rubocop-github 0.13.0 → 0.16.2

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: 20ebeaa5b28b3bd9c71165db189848826a85b99e02a0a94bdefb0d0fdcd0613b
4
+ data.tar.gz: 380eb924e8f04d7c2b0cbabec3c6812cd02486646b4bdb00b7fcb7f17ac153c7
5
5
  SHA512:
6
- metadata.gz: 36d6bfbc4936221bd01eeffa1667a5f421aca8039b134d3918e9587be3b8778819062d42e4f464b93c62ff3caecb297d4ace38c3d214b94289a1a02c69b9d81a
7
- data.tar.gz: dadce863318b8ca16f6f3f5a0fd8e9827cc992df3f1e925d57f5711e12d79bff79996a451f0fa81ae795d46971ea8a17fb727d4db6756a8194449228b8310f90
6
+ metadata.gz: 597c2e3594b4bacf764a1fca6d1cbab7336b2634a6d5375305c4aeb479f9c4eb0e21796f1a372dd21013374ae24fd194fba54262c1e84cf5a19bedd97bfadc0d
7
+ data.tar.gz: '008078b1e9e5d737cbe459c64772a854e2c00b863fbd766be4d2e73698e2606ebb32e1fc1e36926b14182d3296785802cdc3f98895c59dfd79b6d27f3b144004'
data/README.md CHANGED
@@ -1,12 +1,17 @@
1
- # RuboCop GitHub [![Build Status](https://travis-ci.org/github/rubocop-github.svg?branch=master)](https://travis-ci.org/github/rubocop-github)
1
+ # RuboCop GitHub ![CI](https://github.com/github/rubocop-github/workflows/CI/badge.svg?event=push)
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`
data/STYLEGUIDE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  * Use soft-tabs with a two space indent.
4
4
 
5
- * Keep each line of code to a readable length. Unless you have a reason to, keep lines to fewer than 100 characters.
5
+ * Keep each line of code to a readable length. Unless you have a reason to, keep lines to a maximum of 118 characters. Why 118? That's the width at which the pull request diff UI needs horizontal scrolling (making pull requests harder to review).
6
6
 
7
7
  * Never leave trailing whitespace.
8
8
 
@@ -31,9 +31,34 @@ some(arg).other
31
31
  !array.include?(element)
32
32
  ```
33
33
 
34
- * Indent `when` as deep as `case`.
34
+ * Indent `when` with the start of the `case` expression.
35
35
 
36
36
  ``` ruby
37
+ # bad
38
+ message = case
39
+ when song.name == "Misty"
40
+ "Not again!"
41
+ when song.duration > 120
42
+ "Too long!"
43
+ when Time.now.hour > 21
44
+ "It's too late"
45
+ else
46
+ song.to_s
47
+ end
48
+
49
+ # good
50
+ message = case
51
+ when song.name == "Misty"
52
+ "Not again!"
53
+ when song.duration > 120
54
+ "Too long!"
55
+ when Time.now.hour > 21
56
+ "It's too late"
57
+ else
58
+ song.to_s
59
+ end
60
+
61
+ # good
37
62
  case
38
63
  when song.name == "Misty"
39
64
  puts "Not again!"
@@ -44,15 +69,6 @@ when Time.now.hour > 21
44
69
  else
45
70
  song.play
46
71
  end
47
-
48
- kind = case year
49
- when 1850..1889 then "Blues"
50
- when 1890..1909 then "Ragtime"
51
- when 1910..1929 then "New Orleans Jazz"
52
- when 1930..1939 then "Swing"
53
- when 1940..1950 then "Bebop"
54
- else "Jazz"
55
- end
56
72
  ```
57
73
 
58
74
  * Use empty lines between `def`s and to break up a method into logical
@@ -0,0 +1,329 @@
1
+ require:
2
+ - rubocop/cop/github
3
+ - rubocop-performance
4
+
5
+ # These cops are compatible across supported versions of rubocop
6
+
7
+ Bundler/DuplicatedGem:
8
+ Enabled: true
9
+
10
+ Bundler/OrderedGems:
11
+ Enabled: true
12
+
13
+ GitHub/InsecureHashAlgorithm:
14
+ Enabled: true
15
+
16
+ Layout/BlockAlignment:
17
+ Enabled: true
18
+
19
+ Layout/BlockEndNewline:
20
+ Enabled: true
21
+
22
+ Layout/ConditionPosition:
23
+ Enabled: true
24
+
25
+ Layout/DefEndAlignment:
26
+ Enabled: true
27
+
28
+ Layout/EndAlignment:
29
+ Enabled: false
30
+
31
+ Layout/EndOfLine:
32
+ Enabled: true
33
+
34
+ Layout/IndentationStyle:
35
+ Enabled: true
36
+ EnforcedStyle: spaces
37
+ IndentationWidth: 2
38
+
39
+ Layout/InitialIndentation:
40
+ Enabled: true
41
+
42
+ Layout/LineLength:
43
+ Enabled: false
44
+
45
+ Layout/SpaceAfterColon:
46
+ Enabled: true
47
+
48
+ Layout/SpaceAfterComma:
49
+ Enabled: true
50
+
51
+ Layout/SpaceAfterMethodName:
52
+ Enabled: true
53
+
54
+ Layout/SpaceAfterNot:
55
+ Enabled: true
56
+
57
+ Layout/SpaceAfterSemicolon:
58
+ Enabled: true
59
+
60
+ Layout/SpaceAroundBlockParameters:
61
+ Enabled: true
62
+
63
+ Layout/SpaceAroundEqualsInParameterDefault:
64
+ Enabled: true
65
+
66
+ Layout/SpaceBeforeBlockBraces:
67
+ Enabled: true
68
+
69
+ Layout/SpaceInsideArrayLiteralBrackets:
70
+ Enabled: true
71
+ EnforcedStyle: no_space
72
+
73
+ Layout/SpaceInsideArrayPercentLiteral:
74
+ Enabled: true
75
+
76
+ Layout/SpaceInsideBlockBraces:
77
+ Enabled: true
78
+
79
+ Layout/SpaceInsideParens:
80
+ Enabled: true
81
+
82
+ Layout/SpaceInsideRangeLiteral:
83
+ Enabled: true
84
+
85
+ Layout/SpaceInsideReferenceBrackets:
86
+ Enabled: true
87
+
88
+ Layout/TrailingEmptyLines:
89
+ Enabled: true
90
+
91
+ Layout/TrailingWhitespace:
92
+ Enabled: true
93
+
94
+ Lint/CircularArgumentReference:
95
+ Enabled: true
96
+
97
+ Lint/Debugger:
98
+ Enabled: true
99
+
100
+ Lint/DeprecatedClassMethods:
101
+ Enabled: true
102
+
103
+ Lint/DuplicateMethods:
104
+ Enabled: true
105
+
106
+ Lint/DuplicateHashKey:
107
+ Enabled: true
108
+
109
+ Lint/EachWithObjectArgument:
110
+ Enabled: true
111
+
112
+ Lint/ElseLayout:
113
+ Enabled: true
114
+
115
+ Lint/EmptyEnsure:
116
+ Enabled: true
117
+
118
+ Lint/EmptyInterpolation:
119
+ Enabled: true
120
+
121
+ Lint/EnsureReturn:
122
+ Enabled: true
123
+
124
+ Lint/FlipFlop:
125
+ Enabled: true
126
+
127
+ Lint/FloatOutOfRange:
128
+ Enabled: true
129
+
130
+ Lint/FormatParameterMismatch:
131
+ Enabled: true
132
+
133
+ Lint/LiteralAsCondition:
134
+ Enabled: true
135
+
136
+ Lint/LiteralInInterpolation:
137
+ Enabled: true
138
+
139
+ Lint/Loop:
140
+ Enabled: true
141
+
142
+ Lint/NextWithoutAccumulator:
143
+ Enabled: true
144
+
145
+ Lint/RandOne:
146
+ Enabled: true
147
+
148
+ Lint/RequireParentheses:
149
+ Enabled: true
150
+
151
+ Lint/RescueException:
152
+ Enabled: true
153
+
154
+ Lint/RedundantStringCoercion:
155
+ Enabled: true
156
+
157
+ Lint/UnderscorePrefixedVariableName:
158
+ Enabled: true
159
+
160
+ Lint/RedundantCopDisableDirective:
161
+ Enabled: true
162
+
163
+ Lint/RedundantSplatExpansion:
164
+ Enabled: true
165
+
166
+ Lint/UnreachableCode:
167
+ Enabled: true
168
+
169
+ Lint/BinaryOperatorWithIdenticalOperands:
170
+ Enabled: true
171
+
172
+ Lint/UselessSetterCall:
173
+ Enabled: true
174
+
175
+ Lint/Void:
176
+ Enabled: true
177
+
178
+ Metrics/AbcSize:
179
+ Enabled: false
180
+
181
+ Metrics/BlockLength:
182
+ Enabled: false
183
+
184
+ Metrics/BlockNesting:
185
+ Enabled: false
186
+
187
+ Metrics/ClassLength:
188
+ Enabled: false
189
+
190
+ Metrics/CyclomaticComplexity:
191
+ Enabled: false
192
+
193
+ Metrics/MethodLength:
194
+ Enabled: false
195
+
196
+ Metrics/ModuleLength:
197
+ Enabled: false
198
+
199
+ Metrics/ParameterLists:
200
+ Enabled: false
201
+
202
+ Metrics/PerceivedComplexity:
203
+ Enabled: false
204
+
205
+ Naming/AsciiIdentifiers:
206
+ Enabled: true
207
+
208
+ Naming/ClassAndModuleCamelCase:
209
+ Enabled: true
210
+
211
+ Naming/FileName:
212
+ Enabled: true
213
+
214
+ Naming/MethodName:
215
+ Enabled: true
216
+
217
+ Performance/CaseWhenSplat:
218
+ Enabled: false
219
+
220
+ Performance/Count:
221
+ Enabled: true
222
+
223
+ Performance/Detect:
224
+ Enabled: true
225
+
226
+ Performance/DoubleStartEndWith:
227
+ Enabled: true
228
+
229
+ Performance/EndWith:
230
+ Enabled: true
231
+
232
+ Performance/FlatMap:
233
+ Enabled: true
234
+
235
+ Performance/RangeInclude:
236
+ Enabled: false
237
+
238
+ Performance/RedundantMatch:
239
+ Enabled: false
240
+
241
+ Performance/RedundantMerge:
242
+ Enabled: true
243
+ MaxKeyValuePairs: 1
244
+
245
+ Performance/ReverseEach:
246
+ Enabled: true
247
+
248
+ Performance/Size:
249
+ Enabled: true
250
+
251
+ Performance/StartWith:
252
+ Enabled: true
253
+
254
+ Security/Eval:
255
+ Enabled: true
256
+
257
+ Style/ArrayJoin:
258
+ Enabled: true
259
+
260
+ Style/BeginBlock:
261
+ Enabled: true
262
+
263
+ Style/BlockComments:
264
+ Enabled: true
265
+
266
+ Style/CaseEquality:
267
+ Enabled: true
268
+
269
+ Style/CharacterLiteral:
270
+ Enabled: true
271
+
272
+ Style/ClassMethods:
273
+ Enabled: true
274
+
275
+ Style/Copyright:
276
+ Enabled: false
277
+
278
+ Style/DefWithParentheses:
279
+ Enabled: true
280
+
281
+ Style/EndBlock:
282
+ Enabled: true
283
+
284
+ Style/For:
285
+ Enabled: true
286
+
287
+ Style/FrozenStringLiteralComment:
288
+ Enabled: true
289
+
290
+ Style/HashSyntax:
291
+ Enabled: true
292
+ EnforcedStyle: ruby19_no_mixed_keys
293
+
294
+ Style/LambdaCall:
295
+ Enabled: true
296
+
297
+ Style/MethodCallWithoutArgsParentheses:
298
+ Enabled: true
299
+
300
+ Style/MethodDefParentheses:
301
+ Enabled: true
302
+
303
+ Style/MultilineIfThen:
304
+ Enabled: true
305
+
306
+ Style/NilComparison:
307
+ Enabled: true
308
+
309
+ Style/Not:
310
+ Enabled: true
311
+
312
+ Style/OneLineConditional:
313
+ Enabled: true
314
+
315
+ Style/RedundantSortBy:
316
+ Enabled: true
317
+
318
+ Style/Sample:
319
+ Enabled: true
320
+
321
+ Style/StabbyLambdaParentheses:
322
+ Enabled: true
323
+
324
+ Style/Strip:
325
+ Enabled: true
326
+
327
+ Style/StringLiterals:
328
+ Enabled: true
329
+ 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