makandra-rubocop 9.1.0 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/config/default.yml CHANGED
@@ -157,6 +157,8 @@ AllCops:
157
157
  rubocop-sequel: [sequel]
158
158
  rubocop-rake: [rake]
159
159
  rubocop-graphql: [graphql]
160
+ # Enable/Disable checking the methods extended by Active Support.
161
+ ActiveSupportExtensionsEnabled: false
160
162
 
161
163
  #################### Bundler ###############################
162
164
 
@@ -239,10 +241,22 @@ Bundler/OrderedGems:
239
241
 
240
242
  #################### Gemspec ###############################
241
243
 
242
- Gemspec/DateAssignment:
243
- Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
244
+ Gemspec/DependencyVersion:
245
+ Description: 'Requires or forbids specifying gem dependency versions.'
246
+ Enabled: false
247
+ VersionAdded: '1.29'
248
+ EnforcedStyle: 'required'
249
+ SupportedStyles:
250
+ - 'required'
251
+ - 'forbidden'
252
+ Include:
253
+ - '**/*.gemspec'
254
+ AllowedGems: []
255
+
256
+ Gemspec/DeprecatedAttributeAssignment:
257
+ Description: Checks that deprecated attribute assignments are not set in a gemspec file.
244
258
  Enabled: true
245
- VersionAdded: '1.10'
259
+ VersionAdded: '1.30'
246
260
  Include:
247
261
  - '**/*.gemspec'
248
262
 
@@ -266,8 +280,8 @@ Gemspec/OrderedDependencies:
266
280
  - '**/*.gemspec'
267
281
 
268
282
  Gemspec/RequireMFA:
269
- Description: 'Checks that the gemspec has metadata to require MFA from RubyGems.'
270
- Enabled: pending
283
+ Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
284
+ Enabled: true
271
285
  VersionAdded: '1.23'
272
286
  Reference:
273
287
  - https://guides.rubygems.org/mfa-requirement-opt-in/
@@ -301,8 +315,8 @@ Layout/AccessModifierIndentation:
301
315
  SupportedStyles:
302
316
  - outdent
303
317
  - indent
304
- # By default, the indentation width from Layout/IndentationWidth is used
305
- # But it can be overridden by setting this parameter
318
+ # By default the indentation width from `Layout/IndentationWidth` is used,
319
+ # but it can be overridden by setting this parameter.
306
320
  IndentationWidth: ~
307
321
 
308
322
  Layout/ArgumentAlignment:
@@ -330,8 +344,8 @@ Layout/ArgumentAlignment:
330
344
  SupportedStyles:
331
345
  - with_first_argument
332
346
  - with_fixed_indentation
333
- # By default, the indentation width from Layout/IndentationWidth is used
334
- # But it can be overridden by setting this parameter
347
+ # By default the indentation width from `Layout/IndentationWidth` is used,
348
+ # but it can be overridden by setting this parameter.
335
349
  IndentationWidth: ~
336
350
 
337
351
  Layout/ArrayAlignment:
@@ -359,8 +373,8 @@ Layout/ArrayAlignment:
359
373
  SupportedStyles:
360
374
  - with_first_element
361
375
  - with_fixed_indentation
362
- # By default, the indentation width from Layout/IndentationWidth is used
363
- # But it can be overridden by setting this parameter
376
+ # By default the indentation width from `Layout/IndentationWidth` is used,
377
+ # but it can be overridden by setting this parameter.
364
378
  IndentationWidth: ~
365
379
 
366
380
  Layout/AssignmentIndentation:
@@ -370,8 +384,8 @@ Layout/AssignmentIndentation:
370
384
  Enabled: false # We do not want to write the assignment in the following line
371
385
  VersionAdded: '0.49'
372
386
  VersionChanged: '0.77'
373
- # By default, the indentation width from `Layout/IndentationWidth` is used
374
- # But it can be overridden by setting this parameter
387
+ # By default the indentation width from `Layout/IndentationWidth` is used,
388
+ # but it can be overridden by setting this parameter.
375
389
  IndentationWidth: ~
376
390
 
377
391
  Layout/BeginEndAlignment:
@@ -418,9 +432,9 @@ Layout/CaseIndentation:
418
432
  - case
419
433
  - end
420
434
  IndentOneStep: false
421
- # By default, the indentation width from `Layout/IndentationWidth` is used.
422
- # But it can be overridden by setting this parameter.
423
- # This only matters if `IndentOneStep` is `true`
435
+ # By default the indentation width from `Layout/IndentationWidth` is used,
436
+ # but it can be overridden by setting this parameter.
437
+ # This only matters if `IndentOneStep` is `true`.
424
438
  IndentationWidth: ~
425
439
 
426
440
  Layout/ClassStructure:
@@ -701,8 +715,8 @@ Layout/FirstArgumentIndentation:
701
715
  # Same as `special_for_inner_method_call` except that the special rule only
702
716
  # applies if the outer method call encloses its arguments in parentheses.
703
717
  - special_for_inner_method_call_in_parentheses
704
- # By default, the indentation width from `Layout/IndentationWidth` is used
705
- # But it can be overridden by setting this parameter
718
+ # By default the indentation width from `Layout/IndentationWidth` is used,
719
+ # but it can be overridden by setting this parameter.
706
720
  IndentationWidth: ~
707
721
 
708
722
  Layout/FirstArrayElementIndentation:
@@ -728,8 +742,8 @@ Layout/FirstArrayElementIndentation:
728
742
  - special_inside_parentheses
729
743
  - consistent
730
744
  - align_brackets
731
- # By default, the indentation width from `Layout/IndentationWidth` is used
732
- # But it can be overridden by setting this parameter
745
+ # By default the indentation width from `Layout/IndentationWidth` is used,
746
+ # but it can be overridden by setting this parameter.
733
747
  IndentationWidth: ~
734
748
 
735
749
  Layout/FirstArrayElementLineBreak:
@@ -760,8 +774,8 @@ Layout/FirstHashElementIndentation:
760
774
  - special_inside_parentheses
761
775
  - consistent
762
776
  - align_braces
763
- # By default, the indentation width from `Layout/IndentationWidth` is used
764
- # But it can be overridden by setting this parameter
777
+ # By default the indentation width from `Layout/IndentationWidth` is used,
778
+ # but it can be overridden by setting this parameter.
765
779
  IndentationWidth: ~
766
780
 
767
781
  Layout/FirstHashElementLineBreak:
@@ -796,8 +810,8 @@ Layout/FirstParameterIndentation:
796
810
  SupportedStyles:
797
811
  - consistent
798
812
  - align_parentheses
799
- # By default, the indentation width from `Layout/IndentationWidth` is used
800
- # But it can be overridden by setting this parameter
813
+ # By default the indentation width from `Layout/IndentationWidth` is used,
814
+ # but it can be overridden by setting this parameter.
801
815
  IndentationWidth: ~
802
816
 
803
817
  Layout/HashAlignment:
@@ -887,7 +901,7 @@ Layout/HeredocArgumentClosingParenthesis:
887
901
  VersionAdded: '0.68'
888
902
 
889
903
  Layout/HeredocIndentation:
890
- Description: 'This cop checks the indentation of the here document bodies.'
904
+ Description: 'Checks the indentation of the here document bodies.'
891
905
  StyleGuide: '#squiggly-heredocs'
892
906
  Enabled: true
893
907
  VersionAdded: '0.49'
@@ -920,7 +934,7 @@ Layout/IndentationStyle:
920
934
  VersionChanged: '0.82'
921
935
  # By default the indentation width from `Layout/IndentationWidth` is used,
922
936
  # but it can be overridden by setting this parameter.
923
- # It is used during auto-correction to determine how many spaces should
937
+ # It is used during autocorrection to determine how many spaces should
924
938
  # replace each tab.
925
939
  IndentationWidth: ~
926
940
  EnforcedStyle: spaces
@@ -935,7 +949,6 @@ Layout/IndentationWidth:
935
949
  VersionAdded: '0.49'
936
950
  # Number of spaces for each indentation level.
937
951
  Width: 2
938
- IgnoredPatterns: []
939
952
 
940
953
  Layout/InitialIndentation:
941
954
  Description: >-
@@ -958,6 +971,31 @@ Layout/LeadingEmptyLines:
958
971
  VersionAdded: '0.57'
959
972
  VersionChanged: '0.77'
960
973
 
974
+ Layout/LineContinuationLeadingSpace:
975
+ Description: >-
976
+ Use trailing spaces instead of leading spaces in strings
977
+ broken over multiple lines (by a backslash).
978
+ Enabled: false
979
+ AutoCorrect: false
980
+ SafeAutoCorrect: false
981
+ VersionAdded: '1.31'
982
+ VersionChanged: '1.32'
983
+ EnforcedStyle: trailing
984
+ SupportedStyles:
985
+ - leading
986
+ - trailing
987
+
988
+ Layout/LineContinuationSpacing:
989
+ Description: 'Checks the spacing in front of backslash in line continuations.'
990
+ Enabled: true
991
+ AutoCorrect: true
992
+ SafeAutoCorrect: true
993
+ VersionAdded: '1.31'
994
+ EnforcedStyle: space
995
+ SupportedStyles:
996
+ - space
997
+ - no_space
998
+
961
999
  Layout/LineEndStringConcatenationIndentation:
962
1000
  Description: >-
963
1001
  Checks the indentation of the next line after a line that
@@ -989,10 +1027,10 @@ Layout/LineLength:
989
1027
  # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
990
1028
  # directives like '# rubocop: enable ...' when calculating a line's length.
991
1029
  IgnoreCopDirectives: true
992
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1030
+ # The AllowedPatterns option is a list of !ruby/regexp and/or string
993
1031
  # elements. Strings will be converted to Regexp objects. A line that matches
994
1032
  # any regular expression listed in this option will be ignored by LineLength.
995
- IgnoredPatterns: []
1033
+ AllowedPatterns: []
996
1034
 
997
1035
  Layout/MultilineArrayBraceLayout:
998
1036
  Description: >-
@@ -1121,6 +1159,13 @@ Layout/MultilineMethodDefinitionBraceLayout:
1121
1159
  - new_line
1122
1160
  - same_line
1123
1161
 
1162
+ Layout/MultilineMethodParameterLineBreaks:
1163
+ Description: >-
1164
+ Checks that each parameter in a multi-line method definition
1165
+ starts on a separate line.
1166
+ Enabled: false
1167
+ VersionAdded: '1.32'
1168
+
1124
1169
  Layout/MultilineOperationIndentation:
1125
1170
  Description: >-
1126
1171
  Checks indentation of binary operations that span more than
@@ -1458,7 +1503,7 @@ Lint/AmbiguousBlockAssociation:
1458
1503
  Enabled: false
1459
1504
  VersionAdded: '0.48'
1460
1505
  VersionChanged: '1.13'
1461
- IgnoredMethods: []
1506
+ AllowedMethods: []
1462
1507
 
1463
1508
  Lint/AmbiguousOperator:
1464
1509
  Description: >-
@@ -1471,14 +1516,14 @@ Lint/AmbiguousOperator:
1471
1516
 
1472
1517
  Lint/AmbiguousOperatorPrecedence:
1473
1518
  Description: >-
1474
- Checks for expressions containing multiple binary operations with
1475
- ambiguous precedence.
1476
- Enabled: pending
1519
+ Checks for expressions containing multiple binary operations with
1520
+ ambiguous precedence.
1521
+ Enabled: false
1477
1522
  VersionAdded: '1.21'
1478
1523
 
1479
1524
  Lint/AmbiguousRange:
1480
1525
  Description: Checks for ranges with ambiguous boundaries.
1481
- Enabled: pending
1526
+ Enabled: true # precedence of range is not always clear
1482
1527
  VersionAdded: '1.19'
1483
1528
  SafeAutoCorrect: false
1484
1529
  RequireParenthesesForMethodChains: false
@@ -1504,7 +1549,7 @@ Lint/BigDecimalNew:
1504
1549
  VersionAdded: '0.53'
1505
1550
 
1506
1551
  Lint/BinaryOperatorWithIdenticalOperands:
1507
- Description: 'This cop checks for places where binary operator has identical operands.'
1552
+ Description: 'Checks for places where binary operator has identical operands.'
1508
1553
  Enabled: true
1509
1554
  Safe: false
1510
1555
  VersionAdded: '0.89'
@@ -1536,6 +1581,11 @@ Lint/ConstantDefinitionInBlock:
1536
1581
  Exclude:
1537
1582
  - 'spec/**/*'
1538
1583
 
1584
+ Lint/ConstantOverwrittenInRescue:
1585
+ Description: 'Checks for overwriting an exception with an exception result by use `rescue =>`.'
1586
+ Enabled: true
1587
+ VersionAdded: '1.31'
1588
+
1539
1589
  Lint/ConstantResolution:
1540
1590
  Description: 'Check that constants are fully qualified with `::`.'
1541
1591
  Enabled: false
@@ -1667,7 +1717,9 @@ Lint/DuplicateRegexpCharacterClassElement:
1667
1717
  Lint/DuplicateRequire:
1668
1718
  Description: 'Check for duplicate `require`s and `require_relative`s.'
1669
1719
  Enabled: true
1720
+ SafeAutoCorrect: false
1670
1721
  VersionAdded: '0.90'
1722
+ VersionChanged: '1.28'
1671
1723
 
1672
1724
  Lint/DuplicateRescueException:
1673
1725
  Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
@@ -1686,10 +1738,10 @@ Lint/ElseLayout:
1686
1738
  VersionChanged: '1.2'
1687
1739
 
1688
1740
  Lint/EmptyBlock:
1689
- Description: 'This cop checks for blocks without a body.'
1741
+ Description: 'Checks for blocks without a body.'
1690
1742
  Enabled: true
1691
1743
  VersionAdded: '1.1'
1692
- VersionChanged: '1.3'
1744
+ VersionChanged: '1.15'
1693
1745
  AllowComments: true
1694
1746
  AllowEmptyLambdas: true
1695
1747
 
@@ -1700,10 +1752,12 @@ Lint/EmptyClass:
1700
1752
  AllowComments: false
1701
1753
 
1702
1754
  Lint/EmptyConditionalBody:
1703
- Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1755
+ Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1704
1756
  Enabled: true
1757
+ SafeAutoCorrect: false
1705
1758
  AllowComments: true
1706
1759
  VersionAdded: '0.89'
1760
+ VersionChanged: '1.34'
1707
1761
 
1708
1762
  Lint/EmptyEnsure:
1709
1763
  Description: 'Checks for empty ensure block.'
@@ -1822,12 +1876,14 @@ Lint/IneffectiveAccessModifier:
1822
1876
  Lint/InheritException:
1823
1877
  Description: 'Avoid inheriting from the `Exception` class.'
1824
1878
  Enabled: true
1879
+ SafeAutoCorrect: false
1825
1880
  VersionAdded: '0.41'
1881
+ VersionChanged: '1.26'
1826
1882
  # The default base class in favour of `Exception`.
1827
1883
  EnforcedStyle: runtime_error
1828
1884
  SupportedStyles:
1829
- - runtime_error
1830
1885
  - standard_error
1886
+ - runtime_error
1831
1887
 
1832
1888
  Lint/InterpolationCheck:
1833
1889
  Description: 'Raise warning for interpolation in single q strs.'
@@ -1877,8 +1933,8 @@ Lint/MissingCopEnableDirective:
1877
1933
 
1878
1934
  Lint/MissingSuper:
1879
1935
  Description: >-
1880
- This cop checks for the presence of constructors and lifecycle callbacks
1881
- without calls to `super`'.
1936
+ Checks for the presence of constructors and lifecycle callbacks
1937
+ without calls to `super`.
1882
1938
  Enabled: true
1883
1939
  VersionAdded: '0.89'
1884
1940
  VersionChanged: '1.4'
@@ -1906,7 +1962,7 @@ Lint/NestedPercentLiteral:
1906
1962
  VersionAdded: '0.52'
1907
1963
 
1908
1964
  Lint/NextWithoutAccumulator:
1909
- Description: >-
1965
+ Description: >-
1910
1966
  Do not omit the accumulator when calling `next`
1911
1967
  in a `reduce`/`inject` block.
1912
1968
  Enabled: true
@@ -1917,6 +1973,13 @@ Lint/NoReturnInBeginEndBlocks:
1917
1973
  Enabled: true
1918
1974
  VersionAdded: '1.2'
1919
1975
 
1976
+ Lint/NonAtomicFileOperation:
1977
+ Description: Checks for non-atomic file operations.
1978
+ StyleGuide: '#atomic-file-operations'
1979
+ Enabled: true
1980
+ VersionAdded: '1.31'
1981
+ SafeAutoCorrect: false
1982
+
1920
1983
  Lint/NonDeterministicRequireOrder:
1921
1984
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1922
1985
  Enabled: true
@@ -1934,7 +1997,7 @@ Lint/NumberConversion:
1934
1997
  VersionAdded: '0.53'
1935
1998
  VersionChanged: '1.1'
1936
1999
  SafeAutoCorrect: false
1937
- IgnoredMethods: []
2000
+ AllowedMethods: []
1938
2001
  IgnoredClasses:
1939
2002
  - Time
1940
2003
  - DateTime
@@ -2017,6 +2080,8 @@ Lint/RedundantDirGlobSort:
2017
2080
  Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
2018
2081
  Enabled: true
2019
2082
  VersionAdded: '1.8'
2083
+ VersionChanged: '1.26'
2084
+ SafeAutoCorrect: false
2020
2085
 
2021
2086
  Lint/RedundantRequireStatement:
2022
2087
  Description: 'Checks for unnecessary `require` statement.'
@@ -2060,6 +2125,12 @@ Lint/RedundantWithObject:
2060
2125
  Enabled: true
2061
2126
  VersionAdded: '0.51'
2062
2127
 
2128
+ Lint/RefinementImportMethods:
2129
+ Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
2130
+ Enabled: false # requires ruby 3.1
2131
+ SafeAutoCorrect: false
2132
+ VersionAdded: '1.27'
2133
+
2063
2134
  Lint/RegexpAsCondition:
2064
2135
  Description: >-
2065
2136
  Do not use regexp literal as a condition.
@@ -2075,9 +2146,14 @@ Lint/RequireParentheses:
2075
2146
  Enabled: true
2076
2147
  VersionAdded: '0.18'
2077
2148
 
2149
+ Lint/RequireRangeParentheses:
2150
+ Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
2151
+ Enabled: true
2152
+ VersionAdded: '1.32'
2153
+
2078
2154
  Lint/RequireRelativeSelfPath:
2079
2155
  Description: 'Checks for uses a file requiring itself with `require_relative`.'
2080
- Enabled: pending
2156
+ Enabled: true
2081
2157
  VersionAdded: '1.22'
2082
2158
 
2083
2159
  Lint/RescueException:
@@ -2198,7 +2274,7 @@ Lint/Syntax:
2198
2274
  VersionAdded: '0.9'
2199
2275
 
2200
2276
  Lint/ToEnumArguments:
2201
- Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2277
+ Description: 'Ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2202
2278
  Enabled: true
2203
2279
  VersionAdded: '1.1'
2204
2280
 
@@ -2208,12 +2284,12 @@ Lint/ToJSON:
2208
2284
  VersionAdded: '0.66'
2209
2285
 
2210
2286
  Lint/TopLevelReturnWithArgument:
2211
- Description: 'This cop detects top level return statements with argument.'
2287
+ Description: 'Detects top level return statements with argument.'
2212
2288
  Enabled: true
2213
2289
  VersionAdded: '0.89'
2214
2290
 
2215
2291
  Lint/TrailingCommaInAttributeDeclaration:
2216
- Description: 'This cop checks for trailing commas in attribute declarations.'
2292
+ Description: 'Checks for trailing commas in attribute declarations.'
2217
2293
  Enabled: true
2218
2294
  VersionAdded: '0.90'
2219
2295
 
@@ -2262,11 +2338,11 @@ Lint/UnreachableCode:
2262
2338
  VersionAdded: '0.9'
2263
2339
 
2264
2340
  Lint/UnreachableLoop:
2265
- Description: 'This cop checks for loops that will have at most one iteration.'
2341
+ Description: 'Checks for loops that will have at most one iteration.'
2266
2342
  Enabled: true
2267
2343
  VersionAdded: '0.89'
2268
2344
  VersionChanged: '1.7'
2269
- IgnoredPatterns:
2345
+ AllowedPatterns:
2270
2346
  # RSpec uses `times` in its message expectations
2271
2347
  # eg. `exactly(2).times`
2272
2348
  - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
@@ -2324,17 +2400,18 @@ Lint/UselessElseWithoutRescue:
2324
2400
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2325
2401
  Enabled: true
2326
2402
  VersionAdded: '0.17'
2403
+ VersionChanged: '1.31'
2327
2404
 
2328
2405
  Lint/UselessMethodDefinition:
2329
2406
  Description: 'Checks for useless method definitions.'
2330
2407
  Enabled: true
2331
2408
  VersionAdded: '0.90'
2409
+ VersionChanged: '0.91'
2332
2410
  Safe: false
2333
- AllowComments: true
2334
2411
 
2335
2412
  Lint/UselessRuby2Keywords:
2336
2413
  Description: 'Finds unnecessary uses of `ruby2_keywords`.'
2337
- Enabled: pending
2414
+ Enabled: true
2338
2415
  VersionAdded: '1.23'
2339
2416
 
2340
2417
  Lint/UselessSetterCall:
@@ -2371,7 +2448,8 @@ Metrics/AbcSize:
2371
2448
  VersionChanged: '1.5'
2372
2449
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2373
2450
  # a Float.
2374
- IgnoredMethods: []
2451
+ AllowedMethods: []
2452
+ AllowedPatterns: []
2375
2453
  CountRepeatedAttributes: true
2376
2454
  Max: 17
2377
2455
 
@@ -2383,10 +2461,11 @@ Metrics/BlockLength:
2383
2461
  CountComments: false # count full line comments?
2384
2462
  Max: 25
2385
2463
  CountAsOne: []
2386
- IgnoredMethods:
2464
+ AllowedMethods:
2387
2465
  # By default, exclude the `#refine` method, as it tends to have larger
2388
2466
  # associated blocks.
2389
2467
  - refine
2468
+ AllowedPatterns: []
2390
2469
  Exclude:
2391
2470
  - '**/*.gemspec'
2392
2471
 
@@ -2416,7 +2495,8 @@ Metrics/CyclomaticComplexity:
2416
2495
  Enabled: false
2417
2496
  VersionAdded: '0.25'
2418
2497
  VersionChanged: '0.81'
2419
- IgnoredMethods: []
2498
+ AllowedMethods: []
2499
+ AllowedPatterns: []
2420
2500
  Max: 7
2421
2501
 
2422
2502
  Metrics/MethodLength:
@@ -2428,7 +2508,8 @@ Metrics/MethodLength:
2428
2508
  CountComments: false # count full line comments?
2429
2509
  Max: 10
2430
2510
  CountAsOne: []
2431
- IgnoredMethods: []
2511
+ AllowedMethods: []
2512
+ AllowedPatterns: []
2432
2513
 
2433
2514
  Metrics/ModuleLength:
2434
2515
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2456,7 +2537,8 @@ Metrics/PerceivedComplexity:
2456
2537
  Enabled: false
2457
2538
  VersionAdded: '0.25'
2458
2539
  VersionChanged: '0.81'
2459
- IgnoredMethods: []
2540
+ AllowedMethods: []
2541
+ AllowedPatterns: []
2460
2542
  Max: 8
2461
2543
 
2462
2544
  ################## Migration #############################
@@ -2680,11 +2762,11 @@ Naming/MethodName:
2680
2762
  - camelCase
2681
2763
  # Method names matching patterns are always allowed.
2682
2764
  #
2683
- # IgnoredPatterns:
2765
+ # AllowedPatterns:
2684
2766
  # - '\A\s*onSelectionBulkChange\s*'
2685
2767
  # - '\A\s*onSelectionCleared\s*'
2686
2768
  #
2687
- IgnoredPatterns: []
2769
+ AllowedPatterns: []
2688
2770
 
2689
2771
  Naming/MethodParameterName:
2690
2772
  Description: >-
@@ -2760,6 +2842,7 @@ Naming/VariableName:
2760
2842
  - snake_case
2761
2843
  - camelCase
2762
2844
  AllowedIdentifiers: []
2845
+ AllowedPatterns: []
2763
2846
 
2764
2847
  Naming/VariableNumber:
2765
2848
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2787,9 +2870,15 @@ Naming/VariableNumber:
2787
2870
  - h3 # content_tag :h3
2788
2871
  - h4 # content_tag :h4
2789
2872
  - h5 # content_tag :h5
2873
+ AllowedPatterns: []
2790
2874
 
2791
2875
  #################### Security ##############################
2792
2876
 
2877
+ Security/CompoundHash:
2878
+ Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
2879
+ Enabled: true
2880
+ VersionAdded: '1.28'
2881
+
2793
2882
  Security/Eval:
2794
2883
  Description: 'The use of eval represents a serious security risk.'
2795
2884
  Enabled: false # We all know not to eval. If we need to, there will be a reason.
@@ -2797,8 +2886,8 @@ Security/Eval:
2797
2886
 
2798
2887
  Security/IoMethods:
2799
2888
  Description: >-
2800
- Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
2801
- `IO.foreach`, and `IO.readlines`.
2889
+ Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
2890
+ `IO.foreach`, and `IO.readlines`.
2802
2891
  Enabled: pending
2803
2892
  Safe: false
2804
2893
  VersionAdded: '1.22'
@@ -2851,6 +2940,7 @@ Style/AccessModifierDeclarations:
2851
2940
  - inline
2852
2941
  - group
2853
2942
  AllowModifiersOnSymbols: true
2943
+ SafeAutoCorrect: false
2854
2944
 
2855
2945
  Style/AccessorGrouping:
2856
2946
  Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
@@ -2985,7 +3075,7 @@ Style/BlockDelimiters:
2985
3075
  # This looks at the usage of a block's method to determine its type (e.g. is
2986
3076
  # the result of a `map` assigned to a variable or passed to another
2987
3077
  # method) but exceptions are permitted in the `ProceduralMethods`,
2988
- # `FunctionalMethods` and `IgnoredMethods` sections below.
3078
+ # `FunctionalMethods` and `AllowedMethods` sections below.
2989
3079
  - semantic
2990
3080
  # The `braces_for_chaining` style enforces braces around single line blocks
2991
3081
  # and do..end around multi-line blocks, except for multi-line blocks whose
@@ -3026,7 +3116,7 @@ Style/BlockDelimiters:
3026
3116
  - let!
3027
3117
  - subject
3028
3118
  - watch
3029
- IgnoredMethods:
3119
+ AllowedMethods:
3030
3120
  # Methods that can be either procedural or functional and cannot be
3031
3121
  # categorised from their usage alone, e.g.
3032
3122
  #
@@ -3043,6 +3133,7 @@ Style/BlockDelimiters:
3043
3133
  - lambda
3044
3134
  - proc
3045
3135
  - it
3136
+ AllowedPatterns: []
3046
3137
  # The AllowBracesOnProceduralOneLiners option is ignored unless the
3047
3138
  # EnforcedStyle is set to `semantic`. If so:
3048
3139
  #
@@ -3087,9 +3178,18 @@ Style/CaseEquality:
3087
3178
  # # good
3088
3179
  # String === "string"
3089
3180
  AllowOnConstant: false
3181
+ # If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
3182
+ # the case equality operator is `self.class`.
3183
+ #
3184
+ # # bad
3185
+ # some_class === object
3186
+ #
3187
+ # # good
3188
+ # self.class === object
3189
+ AllowOnSelfClass: false
3090
3190
 
3091
3191
  Style/CaseLikeIf:
3092
- Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
3192
+ Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
3093
3193
  StyleGuide: '#case-vs-if-else'
3094
3194
  Enabled: true
3095
3195
  Safe: false
@@ -3146,10 +3246,11 @@ Style/ClassEqualityComparison:
3146
3246
  StyleGuide: '#instance-of-vs-class-comparison'
3147
3247
  Enabled: true
3148
3248
  VersionAdded: '0.93'
3149
- IgnoredMethods:
3249
+ AllowedMethods:
3150
3250
  - ==
3151
3251
  - equal?
3152
3252
  - eql?
3253
+ AllowedPatterns: []
3153
3254
 
3154
3255
  Style/ClassMethods:
3155
3256
  Description: 'Use self when defining module/class methods.'
@@ -3163,7 +3264,7 @@ Style/ClassMethodsDefinitions:
3163
3264
  StyleGuide: '#def-self-class-methods'
3164
3265
  Enabled: false
3165
3266
  VersionAdded: '0.89'
3166
- EnforcedStyle: def_self
3267
+ EnforcedStyle: def_self
3167
3268
  SupportedStyles:
3168
3269
  - def_self
3169
3270
  - self_class
@@ -3436,6 +3537,12 @@ Style/EmptyElse:
3436
3537
  - empty
3437
3538
  - nil
3438
3539
  - both
3540
+ AllowComments: false
3541
+
3542
+ Style/EmptyHeredoc:
3543
+ Description: 'Checks for using empty heredoc to reduce redundancy.'
3544
+ Enabled: true
3545
+ VersionAdded: '1.32'
3439
3546
 
3440
3547
  Style/EmptyLambdaParameter:
3441
3548
  Description: 'Omit parens for empty lambda parameters.'
@@ -3484,6 +3591,12 @@ Style/EndlessMethod:
3484
3591
  - allow_always
3485
3592
  - disallow
3486
3593
 
3594
+ Style/EnvHome:
3595
+ Description: "Checks for consistent usage of `ENV['HOME']`."
3596
+ Enabled: true
3597
+ Safe: false
3598
+ VersionAdded: '1.29'
3599
+
3487
3600
  Style/EvalWithLocation:
3488
3601
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3489
3602
  Enabled: true
@@ -3521,16 +3634,26 @@ Style/ExponentialNotation:
3521
3634
  - engineering
3522
3635
  - integral
3523
3636
 
3637
+ Style/FetchEnvVar:
3638
+ Description: >-
3639
+ Suggests `ENV.fetch` for the replacement of `ENV[]`.
3640
+ Reference:
3641
+ - https://rubystyle.guide/#hash-fetch-defaults
3642
+ Enabled: false # We often check for ENV variables in conditions. We don't want to raise errors in those places or use the much longer ENV.fetch('FOO', nil)
3643
+ VersionAdded: '1.28'
3644
+ # Environment variables to be excluded from the inspection.
3645
+ AllowedVars: []
3646
+
3524
3647
  Style/FileRead:
3525
3648
  Description: 'Favor `File.(bin)read` convenience methods.'
3526
3649
  StyleGuide: '#file-read'
3527
- Enabled: pending
3650
+ Enabled: true
3528
3651
  VersionAdded: '1.24'
3529
3652
 
3530
3653
  Style/FileWrite:
3531
3654
  Description: 'Favor `File.(bin)write` convenience methods.'
3532
3655
  StyleGuide: '#file-write'
3533
- Enabled: pending
3656
+ Enabled: true
3534
3657
  VersionAdded: '1.24'
3535
3658
 
3536
3659
  Style/FloatDivision:
@@ -3552,8 +3675,9 @@ Style/For:
3552
3675
  Description: 'Checks use of for or each in multiline loops.'
3553
3676
  StyleGuide: '#no-for-loops'
3554
3677
  Enabled: true
3678
+ SafeAutoCorrect: false
3555
3679
  VersionAdded: '0.13'
3556
- VersionChanged: '0.59'
3680
+ VersionChanged: '1.26'
3557
3681
  EnforcedStyle: each
3558
3682
  SupportedStyles:
3559
3683
  - each
@@ -3588,7 +3712,8 @@ Style/FormatStringToken:
3588
3712
  MaxUnannotatedPlaceholdersAllowed: 1
3589
3713
  VersionAdded: '0.49'
3590
3714
  VersionChanged: '1.0'
3591
- IgnoredMethods: []
3715
+ AllowedMethods: []
3716
+ AllowedPatterns: []
3592
3717
 
3593
3718
  Style/FrozenStringLiteralComment:
3594
3719
  Description: >-
@@ -3633,10 +3758,11 @@ Style/GuardClause:
3633
3758
  StyleGuide: '#no-nested-conditionals'
3634
3759
  Enabled: false
3635
3760
  VersionAdded: '0.20'
3636
- VersionChanged: '0.22'
3761
+ VersionChanged: '1.31'
3637
3762
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3638
3763
  # needs to have to trigger this cop
3639
3764
  MinBodyLength: 1
3765
+ AllowConsecutiveConditionals: false
3640
3766
 
3641
3767
  Style/HashAsLastArrayItem:
3642
3768
  Description: >-
@@ -3673,6 +3799,7 @@ Style/HashExcept:
3673
3799
  that can be replaced with `Hash#except` method.
3674
3800
  Enabled: true
3675
3801
  VersionAdded: '1.7'
3802
+ VersionChanged: '1.31'
3676
3803
 
3677
3804
  Style/HashLikeCase:
3678
3805
  Description: >-
@@ -3711,6 +3838,8 @@ Style/HashSyntax:
3711
3838
  - never
3712
3839
  # accepts both shorthand and explicit use of hash literal value.
3713
3840
  - either
3841
+ # like "always", but will avoid mixing styles in a single hash
3842
+ - consistent
3714
3843
  # Force hashes that have a symbol value to use hash rockets
3715
3844
  UseHashRocketsWithSymbolValues: false
3716
3845
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3887,9 +4016,34 @@ Style/LineEndConcatenation:
3887
4016
  VersionAdded: '0.18'
3888
4017
  VersionChanged: '0.64'
3889
4018
 
4019
+ Style/MagicCommentFormat:
4020
+ Description: 'Use a consistent style for magic comments.'
4021
+ Enabled: true
4022
+ VersionAdded: '1.35'
4023
+ EnforcedStyle: snake_case
4024
+ SupportedStyles:
4025
+ # `snake` will enforce the magic comment is written
4026
+ # in snake case (words separated by underscores).
4027
+ # Eg: froze_string_literal: true
4028
+ - snake_case
4029
+ # `kebab` will enforce the magic comment is written
4030
+ # in kebab case (words separated by hyphens).
4031
+ # Eg: froze-string-literal: true
4032
+ - kebab_case
4033
+ DirectiveCapitalization: lowercase
4034
+ ValueCapitalization: ~
4035
+ SupportedCapitalizations:
4036
+ - lowercase
4037
+ - uppercase
4038
+
4039
+ Style/MapCompactWithConditionalBlock:
4040
+ Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
4041
+ Enabled: true
4042
+ VersionAdded: '1.30'
4043
+
3890
4044
  Style/MapToHash:
3891
4045
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
3892
- Enabled: pending
4046
+ Enabled: false # Requires at least Ruby 2.6, but we officially still support Ruby 2.5 (https://makandracards.com/makandra/493762-technologie-radar-entwicklung#section-deprecated).
3893
4047
  VersionAdded: '1.24'
3894
4048
  Safe: false
3895
4049
 
@@ -3900,8 +4054,8 @@ Style/MethodCallWithArgsParentheses:
3900
4054
  VersionAdded: '0.47'
3901
4055
  VersionChanged: '1.7'
3902
4056
  IgnoreMacros: true
3903
- IgnoredMethods: []
3904
- IgnoredPatterns: []
4057
+ AllowedMethods: []
4058
+ AllowedPatterns: []
3905
4059
  IncludedMacros: []
3906
4060
  AllowParenthesesInMultilineCall: false
3907
4061
  AllowParenthesesInChaining: false
@@ -3916,7 +4070,8 @@ Style/MethodCallWithoutArgsParentheses:
3916
4070
  Description: 'Do not use parentheses for method calls with no arguments.'
3917
4071
  StyleGuide: '#method-invocation-parens'
3918
4072
  Enabled: true
3919
- IgnoredMethods: []
4073
+ AllowedMethods: []
4074
+ AllowedPatterns: []
3920
4075
  VersionAdded: '0.47'
3921
4076
  VersionChanged: '0.55'
3922
4077
 
@@ -4109,7 +4264,7 @@ Style/NegatedIf:
4109
4264
 
4110
4265
  Style/NegatedIfElseCondition:
4111
4266
  Description: >-
4112
- This cop checks for uses of `if-else` and ternary operators with a negated condition
4267
+ Checks for uses of `if-else` and ternary operators with a negated condition
4113
4268
  which can be simplified by inverting condition and swapping branches.
4114
4269
  Enabled: false
4115
4270
  VersionAdded: '1.2'
@@ -4134,6 +4289,11 @@ Style/NegatedWhile:
4134
4289
  Enabled: true
4135
4290
  VersionAdded: '0.20'
4136
4291
 
4292
+ Style/NestedFileDirname:
4293
+ Description: 'Checks for nested `File.dirname`.'
4294
+ Enabled: false # requires Ruby 3.1
4295
+ VersionAdded: '1.26'
4296
+
4137
4297
  Style/NestedModifier:
4138
4298
  Description: 'Avoid using nested modifiers.'
4139
4299
  StyleGuide: '#no-nested-modifiers'
@@ -4265,6 +4425,7 @@ Style/NumericLiterals:
4265
4425
  Strict: false
4266
4426
  # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4267
4427
  AllowedNumbers: []
4428
+ AllowedPatterns: []
4268
4429
 
4269
4430
  Style/NumericPredicate:
4270
4431
  Description: >-
@@ -4283,12 +4444,26 @@ Style/NumericPredicate:
4283
4444
  SupportedStyles:
4284
4445
  - predicate
4285
4446
  - comparison
4286
- IgnoredMethods: []
4447
+ AllowedMethods: []
4448
+ AllowedPatterns: []
4287
4449
  # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
4288
4450
  # false positives.
4289
4451
  Exclude:
4290
4452
  - 'spec/**/*'
4291
4453
 
4454
+ Style/ObjectThen:
4455
+ Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
4456
+ StyleGuide: '#object-yield-self-vs-object-then'
4457
+ Enabled: false
4458
+ VersionAdded: '1.28'
4459
+ # Use `Object#yield_self` or `Object#then`?
4460
+ # Prefer `Object#yield_self` to `Object#then` (yield_self)
4461
+ # Prefer `Object#then` to `Object#yield_self` (then)
4462
+ EnforcedStyle: 'then'
4463
+ SupportedStyles:
4464
+ - then
4465
+ - yield_self
4466
+
4292
4467
  Style/OneLineConditional:
4293
4468
  Description: >-
4294
4469
  Favor the ternary operator (?:) or multi-line constructs over
@@ -4301,8 +4476,8 @@ Style/OneLineConditional:
4301
4476
 
4302
4477
  Style/OpenStructUse:
4303
4478
  Description: >-
4304
- Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4305
- version compatibility, and potential security issues.
4479
+ Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4480
+ version compatibility, and potential security issues.
4306
4481
  Reference:
4307
4482
  - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4308
4483
 
@@ -4526,10 +4701,20 @@ Style/RedundantFreeze:
4526
4701
  VersionAdded: '0.34'
4527
4702
  VersionChanged: '0.66'
4528
4703
 
4704
+ Style/RedundantInitialize:
4705
+ Description: 'Checks for redundant `initialize` methods.'
4706
+ Enabled: true
4707
+ Safe: false
4708
+ AllowComments: true
4709
+ VersionAdded: '1.27'
4710
+ VersionChanged: '1.28'
4711
+
4529
4712
  Style/RedundantInterpolation:
4530
4713
  Description: 'Checks for strings that are just an interpolated expression.'
4531
4714
  Enabled: true
4715
+ SafeAutoCorrect: false
4532
4716
  VersionAdded: '0.76'
4717
+ VersionChanged: '1.30'
4533
4718
 
4534
4719
  Style/RedundantParentheses:
4535
4720
  Description: "Checks for parentheses that seem not to serve any purpose."
@@ -4576,7 +4761,7 @@ Style/RedundantSelfAssignment:
4576
4761
 
4577
4762
  Style/RedundantSelfAssignmentBranch:
4578
4763
  Description: 'Checks for places where conditional branch makes redundant self-assignment.'
4579
- Enabled: pending
4764
+ Enabled: true
4580
4765
  VersionAdded: '1.19'
4581
4766
 
4582
4767
  Style/RedundantSort:
@@ -4640,14 +4825,14 @@ Style/ReturnNil:
4640
4825
 
4641
4826
  Style/SafeNavigation:
4642
4827
  Description: >-
4643
- This cop transforms usages of a method call safeguarded by
4828
+ Transforms usages of a method call safeguarded by
4644
4829
  a check for the existence of the object to
4645
4830
  safe navigation (`&.`).
4646
- Auto-correction is unsafe as it assumes the object will
4831
+ Autocorrection is unsafe as it assumes the object will
4647
4832
  be `nil` or truthy, but never `false`.
4648
4833
  Enabled: true
4649
4834
  VersionAdded: '0.43'
4650
- VersionChanged: '0.77'
4835
+ VersionChanged: '1.27'
4651
4836
  # Safe navigation may cause a statement to start returning `nil` in addition
4652
4837
  # to whatever it used to return.
4653
4838
  ConvertCodeThatCanStartToReturnNil: false
@@ -4658,6 +4843,8 @@ Style/SafeNavigation:
4658
4843
  - try
4659
4844
  - try!
4660
4845
  SafeAutoCorrect: false
4846
+ # Maximum length of method chains for register an offense.
4847
+ MaxChainLength: 2
4661
4848
 
4662
4849
  Style/Sample:
4663
4850
  Description: >-
@@ -4669,7 +4856,7 @@ Style/Sample:
4669
4856
 
4670
4857
  Style/SelectByRegexp:
4671
4858
  Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
4672
- Enabled: pending
4859
+ Enabled: false # Can accidentally break your code, as it only works for arrays, but the cop cannot tell for sure if its an array or a hash calling `select`\`reject`
4673
4860
  SafeAutoCorrect: false
4674
4861
  VersionAdded: '1.22'
4675
4862
 
@@ -4763,6 +4950,7 @@ Style/SpecialGlobalVars:
4763
4950
  SupportedStyles:
4764
4951
  - use_perl_names
4765
4952
  - use_english_names
4953
+ - use_builtin_english_names
4766
4954
 
4767
4955
  Style/StabbyLambdaParentheses:
4768
4956
  Description: 'Check for the usage of parentheses around stabby lambda arguments.'
@@ -4864,7 +5052,7 @@ Style/StructInheritance:
4864
5052
  VersionChanged: '1.20'
4865
5053
 
4866
5054
  Style/SwapValues:
4867
- Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
5055
+ Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
4868
5056
  StyleGuide: '#values-swapping'
4869
5057
  Enabled: true
4870
5058
  VersionAdded: '1.1'
@@ -4892,13 +5080,15 @@ Style/SymbolProc:
4892
5080
  Enabled: false # We can't enforce this because of "Can't create Binding from C level Proc" errors, and because it messes up arity checks.
4893
5081
  Safe: false
4894
5082
  VersionAdded: '0.26'
4895
- VersionChanged: '1.5'
5083
+ VersionChanged: '1.28'
4896
5084
  AllowMethodsWithArguments: false
4897
- # A list of method names to be ignored by the check.
5085
+ # A list of method names to be always allowed by the check.
4898
5086
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4899
- IgnoredMethods:
5087
+ AllowedMethods:
4900
5088
  - respond_to
4901
5089
  - define_method
5090
+ AllowedPatterns: []
5091
+ AllowComments: false
4902
5092
 
4903
5093
  Style/TernaryParentheses:
4904
5094
  Description: 'Checks for use of parentheses around ternary conditions.'
@@ -4913,7 +5103,7 @@ Style/TernaryParentheses:
4913
5103
  AllowSafeAssignment: true
4914
5104
 
4915
5105
  Style/TopLevelMethodDefinition:
4916
- Description: 'This cop looks for top-level method definitions.'
5106
+ Description: 'Looks for top-level method definitions.'
4917
5107
  StyleGuide: '#top-level-methods'
4918
5108
  Enabled: false
4919
5109
  VersionAdded: '1.15'