rubocop-airbnb 1.0.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/config/rubocop-airbnb.yml +4 -0
- data/config/rubocop-layout.yml +61 -24
- data/config/rubocop-lint.yml +24 -43
- data/config/rubocop-metrics.yml +2 -2
- data/config/rubocop-naming.yml +25 -8
- data/config/rubocop-performance.yml +0 -8
- data/config/rubocop-rails.yml +8 -2
- data/config/rubocop-security.yml +4 -0
- data/config/rubocop-style.yml +103 -79
- data/lib/rubocop/airbnb/version.rb +1 -1
- data/lib/rubocop/cop/airbnb/simple_unless.rb +19 -0
- data/rubocop-airbnb.gemspec +1 -1
- data/spec/rubocop/cop/airbnb/simple_unless_spec.rb +36 -0
- metadata +8 -5
data/config/rubocop-metrics.yml
CHANGED
@@ -7,7 +7,7 @@ Metrics/BlockLength:
|
|
7
7
|
|
8
8
|
Metrics/BlockNesting:
|
9
9
|
Description: Avoid excessive block nesting
|
10
|
-
StyleGuide: https://github.com/
|
10
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#three-is-the-number-thou-shalt-count
|
11
11
|
Enabled: false
|
12
12
|
Max: 3
|
13
13
|
|
@@ -36,7 +36,7 @@ Metrics/ModuleLength:
|
|
36
36
|
|
37
37
|
Metrics/ParameterLists:
|
38
38
|
Description: Avoid parameter lists longer than three or four parameters.
|
39
|
-
StyleGuide: https://github.com/
|
39
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#too-many-params
|
40
40
|
Enabled: false
|
41
41
|
Max: 5
|
42
42
|
CountKeywordArgs: true
|
data/config/rubocop-naming.yml
CHANGED
@@ -4,27 +4,27 @@ Naming/AccessorMethodName:
|
|
4
4
|
|
5
5
|
Naming/AsciiIdentifiers:
|
6
6
|
Description: Use only ascii symbols in identifiers.
|
7
|
-
StyleGuide: https://github.com/
|
7
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#english-identifiers
|
8
8
|
Enabled: true
|
9
9
|
|
10
10
|
Naming/BinaryOperatorParameterName:
|
11
11
|
Description: When defining binary operators, name the argument other.
|
12
|
-
StyleGuide: https://github.com/
|
12
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#other-arg
|
13
13
|
Enabled: false
|
14
14
|
|
15
15
|
Naming/ClassAndModuleCamelCase:
|
16
16
|
Description: Use CamelCase for classes and modules.
|
17
|
-
StyleGuide: https://github.com/
|
17
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#camelcase-classes
|
18
18
|
Enabled: true
|
19
19
|
|
20
20
|
Naming/ConstantName:
|
21
21
|
Description: Constants should use SCREAMING_SNAKE_CASE.
|
22
|
-
StyleGuide: https://github.com/
|
22
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#screaming-snake-case
|
23
23
|
Enabled: false
|
24
24
|
|
25
25
|
Naming/FileName:
|
26
26
|
Description: Use snake_case for source file names.
|
27
|
-
StyleGuide: https://github.com/
|
27
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#snake-case-files
|
28
28
|
Enabled: false
|
29
29
|
|
30
30
|
Naming/HeredocDelimiterCase:
|
@@ -33,9 +33,14 @@ Naming/HeredocDelimiterCase:
|
|
33
33
|
Naming/HeredocDelimiterNaming:
|
34
34
|
Enabled: false
|
35
35
|
|
36
|
+
Naming/MemoizedInstanceVariableName:
|
37
|
+
Description: >-
|
38
|
+
Memoized method name should match memo instance variable name.
|
39
|
+
Enabled: false
|
40
|
+
|
36
41
|
Naming/MethodName:
|
37
42
|
Description: Use the configured style when naming methods.
|
38
|
-
StyleGuide: https://github.com/
|
43
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#snake-case-symbols-methods-vars
|
39
44
|
Enabled: false
|
40
45
|
EnforcedStyle: snake_case
|
41
46
|
SupportedStyles:
|
@@ -44,7 +49,7 @@ Naming/MethodName:
|
|
44
49
|
|
45
50
|
Naming/PredicateName:
|
46
51
|
Description: Check the names of predicate methods.
|
47
|
-
StyleGuide: https://github.com/
|
52
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#bool-methods-qmark
|
48
53
|
Enabled: false
|
49
54
|
NamePrefix:
|
50
55
|
- is_
|
@@ -55,9 +60,21 @@ Naming/PredicateName:
|
|
55
60
|
- has_
|
56
61
|
- have_
|
57
62
|
|
63
|
+
Naming/UncommunicativeBlockParamName:
|
64
|
+
Description: >-
|
65
|
+
Checks for block parameter names that contain capital letters,
|
66
|
+
end in numbers, or do not meet a minimal length.
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Naming/UncommunicativeMethodParamName:
|
70
|
+
Description: >-
|
71
|
+
Checks for method parameter names that contain capital letters,
|
72
|
+
end in numbers, or do not meet a minimal length.
|
73
|
+
Enabled: false
|
74
|
+
|
58
75
|
Naming/VariableName:
|
59
76
|
Description: Use the configured style when naming variables.
|
60
|
-
StyleGuide: https://github.com/
|
77
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#snake-case-symbols-methods-vars
|
61
78
|
Enabled: true
|
62
79
|
EnforcedStyle: snake_case
|
63
80
|
SupportedStyles:
|
@@ -53,14 +53,6 @@ Performance/FlatMap:
|
|
53
53
|
Enabled: false
|
54
54
|
EnabledForFlattenWithoutParams: false
|
55
55
|
|
56
|
-
# Supports --auto-correct
|
57
|
-
Performance/HashEachMethods:
|
58
|
-
Description: Use `Hash#each_key` and `Hash#each_value` instead of `Hash#keys.each`
|
59
|
-
and `Hash#values.each`.
|
60
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-each
|
61
|
-
Enabled: false
|
62
|
-
AutoCorrect: false
|
63
|
-
|
64
56
|
# Supports --auto-correct
|
65
57
|
Performance/LstripRstrip:
|
66
58
|
Description: Use `strip` instead of `lstrip.rstrip`.
|
data/config/rubocop-rails.yml
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
Rails/ActionFilter:
|
3
3
|
Enabled: false
|
4
4
|
|
5
|
+
Rails/ActiveRecordAliases:
|
6
|
+
Enabled: false
|
7
|
+
|
5
8
|
Rails/ActiveSupportAliases:
|
6
9
|
Enabled: false
|
7
10
|
|
@@ -88,6 +91,9 @@ Rails/HasManyOrHasOneDependent:
|
|
88
91
|
Rails/HttpPositionalArguments:
|
89
92
|
Enabled: false
|
90
93
|
|
94
|
+
Rails/HttpStatus:
|
95
|
+
Enabled: false
|
96
|
+
|
91
97
|
Rails/InverseOf:
|
92
98
|
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
93
99
|
Enabled: false
|
@@ -95,7 +101,7 @@ Rails/InverseOf:
|
|
95
101
|
Rails/LexicallyScopedActionFilter:
|
96
102
|
Description: Checks that methods specified in the filter's `only` or `except` options are
|
97
103
|
explicitly defined in the controller.
|
98
|
-
StyleGuide: 'https://github.com/
|
104
|
+
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
|
99
105
|
Enabled: false
|
100
106
|
|
101
107
|
Rails/NotNullColumn:
|
@@ -172,7 +178,7 @@ Rails/SkipsModelValidations:
|
|
172
178
|
|
173
179
|
Rails/TimeZone:
|
174
180
|
Description: Checks the correct usage of time zone aware methods.
|
175
|
-
StyleGuide: https://github.com/
|
181
|
+
StyleGuide: https://github.com/rubocop-hq/rails-style-guide#time
|
176
182
|
Reference: http://danilenko.org/2012/7/6/rails_timezones
|
177
183
|
Enabled: false
|
178
184
|
EnforcedStyle: flexible
|
data/config/rubocop-security.yml
CHANGED
data/config/rubocop-style.yml
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
# Supports --auto-correct
|
3
3
|
Style/Alias:
|
4
4
|
Description: Use alias_method instead of alias.
|
5
|
-
StyleGuide: https://github.com/
|
5
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#alias-method
|
6
6
|
Enabled: false
|
7
7
|
|
8
8
|
# Supports --auto-correct
|
9
9
|
Style/AndOr:
|
10
10
|
Description: Use &&/|| instead of and/or.
|
11
|
-
StyleGuide: https://github.com/
|
11
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-and-or-or
|
12
12
|
Enabled: true
|
13
13
|
EnforcedStyle: always
|
14
14
|
SupportedStyles:
|
@@ -18,18 +18,18 @@ Style/AndOr:
|
|
18
18
|
# Supports --auto-correct
|
19
19
|
Style/ArrayJoin:
|
20
20
|
Description: Use Array#join instead of Array#*.
|
21
|
-
StyleGuide: https://github.com/
|
21
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#array-join
|
22
22
|
Enabled: true
|
23
23
|
|
24
24
|
Style/AsciiComments:
|
25
25
|
Description: Use only ascii symbols in comments.
|
26
|
-
StyleGuide: https://github.com/
|
26
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#english-comments
|
27
27
|
Enabled: false
|
28
28
|
|
29
29
|
# Supports --auto-correct
|
30
30
|
Style/Attr:
|
31
31
|
Description: Checks for uses of Module#attr.
|
32
|
-
StyleGuide: https://github.com/
|
32
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#attr
|
33
33
|
Enabled: false
|
34
34
|
|
35
35
|
Style/AutoResourceCleanup:
|
@@ -40,7 +40,7 @@ Style/AutoResourceCleanup:
|
|
40
40
|
# Supports --auto-correct
|
41
41
|
Style/BarePercentLiterals:
|
42
42
|
Description: Checks if usage of %() or %Q() matches configuration.
|
43
|
-
StyleGuide: https://github.com/
|
43
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-q-shorthand
|
44
44
|
Enabled: false
|
45
45
|
EnforcedStyle: bare_percent
|
46
46
|
SupportedStyles:
|
@@ -49,13 +49,13 @@ Style/BarePercentLiterals:
|
|
49
49
|
|
50
50
|
Style/BeginBlock:
|
51
51
|
Description: Avoid the use of BEGIN blocks.
|
52
|
-
StyleGuide: https://github.com/
|
52
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-BEGIN-blocks
|
53
53
|
Enabled: false
|
54
54
|
|
55
55
|
# Supports --auto-correct
|
56
56
|
Style/BlockComments:
|
57
57
|
Description: Do not use block comments.
|
58
|
-
StyleGuide: https://github.com/
|
58
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-block-comments
|
59
59
|
Enabled: true
|
60
60
|
|
61
61
|
# Supports --auto-correct
|
@@ -144,13 +144,13 @@ Style/BracesAroundHashParameters:
|
|
144
144
|
|
145
145
|
Style/CaseEquality:
|
146
146
|
Description: Avoid explicit use of the case equality operator(===).
|
147
|
-
StyleGuide: https://github.com/
|
147
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-case-equality
|
148
148
|
Enabled: false
|
149
149
|
|
150
150
|
# Supports --auto-correct
|
151
151
|
Style/CharacterLiteral:
|
152
152
|
Description: Checks for uses of character literals.
|
153
|
-
StyleGuide: https://github.com/
|
153
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-character-literals
|
154
154
|
Enabled: false
|
155
155
|
|
156
156
|
Style/ClassAndModuleChildren:
|
@@ -167,18 +167,18 @@ Style/ClassCheck:
|
|
167
167
|
# Supports --auto-correct
|
168
168
|
Style/ClassMethods:
|
169
169
|
Description: Use self when defining module/class methods.
|
170
|
-
StyleGuide: https://github.com/
|
170
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#def-self-class-methods
|
171
171
|
Enabled: false
|
172
172
|
|
173
173
|
Style/ClassVars:
|
174
174
|
Description: Avoid the use of class variables.
|
175
|
-
StyleGuide: https://github.com/
|
175
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-class-vars
|
176
176
|
Enabled: true
|
177
177
|
|
178
178
|
# Supports --auto-correct
|
179
179
|
Style/CollectionMethods:
|
180
180
|
Description: Preferred collection methods.
|
181
|
-
StyleGuide: https://github.com/
|
181
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#map-find-select-reduce-size
|
182
182
|
Enabled: false
|
183
183
|
PreferredMethods:
|
184
184
|
collect: map
|
@@ -191,7 +191,7 @@ Style/CollectionMethods:
|
|
191
191
|
# Supports --auto-correct
|
192
192
|
Style/ColonMethodCall:
|
193
193
|
Description: ! 'Do not use :: for method call.'
|
194
|
-
StyleGuide: https://github.com/
|
194
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#double-colons
|
195
195
|
Enabled: true
|
196
196
|
|
197
197
|
Style/ColonMethodDefinition:
|
@@ -202,7 +202,7 @@ Style/ColonMethodDefinition:
|
|
202
202
|
# Supports --auto-correct
|
203
203
|
Style/CommandLiteral:
|
204
204
|
Description: Use `` or %x around command literals.
|
205
|
-
StyleGuide: https://github.com/
|
205
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-x
|
206
206
|
Enabled: true
|
207
207
|
EnforcedStyle: backticks
|
208
208
|
AllowInnerBackticks: false
|
@@ -210,7 +210,7 @@ Style/CommandLiteral:
|
|
210
210
|
# Supports --auto-correct
|
211
211
|
Style/CommentAnnotation:
|
212
212
|
Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
213
|
-
StyleGuide: https://github.com/
|
213
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#annotate-keywords
|
214
214
|
Enabled: false
|
215
215
|
Keywords:
|
216
216
|
- TODO
|
@@ -243,7 +243,7 @@ Style/DateTime:
|
|
243
243
|
# Supports --auto-correct
|
244
244
|
Style/DefWithParentheses:
|
245
245
|
Description: Use def with parentheses when there are arguments.
|
246
|
-
StyleGuide: https://github.com/
|
246
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#method-parens
|
247
247
|
Enabled: false
|
248
248
|
|
249
249
|
Style/Dir:
|
@@ -258,7 +258,7 @@ Style/DocumentationMethod:
|
|
258
258
|
|
259
259
|
Style/DoubleNegation:
|
260
260
|
Description: Checks for uses of double negation (!!).
|
261
|
-
StyleGuide: https://github.com/
|
261
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-bang-bang
|
262
262
|
Enabled: false
|
263
263
|
|
264
264
|
Style/EachForSimpleLoop:
|
@@ -295,7 +295,7 @@ Style/EmptyLambdaParameter:
|
|
295
295
|
# Supports --auto-correct
|
296
296
|
Style/EmptyLiteral:
|
297
297
|
Description: Prefer literals to Array.new/Hash.new/String.new.
|
298
|
-
StyleGuide: https://github.com/
|
298
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#literal-array-hash
|
299
299
|
Enabled: true
|
300
300
|
|
301
301
|
Style/EmptyMethod:
|
@@ -304,12 +304,12 @@ Style/EmptyMethod:
|
|
304
304
|
# Supports --auto-correct
|
305
305
|
Style/Encoding:
|
306
306
|
Description: Use UTF-8 as the source file encoding.
|
307
|
-
StyleGuide: https://github.com/
|
307
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#utf-8
|
308
308
|
Enabled: false
|
309
309
|
|
310
310
|
Style/EndBlock:
|
311
311
|
Description: Avoid the use of END blocks.
|
312
|
-
StyleGuide: https://github.com/
|
312
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-END-blocks
|
313
313
|
Enabled: false
|
314
314
|
|
315
315
|
Style/EvalWithLocation:
|
@@ -319,17 +319,21 @@ Style/EvalWithLocation:
|
|
319
319
|
# Supports --auto-correct
|
320
320
|
Style/EvenOdd:
|
321
321
|
Description: Favor the use of Fixnum#even? && Fixnum#odd?
|
322
|
-
StyleGuide: https://github.com/
|
322
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#predicate-methods
|
323
|
+
Enabled: false
|
324
|
+
|
325
|
+
Style/ExpandPathArguments:
|
326
|
+
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
|
323
327
|
Enabled: false
|
324
328
|
|
325
329
|
Style/FlipFlop:
|
326
330
|
Description: Checks for flip flops
|
327
|
-
StyleGuide: https://github.com/
|
331
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-flip-flops
|
328
332
|
Enabled: false
|
329
333
|
|
330
334
|
Style/For:
|
331
335
|
Description: Checks use of for or each in multiline loops.
|
332
|
-
StyleGuide: https://github.com/
|
336
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-for-loops
|
333
337
|
Enabled: false
|
334
338
|
EnforcedStyle: each
|
335
339
|
SupportedStyles:
|
@@ -338,7 +342,7 @@ Style/For:
|
|
338
342
|
|
339
343
|
Style/FormatString:
|
340
344
|
Description: Enforce the use of Kernel#sprintf, Kernel#format or String#%.
|
341
|
-
StyleGuide: https://github.com/
|
345
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#sprintf
|
342
346
|
Enabled: false
|
343
347
|
EnforcedStyle: format
|
344
348
|
SupportedStyles:
|
@@ -361,7 +365,7 @@ Style/FrozenStringLiteralComment:
|
|
361
365
|
|
362
366
|
Style/GlobalVars:
|
363
367
|
Description: Do not introduce global variables.
|
364
|
-
StyleGuide: https://github.com/
|
368
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#instance-vars
|
365
369
|
Reference: http://www.zenspider.com/Languages/Ruby/QuickRef.html
|
366
370
|
Enabled: false
|
367
371
|
AllowedVariables: []
|
@@ -396,13 +400,13 @@ Style/IfUnlessModifierOfIfUnless:
|
|
396
400
|
|
397
401
|
Style/IfWithSemicolon:
|
398
402
|
Description: Do not use if x; .... Use the ternary operator instead.
|
399
|
-
StyleGuide: https://github.com/
|
403
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-semicolon-ifs
|
400
404
|
Enabled: true
|
401
405
|
|
402
406
|
# Supports --auto-correct
|
403
407
|
Style/InfiniteLoop:
|
404
408
|
Description: Use Kernel#loop for infinite loops.
|
405
|
-
StyleGuide: https://github.com/
|
409
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#infinite-loop
|
406
410
|
Enabled: false
|
407
411
|
|
408
412
|
Style/InlineComment:
|
@@ -415,13 +419,13 @@ Style/InverseMethods:
|
|
415
419
|
# Supports --auto-correct
|
416
420
|
Style/Lambda:
|
417
421
|
Description: Use the new lambda literal syntax for single-line blocks.
|
418
|
-
StyleGuide: https://github.com/
|
422
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#lambda-multi-line
|
419
423
|
Enabled: false
|
420
424
|
|
421
425
|
# Supports --auto-correct
|
422
426
|
Style/LambdaCall:
|
423
427
|
Description: Use lambda.call(...) instead of lambda.(...).
|
424
|
-
StyleGuide: https://github.com/
|
428
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#proc-call
|
425
429
|
Enabled: true
|
426
430
|
EnforcedStyle: call
|
427
431
|
SupportedStyles:
|
@@ -433,24 +437,27 @@ Style/LineEndConcatenation:
|
|
433
437
|
Description: Use \ instead of + or << to concatenate two string literals at line end.
|
434
438
|
Enabled: true
|
435
439
|
|
440
|
+
Style/EmptyLineAfterGuardClause:
|
441
|
+
Enabled: false
|
442
|
+
|
436
443
|
Style/MethodCallWithArgsParentheses:
|
437
444
|
Enabled: false
|
438
445
|
|
439
446
|
# Supports --auto-correct
|
440
447
|
Style/MethodCallWithoutArgsParentheses:
|
441
448
|
Description: Do not use parentheses for method calls with no arguments.
|
442
|
-
StyleGuide: https://github.com/
|
449
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-args-no-parens
|
443
450
|
Enabled: true
|
444
451
|
|
445
452
|
Style/MethodCalledOnDoEndBlock:
|
446
453
|
Description: Avoid chaining a method call on a do...end block.
|
447
|
-
StyleGuide: https://github.com/
|
454
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#single-line-blocks
|
448
455
|
Enabled: false
|
449
456
|
|
450
457
|
# Supports --auto-correct
|
451
458
|
Style/MethodDefParentheses:
|
452
459
|
Description: Checks if the method definitions have or don't have parentheses.
|
453
|
-
StyleGuide: https://github.com/
|
460
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#method-parens
|
454
461
|
Enabled: true
|
455
462
|
EnforcedStyle: require_parentheses
|
456
463
|
SupportedStyles:
|
@@ -485,14 +492,15 @@ Style/MixinUsage:
|
|
485
492
|
`include`, `extend` and `prepend` at the top level. Let's use it inside `class` or `module`.
|
486
493
|
Enabled: true
|
487
494
|
|
495
|
+
# Supports --auto-correct
|
488
496
|
Style/ModuleFunction:
|
489
497
|
Description: Checks for usage of `extend self` in modules.
|
490
|
-
StyleGuide: https://github.com/
|
498
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#module-function
|
491
499
|
Enabled: false
|
492
500
|
|
493
501
|
Style/MultilineBlockChain:
|
494
502
|
Description: Avoid multi-line chains of blocks.
|
495
|
-
StyleGuide: https://github.com/
|
503
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#single-line-blocks
|
496
504
|
Enabled: false
|
497
505
|
|
498
506
|
Style/MultilineIfModifier:
|
@@ -501,7 +509,7 @@ Style/MultilineIfModifier:
|
|
501
509
|
# Supports --auto-correct
|
502
510
|
Style/MultilineIfThen:
|
503
511
|
Description: Do not use then for multi-line if/unless.
|
504
|
-
StyleGuide: https://github.com/
|
512
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-then
|
505
513
|
Enabled: true
|
506
514
|
|
507
515
|
Style/MultilineMemoization:
|
@@ -509,7 +517,7 @@ Style/MultilineMemoization:
|
|
509
517
|
|
510
518
|
Style/MultilineTernaryOperator:
|
511
519
|
Description: ! 'Avoid multi-line ?: (the ternary operator); use if/unless instead.'
|
512
|
-
StyleGuide: https://github.com/
|
520
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-multiline-ternary
|
513
521
|
Enabled: true
|
514
522
|
|
515
523
|
Style/MultipleComparison:
|
@@ -523,13 +531,13 @@ Style/MutableConstant:
|
|
523
531
|
# Supports --auto-correct
|
524
532
|
Style/NegatedIf:
|
525
533
|
Description: Favor unless over if for negative conditions (or control flow or).
|
526
|
-
StyleGuide: https://github.com/
|
534
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#unless-for-negatives
|
527
535
|
Enabled: false
|
528
536
|
|
529
537
|
# Supports --auto-correct
|
530
538
|
Style/NegatedWhile:
|
531
539
|
Description: Favor until over while for negative conditions.
|
532
|
-
StyleGuide: https://github.com/
|
540
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#until-for-negatives
|
533
541
|
Enabled: false
|
534
542
|
|
535
543
|
Style/NestedModifier:
|
@@ -542,12 +550,12 @@ Style/NestedParenthesizedCalls:
|
|
542
550
|
|
543
551
|
Style/NestedTernaryOperator:
|
544
552
|
Description: Use one expression per branch in a ternary operator.
|
545
|
-
StyleGuide: https://github.com/
|
553
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-nested-ternary
|
546
554
|
Enabled: true
|
547
555
|
|
548
556
|
Style/Next:
|
549
557
|
Description: Use `next` to skip iteration instead of a condition at the end.
|
550
|
-
StyleGuide: https://github.com/
|
558
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-nested-conditionals
|
551
559
|
Enabled: false
|
552
560
|
EnforcedStyle: skip_modifier_ifs
|
553
561
|
MinBodyLength: 3
|
@@ -558,20 +566,20 @@ Style/Next:
|
|
558
566
|
# Supports --auto-correct
|
559
567
|
Style/NilComparison:
|
560
568
|
Description: Prefer x.nil? to x == nil.
|
561
|
-
StyleGuide: https://github.com/
|
569
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#predicate-methods
|
562
570
|
Enabled: true
|
563
571
|
|
564
572
|
# Supports --auto-correct
|
565
573
|
Style/NonNilCheck:
|
566
574
|
Description: Checks for redundant nil checks.
|
567
|
-
StyleGuide: https://github.com/
|
575
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-non-nil-checks
|
568
576
|
Enabled: true
|
569
577
|
IncludeSemanticChanges: false
|
570
578
|
|
571
579
|
# Supports --auto-correct
|
572
580
|
Style/Not:
|
573
581
|
Description: Use ! instead of not.
|
574
|
-
StyleGuide: https://github.com/
|
582
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#bang-not-not
|
575
583
|
Enabled: true
|
576
584
|
|
577
585
|
Style/NumericLiteralPrefix:
|
@@ -584,7 +592,7 @@ Style/NumericLiteralPrefix:
|
|
584
592
|
# We just don't like this style.
|
585
593
|
Style/NumericLiterals:
|
586
594
|
Description: Add underscores to large numeric literals to improve their readability.
|
587
|
-
StyleGuide: https://github.com/
|
595
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#underscores-in-numerics
|
588
596
|
Enabled: false
|
589
597
|
|
590
598
|
Style/NumericPredicate:
|
@@ -592,7 +600,7 @@ Style/NumericPredicate:
|
|
592
600
|
|
593
601
|
Style/OneLineConditional:
|
594
602
|
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
595
|
-
StyleGuide: https://github.com/
|
603
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#ternary-operator
|
596
604
|
Enabled: true
|
597
605
|
|
598
606
|
Style/OptionHash:
|
@@ -608,7 +616,7 @@ Style/OptionHash:
|
|
608
616
|
Style/OptionalArguments:
|
609
617
|
Description: Checks for optional arguments that do not appear at the end of the argument
|
610
618
|
list
|
611
|
-
StyleGuide: https://github.com/
|
619
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#optional-arguments
|
612
620
|
Enabled: true
|
613
621
|
|
614
622
|
Style/OrAssignment:
|
@@ -618,20 +626,20 @@ Style/OrAssignment:
|
|
618
626
|
Style/ParallelAssignment:
|
619
627
|
Description: Check for simple usages of parallel assignment. It will only warn when
|
620
628
|
the number of variables matches on both sides of the assignment.
|
621
|
-
StyleGuide: https://github.com/
|
629
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#parallel-assignment
|
622
630
|
Enabled: false
|
623
631
|
|
624
632
|
# Supports --auto-correct
|
625
633
|
Style/ParenthesesAroundCondition:
|
626
634
|
Description: Don't use parentheses around the condition of an if/unless/while.
|
627
|
-
StyleGuide: https://github.com/
|
635
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-parens-if
|
628
636
|
Enabled: true
|
629
637
|
AllowSafeAssignment: true
|
630
638
|
|
631
639
|
# Supports --auto-correct
|
632
640
|
Style/PercentLiteralDelimiters:
|
633
641
|
Description: Use `%`-literal delimiters consistently
|
634
|
-
StyleGuide: https://github.com/
|
642
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-literal-braces
|
635
643
|
Enabled: true
|
636
644
|
PreferredDelimiters:
|
637
645
|
! '%': ()
|
@@ -656,25 +664,25 @@ Style/PercentQLiterals:
|
|
656
664
|
# Supports --auto-correct
|
657
665
|
Style/PerlBackrefs:
|
658
666
|
Description: Avoid Perl-style regex back references.
|
659
|
-
StyleGuide: https://github.com/
|
667
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-perl-regexp-last-matchers
|
660
668
|
Enabled: true
|
661
669
|
|
662
670
|
# Supports --auto-correct
|
663
671
|
Style/PreferredHashMethods:
|
664
672
|
Description: Checks for use of deprecated Hash methods.
|
665
|
-
StyleGuide: https://github.com/
|
673
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#hash-key
|
666
674
|
Enabled: true
|
667
675
|
|
668
676
|
# Supports --auto-correct
|
669
677
|
Style/Proc:
|
670
678
|
Description: Use proc instead of Proc.new.
|
671
|
-
StyleGuide: https://github.com/
|
679
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#proc
|
672
680
|
Enabled: false
|
673
681
|
|
674
682
|
Style/RaiseArgs:
|
675
683
|
Description: Checks the arguments passed to raise/fail.
|
676
684
|
# Also https://github.com/airbnb/ruby#exception-class-messages
|
677
|
-
StyleGuide: https://github.com/
|
685
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#exception-class-messages
|
678
686
|
Enabled: true
|
679
687
|
EnforcedStyle: exploded
|
680
688
|
SupportedStyles:
|
@@ -689,7 +697,7 @@ Style/RandomWithOffset:
|
|
689
697
|
# Supports --auto-correct
|
690
698
|
Style/RedundantBegin:
|
691
699
|
Description: Don't use begin blocks when they are not needed.
|
692
|
-
StyleGuide: https://github.com/
|
700
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#begin-implicit
|
693
701
|
Enabled: true
|
694
702
|
|
695
703
|
Style/RedundantConditional:
|
@@ -698,7 +706,7 @@ Style/RedundantConditional:
|
|
698
706
|
# Supports --auto-correct
|
699
707
|
Style/RedundantException:
|
700
708
|
Description: Checks for an obsolete RuntimeException argument in raise/fail.
|
701
|
-
StyleGuide: https://github.com/
|
709
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-explicit-runtimeerror
|
702
710
|
Enabled: true
|
703
711
|
|
704
712
|
# Supports --auto-correct
|
@@ -714,20 +722,20 @@ Style/RedundantParentheses:
|
|
714
722
|
# Supports --auto-correct
|
715
723
|
Style/RedundantReturn:
|
716
724
|
Description: Don't use return where it's not required.
|
717
|
-
StyleGuide: https://github.com/
|
725
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-explicit-return
|
718
726
|
Enabled: true
|
719
727
|
AllowMultipleReturnValues: false
|
720
728
|
|
721
729
|
# Supports --auto-correct
|
722
730
|
Style/RedundantSelf:
|
723
731
|
Description: Don't use self where it's not needed.
|
724
|
-
StyleGuide: https://github.com/
|
732
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-self-unless-required
|
725
733
|
Enabled: true
|
726
734
|
|
727
735
|
# Supports --auto-correct
|
728
736
|
Style/RegexpLiteral:
|
729
737
|
Description: Use / or %r around regular expressions.
|
730
|
-
StyleGuide: https://github.com/
|
738
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-r
|
731
739
|
Enabled: false
|
732
740
|
EnforcedStyle: slashes
|
733
741
|
SupportedStyles:
|
@@ -739,7 +747,7 @@ Style/RegexpLiteral:
|
|
739
747
|
# Supports --auto-correct
|
740
748
|
Style/RescueModifier:
|
741
749
|
Description: Avoid using rescue in its modifier form.
|
742
|
-
StyleGuide: https://github.com/
|
750
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-rescue-modifiers
|
743
751
|
Enabled: true
|
744
752
|
|
745
753
|
Style/RescueStandardError:
|
@@ -755,26 +763,26 @@ Style/SafeNavigation:
|
|
755
763
|
# Supports --auto-correct
|
756
764
|
Style/SelfAssignment:
|
757
765
|
Description: Checks for places where self-assignment shorthand should have been used.
|
758
|
-
StyleGuide: https://github.com/
|
766
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#self-assignment
|
759
767
|
Enabled: true
|
760
768
|
|
761
769
|
# Supports --auto-correct
|
762
770
|
Style/Semicolon:
|
763
771
|
Description: Don't use semicolons to terminate expressions.
|
764
|
-
StyleGuide: https://github.com/
|
772
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-semicolon
|
765
773
|
Enabled: true
|
766
774
|
AllowAsExpressionSeparator: false
|
767
775
|
|
768
776
|
Style/Send:
|
769
777
|
Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
|
770
778
|
may overlap with existing methods.
|
771
|
-
StyleGuide: https://github.com/
|
779
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#prefer-public-send
|
772
780
|
Enabled: false
|
773
781
|
|
774
782
|
# Supports --auto-correct
|
775
783
|
Style/SignalException:
|
776
784
|
Description: Checks for proper usage of fail and raise.
|
777
|
-
StyleGuide: https://github.com/
|
785
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#fail-method
|
778
786
|
Enabled: false
|
779
787
|
EnforcedStyle: semantic
|
780
788
|
SupportedStyles:
|
@@ -784,7 +792,7 @@ Style/SignalException:
|
|
784
792
|
|
785
793
|
Style/SingleLineBlockParams:
|
786
794
|
Description: Enforces the names of some block params.
|
787
|
-
StyleGuide: https://github.com/
|
795
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#reduce-blocks
|
788
796
|
Enabled: false
|
789
797
|
Methods:
|
790
798
|
- reduce:
|
@@ -797,19 +805,19 @@ Style/SingleLineBlockParams:
|
|
797
805
|
# Supports --auto-correct
|
798
806
|
Style/SingleLineMethods:
|
799
807
|
Description: Avoid single-line methods.
|
800
|
-
StyleGuide: https://github.com/
|
808
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-single-line-methods
|
801
809
|
Enabled: true
|
802
810
|
AllowIfMethodIsEmpty: true
|
803
811
|
|
804
812
|
# Supports --auto-correct
|
805
813
|
Style/SpecialGlobalVars:
|
806
814
|
Description: Avoid Perl-style global variables.
|
807
|
-
StyleGuide: https://github.com/
|
815
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-cryptic-perlisms
|
808
816
|
Enabled: true
|
809
817
|
|
810
818
|
Style/StabbyLambdaParentheses:
|
811
819
|
Description: Check for the usage of parentheses around stabby lambda arguments.
|
812
|
-
StyleGuide: https://github.com/
|
820
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#stabby-lambda-with-args
|
813
821
|
Enabled: false
|
814
822
|
EnforcedStyle: require_parentheses
|
815
823
|
SupportedStyles:
|
@@ -847,12 +855,12 @@ Style/StringMethods:
|
|
847
855
|
|
848
856
|
Style/StructInheritance:
|
849
857
|
Description: Checks for inheritance from Struct.new.
|
850
|
-
StyleGuide: https://github.com/
|
858
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-extend-struct-new
|
851
859
|
Enabled: false
|
852
860
|
|
853
861
|
Style/SymbolArray:
|
854
862
|
Description: Use %i or %I for arrays of symbols.
|
855
|
-
StyleGuide: https://github.com/
|
863
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-i
|
856
864
|
Enabled: false
|
857
865
|
|
858
866
|
# Supports --auto-correct
|
@@ -870,15 +878,28 @@ Style/SymbolProc:
|
|
870
878
|
Style/TernaryParentheses:
|
871
879
|
Enabled: false
|
872
880
|
|
881
|
+
Style/TrailingBodyOnClass:
|
882
|
+
Description: 'Class body goes below class statement.'
|
883
|
+
Enabled: true
|
884
|
+
|
873
885
|
Style/TrailingBodyOnMethodDefinition:
|
874
886
|
Description: 'Method body goes below definition.'
|
875
887
|
Enabled: true
|
876
888
|
|
889
|
+
Style/TrailingBodyOnModule:
|
890
|
+
Description: 'Module body goes below module statement.'
|
891
|
+
Enabled: true
|
892
|
+
|
877
893
|
Style/TrailingCommaInArguments:
|
878
894
|
Enabled: false
|
879
895
|
|
880
|
-
#
|
881
|
-
Style/
|
896
|
+
# Enforce trailing commas (we like 'em!)
|
897
|
+
Style/TrailingCommaInArrayLiteral:
|
898
|
+
Enabled: true
|
899
|
+
EnforcedStyleForMultiline: consistent_comma
|
900
|
+
|
901
|
+
# Enforce trailing commas (we like 'em!)
|
902
|
+
Style/TrailingCommaInHashLiteral:
|
882
903
|
Enabled: true
|
883
904
|
EnforcedStyleForMultiline: consistent_comma
|
884
905
|
|
@@ -894,7 +915,7 @@ Style/TrivialAccessors:
|
|
894
915
|
|
895
916
|
Style/UnlessElse:
|
896
917
|
Description: Do not use unless with else. Rewrite these with the positive case first.
|
897
|
-
StyleGuide: https://github.com/
|
918
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-else-with-unless
|
898
919
|
Enabled: true
|
899
920
|
|
900
921
|
# Supports --auto-correct
|
@@ -910,37 +931,40 @@ Style/UnneededInterpolation:
|
|
910
931
|
# Supports --auto-correct
|
911
932
|
Style/UnneededPercentQ:
|
912
933
|
Description: Checks for %q/%Q when single quotes or double quotes would do.
|
913
|
-
StyleGuide: https://github.com/
|
934
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-q
|
935
|
+
Enabled: false
|
936
|
+
|
937
|
+
Style/UnpackFirst:
|
914
938
|
Enabled: false
|
915
939
|
|
916
940
|
# Supports --auto-correct
|
917
941
|
Style/VariableInterpolation:
|
918
942
|
Description: Don't interpolate global, instance and class variables directly in strings.
|
919
|
-
StyleGuide: https://github.com/
|
943
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#curlies-interpolate
|
920
944
|
Enabled: false
|
921
945
|
|
922
946
|
# Supports --auto-correct
|
923
947
|
Style/WhenThen:
|
924
948
|
Description: Use when x then ... for one-line cases.
|
925
|
-
StyleGuide: https://github.com/
|
949
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#one-line-cases
|
926
950
|
Enabled: false
|
927
951
|
|
928
952
|
# Supports --auto-correct
|
929
953
|
Style/WhileUntilDo:
|
930
954
|
Description: Checks for redundant do after while or until.
|
931
|
-
StyleGuide: https://github.com/
|
955
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-multiline-while-do
|
932
956
|
Enabled: true
|
933
957
|
|
934
958
|
# Supports --auto-correct
|
935
959
|
Style/WhileUntilModifier:
|
936
960
|
Description: Favor modifier while/until usage when you have a single-line body.
|
937
|
-
StyleGuide: https://github.com/
|
961
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#while-as-a-modifier
|
938
962
|
Enabled: false
|
939
963
|
|
940
964
|
# Supports --auto-correct
|
941
965
|
Style/WordArray:
|
942
966
|
Description: Use %w or %W for arrays of words.
|
943
|
-
StyleGuide: https://github.com/
|
967
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-w
|
944
968
|
Enabled: false
|
945
969
|
MinSize: 0
|
946
970
|
WordRegex: !ruby/regexp /\A[\p{Word}]+\z/
|