chefstyle 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/chefstyle.yml +14 -93
- data/config/disable_all.yml +44 -156
- data/config/upstream.yml +312 -721
- data/lib/chefstyle/version.rb +2 -2
- metadata +5 -6
data/config/upstream.yml
CHANGED
@@ -73,7 +73,7 @@ AllCops:
|
|
73
73
|
DisplayStyleGuide: false
|
74
74
|
# When specifying style guide URLs, any paths and/or fragments will be
|
75
75
|
# evaluated relative to the base URL.
|
76
|
-
StyleGuideBaseURL: https://
|
76
|
+
StyleGuideBaseURL: https://rubystyle.guide
|
77
77
|
# Extra details are not displayed in offense messages by default. Change
|
78
78
|
# behavior by overriding ExtraDetails, or by giving the
|
79
79
|
# `-E/--extra-details` option.
|
@@ -123,16 +123,8 @@ AllCops:
|
|
123
123
|
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
|
124
124
|
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
|
125
125
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
126
|
-
# use the oldest officially supported Ruby version (currently Ruby 2.
|
126
|
+
# use the oldest officially supported Ruby version (currently Ruby 2.3).
|
127
127
|
TargetRubyVersion: ~
|
128
|
-
# What version of Rails is the inspected code using? If a value is specified
|
129
|
-
# for TargetRailsVersion then it is used. Acceptable values are specificed
|
130
|
-
# as a float (i.e. 5.1); the patch version of Rails should not be included.
|
131
|
-
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
|
132
|
-
# gems.locked file to find the version of Rails that has been bound to the
|
133
|
-
# application. If neither of those files exist, RuboCop will use Rails 5.0
|
134
|
-
# as the default.
|
135
|
-
TargetRailsVersion: ~
|
136
128
|
|
137
129
|
#################### Bundler ###############################
|
138
130
|
|
@@ -203,6 +195,13 @@ Gemspec/RequiredRubyVersion:
|
|
203
195
|
VersionAdded: '0.52'
|
204
196
|
Include:
|
205
197
|
- '**/*.gemspec'
|
198
|
+
-
|
199
|
+
Gemspec/RubyVersionGlobalsUsage:
|
200
|
+
Description: Checks usage of RUBY_VERSION in gemspec.
|
201
|
+
Enabled: true
|
202
|
+
VersionAdded: '0.72'
|
203
|
+
Include:
|
204
|
+
- '**/*.gemspec'
|
206
205
|
|
207
206
|
#################### Layout ###########################
|
208
207
|
|
@@ -219,6 +218,34 @@ Layout/AccessModifierIndentation:
|
|
219
218
|
# But it can be overridden by setting this parameter
|
220
219
|
IndentationWidth: ~
|
221
220
|
|
221
|
+
Layout/AlignArguments:
|
222
|
+
Description: >-
|
223
|
+
Align the arguments of a method call if they span more
|
224
|
+
than one line.
|
225
|
+
StyleGuide: '#no-double-indent'
|
226
|
+
Enabled: true
|
227
|
+
VersionAdded: '0.68'
|
228
|
+
# Alignment of arguments in multi-line method calls.
|
229
|
+
#
|
230
|
+
# The `with_first_argument` style aligns the following lines along the same
|
231
|
+
# column as the first parameter.
|
232
|
+
#
|
233
|
+
# method_call(a,
|
234
|
+
# b)
|
235
|
+
#
|
236
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
237
|
+
# level of indentation relative to the start of the line with the method call.
|
238
|
+
#
|
239
|
+
# method_call(a,
|
240
|
+
# b)
|
241
|
+
EnforcedStyle: with_first_argument
|
242
|
+
SupportedStyles:
|
243
|
+
- with_first_argument
|
244
|
+
- with_fixed_indentation
|
245
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
246
|
+
# But it can be overridden by setting this parameter
|
247
|
+
IndentationWidth: ~
|
248
|
+
|
222
249
|
Layout/AlignArray:
|
223
250
|
Description: >-
|
224
251
|
Align the elements of an array literal if they span more than
|
@@ -232,6 +259,7 @@ Layout/AlignHash:
|
|
232
259
|
Align the elements of a hash literal if they span more than
|
233
260
|
one line.
|
234
261
|
Enabled: true
|
262
|
+
AllowMultipleStyles: true
|
235
263
|
VersionAdded: '0.49'
|
236
264
|
# Alignment of entries using hash rocket as separator. Valid values are:
|
237
265
|
#
|
@@ -305,23 +333,24 @@ Layout/AlignHash:
|
|
305
333
|
|
306
334
|
Layout/AlignParameters:
|
307
335
|
Description: >-
|
308
|
-
Align the parameters of a method
|
336
|
+
Align the parameters of a method definition if they span more
|
309
337
|
than one line.
|
310
338
|
StyleGuide: '#no-double-indent'
|
311
339
|
Enabled: true
|
312
340
|
VersionAdded: '0.49'
|
341
|
+
VersionChanged: '0.68'
|
313
342
|
# Alignment of parameters in multi-line method calls.
|
314
343
|
#
|
315
344
|
# The `with_first_parameter` style aligns the following lines along the same
|
316
345
|
# column as the first parameter.
|
317
346
|
#
|
318
|
-
#
|
319
|
-
#
|
347
|
+
# def method_foo(a,
|
348
|
+
# b)
|
320
349
|
#
|
321
350
|
# The `with_fixed_indentation` style aligns the following lines with one
|
322
351
|
# level of indentation relative to the start of the line with the method call.
|
323
352
|
#
|
324
|
-
#
|
353
|
+
# def method_foo(a,
|
325
354
|
# b)
|
326
355
|
EnforcedStyle: with_first_parameter
|
327
356
|
SupportedStyles:
|
@@ -368,7 +397,7 @@ Layout/CaseIndentation:
|
|
368
397
|
|
369
398
|
Layout/ClassStructure:
|
370
399
|
Description: 'Enforces a configured order of definitions within a class body.'
|
371
|
-
StyleGuide: '
|
400
|
+
StyleGuide: '#consistent-classes'
|
372
401
|
Enabled: false
|
373
402
|
VersionAdded: '0.52'
|
374
403
|
Categories:
|
@@ -479,6 +508,13 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
479
508
|
StyleGuide: '#empty-lines-around-access-modifier'
|
480
509
|
Enabled: true
|
481
510
|
VersionAdded: '0.49'
|
511
|
+
EnforcedStyle: around
|
512
|
+
SupportedStyles:
|
513
|
+
- around
|
514
|
+
- only_before
|
515
|
+
Reference:
|
516
|
+
# A reference to `EnforcedStyle: only_before`.
|
517
|
+
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
482
518
|
|
483
519
|
Layout/EmptyLinesAroundArguments:
|
484
520
|
Description: "Keeps track of empty lines around method arguments."
|
@@ -581,6 +617,10 @@ Layout/ExtraSpacing:
|
|
581
617
|
# things with the previous or next line, not counting empty lines or comment
|
582
618
|
# lines.
|
583
619
|
AllowForAlignment: true
|
620
|
+
# When true, allows things like 'obj.meth(arg) # comment',
|
621
|
+
# rather than insisting on 'obj.meth(arg) # comment'.
|
622
|
+
# If done for alignment, either this OR AllowForAlignment will allow it.
|
623
|
+
AllowBeforeTrailingComments: false
|
584
624
|
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
585
625
|
ForceEqualSignAlignment: false
|
586
626
|
|
@@ -612,11 +652,28 @@ Layout/FirstMethodParameterLineBreak:
|
|
612
652
|
Enabled: false
|
613
653
|
VersionAdded: '0.49'
|
614
654
|
|
615
|
-
Layout/
|
616
|
-
Description:
|
655
|
+
Layout/HeredocArgumentClosingParenthesis:
|
656
|
+
Description: >-
|
657
|
+
Checks for the placement of the closing parenthesis in a
|
658
|
+
method call that passes a HEREDOC string as an argument.
|
659
|
+
Enabled: false
|
660
|
+
StyleGuide: '#heredoc-argument-closing-parentheses'
|
661
|
+
VersionAdded: '0.68'
|
662
|
+
|
663
|
+
Layout/IndentAssignment:
|
664
|
+
Description: >-
|
665
|
+
Checks the indentation of the first line of the
|
666
|
+
right-hand-side of a multi-line assignment.
|
617
667
|
Enabled: true
|
618
668
|
VersionAdded: '0.49'
|
619
|
-
|
669
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
670
|
+
# But it can be overridden by setting this parameter
|
671
|
+
IndentationWidth: ~
|
672
|
+
|
673
|
+
Layout/IndentFirstArgument:
|
674
|
+
Description: 'Checks the indentation of the first argument in a method call.'
|
675
|
+
Enabled: true
|
676
|
+
VersionAdded: '0.68'
|
620
677
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
621
678
|
SupportedStyles:
|
622
679
|
# The first parameter should always be indented one step more than the
|
@@ -637,12 +694,12 @@ Layout/FirstParameterIndentation:
|
|
637
694
|
# But it can be overridden by setting this parameter
|
638
695
|
IndentationWidth: ~
|
639
696
|
|
640
|
-
Layout/
|
697
|
+
Layout/IndentFirstArrayElement:
|
641
698
|
Description: >-
|
642
699
|
Checks the indentation of the first element in an array
|
643
700
|
literal.
|
644
701
|
Enabled: true
|
645
|
-
VersionAdded: '0.
|
702
|
+
VersionAdded: '0.68'
|
646
703
|
# The value `special_inside_parentheses` means that array literals with
|
647
704
|
# brackets that have their opening bracket on the same line as a surrounding
|
648
705
|
# opening round parenthesis, shall have their first element indented relative
|
@@ -663,20 +720,10 @@ Layout/IndentArray:
|
|
663
720
|
# But it can be overridden by setting this parameter
|
664
721
|
IndentationWidth: ~
|
665
722
|
|
666
|
-
Layout/
|
667
|
-
Description: >-
|
668
|
-
Checks the indentation of the first line of the
|
669
|
-
right-hand-side of a multi-line assignment.
|
670
|
-
Enabled: true
|
671
|
-
VersionAdded: '0.49'
|
672
|
-
# By default, the indentation width from `Layout/IndentationWidth` is used
|
673
|
-
# But it can be overridden by setting this parameter
|
674
|
-
IndentationWidth: ~
|
675
|
-
|
676
|
-
Layout/IndentHash:
|
723
|
+
Layout/IndentFirstHashElement:
|
677
724
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
678
725
|
Enabled: true
|
679
|
-
VersionAdded: '0.
|
726
|
+
VersionAdded: '0.68'
|
680
727
|
# The value `special_inside_parentheses` means that hash literals with braces
|
681
728
|
# that have their opening brace on the same line as a surrounding opening
|
682
729
|
# round parenthesis, shall have their first key indented relative to the
|
@@ -697,14 +744,29 @@ Layout/IndentHash:
|
|
697
744
|
# But it can be overridden by setting this parameter
|
698
745
|
IndentationWidth: ~
|
699
746
|
|
747
|
+
Layout/IndentFirstParameter:
|
748
|
+
Description: >-
|
749
|
+
Checks the indentation of the first parameter in a
|
750
|
+
method definition.
|
751
|
+
Enabled: true
|
752
|
+
VersionAdded: '0.49'
|
753
|
+
VersionChanged: '0.68'
|
754
|
+
EnforcedStyle: consistent
|
755
|
+
SupportedStyles:
|
756
|
+
- consistent
|
757
|
+
- align_parentheses
|
758
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
759
|
+
# But it can be overridden by setting this parameter
|
760
|
+
IndentationWidth: ~
|
761
|
+
|
700
762
|
Layout/IndentHeredoc:
|
701
763
|
Description: 'This cop checks the indentation of the here document bodies.'
|
702
764
|
StyleGuide: '#squiggly-heredocs'
|
703
765
|
Enabled: true
|
704
766
|
VersionAdded: '0.49'
|
705
|
-
|
767
|
+
VersionChanged: '0.69'
|
768
|
+
EnforcedStyle: squiggly
|
706
769
|
SupportedStyles:
|
707
|
-
- auto_detection
|
708
770
|
- squiggly
|
709
771
|
- active_support
|
710
772
|
- powerpack
|
@@ -715,8 +777,8 @@ Layout/IndentationConsistency:
|
|
715
777
|
StyleGuide: '#spaces-indentation'
|
716
778
|
Enabled: true
|
717
779
|
VersionAdded: '0.49'
|
718
|
-
# The difference between `
|
719
|
-
# prescribes that in classes and modules the `protected` and `private`
|
780
|
+
# The difference between `indented` and `normal` is that the `indented_internal_methods`
|
781
|
+
# style prescribes that in classes and modules the `protected` and `private`
|
720
782
|
# modifier keywords shall be indented the same as public methods and that
|
721
783
|
# protected and private members shall be indented one step more than the
|
722
784
|
# modifiers. Other than that, both styles mean that entities on the same
|
@@ -724,7 +786,10 @@ Layout/IndentationConsistency:
|
|
724
786
|
EnforcedStyle: normal
|
725
787
|
SupportedStyles:
|
726
788
|
- normal
|
727
|
-
-
|
789
|
+
- indented_internal_methods
|
790
|
+
Reference:
|
791
|
+
# A reference to `EnforcedStyle: indented_internal_methods`.
|
792
|
+
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
728
793
|
|
729
794
|
Layout/IndentationWidth:
|
730
795
|
Description: 'Use 2 spaces for indentation.'
|
@@ -751,6 +816,8 @@ Layout/LeadingCommentSpace:
|
|
751
816
|
StyleGuide: '#hash-space'
|
752
817
|
Enabled: true
|
753
818
|
VersionAdded: '0.49'
|
819
|
+
VersionChanged: '0.73'
|
820
|
+
AllowDoxygenCommentStyle: false
|
754
821
|
|
755
822
|
Layout/MultilineArrayBraceLayout:
|
756
823
|
Description: >-
|
@@ -768,6 +835,13 @@ Layout/MultilineArrayBraceLayout:
|
|
768
835
|
- new_line
|
769
836
|
- same_line
|
770
837
|
|
838
|
+
Layout/MultilineArrayLineBreaks:
|
839
|
+
Description: >-
|
840
|
+
Checks that each item in a multi-line array literal
|
841
|
+
starts on a separate line.
|
842
|
+
Enabled: false
|
843
|
+
VersionAdded: '0.67'
|
844
|
+
|
771
845
|
Layout/MultilineAssignmentLayout:
|
772
846
|
Description: 'Check for a newline after the assignment operator in multi-line assignments.'
|
773
847
|
StyleGuide: '#indent-conditional-assignment'
|
@@ -811,6 +885,20 @@ Layout/MultilineHashBraceLayout:
|
|
811
885
|
- new_line
|
812
886
|
- same_line
|
813
887
|
|
888
|
+
Layout/MultilineHashKeyLineBreaks:
|
889
|
+
Description: >-
|
890
|
+
Checks that each item in a multi-line hash literal
|
891
|
+
starts on a separate line.
|
892
|
+
Enabled: false
|
893
|
+
VersionAdded: '0.67'
|
894
|
+
|
895
|
+
Layout/MultilineMethodArgumentLineBreaks:
|
896
|
+
Description: >-
|
897
|
+
Checks that each argument in a multi-line method call
|
898
|
+
starts on a separate line.
|
899
|
+
Enabled: false
|
900
|
+
VersionAdded: '0.67'
|
901
|
+
|
814
902
|
Layout/MultilineMethodCallBraceLayout:
|
815
903
|
Description: >-
|
816
904
|
Checks that the closing brace in a method call is
|
@@ -1191,6 +1279,12 @@ Lint/DeprecatedClassMethods:
|
|
1191
1279
|
Enabled: true
|
1192
1280
|
VersionAdded: '0.19'
|
1193
1281
|
|
1282
|
+
Lint/DisjunctiveAssignmentInConstructor:
|
1283
|
+
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1284
|
+
Enabled: true
|
1285
|
+
Safe: false
|
1286
|
+
VersionAdded: '0.62'
|
1287
|
+
|
1194
1288
|
Lint/DuplicateCaseCondition:
|
1195
1289
|
Description: 'Do not repeat values in case conditionals.'
|
1196
1290
|
Enabled: true
|
@@ -1255,6 +1349,12 @@ Lint/ErbNewArguments:
|
|
1255
1349
|
Enabled: true
|
1256
1350
|
VersionAdded: '0.56'
|
1257
1351
|
|
1352
|
+
Lint/FlipFlop:
|
1353
|
+
Description: 'Checks for flip-flops.'
|
1354
|
+
StyleGuide: '#no-flip-flops'
|
1355
|
+
Enabled: true
|
1356
|
+
VersionAdded: '0.16'
|
1357
|
+
|
1258
1358
|
Lint/FloatOutOfRange:
|
1259
1359
|
Description: >-
|
1260
1360
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1271,7 +1371,17 @@ Lint/HandleExceptions:
|
|
1271
1371
|
Description: "Don't suppress exception."
|
1272
1372
|
StyleGuide: '#dont-hide-exceptions'
|
1273
1373
|
Enabled: true
|
1374
|
+
AllowComments: false
|
1274
1375
|
VersionAdded: '0.9'
|
1376
|
+
VersionChanged: '0.70'
|
1377
|
+
|
1378
|
+
Lint/HeredocMethodCallPosition:
|
1379
|
+
Description: >-
|
1380
|
+
Checks for the ordering of a method call where
|
1381
|
+
the receiver of the call is a HEREDOC.
|
1382
|
+
Enabled: false
|
1383
|
+
StyleGuide: '#heredoc-method-calls'
|
1384
|
+
VersionAdded: '0.68'
|
1275
1385
|
|
1276
1386
|
Lint/ImplicitStringConcatenation:
|
1277
1387
|
Description: >-
|
@@ -1298,7 +1408,7 @@ Lint/InheritException:
|
|
1298
1408
|
- standard_error
|
1299
1409
|
|
1300
1410
|
Lint/InterpolationCheck:
|
1301
|
-
Description: 'Raise warning for interpolation in single q strs'
|
1411
|
+
Description: 'Raise warning for interpolation in single q strs.'
|
1302
1412
|
Enabled: true
|
1303
1413
|
VersionAdded: '0.50'
|
1304
1414
|
|
@@ -1322,7 +1432,7 @@ Lint/Loop:
|
|
1322
1432
|
VersionAdded: '0.9'
|
1323
1433
|
|
1324
1434
|
Lint/MissingCopEnableDirective:
|
1325
|
-
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable
|
1435
|
+
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
1326
1436
|
Enabled: true
|
1327
1437
|
VersionAdded: '0.52'
|
1328
1438
|
# Maximum number of consecutive lines the cop can be disabled for.
|
@@ -1366,6 +1476,8 @@ Lint/NumberConversion:
|
|
1366
1476
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1367
1477
|
Enabled: false
|
1368
1478
|
VersionAdded: '0.53'
|
1479
|
+
VersionChanged: '0.70'
|
1480
|
+
SafeAutoCorrect: false
|
1369
1481
|
|
1370
1482
|
Lint/OrderedMagicComments:
|
1371
1483
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
@@ -1384,6 +1496,7 @@ Lint/PercentStringArray:
|
|
1384
1496
|
Description: >-
|
1385
1497
|
Checks for unwanted commas and quotes in %w/%W literals.
|
1386
1498
|
Enabled: true
|
1499
|
+
Safe: false
|
1387
1500
|
VersionAdded: '0.41'
|
1388
1501
|
|
1389
1502
|
Lint/PercentSymbolArray:
|
@@ -1467,6 +1580,11 @@ Lint/SafeNavigationConsistency:
|
|
1467
1580
|
- try!
|
1468
1581
|
|
1469
1582
|
|
1583
|
+
Lint/SafeNavigationWithEmpty:
|
1584
|
+
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1585
|
+
Enabled: true
|
1586
|
+
VersionAdded: '0.62'
|
1587
|
+
|
1470
1588
|
Lint/ScriptPermission:
|
1471
1589
|
Description: 'Grant script file execute permission.'
|
1472
1590
|
Enabled: true
|
@@ -1502,18 +1620,23 @@ Lint/StringConversionInInterpolation:
|
|
1502
1620
|
VersionChanged: '0.20'
|
1503
1621
|
|
1504
1622
|
Lint/Syntax:
|
1505
|
-
Description: 'Checks syntax error'
|
1623
|
+
Description: 'Checks syntax error.'
|
1506
1624
|
Enabled: true
|
1507
1625
|
VersionAdded: '0.9'
|
1508
1626
|
|
1509
1627
|
|
1628
|
+
Lint/ToJSON:
|
1629
|
+
Description: 'Ensure #to_json includes an optional argument.'
|
1630
|
+
Enabled: true
|
1631
|
+
|
1510
1632
|
Lint/UnderscorePrefixedVariableName:
|
1511
1633
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1512
1634
|
Enabled: true
|
1513
1635
|
VersionAdded: '0.21'
|
1636
|
+
AllowKeywordBlockArguments: false
|
1514
1637
|
|
1515
1638
|
Lint/UnifiedInteger:
|
1516
|
-
Description: 'Use Integer instead of Fixnum or Bignum'
|
1639
|
+
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1517
1640
|
Enabled: true
|
1518
1641
|
VersionAdded: '0.43'
|
1519
1642
|
|
@@ -1536,7 +1659,7 @@ Lint/UnneededRequireStatement:
|
|
1536
1659
|
VersionAdded: '0.51'
|
1537
1660
|
|
1538
1661
|
Lint/UnneededSplatExpansion:
|
1539
|
-
Description: 'Checks for splat unnecessarily being called on literals'
|
1662
|
+
Description: 'Checks for splat unnecessarily being called on literals.'
|
1540
1663
|
Enabled: true
|
1541
1664
|
VersionAdded: '0.43'
|
1542
1665
|
|
@@ -1620,9 +1743,12 @@ Metrics/AbcSize:
|
|
1620
1743
|
Description: >-
|
1621
1744
|
A calculated magnitude based on number of assignments,
|
1622
1745
|
branches, and conditions.
|
1623
|
-
Reference:
|
1746
|
+
Reference:
|
1747
|
+
- http://c2.com/cgi/wiki?AbcMetric
|
1748
|
+
- https://en.wikipedia.org/wiki/ABC_Software_Metric'
|
1624
1749
|
Enabled: true
|
1625
1750
|
VersionAdded: '0.27'
|
1751
|
+
VersionChanged: '0.66'
|
1626
1752
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1627
1753
|
# a Float.
|
1628
1754
|
Max: 15
|
@@ -1631,16 +1757,18 @@ Metrics/BlockLength:
|
|
1631
1757
|
Description: 'Avoid long blocks with many lines.'
|
1632
1758
|
Enabled: true
|
1633
1759
|
VersionAdded: '0.44'
|
1634
|
-
VersionChanged: '0.
|
1760
|
+
VersionChanged: '0.66'
|
1635
1761
|
CountComments: false # count full line comments?
|
1636
1762
|
Max: 25
|
1637
1763
|
ExcludedMethods:
|
1638
1764
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1639
1765
|
# associated blocks.
|
1640
1766
|
- refine
|
1767
|
+
Exclude:
|
1768
|
+
- '**/*.gemspec'
|
1641
1769
|
|
1642
1770
|
Metrics/BlockNesting:
|
1643
|
-
Description: 'Avoid excessive block nesting'
|
1771
|
+
Description: 'Avoid excessive block nesting.'
|
1644
1772
|
StyleGuide: '#three-is-the-number-thou-shalt-count'
|
1645
1773
|
Enabled: true
|
1646
1774
|
VersionAdded: '0.25'
|
@@ -1669,7 +1797,8 @@ Metrics/LineLength:
|
|
1669
1797
|
StyleGuide: '#80-character-limits'
|
1670
1798
|
Enabled: true
|
1671
1799
|
VersionAdded: '0.25'
|
1672
|
-
VersionChanged: '0.
|
1800
|
+
VersionChanged: '0.68'
|
1801
|
+
AutoCorrect: false
|
1673
1802
|
Max: 80
|
1674
1803
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
1675
1804
|
# containing a URI to be longer than Max.
|
@@ -1884,6 +2013,13 @@ Naming/PredicateName:
|
|
1884
2013
|
Exclude:
|
1885
2014
|
- 'spec/**/*'
|
1886
2015
|
|
2016
|
+
Naming/RescuedExceptionsVariableName:
|
2017
|
+
Description: 'Use consistent rescued exceptions variables naming.'
|
2018
|
+
Enabled: true
|
2019
|
+
VersionAdded: '0.67'
|
2020
|
+
VersionChanged: '0.68'
|
2021
|
+
PreferredName: e
|
2022
|
+
|
1887
2023
|
Naming/UncommunicativeBlockParamName:
|
1888
2024
|
Description: >-
|
1889
2025
|
Checks for block parameter names that contain capital letters,
|
@@ -1943,650 +2079,6 @@ Naming/VariableNumber:
|
|
1943
2079
|
- normalcase
|
1944
2080
|
- non_integer
|
1945
2081
|
|
1946
|
-
#################### Performance ###########################
|
1947
|
-
|
1948
|
-
Performance/Caller:
|
1949
|
-
Description: >-
|
1950
|
-
Use `caller(n..n)` instead of `caller`.
|
1951
|
-
Enabled: true
|
1952
|
-
VersionAdded: '0.49'
|
1953
|
-
|
1954
|
-
Performance/CaseWhenSplat:
|
1955
|
-
Description: >-
|
1956
|
-
Reordering `when` conditions with a splat to the end
|
1957
|
-
of the `when` branches can improve performance.
|
1958
|
-
Enabled: false
|
1959
|
-
AutoCorrect: false
|
1960
|
-
SafeAutoCorrect: false
|
1961
|
-
VersionAdded: '0.34'
|
1962
|
-
VersionChanged: '0.59'
|
1963
|
-
|
1964
|
-
Performance/Casecmp:
|
1965
|
-
Description: >-
|
1966
|
-
Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
|
1967
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
|
1968
|
-
Enabled: true
|
1969
|
-
VersionAdded: '0.36'
|
1970
|
-
|
1971
|
-
Performance/ChainArrayAllocation:
|
1972
|
-
Description: >-
|
1973
|
-
Instead of chaining array methods that allocate new arrays, mutate an
|
1974
|
-
existing array.
|
1975
|
-
Reference: 'https://twitter.com/schneems/status/1034123879978029057'
|
1976
|
-
Enabled: false
|
1977
|
-
VersionAdded: '0.59'
|
1978
|
-
|
1979
|
-
Performance/CompareWithBlock:
|
1980
|
-
Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
|
1981
|
-
Enabled: true
|
1982
|
-
VersionAdded: '0.46'
|
1983
|
-
|
1984
|
-
Performance/Count:
|
1985
|
-
Description: >-
|
1986
|
-
Use `count` instead of `select...size`, `reject...size`,
|
1987
|
-
`select...count`, `reject...count`, `select...length`,
|
1988
|
-
and `reject...length`.
|
1989
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
1990
|
-
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
1991
|
-
# For more information, see the documentation in the cop itself.
|
1992
|
-
# If you understand the known risk, you can disable `SafeMode`.
|
1993
|
-
SafeMode: true
|
1994
|
-
Enabled: true
|
1995
|
-
VersionAdded: '0.31'
|
1996
|
-
VersionChanged: '0.39'
|
1997
|
-
|
1998
|
-
Performance/Detect:
|
1999
|
-
Description: >-
|
2000
|
-
Use `detect` instead of `select.first`, `find_all.first`,
|
2001
|
-
`select.last`, and `find_all.last`.
|
2002
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
2003
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
2004
|
-
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
2005
|
-
# has its own meaning. Correcting `ActiveRecord` methods with this cop
|
2006
|
-
# should be considered unsafe.
|
2007
|
-
SafeMode: true
|
2008
|
-
Enabled: true
|
2009
|
-
VersionAdded: '0.30'
|
2010
|
-
VersionChanged: '0.39'
|
2011
|
-
|
2012
|
-
Performance/DoubleStartEndWith:
|
2013
|
-
Description: >-
|
2014
|
-
Use `str.{start,end}_with?(x, ..., y, ...)`
|
2015
|
-
instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
2016
|
-
Enabled: true
|
2017
|
-
VersionAdded: '0.36'
|
2018
|
-
VersionChanged: '0.48'
|
2019
|
-
# Used to check for `starts_with?` and `ends_with?`.
|
2020
|
-
# These methods are defined by `ActiveSupport`.
|
2021
|
-
IncludeActiveSupportAliases: false
|
2022
|
-
|
2023
|
-
Performance/EndWith:
|
2024
|
-
Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
|
2025
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2026
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
2027
|
-
# object. Switching these methods has to be done with knowledge of the types
|
2028
|
-
# of the variables which rubocop doesn't have.
|
2029
|
-
SafeAutoCorrect: false
|
2030
|
-
AutoCorrect: false
|
2031
|
-
Enabled: true
|
2032
|
-
VersionAdded: '0.36'
|
2033
|
-
VersionChanged: '0.44'
|
2034
|
-
|
2035
|
-
Performance/FixedSize:
|
2036
|
-
Description: 'Do not compute the size of statically sized objects except in constants'
|
2037
|
-
Enabled: true
|
2038
|
-
VersionAdded: '0.35'
|
2039
|
-
|
2040
|
-
Performance/FlatMap:
|
2041
|
-
Description: >-
|
2042
|
-
Use `Enumerable#flat_map`
|
2043
|
-
instead of `Enumerable#map...Array#flatten(1)`
|
2044
|
-
or `Enumberable#collect..Array#flatten(1)`
|
2045
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
2046
|
-
Enabled: true
|
2047
|
-
VersionAdded: '0.30'
|
2048
|
-
EnabledForFlattenWithoutParams: false
|
2049
|
-
# If enabled, this cop will warn about usages of
|
2050
|
-
# `flatten` being called without any parameters.
|
2051
|
-
# This can be dangerous since `flat_map` will only flatten 1 level, and
|
2052
|
-
# `flatten` without any parameters can flatten multiple levels.
|
2053
|
-
|
2054
|
-
Performance/InefficientHashSearch:
|
2055
|
-
Description: 'Use `key?` or `value?` instead of `keys.include?` or `values.include?`'
|
2056
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code'
|
2057
|
-
Enabled: true
|
2058
|
-
VersionAdded: '0.56'
|
2059
|
-
Safe: false
|
2060
|
-
|
2061
|
-
Performance/LstripRstrip:
|
2062
|
-
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
2063
|
-
Enabled: true
|
2064
|
-
VersionAdded: '0.36'
|
2065
|
-
|
2066
|
-
Performance/OpenStruct:
|
2067
|
-
Description: 'Use `Struct` instead of `OpenStruct`.'
|
2068
|
-
Enabled: false
|
2069
|
-
VersionAdded: '0.61'
|
2070
|
-
Safe: false
|
2071
|
-
|
2072
|
-
Performance/RangeInclude:
|
2073
|
-
Description: 'Use `Range#cover?` instead of `Range#include?`.'
|
2074
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
|
2075
|
-
Enabled: true
|
2076
|
-
VersionAdded: '0.36'
|
2077
|
-
|
2078
|
-
Performance/RedundantBlockCall:
|
2079
|
-
Description: 'Use `yield` instead of `block.call`.'
|
2080
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
|
2081
|
-
Enabled: true
|
2082
|
-
VersionAdded: '0.36'
|
2083
|
-
|
2084
|
-
Performance/RedundantMatch:
|
2085
|
-
Description: >-
|
2086
|
-
Use `=~` instead of `String#match` or `Regexp#match` in a context where the
|
2087
|
-
returned `MatchData` is not needed.
|
2088
|
-
Enabled: true
|
2089
|
-
VersionAdded: '0.36'
|
2090
|
-
|
2091
|
-
Performance/RedundantMerge:
|
2092
|
-
Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
|
2093
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
|
2094
|
-
Enabled: true
|
2095
|
-
VersionAdded: '0.36'
|
2096
|
-
# Max number of key-value pairs to consider an offense
|
2097
|
-
MaxKeyValuePairs: 2
|
2098
|
-
|
2099
|
-
Performance/RedundantSortBy:
|
2100
|
-
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
2101
|
-
Enabled: true
|
2102
|
-
VersionAdded: '0.36'
|
2103
|
-
|
2104
|
-
Performance/RegexpMatch:
|
2105
|
-
Description: >-
|
2106
|
-
Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
|
2107
|
-
`Regexp#===`, or `=~` when `MatchData` is not used.
|
2108
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
|
2109
|
-
Enabled: true
|
2110
|
-
VersionAdded: '0.47'
|
2111
|
-
|
2112
|
-
Performance/ReverseEach:
|
2113
|
-
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
2114
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
2115
|
-
Enabled: true
|
2116
|
-
VersionAdded: '0.30'
|
2117
|
-
|
2118
|
-
Performance/Sample:
|
2119
|
-
Description: >-
|
2120
|
-
Use `sample` instead of `shuffle.first`,
|
2121
|
-
`shuffle.last`, and `shuffle[Integer]`.
|
2122
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
2123
|
-
Enabled: true
|
2124
|
-
VersionAdded: '0.30'
|
2125
|
-
|
2126
|
-
Performance/Size:
|
2127
|
-
Description: >-
|
2128
|
-
Use `size` instead of `count` for counting
|
2129
|
-
the number of elements in `Array` and `Hash`.
|
2130
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
|
2131
|
-
Enabled: true
|
2132
|
-
VersionAdded: '0.30'
|
2133
|
-
|
2134
|
-
Performance/StartWith:
|
2135
|
-
Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
|
2136
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2137
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
2138
|
-
# object. Switching these methods has to be done with knowledge of the types
|
2139
|
-
# of the variables which rubocop doesn't have.
|
2140
|
-
SafeAutoCorrect: false
|
2141
|
-
AutoCorrect: false
|
2142
|
-
Enabled: true
|
2143
|
-
VersionAdded: '0.36'
|
2144
|
-
VersionChanged: '0.44'
|
2145
|
-
|
2146
|
-
Performance/StringReplacement:
|
2147
|
-
Description: >-
|
2148
|
-
Use `tr` instead of `gsub` when you are replacing the same
|
2149
|
-
number of characters. Use `delete` instead of `gsub` when
|
2150
|
-
you are deleting characters.
|
2151
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
2152
|
-
Enabled: true
|
2153
|
-
VersionAdded: '0.33'
|
2154
|
-
|
2155
|
-
Performance/TimesMap:
|
2156
|
-
Description: 'Checks for .times.map calls.'
|
2157
|
-
AutoCorrect: false
|
2158
|
-
Enabled: true
|
2159
|
-
VersionAdded: '0.36'
|
2160
|
-
VersionChanged: '0.50'
|
2161
|
-
SafeAutoCorrect: false # see https://github.com/rubocop-hq/rubocop/issues/4658
|
2162
|
-
|
2163
|
-
Performance/UnfreezeString:
|
2164
|
-
Description: 'Use unary plus to get an unfrozen string literal.'
|
2165
|
-
Enabled: true
|
2166
|
-
VersionAdded: '0.50'
|
2167
|
-
|
2168
|
-
Performance/UnneededSort:
|
2169
|
-
Description: >-
|
2170
|
-
Use `min` instead of `sort.first`,
|
2171
|
-
`max_by` instead of `sort_by...last`, etc.
|
2172
|
-
Enabled: true
|
2173
|
-
VersionAdded: '0.55'
|
2174
|
-
|
2175
|
-
Performance/UriDefaultParser:
|
2176
|
-
Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
|
2177
|
-
Enabled: true
|
2178
|
-
VersionAdded: '0.50'
|
2179
|
-
|
2180
|
-
#################### Rails #################################
|
2181
|
-
|
2182
|
-
# By default, the rails cops are not run. Override in project or home
|
2183
|
-
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
2184
|
-
Rails:
|
2185
|
-
Enabled: false
|
2186
|
-
|
2187
|
-
Rails/ActionFilter:
|
2188
|
-
Description: 'Enforces consistent use of action filter methods.'
|
2189
|
-
Enabled: true
|
2190
|
-
VersionAdded: '0.19'
|
2191
|
-
EnforcedStyle: action
|
2192
|
-
SupportedStyles:
|
2193
|
-
- action
|
2194
|
-
- filter
|
2195
|
-
Include:
|
2196
|
-
- app/controllers/**/*.rb
|
2197
|
-
|
2198
|
-
Rails/ActiveRecordAliases:
|
2199
|
-
Description: >-
|
2200
|
-
Avoid Active Record aliases:
|
2201
|
-
Use `update` instead of `update_attributes`.
|
2202
|
-
Use `update!` instead of `update_attributes!`.
|
2203
|
-
Enabled: true
|
2204
|
-
VersionAdded: '0.53'
|
2205
|
-
|
2206
|
-
Rails/ActiveSupportAliases:
|
2207
|
-
Description: >-
|
2208
|
-
Avoid ActiveSupport aliases of standard ruby methods:
|
2209
|
-
`String#starts_with?`, `String#ends_with?`,
|
2210
|
-
`Array#append`, `Array#prepend`.
|
2211
|
-
Enabled: true
|
2212
|
-
VersionAdded: '0.48'
|
2213
|
-
|
2214
|
-
Rails/ApplicationJob:
|
2215
|
-
Description: 'Check that jobs subclass ApplicationJob.'
|
2216
|
-
Enabled: true
|
2217
|
-
VersionAdded: '0.49'
|
2218
|
-
|
2219
|
-
Rails/ApplicationRecord:
|
2220
|
-
Description: 'Check that models subclass ApplicationRecord.'
|
2221
|
-
Enabled: true
|
2222
|
-
VersionAdded: '0.49'
|
2223
|
-
|
2224
|
-
Rails/AssertNot:
|
2225
|
-
Description: 'Use `assert_not` instead of `assert !`.'
|
2226
|
-
Enabled: true
|
2227
|
-
VersionAdded: '0.56'
|
2228
|
-
Include:
|
2229
|
-
- '**/test/**/*'
|
2230
|
-
|
2231
|
-
Rails/Blank:
|
2232
|
-
Description: 'Enforces use of `blank?`.'
|
2233
|
-
Enabled: true
|
2234
|
-
VersionAdded: '0.48'
|
2235
|
-
# Convert usages of `nil? || empty?` to `blank?`
|
2236
|
-
NilOrEmpty: true
|
2237
|
-
# Convert usages of `!present?` to `blank?`
|
2238
|
-
NotPresent: true
|
2239
|
-
# Convert usages of `unless present?` to `if blank?`
|
2240
|
-
UnlessPresent: true
|
2241
|
-
|
2242
|
-
Rails/BulkChangeTable:
|
2243
|
-
Description: 'Check whether alter queries are combinable.'
|
2244
|
-
Enabled: true
|
2245
|
-
VersionAdded: '0.57'
|
2246
|
-
Database: null
|
2247
|
-
SupportedDatabases:
|
2248
|
-
- mysql
|
2249
|
-
- postgresql
|
2250
|
-
Include:
|
2251
|
-
- db/migrate/*.rb
|
2252
|
-
|
2253
|
-
Rails/CreateTableWithTimestamps:
|
2254
|
-
Description: >-
|
2255
|
-
Checks the migration for which timestamps are not included
|
2256
|
-
when creating a new table.
|
2257
|
-
Enabled: true
|
2258
|
-
VersionAdded: '0.52'
|
2259
|
-
Include:
|
2260
|
-
- db/migrate/*.rb
|
2261
|
-
|
2262
|
-
Rails/Date:
|
2263
|
-
Description: >-
|
2264
|
-
Checks the correct usage of date aware methods,
|
2265
|
-
such as Date.today, Date.current etc.
|
2266
|
-
Enabled: true
|
2267
|
-
VersionAdded: '0.30'
|
2268
|
-
VersionChanged: '0.33'
|
2269
|
-
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
2270
|
-
# `Date#to_time` etc.
|
2271
|
-
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
|
2272
|
-
# (but not `Date.today`) which are overridden by ActiveSupport to handle current
|
2273
|
-
# time zone.
|
2274
|
-
EnforcedStyle: flexible
|
2275
|
-
SupportedStyles:
|
2276
|
-
- strict
|
2277
|
-
- flexible
|
2278
|
-
|
2279
|
-
Rails/Delegate:
|
2280
|
-
Description: 'Prefer delegate method for delegations.'
|
2281
|
-
Enabled: true
|
2282
|
-
VersionAdded: '0.21'
|
2283
|
-
VersionChanged: '0.50'
|
2284
|
-
# When set to true, using the target object as a prefix of the
|
2285
|
-
# method name without using the `delegate` method will be a
|
2286
|
-
# violation. When set to false, this case is legal.
|
2287
|
-
EnforceForPrefixed: true
|
2288
|
-
|
2289
|
-
Rails/DelegateAllowBlank:
|
2290
|
-
Description: 'Do not use allow_blank as an option to delegate.'
|
2291
|
-
Enabled: true
|
2292
|
-
VersionAdded: '0.44'
|
2293
|
-
|
2294
|
-
Rails/DynamicFindBy:
|
2295
|
-
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
|
2296
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2297
|
-
Enabled: true
|
2298
|
-
VersionAdded: '0.44'
|
2299
|
-
Whitelist:
|
2300
|
-
- find_by_sql
|
2301
|
-
|
2302
|
-
Rails/EnumUniqueness:
|
2303
|
-
Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
|
2304
|
-
Enabled: true
|
2305
|
-
VersionAdded: '0.46'
|
2306
|
-
Include:
|
2307
|
-
- app/models/**/*.rb
|
2308
|
-
|
2309
|
-
Rails/EnvironmentComparison:
|
2310
|
-
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
|
2311
|
-
Enabled: true
|
2312
|
-
VersionAdded: '0.52'
|
2313
|
-
|
2314
|
-
Rails/Exit:
|
2315
|
-
Description: >-
|
2316
|
-
Favor `fail`, `break`, `return`, etc. over `exit` in
|
2317
|
-
application or library code outside of Rake files to avoid
|
2318
|
-
exits during unit testing or running in production.
|
2319
|
-
Enabled: true
|
2320
|
-
VersionAdded: '0.41'
|
2321
|
-
Include:
|
2322
|
-
- app/**/*.rb
|
2323
|
-
- config/**/*.rb
|
2324
|
-
- lib/**/*.rb
|
2325
|
-
Exclude:
|
2326
|
-
- lib/**/*.rake
|
2327
|
-
|
2328
|
-
Rails/FilePath:
|
2329
|
-
Description: 'Use `Rails.root.join` for file path joining.'
|
2330
|
-
Enabled: true
|
2331
|
-
VersionAdded: '0.47'
|
2332
|
-
VersionChanged: '0.57'
|
2333
|
-
EnforcedStyle: arguments
|
2334
|
-
SupportedStyles:
|
2335
|
-
- slashes
|
2336
|
-
- arguments
|
2337
|
-
|
2338
|
-
Rails/FindBy:
|
2339
|
-
Description: 'Prefer find_by over where.first.'
|
2340
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2341
|
-
Enabled: true
|
2342
|
-
VersionAdded: '0.30'
|
2343
|
-
Include:
|
2344
|
-
- app/models/**/*.rb
|
2345
|
-
|
2346
|
-
Rails/FindEach:
|
2347
|
-
Description: 'Prefer all.find_each over all.find.'
|
2348
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
|
2349
|
-
Enabled: true
|
2350
|
-
VersionAdded: '0.30'
|
2351
|
-
Include:
|
2352
|
-
- app/models/**/*.rb
|
2353
|
-
|
2354
|
-
Rails/HasAndBelongsToMany:
|
2355
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
2356
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
|
2357
|
-
Enabled: true
|
2358
|
-
VersionAdded: '0.12'
|
2359
|
-
Include:
|
2360
|
-
- app/models/**/*.rb
|
2361
|
-
|
2362
|
-
Rails/HasManyOrHasOneDependent:
|
2363
|
-
Description: 'Define the dependent option to the has_many and has_one associations.'
|
2364
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
|
2365
|
-
Enabled: true
|
2366
|
-
VersionAdded: '0.50'
|
2367
|
-
Include:
|
2368
|
-
- app/models/**/*.rb
|
2369
|
-
|
2370
|
-
Rails/HttpPositionalArguments:
|
2371
|
-
Description: 'Use keyword arguments instead of positional arguments in http method calls.'
|
2372
|
-
Enabled: true
|
2373
|
-
VersionAdded: '0.44'
|
2374
|
-
Include:
|
2375
|
-
- 'spec/**/*'
|
2376
|
-
- 'test/**/*'
|
2377
|
-
|
2378
|
-
Rails/HttpStatus:
|
2379
|
-
Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
|
2380
|
-
Enabled: true
|
2381
|
-
VersionAdded: '0.54'
|
2382
|
-
EnforcedStyle: symbolic
|
2383
|
-
SupportedStyles:
|
2384
|
-
- numeric
|
2385
|
-
- symbolic
|
2386
|
-
|
2387
|
-
Rails/InverseOf:
|
2388
|
-
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
2389
|
-
Enabled: true
|
2390
|
-
VersionAdded: '0.52'
|
2391
|
-
Include:
|
2392
|
-
- app/models/**/*.rb
|
2393
|
-
|
2394
|
-
Rails/LexicallyScopedActionFilter:
|
2395
|
-
Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
|
2396
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
|
2397
|
-
Enabled: true
|
2398
|
-
VersionAdded: '0.52'
|
2399
|
-
Include:
|
2400
|
-
- app/controllers/**/*.rb
|
2401
|
-
|
2402
|
-
Rails/LinkToBlank:
|
2403
|
-
Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
|
2404
|
-
Reference: https://mathiasbynens.github.io/rel-noopener/
|
2405
|
-
Enabled: true
|
2406
|
-
VersionAdded: '0.62'
|
2407
|
-
|
2408
|
-
Rails/NotNullColumn:
|
2409
|
-
Description: 'Do not add a NOT NULL column without a default value'
|
2410
|
-
Enabled: true
|
2411
|
-
VersionAdded: '0.43'
|
2412
|
-
Include:
|
2413
|
-
- db/migrate/*.rb
|
2414
|
-
|
2415
|
-
Rails/Output:
|
2416
|
-
Description: 'Checks for calls to puts, print, etc.'
|
2417
|
-
Enabled: true
|
2418
|
-
VersionAdded: '0.15'
|
2419
|
-
VersionChanged: '0.19'
|
2420
|
-
Include:
|
2421
|
-
- app/**/*.rb
|
2422
|
-
- config/**/*.rb
|
2423
|
-
- db/**/*.rb
|
2424
|
-
- lib/**/*.rb
|
2425
|
-
|
2426
|
-
Rails/OutputSafety:
|
2427
|
-
Description: 'The use of `html_safe` or `raw` may be a security risk.'
|
2428
|
-
Enabled: true
|
2429
|
-
VersionAdded: '0.41'
|
2430
|
-
|
2431
|
-
Rails/PluralizationGrammar:
|
2432
|
-
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
|
2433
|
-
Enabled: true
|
2434
|
-
VersionAdded: '0.35'
|
2435
|
-
|
2436
|
-
Rails/Presence:
|
2437
|
-
Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
|
2438
|
-
Enabled: true
|
2439
|
-
VersionAdded: '0.52'
|
2440
|
-
|
2441
|
-
Rails/Present:
|
2442
|
-
Description: 'Enforces use of `present?`.'
|
2443
|
-
Enabled: true
|
2444
|
-
VersionAdded: '0.48'
|
2445
|
-
# Convert usages of `!nil? && !empty?` to `present?`
|
2446
|
-
NotNilAndNotEmpty: true
|
2447
|
-
# Convert usages of `!blank?` to `present?`
|
2448
|
-
NotBlank: true
|
2449
|
-
# Convert usages of `unless blank?` to `if present?`
|
2450
|
-
UnlessBlank: true
|
2451
|
-
|
2452
|
-
Rails/ReadWriteAttribute:
|
2453
|
-
Description: >-
|
2454
|
-
Checks for read_attribute(:attr) and
|
2455
|
-
write_attribute(:attr, val).
|
2456
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
|
2457
|
-
Enabled: true
|
2458
|
-
VersionAdded: '0.20'
|
2459
|
-
VersionChanged: '0.29'
|
2460
|
-
Include:
|
2461
|
-
- app/models/**/*.rb
|
2462
|
-
|
2463
|
-
Rails/RedundantReceiverInWithOptions:
|
2464
|
-
Description: 'Checks for redundant receiver in `with_options`.'
|
2465
|
-
Enabled: true
|
2466
|
-
VersionAdded: '0.52'
|
2467
|
-
|
2468
|
-
Rails/RefuteMethods:
|
2469
|
-
Description: 'Use `assert_not` methods instead of `refute` methods.'
|
2470
|
-
Enabled: true
|
2471
|
-
VersionAdded: '0.56'
|
2472
|
-
Include:
|
2473
|
-
- '**/test/**/*'
|
2474
|
-
|
2475
|
-
Rails/RelativeDateConstant:
|
2476
|
-
Description: 'Do not assign relative date to constants.'
|
2477
|
-
Enabled: true
|
2478
|
-
VersionAdded: '0.48'
|
2479
|
-
VersionChanged: '0.59'
|
2480
|
-
AutoCorrect: false
|
2481
|
-
|
2482
|
-
Rails/RequestReferer:
|
2483
|
-
Description: 'Use consistent syntax for request.referer.'
|
2484
|
-
Enabled: true
|
2485
|
-
VersionAdded: '0.41'
|
2486
|
-
EnforcedStyle: referer
|
2487
|
-
SupportedStyles:
|
2488
|
-
- referer
|
2489
|
-
- referrer
|
2490
|
-
|
2491
|
-
Rails/ReversibleMigration:
|
2492
|
-
Description: 'Checks whether the change method of the migration file is reversible.'
|
2493
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
|
2494
|
-
Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
|
2495
|
-
Enabled: true
|
2496
|
-
VersionAdded: '0.47'
|
2497
|
-
Include:
|
2498
|
-
- db/migrate/*.rb
|
2499
|
-
|
2500
|
-
Rails/SafeNavigation:
|
2501
|
-
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
|
2502
|
-
Enabled: true
|
2503
|
-
VersionAdded: '0.43'
|
2504
|
-
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
2505
|
-
# `try` and `try!` work slightly differently. `try!` and safe navigation will
|
2506
|
-
# both raise a `NoMethodError` if the receiver of the method call does not
|
2507
|
-
# implement the intended method. `try` will not raise an exception for this.
|
2508
|
-
ConvertTry: false
|
2509
|
-
|
2510
|
-
Rails/SaveBang:
|
2511
|
-
Description: 'Identifies possible cases where Active Record save! or related should be used.'
|
2512
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
|
2513
|
-
Enabled: false
|
2514
|
-
VersionAdded: '0.42'
|
2515
|
-
VersionChanged: '0.59'
|
2516
|
-
AllowImplicitReturn: true
|
2517
|
-
AllowedReceivers: []
|
2518
|
-
|
2519
|
-
Rails/ScopeArgs:
|
2520
|
-
Description: 'Checks the arguments of ActiveRecord scopes.'
|
2521
|
-
Enabled: true
|
2522
|
-
VersionAdded: '0.19'
|
2523
|
-
Include:
|
2524
|
-
- app/models/**/*.rb
|
2525
|
-
|
2526
|
-
Rails/SkipsModelValidations:
|
2527
|
-
Description: >-
|
2528
|
-
Use methods that skips model validations with caution.
|
2529
|
-
See reference for more information.
|
2530
|
-
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
2531
|
-
Enabled: true
|
2532
|
-
VersionAdded: '0.47'
|
2533
|
-
VersionChanged: '0.60'
|
2534
|
-
Blacklist:
|
2535
|
-
- decrement!
|
2536
|
-
- decrement_counter
|
2537
|
-
- increment!
|
2538
|
-
- increment_counter
|
2539
|
-
- toggle!
|
2540
|
-
- touch
|
2541
|
-
- update_all
|
2542
|
-
- update_attribute
|
2543
|
-
- update_column
|
2544
|
-
- update_columns
|
2545
|
-
- update_counters
|
2546
|
-
Whitelist: []
|
2547
|
-
|
2548
|
-
Rails/TimeZone:
|
2549
|
-
Description: 'Checks the correct usage of time zone aware methods.'
|
2550
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
|
2551
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
2552
|
-
Enabled: true
|
2553
|
-
VersionAdded: '0.30'
|
2554
|
-
VersionChanged: '0.33'
|
2555
|
-
# The value `strict` means that `Time` should be used with `zone`.
|
2556
|
-
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
2557
|
-
EnforcedStyle: flexible
|
2558
|
-
SupportedStyles:
|
2559
|
-
- strict
|
2560
|
-
- flexible
|
2561
|
-
|
2562
|
-
Rails/UniqBeforePluck:
|
2563
|
-
Description: 'Prefer the use of uniq or distinct before pluck.'
|
2564
|
-
Enabled: true
|
2565
|
-
VersionAdded: '0.40'
|
2566
|
-
VersionChanged: '0.47'
|
2567
|
-
EnforcedStyle: conservative
|
2568
|
-
SupportedStyles:
|
2569
|
-
- conservative
|
2570
|
-
- aggressive
|
2571
|
-
AutoCorrect: false
|
2572
|
-
|
2573
|
-
Rails/UnknownEnv:
|
2574
|
-
Description: 'Use correct environment name.'
|
2575
|
-
Enabled: true
|
2576
|
-
VersionAdded: '0.51'
|
2577
|
-
Environments:
|
2578
|
-
- development
|
2579
|
-
- test
|
2580
|
-
- production
|
2581
|
-
|
2582
|
-
Rails/Validation:
|
2583
|
-
Description: 'Use validates :attribute, hash of validations.'
|
2584
|
-
Enabled: true
|
2585
|
-
VersionAdded: '0.9'
|
2586
|
-
VersionChanged: '0.41'
|
2587
|
-
Include:
|
2588
|
-
- app/models/**/*.rb
|
2589
|
-
|
2590
2082
|
#################### Security ##############################
|
2591
2083
|
|
2592
2084
|
Security/Eval:
|
@@ -2643,7 +2135,7 @@ Style/AccessModifierDeclarations:
|
|
2643
2135
|
|
2644
2136
|
Style/Alias:
|
2645
2137
|
Description: 'Use alias instead of alias_method.'
|
2646
|
-
StyleGuide: '#alias-method'
|
2138
|
+
StyleGuide: '#alias-method-lexically'
|
2647
2139
|
Enabled: true
|
2648
2140
|
VersionAdded: '0.9'
|
2649
2141
|
VersionChanged: '0.36'
|
@@ -2731,8 +2223,9 @@ Style/BlockDelimiters:
|
|
2731
2223
|
- line_count_based
|
2732
2224
|
# The `semantic` style enforces braces around functional blocks, where the
|
2733
2225
|
# primary purpose of the block is to return a value and do..end for
|
2734
|
-
# procedural blocks, where the primary purpose of the block is
|
2735
|
-
# side-effects.
|
2226
|
+
# multi-line procedural blocks, where the primary purpose of the block is
|
2227
|
+
# its side-effects. Single-line procedural blocks may only use do-end,
|
2228
|
+
# unless AllowBracesOnProceduralOneLiners has a truthy value (see below).
|
2736
2229
|
#
|
2737
2230
|
# This looks at the usage of a block's method to determine its type (e.g. is
|
2738
2231
|
# the result of a `map` assigned to a variable or passed to another
|
@@ -2744,6 +2237,8 @@ Style/BlockDelimiters:
|
|
2744
2237
|
# return value is being chained with another method (in which case braces
|
2745
2238
|
# are enforced).
|
2746
2239
|
- braces_for_chaining
|
2240
|
+
# The `always_braces` style always enforces braces.
|
2241
|
+
- always_braces
|
2747
2242
|
ProceduralMethods:
|
2748
2243
|
# Methods that are known to be procedural in nature but look functional from
|
2749
2244
|
# their usage, e.g.
|
@@ -2793,6 +2288,28 @@ Style/BlockDelimiters:
|
|
2793
2288
|
- lambda
|
2794
2289
|
- proc
|
2795
2290
|
- it
|
2291
|
+
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
2292
|
+
# EnforcedStyle is set to `semantic`. If so:
|
2293
|
+
#
|
2294
|
+
# If AllowBracesOnProceduralOneLiners is unspecified, or set to any
|
2295
|
+
# falsey value, then semantic purity is maintained, so one-line
|
2296
|
+
# procedural blocks must use do-end, not braces.
|
2297
|
+
#
|
2298
|
+
# # bad
|
2299
|
+
# collection.each { |element| puts element }
|
2300
|
+
#
|
2301
|
+
# # good
|
2302
|
+
# collection.each do |element| puts element end
|
2303
|
+
#
|
2304
|
+
# If AllowBracesOnProceduralOneLiners is set to any truthy value,
|
2305
|
+
# then one-line procedural blocks may use either style.
|
2306
|
+
#
|
2307
|
+
# # good
|
2308
|
+
# collection.each { |element| puts element }
|
2309
|
+
#
|
2310
|
+
# # also good
|
2311
|
+
# collection.each do |element| puts element end
|
2312
|
+
AllowBracesOnProceduralOneLiners: false
|
2796
2313
|
|
2797
2314
|
Style/BracesAroundHashParameters:
|
2798
2315
|
Description: 'Enforce braces style around hash parameters.'
|
@@ -2969,6 +2486,13 @@ Style/ConditionalAssignment:
|
|
2969
2486
|
SingleLineConditionsOnly: true
|
2970
2487
|
IncludeTernaryExpressions: true
|
2971
2488
|
|
2489
|
+
Style/ConstantVisibility:
|
2490
|
+
Description: >-
|
2491
|
+
Check that class- and module constants have
|
2492
|
+
visibility declarations.
|
2493
|
+
Enabled: false
|
2494
|
+
VersionAdded: '0.66'
|
2495
|
+
|
2972
2496
|
# Checks that you have put a copyright in a comment before any code.
|
2973
2497
|
#
|
2974
2498
|
# You can override the default Notice in your .rubocop.yml file.
|
@@ -3117,7 +2641,7 @@ Style/EvalWithLocation:
|
|
3117
2641
|
VersionAdded: '0.52'
|
3118
2642
|
|
3119
2643
|
Style/EvenOdd:
|
3120
|
-
Description: 'Favor the use of Integer#even
|
2644
|
+
Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
|
3121
2645
|
StyleGuide: '#predicate-methods'
|
3122
2646
|
Enabled: true
|
3123
2647
|
VersionAdded: '0.12'
|
@@ -3128,11 +2652,18 @@ Style/ExpandPathArguments:
|
|
3128
2652
|
Enabled: true
|
3129
2653
|
VersionAdded: '0.53'
|
3130
2654
|
|
3131
|
-
Style/
|
3132
|
-
Description: '
|
3133
|
-
StyleGuide: '#
|
2655
|
+
Style/FloatDivision:
|
2656
|
+
Description: 'For performing float division, coerce one side only.'
|
2657
|
+
StyleGuide: '#float-division'
|
2658
|
+
Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
|
3134
2659
|
Enabled: true
|
3135
|
-
VersionAdded: '0.
|
2660
|
+
VersionAdded: '0.72'
|
2661
|
+
EnforcedStyle: single_coerce
|
2662
|
+
SupportedStyles:
|
2663
|
+
- left_coerce
|
2664
|
+
- right_coerce
|
2665
|
+
- single_coerce
|
2666
|
+
- fdiv
|
3136
2667
|
|
3137
2668
|
Style/For:
|
3138
2669
|
Description: 'Checks use of for or each in multiline loops.'
|
@@ -3174,15 +2705,12 @@ Style/FormatStringToken:
|
|
3174
2705
|
Style/FrozenStringLiteralComment:
|
3175
2706
|
Description: >-
|
3176
2707
|
Add the frozen_string_literal comment to the top of files
|
3177
|
-
to help transition
|
2708
|
+
to help transition to frozen string literals by default.
|
3178
2709
|
Enabled: true
|
3179
2710
|
VersionAdded: '0.36'
|
3180
|
-
VersionChanged: '0.
|
3181
|
-
EnforcedStyle:
|
2711
|
+
VersionChanged: '0.69'
|
2712
|
+
EnforcedStyle: always
|
3182
2713
|
SupportedStyles:
|
3183
|
-
# `when_needed` will add the frozen string literal comment to files
|
3184
|
-
# only when the `TargetRubyVersion` is set to 2.3+.
|
3185
|
-
- when_needed
|
3186
2714
|
# `always` will always add the frozen string literal comment to a file
|
3187
2715
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
3188
2716
|
# string literal. If you run code against multiple versions of Ruby, it is
|
@@ -3202,7 +2730,7 @@ Style/GlobalVars:
|
|
3202
2730
|
AllowedVariables: []
|
3203
2731
|
|
3204
2732
|
Style/GuardClause:
|
3205
|
-
Description: 'Check for conditionals that can be replaced with guard clauses'
|
2733
|
+
Description: 'Check for conditionals that can be replaced with guard clauses.'
|
3206
2734
|
StyleGuide: '#no-nested-conditionals'
|
3207
2735
|
Enabled: true
|
3208
2736
|
VersionAdded: '0.20'
|
@@ -3245,6 +2773,7 @@ Style/IdenticalConditionalBranches:
|
|
3245
2773
|
Style/IfInsideElse:
|
3246
2774
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
3247
2775
|
Enabled: true
|
2776
|
+
AllowIfModifier: false
|
3248
2777
|
VersionAdded: '0.36'
|
3249
2778
|
|
3250
2779
|
Style/IfUnlessModifier:
|
@@ -3352,7 +2881,9 @@ Style/LineEndConcatenation:
|
|
3352
2881
|
Use \ instead of + or << to concatenate two string literals at
|
3353
2882
|
line end.
|
3354
2883
|
Enabled: true
|
2884
|
+
SafeAutoCorrect: false
|
3355
2885
|
VersionAdded: '0.18'
|
2886
|
+
VersionChanged: '0.64'
|
3356
2887
|
|
3357
2888
|
Style/MethodCallWithArgsParentheses:
|
3358
2889
|
Description: 'Use parentheses for method calls with arguments.'
|
@@ -3362,8 +2893,10 @@ Style/MethodCallWithArgsParentheses:
|
|
3362
2893
|
VersionChanged: '0.61'
|
3363
2894
|
IgnoreMacros: true
|
3364
2895
|
IgnoredMethods: []
|
2896
|
+
IncludedMacros: []
|
3365
2897
|
AllowParenthesesInMultilineCall: false
|
3366
2898
|
AllowParenthesesInChaining: false
|
2899
|
+
AllowParenthesesInCamelCaseMethod: false
|
3367
2900
|
EnforcedStyle: require_parentheses
|
3368
2901
|
SupportedStyles:
|
3369
2902
|
- require_parentheses
|
@@ -3406,7 +2939,7 @@ Style/MethodMissingSuper:
|
|
3406
2939
|
Style/MinMax:
|
3407
2940
|
Description: >-
|
3408
2941
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
3409
|
-
and `Enumerable#max` in conjunction.
|
2942
|
+
and `Enumerable#max` in conjunction.
|
3410
2943
|
Enabled: true
|
3411
2944
|
VersionAdded: '0.50'
|
3412
2945
|
|
@@ -3416,7 +2949,7 @@ Style/MissingElse:
|
|
3416
2949
|
If enabled, it is recommended that
|
3417
2950
|
Style/UnlessElse and Style/EmptyElse be enabled.
|
3418
2951
|
This will conflict with Style/EmptyElse if
|
3419
|
-
Style/EmptyElse is configured to style "both"
|
2952
|
+
Style/EmptyElse is configured to style "both".
|
3420
2953
|
Enabled: false
|
3421
2954
|
VersionAdded: '0.30'
|
3422
2955
|
VersionChanged: '0.38'
|
@@ -3460,11 +2993,13 @@ Style/ModuleFunction:
|
|
3460
2993
|
StyleGuide: '#module-function'
|
3461
2994
|
Enabled: true
|
3462
2995
|
VersionAdded: '0.11'
|
3463
|
-
VersionChanged: '0.
|
2996
|
+
VersionChanged: '0.65'
|
3464
2997
|
EnforcedStyle: module_function
|
3465
2998
|
SupportedStyles:
|
3466
2999
|
- module_function
|
3467
3000
|
- extend_self
|
3001
|
+
Autocorrect: false
|
3002
|
+
SafeAutoCorrect: false
|
3468
3003
|
|
3469
3004
|
Style/MultilineBlockChain:
|
3470
3005
|
Description: 'Avoid multi-line chains of blocks.'
|
@@ -3519,6 +3054,17 @@ Style/MutableConstant:
|
|
3519
3054
|
Description: 'Do not assign mutable objects to constants.'
|
3520
3055
|
Enabled: true
|
3521
3056
|
VersionAdded: '0.34'
|
3057
|
+
VersionChanged: '0.65'
|
3058
|
+
EnforcedStyle: literals
|
3059
|
+
SupportedStyles:
|
3060
|
+
# literals: freeze literals assigned to constants
|
3061
|
+
# strict: freeze all constants
|
3062
|
+
# Strict mode is considered an experimental feature. It has not been updated
|
3063
|
+
# with an exhaustive list of all methods that will produce frozen objects so
|
3064
|
+
# there is a decent chance of getting some false positives. Luckily, there is
|
3065
|
+
# no harm in freezing an already frozen object.
|
3066
|
+
- literals
|
3067
|
+
- strict
|
3522
3068
|
|
3523
3069
|
Style/NegatedIf:
|
3524
3070
|
Description: >-
|
@@ -3537,6 +3083,20 @@ Style/NegatedIf:
|
|
3537
3083
|
- prefix
|
3538
3084
|
- postfix
|
3539
3085
|
|
3086
|
+
Style/NegatedUnless:
|
3087
|
+
Description: 'Favor if over unless for negative conditions.'
|
3088
|
+
StyleGuide: '#if-for-negatives'
|
3089
|
+
Enabled: true
|
3090
|
+
VersionAdded: '0.69'
|
3091
|
+
EnforcedStyle: both
|
3092
|
+
SupportedStyles:
|
3093
|
+
# both: prefix and postfix negated `unless` should both use `if`
|
3094
|
+
# prefix: only use `if` for negated `unless` statements positioned before the body of the statement
|
3095
|
+
# postfix: only use `if` for negated `unless` statements positioned after the body of the statement
|
3096
|
+
- both
|
3097
|
+
- prefix
|
3098
|
+
- postfix
|
3099
|
+
|
3540
3100
|
Style/NegatedWhile:
|
3541
3101
|
Description: 'Favor until over while for negative conditions.'
|
3542
3102
|
StyleGuide: '#until-for-negatives'
|
@@ -3701,7 +3261,7 @@ Style/OptionHash:
|
|
3701
3261
|
Style/OptionalArguments:
|
3702
3262
|
Description: >-
|
3703
3263
|
Checks for optional arguments that do not appear at the end
|
3704
|
-
of the argument list
|
3264
|
+
of the argument list.
|
3705
3265
|
StyleGuide: '#optional-arguments'
|
3706
3266
|
Enabled: true
|
3707
3267
|
VersionAdded: '0.33'
|
@@ -3733,7 +3293,7 @@ Style/ParenthesesAroundCondition:
|
|
3733
3293
|
AllowInMultilineConditions: false
|
3734
3294
|
|
3735
3295
|
Style/PercentLiteralDelimiters:
|
3736
|
-
Description: 'Use `%`-literal delimiters consistently'
|
3296
|
+
Description: 'Use `%`-literal delimiters consistently.'
|
3737
3297
|
StyleGuide: '#percent-literal-braces'
|
3738
3298
|
Enabled: true
|
3739
3299
|
VersionAdded: '0.19'
|
@@ -3768,8 +3328,9 @@ Style/PreferredHashMethods:
|
|
3768
3328
|
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
3769
3329
|
StyleGuide: '#hash-key'
|
3770
3330
|
Enabled: true
|
3331
|
+
Safe: false
|
3771
3332
|
VersionAdded: '0.41'
|
3772
|
-
VersionChanged: '0.
|
3333
|
+
VersionChanged: '0.70'
|
3773
3334
|
EnforcedStyle: short
|
3774
3335
|
SupportedStyles:
|
3775
3336
|
- short
|
@@ -3824,6 +3385,7 @@ Style/RedundantFreeze:
|
|
3824
3385
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3825
3386
|
Enabled: true
|
3826
3387
|
VersionAdded: '0.34'
|
3388
|
+
VersionChanged: '0.66'
|
3827
3389
|
|
3828
3390
|
Style/RedundantParentheses:
|
3829
3391
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
@@ -3846,6 +3408,11 @@ Style/RedundantSelf:
|
|
3846
3408
|
VersionAdded: '0.10'
|
3847
3409
|
VersionChanged: '0.13'
|
3848
3410
|
|
3411
|
+
Style/RedundantSortBy:
|
3412
|
+
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
3413
|
+
Enabled: true
|
3414
|
+
VersionAdded: '0.36'
|
3415
|
+
|
3849
3416
|
Style/RegexpLiteral:
|
3850
3417
|
Description: 'Use / or %r around regular expressions.'
|
3851
3418
|
StyleGuide: '#percent-r'
|
@@ -3898,7 +3465,7 @@ Style/SafeNavigation:
|
|
3898
3465
|
safe navigation (`&.`).
|
3899
3466
|
Enabled: true
|
3900
3467
|
VersionAdded: '0.43'
|
3901
|
-
VersionChanged: '0.
|
3468
|
+
VersionChanged: '0.56'
|
3902
3469
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
3903
3470
|
# to whatever it used to return.
|
3904
3471
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -3908,7 +3475,14 @@ Style/SafeNavigation:
|
|
3908
3475
|
- presence
|
3909
3476
|
- try
|
3910
3477
|
- try!
|
3911
|
-
|
3478
|
+
|
3479
|
+
Style/Sample:
|
3480
|
+
Description: >-
|
3481
|
+
Use `sample` instead of `shuffle.first`,
|
3482
|
+
`shuffle.last`, and `shuffle[Integer]`.
|
3483
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
3484
|
+
Enabled: true
|
3485
|
+
VersionAdded: '0.30'
|
3912
3486
|
|
3913
3487
|
Style/SelfAssignment:
|
3914
3488
|
Description: >-
|
@@ -4040,6 +3614,11 @@ Style/StringMethods:
|
|
4040
3614
|
PreferredMethods:
|
4041
3615
|
intern: to_sym
|
4042
3616
|
|
3617
|
+
Style/Strip:
|
3618
|
+
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
3619
|
+
Enabled: true
|
3620
|
+
VersionAdded: '0.36'
|
3621
|
+
|
4043
3622
|
Style/StructInheritance:
|
4044
3623
|
Description: 'Checks for inheritance from Struct.new.'
|
4045
3624
|
StyleGuide: '#no-extend-struct-new'
|
@@ -4066,8 +3645,9 @@ Style/SymbolLiteral:
|
|
4066
3645
|
Style/SymbolProc:
|
4067
3646
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
4068
3647
|
Enabled: true
|
3648
|
+
SafeAutoCorrect: false
|
4069
3649
|
VersionAdded: '0.26'
|
4070
|
-
VersionChanged: '0.
|
3650
|
+
VersionChanged: '0.64'
|
4071
3651
|
# A list of method names to be ignored by the check.
|
4072
3652
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4073
3653
|
IgnoredMethods:
|
@@ -4235,10 +3815,17 @@ Style/UnneededPercentQ:
|
|
4235
3815
|
Enabled: true
|
4236
3816
|
VersionAdded: '0.24'
|
4237
3817
|
|
3818
|
+
Style/UnneededSort:
|
3819
|
+
Description: >-
|
3820
|
+
Use `min` instead of `sort.first`,
|
3821
|
+
`max_by` instead of `sort_by...last`, etc.
|
3822
|
+
Enabled: true
|
3823
|
+
VersionAdded: '0.55'
|
3824
|
+
|
4238
3825
|
Style/UnpackFirst:
|
4239
3826
|
Description: >-
|
4240
3827
|
Checks for accessing the first element of `String#unpack`
|
4241
|
-
instead of using `unpack1
|
3828
|
+
instead of using `unpack1`.
|
4242
3829
|
Enabled: true
|
4243
3830
|
VersionAdded: '0.54'
|
4244
3831
|
|
@@ -4289,20 +3876,24 @@ Style/WordArray:
|
|
4289
3876
|
# whose element count is greater than or equal to `MinSize`.
|
4290
3877
|
MinSize: 2
|
4291
3878
|
# The regular expression `WordRegex` decides what is considered a word.
|
4292
|
-
WordRegex: !ruby/regexp '/\A
|
3879
|
+
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
4293
3880
|
|
4294
3881
|
Style/YodaCondition:
|
4295
|
-
Description: '
|
3882
|
+
Description: 'Forbid or enforce yoda conditions.'
|
4296
3883
|
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
4297
3884
|
Enabled: true
|
4298
|
-
EnforcedStyle:
|
3885
|
+
EnforcedStyle: forbid_for_all_comparison_operators
|
4299
3886
|
SupportedStyles:
|
4300
3887
|
# check all comparison operators
|
4301
|
-
-
|
3888
|
+
- forbid_for_all_comparison_operators
|
4302
3889
|
# check only equality operators: `!=` and `==`
|
4303
|
-
-
|
3890
|
+
- forbid_for_equality_operators_only
|
3891
|
+
# enforce yoda for all comparison operators
|
3892
|
+
- require_for_all_comparison_operators
|
3893
|
+
# enforce yoda only for equality operators: `!=` and `==`
|
3894
|
+
- require_for_equality_operators_only
|
4304
3895
|
VersionAdded: '0.49'
|
4305
|
-
VersionChanged: '0.
|
3896
|
+
VersionChanged: '0.63'
|
4306
3897
|
|
4307
3898
|
Style/ZeroLengthPredicate:
|
4308
3899
|
Description: 'Use #empty? when testing for objects of length 0.'
|