makandra-rubocop 2.0.0 → 3.0.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 +13 -0
- data/Gemfile.lock +7 -5
- data/config/default.yml +310 -261
- data/lib/makandra_rubocop/version.rb +1 -1
- data/makandra-rubocop.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0942fa4b06e6919c0158759988528dbbb5d390c38640259ad87c9282c17f762
|
4
|
+
data.tar.gz: ee7fe82d6916b524afe242425a9d35c6450491c66623c94801b8cdc48f7d10f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1b191539a58bb8ec1f51f0a18988b52cdfcbdc37110438868abb2c4de1abbfa63f16a8afe3cbba4b5b5787fe495360f41951d1c2db8f488ca1a5f1b1c8ee5a3
|
7
|
+
data.tar.gz: b8a345569f94cae49240def4b124ee93ef940ca5e12ed65bb091d8ceadb04b7a6ac1cd97d1cdc414ccbaac7d58b95f876e986d4386ab05c2425078d37a4d50f5
|
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,19 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
13
13
|
|
14
14
|
-
|
15
15
|
|
16
|
+
|
17
|
+
## 3.0.0 - 2019-02-28
|
18
|
+
|
19
|
+
### Breaking changes
|
20
|
+
|
21
|
+
- Upgrade Rubocop from 0.62.0 to [0.65.0](https://github.com/rubocop-hq/rubocop/blob/2e52af0e33cc6387f7c8495b52f66c8f2f46a804/CHANGELOG.md#0650-2019-02-19)
|
22
|
+
|
23
|
+
### Compatible changes
|
24
|
+
|
25
|
+
- Disable `Style/MultilineBlockChain` for `spec/**/*`
|
26
|
+
- Disable `Layout/ClosingParenthesisIndentation`
|
27
|
+
|
28
|
+
|
16
29
|
## 2.0.0 - 2019-01-31
|
17
30
|
|
18
31
|
### Breaking changes
|
data/Gemfile.lock
CHANGED
@@ -1,25 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
makandra-rubocop (
|
5
|
-
rubocop (~> 0.
|
4
|
+
makandra-rubocop (3.0.0)
|
5
|
+
rubocop (~> 0.65.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.0)
|
11
11
|
jaro_winkler (1.5.2)
|
12
|
-
parallel (1.
|
13
|
-
parser (2.
|
12
|
+
parallel (1.14.0)
|
13
|
+
parser (2.6.0.0)
|
14
14
|
ast (~> 2.4.0)
|
15
15
|
powerpack (0.1.2)
|
16
|
+
psych (3.1.0)
|
16
17
|
rainbow (3.0.0)
|
17
18
|
rake (12.3.2)
|
18
|
-
rubocop (0.
|
19
|
+
rubocop (0.65.0)
|
19
20
|
jaro_winkler (~> 1.5.1)
|
20
21
|
parallel (~> 1.10)
|
21
22
|
parser (>= 2.5, != 2.5.1.1)
|
22
23
|
powerpack (~> 0.1)
|
24
|
+
psych (>= 3.1.0)
|
23
25
|
rainbow (>= 2.2.2, < 4.0)
|
24
26
|
ruby-progressbar (~> 1.7)
|
25
27
|
unicode-display_width (~> 1.4.0)
|
data/config/default.yml
CHANGED
@@ -159,9 +159,9 @@ Bundler/GemComment:
|
|
159
159
|
|
160
160
|
Bundler/InsecureProtocolSource:
|
161
161
|
Description: >-
|
162
|
-
|
163
|
-
|
164
|
-
|
162
|
+
The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
|
163
|
+
because HTTP requests are insecure. Please change your source to
|
164
|
+
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
|
165
165
|
Enabled: true
|
166
166
|
VersionAdded: '0.50'
|
167
167
|
Include:
|
@@ -171,7 +171,7 @@ Bundler/InsecureProtocolSource:
|
|
171
171
|
|
172
172
|
Bundler/OrderedGems:
|
173
173
|
Description: >-
|
174
|
-
|
174
|
+
Gems within groups in the Gemfile should be alphabetically sorted.
|
175
175
|
Enabled: false
|
176
176
|
VersionAdded: '0.46'
|
177
177
|
VersionChanged: '0.47'
|
@@ -192,7 +192,7 @@ Gemspec/DuplicatedAssignment:
|
|
192
192
|
|
193
193
|
Gemspec/OrderedDependencies:
|
194
194
|
Description: >-
|
195
|
-
|
195
|
+
Dependencies in the gemspec should be alphabetically sorted.
|
196
196
|
Enabled: false
|
197
197
|
VersionAdded: '0.51'
|
198
198
|
TreatCommentsAsGroupSeparators: true
|
@@ -223,16 +223,16 @@ Layout/AccessModifierIndentation:
|
|
223
223
|
|
224
224
|
Layout/AlignArray:
|
225
225
|
Description: >-
|
226
|
-
|
227
|
-
|
226
|
+
Align the elements of an array literal if they span more than
|
227
|
+
one line.
|
228
228
|
StyleGuide: '#align-multiline-arrays'
|
229
229
|
Enabled: false
|
230
230
|
VersionAdded: '0.49'
|
231
231
|
|
232
232
|
Layout/AlignHash:
|
233
233
|
Description: >-
|
234
|
-
|
235
|
-
|
234
|
+
Align the elements of a hash literal if they span more than
|
235
|
+
one line.
|
236
236
|
Enabled: false
|
237
237
|
VersionAdded: '0.49'
|
238
238
|
# Alignment of entries using hash rocket as separator. Valid values are:
|
@@ -307,8 +307,8 @@ Layout/AlignHash:
|
|
307
307
|
|
308
308
|
Layout/AlignParameters:
|
309
309
|
Description: >-
|
310
|
-
|
311
|
-
|
310
|
+
Align the parameters of a method call if they span more
|
311
|
+
than one line.
|
312
312
|
StyleGuide: '#no-double-indent'
|
313
313
|
Enabled: false
|
314
314
|
VersionAdded: '0.49'
|
@@ -379,13 +379,13 @@ Layout/ClassStructure:
|
|
379
379
|
- prepend
|
380
380
|
- extend
|
381
381
|
ExpectedOrder:
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
382
|
+
- module_inclusion
|
383
|
+
- constants
|
384
|
+
- public_class_methods
|
385
|
+
- initializer
|
386
|
+
- public_methods
|
387
|
+
- protected_methods
|
388
|
+
- private_methods
|
389
389
|
|
390
390
|
Layout/ClosingHeredocIndentation:
|
391
391
|
Description: 'Checks the indentation of here document closings.'
|
@@ -394,7 +394,7 @@ Layout/ClosingHeredocIndentation:
|
|
394
394
|
|
395
395
|
Layout/ClosingParenthesisIndentation:
|
396
396
|
Description: 'Checks the indentation of hanging closing parentheses.'
|
397
|
-
Enabled:
|
397
|
+
Enabled: false # See https://github.com/makandra/makandra-rubocop/issues/3 for more details
|
398
398
|
VersionAdded: '0.49'
|
399
399
|
|
400
400
|
Layout/CommentIndentation:
|
@@ -404,8 +404,8 @@ Layout/CommentIndentation:
|
|
404
404
|
|
405
405
|
Layout/ConditionPosition:
|
406
406
|
Description: >-
|
407
|
-
|
408
|
-
|
407
|
+
Checks for condition placed in a confusing position relative to
|
408
|
+
the keyword.
|
409
409
|
StyleGuide: '#same-line-condition'
|
410
410
|
Enabled: true
|
411
411
|
VersionAdded: '0.53'
|
@@ -588,29 +588,29 @@ Layout/ExtraSpacing:
|
|
588
588
|
|
589
589
|
Layout/FirstArrayElementLineBreak:
|
590
590
|
Description: >-
|
591
|
-
|
592
|
-
|
591
|
+
Checks for a line break before the first element in a
|
592
|
+
multi-line array.
|
593
593
|
Enabled: false
|
594
594
|
VersionAdded: '0.49'
|
595
595
|
|
596
596
|
Layout/FirstHashElementLineBreak:
|
597
597
|
Description: >-
|
598
|
-
|
599
|
-
|
598
|
+
Checks for a line break before the first element in a
|
599
|
+
multi-line hash.
|
600
600
|
Enabled: false
|
601
601
|
VersionAdded: '0.49'
|
602
602
|
|
603
603
|
Layout/FirstMethodArgumentLineBreak:
|
604
604
|
Description: >-
|
605
|
-
|
606
|
-
|
605
|
+
Checks for a line break before the first argument in a
|
606
|
+
multi-line method call.
|
607
607
|
Enabled: false
|
608
608
|
VersionAdded: '0.49'
|
609
609
|
|
610
610
|
Layout/FirstMethodParameterLineBreak:
|
611
611
|
Description: >-
|
612
|
-
|
613
|
-
|
612
|
+
Checks for a line break before the first parameter in a
|
613
|
+
multi-line method parameter definition.
|
614
614
|
Enabled: false
|
615
615
|
VersionAdded: '0.49'
|
616
616
|
|
@@ -641,8 +641,8 @@ Layout/FirstParameterIndentation:
|
|
641
641
|
|
642
642
|
Layout/IndentArray:
|
643
643
|
Description: >-
|
644
|
-
|
645
|
-
|
644
|
+
Checks the indentation of the first element in an array
|
645
|
+
literal.
|
646
646
|
Enabled: true
|
647
647
|
VersionAdded: '0.49'
|
648
648
|
# The value `special_inside_parentheses` means that array literals with
|
@@ -667,8 +667,8 @@ Layout/IndentArray:
|
|
667
667
|
|
668
668
|
Layout/IndentAssignment:
|
669
669
|
Description: >-
|
670
|
-
|
671
|
-
|
670
|
+
Checks the indentation of the first line of the
|
671
|
+
right-hand-side of a multi-line assignment.
|
672
672
|
Enabled: true
|
673
673
|
VersionAdded: '0.49'
|
674
674
|
# By default, the indentation width from `Layout/IndentationWidth` is used
|
@@ -756,9 +756,9 @@ Layout/LeadingCommentSpace:
|
|
756
756
|
|
757
757
|
Layout/MultilineArrayBraceLayout:
|
758
758
|
Description: >-
|
759
|
-
|
760
|
-
|
761
|
-
|
759
|
+
Checks that the closing brace in an array literal is
|
760
|
+
either on the same line as the last array element, or
|
761
|
+
a new line.
|
762
762
|
Enabled: true
|
763
763
|
VersionAdded: '0.49'
|
764
764
|
EnforcedStyle: symmetrical
|
@@ -799,9 +799,9 @@ Layout/MultilineBlockLayout:
|
|
799
799
|
|
800
800
|
Layout/MultilineHashBraceLayout:
|
801
801
|
Description: >-
|
802
|
-
|
803
|
-
|
804
|
-
|
802
|
+
Checks that the closing brace in a hash literal is
|
803
|
+
either on the same line as the last hash element, or
|
804
|
+
a new line.
|
805
805
|
Enabled: true
|
806
806
|
VersionAdded: '0.49'
|
807
807
|
EnforcedStyle: symmetrical
|
@@ -815,9 +815,9 @@ Layout/MultilineHashBraceLayout:
|
|
815
815
|
|
816
816
|
Layout/MultilineMethodCallBraceLayout:
|
817
817
|
Description: >-
|
818
|
-
|
819
|
-
|
820
|
-
|
818
|
+
Checks that the closing brace in a method call is
|
819
|
+
either on the same line as the last method argument, or
|
820
|
+
a new line.
|
821
821
|
Enabled: true
|
822
822
|
VersionAdded: '0.49'
|
823
823
|
EnforcedStyle: new_line
|
@@ -831,8 +831,8 @@ Layout/MultilineMethodCallBraceLayout:
|
|
831
831
|
|
832
832
|
Layout/MultilineMethodCallIndentation:
|
833
833
|
Description: >-
|
834
|
-
|
835
|
-
|
834
|
+
Checks indentation of method calls with the dot operator
|
835
|
+
that span more than one line.
|
836
836
|
Enabled: true
|
837
837
|
VersionAdded: '0.49'
|
838
838
|
EnforcedStyle: indented
|
@@ -846,9 +846,9 @@ Layout/MultilineMethodCallIndentation:
|
|
846
846
|
|
847
847
|
Layout/MultilineMethodDefinitionBraceLayout:
|
848
848
|
Description: >-
|
849
|
-
|
850
|
-
|
851
|
-
|
849
|
+
Checks that the closing brace in a method definition is
|
850
|
+
either on the same line as the last method parameter, or
|
851
|
+
a new line.
|
852
852
|
Enabled: true
|
853
853
|
VersionAdded: '0.49'
|
854
854
|
EnforcedStyle: symmetrical
|
@@ -862,8 +862,8 @@ Layout/MultilineMethodDefinitionBraceLayout:
|
|
862
862
|
|
863
863
|
Layout/MultilineOperationIndentation:
|
864
864
|
Description: >-
|
865
|
-
|
866
|
-
|
865
|
+
Checks indentation of binary operations that span more than
|
866
|
+
one line.
|
867
867
|
Enabled: true
|
868
868
|
VersionAdded: '0.49'
|
869
869
|
EnforcedStyle: indented
|
@@ -893,8 +893,8 @@ Layout/SpaceAfterComma:
|
|
893
893
|
|
894
894
|
Layout/SpaceAfterMethodName:
|
895
895
|
Description: >-
|
896
|
-
|
897
|
-
|
896
|
+
Do not put a space between a method name and the opening
|
897
|
+
parenthesis in a method definition.
|
898
898
|
StyleGuide: '#parens-no-spaces'
|
899
899
|
Enabled: true
|
900
900
|
VersionAdded: '0.49'
|
@@ -922,9 +922,9 @@ Layout/SpaceAroundBlockParameters:
|
|
922
922
|
|
923
923
|
Layout/SpaceAroundEqualsInParameterDefault:
|
924
924
|
Description: >-
|
925
|
-
|
926
|
-
|
927
|
-
|
925
|
+
Checks that the equals signs in parameter default assignments
|
926
|
+
have or don't have surrounding space depending on
|
927
|
+
configuration.
|
928
928
|
StyleGuide: '#spaces-around-equals'
|
929
929
|
Enabled: true
|
930
930
|
VersionAdded: '0.49'
|
@@ -950,8 +950,8 @@ Layout/SpaceAroundOperators:
|
|
950
950
|
|
951
951
|
Layout/SpaceBeforeBlockBraces:
|
952
952
|
Description: >-
|
953
|
-
|
954
|
-
|
953
|
+
Checks that the left block brace has or doesn't have space
|
954
|
+
before it.
|
955
955
|
Enabled: true
|
956
956
|
VersionAdded: '0.49'
|
957
957
|
EnforcedStyle: space
|
@@ -971,15 +971,15 @@ Layout/SpaceBeforeComma:
|
|
971
971
|
|
972
972
|
Layout/SpaceBeforeComment:
|
973
973
|
Description: >-
|
974
|
-
|
975
|
-
|
974
|
+
Checks for missing space between code and a comment on the
|
975
|
+
same line.
|
976
976
|
Enabled: true
|
977
977
|
VersionAdded: '0.49'
|
978
978
|
|
979
979
|
Layout/SpaceBeforeFirstArg:
|
980
980
|
Description: >-
|
981
|
-
|
982
|
-
|
981
|
+
Checks that exactly one space is used between a method name
|
982
|
+
and the first argument for method calls without parentheses.
|
983
983
|
Enabled: true
|
984
984
|
VersionAdded: '0.49'
|
985
985
|
# When `true`, allows most uses of extra spacing if the intent is to align
|
@@ -1024,9 +1024,9 @@ Layout/SpaceInsideArrayPercentLiteral:
|
|
1024
1024
|
|
1025
1025
|
Layout/SpaceInsideBlockBraces:
|
1026
1026
|
Description: >-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1027
|
+
Checks that block braces have or don't have surrounding space.
|
1028
|
+
For blocks taking parameters, checks that the left brace has
|
1029
|
+
or doesn't have trailing space.
|
1030
1030
|
Enabled: true
|
1031
1031
|
VersionAdded: '0.49'
|
1032
1032
|
EnforcedStyle: space
|
@@ -1139,24 +1139,24 @@ Layout/TrailingWhitespace:
|
|
1139
1139
|
|
1140
1140
|
Lint/AmbiguousBlockAssociation:
|
1141
1141
|
Description: >-
|
1142
|
-
|
1143
|
-
|
1142
|
+
Checks for ambiguous block association with method when param passed without
|
1143
|
+
parentheses.
|
1144
1144
|
StyleGuide: '#syntax'
|
1145
1145
|
Enabled: false
|
1146
1146
|
VersionAdded: '0.48'
|
1147
1147
|
|
1148
1148
|
Lint/AmbiguousOperator:
|
1149
1149
|
Description: >-
|
1150
|
-
|
1151
|
-
|
1150
|
+
Checks for ambiguous operators in the first argument of a
|
1151
|
+
method invocation without parentheses.
|
1152
1152
|
StyleGuide: '#method-invocation-parens'
|
1153
1153
|
Enabled: false
|
1154
1154
|
VersionAdded: '0.17'
|
1155
1155
|
|
1156
1156
|
Lint/AmbiguousRegexpLiteral:
|
1157
1157
|
Description: >-
|
1158
|
-
|
1159
|
-
|
1158
|
+
Checks for ambiguous regexp literals in the first argument of
|
1159
|
+
a method invocation without parentheses.
|
1160
1160
|
Enabled: false
|
1161
1161
|
VersionAdded: '0.17'
|
1162
1162
|
|
@@ -1193,6 +1193,12 @@ Lint/DeprecatedClassMethods:
|
|
1193
1193
|
Enabled: true
|
1194
1194
|
VersionAdded: '0.19'
|
1195
1195
|
|
1196
|
+
Lint/DisjunctiveAssignmentInConstructor:
|
1197
|
+
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1198
|
+
Enabled: true
|
1199
|
+
Safe: false
|
1200
|
+
VersionAdded: '0.62'
|
1201
|
+
|
1196
1202
|
Lint/DuplicateCaseCondition:
|
1197
1203
|
Description: 'Do not repeat values in case conditionals.'
|
1198
1204
|
Enabled: true
|
@@ -1257,10 +1263,16 @@ Lint/ErbNewArguments:
|
|
1257
1263
|
Enabled: true
|
1258
1264
|
VersionAdded: '0.56'
|
1259
1265
|
|
1266
|
+
Lint/FlipFlop:
|
1267
|
+
Description: 'Checks for flip-flops'
|
1268
|
+
StyleGuide: '#no-flip-flops'
|
1269
|
+
Enabled: true
|
1270
|
+
VersionAdded: '0.16'
|
1271
|
+
|
1260
1272
|
Lint/FloatOutOfRange:
|
1261
1273
|
Description: >-
|
1262
|
-
|
1263
|
-
|
1274
|
+
Catches floating-point literals too large or small for Ruby to
|
1275
|
+
represent.
|
1264
1276
|
Enabled: true
|
1265
1277
|
VersionAdded: '0.36'
|
1266
1278
|
|
@@ -1277,15 +1289,15 @@ Lint/HandleExceptions:
|
|
1277
1289
|
|
1278
1290
|
Lint/ImplicitStringConcatenation:
|
1279
1291
|
Description: >-
|
1280
|
-
|
1281
|
-
|
1292
|
+
Checks for adjacent string literals on the same line, which
|
1293
|
+
could better be represented as a single string literal.
|
1282
1294
|
Enabled: true
|
1283
1295
|
VersionAdded: '0.36'
|
1284
1296
|
|
1285
1297
|
Lint/IneffectiveAccessModifier:
|
1286
1298
|
Description: >-
|
1287
|
-
|
1288
|
-
|
1299
|
+
Checks for attempts to use `private` or `protected` to set
|
1300
|
+
the visibility of a class method, which does not work.
|
1289
1301
|
Enabled: true
|
1290
1302
|
VersionAdded: '0.36'
|
1291
1303
|
|
@@ -1317,8 +1329,8 @@ Lint/LiteralInInterpolation:
|
|
1317
1329
|
|
1318
1330
|
Lint/Loop:
|
1319
1331
|
Description: >-
|
1320
|
-
|
1321
|
-
|
1332
|
+
Use Kernel#loop with break rather than begin/end/until or
|
1333
|
+
begin/end/while for post-loop tests.
|
1322
1334
|
StyleGuide: '#loop-with-break'
|
1323
1335
|
Enabled: true
|
1324
1336
|
VersionAdded: '0.9'
|
@@ -1354,8 +1366,8 @@ Lint/NestedPercentLiteral:
|
|
1354
1366
|
|
1355
1367
|
Lint/NextWithoutAccumulator:
|
1356
1368
|
Description: >-
|
1357
|
-
|
1358
|
-
|
1369
|
+
Do not omit the accumulator when calling `next`
|
1370
|
+
in a `reduce`/`inject` block.
|
1359
1371
|
Enabled: true
|
1360
1372
|
VersionAdded: '0.36'
|
1361
1373
|
|
@@ -1376,28 +1388,28 @@ Lint/OrderedMagicComments:
|
|
1376
1388
|
|
1377
1389
|
Lint/ParenthesesAsGroupedExpression:
|
1378
1390
|
Description: >-
|
1379
|
-
|
1380
|
-
|
1391
|
+
Checks for method calls with a space before the opening
|
1392
|
+
parenthesis.
|
1381
1393
|
StyleGuide: '#parens-no-spaces'
|
1382
1394
|
Enabled: true
|
1383
1395
|
VersionAdded: '0.12'
|
1384
1396
|
|
1385
1397
|
Lint/PercentStringArray:
|
1386
1398
|
Description: >-
|
1387
|
-
|
1399
|
+
Checks for unwanted commas and quotes in %w/%W literals.
|
1388
1400
|
Enabled: true
|
1389
1401
|
VersionAdded: '0.41'
|
1390
1402
|
|
1391
1403
|
Lint/PercentSymbolArray:
|
1392
1404
|
Description: >-
|
1393
|
-
|
1405
|
+
Checks for unwanted commas and colons in %i/%I literals.
|
1394
1406
|
Enabled: true
|
1395
1407
|
VersionAdded: '0.41'
|
1396
1408
|
|
1397
1409
|
Lint/RandOne:
|
1398
1410
|
Description: >-
|
1399
|
-
|
1400
|
-
|
1411
|
+
Checks for `rand(1)` calls. Such calls always return `0`
|
1412
|
+
and most likely a mistake.
|
1401
1413
|
Enabled: true
|
1402
1414
|
VersionAdded: '0.36'
|
1403
1415
|
|
@@ -1413,15 +1425,15 @@ Lint/RedundantWithObject:
|
|
1413
1425
|
|
1414
1426
|
Lint/RegexpAsCondition:
|
1415
1427
|
Description: >-
|
1416
|
-
|
1417
|
-
|
1428
|
+
Do not use regexp literal as a condition.
|
1429
|
+
The regexp literal matches `$_` implicitly.
|
1418
1430
|
Enabled: true
|
1419
1431
|
VersionAdded: '0.51'
|
1420
1432
|
|
1421
1433
|
Lint/RequireParentheses:
|
1422
1434
|
Description: >-
|
1423
|
-
|
1424
|
-
|
1435
|
+
Use parentheses in the method call to avoid confusion
|
1436
|
+
about precedence.
|
1425
1437
|
Enabled: true
|
1426
1438
|
VersionAdded: '0.18'
|
1427
1439
|
|
@@ -1456,9 +1468,9 @@ Lint/SafeNavigationChain:
|
|
1456
1468
|
|
1457
1469
|
Lint/SafeNavigationConsistency:
|
1458
1470
|
Description: >-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1471
|
+
Check to make sure that if safe navigation is used for a method
|
1472
|
+
call in an `&&` or `||` condition that safe navigation is used
|
1473
|
+
for all method calls on that same object.
|
1462
1474
|
Enabled: true
|
1463
1475
|
VersionAdded: '0.55'
|
1464
1476
|
Whitelist:
|
@@ -1484,15 +1496,15 @@ Lint/ShadowedArgument:
|
|
1484
1496
|
|
1485
1497
|
Lint/ShadowedException:
|
1486
1498
|
Description: >-
|
1487
|
-
|
1488
|
-
|
1499
|
+
Avoid rescuing a higher level exception
|
1500
|
+
before a lower level exception.
|
1489
1501
|
Enabled: true
|
1490
1502
|
VersionAdded: '0.41'
|
1491
1503
|
|
1492
1504
|
Lint/ShadowingOuterLocalVariable:
|
1493
1505
|
Description: >-
|
1494
|
-
|
1495
|
-
|
1506
|
+
Do not use the same name as outer local variable
|
1507
|
+
for block arguments or block local variables.
|
1496
1508
|
Enabled: true
|
1497
1509
|
VersionAdded: '0.9'
|
1498
1510
|
|
@@ -1521,9 +1533,9 @@ Lint/UnifiedInteger:
|
|
1521
1533
|
|
1522
1534
|
Lint/UnneededCopDisableDirective:
|
1523
1535
|
Description: >-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1536
|
+
Checks for rubocop:disable comments that can be removed.
|
1537
|
+
Note: this cop is not disabled when disabling all cops.
|
1538
|
+
It must be explicitly disabled.
|
1527
1539
|
Enabled: true
|
1528
1540
|
VersionAdded: '0.53'
|
1529
1541
|
|
@@ -1567,12 +1579,12 @@ Lint/UnusedMethodArgument:
|
|
1567
1579
|
|
1568
1580
|
Lint/UriEscapeUnescape:
|
1569
1581
|
Description: >-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1582
|
+
`URI.escape` method is obsolete and should not be used. Instead, use
|
1583
|
+
`CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
|
1584
|
+
depending on your specific use case.
|
1585
|
+
Also `URI.unescape` method is obsolete and should not be used. Instead, use
|
1586
|
+
`CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
|
1587
|
+
depending on your specific use case.
|
1576
1588
|
Enabled: true
|
1577
1589
|
VersionAdded: '0.50'
|
1578
1590
|
|
@@ -1620,8 +1632,8 @@ Lint/Void:
|
|
1620
1632
|
|
1621
1633
|
Metrics/AbcSize:
|
1622
1634
|
Description: >-
|
1623
|
-
|
1624
|
-
|
1635
|
+
A calculated magnitude based on number of assignments,
|
1636
|
+
branches, and conditions.
|
1625
1637
|
Reference: 'http://c2.com/cgi/wiki?AbcMetric'
|
1626
1638
|
Enabled: false
|
1627
1639
|
VersionAdded: '0.27'
|
@@ -1660,8 +1672,8 @@ Metrics/ClassLength:
|
|
1660
1672
|
# Avoid complex methods.
|
1661
1673
|
Metrics/CyclomaticComplexity:
|
1662
1674
|
Description: >-
|
1663
|
-
|
1664
|
-
|
1675
|
+
A complexity metric that is strongly correlated to the number
|
1676
|
+
of test cases needed to validate a method.
|
1665
1677
|
Enabled: false
|
1666
1678
|
VersionAdded: '0.25'
|
1667
1679
|
Max: 6
|
@@ -1715,8 +1727,8 @@ Metrics/ParameterLists:
|
|
1715
1727
|
|
1716
1728
|
Metrics/PerceivedComplexity:
|
1717
1729
|
Description: >-
|
1718
|
-
|
1719
|
-
|
1730
|
+
A complexity metric geared towards measuring complexity for a
|
1731
|
+
human reader.
|
1720
1732
|
Enabled: false
|
1721
1733
|
VersionAdded: '0.25'
|
1722
1734
|
Max: 7
|
@@ -1888,8 +1900,8 @@ Naming/PredicateName:
|
|
1888
1900
|
|
1889
1901
|
Naming/UncommunicativeBlockParamName:
|
1890
1902
|
Description: >-
|
1891
|
-
|
1892
|
-
|
1903
|
+
Checks for block parameter names that contain capital letters,
|
1904
|
+
end in numbers, or do not meet a minimal length.
|
1893
1905
|
Enabled: false
|
1894
1906
|
VersionAdded: '0.53'
|
1895
1907
|
# Parameter names may be equal to or greater than this value
|
@@ -1902,8 +1914,8 @@ Naming/UncommunicativeBlockParamName:
|
|
1902
1914
|
|
1903
1915
|
Naming/UncommunicativeMethodParamName:
|
1904
1916
|
Description: >-
|
1905
|
-
|
1906
|
-
|
1917
|
+
Checks for method parameter names that contain capital letters,
|
1918
|
+
end in numbers, or do not meet a minimal length.
|
1907
1919
|
Enabled: false
|
1908
1920
|
VersionAdded: '0.53'
|
1909
1921
|
VersionChanged: '0.59'
|
@@ -1949,14 +1961,14 @@ Naming/VariableNumber:
|
|
1949
1961
|
|
1950
1962
|
Performance/Caller:
|
1951
1963
|
Description: >-
|
1952
|
-
|
1964
|
+
Use `caller(n..n)` instead of `caller`.
|
1953
1965
|
Enabled: true
|
1954
1966
|
VersionAdded: '0.49'
|
1955
1967
|
|
1956
1968
|
Performance/CaseWhenSplat:
|
1957
1969
|
Description: >-
|
1958
|
-
|
1959
|
-
|
1970
|
+
Reordering `when` conditions with a splat to the end
|
1971
|
+
of the `when` branches can improve performance.
|
1960
1972
|
Enabled: false
|
1961
1973
|
AutoCorrect: false
|
1962
1974
|
SafeAutoCorrect: false
|
@@ -1965,15 +1977,15 @@ Performance/CaseWhenSplat:
|
|
1965
1977
|
|
1966
1978
|
Performance/Casecmp:
|
1967
1979
|
Description: >-
|
1968
|
-
|
1980
|
+
Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
|
1969
1981
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
|
1970
1982
|
Enabled: false
|
1971
1983
|
VersionAdded: '0.36'
|
1972
1984
|
|
1973
1985
|
Performance/ChainArrayAllocation:
|
1974
1986
|
Description: >-
|
1975
|
-
|
1976
|
-
|
1987
|
+
Instead of chaining array methods that allocate new arrays, mutate an
|
1988
|
+
existing array.
|
1977
1989
|
Reference: 'https://twitter.com/schneems/status/1034123879978029057'
|
1978
1990
|
Enabled: false
|
1979
1991
|
VersionAdded: '0.59'
|
@@ -1985,9 +1997,9 @@ Performance/CompareWithBlock:
|
|
1985
1997
|
|
1986
1998
|
Performance/Count:
|
1987
1999
|
Description: >-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
2000
|
+
Use `count` instead of `select...size`, `reject...size`,
|
2001
|
+
`select...count`, `reject...count`, `select...length`,
|
2002
|
+
and `reject...length`.
|
1991
2003
|
# This cop has known compatibility issues with `ActiveRecord` and other
|
1992
2004
|
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
1993
2005
|
# For more information, see the documentation in the cop itself.
|
@@ -1999,8 +2011,8 @@ Performance/Count:
|
|
1999
2011
|
|
2000
2012
|
Performance/Detect:
|
2001
2013
|
Description: >-
|
2002
|
-
|
2003
|
-
|
2014
|
+
Use `detect` instead of `select.first`, `find_all.first`,
|
2015
|
+
`select.last`, and `find_all.last`.
|
2004
2016
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
2005
2017
|
# This cop has known compatibility issues with `ActiveRecord` and other
|
2006
2018
|
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
@@ -2013,8 +2025,8 @@ Performance/Detect:
|
|
2013
2025
|
|
2014
2026
|
Performance/DoubleStartEndWith:
|
2015
2027
|
Description: >-
|
2016
|
-
|
2017
|
-
|
2028
|
+
Use `str.{start,end}_with?(x, ..., y, ...)`
|
2029
|
+
instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
2018
2030
|
Enabled: true
|
2019
2031
|
VersionAdded: '0.36'
|
2020
2032
|
VersionChanged: '0.48'
|
@@ -2041,9 +2053,9 @@ Performance/FixedSize:
|
|
2041
2053
|
|
2042
2054
|
Performance/FlatMap:
|
2043
2055
|
Description: >-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2056
|
+
Use `Enumerable#flat_map`
|
2057
|
+
instead of `Enumerable#map...Array#flatten(1)`
|
2058
|
+
or `Enumberable#collect..Array#flatten(1)`
|
2047
2059
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
2048
2060
|
Enabled: true
|
2049
2061
|
VersionAdded: '0.30'
|
@@ -2076,6 +2088,7 @@ Performance/RangeInclude:
|
|
2076
2088
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
|
2077
2089
|
Enabled: true
|
2078
2090
|
VersionAdded: '0.36'
|
2091
|
+
Safe: false
|
2079
2092
|
|
2080
2093
|
Performance/RedundantBlockCall:
|
2081
2094
|
Description: 'Use `yield` instead of `block.call`.'
|
@@ -2085,8 +2098,8 @@ Performance/RedundantBlockCall:
|
|
2085
2098
|
|
2086
2099
|
Performance/RedundantMatch:
|
2087
2100
|
Description: >-
|
2088
|
-
|
2089
|
-
|
2101
|
+
Use `=~` instead of `String#match` or `Regexp#match` in a context where the
|
2102
|
+
returned `MatchData` is not needed.
|
2090
2103
|
Enabled: true
|
2091
2104
|
VersionAdded: '0.36'
|
2092
2105
|
|
@@ -2105,8 +2118,8 @@ Performance/RedundantSortBy:
|
|
2105
2118
|
|
2106
2119
|
Performance/RegexpMatch:
|
2107
2120
|
Description: >-
|
2108
|
-
|
2109
|
-
|
2121
|
+
Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
|
2122
|
+
`Regexp#===`, or `=~` when `MatchData` is not used.
|
2110
2123
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
|
2111
2124
|
Enabled: true
|
2112
2125
|
VersionAdded: '0.47'
|
@@ -2119,16 +2132,16 @@ Performance/ReverseEach:
|
|
2119
2132
|
|
2120
2133
|
Performance/Sample:
|
2121
2134
|
Description: >-
|
2122
|
-
|
2123
|
-
|
2135
|
+
Use `sample` instead of `shuffle.first`,
|
2136
|
+
`shuffle.last`, and `shuffle[Integer]`.
|
2124
2137
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
2125
2138
|
Enabled: true
|
2126
2139
|
VersionAdded: '0.30'
|
2127
2140
|
|
2128
2141
|
Performance/Size:
|
2129
2142
|
Description: >-
|
2130
|
-
|
2131
|
-
|
2143
|
+
Use `size` instead of `count` for counting
|
2144
|
+
the number of elements in `Array` and `Hash`.
|
2132
2145
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
|
2133
2146
|
Enabled: true
|
2134
2147
|
VersionAdded: '0.30'
|
@@ -2147,9 +2160,9 @@ Performance/StartWith:
|
|
2147
2160
|
|
2148
2161
|
Performance/StringReplacement:
|
2149
2162
|
Description: >-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2163
|
+
Use `tr` instead of `gsub` when you are replacing the same
|
2164
|
+
number of characters. Use `delete` instead of `gsub` when
|
2165
|
+
you are deleting characters.
|
2153
2166
|
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
2154
2167
|
Enabled: false
|
2155
2168
|
VersionAdded: '0.33'
|
@@ -2169,8 +2182,8 @@ Performance/UnfreezeString:
|
|
2169
2182
|
|
2170
2183
|
Performance/UnneededSort:
|
2171
2184
|
Description: >-
|
2172
|
-
|
2173
|
-
|
2185
|
+
Use `min` instead of `sort.first`,
|
2186
|
+
`max_by` instead of `sort_by...last`, etc.
|
2174
2187
|
Enabled: true
|
2175
2188
|
VersionAdded: '0.55'
|
2176
2189
|
|
@@ -2199,17 +2212,17 @@ Rails/ActionFilter:
|
|
2199
2212
|
|
2200
2213
|
Rails/ActiveRecordAliases:
|
2201
2214
|
Description: >-
|
2202
|
-
|
2203
|
-
|
2204
|
-
|
2215
|
+
Avoid Active Record aliases:
|
2216
|
+
Use `update` instead of `update_attributes`.
|
2217
|
+
Use `update!` instead of `update_attributes!`.
|
2205
2218
|
Enabled: true
|
2206
2219
|
VersionAdded: '0.53'
|
2207
2220
|
|
2208
2221
|
Rails/ActiveSupportAliases:
|
2209
2222
|
Description: >-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2223
|
+
Avoid ActiveSupport aliases of standard ruby methods:
|
2224
|
+
`String#starts_with?`, `String#ends_with?`,
|
2225
|
+
`Array#append`, `Array#prepend`.
|
2213
2226
|
Enabled: false
|
2214
2227
|
VersionAdded: '0.48'
|
2215
2228
|
|
@@ -2230,6 +2243,13 @@ Rails/AssertNot:
|
|
2230
2243
|
Include:
|
2231
2244
|
- '**/test/**/*'
|
2232
2245
|
|
2246
|
+
Rails/BelongsTo:
|
2247
|
+
Description: >-
|
2248
|
+
Use `optional: true` instead of `required: false` for
|
2249
|
+
`belongs_to` relations'
|
2250
|
+
Enabled: true
|
2251
|
+
VersionAdded: '0.62'
|
2252
|
+
|
2233
2253
|
Rails/Blank:
|
2234
2254
|
Description: 'Enforces use of `blank?`.'
|
2235
2255
|
Enabled: true
|
@@ -2254,8 +2274,8 @@ Rails/BulkChangeTable:
|
|
2254
2274
|
|
2255
2275
|
Rails/CreateTableWithTimestamps:
|
2256
2276
|
Description: >-
|
2257
|
-
|
2258
|
-
|
2277
|
+
Checks the migration for which timestamps are not included
|
2278
|
+
when creating a new table.
|
2259
2279
|
Enabled: true
|
2260
2280
|
VersionAdded: '0.52'
|
2261
2281
|
Include:
|
@@ -2263,8 +2283,8 @@ Rails/CreateTableWithTimestamps:
|
|
2263
2283
|
|
2264
2284
|
Rails/Date:
|
2265
2285
|
Description: >-
|
2266
|
-
|
2267
|
-
|
2286
|
+
Checks the correct usage of date aware methods,
|
2287
|
+
such as Date.today, Date.current etc.
|
2268
2288
|
Enabled: false # It's not that simple. Really.
|
2269
2289
|
VersionAdded: '0.30'
|
2270
2290
|
VersionChanged: '0.33'
|
@@ -2315,9 +2335,9 @@ Rails/EnvironmentComparison:
|
|
2315
2335
|
|
2316
2336
|
Rails/Exit:
|
2317
2337
|
Description: >-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2338
|
+
Favor `fail`, `break`, `return`, etc. over `exit` in
|
2339
|
+
application or library code outside of Rake files to avoid
|
2340
|
+
exits during unit testing or running in production.
|
2321
2341
|
Enabled: true
|
2322
2342
|
VersionAdded: '0.41'
|
2323
2343
|
Include:
|
@@ -2386,6 +2406,14 @@ Rails/HttpStatus:
|
|
2386
2406
|
- numeric
|
2387
2407
|
- symbolic
|
2388
2408
|
|
2409
|
+
Rails/IgnoredSkipActionFilterOption:
|
2410
|
+
Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
|
2411
|
+
Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
|
2412
|
+
Enabled: true
|
2413
|
+
VersionAdded: '0.63'
|
2414
|
+
Include:
|
2415
|
+
- app/controllers/**/*.rb
|
2416
|
+
|
2389
2417
|
Rails/InverseOf:
|
2390
2418
|
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
2391
2419
|
Enabled: true
|
@@ -2453,8 +2481,8 @@ Rails/Present:
|
|
2453
2481
|
|
2454
2482
|
Rails/ReadWriteAttribute:
|
2455
2483
|
Description: >-
|
2456
|
-
|
2457
|
-
|
2484
|
+
Checks for read_attribute(:attr) and
|
2485
|
+
write_attribute(:attr, val).
|
2458
2486
|
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
|
2459
2487
|
Enabled: true
|
2460
2488
|
VersionAdded: '0.20'
|
@@ -2467,6 +2495,11 @@ Rails/RedundantReceiverInWithOptions:
|
|
2467
2495
|
Enabled: true
|
2468
2496
|
VersionAdded: '0.52'
|
2469
2497
|
|
2498
|
+
Rails/ReflectionClassName:
|
2499
|
+
Description: 'Use a string for `class_name` option value in the definition of a reflection.'
|
2500
|
+
Enabled: true
|
2501
|
+
VersionAdded: '0.64'
|
2502
|
+
|
2470
2503
|
Rails/RefuteMethods:
|
2471
2504
|
Description: 'Use `assert_not` methods instead of `refute` methods.'
|
2472
2505
|
Enabled: true
|
@@ -2527,8 +2560,8 @@ Rails/ScopeArgs:
|
|
2527
2560
|
|
2528
2561
|
Rails/SkipsModelValidations:
|
2529
2562
|
Description: >-
|
2530
|
-
|
2531
|
-
|
2563
|
+
Use methods that skips model validations with caution.
|
2564
|
+
See reference for more information.
|
2532
2565
|
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
2533
2566
|
Enabled: false
|
2534
2567
|
VersionAdded: '0.47'
|
@@ -2598,8 +2631,8 @@ Security/Eval:
|
|
2598
2631
|
|
2599
2632
|
Security/JSONLoad:
|
2600
2633
|
Description: >-
|
2601
|
-
|
2602
|
-
|
2634
|
+
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2635
|
+
security issues. See reference for more information.
|
2603
2636
|
Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2604
2637
|
Enabled: true
|
2605
2638
|
VersionAdded: '0.43'
|
@@ -2611,8 +2644,8 @@ Security/JSONLoad:
|
|
2611
2644
|
|
2612
2645
|
Security/MarshalLoad:
|
2613
2646
|
Description: >-
|
2614
|
-
|
2615
|
-
|
2647
|
+
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2648
|
+
security issues. See reference for more information.
|
2616
2649
|
Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
|
2617
2650
|
Enabled: true
|
2618
2651
|
VersionAdded: '0.47'
|
@@ -2625,8 +2658,8 @@ Security/Open:
|
|
2625
2658
|
|
2626
2659
|
Security/YAMLLoad:
|
2627
2660
|
Description: >-
|
2628
|
-
|
2629
|
-
|
2661
|
+
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2662
|
+
security issues. See reference for more information.
|
2630
2663
|
Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2631
2664
|
Enabled: true
|
2632
2665
|
VersionAdded: '0.47'
|
@@ -2719,9 +2752,9 @@ Style/BlockComments:
|
|
2719
2752
|
|
2720
2753
|
Style/BlockDelimiters:
|
2721
2754
|
Description: >-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2755
|
+
Avoid using {...} for multi-line blocks (multiline chaining is
|
2756
|
+
always ugly).
|
2757
|
+
Prefer {...} over do...end for single-line blocks.
|
2725
2758
|
StyleGuide: '#single-line-blocks'
|
2726
2759
|
Enabled: true
|
2727
2760
|
VersionAdded: '0.30'
|
@@ -2932,8 +2965,8 @@ Style/CommandLiteral:
|
|
2932
2965
|
# Checks formatting of special comments
|
2933
2966
|
Style/CommentAnnotation:
|
2934
2967
|
Description: >-
|
2935
|
-
|
2936
|
-
|
2968
|
+
Checks formatting of special comments
|
2969
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
2937
2970
|
StyleGuide: '#annotate-keywords'
|
2938
2971
|
Enabled: true
|
2939
2972
|
VersionAdded: '0.10'
|
@@ -2952,9 +2985,9 @@ Style/CommentedKeyword:
|
|
2952
2985
|
|
2953
2986
|
Style/ConditionalAssignment:
|
2954
2987
|
Description: >-
|
2955
|
-
|
2956
|
-
|
2957
|
-
|
2988
|
+
Use the return value of `if` and `case` statements for
|
2989
|
+
assignment to a variable and variable comparison instead
|
2990
|
+
of assigning that variable inside of each branch.
|
2958
2991
|
Enabled: true # We usually want this, except when assigning multiple values. Disable, if this cop contradicts that.
|
2959
2992
|
VersionAdded: '0.36'
|
2960
2993
|
VersionChanged: '0.47'
|
@@ -3013,8 +3046,8 @@ Style/DefWithParentheses:
|
|
3013
3046
|
|
3014
3047
|
Style/Dir:
|
3015
3048
|
Description: >-
|
3016
|
-
|
3017
|
-
|
3049
|
+
Use the `__dir__` method to retrieve the canonicalized
|
3050
|
+
absolute path to the current file.
|
3018
3051
|
Enabled: true
|
3019
3052
|
VersionAdded: '0.50'
|
3020
3053
|
|
@@ -3043,8 +3076,8 @@ Style/DoubleNegation:
|
|
3043
3076
|
|
3044
3077
|
Style/EachForSimpleLoop:
|
3045
3078
|
Description: >-
|
3046
|
-
|
3047
|
-
|
3079
|
+
Use `Integer#times` for a simple loop which iterates a fixed
|
3080
|
+
number of times.
|
3048
3081
|
Enabled: true
|
3049
3082
|
VersionAdded: '0.41'
|
3050
3083
|
|
@@ -3130,12 +3163,6 @@ Style/ExpandPathArguments:
|
|
3130
3163
|
Enabled: true
|
3131
3164
|
VersionAdded: '0.53'
|
3132
3165
|
|
3133
|
-
Style/FlipFlop:
|
3134
|
-
Description: 'Checks for flip flops'
|
3135
|
-
StyleGuide: '#no-flip-flops'
|
3136
|
-
Enabled: true
|
3137
|
-
VersionAdded: '0.16'
|
3138
|
-
|
3139
3166
|
Style/For:
|
3140
3167
|
Description: 'Checks use of for or each in multiline loops.'
|
3141
3168
|
StyleGuide: '#no-for-loops'
|
@@ -3175,8 +3202,8 @@ Style/FormatStringToken:
|
|
3175
3202
|
|
3176
3203
|
Style/FrozenStringLiteralComment:
|
3177
3204
|
Description: >-
|
3178
|
-
|
3179
|
-
|
3205
|
+
Add the frozen_string_literal comment to the top of files
|
3206
|
+
to help transition to frozen string literals by default.
|
3180
3207
|
Enabled: false
|
3181
3208
|
VersionAdded: '0.36'
|
3182
3209
|
VersionChanged: '0.47'
|
@@ -3215,8 +3242,8 @@ Style/GuardClause:
|
|
3215
3242
|
|
3216
3243
|
Style/HashSyntax:
|
3217
3244
|
Description: >-
|
3218
|
-
|
3219
|
-
|
3245
|
+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
3246
|
+
{ :a => 1, :b => 2 }.
|
3220
3247
|
StyleGuide: '#hash-literals'
|
3221
3248
|
Enabled: true
|
3222
3249
|
VersionAdded: '0.9'
|
@@ -3238,9 +3265,9 @@ Style/HashSyntax:
|
|
3238
3265
|
|
3239
3266
|
Style/IdenticalConditionalBranches:
|
3240
3267
|
Description: >-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3268
|
+
Checks that conditional statements do not have an identical
|
3269
|
+
line at the end of each branch, which can validly be moved
|
3270
|
+
out of the conditional.
|
3244
3271
|
Enabled: true
|
3245
3272
|
VersionAdded: '0.36'
|
3246
3273
|
|
@@ -3251,8 +3278,8 @@ Style/IfInsideElse:
|
|
3251
3278
|
|
3252
3279
|
Style/IfUnlessModifier:
|
3253
3280
|
Description: >-
|
3254
|
-
|
3255
|
-
|
3281
|
+
Favor modifier if/unless usage when you have a
|
3282
|
+
single-line body.
|
3256
3283
|
StyleGuide: '#if-as-a-modifier'
|
3257
3284
|
Enabled: false
|
3258
3285
|
VersionAdded: '0.9'
|
@@ -3260,7 +3287,7 @@ Style/IfUnlessModifier:
|
|
3260
3287
|
|
3261
3288
|
Style/IfUnlessModifierOfIfUnless:
|
3262
3289
|
Description: >-
|
3263
|
-
|
3290
|
+
Avoid modifier if/unless usage on conditionals.
|
3264
3291
|
Enabled: true
|
3265
3292
|
VersionAdded: '0.39'
|
3266
3293
|
|
@@ -3272,8 +3299,8 @@ Style/IfWithSemicolon:
|
|
3272
3299
|
|
3273
3300
|
Style/ImplicitRuntimeError:
|
3274
3301
|
Description: >-
|
3275
|
-
|
3276
|
-
|
3302
|
+
Use `raise` or `fail` with an explicit exception class and
|
3303
|
+
message, rather than just a message.
|
3277
3304
|
Enabled: false
|
3278
3305
|
VersionAdded: '0.41'
|
3279
3306
|
|
@@ -3292,8 +3319,8 @@ Style/InlineComment:
|
|
3292
3319
|
|
3293
3320
|
Style/InverseMethods:
|
3294
3321
|
Description: >-
|
3295
|
-
|
3296
|
-
|
3322
|
+
Use the inverse method instead of `!.method`
|
3323
|
+
if an inverse method is defined.
|
3297
3324
|
Enabled: true
|
3298
3325
|
Safe: false
|
3299
3326
|
VersionAdded: '0.48'
|
@@ -3351,10 +3378,12 @@ Style/LambdaCall:
|
|
3351
3378
|
|
3352
3379
|
Style/LineEndConcatenation:
|
3353
3380
|
Description: >-
|
3354
|
-
|
3355
|
-
|
3381
|
+
Use \ instead of + or << to concatenate two string literals at
|
3382
|
+
line end.
|
3356
3383
|
Enabled: true
|
3384
|
+
SafeAutoCorrect: false
|
3357
3385
|
VersionAdded: '0.18'
|
3386
|
+
VersionChanged: '0.64'
|
3358
3387
|
|
3359
3388
|
Style/MethodCallWithArgsParentheses:
|
3360
3389
|
Description: 'Use parentheses for method calls with arguments.'
|
@@ -3366,6 +3395,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3366
3395
|
IgnoredMethods: []
|
3367
3396
|
AllowParenthesesInMultilineCall: false
|
3368
3397
|
AllowParenthesesInChaining: false
|
3398
|
+
AllowParenthesesInCamelCaseMethod: false
|
3369
3399
|
EnforcedStyle: require_parentheses
|
3370
3400
|
SupportedStyles:
|
3371
3401
|
- require_parentheses
|
@@ -3387,8 +3417,8 @@ Style/MethodCalledOnDoEndBlock:
|
|
3387
3417
|
|
3388
3418
|
Style/MethodDefParentheses:
|
3389
3419
|
Description: >-
|
3390
|
-
|
3391
|
-
|
3420
|
+
Checks if the method definitions have or don't have
|
3421
|
+
parentheses.
|
3392
3422
|
StyleGuide: '#method-parens'
|
3393
3423
|
Enabled: true
|
3394
3424
|
VersionAdded: '0.16'
|
@@ -3407,18 +3437,18 @@ Style/MethodMissingSuper:
|
|
3407
3437
|
|
3408
3438
|
Style/MinMax:
|
3409
3439
|
Description: >-
|
3410
|
-
|
3411
|
-
|
3440
|
+
Use `Enumerable#minmax` instead of `Enumerable#min`
|
3441
|
+
and `Enumerable#max` in conjunction.'
|
3412
3442
|
Enabled: true
|
3413
3443
|
VersionAdded: '0.50'
|
3414
3444
|
|
3415
3445
|
Style/MissingElse:
|
3416
3446
|
Description: >-
|
3417
|
-
|
3418
|
-
|
3419
|
-
|
3420
|
-
|
3421
|
-
|
3447
|
+
Require if/case expressions to have an else branches.
|
3448
|
+
If enabled, it is recommended that
|
3449
|
+
Style/UnlessElse and Style/EmptyElse be enabled.
|
3450
|
+
This will conflict with Style/EmptyElse if
|
3451
|
+
Style/EmptyElse is configured to style "both"
|
3422
3452
|
Enabled: false
|
3423
3453
|
VersionAdded: '0.30'
|
3424
3454
|
VersionChanged: '0.38'
|
@@ -3433,8 +3463,8 @@ Style/MissingElse:
|
|
3433
3463
|
|
3434
3464
|
Style/MissingRespondToMissing:
|
3435
3465
|
Description: >-
|
3436
|
-
|
3437
|
-
|
3466
|
+
Checks if `method_missing` is implemented
|
3467
|
+
without implementing `respond_to_missing`.
|
3438
3468
|
StyleGuide: '#no-method-missing'
|
3439
3469
|
Enabled: true
|
3440
3470
|
VersionAdded: '0.56'
|
@@ -3462,17 +3492,21 @@ Style/ModuleFunction:
|
|
3462
3492
|
StyleGuide: '#module-function'
|
3463
3493
|
Enabled: true
|
3464
3494
|
VersionAdded: '0.11'
|
3465
|
-
VersionChanged: '0.
|
3495
|
+
VersionChanged: '0.65'
|
3466
3496
|
EnforcedStyle: module_function
|
3467
3497
|
SupportedStyles:
|
3468
3498
|
- module_function
|
3469
3499
|
- extend_self
|
3500
|
+
Autocorrect: false
|
3501
|
+
SafeAutoCorrect: false
|
3470
3502
|
|
3471
3503
|
Style/MultilineBlockChain:
|
3472
3504
|
Description: 'Avoid multi-line chains of blocks.'
|
3473
3505
|
StyleGuide: '#single-line-blocks'
|
3474
3506
|
Enabled: true
|
3475
3507
|
VersionAdded: '0.13'
|
3508
|
+
Exclude:
|
3509
|
+
- 'spec/**/*' # See https://github.com/makandra/makandra-rubocop/issues/5 for more details
|
3476
3510
|
|
3477
3511
|
Style/MultilineIfModifier:
|
3478
3512
|
Description: 'Only use if/unless modifiers on single line statements.'
|
@@ -3504,16 +3538,16 @@ Style/MultilineMethodSignature:
|
|
3504
3538
|
|
3505
3539
|
Style/MultilineTernaryOperator:
|
3506
3540
|
Description: >-
|
3507
|
-
|
3508
|
-
|
3541
|
+
Avoid multi-line ?: (the ternary operator);
|
3542
|
+
use if/unless instead.
|
3509
3543
|
StyleGuide: '#no-multiline-ternary'
|
3510
3544
|
Enabled: true
|
3511
3545
|
VersionAdded: '0.9'
|
3512
3546
|
|
3513
3547
|
Style/MultipleComparison:
|
3514
3548
|
Description: >-
|
3515
|
-
|
3516
|
-
|
3549
|
+
Avoid comparing a variable with multiple items in a conditional,
|
3550
|
+
use Array#include? instead.
|
3517
3551
|
Enabled: true
|
3518
3552
|
VersionAdded: '0.49'
|
3519
3553
|
|
@@ -3521,11 +3555,22 @@ Style/MutableConstant:
|
|
3521
3555
|
Description: 'Do not assign mutable objects to constants.'
|
3522
3556
|
Enabled: true
|
3523
3557
|
VersionAdded: '0.34'
|
3558
|
+
VersionChanged: '0.65'
|
3559
|
+
EnforcedStyle: literals
|
3560
|
+
SupportedStyles:
|
3561
|
+
# literals: freeze literals assigned to constants
|
3562
|
+
# strict: freeze all constants
|
3563
|
+
# Strict mode is considered an experimental feature. It has not been updated
|
3564
|
+
# with an exhaustive list of all methods that will produce frozen objects so
|
3565
|
+
# there is a decent chance of getting some false positives. Luckily, there is
|
3566
|
+
# no harm in freezing an already frozen object.
|
3567
|
+
- literals
|
3568
|
+
- strict
|
3524
3569
|
|
3525
3570
|
Style/NegatedIf:
|
3526
3571
|
Description: >-
|
3527
|
-
|
3528
|
-
|
3572
|
+
Favor unless over if for negative conditions
|
3573
|
+
(or control flow or).
|
3529
3574
|
StyleGuide: '#unless-for-negatives'
|
3530
3575
|
Enabled: true
|
3531
3576
|
VersionAdded: '0.20'
|
@@ -3553,8 +3598,8 @@ Style/NestedModifier:
|
|
3553
3598
|
|
3554
3599
|
Style/NestedParenthesizedCalls:
|
3555
3600
|
Description: >-
|
3556
|
-
|
3557
|
-
|
3601
|
+
Parenthesize method calls which are nested inside the
|
3602
|
+
argument list of another parenthesized method call.
|
3558
3603
|
Enabled: true
|
3559
3604
|
VersionAdded: '0.36'
|
3560
3605
|
VersionChanged: '0.50'
|
@@ -3645,8 +3690,8 @@ Style/NumericLiteralPrefix:
|
|
3645
3690
|
|
3646
3691
|
Style/NumericLiterals:
|
3647
3692
|
Description: >-
|
3648
|
-
|
3649
|
-
|
3693
|
+
Add underscores to large numeric literals to improve their
|
3694
|
+
readability.
|
3650
3695
|
StyleGuide: '#underscores-in-numerics'
|
3651
3696
|
Enabled: false
|
3652
3697
|
VersionAdded: '0.9'
|
@@ -3656,8 +3701,8 @@ Style/NumericLiterals:
|
|
3656
3701
|
|
3657
3702
|
Style/NumericPredicate:
|
3658
3703
|
Description: >-
|
3659
|
-
|
3660
|
-
|
3704
|
+
Checks for the use of predicate- or comparison methods for
|
3705
|
+
numeric comparisons.
|
3661
3706
|
StyleGuide: '#predicate-methods'
|
3662
3707
|
Safe: false
|
3663
3708
|
# This will change to a new method call which isn't guaranteed to be on the
|
@@ -3680,8 +3725,8 @@ Style/NumericPredicate:
|
|
3680
3725
|
|
3681
3726
|
Style/OneLineConditional:
|
3682
3727
|
Description: >-
|
3683
|
-
|
3684
|
-
|
3728
|
+
Favor the ternary operator(?:) over
|
3729
|
+
if/then/else/end constructs.
|
3685
3730
|
StyleGuide: '#ternary-operator'
|
3686
3731
|
Enabled: true
|
3687
3732
|
VersionAdded: '0.9'
|
@@ -3702,8 +3747,8 @@ Style/OptionHash:
|
|
3702
3747
|
|
3703
3748
|
Style/OptionalArguments:
|
3704
3749
|
Description: >-
|
3705
|
-
|
3706
|
-
|
3750
|
+
Checks for optional arguments that do not appear at the end
|
3751
|
+
of the argument list
|
3707
3752
|
StyleGuide: '#optional-arguments'
|
3708
3753
|
Enabled: false # We want to support helpers like link_to where the link text may be the first argument or be defined by a block
|
3709
3754
|
VersionAdded: '0.33'
|
@@ -3716,17 +3761,17 @@ Style/OrAssignment:
|
|
3716
3761
|
|
3717
3762
|
Style/ParallelAssignment:
|
3718
3763
|
Description: >-
|
3719
|
-
|
3720
|
-
|
3721
|
-
|
3764
|
+
Check for simple usages of parallel assignment.
|
3765
|
+
It will only warn when the number of variables
|
3766
|
+
matches on both sides of the assignment.
|
3722
3767
|
StyleGuide: '#parallel-assignment'
|
3723
3768
|
Enabled: true
|
3724
3769
|
VersionAdded: '0.32'
|
3725
3770
|
|
3726
3771
|
Style/ParenthesesAroundCondition:
|
3727
3772
|
Description: >-
|
3728
|
-
|
3729
|
-
|
3773
|
+
Don't use parentheses around the condition of an
|
3774
|
+
if/unless/while.
|
3730
3775
|
StyleGuide: '#no-parens-around-condition'
|
3731
3776
|
Enabled: true
|
3732
3777
|
VersionAdded: '0.9'
|
@@ -3797,8 +3842,8 @@ Style/RaiseArgs:
|
|
3797
3842
|
|
3798
3843
|
Style/RandomWithOffset:
|
3799
3844
|
Description: >-
|
3800
|
-
|
3801
|
-
|
3845
|
+
Prefer to use ranges when generating random numbers instead of
|
3846
|
+
integers with offsets.
|
3802
3847
|
StyleGuide: '#random-numbers'
|
3803
3848
|
Enabled: true
|
3804
3849
|
VersionAdded: '0.52'
|
@@ -3895,12 +3940,12 @@ Style/ReturnNil:
|
|
3895
3940
|
|
3896
3941
|
Style/SafeNavigation:
|
3897
3942
|
Description: >-
|
3898
|
-
|
3899
|
-
|
3900
|
-
|
3943
|
+
This cop transforms usages of a method call safeguarded by
|
3944
|
+
a check for the existence of the object to
|
3945
|
+
safe navigation (`&.`).
|
3901
3946
|
Enabled: true
|
3902
3947
|
VersionAdded: '0.43'
|
3903
|
-
VersionChanged: '0.
|
3948
|
+
VersionChanged: '0.56'
|
3904
3949
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
3905
3950
|
# to whatever it used to return.
|
3906
3951
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -3910,12 +3955,11 @@ Style/SafeNavigation:
|
|
3910
3955
|
- presence
|
3911
3956
|
- try
|
3912
3957
|
- try!
|
3913
|
-
VersionChanged: '0.56'
|
3914
3958
|
|
3915
3959
|
Style/SelfAssignment:
|
3916
3960
|
Description: >-
|
3917
|
-
|
3918
|
-
|
3961
|
+
Checks for places where self-assignment shorthand should have
|
3962
|
+
been used.
|
3919
3963
|
StyleGuide: '#self-assignment'
|
3920
3964
|
Enabled: true
|
3921
3965
|
VersionAdded: '0.19'
|
@@ -4019,8 +4063,8 @@ Style/StringLiterals:
|
|
4019
4063
|
|
4020
4064
|
Style/StringLiteralsInInterpolation:
|
4021
4065
|
Description: >-
|
4022
|
-
|
4023
|
-
|
4066
|
+
Checks if uses of quotes inside expressions in interpolated
|
4067
|
+
strings match the configured preference.
|
4024
4068
|
Enabled: true
|
4025
4069
|
VersionAdded: '0.27'
|
4026
4070
|
EnforcedStyle: single_quotes
|
@@ -4068,8 +4112,9 @@ Style/SymbolLiteral:
|
|
4068
4112
|
Style/SymbolProc:
|
4069
4113
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
4070
4114
|
Enabled: false # We can't enforce this because of "Can't create Binding from C level Proc" errors, and because it messes up arity checks.
|
4115
|
+
SafeAutoCorrect: false
|
4071
4116
|
VersionAdded: '0.26'
|
4072
|
-
VersionChanged: '0.
|
4117
|
+
VersionChanged: '0.64'
|
4073
4118
|
# A list of method names to be ignored by the check.
|
4074
4119
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4075
4120
|
IgnoredMethods:
|
@@ -4153,8 +4198,8 @@ Style/TrailingMethodEndStatement:
|
|
4153
4198
|
|
4154
4199
|
Style/TrailingUnderscoreVariable:
|
4155
4200
|
Description: >-
|
4156
|
-
|
4157
|
-
|
4201
|
+
Checks for the usage of unneeded trailing underscores at the
|
4202
|
+
end of parallel variable assignment.
|
4158
4203
|
AllowNamedUnderscoreVariables: true
|
4159
4204
|
Enabled: true
|
4160
4205
|
VersionAdded: '0.31'
|
@@ -4209,8 +4254,8 @@ Style/TrivialAccessors:
|
|
4209
4254
|
|
4210
4255
|
Style/UnlessElse:
|
4211
4256
|
Description: >-
|
4212
|
-
|
4213
|
-
|
4257
|
+
Do not use unless with else. Rewrite these with the positive
|
4258
|
+
case first.
|
4214
4259
|
StyleGuide: '#no-else-with-unless'
|
4215
4260
|
Enabled: true
|
4216
4261
|
VersionAdded: '0.9'
|
@@ -4239,15 +4284,15 @@ Style/UnneededPercentQ:
|
|
4239
4284
|
|
4240
4285
|
Style/UnpackFirst:
|
4241
4286
|
Description: >-
|
4242
|
-
|
4243
|
-
|
4287
|
+
Checks for accessing the first element of `String#unpack`
|
4288
|
+
instead of using `unpack1`
|
4244
4289
|
Enabled: false
|
4245
4290
|
VersionAdded: '0.54'
|
4246
4291
|
|
4247
4292
|
Style/VariableInterpolation:
|
4248
4293
|
Description: >-
|
4249
|
-
|
4250
|
-
|
4294
|
+
Don't interpolate global, instance and class variables
|
4295
|
+
directly in strings.
|
4251
4296
|
StyleGuide: '#curlies-interpolate'
|
4252
4297
|
Enabled: true
|
4253
4298
|
VersionAdded: '0.9'
|
@@ -4267,8 +4312,8 @@ Style/WhileUntilDo:
|
|
4267
4312
|
|
4268
4313
|
Style/WhileUntilModifier:
|
4269
4314
|
Description: >-
|
4270
|
-
|
4271
|
-
|
4315
|
+
Favor modifier while/until usage when you have a
|
4316
|
+
single-line body.
|
4272
4317
|
StyleGuide: '#while-as-a-modifier'
|
4273
4318
|
Enabled: false
|
4274
4319
|
VersionAdded: '0.9'
|
@@ -4294,17 +4339,21 @@ Style/WordArray:
|
|
4294
4339
|
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
4295
4340
|
|
4296
4341
|
Style/YodaCondition:
|
4297
|
-
Description: '
|
4342
|
+
Description: 'Forbid or enforce yoda conditions.'
|
4298
4343
|
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
4299
4344
|
Enabled: true
|
4300
|
-
EnforcedStyle:
|
4345
|
+
EnforcedStyle: forbid_for_all_comparison_operators
|
4301
4346
|
SupportedStyles:
|
4302
4347
|
# check all comparison operators
|
4303
|
-
-
|
4348
|
+
- forbid_for_all_comparison_operators
|
4304
4349
|
# check only equality operators: `!=` and `==`
|
4305
|
-
-
|
4350
|
+
- forbid_for_equality_operators_only
|
4351
|
+
# enforce yoda for all comparison operators
|
4352
|
+
- require_for_all_comparison_operators
|
4353
|
+
# enforce yoda only for equality operators: `!=` and `==`
|
4354
|
+
- require_for_equality_operators_only
|
4306
4355
|
VersionAdded: '0.49'
|
4307
|
-
VersionChanged: '0.
|
4356
|
+
VersionChanged: '0.63'
|
4308
4357
|
|
4309
4358
|
Style/ZeroLengthPredicate:
|
4310
4359
|
Description: 'Use #empty? when testing for objects of length 0.'
|