rubocop-github 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58ddfb6fbfe780a05b368dea76dc36274bc05065088e606592ba87dd82372e65
4
- data.tar.gz: 209ce2b5181fa610a44a704df33b2571ad8034c1eb0e0be7620530f31ba707bb
3
+ metadata.gz: c5b56ddce6224d4cc8897485c8b2444083404d936b7074dfe03ed028e46370bc
4
+ data.tar.gz: 403516d512659040d2b0a331ead52c14ecb4784642372f5bfb9b077d7ef53e0d
5
5
  SHA512:
6
- metadata.gz: 36d6bfbc4936221bd01eeffa1667a5f421aca8039b134d3918e9587be3b8778819062d42e4f464b93c62ff3caecb297d4ace38c3d214b94289a1a02c69b9d81a
7
- data.tar.gz: dadce863318b8ca16f6f3f5a0fd8e9827cc992df3f1e925d57f5711e12d79bff79996a451f0fa81ae795d46971ea8a17fb727d4db6756a8194449228b8310f90
6
+ metadata.gz: 353618467c3b7b29b872ef5df95018b11d42e511fea60962c55d80990c3c890599288e320ac6bbf89c4e047c55f8485eb7ad8ab053c080d2bc61a6e504af0560
7
+ data.tar.gz: 6c655140331052725d30d4d862d0a34bc04eba2ca069990ced123d6c94ec15ce500c09c5d15f30d3fd56ad9532eb795e0b47f6ffb1b4029a29fb6f319c143fb6
data/README.md CHANGED
@@ -2,11 +2,16 @@
2
2
 
3
3
  This repository provides recommended RuboCop configuration and additional Cops for use on GitHub open source and internal Ruby projects.
4
4
 
5
- ## Installation
5
+ ## Usage
6
+
7
+ Rubocop 0.68 removed performance cops and 0.72 removed Rails cops. However, upgrading `rubocop-github` without modification will almost definitely create very many new offenses. The current version of this gem exposes the "legacy" configuration under `config/default.yml` and `config/rails.yml` which should be used *if and only if* the version of rubocop is locked to `< 0.68` in your project (which it should be unless you `bundle update rubocop`). It also exposes an "edge" configuration under `config/default_edge.yml` and `config/rails_edge.yml` so that the changes can be tested without introducing breaking changes.
8
+
9
+ ### Legacy usage
6
10
 
7
11
  **Gemfile**
8
12
 
9
13
  ``` ruby
14
+ gem "rubocop", "< 0.68"
10
15
  gem "rubocop-github"
11
16
  ```
12
17
 
@@ -19,6 +24,25 @@ inherit_gem:
19
24
  - config/rails.yml
20
25
  ```
21
26
 
27
+ ### Edge usage
28
+
29
+ **Gemfile**
30
+
31
+ ``` ruby
32
+ gem "rubocop-github"
33
+ gem "rubocop-performance", require: false
34
+ gem "rubocop-rails", require: false
35
+ ```
36
+
37
+ **.rubocop.yml**
38
+
39
+ ``` yaml
40
+ inherit_gem:
41
+ rubocop-github:
42
+ - config/default_edge.yml
43
+ - config/rails_edge.yml
44
+ ```
45
+
22
46
  ## Testing
23
47
 
24
48
  `bundle install`
@@ -0,0 +1,325 @@
1
+ require: rubocop/cop/github
2
+
3
+ # These cops are compatible across supported versions of rubocop
4
+
5
+ Bundler/DuplicatedGem:
6
+ Enabled: true
7
+
8
+ Bundler/OrderedGems:
9
+ Enabled: true
10
+
11
+ Layout/BlockAlignment:
12
+ Enabled: true
13
+
14
+ Layout/BlockEndNewline:
15
+ Enabled: true
16
+
17
+ Layout/ConditionPosition:
18
+ Enabled: true
19
+
20
+ Layout/DefEndAlignment:
21
+ Enabled: true
22
+
23
+ Layout/EndAlignment:
24
+ Enabled: false
25
+
26
+ Layout/EndOfLine:
27
+ Enabled: true
28
+
29
+ Layout/InitialIndentation:
30
+ Enabled: true
31
+
32
+ Layout/SpaceAfterColon:
33
+ Enabled: true
34
+
35
+ Layout/SpaceAfterComma:
36
+ Enabled: true
37
+
38
+ Layout/SpaceAfterMethodName:
39
+ Enabled: true
40
+
41
+ Layout/SpaceAfterNot:
42
+ Enabled: true
43
+
44
+ Layout/SpaceAfterSemicolon:
45
+ Enabled: true
46
+
47
+ Layout/SpaceAroundBlockParameters:
48
+ Enabled: true
49
+
50
+ Layout/SpaceAroundEqualsInParameterDefault:
51
+ Enabled: true
52
+
53
+ Layout/SpaceBeforeBlockBraces:
54
+ Enabled: true
55
+
56
+ Layout/SpaceInsideArrayLiteralBrackets:
57
+ Enabled: true
58
+ EnforcedStyle: no_space
59
+
60
+ Layout/SpaceInsideArrayPercentLiteral:
61
+ Enabled: true
62
+
63
+ Layout/SpaceInsideBlockBraces:
64
+ Enabled: true
65
+
66
+ Layout/SpaceInsideParens:
67
+ Enabled: true
68
+
69
+ Layout/SpaceInsideRangeLiteral:
70
+ Enabled: true
71
+
72
+ Layout/SpaceInsideReferenceBrackets:
73
+ Enabled: true
74
+
75
+ Layout/Tab:
76
+ Enabled: true
77
+
78
+ Layout/TrailingEmptyLines:
79
+ Enabled: true
80
+
81
+ Layout/TrailingWhitespace:
82
+ Enabled: true
83
+
84
+ Lint/CircularArgumentReference:
85
+ Enabled: true
86
+
87
+ Lint/Debugger:
88
+ Enabled: true
89
+
90
+ Lint/DeprecatedClassMethods:
91
+ Enabled: true
92
+
93
+ Lint/DuplicateMethods:
94
+ Enabled: true
95
+
96
+ Lint/DuplicateHashKey:
97
+ Enabled: true
98
+
99
+ Lint/EachWithObjectArgument:
100
+ Enabled: true
101
+
102
+ Lint/ElseLayout:
103
+ Enabled: true
104
+
105
+ Lint/EmptyEnsure:
106
+ Enabled: true
107
+
108
+ Lint/EmptyInterpolation:
109
+ Enabled: true
110
+
111
+ Lint/EndInMethod:
112
+ Enabled: true
113
+
114
+ Lint/EnsureReturn:
115
+ Enabled: true
116
+
117
+ Lint/FlipFlop:
118
+ Enabled: true
119
+
120
+ Lint/FloatOutOfRange:
121
+ Enabled: true
122
+
123
+ Lint/FormatParameterMismatch:
124
+ Enabled: true
125
+
126
+ Lint/LiteralAsCondition:
127
+ Enabled: true
128
+
129
+ Lint/LiteralInInterpolation:
130
+ Enabled: true
131
+
132
+ Lint/Loop:
133
+ Enabled: true
134
+
135
+ Lint/NextWithoutAccumulator:
136
+ Enabled: true
137
+
138
+ Lint/RandOne:
139
+ Enabled: true
140
+
141
+ Lint/RequireParentheses:
142
+ Enabled: true
143
+
144
+ Lint/RescueException:
145
+ Enabled: true
146
+
147
+ Lint/RedundantStringCoercion:
148
+ Enabled: true
149
+
150
+ Lint/UnderscorePrefixedVariableName:
151
+ Enabled: true
152
+
153
+ Lint/RedundantCopDisableDirective:
154
+ Enabled: true
155
+
156
+ Lint/RedundantSplatExpansion:
157
+ Enabled: true
158
+
159
+ Lint/UnreachableCode:
160
+ Enabled: true
161
+
162
+ Lint/UselessComparison:
163
+ Enabled: true
164
+
165
+ Lint/UselessSetterCall:
166
+ Enabled: true
167
+
168
+ Lint/Void:
169
+ Enabled: true
170
+
171
+ Metrics/AbcSize:
172
+ Enabled: false
173
+
174
+ Metrics/BlockLength:
175
+ Enabled: false
176
+
177
+ Metrics/BlockNesting:
178
+ Enabled: false
179
+
180
+ Metrics/ClassLength:
181
+ Enabled: false
182
+
183
+ Metrics/CyclomaticComplexity:
184
+ Enabled: false
185
+
186
+ Metrics/LineLength:
187
+ Enabled: false
188
+
189
+ Metrics/MethodLength:
190
+ Enabled: false
191
+
192
+ Metrics/ModuleLength:
193
+ Enabled: false
194
+
195
+ Metrics/ParameterLists:
196
+ Enabled: false
197
+
198
+ Metrics/PerceivedComplexity:
199
+ Enabled: false
200
+
201
+ Naming/AsciiIdentifiers:
202
+ Enabled: true
203
+
204
+ Naming/ClassAndModuleCamelCase:
205
+ Enabled: true
206
+
207
+ Naming/FileName:
208
+ Enabled: true
209
+
210
+ Naming/MethodName:
211
+ Enabled: true
212
+
213
+ Performance/CaseWhenSplat:
214
+ Enabled: false
215
+
216
+ Performance/Count:
217
+ Enabled: true
218
+
219
+ Performance/Detect:
220
+ Enabled: true
221
+
222
+ Performance/DoubleStartEndWith:
223
+ Enabled: true
224
+
225
+ Performance/EndWith:
226
+ Enabled: true
227
+
228
+ Performance/FlatMap:
229
+ Enabled: true
230
+
231
+ Performance/RangeInclude:
232
+ Enabled: false
233
+
234
+ Performance/RedundantMatch:
235
+ Enabled: false
236
+
237
+ Performance/RedundantMerge:
238
+ Enabled: true
239
+ MaxKeyValuePairs: 1
240
+
241
+ Performance/ReverseEach:
242
+ Enabled: true
243
+
244
+ Performance/Size:
245
+ Enabled: true
246
+
247
+ Performance/StartWith:
248
+ Enabled: true
249
+
250
+ Security/Eval:
251
+ Enabled: true
252
+
253
+ Style/ArrayJoin:
254
+ Enabled: true
255
+
256
+ Style/BeginBlock:
257
+ Enabled: true
258
+
259
+ Style/BlockComments:
260
+ Enabled: true
261
+
262
+ Style/CaseEquality:
263
+ Enabled: true
264
+
265
+ Style/CharacterLiteral:
266
+ Enabled: true
267
+
268
+ Style/ClassMethods:
269
+ Enabled: true
270
+
271
+ Style/Copyright:
272
+ Enabled: false
273
+
274
+ Style/DefWithParentheses:
275
+ Enabled: true
276
+
277
+ Style/EndBlock:
278
+ Enabled: true
279
+
280
+ Style/For:
281
+ Enabled: true
282
+
283
+ Style/FrozenStringLiteralComment:
284
+ Enabled: true
285
+
286
+ Style/HashSyntax:
287
+ Enabled: true
288
+ EnforcedStyle: ruby19_no_mixed_keys
289
+
290
+ Style/LambdaCall:
291
+ Enabled: true
292
+
293
+ Style/MethodCallWithoutArgsParentheses:
294
+ Enabled: true
295
+
296
+ Style/MethodDefParentheses:
297
+ Enabled: true
298
+
299
+ Style/MultilineIfThen:
300
+ Enabled: true
301
+
302
+ Style/NilComparison:
303
+ Enabled: true
304
+
305
+ Style/Not:
306
+ Enabled: true
307
+
308
+ Style/OneLineConditional:
309
+ Enabled: true
310
+
311
+ Style/RedundantSortBy:
312
+ Enabled: true
313
+
314
+ Style/Sample:
315
+ Enabled: true
316
+
317
+ Style/StabbyLambdaParentheses:
318
+ Enabled: true
319
+
320
+ Style/Strip:
321
+ Enabled: true
322
+
323
+ Style/StringLiterals:
324
+ Enabled: true
325
+ EnforcedStyle: double_quotes
@@ -0,0 +1,120 @@
1
+ Rails/OutputSafety:
2
+ Enabled: true
3
+
4
+ Rails/PluralizationGrammar:
5
+ Enabled: true
6
+
7
+ Rails/RequestReferer:
8
+ Enabled: true
9
+ EnforcedStyle: referrer
10
+
11
+ Rails/ScopeArgs:
12
+ Enabled: true
13
+
14
+ Rails/UniqBeforePluck:
15
+ Enabled: true
16
+
17
+ GitHub/RailsApplicationRecord:
18
+ Enabled: true
19
+
20
+ GitHub/RailsControllerRenderActionSymbol:
21
+ Enabled: true
22
+ Include:
23
+ - 'app/controllers/**/*.rb'
24
+
25
+ GitHub/RailsControllerRenderLiteral:
26
+ Enabled: true
27
+ StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md
28
+ Include:
29
+ - 'app/controllers/**/*.rb'
30
+
31
+ GitHub/RailsControllerRenderPathsExist:
32
+ Enabled: true
33
+ ViewPath:
34
+ - 'app/views'
35
+ Include:
36
+ - 'app/controllers/**/*.rb'
37
+
38
+ GitHub/RailsControllerRenderShorthand:
39
+ Enabled: true
40
+ StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-shorthand.md
41
+ Include:
42
+ - 'app/controllers/**/*.rb'
43
+
44
+ GitHub/RailsRenderInline:
45
+ Enabled: true
46
+ StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-inline.md
47
+ Include:
48
+ - 'app/controllers/**/*.rb'
49
+ - 'app/helpers/**/*.rb'
50
+ - 'app/view_models/**/*.rb'
51
+ - 'app/views/**/*.erb'
52
+
53
+ GitHub/RailsRenderObjectCollection:
54
+ Enabled: false
55
+
56
+ GitHub/RailsViewRenderLiteral:
57
+ Enabled: true
58
+ StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md
59
+ Include:
60
+ - 'app/helpers/**/*.rb'
61
+ - 'app/view_models/**/*.rb'
62
+ - 'app/views/**/*.erb'
63
+
64
+ GitHub/RailsViewRenderPathsExist:
65
+ Enabled: true
66
+ ViewPath:
67
+ - 'app/views'
68
+ Include:
69
+ - 'app/helpers/**/*.rb'
70
+ - 'app/view_models/**/*.rb'
71
+ - 'app/views/**/*.erb'
72
+
73
+ GitHub/RailsViewRenderShorthand:
74
+ Enabled: true
75
+ Include:
76
+ - 'app/helpers/**/*.rb'
77
+ - 'app/view_models/**/*.rb'
78
+ - 'app/views/**/*.erb'
79
+
80
+ # Exclude Rails ERB files from incompatible cops
81
+
82
+ Layout/BlockAlignment:
83
+ Exclude:
84
+ - 'app/views/**/*.erb'
85
+
86
+ Style/For:
87
+ Exclude:
88
+ - 'app/views/**/*.erb'
89
+
90
+ Style/OneLineConditional:
91
+ Exclude:
92
+ - 'app/views/**/*.erb'
93
+
94
+ Style/Semicolon:
95
+ Exclude:
96
+ - 'app/views/**/*.erb'
97
+
98
+ Layout/SpaceInsideParens:
99
+ Exclude:
100
+ - 'app/views/**/*.erb'
101
+
102
+ Style/StringLiterals:
103
+ Exclude:
104
+ - 'app/views/**/*.erb'
105
+
106
+ Layout/TrailingEmptyLines:
107
+ Exclude:
108
+ - 'app/views/**/*.erb'
109
+
110
+ Layout/TrailingWhitespace:
111
+ Exclude:
112
+ - 'app/views/**/*.erb'
113
+
114
+ Layout/InitialIndentation:
115
+ Exclude:
116
+ - 'app/views/**/*.erb'
117
+
118
+ Lint/UselessAccessModifier:
119
+ ContextCreatingMethods:
120
+ - concerning
@@ -1,328 +1,2 @@
1
- require:
2
- - rubocop/cop/github
3
- - rubocop-performance
4
-
5
- AllCops:
6
- DisabledByDefault: true
7
-
8
- Bundler/DuplicatedGem:
9
- Enabled: true
10
-
11
- Bundler/OrderedGems:
12
- Enabled: true
13
-
14
- Layout/BlockAlignment:
15
- Enabled: true
16
-
17
- Layout/BlockEndNewline:
18
- Enabled: true
19
-
20
- Layout/ConditionPosition:
21
- Enabled: true
22
-
23
- Layout/DefEndAlignment:
24
- Enabled: true
25
-
26
- Layout/EndAlignment:
27
- Enabled: false
28
-
29
- Layout/EndOfLine:
30
- Enabled: true
31
-
32
- Layout/InitialIndentation:
33
- Enabled: true
34
-
35
- Layout/SpaceAfterColon:
36
- Enabled: true
37
-
38
- Layout/SpaceAfterComma:
39
- Enabled: true
40
-
41
- Layout/SpaceAfterMethodName:
42
- Enabled: true
43
-
44
- Layout/SpaceAfterNot:
45
- Enabled: true
46
-
47
- Layout/SpaceAfterSemicolon:
48
- Enabled: true
49
-
50
- Layout/SpaceAroundBlockParameters:
51
- Enabled: true
52
-
53
- Layout/SpaceAroundEqualsInParameterDefault:
54
- Enabled: true
55
-
56
- Layout/SpaceBeforeBlockBraces:
57
- Enabled: true
58
-
59
- Layout/SpaceInsideArrayLiteralBrackets:
60
- Enabled: true
61
- EnforcedStyle: no_space
62
-
63
- Layout/SpaceInsideArrayPercentLiteral:
64
- Enabled: true
65
-
66
- Layout/SpaceInsideBlockBraces:
67
- Enabled: true
68
-
69
- Layout/SpaceInsideParens:
70
- Enabled: true
71
-
72
- Layout/SpaceInsideRangeLiteral:
73
- Enabled: true
74
-
75
- Layout/SpaceInsideReferenceBrackets:
76
- Enabled: true
77
-
78
- Layout/Tab:
79
- Enabled: true
80
-
81
- Layout/TrailingBlankLines:
82
- Enabled: true
83
-
84
- Layout/TrailingWhitespace:
85
- Enabled: true
86
-
87
- Lint/CircularArgumentReference:
88
- Enabled: true
89
-
90
- Lint/Debugger:
91
- Enabled: true
92
-
93
- Lint/DeprecatedClassMethods:
94
- Enabled: true
95
-
96
- Lint/DuplicateMethods:
97
- Enabled: true
98
-
99
- Lint/DuplicatedKey:
100
- Enabled: true
101
-
102
- Lint/EachWithObjectArgument:
103
- Enabled: true
104
-
105
- Lint/ElseLayout:
106
- Enabled: true
107
-
108
- Lint/EmptyEnsure:
109
- Enabled: true
110
-
111
- Lint/EmptyInterpolation:
112
- Enabled: true
113
-
114
- Lint/EndInMethod:
115
- Enabled: true
116
-
117
- Lint/EnsureReturn:
118
- Enabled: true
119
-
120
- Lint/FlipFlop:
121
- Enabled: true
122
-
123
- Lint/FloatOutOfRange:
124
- Enabled: true
125
-
126
- Lint/FormatParameterMismatch:
127
- Enabled: true
128
-
129
- Lint/LiteralAsCondition:
130
- Enabled: true
131
-
132
- Lint/LiteralInInterpolation:
133
- Enabled: true
134
-
135
- Lint/Loop:
136
- Enabled: true
137
-
138
- Lint/NextWithoutAccumulator:
139
- Enabled: true
140
-
141
- Lint/RandOne:
142
- Enabled: true
143
-
144
- Lint/RequireParentheses:
145
- Enabled: true
146
-
147
- Lint/RescueException:
148
- Enabled: true
149
-
150
- Lint/StringConversionInInterpolation:
151
- Enabled: true
152
-
153
- Lint/UnderscorePrefixedVariableName:
154
- Enabled: true
155
-
156
- Lint/UnneededCopDisableDirective:
157
- Enabled: true
158
-
159
- Lint/UnneededSplatExpansion:
160
- Enabled: true
161
-
162
- Lint/UnreachableCode:
163
- Enabled: true
164
-
165
- Lint/UselessComparison:
166
- Enabled: true
167
-
168
- Lint/UselessSetterCall:
169
- Enabled: true
170
-
171
- Lint/Void:
172
- Enabled: true
173
-
174
- Metrics/AbcSize:
175
- Enabled: false
176
-
177
- Metrics/BlockLength:
178
- Enabled: false
179
-
180
- Metrics/BlockNesting:
181
- Enabled: false
182
-
183
- Metrics/ClassLength:
184
- Enabled: false
185
-
186
- Metrics/CyclomaticComplexity:
187
- Enabled: false
188
-
189
- Metrics/LineLength:
190
- Enabled: false
191
-
192
- Metrics/MethodLength:
193
- Enabled: false
194
-
195
- Metrics/ModuleLength:
196
- Enabled: false
197
-
198
- Metrics/ParameterLists:
199
- Enabled: false
200
-
201
- Metrics/PerceivedComplexity:
202
- Enabled: false
203
-
204
- Naming/AsciiIdentifiers:
205
- Enabled: true
206
-
207
- Naming/ClassAndModuleCamelCase:
208
- Enabled: true
209
-
210
- Naming/FileName:
211
- Enabled: true
212
-
213
- Naming/MethodName:
214
- Enabled: true
215
-
216
- Performance/CaseWhenSplat:
217
- Enabled: false
218
-
219
- Performance/Count:
220
- Enabled: true
221
-
222
- Performance/Detect:
223
- Enabled: true
224
-
225
- Performance/DoubleStartEndWith:
226
- Enabled: true
227
-
228
- Performance/EndWith:
229
- Enabled: true
230
-
231
- Performance/FlatMap:
232
- Enabled: true
233
-
234
- Performance/RangeInclude:
235
- Enabled: false
236
-
237
- Performance/RedundantMatch:
238
- Enabled: false
239
-
240
- Performance/RedundantMerge:
241
- Enabled: true
242
- MaxKeyValuePairs: 1
243
-
244
- Performance/ReverseEach:
245
- Enabled: true
246
-
247
- Performance/Size:
248
- Enabled: true
249
-
250
- Performance/StartWith:
251
- Enabled: true
252
-
253
- Security/Eval:
254
- Enabled: true
255
-
256
- Style/ArrayJoin:
257
- Enabled: true
258
-
259
- Style/BeginBlock:
260
- Enabled: true
261
-
262
- Style/BlockComments:
263
- Enabled: true
264
-
265
- Style/CaseEquality:
266
- Enabled: true
267
-
268
- Style/CharacterLiteral:
269
- Enabled: true
270
-
271
- Style/ClassMethods:
272
- Enabled: true
273
-
274
- Style/Copyright:
275
- Enabled: false
276
-
277
- Style/DefWithParentheses:
278
- Enabled: true
279
-
280
- Style/EndBlock:
281
- Enabled: true
282
-
283
- Style/For:
284
- Enabled: true
285
-
286
- Style/FrozenStringLiteralComment:
287
- Enabled: true
288
-
289
- Style/HashSyntax:
290
- Enabled: true
291
- EnforcedStyle: ruby19_no_mixed_keys
292
-
293
- Style/LambdaCall:
294
- Enabled: true
295
-
296
- Style/MethodCallWithoutArgsParentheses:
297
- Enabled: true
298
-
299
- Style/MethodDefParentheses:
300
- Enabled: true
301
-
302
- Style/MultilineIfThen:
303
- Enabled: true
304
-
305
- Style/NilComparison:
306
- Enabled: true
307
-
308
- Style/Not:
309
- Enabled: true
310
-
311
- Style/OneLineConditional:
312
- Enabled: true
313
-
314
- Style/RedundantSortBy:
315
- Enabled: true
316
-
317
- Style/Sample:
318
- Enabled: true
319
-
320
- Style/StabbyLambdaParentheses:
321
- Enabled: true
322
-
323
- Style/StringLiterals:
324
- Enabled: true
325
- EnforcedStyle: double_quotes
326
-
327
- Style/Strip:
328
- Enabled: true
1
+ # Inherit from default_deprecated until 1.0
2
+ inherit_from: default_deprecated.yml
@@ -0,0 +1,4 @@
1
+ inherit_from: _default_shared.yml
2
+
3
+ AllCops:
4
+ DisabledByDefault: true
@@ -0,0 +1,4 @@
1
+ inherit_from: _default_shared.yml
2
+
3
+ require:
4
+ - rubocop-performance
@@ -1,122 +1,2 @@
1
- Rails:
2
- Enabled: true
3
-
4
- Rails/FindEach:
5
- Enabled: false
6
-
7
- Rails/OutputSafety:
8
- Enabled: true
9
-
10
- Rails/PluralizationGrammar:
11
- Enabled: true
12
-
13
- Rails/RequestReferer:
14
- Enabled: true
15
- EnforcedStyle: referrer
16
-
17
- Rails/ScopeArgs:
18
- Enabled: true
19
-
20
- Rails/UniqBeforePluck:
21
- Enabled: true
22
-
23
- GitHub/RailsApplicationRecord:
24
- Enabled: true
25
-
26
- GitHub/RailsControllerRenderActionSymbol:
27
- Enabled: true
28
- Include:
29
- - 'app/controllers/**/*.rb'
30
-
31
- GitHub/RailsControllerRenderLiteral:
32
- Enabled: true
33
- StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md
34
- Include:
35
- - 'app/controllers/**/*.rb'
36
-
37
- GitHub/RailsControllerRenderPathsExist:
38
- Enabled: true
39
- ViewPath:
40
- - 'app/views'
41
- Include:
42
- - 'app/controllers/**/*.rb'
43
-
44
- GitHub/RailsControllerRenderShorthand:
45
- Enabled: true
46
- StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-shorthand.md
47
- Include:
48
- - 'app/controllers/**/*.rb'
49
-
50
- GitHub/RailsRenderInline:
51
- Enabled: true
52
- StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-inline.md
53
- Include:
54
- - 'app/controllers/**/*.rb'
55
- - 'app/helpers/**/*.rb'
56
- - 'app/view_models/**/*.rb'
57
- - 'app/views/**/*.erb'
58
-
59
- GitHub/RailsRenderObjectCollection:
60
- Enabled: false
61
-
62
- GitHub/RailsViewRenderLiteral:
63
- Enabled: true
64
- StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md
65
- Include:
66
- - 'app/helpers/**/*.rb'
67
- - 'app/view_models/**/*.rb'
68
- - 'app/views/**/*.erb'
69
-
70
- GitHub/RailsViewRenderPathsExist:
71
- Enabled: true
72
- ViewPath:
73
- - 'app/views'
74
- Include:
75
- - 'app/helpers/**/*.rb'
76
- - 'app/view_models/**/*.rb'
77
- - 'app/views/**/*.erb'
78
-
79
- GitHub/RailsViewRenderShorthand:
80
- Enabled: true
81
- Include:
82
- - 'app/helpers/**/*.rb'
83
- - 'app/view_models/**/*.rb'
84
- - 'app/views/**/*.erb'
85
-
86
- # Exclude Rails ERB files from incompatible cops
87
-
88
- Layout/BlockAlignment:
89
- Exclude:
90
- - 'app/views/**/*.erb'
91
-
92
- Style/For:
93
- Exclude:
94
- - 'app/views/**/*.erb'
95
-
96
- Style/OneLineConditional:
97
- Exclude:
98
- - 'app/views/**/*.erb'
99
-
100
- Style/Semicolon:
101
- Exclude:
102
- - 'app/views/**/*.erb'
103
-
104
- Layout/SpaceInsideParens:
105
- Exclude:
106
- - 'app/views/**/*.erb'
107
-
108
- Style/StringLiterals:
109
- Exclude:
110
- - 'app/views/**/*.erb'
111
-
112
- Layout/TrailingBlankLines:
113
- Exclude:
114
- - 'app/views/**/*.erb'
115
-
116
- Layout/TrailingWhitespace:
117
- Exclude:
118
- - 'app/views/**/*.erb'
119
-
120
- Layout/InitialIndentation:
121
- Exclude:
122
- - 'app/views/**/*.erb'
1
+ # Inherit from rails_deprecated until 1.0
2
+ inherit_from: rails_deprecated.yml
@@ -0,0 +1,7 @@
1
+ inherit_from: _rails_shared.yml
2
+
3
+ Rails:
4
+ Enabled: true
5
+
6
+ Rails/FindEach:
7
+ Enabled: false
@@ -0,0 +1,4 @@
1
+ inherit_from: _rails_shared.yml
2
+
3
+ require:
4
+ - rubocop-rails
@@ -6,7 +6,7 @@ module RuboCop
6
6
  module Cop
7
7
  module GitHub
8
8
  class RailsControllerRenderLiteral < Cop
9
- MSG = "render must be used with a string literal"
9
+ MSG = "render must be used with a string literal or an instance of a Class"
10
10
 
11
11
  def_node_matcher :literal?, <<-PATTERN
12
12
  ({str sym true false nil?} ...)
@@ -24,6 +24,10 @@ module RuboCop
24
24
  (send nil? :render (const _ _) ...)
25
25
  PATTERN
26
26
 
27
+ def_node_matcher :render_inst?, <<-PATTERN
28
+ (send nil? :render (send _ :new ...) ...)
29
+ PATTERN
30
+
27
31
  def_node_matcher :render_with_options?, <<-PATTERN
28
32
  (send nil? :render (hash $...))
29
33
  PATTERN
@@ -67,7 +71,7 @@ module RuboCop
67
71
  def on_send(node)
68
72
  return unless render?(node)
69
73
 
70
- if render_literal?(node) || render_const?(node)
74
+ if render_literal?(node) || render_inst?(node) || render_const?(node)
71
75
  elsif option_pairs = render_with_options?(node)
72
76
  option_pairs = option_pairs.reject { |pair| options_key?(pair) }
73
77
 
@@ -6,7 +6,7 @@ module RuboCop
6
6
  module Cop
7
7
  module GitHub
8
8
  class RailsViewRenderLiteral < Cop
9
- MSG = "render must be used with a string literal"
9
+ MSG = "render must be used with a string literal or an instance of a Class"
10
10
 
11
11
  def_node_matcher :literal?, <<-PATTERN
12
12
  ({str sym true false nil?} ...)
@@ -20,6 +20,10 @@ module RuboCop
20
20
  (send nil? :render ({str sym} $_) $...)
21
21
  PATTERN
22
22
 
23
+ def_node_matcher :render_inst?, <<-PATTERN
24
+ (send nil? :render (send _ :new ...) ...)
25
+ PATTERN
26
+
23
27
  def_node_matcher :render_const?, <<-PATTERN
24
28
  (send nil? :render (const _ _) ...)
25
29
  PATTERN
@@ -46,7 +50,7 @@ module RuboCop
46
50
  def on_send(node)
47
51
  return unless render?(node)
48
52
 
49
- if render_literal?(node) || render_const?(node)
53
+ if render_literal?(node) || render_inst?(node) || render_const?(node)
50
54
  elsif option_pairs = render_with_options?(node)
51
55
  if option_pairs.any? { |pair| ignore_key?(pair) }
52
56
  return
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-06 00:00:00.000000000 Z
11
+ date: 2019-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.70'
19
+ version: '0.59'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.70'
27
- - !ruby/object:Gem::Dependency
28
- name: rubocop-performance
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 1.3.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 1.3.0
26
+ version: '0.59'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: actionview
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -89,8 +75,14 @@ files:
89
75
  - LICENSE
90
76
  - README.md
91
77
  - STYLEGUIDE.md
78
+ - config/_default_shared.yml
79
+ - config/_rails_shared.yml
92
80
  - config/default.yml
81
+ - config/default_deprecated.yml
82
+ - config/default_edge.yml
93
83
  - config/rails.yml
84
+ - config/rails_deprecated.yml
85
+ - config/rails_edge.yml
94
86
  - guides/rails-controller-render-shorthand.md
95
87
  - guides/rails-render-inline.md
96
88
  - guides/rails-render-literal.md
@@ -117,15 +109,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
109
  requirements:
118
110
  - - ">="
119
111
  - !ruby/object:Gem::Version
120
- version: 2.3.6
112
+ version: 2.1.0
121
113
  required_rubygems_version: !ruby/object:Gem::Requirement
122
114
  requirements:
123
115
  - - ">="
124
116
  - !ruby/object:Gem::Version
125
117
  version: '0'
126
118
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.7.6
119
+ rubygems_version: 3.0.3
129
120
  signing_key:
130
121
  specification_version: 4
131
122
  summary: RuboCop GitHub