cookstyle 4.0.0 → 5.0.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/cookstyle.yml +49 -55
- data/config/disable_all.yml +64 -152
- data/config/upstream.yml +310 -728
- data/lib/cookstyle.rb +15 -2
- data/lib/cookstyle/version.rb +2 -2
- data/lib/rubocop/chef.rb +10 -0
- data/lib/rubocop/chef/cookbook_only.rb +75 -0
- data/lib/rubocop/cop/chef/attribute_keys.rb +92 -0
- data/lib/rubocop/cop/chef/comments_copyright_format.rb +99 -0
- data/lib/rubocop/cop/chef/comments_format.rb +75 -0
- data/lib/rubocop/cop/chef/file_mode.rb +63 -0
- data/lib/rubocop/cop/chef/service_resource.rb +53 -0
- data/lib/rubocop/cop/chef/tmp_path.rb +58 -0
- metadata +13 -8
- data/config/disabled.yml +0 -128
- data/config/enabled.yml +0 -2068
data/config/upstream.yml
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
# This is the default configuration file. Enabling and disabling is configured
|
2
|
-
# in separate files. This file adds all other parameters apart from Enabled.
|
3
|
-
|
4
|
-
inherit_from:
|
5
|
-
- enabled.yml
|
6
|
-
- disabled.yml
|
7
|
-
|
8
1
|
# Common configuration.
|
9
2
|
|
10
3
|
AllCops:
|
@@ -80,7 +73,7 @@ AllCops:
|
|
80
73
|
DisplayStyleGuide: false
|
81
74
|
# When specifying style guide URLs, any paths and/or fragments will be
|
82
75
|
# evaluated relative to the base URL.
|
83
|
-
StyleGuideBaseURL: https://
|
76
|
+
StyleGuideBaseURL: https://rubystyle.guide
|
84
77
|
# Extra details are not displayed in offense messages by default. Change
|
85
78
|
# behavior by overriding ExtraDetails, or by giving the
|
86
79
|
# `-E/--extra-details` option.
|
@@ -130,16 +123,8 @@ AllCops:
|
|
130
123
|
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
|
131
124
|
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
|
132
125
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
133
|
-
# use the oldest officially supported Ruby version (currently Ruby 2.
|
126
|
+
# use the oldest officially supported Ruby version (currently Ruby 2.3).
|
134
127
|
TargetRubyVersion: ~
|
135
|
-
# What version of Rails is the inspected code using? If a value is specified
|
136
|
-
# for TargetRailsVersion then it is used. Acceptable values are specificed
|
137
|
-
# as a float (i.e. 5.1); the patch version of Rails should not be included.
|
138
|
-
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
|
139
|
-
# gems.locked file to find the version of Rails that has been bound to the
|
140
|
-
# application. If neither of those files exist, RuboCop will use Rails 5.0
|
141
|
-
# as the default.
|
142
|
-
TargetRailsVersion: ~
|
143
128
|
|
144
129
|
#################### Bundler ###############################
|
145
130
|
|
@@ -210,6 +195,13 @@ Gemspec/RequiredRubyVersion:
|
|
210
195
|
VersionAdded: '0.52'
|
211
196
|
Include:
|
212
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'
|
213
205
|
|
214
206
|
#################### Layout ###########################
|
215
207
|
|
@@ -226,6 +218,34 @@ Layout/AccessModifierIndentation:
|
|
226
218
|
# But it can be overridden by setting this parameter
|
227
219
|
IndentationWidth: ~
|
228
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
|
+
|
229
249
|
Layout/AlignArray:
|
230
250
|
Description: >-
|
231
251
|
Align the elements of an array literal if they span more than
|
@@ -239,6 +259,7 @@ Layout/AlignHash:
|
|
239
259
|
Align the elements of a hash literal if they span more than
|
240
260
|
one line.
|
241
261
|
Enabled: true
|
262
|
+
AllowMultipleStyles: true
|
242
263
|
VersionAdded: '0.49'
|
243
264
|
# Alignment of entries using hash rocket as separator. Valid values are:
|
244
265
|
#
|
@@ -312,23 +333,24 @@ Layout/AlignHash:
|
|
312
333
|
|
313
334
|
Layout/AlignParameters:
|
314
335
|
Description: >-
|
315
|
-
Align the parameters of a method
|
336
|
+
Align the parameters of a method definition if they span more
|
316
337
|
than one line.
|
317
338
|
StyleGuide: '#no-double-indent'
|
318
339
|
Enabled: true
|
319
340
|
VersionAdded: '0.49'
|
341
|
+
VersionChanged: '0.68'
|
320
342
|
# Alignment of parameters in multi-line method calls.
|
321
343
|
#
|
322
344
|
# The `with_first_parameter` style aligns the following lines along the same
|
323
345
|
# column as the first parameter.
|
324
346
|
#
|
325
|
-
#
|
326
|
-
#
|
347
|
+
# def method_foo(a,
|
348
|
+
# b)
|
327
349
|
#
|
328
350
|
# The `with_fixed_indentation` style aligns the following lines with one
|
329
351
|
# level of indentation relative to the start of the line with the method call.
|
330
352
|
#
|
331
|
-
#
|
353
|
+
# def method_foo(a,
|
332
354
|
# b)
|
333
355
|
EnforcedStyle: with_first_parameter
|
334
356
|
SupportedStyles:
|
@@ -375,7 +397,7 @@ Layout/CaseIndentation:
|
|
375
397
|
|
376
398
|
Layout/ClassStructure:
|
377
399
|
Description: 'Enforces a configured order of definitions within a class body.'
|
378
|
-
StyleGuide: '
|
400
|
+
StyleGuide: '#consistent-classes'
|
379
401
|
Enabled: false
|
380
402
|
VersionAdded: '0.52'
|
381
403
|
Categories:
|
@@ -486,6 +508,13 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
486
508
|
StyleGuide: '#empty-lines-around-access-modifier'
|
487
509
|
Enabled: true
|
488
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
|
489
518
|
|
490
519
|
Layout/EmptyLinesAroundArguments:
|
491
520
|
Description: "Keeps track of empty lines around method arguments."
|
@@ -588,6 +617,10 @@ Layout/ExtraSpacing:
|
|
588
617
|
# things with the previous or next line, not counting empty lines or comment
|
589
618
|
# lines.
|
590
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
|
591
624
|
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
592
625
|
ForceEqualSignAlignment: false
|
593
626
|
|
@@ -619,11 +652,28 @@ Layout/FirstMethodParameterLineBreak:
|
|
619
652
|
Enabled: false
|
620
653
|
VersionAdded: '0.49'
|
621
654
|
|
622
|
-
Layout/
|
623
|
-
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.
|
624
667
|
Enabled: true
|
625
668
|
VersionAdded: '0.49'
|
626
|
-
|
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'
|
627
677
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
628
678
|
SupportedStyles:
|
629
679
|
# The first parameter should always be indented one step more than the
|
@@ -644,12 +694,12 @@ Layout/FirstParameterIndentation:
|
|
644
694
|
# But it can be overridden by setting this parameter
|
645
695
|
IndentationWidth: ~
|
646
696
|
|
647
|
-
Layout/
|
697
|
+
Layout/IndentFirstArrayElement:
|
648
698
|
Description: >-
|
649
699
|
Checks the indentation of the first element in an array
|
650
700
|
literal.
|
651
701
|
Enabled: true
|
652
|
-
VersionAdded: '0.
|
702
|
+
VersionAdded: '0.68'
|
653
703
|
# The value `special_inside_parentheses` means that array literals with
|
654
704
|
# brackets that have their opening bracket on the same line as a surrounding
|
655
705
|
# opening round parenthesis, shall have their first element indented relative
|
@@ -670,20 +720,10 @@ Layout/IndentArray:
|
|
670
720
|
# But it can be overridden by setting this parameter
|
671
721
|
IndentationWidth: ~
|
672
722
|
|
673
|
-
Layout/
|
674
|
-
Description: >-
|
675
|
-
Checks the indentation of the first line of the
|
676
|
-
right-hand-side of a multi-line assignment.
|
677
|
-
Enabled: true
|
678
|
-
VersionAdded: '0.49'
|
679
|
-
# By default, the indentation width from `Layout/IndentationWidth` is used
|
680
|
-
# But it can be overridden by setting this parameter
|
681
|
-
IndentationWidth: ~
|
682
|
-
|
683
|
-
Layout/IndentHash:
|
723
|
+
Layout/IndentFirstHashElement:
|
684
724
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
685
725
|
Enabled: true
|
686
|
-
VersionAdded: '0.
|
726
|
+
VersionAdded: '0.68'
|
687
727
|
# The value `special_inside_parentheses` means that hash literals with braces
|
688
728
|
# that have their opening brace on the same line as a surrounding opening
|
689
729
|
# round parenthesis, shall have their first key indented relative to the
|
@@ -704,14 +744,29 @@ Layout/IndentHash:
|
|
704
744
|
# But it can be overridden by setting this parameter
|
705
745
|
IndentationWidth: ~
|
706
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
|
+
|
707
762
|
Layout/IndentHeredoc:
|
708
763
|
Description: 'This cop checks the indentation of the here document bodies.'
|
709
764
|
StyleGuide: '#squiggly-heredocs'
|
710
765
|
Enabled: true
|
711
766
|
VersionAdded: '0.49'
|
712
|
-
|
767
|
+
VersionChanged: '0.69'
|
768
|
+
EnforcedStyle: squiggly
|
713
769
|
SupportedStyles:
|
714
|
-
- auto_detection
|
715
770
|
- squiggly
|
716
771
|
- active_support
|
717
772
|
- powerpack
|
@@ -722,8 +777,8 @@ Layout/IndentationConsistency:
|
|
722
777
|
StyleGuide: '#spaces-indentation'
|
723
778
|
Enabled: true
|
724
779
|
VersionAdded: '0.49'
|
725
|
-
# The difference between `
|
726
|
-
# 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`
|
727
782
|
# modifier keywords shall be indented the same as public methods and that
|
728
783
|
# protected and private members shall be indented one step more than the
|
729
784
|
# modifiers. Other than that, both styles mean that entities on the same
|
@@ -731,7 +786,10 @@ Layout/IndentationConsistency:
|
|
731
786
|
EnforcedStyle: normal
|
732
787
|
SupportedStyles:
|
733
788
|
- normal
|
734
|
-
-
|
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
|
735
793
|
|
736
794
|
Layout/IndentationWidth:
|
737
795
|
Description: 'Use 2 spaces for indentation.'
|
@@ -775,6 +833,13 @@ Layout/MultilineArrayBraceLayout:
|
|
775
833
|
- new_line
|
776
834
|
- same_line
|
777
835
|
|
836
|
+
Layout/MultilineArrayLineBreaks:
|
837
|
+
Description: >-
|
838
|
+
Checks that each item in a multi-line array literal
|
839
|
+
starts on a separate line.
|
840
|
+
Enabled: false
|
841
|
+
VersionAdded: '0.67'
|
842
|
+
|
778
843
|
Layout/MultilineAssignmentLayout:
|
779
844
|
Description: 'Check for a newline after the assignment operator in multi-line assignments.'
|
780
845
|
StyleGuide: '#indent-conditional-assignment'
|
@@ -818,6 +883,20 @@ Layout/MultilineHashBraceLayout:
|
|
818
883
|
- new_line
|
819
884
|
- same_line
|
820
885
|
|
886
|
+
Layout/MultilineHashKeyLineBreaks:
|
887
|
+
Description: >-
|
888
|
+
Checks that each item in a multi-line hash literal
|
889
|
+
starts on a separate line.
|
890
|
+
Enabled: false
|
891
|
+
VersionAdded: '0.67'
|
892
|
+
|
893
|
+
Layout/MultilineMethodArgumentLineBreaks:
|
894
|
+
Description: >-
|
895
|
+
Checks that each argument in a multi-line method call
|
896
|
+
starts on a separate line.
|
897
|
+
Enabled: false
|
898
|
+
VersionAdded: '0.67'
|
899
|
+
|
821
900
|
Layout/MultilineMethodCallBraceLayout:
|
822
901
|
Description: >-
|
823
902
|
Checks that the closing brace in a method call is
|
@@ -1198,6 +1277,12 @@ Lint/DeprecatedClassMethods:
|
|
1198
1277
|
Enabled: true
|
1199
1278
|
VersionAdded: '0.19'
|
1200
1279
|
|
1280
|
+
Lint/DisjunctiveAssignmentInConstructor:
|
1281
|
+
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1282
|
+
Enabled: true
|
1283
|
+
Safe: false
|
1284
|
+
VersionAdded: '0.62'
|
1285
|
+
|
1201
1286
|
Lint/DuplicateCaseCondition:
|
1202
1287
|
Description: 'Do not repeat values in case conditionals.'
|
1203
1288
|
Enabled: true
|
@@ -1262,6 +1347,12 @@ Lint/ErbNewArguments:
|
|
1262
1347
|
Enabled: true
|
1263
1348
|
VersionAdded: '0.56'
|
1264
1349
|
|
1350
|
+
Lint/FlipFlop:
|
1351
|
+
Description: 'Checks for flip-flops.'
|
1352
|
+
StyleGuide: '#no-flip-flops'
|
1353
|
+
Enabled: true
|
1354
|
+
VersionAdded: '0.16'
|
1355
|
+
|
1265
1356
|
Lint/FloatOutOfRange:
|
1266
1357
|
Description: >-
|
1267
1358
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1278,7 +1369,17 @@ Lint/HandleExceptions:
|
|
1278
1369
|
Description: "Don't suppress exception."
|
1279
1370
|
StyleGuide: '#dont-hide-exceptions'
|
1280
1371
|
Enabled: true
|
1372
|
+
AllowComments: false
|
1281
1373
|
VersionAdded: '0.9'
|
1374
|
+
VersionChanged: '0.70'
|
1375
|
+
|
1376
|
+
Lint/HeredocMethodCallPosition:
|
1377
|
+
Description: >-
|
1378
|
+
Checks for the ordering of a method call where
|
1379
|
+
the receiver of the call is a HEREDOC.
|
1380
|
+
Enabled: false
|
1381
|
+
StyleGuide: '#heredoc-method-calls'
|
1382
|
+
VersionAdded: '0.68'
|
1282
1383
|
|
1283
1384
|
Lint/ImplicitStringConcatenation:
|
1284
1385
|
Description: >-
|
@@ -1305,7 +1406,7 @@ Lint/InheritException:
|
|
1305
1406
|
- standard_error
|
1306
1407
|
|
1307
1408
|
Lint/InterpolationCheck:
|
1308
|
-
Description: 'Raise warning for interpolation in single q strs'
|
1409
|
+
Description: 'Raise warning for interpolation in single q strs.'
|
1309
1410
|
Enabled: true
|
1310
1411
|
VersionAdded: '0.50'
|
1311
1412
|
|
@@ -1329,7 +1430,7 @@ Lint/Loop:
|
|
1329
1430
|
VersionAdded: '0.9'
|
1330
1431
|
|
1331
1432
|
Lint/MissingCopEnableDirective:
|
1332
|
-
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable
|
1433
|
+
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
1333
1434
|
Enabled: true
|
1334
1435
|
VersionAdded: '0.52'
|
1335
1436
|
# Maximum number of consecutive lines the cop can be disabled for.
|
@@ -1373,6 +1474,8 @@ Lint/NumberConversion:
|
|
1373
1474
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1374
1475
|
Enabled: false
|
1375
1476
|
VersionAdded: '0.53'
|
1477
|
+
VersionChanged: '0.70'
|
1478
|
+
SafeAutoCorrect: false
|
1376
1479
|
|
1377
1480
|
Lint/OrderedMagicComments:
|
1378
1481
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
@@ -1391,6 +1494,7 @@ Lint/PercentStringArray:
|
|
1391
1494
|
Description: >-
|
1392
1495
|
Checks for unwanted commas and quotes in %w/%W literals.
|
1393
1496
|
Enabled: true
|
1497
|
+
Safe: false
|
1394
1498
|
VersionAdded: '0.41'
|
1395
1499
|
|
1396
1500
|
Lint/PercentSymbolArray:
|
@@ -1474,6 +1578,11 @@ Lint/SafeNavigationConsistency:
|
|
1474
1578
|
- try!
|
1475
1579
|
|
1476
1580
|
|
1581
|
+
Lint/SafeNavigationWithEmpty:
|
1582
|
+
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1583
|
+
Enabled: true
|
1584
|
+
VersionAdded: '0.62'
|
1585
|
+
|
1477
1586
|
Lint/ScriptPermission:
|
1478
1587
|
Description: 'Grant script file execute permission.'
|
1479
1588
|
Enabled: true
|
@@ -1509,18 +1618,23 @@ Lint/StringConversionInInterpolation:
|
|
1509
1618
|
VersionChanged: '0.20'
|
1510
1619
|
|
1511
1620
|
Lint/Syntax:
|
1512
|
-
Description: 'Checks syntax error'
|
1621
|
+
Description: 'Checks syntax error.'
|
1513
1622
|
Enabled: true
|
1514
1623
|
VersionAdded: '0.9'
|
1515
1624
|
|
1516
1625
|
|
1626
|
+
Lint/ToJSON:
|
1627
|
+
Description: 'Ensure #to_json includes an optional argument.'
|
1628
|
+
Enabled: true
|
1629
|
+
|
1517
1630
|
Lint/UnderscorePrefixedVariableName:
|
1518
1631
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1519
1632
|
Enabled: true
|
1520
1633
|
VersionAdded: '0.21'
|
1634
|
+
AllowKeywordBlockArguments: false
|
1521
1635
|
|
1522
1636
|
Lint/UnifiedInteger:
|
1523
|
-
Description: 'Use Integer instead of Fixnum or Bignum'
|
1637
|
+
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1524
1638
|
Enabled: true
|
1525
1639
|
VersionAdded: '0.43'
|
1526
1640
|
|
@@ -1543,7 +1657,7 @@ Lint/UnneededRequireStatement:
|
|
1543
1657
|
VersionAdded: '0.51'
|
1544
1658
|
|
1545
1659
|
Lint/UnneededSplatExpansion:
|
1546
|
-
Description: 'Checks for splat unnecessarily being called on literals'
|
1660
|
+
Description: 'Checks for splat unnecessarily being called on literals.'
|
1547
1661
|
Enabled: true
|
1548
1662
|
VersionAdded: '0.43'
|
1549
1663
|
|
@@ -1627,9 +1741,12 @@ Metrics/AbcSize:
|
|
1627
1741
|
Description: >-
|
1628
1742
|
A calculated magnitude based on number of assignments,
|
1629
1743
|
branches, and conditions.
|
1630
|
-
Reference:
|
1744
|
+
Reference:
|
1745
|
+
- http://c2.com/cgi/wiki?AbcMetric
|
1746
|
+
- https://en.wikipedia.org/wiki/ABC_Software_Metric'
|
1631
1747
|
Enabled: true
|
1632
1748
|
VersionAdded: '0.27'
|
1749
|
+
VersionChanged: '0.66'
|
1633
1750
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1634
1751
|
# a Float.
|
1635
1752
|
Max: 15
|
@@ -1638,16 +1755,18 @@ Metrics/BlockLength:
|
|
1638
1755
|
Description: 'Avoid long blocks with many lines.'
|
1639
1756
|
Enabled: true
|
1640
1757
|
VersionAdded: '0.44'
|
1641
|
-
VersionChanged: '0.
|
1758
|
+
VersionChanged: '0.66'
|
1642
1759
|
CountComments: false # count full line comments?
|
1643
1760
|
Max: 25
|
1644
1761
|
ExcludedMethods:
|
1645
1762
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1646
1763
|
# associated blocks.
|
1647
1764
|
- refine
|
1765
|
+
Exclude:
|
1766
|
+
- '**/*.gemspec'
|
1648
1767
|
|
1649
1768
|
Metrics/BlockNesting:
|
1650
|
-
Description: 'Avoid excessive block nesting'
|
1769
|
+
Description: 'Avoid excessive block nesting.'
|
1651
1770
|
StyleGuide: '#three-is-the-number-thou-shalt-count'
|
1652
1771
|
Enabled: true
|
1653
1772
|
VersionAdded: '0.25'
|
@@ -1676,7 +1795,8 @@ Metrics/LineLength:
|
|
1676
1795
|
StyleGuide: '#80-character-limits'
|
1677
1796
|
Enabled: true
|
1678
1797
|
VersionAdded: '0.25'
|
1679
|
-
VersionChanged: '0.
|
1798
|
+
VersionChanged: '0.68'
|
1799
|
+
AutoCorrect: false
|
1680
1800
|
Max: 80
|
1681
1801
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
1682
1802
|
# containing a URI to be longer than Max.
|
@@ -1891,6 +2011,13 @@ Naming/PredicateName:
|
|
1891
2011
|
Exclude:
|
1892
2012
|
- 'spec/**/*'
|
1893
2013
|
|
2014
|
+
Naming/RescuedExceptionsVariableName:
|
2015
|
+
Description: 'Use consistent rescued exceptions variables naming.'
|
2016
|
+
Enabled: true
|
2017
|
+
VersionAdded: '0.67'
|
2018
|
+
VersionChanged: '0.68'
|
2019
|
+
PreferredName: e
|
2020
|
+
|
1894
2021
|
Naming/UncommunicativeBlockParamName:
|
1895
2022
|
Description: >-
|
1896
2023
|
Checks for block parameter names that contain capital letters,
|
@@ -1950,650 +2077,6 @@ Naming/VariableNumber:
|
|
1950
2077
|
- normalcase
|
1951
2078
|
- non_integer
|
1952
2079
|
|
1953
|
-
#################### Performance ###########################
|
1954
|
-
|
1955
|
-
Performance/Caller:
|
1956
|
-
Description: >-
|
1957
|
-
Use `caller(n..n)` instead of `caller`.
|
1958
|
-
Enabled: true
|
1959
|
-
VersionAdded: '0.49'
|
1960
|
-
|
1961
|
-
Performance/CaseWhenSplat:
|
1962
|
-
Description: >-
|
1963
|
-
Reordering `when` conditions with a splat to the end
|
1964
|
-
of the `when` branches can improve performance.
|
1965
|
-
Enabled: false
|
1966
|
-
AutoCorrect: false
|
1967
|
-
SafeAutoCorrect: false
|
1968
|
-
VersionAdded: '0.34'
|
1969
|
-
VersionChanged: '0.59'
|
1970
|
-
|
1971
|
-
Performance/Casecmp:
|
1972
|
-
Description: >-
|
1973
|
-
Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
|
1974
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
|
1975
|
-
Enabled: true
|
1976
|
-
VersionAdded: '0.36'
|
1977
|
-
|
1978
|
-
Performance/ChainArrayAllocation:
|
1979
|
-
Description: >-
|
1980
|
-
Instead of chaining array methods that allocate new arrays, mutate an
|
1981
|
-
existing array.
|
1982
|
-
Reference: 'https://twitter.com/schneems/status/1034123879978029057'
|
1983
|
-
Enabled: false
|
1984
|
-
VersionAdded: '0.59'
|
1985
|
-
|
1986
|
-
Performance/CompareWithBlock:
|
1987
|
-
Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
|
1988
|
-
Enabled: true
|
1989
|
-
VersionAdded: '0.46'
|
1990
|
-
|
1991
|
-
Performance/Count:
|
1992
|
-
Description: >-
|
1993
|
-
Use `count` instead of `select...size`, `reject...size`,
|
1994
|
-
`select...count`, `reject...count`, `select...length`,
|
1995
|
-
and `reject...length`.
|
1996
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
1997
|
-
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
1998
|
-
# For more information, see the documentation in the cop itself.
|
1999
|
-
# If you understand the known risk, you can disable `SafeMode`.
|
2000
|
-
SafeMode: true
|
2001
|
-
Enabled: true
|
2002
|
-
VersionAdded: '0.31'
|
2003
|
-
VersionChanged: '0.39'
|
2004
|
-
|
2005
|
-
Performance/Detect:
|
2006
|
-
Description: >-
|
2007
|
-
Use `detect` instead of `select.first`, `find_all.first`,
|
2008
|
-
`select.last`, and `find_all.last`.
|
2009
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
2010
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
2011
|
-
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
2012
|
-
# has its own meaning. Correcting `ActiveRecord` methods with this cop
|
2013
|
-
# should be considered unsafe.
|
2014
|
-
SafeMode: true
|
2015
|
-
Enabled: true
|
2016
|
-
VersionAdded: '0.30'
|
2017
|
-
VersionChanged: '0.39'
|
2018
|
-
|
2019
|
-
Performance/DoubleStartEndWith:
|
2020
|
-
Description: >-
|
2021
|
-
Use `str.{start,end}_with?(x, ..., y, ...)`
|
2022
|
-
instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
2023
|
-
Enabled: true
|
2024
|
-
VersionAdded: '0.36'
|
2025
|
-
VersionChanged: '0.48'
|
2026
|
-
# Used to check for `starts_with?` and `ends_with?`.
|
2027
|
-
# These methods are defined by `ActiveSupport`.
|
2028
|
-
IncludeActiveSupportAliases: false
|
2029
|
-
|
2030
|
-
Performance/EndWith:
|
2031
|
-
Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
|
2032
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2033
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
2034
|
-
# object. Switching these methods has to be done with knowledge of the types
|
2035
|
-
# of the variables which rubocop doesn't have.
|
2036
|
-
SafeAutoCorrect: false
|
2037
|
-
AutoCorrect: false
|
2038
|
-
Enabled: true
|
2039
|
-
VersionAdded: '0.36'
|
2040
|
-
VersionChanged: '0.44'
|
2041
|
-
|
2042
|
-
Performance/FixedSize:
|
2043
|
-
Description: 'Do not compute the size of statically sized objects except in constants'
|
2044
|
-
Enabled: true
|
2045
|
-
VersionAdded: '0.35'
|
2046
|
-
|
2047
|
-
Performance/FlatMap:
|
2048
|
-
Description: >-
|
2049
|
-
Use `Enumerable#flat_map`
|
2050
|
-
instead of `Enumerable#map...Array#flatten(1)`
|
2051
|
-
or `Enumberable#collect..Array#flatten(1)`
|
2052
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
2053
|
-
Enabled: true
|
2054
|
-
VersionAdded: '0.30'
|
2055
|
-
EnabledForFlattenWithoutParams: false
|
2056
|
-
# If enabled, this cop will warn about usages of
|
2057
|
-
# `flatten` being called without any parameters.
|
2058
|
-
# This can be dangerous since `flat_map` will only flatten 1 level, and
|
2059
|
-
# `flatten` without any parameters can flatten multiple levels.
|
2060
|
-
|
2061
|
-
Performance/InefficientHashSearch:
|
2062
|
-
Description: 'Use `key?` or `value?` instead of `keys.include?` or `values.include?`'
|
2063
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashkey-instead-of-hashkeysinclude-code'
|
2064
|
-
Enabled: true
|
2065
|
-
VersionAdded: '0.56'
|
2066
|
-
Safe: false
|
2067
|
-
|
2068
|
-
Performance/LstripRstrip:
|
2069
|
-
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
2070
|
-
Enabled: true
|
2071
|
-
VersionAdded: '0.36'
|
2072
|
-
|
2073
|
-
Performance/OpenStruct:
|
2074
|
-
Description: 'Use `Struct` instead of `OpenStruct`.'
|
2075
|
-
Enabled: false
|
2076
|
-
VersionAdded: '0.61'
|
2077
|
-
Safe: false
|
2078
|
-
|
2079
|
-
Performance/RangeInclude:
|
2080
|
-
Description: 'Use `Range#cover?` instead of `Range#include?`.'
|
2081
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
|
2082
|
-
Enabled: true
|
2083
|
-
VersionAdded: '0.36'
|
2084
|
-
|
2085
|
-
Performance/RedundantBlockCall:
|
2086
|
-
Description: 'Use `yield` instead of `block.call`.'
|
2087
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
|
2088
|
-
Enabled: true
|
2089
|
-
VersionAdded: '0.36'
|
2090
|
-
|
2091
|
-
Performance/RedundantMatch:
|
2092
|
-
Description: >-
|
2093
|
-
Use `=~` instead of `String#match` or `Regexp#match` in a context where the
|
2094
|
-
returned `MatchData` is not needed.
|
2095
|
-
Enabled: true
|
2096
|
-
VersionAdded: '0.36'
|
2097
|
-
|
2098
|
-
Performance/RedundantMerge:
|
2099
|
-
Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
|
2100
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
|
2101
|
-
Enabled: true
|
2102
|
-
VersionAdded: '0.36'
|
2103
|
-
# Max number of key-value pairs to consider an offense
|
2104
|
-
MaxKeyValuePairs: 2
|
2105
|
-
|
2106
|
-
Performance/RedundantSortBy:
|
2107
|
-
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
2108
|
-
Enabled: true
|
2109
|
-
VersionAdded: '0.36'
|
2110
|
-
|
2111
|
-
Performance/RegexpMatch:
|
2112
|
-
Description: >-
|
2113
|
-
Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
|
2114
|
-
`Regexp#===`, or `=~` when `MatchData` is not used.
|
2115
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
|
2116
|
-
Enabled: true
|
2117
|
-
VersionAdded: '0.47'
|
2118
|
-
|
2119
|
-
Performance/ReverseEach:
|
2120
|
-
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
2121
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
2122
|
-
Enabled: true
|
2123
|
-
VersionAdded: '0.30'
|
2124
|
-
|
2125
|
-
Performance/Sample:
|
2126
|
-
Description: >-
|
2127
|
-
Use `sample` instead of `shuffle.first`,
|
2128
|
-
`shuffle.last`, and `shuffle[Integer]`.
|
2129
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
2130
|
-
Enabled: true
|
2131
|
-
VersionAdded: '0.30'
|
2132
|
-
|
2133
|
-
Performance/Size:
|
2134
|
-
Description: >-
|
2135
|
-
Use `size` instead of `count` for counting
|
2136
|
-
the number of elements in `Array` and `Hash`.
|
2137
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
|
2138
|
-
Enabled: true
|
2139
|
-
VersionAdded: '0.30'
|
2140
|
-
|
2141
|
-
Performance/StartWith:
|
2142
|
-
Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
|
2143
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
2144
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
2145
|
-
# object. Switching these methods has to be done with knowledge of the types
|
2146
|
-
# of the variables which rubocop doesn't have.
|
2147
|
-
SafeAutoCorrect: false
|
2148
|
-
AutoCorrect: false
|
2149
|
-
Enabled: true
|
2150
|
-
VersionAdded: '0.36'
|
2151
|
-
VersionChanged: '0.44'
|
2152
|
-
|
2153
|
-
Performance/StringReplacement:
|
2154
|
-
Description: >-
|
2155
|
-
Use `tr` instead of `gsub` when you are replacing the same
|
2156
|
-
number of characters. Use `delete` instead of `gsub` when
|
2157
|
-
you are deleting characters.
|
2158
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
2159
|
-
Enabled: true
|
2160
|
-
VersionAdded: '0.33'
|
2161
|
-
|
2162
|
-
Performance/TimesMap:
|
2163
|
-
Description: 'Checks for .times.map calls.'
|
2164
|
-
AutoCorrect: false
|
2165
|
-
Enabled: true
|
2166
|
-
VersionAdded: '0.36'
|
2167
|
-
VersionChanged: '0.50'
|
2168
|
-
SafeAutoCorrect: false # see https://github.com/rubocop-hq/rubocop/issues/4658
|
2169
|
-
|
2170
|
-
Performance/UnfreezeString:
|
2171
|
-
Description: 'Use unary plus to get an unfrozen string literal.'
|
2172
|
-
Enabled: true
|
2173
|
-
VersionAdded: '0.50'
|
2174
|
-
|
2175
|
-
Performance/UnneededSort:
|
2176
|
-
Description: >-
|
2177
|
-
Use `min` instead of `sort.first`,
|
2178
|
-
`max_by` instead of `sort_by...last`, etc.
|
2179
|
-
Enabled: true
|
2180
|
-
VersionAdded: '0.55'
|
2181
|
-
|
2182
|
-
Performance/UriDefaultParser:
|
2183
|
-
Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
|
2184
|
-
Enabled: true
|
2185
|
-
VersionAdded: '0.50'
|
2186
|
-
|
2187
|
-
#################### Rails #################################
|
2188
|
-
|
2189
|
-
# By default, the rails cops are not run. Override in project or home
|
2190
|
-
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
2191
|
-
Rails:
|
2192
|
-
Enabled: false
|
2193
|
-
|
2194
|
-
Rails/ActionFilter:
|
2195
|
-
Description: 'Enforces consistent use of action filter methods.'
|
2196
|
-
Enabled: true
|
2197
|
-
VersionAdded: '0.19'
|
2198
|
-
EnforcedStyle: action
|
2199
|
-
SupportedStyles:
|
2200
|
-
- action
|
2201
|
-
- filter
|
2202
|
-
Include:
|
2203
|
-
- app/controllers/**/*.rb
|
2204
|
-
|
2205
|
-
Rails/ActiveRecordAliases:
|
2206
|
-
Description: >-
|
2207
|
-
Avoid Active Record aliases:
|
2208
|
-
Use `update` instead of `update_attributes`.
|
2209
|
-
Use `update!` instead of `update_attributes!`.
|
2210
|
-
Enabled: true
|
2211
|
-
VersionAdded: '0.53'
|
2212
|
-
|
2213
|
-
Rails/ActiveSupportAliases:
|
2214
|
-
Description: >-
|
2215
|
-
Avoid ActiveSupport aliases of standard ruby methods:
|
2216
|
-
`String#starts_with?`, `String#ends_with?`,
|
2217
|
-
`Array#append`, `Array#prepend`.
|
2218
|
-
Enabled: true
|
2219
|
-
VersionAdded: '0.48'
|
2220
|
-
|
2221
|
-
Rails/ApplicationJob:
|
2222
|
-
Description: 'Check that jobs subclass ApplicationJob.'
|
2223
|
-
Enabled: true
|
2224
|
-
VersionAdded: '0.49'
|
2225
|
-
|
2226
|
-
Rails/ApplicationRecord:
|
2227
|
-
Description: 'Check that models subclass ApplicationRecord.'
|
2228
|
-
Enabled: true
|
2229
|
-
VersionAdded: '0.49'
|
2230
|
-
|
2231
|
-
Rails/AssertNot:
|
2232
|
-
Description: 'Use `assert_not` instead of `assert !`.'
|
2233
|
-
Enabled: true
|
2234
|
-
VersionAdded: '0.56'
|
2235
|
-
Include:
|
2236
|
-
- '**/test/**/*'
|
2237
|
-
|
2238
|
-
Rails/Blank:
|
2239
|
-
Description: 'Enforces use of `blank?`.'
|
2240
|
-
Enabled: true
|
2241
|
-
VersionAdded: '0.48'
|
2242
|
-
# Convert usages of `nil? || empty?` to `blank?`
|
2243
|
-
NilOrEmpty: true
|
2244
|
-
# Convert usages of `!present?` to `blank?`
|
2245
|
-
NotPresent: true
|
2246
|
-
# Convert usages of `unless present?` to `if blank?`
|
2247
|
-
UnlessPresent: true
|
2248
|
-
|
2249
|
-
Rails/BulkChangeTable:
|
2250
|
-
Description: 'Check whether alter queries are combinable.'
|
2251
|
-
Enabled: true
|
2252
|
-
VersionAdded: '0.57'
|
2253
|
-
Database: null
|
2254
|
-
SupportedDatabases:
|
2255
|
-
- mysql
|
2256
|
-
- postgresql
|
2257
|
-
Include:
|
2258
|
-
- db/migrate/*.rb
|
2259
|
-
|
2260
|
-
Rails/CreateTableWithTimestamps:
|
2261
|
-
Description: >-
|
2262
|
-
Checks the migration for which timestamps are not included
|
2263
|
-
when creating a new table.
|
2264
|
-
Enabled: true
|
2265
|
-
VersionAdded: '0.52'
|
2266
|
-
Include:
|
2267
|
-
- db/migrate/*.rb
|
2268
|
-
|
2269
|
-
Rails/Date:
|
2270
|
-
Description: >-
|
2271
|
-
Checks the correct usage of date aware methods,
|
2272
|
-
such as Date.today, Date.current etc.
|
2273
|
-
Enabled: true
|
2274
|
-
VersionAdded: '0.30'
|
2275
|
-
VersionChanged: '0.33'
|
2276
|
-
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
2277
|
-
# `Date#to_time` etc.
|
2278
|
-
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
|
2279
|
-
# (but not `Date.today`) which are overridden by ActiveSupport to handle current
|
2280
|
-
# time zone.
|
2281
|
-
EnforcedStyle: flexible
|
2282
|
-
SupportedStyles:
|
2283
|
-
- strict
|
2284
|
-
- flexible
|
2285
|
-
|
2286
|
-
Rails/Delegate:
|
2287
|
-
Description: 'Prefer delegate method for delegations.'
|
2288
|
-
Enabled: true
|
2289
|
-
VersionAdded: '0.21'
|
2290
|
-
VersionChanged: '0.50'
|
2291
|
-
# When set to true, using the target object as a prefix of the
|
2292
|
-
# method name without using the `delegate` method will be a
|
2293
|
-
# violation. When set to false, this case is legal.
|
2294
|
-
EnforceForPrefixed: true
|
2295
|
-
|
2296
|
-
Rails/DelegateAllowBlank:
|
2297
|
-
Description: 'Do not use allow_blank as an option to delegate.'
|
2298
|
-
Enabled: true
|
2299
|
-
VersionAdded: '0.44'
|
2300
|
-
|
2301
|
-
Rails/DynamicFindBy:
|
2302
|
-
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
|
2303
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2304
|
-
Enabled: true
|
2305
|
-
VersionAdded: '0.44'
|
2306
|
-
Whitelist:
|
2307
|
-
- find_by_sql
|
2308
|
-
|
2309
|
-
Rails/EnumUniqueness:
|
2310
|
-
Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
|
2311
|
-
Enabled: true
|
2312
|
-
VersionAdded: '0.46'
|
2313
|
-
Include:
|
2314
|
-
- app/models/**/*.rb
|
2315
|
-
|
2316
|
-
Rails/EnvironmentComparison:
|
2317
|
-
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
|
2318
|
-
Enabled: true
|
2319
|
-
VersionAdded: '0.52'
|
2320
|
-
|
2321
|
-
Rails/Exit:
|
2322
|
-
Description: >-
|
2323
|
-
Favor `fail`, `break`, `return`, etc. over `exit` in
|
2324
|
-
application or library code outside of Rake files to avoid
|
2325
|
-
exits during unit testing or running in production.
|
2326
|
-
Enabled: true
|
2327
|
-
VersionAdded: '0.41'
|
2328
|
-
Include:
|
2329
|
-
- app/**/*.rb
|
2330
|
-
- config/**/*.rb
|
2331
|
-
- lib/**/*.rb
|
2332
|
-
Exclude:
|
2333
|
-
- lib/**/*.rake
|
2334
|
-
|
2335
|
-
Rails/FilePath:
|
2336
|
-
Description: 'Use `Rails.root.join` for file path joining.'
|
2337
|
-
Enabled: true
|
2338
|
-
VersionAdded: '0.47'
|
2339
|
-
VersionChanged: '0.57'
|
2340
|
-
EnforcedStyle: arguments
|
2341
|
-
SupportedStyles:
|
2342
|
-
- slashes
|
2343
|
-
- arguments
|
2344
|
-
|
2345
|
-
Rails/FindBy:
|
2346
|
-
Description: 'Prefer find_by over where.first.'
|
2347
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2348
|
-
Enabled: true
|
2349
|
-
VersionAdded: '0.30'
|
2350
|
-
Include:
|
2351
|
-
- app/models/**/*.rb
|
2352
|
-
|
2353
|
-
Rails/FindEach:
|
2354
|
-
Description: 'Prefer all.find_each over all.find.'
|
2355
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
|
2356
|
-
Enabled: true
|
2357
|
-
VersionAdded: '0.30'
|
2358
|
-
Include:
|
2359
|
-
- app/models/**/*.rb
|
2360
|
-
|
2361
|
-
Rails/HasAndBelongsToMany:
|
2362
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
2363
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
|
2364
|
-
Enabled: true
|
2365
|
-
VersionAdded: '0.12'
|
2366
|
-
Include:
|
2367
|
-
- app/models/**/*.rb
|
2368
|
-
|
2369
|
-
Rails/HasManyOrHasOneDependent:
|
2370
|
-
Description: 'Define the dependent option to the has_many and has_one associations.'
|
2371
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
|
2372
|
-
Enabled: true
|
2373
|
-
VersionAdded: '0.50'
|
2374
|
-
Include:
|
2375
|
-
- app/models/**/*.rb
|
2376
|
-
|
2377
|
-
Rails/HttpPositionalArguments:
|
2378
|
-
Description: 'Use keyword arguments instead of positional arguments in http method calls.'
|
2379
|
-
Enabled: true
|
2380
|
-
VersionAdded: '0.44'
|
2381
|
-
Include:
|
2382
|
-
- 'spec/**/*'
|
2383
|
-
- 'test/**/*'
|
2384
|
-
|
2385
|
-
Rails/HttpStatus:
|
2386
|
-
Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
|
2387
|
-
Enabled: true
|
2388
|
-
VersionAdded: '0.54'
|
2389
|
-
EnforcedStyle: symbolic
|
2390
|
-
SupportedStyles:
|
2391
|
-
- numeric
|
2392
|
-
- symbolic
|
2393
|
-
|
2394
|
-
Rails/InverseOf:
|
2395
|
-
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
2396
|
-
Enabled: true
|
2397
|
-
VersionAdded: '0.52'
|
2398
|
-
Include:
|
2399
|
-
- app/models/**/*.rb
|
2400
|
-
|
2401
|
-
Rails/LexicallyScopedActionFilter:
|
2402
|
-
Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
|
2403
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
|
2404
|
-
Enabled: true
|
2405
|
-
VersionAdded: '0.52'
|
2406
|
-
Include:
|
2407
|
-
- app/controllers/**/*.rb
|
2408
|
-
|
2409
|
-
Rails/LinkToBlank:
|
2410
|
-
Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
|
2411
|
-
Reference: https://mathiasbynens.github.io/rel-noopener/
|
2412
|
-
Enabled: true
|
2413
|
-
VersionAdded: '0.62'
|
2414
|
-
|
2415
|
-
Rails/NotNullColumn:
|
2416
|
-
Description: 'Do not add a NOT NULL column without a default value'
|
2417
|
-
Enabled: true
|
2418
|
-
VersionAdded: '0.43'
|
2419
|
-
Include:
|
2420
|
-
- db/migrate/*.rb
|
2421
|
-
|
2422
|
-
Rails/Output:
|
2423
|
-
Description: 'Checks for calls to puts, print, etc.'
|
2424
|
-
Enabled: true
|
2425
|
-
VersionAdded: '0.15'
|
2426
|
-
VersionChanged: '0.19'
|
2427
|
-
Include:
|
2428
|
-
- app/**/*.rb
|
2429
|
-
- config/**/*.rb
|
2430
|
-
- db/**/*.rb
|
2431
|
-
- lib/**/*.rb
|
2432
|
-
|
2433
|
-
Rails/OutputSafety:
|
2434
|
-
Description: 'The use of `html_safe` or `raw` may be a security risk.'
|
2435
|
-
Enabled: true
|
2436
|
-
VersionAdded: '0.41'
|
2437
|
-
|
2438
|
-
Rails/PluralizationGrammar:
|
2439
|
-
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
|
2440
|
-
Enabled: true
|
2441
|
-
VersionAdded: '0.35'
|
2442
|
-
|
2443
|
-
Rails/Presence:
|
2444
|
-
Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
|
2445
|
-
Enabled: true
|
2446
|
-
VersionAdded: '0.52'
|
2447
|
-
|
2448
|
-
Rails/Present:
|
2449
|
-
Description: 'Enforces use of `present?`.'
|
2450
|
-
Enabled: true
|
2451
|
-
VersionAdded: '0.48'
|
2452
|
-
# Convert usages of `!nil? && !empty?` to `present?`
|
2453
|
-
NotNilAndNotEmpty: true
|
2454
|
-
# Convert usages of `!blank?` to `present?`
|
2455
|
-
NotBlank: true
|
2456
|
-
# Convert usages of `unless blank?` to `if present?`
|
2457
|
-
UnlessBlank: true
|
2458
|
-
|
2459
|
-
Rails/ReadWriteAttribute:
|
2460
|
-
Description: >-
|
2461
|
-
Checks for read_attribute(:attr) and
|
2462
|
-
write_attribute(:attr, val).
|
2463
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
|
2464
|
-
Enabled: true
|
2465
|
-
VersionAdded: '0.20'
|
2466
|
-
VersionChanged: '0.29'
|
2467
|
-
Include:
|
2468
|
-
- app/models/**/*.rb
|
2469
|
-
|
2470
|
-
Rails/RedundantReceiverInWithOptions:
|
2471
|
-
Description: 'Checks for redundant receiver in `with_options`.'
|
2472
|
-
Enabled: true
|
2473
|
-
VersionAdded: '0.52'
|
2474
|
-
|
2475
|
-
Rails/RefuteMethods:
|
2476
|
-
Description: 'Use `assert_not` methods instead of `refute` methods.'
|
2477
|
-
Enabled: true
|
2478
|
-
VersionAdded: '0.56'
|
2479
|
-
Include:
|
2480
|
-
- '**/test/**/*'
|
2481
|
-
|
2482
|
-
Rails/RelativeDateConstant:
|
2483
|
-
Description: 'Do not assign relative date to constants.'
|
2484
|
-
Enabled: true
|
2485
|
-
VersionAdded: '0.48'
|
2486
|
-
VersionChanged: '0.59'
|
2487
|
-
AutoCorrect: false
|
2488
|
-
|
2489
|
-
Rails/RequestReferer:
|
2490
|
-
Description: 'Use consistent syntax for request.referer.'
|
2491
|
-
Enabled: true
|
2492
|
-
VersionAdded: '0.41'
|
2493
|
-
EnforcedStyle: referer
|
2494
|
-
SupportedStyles:
|
2495
|
-
- referer
|
2496
|
-
- referrer
|
2497
|
-
|
2498
|
-
Rails/ReversibleMigration:
|
2499
|
-
Description: 'Checks whether the change method of the migration file is reversible.'
|
2500
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
|
2501
|
-
Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
|
2502
|
-
Enabled: true
|
2503
|
-
VersionAdded: '0.47'
|
2504
|
-
Include:
|
2505
|
-
- db/migrate/*.rb
|
2506
|
-
|
2507
|
-
Rails/SafeNavigation:
|
2508
|
-
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
|
2509
|
-
Enabled: true
|
2510
|
-
VersionAdded: '0.43'
|
2511
|
-
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
2512
|
-
# `try` and `try!` work slightly differently. `try!` and safe navigation will
|
2513
|
-
# both raise a `NoMethodError` if the receiver of the method call does not
|
2514
|
-
# implement the intended method. `try` will not raise an exception for this.
|
2515
|
-
ConvertTry: false
|
2516
|
-
|
2517
|
-
Rails/SaveBang:
|
2518
|
-
Description: 'Identifies possible cases where Active Record save! or related should be used.'
|
2519
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
|
2520
|
-
Enabled: false
|
2521
|
-
VersionAdded: '0.42'
|
2522
|
-
VersionChanged: '0.59'
|
2523
|
-
AllowImplicitReturn: true
|
2524
|
-
AllowedReceivers: []
|
2525
|
-
|
2526
|
-
Rails/ScopeArgs:
|
2527
|
-
Description: 'Checks the arguments of ActiveRecord scopes.'
|
2528
|
-
Enabled: true
|
2529
|
-
VersionAdded: '0.19'
|
2530
|
-
Include:
|
2531
|
-
- app/models/**/*.rb
|
2532
|
-
|
2533
|
-
Rails/SkipsModelValidations:
|
2534
|
-
Description: >-
|
2535
|
-
Use methods that skips model validations with caution.
|
2536
|
-
See reference for more information.
|
2537
|
-
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
2538
|
-
Enabled: true
|
2539
|
-
VersionAdded: '0.47'
|
2540
|
-
VersionChanged: '0.60'
|
2541
|
-
Blacklist:
|
2542
|
-
- decrement!
|
2543
|
-
- decrement_counter
|
2544
|
-
- increment!
|
2545
|
-
- increment_counter
|
2546
|
-
- toggle!
|
2547
|
-
- touch
|
2548
|
-
- update_all
|
2549
|
-
- update_attribute
|
2550
|
-
- update_column
|
2551
|
-
- update_columns
|
2552
|
-
- update_counters
|
2553
|
-
Whitelist: []
|
2554
|
-
|
2555
|
-
Rails/TimeZone:
|
2556
|
-
Description: 'Checks the correct usage of time zone aware methods.'
|
2557
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
|
2558
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
2559
|
-
Enabled: true
|
2560
|
-
VersionAdded: '0.30'
|
2561
|
-
VersionChanged: '0.33'
|
2562
|
-
# The value `strict` means that `Time` should be used with `zone`.
|
2563
|
-
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
2564
|
-
EnforcedStyle: flexible
|
2565
|
-
SupportedStyles:
|
2566
|
-
- strict
|
2567
|
-
- flexible
|
2568
|
-
|
2569
|
-
Rails/UniqBeforePluck:
|
2570
|
-
Description: 'Prefer the use of uniq or distinct before pluck.'
|
2571
|
-
Enabled: true
|
2572
|
-
VersionAdded: '0.40'
|
2573
|
-
VersionChanged: '0.47'
|
2574
|
-
EnforcedStyle: conservative
|
2575
|
-
SupportedStyles:
|
2576
|
-
- conservative
|
2577
|
-
- aggressive
|
2578
|
-
AutoCorrect: false
|
2579
|
-
|
2580
|
-
Rails/UnknownEnv:
|
2581
|
-
Description: 'Use correct environment name.'
|
2582
|
-
Enabled: true
|
2583
|
-
VersionAdded: '0.51'
|
2584
|
-
Environments:
|
2585
|
-
- development
|
2586
|
-
- test
|
2587
|
-
- production
|
2588
|
-
|
2589
|
-
Rails/Validation:
|
2590
|
-
Description: 'Use validates :attribute, hash of validations.'
|
2591
|
-
Enabled: true
|
2592
|
-
VersionAdded: '0.9'
|
2593
|
-
VersionChanged: '0.41'
|
2594
|
-
Include:
|
2595
|
-
- app/models/**/*.rb
|
2596
|
-
|
2597
2080
|
#################### Security ##############################
|
2598
2081
|
|
2599
2082
|
Security/Eval:
|
@@ -2650,7 +2133,7 @@ Style/AccessModifierDeclarations:
|
|
2650
2133
|
|
2651
2134
|
Style/Alias:
|
2652
2135
|
Description: 'Use alias instead of alias_method.'
|
2653
|
-
StyleGuide: '#alias-method'
|
2136
|
+
StyleGuide: '#alias-method-lexically'
|
2654
2137
|
Enabled: true
|
2655
2138
|
VersionAdded: '0.9'
|
2656
2139
|
VersionChanged: '0.36'
|
@@ -2738,8 +2221,9 @@ Style/BlockDelimiters:
|
|
2738
2221
|
- line_count_based
|
2739
2222
|
# The `semantic` style enforces braces around functional blocks, where the
|
2740
2223
|
# primary purpose of the block is to return a value and do..end for
|
2741
|
-
# procedural blocks, where the primary purpose of the block is
|
2742
|
-
# side-effects.
|
2224
|
+
# multi-line procedural blocks, where the primary purpose of the block is
|
2225
|
+
# its side-effects. Single-line procedural blocks may only use do-end,
|
2226
|
+
# unless AllowBracesOnProceduralOneLiners has a truthy value (see below).
|
2743
2227
|
#
|
2744
2228
|
# This looks at the usage of a block's method to determine its type (e.g. is
|
2745
2229
|
# the result of a `map` assigned to a variable or passed to another
|
@@ -2751,6 +2235,8 @@ Style/BlockDelimiters:
|
|
2751
2235
|
# return value is being chained with another method (in which case braces
|
2752
2236
|
# are enforced).
|
2753
2237
|
- braces_for_chaining
|
2238
|
+
# The `always_braces` style always enforces braces.
|
2239
|
+
- always_braces
|
2754
2240
|
ProceduralMethods:
|
2755
2241
|
# Methods that are known to be procedural in nature but look functional from
|
2756
2242
|
# their usage, e.g.
|
@@ -2800,6 +2286,28 @@ Style/BlockDelimiters:
|
|
2800
2286
|
- lambda
|
2801
2287
|
- proc
|
2802
2288
|
- it
|
2289
|
+
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
2290
|
+
# EnforcedStyle is set to `semantic`. If so:
|
2291
|
+
#
|
2292
|
+
# If AllowBracesOnProceduralOneLiners is unspecified, or set to any
|
2293
|
+
# falsey value, then semantic purity is maintained, so one-line
|
2294
|
+
# procedural blocks must use do-end, not braces.
|
2295
|
+
#
|
2296
|
+
# # bad
|
2297
|
+
# collection.each { |element| puts element }
|
2298
|
+
#
|
2299
|
+
# # good
|
2300
|
+
# collection.each do |element| puts element end
|
2301
|
+
#
|
2302
|
+
# If AllowBracesOnProceduralOneLiners is set to any truthy value,
|
2303
|
+
# then one-line procedural blocks may use either style.
|
2304
|
+
#
|
2305
|
+
# # good
|
2306
|
+
# collection.each { |element| puts element }
|
2307
|
+
#
|
2308
|
+
# # also good
|
2309
|
+
# collection.each do |element| puts element end
|
2310
|
+
AllowBracesOnProceduralOneLiners: false
|
2803
2311
|
|
2804
2312
|
Style/BracesAroundHashParameters:
|
2805
2313
|
Description: 'Enforce braces style around hash parameters.'
|
@@ -2976,6 +2484,13 @@ Style/ConditionalAssignment:
|
|
2976
2484
|
SingleLineConditionsOnly: true
|
2977
2485
|
IncludeTernaryExpressions: true
|
2978
2486
|
|
2487
|
+
Style/ConstantVisibility:
|
2488
|
+
Description: >-
|
2489
|
+
Check that class- and module constants have
|
2490
|
+
visibility declarations.
|
2491
|
+
Enabled: false
|
2492
|
+
VersionAdded: '0.66'
|
2493
|
+
|
2979
2494
|
# Checks that you have put a copyright in a comment before any code.
|
2980
2495
|
#
|
2981
2496
|
# You can override the default Notice in your .rubocop.yml file.
|
@@ -3124,7 +2639,7 @@ Style/EvalWithLocation:
|
|
3124
2639
|
VersionAdded: '0.52'
|
3125
2640
|
|
3126
2641
|
Style/EvenOdd:
|
3127
|
-
Description: 'Favor the use of Integer#even
|
2642
|
+
Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
|
3128
2643
|
StyleGuide: '#predicate-methods'
|
3129
2644
|
Enabled: true
|
3130
2645
|
VersionAdded: '0.12'
|
@@ -3135,11 +2650,18 @@ Style/ExpandPathArguments:
|
|
3135
2650
|
Enabled: true
|
3136
2651
|
VersionAdded: '0.53'
|
3137
2652
|
|
3138
|
-
Style/
|
3139
|
-
Description: '
|
3140
|
-
StyleGuide: '#
|
2653
|
+
Style/FloatDivision:
|
2654
|
+
Description: 'For performing float division, coerce one side only.'
|
2655
|
+
StyleGuide: '#float-division'
|
2656
|
+
Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
|
3141
2657
|
Enabled: true
|
3142
|
-
VersionAdded: '0.
|
2658
|
+
VersionAdded: '0.72'
|
2659
|
+
EnforcedStyle: single_coerce
|
2660
|
+
SupportedStyles:
|
2661
|
+
- left_coerce
|
2662
|
+
- right_coerce
|
2663
|
+
- single_coerce
|
2664
|
+
- fdiv
|
3143
2665
|
|
3144
2666
|
Style/For:
|
3145
2667
|
Description: 'Checks use of for or each in multiline loops.'
|
@@ -3181,15 +2703,12 @@ Style/FormatStringToken:
|
|
3181
2703
|
Style/FrozenStringLiteralComment:
|
3182
2704
|
Description: >-
|
3183
2705
|
Add the frozen_string_literal comment to the top of files
|
3184
|
-
to help transition
|
2706
|
+
to help transition to frozen string literals by default.
|
3185
2707
|
Enabled: true
|
3186
2708
|
VersionAdded: '0.36'
|
3187
|
-
VersionChanged: '0.
|
3188
|
-
EnforcedStyle:
|
2709
|
+
VersionChanged: '0.69'
|
2710
|
+
EnforcedStyle: always
|
3189
2711
|
SupportedStyles:
|
3190
|
-
# `when_needed` will add the frozen string literal comment to files
|
3191
|
-
# only when the `TargetRubyVersion` is set to 2.3+.
|
3192
|
-
- when_needed
|
3193
2712
|
# `always` will always add the frozen string literal comment to a file
|
3194
2713
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
3195
2714
|
# string literal. If you run code against multiple versions of Ruby, it is
|
@@ -3209,7 +2728,7 @@ Style/GlobalVars:
|
|
3209
2728
|
AllowedVariables: []
|
3210
2729
|
|
3211
2730
|
Style/GuardClause:
|
3212
|
-
Description: 'Check for conditionals that can be replaced with guard clauses'
|
2731
|
+
Description: 'Check for conditionals that can be replaced with guard clauses.'
|
3213
2732
|
StyleGuide: '#no-nested-conditionals'
|
3214
2733
|
Enabled: true
|
3215
2734
|
VersionAdded: '0.20'
|
@@ -3252,6 +2771,7 @@ Style/IdenticalConditionalBranches:
|
|
3252
2771
|
Style/IfInsideElse:
|
3253
2772
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
3254
2773
|
Enabled: true
|
2774
|
+
AllowIfModifier: false
|
3255
2775
|
VersionAdded: '0.36'
|
3256
2776
|
|
3257
2777
|
Style/IfUnlessModifier:
|
@@ -3359,7 +2879,9 @@ Style/LineEndConcatenation:
|
|
3359
2879
|
Use \ instead of + or << to concatenate two string literals at
|
3360
2880
|
line end.
|
3361
2881
|
Enabled: true
|
2882
|
+
SafeAutoCorrect: false
|
3362
2883
|
VersionAdded: '0.18'
|
2884
|
+
VersionChanged: '0.64'
|
3363
2885
|
|
3364
2886
|
Style/MethodCallWithArgsParentheses:
|
3365
2887
|
Description: 'Use parentheses for method calls with arguments.'
|
@@ -3369,8 +2891,10 @@ Style/MethodCallWithArgsParentheses:
|
|
3369
2891
|
VersionChanged: '0.61'
|
3370
2892
|
IgnoreMacros: true
|
3371
2893
|
IgnoredMethods: []
|
2894
|
+
IncludedMacros: []
|
3372
2895
|
AllowParenthesesInMultilineCall: false
|
3373
2896
|
AllowParenthesesInChaining: false
|
2897
|
+
AllowParenthesesInCamelCaseMethod: false
|
3374
2898
|
EnforcedStyle: require_parentheses
|
3375
2899
|
SupportedStyles:
|
3376
2900
|
- require_parentheses
|
@@ -3413,7 +2937,7 @@ Style/MethodMissingSuper:
|
|
3413
2937
|
Style/MinMax:
|
3414
2938
|
Description: >-
|
3415
2939
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
3416
|
-
and `Enumerable#max` in conjunction.
|
2940
|
+
and `Enumerable#max` in conjunction.
|
3417
2941
|
Enabled: true
|
3418
2942
|
VersionAdded: '0.50'
|
3419
2943
|
|
@@ -3423,7 +2947,7 @@ Style/MissingElse:
|
|
3423
2947
|
If enabled, it is recommended that
|
3424
2948
|
Style/UnlessElse and Style/EmptyElse be enabled.
|
3425
2949
|
This will conflict with Style/EmptyElse if
|
3426
|
-
Style/EmptyElse is configured to style "both"
|
2950
|
+
Style/EmptyElse is configured to style "both".
|
3427
2951
|
Enabled: false
|
3428
2952
|
VersionAdded: '0.30'
|
3429
2953
|
VersionChanged: '0.38'
|
@@ -3467,11 +2991,13 @@ Style/ModuleFunction:
|
|
3467
2991
|
StyleGuide: '#module-function'
|
3468
2992
|
Enabled: true
|
3469
2993
|
VersionAdded: '0.11'
|
3470
|
-
VersionChanged: '0.
|
2994
|
+
VersionChanged: '0.65'
|
3471
2995
|
EnforcedStyle: module_function
|
3472
2996
|
SupportedStyles:
|
3473
2997
|
- module_function
|
3474
2998
|
- extend_self
|
2999
|
+
Autocorrect: false
|
3000
|
+
SafeAutoCorrect: false
|
3475
3001
|
|
3476
3002
|
Style/MultilineBlockChain:
|
3477
3003
|
Description: 'Avoid multi-line chains of blocks.'
|
@@ -3526,6 +3052,17 @@ Style/MutableConstant:
|
|
3526
3052
|
Description: 'Do not assign mutable objects to constants.'
|
3527
3053
|
Enabled: true
|
3528
3054
|
VersionAdded: '0.34'
|
3055
|
+
VersionChanged: '0.65'
|
3056
|
+
EnforcedStyle: literals
|
3057
|
+
SupportedStyles:
|
3058
|
+
# literals: freeze literals assigned to constants
|
3059
|
+
# strict: freeze all constants
|
3060
|
+
# Strict mode is considered an experimental feature. It has not been updated
|
3061
|
+
# with an exhaustive list of all methods that will produce frozen objects so
|
3062
|
+
# there is a decent chance of getting some false positives. Luckily, there is
|
3063
|
+
# no harm in freezing an already frozen object.
|
3064
|
+
- literals
|
3065
|
+
- strict
|
3529
3066
|
|
3530
3067
|
Style/NegatedIf:
|
3531
3068
|
Description: >-
|
@@ -3544,6 +3081,20 @@ Style/NegatedIf:
|
|
3544
3081
|
- prefix
|
3545
3082
|
- postfix
|
3546
3083
|
|
3084
|
+
Style/NegatedUnless:
|
3085
|
+
Description: 'Favor if over unless for negative conditions.'
|
3086
|
+
StyleGuide: '#if-for-negatives'
|
3087
|
+
Enabled: true
|
3088
|
+
VersionAdded: '0.69'
|
3089
|
+
EnforcedStyle: both
|
3090
|
+
SupportedStyles:
|
3091
|
+
# both: prefix and postfix negated `unless` should both use `if`
|
3092
|
+
# prefix: only use `if` for negated `unless` statements positioned before the body of the statement
|
3093
|
+
# postfix: only use `if` for negated `unless` statements positioned after the body of the statement
|
3094
|
+
- both
|
3095
|
+
- prefix
|
3096
|
+
- postfix
|
3097
|
+
|
3547
3098
|
Style/NegatedWhile:
|
3548
3099
|
Description: 'Favor until over while for negative conditions.'
|
3549
3100
|
StyleGuide: '#until-for-negatives'
|
@@ -3708,7 +3259,7 @@ Style/OptionHash:
|
|
3708
3259
|
Style/OptionalArguments:
|
3709
3260
|
Description: >-
|
3710
3261
|
Checks for optional arguments that do not appear at the end
|
3711
|
-
of the argument list
|
3262
|
+
of the argument list.
|
3712
3263
|
StyleGuide: '#optional-arguments'
|
3713
3264
|
Enabled: true
|
3714
3265
|
VersionAdded: '0.33'
|
@@ -3740,7 +3291,7 @@ Style/ParenthesesAroundCondition:
|
|
3740
3291
|
AllowInMultilineConditions: false
|
3741
3292
|
|
3742
3293
|
Style/PercentLiteralDelimiters:
|
3743
|
-
Description: 'Use `%`-literal delimiters consistently'
|
3294
|
+
Description: 'Use `%`-literal delimiters consistently.'
|
3744
3295
|
StyleGuide: '#percent-literal-braces'
|
3745
3296
|
Enabled: true
|
3746
3297
|
VersionAdded: '0.19'
|
@@ -3775,8 +3326,9 @@ Style/PreferredHashMethods:
|
|
3775
3326
|
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
3776
3327
|
StyleGuide: '#hash-key'
|
3777
3328
|
Enabled: true
|
3329
|
+
Safe: false
|
3778
3330
|
VersionAdded: '0.41'
|
3779
|
-
VersionChanged: '0.
|
3331
|
+
VersionChanged: '0.70'
|
3780
3332
|
EnforcedStyle: short
|
3781
3333
|
SupportedStyles:
|
3782
3334
|
- short
|
@@ -3831,6 +3383,7 @@ Style/RedundantFreeze:
|
|
3831
3383
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3832
3384
|
Enabled: true
|
3833
3385
|
VersionAdded: '0.34'
|
3386
|
+
VersionChanged: '0.66'
|
3834
3387
|
|
3835
3388
|
Style/RedundantParentheses:
|
3836
3389
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
@@ -3853,6 +3406,11 @@ Style/RedundantSelf:
|
|
3853
3406
|
VersionAdded: '0.10'
|
3854
3407
|
VersionChanged: '0.13'
|
3855
3408
|
|
3409
|
+
Style/RedundantSortBy:
|
3410
|
+
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
3411
|
+
Enabled: true
|
3412
|
+
VersionAdded: '0.36'
|
3413
|
+
|
3856
3414
|
Style/RegexpLiteral:
|
3857
3415
|
Description: 'Use / or %r around regular expressions.'
|
3858
3416
|
StyleGuide: '#percent-r'
|
@@ -3905,7 +3463,7 @@ Style/SafeNavigation:
|
|
3905
3463
|
safe navigation (`&.`).
|
3906
3464
|
Enabled: true
|
3907
3465
|
VersionAdded: '0.43'
|
3908
|
-
VersionChanged: '0.
|
3466
|
+
VersionChanged: '0.56'
|
3909
3467
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
3910
3468
|
# to whatever it used to return.
|
3911
3469
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -3915,7 +3473,14 @@ Style/SafeNavigation:
|
|
3915
3473
|
- presence
|
3916
3474
|
- try
|
3917
3475
|
- try!
|
3918
|
-
|
3476
|
+
|
3477
|
+
Style/Sample:
|
3478
|
+
Description: >-
|
3479
|
+
Use `sample` instead of `shuffle.first`,
|
3480
|
+
`shuffle.last`, and `shuffle[Integer]`.
|
3481
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
3482
|
+
Enabled: true
|
3483
|
+
VersionAdded: '0.30'
|
3919
3484
|
|
3920
3485
|
Style/SelfAssignment:
|
3921
3486
|
Description: >-
|
@@ -4047,6 +3612,11 @@ Style/StringMethods:
|
|
4047
3612
|
PreferredMethods:
|
4048
3613
|
intern: to_sym
|
4049
3614
|
|
3615
|
+
Style/Strip:
|
3616
|
+
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
3617
|
+
Enabled: true
|
3618
|
+
VersionAdded: '0.36'
|
3619
|
+
|
4050
3620
|
Style/StructInheritance:
|
4051
3621
|
Description: 'Checks for inheritance from Struct.new.'
|
4052
3622
|
StyleGuide: '#no-extend-struct-new'
|
@@ -4073,8 +3643,9 @@ Style/SymbolLiteral:
|
|
4073
3643
|
Style/SymbolProc:
|
4074
3644
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
4075
3645
|
Enabled: true
|
3646
|
+
SafeAutoCorrect: false
|
4076
3647
|
VersionAdded: '0.26'
|
4077
|
-
VersionChanged: '0.
|
3648
|
+
VersionChanged: '0.64'
|
4078
3649
|
# A list of method names to be ignored by the check.
|
4079
3650
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4080
3651
|
IgnoredMethods:
|
@@ -4242,10 +3813,17 @@ Style/UnneededPercentQ:
|
|
4242
3813
|
Enabled: true
|
4243
3814
|
VersionAdded: '0.24'
|
4244
3815
|
|
3816
|
+
Style/UnneededSort:
|
3817
|
+
Description: >-
|
3818
|
+
Use `min` instead of `sort.first`,
|
3819
|
+
`max_by` instead of `sort_by...last`, etc.
|
3820
|
+
Enabled: true
|
3821
|
+
VersionAdded: '0.55'
|
3822
|
+
|
4245
3823
|
Style/UnpackFirst:
|
4246
3824
|
Description: >-
|
4247
3825
|
Checks for accessing the first element of `String#unpack`
|
4248
|
-
instead of using `unpack1
|
3826
|
+
instead of using `unpack1`.
|
4249
3827
|
Enabled: true
|
4250
3828
|
VersionAdded: '0.54'
|
4251
3829
|
|
@@ -4296,20 +3874,24 @@ Style/WordArray:
|
|
4296
3874
|
# whose element count is greater than or equal to `MinSize`.
|
4297
3875
|
MinSize: 2
|
4298
3876
|
# The regular expression `WordRegex` decides what is considered a word.
|
4299
|
-
WordRegex: !ruby/regexp '/\A
|
3877
|
+
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
4300
3878
|
|
4301
3879
|
Style/YodaCondition:
|
4302
|
-
Description: '
|
3880
|
+
Description: 'Forbid or enforce yoda conditions.'
|
4303
3881
|
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
4304
3882
|
Enabled: true
|
4305
|
-
EnforcedStyle:
|
3883
|
+
EnforcedStyle: forbid_for_all_comparison_operators
|
4306
3884
|
SupportedStyles:
|
4307
3885
|
# check all comparison operators
|
4308
|
-
-
|
3886
|
+
- forbid_for_all_comparison_operators
|
4309
3887
|
# check only equality operators: `!=` and `==`
|
4310
|
-
-
|
3888
|
+
- forbid_for_equality_operators_only
|
3889
|
+
# enforce yoda for all comparison operators
|
3890
|
+
- require_for_all_comparison_operators
|
3891
|
+
# enforce yoda only for equality operators: `!=` and `==`
|
3892
|
+
- require_for_equality_operators_only
|
4311
3893
|
VersionAdded: '0.49'
|
4312
|
-
VersionChanged: '0.
|
3894
|
+
VersionChanged: '0.63'
|
4313
3895
|
|
4314
3896
|
Style/ZeroLengthPredicate:
|
4315
3897
|
Description: 'Use #empty? when testing for objects of length 0.'
|