rubocop-github 0.18.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -17
- data/STYLEGUIDE.md +395 -92
- data/config/default.yml +1400 -46
- data/config/default_cops.yml +3 -0
- data/config/default_pending.yml +6 -0
- data/config/rails.yml +364 -80
- data/config/rails_cops.yml +50 -0
- data/config/rails_pending.yml +20 -0
- data/lib/rubocop/cop/github/rails_view_render_shorthand.rb +8 -2
- data/lib/rubocop/cop/github.rb +2 -11
- data/lib/rubocop/github/inject.rb +27 -0
- data/lib/rubocop/github.rb +9 -0
- data/lib/rubocop-github-rails.rb +16 -0
- data/lib/rubocop-github.rb +9 -0
- metadata +17 -12
- data/guides/rails-render-inline.md +0 -27
- data/lib/rubocop/cop/github/rails_application_record.rb +0 -29
- data/lib/rubocop/cop/github/rails_render_inline.rb +0 -29
data/config/rails.yml
CHANGED
@@ -1,127 +1,411 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- ./rails_pending.yml
|
3
|
+
|
1
4
|
require:
|
5
|
+
- rubocop-github-rails
|
2
6
|
- rubocop-rails
|
3
7
|
|
4
|
-
Rails/OutputSafety:
|
5
|
-
Enabled: true
|
6
|
-
|
7
|
-
Rails/PluralizationGrammar:
|
8
|
-
Enabled: true
|
9
|
-
|
10
|
-
Rails/RequestReferer:
|
11
|
-
Enabled: true
|
12
|
-
EnforcedStyle: referrer
|
13
|
-
|
14
|
-
Rails/ScopeArgs:
|
15
|
-
Enabled: true
|
16
|
-
|
17
|
-
Rails/UniqBeforePluck:
|
18
|
-
Enabled: true
|
19
|
-
|
20
|
-
GitHub/RailsApplicationRecord:
|
21
|
-
Enabled: true
|
22
|
-
|
23
8
|
GitHub/RailsControllerRenderActionSymbol:
|
24
9
|
Enabled: true
|
25
|
-
Include:
|
26
|
-
- 'app/controllers/**/*.rb'
|
27
10
|
|
28
11
|
GitHub/RailsControllerRenderLiteral:
|
29
12
|
Enabled: true
|
30
|
-
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md
|
31
|
-
Include:
|
32
|
-
- 'app/controllers/**/*.rb'
|
33
13
|
|
34
14
|
GitHub/RailsControllerRenderPathsExist:
|
35
15
|
Enabled: true
|
36
|
-
ViewPath:
|
37
|
-
- 'app/views'
|
38
|
-
Include:
|
39
|
-
- 'app/controllers/**/*.rb'
|
40
16
|
|
41
17
|
GitHub/RailsControllerRenderShorthand:
|
42
18
|
Enabled: true
|
43
|
-
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-shorthand.md
|
44
|
-
Include:
|
45
|
-
- 'app/controllers/**/*.rb'
|
46
|
-
|
47
|
-
GitHub/RailsRenderInline:
|
48
|
-
Enabled: true
|
49
|
-
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-inline.md
|
50
|
-
Include:
|
51
|
-
- 'app/controllers/**/*.rb'
|
52
|
-
- 'app/helpers/**/*.rb'
|
53
|
-
- 'app/view_models/**/*.rb'
|
54
|
-
- 'app/views/**/*.erb'
|
55
19
|
|
56
20
|
GitHub/RailsRenderObjectCollection:
|
57
21
|
Enabled: false
|
58
22
|
|
59
23
|
GitHub/RailsViewRenderLiteral:
|
60
24
|
Enabled: true
|
61
|
-
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md
|
62
|
-
Include:
|
63
|
-
- 'app/helpers/**/*.rb'
|
64
|
-
- 'app/view_models/**/*.rb'
|
65
|
-
- 'app/views/**/*.erb'
|
66
25
|
|
67
26
|
GitHub/RailsViewRenderPathsExist:
|
68
27
|
Enabled: true
|
69
|
-
ViewPath:
|
70
|
-
- 'app/views'
|
71
|
-
Include:
|
72
|
-
- 'app/helpers/**/*.rb'
|
73
|
-
- 'app/view_models/**/*.rb'
|
74
|
-
- 'app/views/**/*.erb'
|
75
28
|
|
76
29
|
GitHub/RailsViewRenderShorthand:
|
77
30
|
Enabled: true
|
78
|
-
Include:
|
79
|
-
- 'app/helpers/**/*.rb'
|
80
|
-
- 'app/view_models/**/*.rb'
|
81
|
-
- 'app/views/**/*.erb'
|
82
|
-
|
83
|
-
# Exclude Rails ERB files from incompatible cops
|
84
31
|
|
85
32
|
Layout/BlockAlignment:
|
86
33
|
Exclude:
|
87
|
-
-
|
34
|
+
- "**/*.erb"
|
88
35
|
|
89
|
-
|
90
|
-
Exclude:
|
91
|
-
- 'app/views/**/*.erb'
|
92
|
-
|
93
|
-
Style/OneLineConditional:
|
36
|
+
Layout/IndentationWidth:
|
94
37
|
Exclude:
|
95
|
-
-
|
38
|
+
- "**/*.erb"
|
96
39
|
|
97
|
-
|
40
|
+
Layout/InitialIndentation:
|
98
41
|
Exclude:
|
99
|
-
-
|
42
|
+
- "**/*.erb"
|
100
43
|
|
101
44
|
Layout/SpaceInsideParens:
|
102
45
|
Exclude:
|
103
|
-
-
|
104
|
-
|
105
|
-
Style/StringLiterals:
|
106
|
-
Exclude:
|
107
|
-
- 'app/views/**/*.erb'
|
46
|
+
- "**/*.erb"
|
108
47
|
|
109
48
|
Layout/TrailingEmptyLines:
|
110
49
|
Exclude:
|
111
|
-
-
|
50
|
+
- "**/*.erb"
|
112
51
|
|
113
52
|
Layout/TrailingWhitespace:
|
114
53
|
Exclude:
|
115
|
-
-
|
54
|
+
- "**/*.erb"
|
116
55
|
|
117
|
-
|
56
|
+
Lint/UselessAccessModifier:
|
57
|
+
ContextCreatingMethods:
|
58
|
+
- concerning
|
59
|
+
|
60
|
+
Rails/ActionControllerTestCase:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Rails/ActionFilter:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Rails/ActiveRecordAliases:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Rails/ActiveRecordCallbacksOrder:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Rails/ActiveRecordOverride:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
Rails/ActiveSupportAliases:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
Rails/AddColumnIndex:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
Rails/AfterCommitOverride:
|
82
|
+
Enabled: false
|
83
|
+
|
84
|
+
Rails/ApplicationController:
|
85
|
+
Enabled: false
|
86
|
+
|
87
|
+
Rails/ApplicationJob:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
Rails/ApplicationMailer:
|
91
|
+
Enabled: false
|
92
|
+
|
93
|
+
Rails/ApplicationRecord:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Rails/ArelStar:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
Rails/AssertNot:
|
100
|
+
Enabled: false
|
101
|
+
|
102
|
+
Rails/AttributeDefaultBlockValue:
|
103
|
+
Enabled: false
|
104
|
+
|
105
|
+
Rails/BelongsTo:
|
106
|
+
Enabled: false
|
107
|
+
|
108
|
+
Rails/Blank:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
Rails/BulkChangeTable:
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
Rails/CompactBlank:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
Rails/ContentTag:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
Rails/CreateTableWithTimestamps:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
Rails/Date:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
Rails/DefaultScope:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Rails/Delegate:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Rails/DelegateAllowBlank:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
Rails/DeprecatedActiveModelErrorsMethods:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
Rails/DotSeparatedKeys:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
Rails/DuplicateAssociation:
|
142
|
+
Enabled: false
|
143
|
+
|
144
|
+
Rails/DuplicateScope:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
Rails/DurationArithmetic:
|
148
|
+
Enabled: false
|
149
|
+
|
150
|
+
Rails/DynamicFindBy:
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
Rails/EagerEvaluationLogMessage:
|
154
|
+
Enabled: false
|
155
|
+
|
156
|
+
Rails/EnumHash:
|
157
|
+
Enabled: false
|
158
|
+
|
159
|
+
Rails/EnumUniqueness:
|
160
|
+
Enabled: false
|
161
|
+
|
162
|
+
Rails/EnvironmentComparison:
|
163
|
+
Enabled: false
|
164
|
+
|
165
|
+
Rails/EnvironmentVariableAccess:
|
166
|
+
Enabled: false
|
167
|
+
|
168
|
+
Rails/Exit:
|
169
|
+
Enabled: false
|
170
|
+
|
171
|
+
Rails/ExpandedDateRange:
|
172
|
+
Enabled: false
|
173
|
+
|
174
|
+
Rails/FilePath:
|
175
|
+
Enabled: false
|
176
|
+
|
177
|
+
Rails/FindBy:
|
178
|
+
Enabled: false
|
179
|
+
|
180
|
+
Rails/FindById:
|
181
|
+
Enabled: false
|
182
|
+
|
183
|
+
Rails/FindEach:
|
184
|
+
Enabled: false
|
185
|
+
|
186
|
+
Rails/HasAndBelongsToMany:
|
187
|
+
Enabled: false
|
188
|
+
|
189
|
+
Rails/HasManyOrHasOneDependent:
|
190
|
+
Enabled: false
|
191
|
+
|
192
|
+
Rails/HelperInstanceVariable:
|
193
|
+
Enabled: false
|
194
|
+
|
195
|
+
Rails/HttpPositionalArguments:
|
196
|
+
Enabled: false
|
197
|
+
|
198
|
+
Rails/HttpStatus:
|
199
|
+
Enabled: false
|
200
|
+
|
201
|
+
Rails/I18nLazyLookup:
|
202
|
+
Enabled: false
|
203
|
+
|
204
|
+
Rails/I18nLocaleAssignment:
|
205
|
+
Enabled: false
|
206
|
+
|
207
|
+
Rails/I18nLocaleTexts:
|
208
|
+
Enabled: false
|
209
|
+
|
210
|
+
Rails/IgnoredSkipActionFilterOption:
|
211
|
+
Enabled: false
|
212
|
+
|
213
|
+
Rails/IndexBy:
|
214
|
+
Enabled: false
|
215
|
+
|
216
|
+
Rails/IndexWith:
|
217
|
+
Enabled: false
|
218
|
+
|
219
|
+
Rails/Inquiry:
|
220
|
+
Enabled: false
|
221
|
+
|
222
|
+
Rails/InverseOf:
|
223
|
+
Enabled: false
|
224
|
+
|
225
|
+
Rails/LexicallyScopedActionFilter:
|
226
|
+
Enabled: false
|
227
|
+
|
228
|
+
Rails/LinkToBlank:
|
229
|
+
Enabled: false
|
230
|
+
|
231
|
+
Rails/MailerName:
|
232
|
+
Enabled: false
|
233
|
+
|
234
|
+
Rails/MatchRoute:
|
235
|
+
Enabled: false
|
236
|
+
|
237
|
+
Rails/MigrationClassName:
|
238
|
+
Enabled: false
|
239
|
+
|
240
|
+
Rails/NegateInclude:
|
241
|
+
Enabled: false
|
242
|
+
|
243
|
+
Rails/NotNullColumn:
|
244
|
+
Enabled: false
|
245
|
+
|
246
|
+
Rails/OrderById:
|
247
|
+
Enabled: false
|
248
|
+
|
249
|
+
Rails/Output:
|
250
|
+
Enabled: false
|
251
|
+
|
252
|
+
Rails/OutputSafety:
|
253
|
+
Enabled: true
|
254
|
+
|
255
|
+
Rails/Pick:
|
256
|
+
Enabled: false
|
257
|
+
|
258
|
+
Rails/Pluck:
|
259
|
+
Enabled: false
|
260
|
+
|
261
|
+
Rails/PluckId:
|
262
|
+
Enabled: false
|
263
|
+
|
264
|
+
Rails/PluckInWhere:
|
265
|
+
Enabled: false
|
266
|
+
|
267
|
+
Rails/PluralizationGrammar:
|
268
|
+
Enabled: true
|
269
|
+
|
270
|
+
Rails/Presence:
|
271
|
+
Enabled: false
|
272
|
+
|
273
|
+
Rails/Present:
|
274
|
+
Enabled: false
|
275
|
+
|
276
|
+
Rails/RakeEnvironment:
|
277
|
+
Enabled: false
|
278
|
+
|
279
|
+
Rails/ReadWriteAttribute:
|
280
|
+
Enabled: false
|
281
|
+
|
282
|
+
Rails/RedundantAllowNil:
|
283
|
+
Enabled: false
|
284
|
+
|
285
|
+
Rails/RedundantForeignKey:
|
286
|
+
Enabled: false
|
287
|
+
|
288
|
+
Rails/RedundantPresenceValidationOnBelongsTo:
|
289
|
+
Enabled: false
|
290
|
+
|
291
|
+
Rails/RedundantReceiverInWithOptions:
|
292
|
+
Enabled: false
|
293
|
+
|
294
|
+
Rails/RedundantTravelBack:
|
295
|
+
Enabled: false
|
296
|
+
|
297
|
+
Rails/ReflectionClassName:
|
298
|
+
Enabled: false
|
299
|
+
|
300
|
+
Rails/RefuteMethods:
|
301
|
+
Enabled: false
|
302
|
+
|
303
|
+
Rails/RelativeDateConstant:
|
304
|
+
Enabled: false
|
305
|
+
|
306
|
+
Rails/RenderInline:
|
307
|
+
Enabled: true
|
308
|
+
|
309
|
+
Rails/RenderPlainText:
|
310
|
+
Enabled: false
|
311
|
+
|
312
|
+
Rails/RequestReferer:
|
313
|
+
Enabled: true
|
314
|
+
EnforcedStyle: referrer
|
315
|
+
|
316
|
+
Rails/RequireDependency:
|
317
|
+
Enabled: false
|
318
|
+
|
319
|
+
Rails/ReversibleMigration:
|
320
|
+
Enabled: false
|
321
|
+
|
322
|
+
Rails/ReversibleMigrationMethodDefinition:
|
323
|
+
Enabled: false
|
324
|
+
|
325
|
+
Rails/RootJoinChain:
|
326
|
+
Enabled: false
|
327
|
+
|
328
|
+
Rails/RootPublicPath:
|
329
|
+
Enabled: false
|
330
|
+
|
331
|
+
Rails/SafeNavigation:
|
332
|
+
Enabled: false
|
333
|
+
|
334
|
+
Rails/SafeNavigationWithBlank:
|
335
|
+
Enabled: false
|
336
|
+
|
337
|
+
Rails/SaveBang:
|
338
|
+
Enabled: false
|
339
|
+
|
340
|
+
Rails/SchemaComment:
|
341
|
+
Enabled: false
|
342
|
+
|
343
|
+
Rails/ScopeArgs:
|
344
|
+
Enabled: true
|
345
|
+
|
346
|
+
Rails/ShortI18n:
|
347
|
+
Enabled: false
|
348
|
+
|
349
|
+
Rails/SkipsModelValidations:
|
350
|
+
Enabled: false
|
351
|
+
|
352
|
+
Rails/SquishedSQLHeredocs:
|
353
|
+
Enabled: false
|
354
|
+
|
355
|
+
Rails/StripHeredoc:
|
356
|
+
Enabled: false
|
357
|
+
|
358
|
+
Rails/TableNameAssignment:
|
359
|
+
Enabled: false
|
360
|
+
|
361
|
+
Rails/TimeZone:
|
362
|
+
Enabled: false
|
363
|
+
|
364
|
+
Rails/TimeZoneAssignment:
|
365
|
+
Enabled: false
|
366
|
+
|
367
|
+
Rails/ToFormattedS:
|
368
|
+
Enabled: false
|
369
|
+
|
370
|
+
Rails/TransactionExitStatement:
|
371
|
+
Enabled: false
|
372
|
+
|
373
|
+
Rails/UniqBeforePluck:
|
374
|
+
Enabled: true
|
375
|
+
|
376
|
+
Rails/UniqueValidationWithoutIndex:
|
377
|
+
Enabled: false
|
378
|
+
|
379
|
+
Rails/UnknownEnv:
|
380
|
+
Enabled: false
|
381
|
+
|
382
|
+
Rails/UnusedIgnoredColumns:
|
383
|
+
Enabled: false
|
384
|
+
|
385
|
+
Rails/Validation:
|
386
|
+
Enabled: false
|
387
|
+
|
388
|
+
Rails/WhereEquals:
|
389
|
+
Enabled: false
|
390
|
+
|
391
|
+
Rails/WhereExists:
|
392
|
+
Enabled: false
|
393
|
+
|
394
|
+
Rails/WhereNot:
|
395
|
+
Enabled: false
|
396
|
+
|
397
|
+
Style/For:
|
118
398
|
Exclude:
|
119
|
-
-
|
399
|
+
- "**/*.erb"
|
120
400
|
|
121
|
-
|
401
|
+
Style/OneLineConditional:
|
122
402
|
Exclude:
|
123
|
-
-
|
403
|
+
- "**/*.erb"
|
124
404
|
|
125
|
-
|
126
|
-
|
127
|
-
-
|
405
|
+
Style/Semicolon:
|
406
|
+
Exclude:
|
407
|
+
- "**/*.erb"
|
408
|
+
|
409
|
+
Style/StringLiterals:
|
410
|
+
Exclude:
|
411
|
+
- "**/*.erb"
|
@@ -0,0 +1,50 @@
|
|
1
|
+
GitHub/RailsControllerRenderActionSymbol:
|
2
|
+
Enabled: pending
|
3
|
+
Include:
|
4
|
+
- 'app/controllers/**/*.rb'
|
5
|
+
|
6
|
+
GitHub/RailsControllerRenderLiteral:
|
7
|
+
Enabled: pending
|
8
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/guides/rails-render-literal.md
|
9
|
+
Include:
|
10
|
+
- 'app/controllers/**/*.rb'
|
11
|
+
|
12
|
+
GitHub/RailsControllerRenderPathsExist:
|
13
|
+
Enabled: pending
|
14
|
+
ViewPath:
|
15
|
+
- 'app/views'
|
16
|
+
Include:
|
17
|
+
- 'app/controllers/**/*.rb'
|
18
|
+
|
19
|
+
GitHub/RailsControllerRenderShorthand:
|
20
|
+
Enabled: pending
|
21
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/guides/rails-controller-render-shorthand.md
|
22
|
+
Include:
|
23
|
+
- 'app/controllers/**/*.rb'
|
24
|
+
|
25
|
+
GitHub/RailsRenderObjectCollection:
|
26
|
+
Enabled: pending
|
27
|
+
|
28
|
+
GitHub/RailsViewRenderLiteral:
|
29
|
+
Enabled: pending
|
30
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/main/guides/rails-render-literal.md
|
31
|
+
Include:
|
32
|
+
- 'app/helpers/**/*.rb'
|
33
|
+
- 'app/view_models/**/*.rb'
|
34
|
+
- 'app/views/**/*.erb'
|
35
|
+
|
36
|
+
GitHub/RailsViewRenderPathsExist:
|
37
|
+
Enabled: pending
|
38
|
+
ViewPath:
|
39
|
+
- 'app/views'
|
40
|
+
Include:
|
41
|
+
- 'app/helpers/**/*.rb'
|
42
|
+
- 'app/view_models/**/*.rb'
|
43
|
+
- 'app/views/**/*.erb'
|
44
|
+
|
45
|
+
GitHub/RailsViewRenderShorthand:
|
46
|
+
Enabled: pending
|
47
|
+
Include:
|
48
|
+
- 'app/helpers/**/*.rb'
|
49
|
+
- 'app/view_models/**/*.rb'
|
50
|
+
- 'app/views/**/*.erb'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Rails/ActionControllerFlashBeforeRender: # new in 2.16
|
2
|
+
Enabled: false
|
3
|
+
Rails/ActionOrder: # new in 2.17
|
4
|
+
Enabled: false
|
5
|
+
Rails/ActiveSupportOnLoad: # new in 2.16
|
6
|
+
Enabled: false
|
7
|
+
Rails/FreezeTime: # new in 2.16
|
8
|
+
Enabled: false
|
9
|
+
Rails/IgnoredColumnsAssignment: # new in 2.17
|
10
|
+
Enabled: false
|
11
|
+
Rails/RootPathnameMethods: # new in 2.16
|
12
|
+
Enabled: false
|
13
|
+
Rails/ToSWithArgument: # new in 2.16
|
14
|
+
Enabled: false
|
15
|
+
Rails/TopLevelHashWithIndifferentAccess: # new in 2.16
|
16
|
+
Enabled: false
|
17
|
+
Rails/WhereMissing: # new in 2.16
|
18
|
+
Enabled: false
|
19
|
+
Rails/WhereNotWithMultipleConditions: # new in 2.17
|
20
|
+
Enabled: false
|
@@ -6,6 +6,8 @@ module RuboCop
|
|
6
6
|
module Cop
|
7
7
|
module GitHub
|
8
8
|
class RailsViewRenderShorthand < Base
|
9
|
+
extend AutoCorrector
|
10
|
+
|
9
11
|
MSG = "Prefer `render` partial shorthand"
|
10
12
|
|
11
13
|
def_node_matcher :render_with_options?, <<-PATTERN
|
@@ -26,9 +28,13 @@ module RuboCop
|
|
26
28
|
locals_key = option_pairs.map { |pair| locals_key?(pair) }.compact.first
|
27
29
|
|
28
30
|
if option_pairs.length == 1 && partial_key
|
29
|
-
add_offense(node, message: "Use `render #{partial_key.source}` instead")
|
31
|
+
add_offense(node, message: "Use `render #{partial_key.source}` instead") do |corrector|
|
32
|
+
corrector.replace(node.source_range, "render #{partial_key.source}")
|
33
|
+
end
|
30
34
|
elsif option_pairs.length == 2 && partial_key && locals_key
|
31
|
-
add_offense(node, message: "Use `render #{partial_key.source}, #{locals_key.source}` instead")
|
35
|
+
add_offense(node, message: "Use `render #{partial_key.source}, #{locals_key.source}` instead") do |corrector|
|
36
|
+
corrector.replace(node.source_range, "render #{partial_key.source}, #{locals_key.source}")
|
37
|
+
end
|
32
38
|
end
|
33
39
|
end
|
34
40
|
end
|
data/lib/rubocop/cop/github.rb
CHANGED
@@ -1,13 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "rubocop
|
4
|
-
require "rubocop
|
5
|
-
require "rubocop/cop/github/rails_controller_render_action_symbol"
|
6
|
-
require "rubocop/cop/github/rails_controller_render_literal"
|
7
|
-
require "rubocop/cop/github/rails_controller_render_paths_exist"
|
8
|
-
require "rubocop/cop/github/rails_controller_render_shorthand"
|
9
|
-
require "rubocop/cop/github/rails_render_inline"
|
10
|
-
require "rubocop/cop/github/rails_render_object_collection"
|
11
|
-
require "rubocop/cop/github/rails_view_render_literal"
|
12
|
-
require "rubocop/cop/github/rails_view_render_paths_exist"
|
13
|
-
require "rubocop/cop/github/rails_view_render_shorthand"
|
3
|
+
require "rubocop-github"
|
4
|
+
require "rubocop-rails"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module GitHub
|
5
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
6
|
+
# bit of our configuration. Borrowed from:
|
7
|
+
# https://github.com/rubocop/rubocop-rails/blob/f36121946359615a26c9a941763abd1470693e8d/lib/rubocop/rails/inject.rb
|
8
|
+
module Inject
|
9
|
+
def self.default_defaults!
|
10
|
+
_load_config(CONFIG_DEFAULT)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.rails_defaults!
|
14
|
+
_load_config(CONFIG_RAILS)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self._load_config(path)
|
18
|
+
path = path.to_s
|
19
|
+
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
20
|
+
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
21
|
+
puts "configuration from #{path}" if ConfigLoader.debug?
|
22
|
+
config = ConfigLoader.merge_with_default(config, path, unset_nil: false)
|
23
|
+
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module GitHub
|
5
|
+
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
6
|
+
CONFIG_DEFAULT = PROJECT_ROOT.join("config", "default_cops.yml").freeze
|
7
|
+
CONFIG_RAILS = PROJECT_ROOT.join("config", "rails_cops.yml").freeze
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
require "rubocop/github"
|
5
|
+
require "rubocop/github/inject"
|
6
|
+
|
7
|
+
RuboCop::GitHub::Inject.rails_defaults!
|
8
|
+
|
9
|
+
require "rubocop/cop/github/rails_controller_render_action_symbol"
|
10
|
+
require "rubocop/cop/github/rails_controller_render_literal"
|
11
|
+
require "rubocop/cop/github/rails_controller_render_paths_exist"
|
12
|
+
require "rubocop/cop/github/rails_controller_render_shorthand"
|
13
|
+
require "rubocop/cop/github/rails_render_object_collection"
|
14
|
+
require "rubocop/cop/github/rails_view_render_literal"
|
15
|
+
require "rubocop/cop/github/rails_view_render_paths_exist"
|
16
|
+
require "rubocop/cop/github/rails_view_render_shorthand"
|