makandra-rubocop 11.2.0 → 12.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/config/default.yml CHANGED
@@ -30,6 +30,7 @@ AllCops:
30
30
  - '**/*.rbx'
31
31
  - '**/*.ru'
32
32
  - '**/*.ruby'
33
+ - '**/*.schema'
33
34
  - '**/*.spec'
34
35
  - '**/*.thor'
35
36
  - '**/*.watchr'
@@ -55,6 +56,7 @@ AllCops:
55
56
  - '**/Puppetfile'
56
57
  - '**/Rakefile'
57
58
  - '**/rakefile'
59
+ - '**/Schemafile'
58
60
  - '**/Snapfile'
59
61
  - '**/Steepfile'
60
62
  - '**/Thorfile'
@@ -144,7 +146,7 @@ AllCops:
144
146
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
145
147
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
146
148
  # Ruby version is still unresolved, RuboCop will use the oldest officially
147
- # supported Ruby version (currently Ruby 2.5).
149
+ # supported Ruby version (currently Ruby 2.7).
148
150
  TargetRubyVersion: ~
149
151
  # Determines if a notification for extension libraries should be shown when
150
152
  # rubocop is run. Keys are the name of the extension, and values are an array
@@ -157,6 +159,8 @@ AllCops:
157
159
  rubocop-sequel: [sequel]
158
160
  rubocop-rake: [rake]
159
161
  rubocop-graphql: [graphql]
162
+ rubocop-capybara: [capybara]
163
+ rubocop-factory_bot: [factory_bot, factory_bot_rails]
160
164
  # Enable/Disable checking the methods extended by Active Support.
161
165
  ActiveSupportExtensionsEnabled: false
162
166
 
@@ -165,7 +169,19 @@ AllCops:
165
169
  Bundler/DuplicatedGem:
166
170
  Description: 'Checks for duplicate gem entries in Gemfile.'
167
171
  Enabled: true
172
+ Severity: warning
168
173
  VersionAdded: '0.46'
174
+ VersionChanged: '1.40'
175
+ Include:
176
+ - '**/*.gemfile'
177
+ - '**/Gemfile'
178
+ - '**/gems.rb'
179
+
180
+ Bundler/DuplicatedGroup:
181
+ Description: 'Checks for duplicate group entries in Gemfile.'
182
+ Enabled: true
183
+ Severity: warning
184
+ VersionAdded: '1.56'
169
185
  Include:
170
186
  - '**/*.gemfile'
171
187
  - '**/Gemfile'
@@ -217,7 +233,9 @@ Bundler/InsecureProtocolSource:
217
233
  because HTTP requests are insecure. Please change your source to
218
234
  'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
219
235
  Enabled: true
236
+ Severity: warning
220
237
  VersionAdded: '0.50'
238
+ VersionChanged: '1.40'
221
239
  AllowHttpProtocol: true
222
240
  Include:
223
241
  - '**/*.gemfile'
@@ -256,14 +274,33 @@ Gemspec/DependencyVersion:
256
274
  Gemspec/DeprecatedAttributeAssignment:
257
275
  Description: Checks that deprecated attribute assignments are not set in a gemspec file.
258
276
  Enabled: true
277
+ Severity: warning
259
278
  VersionAdded: '1.30'
279
+ VersionChanged: '1.40'
280
+ Include:
281
+ - '**/*.gemspec'
282
+
283
+ Gemspec/DevelopmentDependencies:
284
+ Description: Checks that development dependencies are specified in Gemfile rather than gemspec.
285
+ Enabled: pending
286
+ VersionAdded: '1.44'
287
+ EnforcedStyle: Gemfile
288
+ SupportedStyles:
289
+ - Gemfile
290
+ - gems.rb
291
+ - gemspec
292
+ AllowedGems: []
260
293
  Include:
261
294
  - '**/*.gemspec'
295
+ - '**/Gemfile'
296
+ - '**/gems.rb'
262
297
 
263
298
  Gemspec/DuplicatedAssignment:
264
299
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
265
300
  Enabled: true
301
+ Severity: warning
266
302
  VersionAdded: '0.52'
303
+ VersionChanged: '1.40'
267
304
  Include:
268
305
  - '**/*.gemspec'
269
306
 
@@ -282,7 +319,9 @@ Gemspec/OrderedDependencies:
282
319
  Gemspec/RequireMFA:
283
320
  Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
284
321
  Enabled: true
322
+ Severity: warning
285
323
  VersionAdded: '1.23'
324
+ VersionChanged: '1.40'
286
325
  Reference:
287
326
  - https://guides.rubygems.org/mfa-requirement-opt-in/
288
327
  Include:
@@ -291,8 +330,9 @@ Gemspec/RequireMFA:
291
330
  Gemspec/RequiredRubyVersion:
292
331
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
293
332
  Enabled: true
333
+ Severity: warning
294
334
  VersionAdded: '0.52'
295
- VersionChanged: '1.22'
335
+ VersionChanged: '1.40'
296
336
  Include:
297
337
  - '**/*.gemspec'
298
338
 
@@ -300,7 +340,9 @@ Gemspec/RubyVersionGlobalsUsage:
300
340
  Description: Checks usage of RUBY_VERSION in gemspec.
301
341
  StyleGuide: '#no-ruby-version-in-the-gemspec'
302
342
  Enabled: false
343
+ Severity: warning
303
344
  VersionAdded: '0.72'
345
+ VersionChanged: '1.40'
304
346
  Include:
305
347
  - '**/*.gemspec'
306
348
 
@@ -383,7 +425,7 @@ Layout/AssignmentIndentation:
383
425
  right-hand-side of a multi-line assignment.
384
426
  Enabled: false # We do not want to write the assignment in the following line
385
427
  VersionAdded: '0.49'
386
- VersionChanged: '0.77'
428
+ VersionChanged: '1.45'
387
429
  # By default the indentation width from `Layout/IndentationWidth` is used,
388
430
  # but it can be overridden by setting this parameter.
389
431
  IndentationWidth: ~
@@ -441,7 +483,9 @@ Layout/ClassStructure:
441
483
  Description: 'Enforces a configured order of definitions within a class body.'
442
484
  StyleGuide: '#consistent-classes'
443
485
  Enabled: false
486
+ SafeAutoCorrect: false
444
487
  VersionAdded: '0.52'
488
+ VersionChanged: '1.53'
445
489
  Categories:
446
490
  module_inclusion:
447
491
  - include
@@ -549,6 +593,8 @@ Layout/EmptyLineBetweenDefs:
549
593
  EmptyLineBetweenMethodDefs: true
550
594
  EmptyLineBetweenClassDefs: true
551
595
  EmptyLineBetweenModuleDefs: true
596
+ # `DefLikeMacros` takes the name of any macro that you want to treat like a def.
597
+ DefLikeMacros: []
552
598
  # `AllowAdjacentOneLineDefs` means that single line method definitions don't
553
599
  # need an empty line between them. `true` by default.
554
600
  AllowAdjacentOneLineDefs: true
@@ -752,6 +798,7 @@ Layout/FirstArrayElementLineBreak:
752
798
  multi-line array.
753
799
  Enabled: false
754
800
  VersionAdded: '0.49'
801
+ AllowMultilineFinalElement: false
755
802
 
756
803
  Layout/FirstHashElementIndentation:
757
804
  Description: 'Checks the indentation of the first key in a hash literal.'
@@ -784,6 +831,7 @@ Layout/FirstHashElementLineBreak:
784
831
  multi-line hash.
785
832
  Enabled: false
786
833
  VersionAdded: '0.49'
834
+ AllowMultilineFinalElement: false
787
835
 
788
836
  Layout/FirstMethodArgumentLineBreak:
789
837
  Description: >-
@@ -791,6 +839,7 @@ Layout/FirstMethodArgumentLineBreak:
791
839
  multi-line method call.
792
840
  Enabled: false
793
841
  VersionAdded: '0.49'
842
+ AllowMultilineFinalElement: false
794
843
 
795
844
  Layout/FirstMethodParameterLineBreak:
796
845
  Description: >-
@@ -798,6 +847,7 @@ Layout/FirstMethodParameterLineBreak:
798
847
  multi-line method parameter definition.
799
848
  Enabled: false
800
849
  VersionAdded: '0.49'
850
+ AllowMultilineFinalElement: false
801
851
 
802
852
  Layout/FirstParameterIndentation:
803
853
  Description: >-
@@ -949,6 +999,7 @@ Layout/IndentationWidth:
949
999
  VersionAdded: '0.49'
950
1000
  # Number of spaces for each indentation level.
951
1001
  Width: 2
1002
+ AllowedPatterns: []
952
1003
 
953
1004
  Layout/InitialIndentation:
954
1005
  Description: >-
@@ -973,13 +1024,11 @@ Layout/LeadingEmptyLines:
973
1024
 
974
1025
  Layout/LineContinuationLeadingSpace:
975
1026
  Description: >-
976
- Use trailing spaces instead of leading spaces in strings
977
- broken over multiple lines (by a backslash).
1027
+ Use trailing spaces instead of leading spaces in strings
1028
+ broken over multiple lines (by a backslash).
978
1029
  Enabled: false
979
- AutoCorrect: false
980
- SafeAutoCorrect: false
981
1030
  VersionAdded: '1.31'
982
- VersionChanged: '1.32'
1031
+ VersionChanged: '1.45'
983
1032
  EnforcedStyle: trailing
984
1033
  SupportedStyles:
985
1034
  - leading
@@ -988,8 +1037,6 @@ Layout/LineContinuationLeadingSpace:
988
1037
  Layout/LineContinuationSpacing:
989
1038
  Description: 'Checks the spacing in front of backslash in line continuations.'
990
1039
  Enabled: true
991
- AutoCorrect: true
992
- SafeAutoCorrect: true
993
1040
  VersionAdded: '1.31'
994
1041
  EnforcedStyle: space
995
1042
  SupportedStyles:
@@ -1054,6 +1101,7 @@ Layout/MultilineArrayLineBreaks:
1054
1101
  starts on a separate line.
1055
1102
  Enabled: false # As discussed in https://github.com/makandra/makandra-rubocop/issues/10
1056
1103
  VersionAdded: '0.67'
1104
+ AllowMultilineFinalElement: false
1057
1105
 
1058
1106
  Layout/MultilineAssignmentLayout:
1059
1107
  Description: 'Check for a newline after the assignment operator in multi-line assignments.'
@@ -1104,6 +1152,7 @@ Layout/MultilineHashKeyLineBreaks:
1104
1152
  starts on a separate line.
1105
1153
  Enabled: false
1106
1154
  VersionAdded: '0.67'
1155
+ AllowMultilineFinalElement: false
1107
1156
 
1108
1157
  Layout/MultilineMethodArgumentLineBreaks:
1109
1158
  Description: >-
@@ -1111,6 +1160,7 @@ Layout/MultilineMethodArgumentLineBreaks:
1111
1160
  starts on a separate line.
1112
1161
  Enabled: false
1113
1162
  VersionAdded: '0.67'
1163
+ AllowMultilineFinalElement: false
1114
1164
 
1115
1165
  Layout/MultilineMethodCallBraceLayout:
1116
1166
  Description: >-
@@ -1165,6 +1215,7 @@ Layout/MultilineMethodParameterLineBreaks:
1165
1215
  starts on a separate line.
1166
1216
  Enabled: false
1167
1217
  VersionAdded: '1.32'
1218
+ AllowMultilineFinalElement: false
1168
1219
 
1169
1220
  Layout/MultilineOperationIndentation:
1170
1221
  Description: >-
@@ -1304,6 +1355,10 @@ Layout/SpaceAroundOperators:
1304
1355
  SupportedStylesForExponentOperator:
1305
1356
  - space
1306
1357
  - no_space
1358
+ EnforcedStyleForRationalLiterals: no_space
1359
+ SupportedStylesForRationalLiterals:
1360
+ - space
1361
+ - no_space
1307
1362
 
1308
1363
  Layout/SpaceBeforeBlockBraces:
1309
1364
  Description: >-
@@ -1497,13 +1552,13 @@ Lint/AmbiguousAssignment:
1497
1552
 
1498
1553
  Lint/AmbiguousBlockAssociation:
1499
1554
  Description: >-
1500
- Checks for ambiguous block association with method when param passed without
1501
- parentheses.
1502
- StyleGuide: '#syntax'
1555
+ Checks for ambiguous block association with method when param passed without
1556
+ parentheses.
1503
1557
  Enabled: false
1504
1558
  VersionAdded: '0.48'
1505
1559
  VersionChanged: '1.13'
1506
1560
  AllowedMethods: []
1561
+ AllowedPatterns: []
1507
1562
 
1508
1563
  Lint/AmbiguousOperator:
1509
1564
  Description: >-
@@ -1540,7 +1595,9 @@ Lint/AssignmentInCondition:
1540
1595
  Description: "Don't use assignment in conditions."
1541
1596
  StyleGuide: '#safe-assignment-in-condition'
1542
1597
  Enabled: true
1598
+ SafeAutoCorrect: false
1543
1599
  VersionAdded: '0.9'
1600
+ VersionChanged: '1.45'
1544
1601
  AllowSafeAssignment: true
1545
1602
 
1546
1603
  Lint/BigDecimalNew:
@@ -1599,7 +1656,7 @@ Lint/Debugger:
1599
1656
  Description: 'Check for debugger calls.'
1600
1657
  Enabled: true # Voted for this in https://github.com/makandra/makandra-rubocop/issues/42
1601
1658
  VersionAdded: '0.14'
1602
- VersionChanged: '1.10'
1659
+ VersionChanged: '1.46'
1603
1660
  DebuggerMethods:
1604
1661
  # Groups are available so that a specific group can be disabled in
1605
1662
  # a user's configuration, but are otherwise not significant.
@@ -1623,6 +1680,7 @@ Lint/Debugger:
1623
1680
  - binding.remote_pry
1624
1681
  - binding.pry_remote
1625
1682
  - Pry.rescue
1683
+ - pry
1626
1684
  Rails:
1627
1685
  - debugger
1628
1686
  - Kernel.debugger
@@ -1640,7 +1698,7 @@ Lint/DeprecatedConstants:
1640
1698
  Description: 'Checks for deprecated constants.'
1641
1699
  Enabled: true
1642
1700
  VersionAdded: '1.8'
1643
- VersionChanged: '1.22'
1701
+ VersionChanged: '1.40'
1644
1702
  # You can configure deprecated constants.
1645
1703
  # If there is an alternative method, you can set alternative value as `Alternative`.
1646
1704
  # And you can set the deprecated version as `DeprecatedVersion`.
@@ -1667,6 +1725,12 @@ Lint/DeprecatedConstants:
1667
1725
  'Random::DEFAULT':
1668
1726
  Alternative: 'Random.new'
1669
1727
  DeprecatedVersion: '3.0'
1728
+ 'Struct::Group':
1729
+ Alternative: 'Etc::Group'
1730
+ DeprecatedVersion: '3.0'
1731
+ 'Struct::Passwd':
1732
+ Alternative: 'Etc::Passwd'
1733
+ DeprecatedVersion: '3.0'
1670
1734
 
1671
1735
  Lint/DeprecatedOpenSSLConstant:
1672
1736
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
@@ -1704,6 +1768,16 @@ Lint/DuplicateHashKey:
1704
1768
  VersionAdded: '0.34'
1705
1769
  VersionChanged: '0.77'
1706
1770
 
1771
+ Lint/DuplicateMagicComment:
1772
+ Description: 'Check for duplicated magic comments.'
1773
+ Enabled: pending
1774
+ VersionAdded: '1.37'
1775
+
1776
+ Lint/DuplicateMatchPattern:
1777
+ Description: 'Do not repeat patterns in `in` keywords.'
1778
+ Enabled: pending
1779
+ VersionAdded: '1.50'
1780
+
1707
1781
  Lint/DuplicateMethods:
1708
1782
  Description: 'Check for duplicate method definitions.'
1709
1783
  Enabled: true
@@ -1886,11 +1960,17 @@ Lint/InheritException:
1886
1960
  - runtime_error
1887
1961
 
1888
1962
  Lint/InterpolationCheck:
1889
- Description: 'Raise warning for interpolation in single q strs.'
1963
+ Description: 'Checks for interpolation in a single quoted string.'
1890
1964
  Enabled: true
1891
- Safe: false
1965
+ SafeAutoCorrect: false
1892
1966
  VersionAdded: '0.50'
1893
- VersionChanged: '0.87'
1967
+ VersionChanged: '1.40'
1968
+
1969
+ Lint/ItWithoutArgumentsInBlock:
1970
+ Description: 'Checks uses of `it` calls without arguments in block.'
1971
+ Reference: 'https://bugs.ruby-lang.org/issues/18980'
1972
+ Enabled: pending
1973
+ VersionAdded: '1.59'
1894
1974
 
1895
1975
  Lint/LambdaWithoutLiteralBlock:
1896
1976
  Description: 'Checks uses of lambda without a literal block.'
@@ -1902,6 +1982,11 @@ Lint/LiteralAsCondition:
1902
1982
  Enabled: true
1903
1983
  VersionAdded: '0.51'
1904
1984
 
1985
+ Lint/LiteralAssignmentInCondition:
1986
+ Description: 'Checks for literal assignments in the conditions.'
1987
+ Enabled: pending
1988
+ VersionAdded: '1.58'
1989
+
1905
1990
  Lint/LiteralInInterpolation:
1906
1991
  Description: 'Checks for literals used in interpolation.'
1907
1992
  Enabled: true
@@ -1936,9 +2021,16 @@ Lint/MissingSuper:
1936
2021
  Checks for the presence of constructors and lifecycle callbacks
1937
2022
  without calls to `super`.
1938
2023
  Enabled: true
2024
+ AllowedParentClasses: []
1939
2025
  VersionAdded: '0.89'
1940
2026
  VersionChanged: '1.4'
1941
2027
 
2028
+ Lint/MixedCaseRange:
2029
+ Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
2030
+ Enabled: pending
2031
+ SafeAutoCorrect: false
2032
+ VersionAdded: '1.53'
2033
+
1942
2034
  Lint/MixedRegexpCaptureTypes:
1943
2035
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1944
2036
  Enabled: true
@@ -1954,6 +2046,8 @@ Lint/NestedMethodDefinition:
1954
2046
  Description: 'Do not use nested method definitions.'
1955
2047
  StyleGuide: '#no-nested-methods'
1956
2048
  Enabled: true
2049
+ AllowedMethods: []
2050
+ AllowedPatterns: []
1957
2051
  VersionAdded: '0.32'
1958
2052
 
1959
2053
  Lint/NestedPercentLiteral:
@@ -1998,6 +2092,7 @@ Lint/NumberConversion:
1998
2092
  VersionChanged: '1.1'
1999
2093
  SafeAutoCorrect: false
2000
2094
  AllowedMethods: []
2095
+ AllowedPatterns: []
2001
2096
  IgnoredClasses:
2002
2097
  - Time
2003
2098
  - DateTime
@@ -2016,7 +2111,9 @@ Lint/OrAssignmentToConstant:
2016
2111
  Lint/OrderedMagicComments:
2017
2112
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
2018
2113
  Enabled: true
2114
+ SafeAutoCorrect: false
2019
2115
  VersionAdded: '0.53'
2116
+ VersionChanged: '1.37'
2020
2117
 
2021
2118
  Lint/OutOfRangeRegexpRef:
2022
2119
  Description: 'Checks for out of range reference for Regexp because it always returns nil.'
@@ -2083,10 +2180,17 @@ Lint/RedundantDirGlobSort:
2083
2180
  VersionChanged: '1.26'
2084
2181
  SafeAutoCorrect: false
2085
2182
 
2183
+ Lint/RedundantRegexpQuantifiers:
2184
+ Description: 'Checks for redundant quantifiers in Regexps.'
2185
+ Enabled: pending
2186
+ VersionAdded: '1.53'
2187
+
2086
2188
  Lint/RedundantRequireStatement:
2087
2189
  Description: 'Checks for unnecessary `require` statement.'
2088
2190
  Enabled: true
2191
+ SafeAutoCorrect: false
2089
2192
  VersionAdded: '0.76'
2193
+ VersionChanged: '1.57'
2090
2194
 
2091
2195
  Lint/RedundantSafeNavigation:
2092
2196
  Description: 'Checks for redundant safe navigation calls.'
@@ -2287,6 +2391,9 @@ Lint/TopLevelReturnWithArgument:
2287
2391
  Description: 'Detects top level return statements with argument.'
2288
2392
  Enabled: true
2289
2393
  VersionAdded: '0.89'
2394
+ # These codes are `eval`-ed in method and their return values may be used.
2395
+ Exclude:
2396
+ - '**/*.jb'
2290
2397
 
2291
2398
  Lint/TrailingCommaInAttributeDeclaration:
2292
2399
  Description: 'Checks for trailing commas in attribute declarations.'
@@ -2395,6 +2502,8 @@ Lint/UselessAssignment:
2395
2502
  StyleGuide: '#underscore-unused-vars'
2396
2503
  Enabled: false # There are cases where it is easier to read if the the same body is used for different branches
2397
2504
  VersionAdded: '0.11'
2505
+ VersionChanged: '1.51'
2506
+ SafeAutoCorrect: false
2398
2507
 
2399
2508
  Lint/UselessElseWithoutRescue:
2400
2509
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
@@ -2409,6 +2518,11 @@ Lint/UselessMethodDefinition:
2409
2518
  VersionChanged: '0.91'
2410
2519
  Safe: false
2411
2520
 
2521
+ Lint/UselessRescue:
2522
+ Description: 'Checks for useless `rescue`s.'
2523
+ Enabled: pending
2524
+ VersionAdded: '1.43'
2525
+
2412
2526
  Lint/UselessRuby2Keywords:
2413
2527
  Description: 'Finds unnecessary uses of `ruby2_keywords`.'
2414
2528
  Enabled: true
@@ -2417,10 +2531,9 @@ Lint/UselessRuby2Keywords:
2417
2531
  Lint/UselessSetterCall:
2418
2532
  Description: 'Checks for useless setter call to a local variable.'
2419
2533
  Enabled: true
2420
- SafeAutoCorrect: false
2534
+ Safe: false
2421
2535
  VersionAdded: '0.13'
2422
2536
  VersionChanged: '1.2'
2423
- Safe: false
2424
2537
 
2425
2538
  Lint/UselessTimes:
2426
2539
  Description: 'Checks for useless `Integer#times` calls.'
@@ -2487,6 +2600,12 @@ Metrics/ClassLength:
2487
2600
  Max: 100
2488
2601
  CountAsOne: []
2489
2602
 
2603
+ Metrics/CollectionLiteralLength:
2604
+ Description: 'Checks for `Array` or `Hash` literals with many entries.'
2605
+ Enabled: false
2606
+ VersionAdded: '1.47'
2607
+ LengthThreshold: 250
2608
+
2490
2609
  # Avoid complex methods.
2491
2610
  Metrics/CyclomaticComplexity:
2492
2611
  Description: >-
@@ -2709,13 +2828,13 @@ Naming/HeredocDelimiterNaming:
2709
2828
  Enabled: true
2710
2829
  VersionAdded: '0.50'
2711
2830
  ForbiddenDelimiters:
2712
- - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2831
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/i'
2713
2832
 
2714
2833
  Naming/InclusiveLanguage:
2715
2834
  Description: 'Recommend the use of inclusive language instead of problematic terms.'
2716
2835
  Enabled: true
2717
2836
  VersionAdded: '1.18'
2718
- VersionChanged: '1.21'
2837
+ VersionChanged: '1.49'
2719
2838
  CheckIdentifiers: true
2720
2839
  CheckConstants: true
2721
2840
  CheckVariables: true
@@ -2782,8 +2901,10 @@ Naming/MethodParameterName:
2782
2901
  AllowedNames:
2783
2902
  - at
2784
2903
  - by
2904
+ - cc
2785
2905
  - db
2786
2906
  - id
2907
+ - if
2787
2908
  - in
2788
2909
  - io
2789
2910
  - ip
@@ -2870,6 +2991,7 @@ Naming/VariableNumber:
2870
2991
  - h3 # content_tag :h3
2871
2992
  - h4 # content_tag :h4
2872
2993
  - h5 # content_tag :h5
2994
+ - x86_64 # Allowed by default as an underscore separated CPU architecture name
2873
2995
  AllowedPatterns: []
2874
2996
 
2875
2997
  #################### Security ##############################
@@ -2877,7 +2999,9 @@ Naming/VariableNumber:
2877
2999
  Security/CompoundHash:
2878
3000
  Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
2879
3001
  Enabled: true
3002
+ Safe: false
2880
3003
  VersionAdded: '1.28'
3004
+ VersionChanged: '1.51'
2881
3005
 
2882
3006
  Security/Eval:
2883
3007
  Description: 'The use of eval represents a serious security risk.'
@@ -2982,8 +3106,21 @@ Style/ArgumentsForwarding:
2982
3106
  Description: 'Use arguments forwarding.'
2983
3107
  StyleGuide: '#arguments-forwarding'
2984
3108
  Enabled: true
2985
- AllowOnlyRestArgument: true
3109
+ # AllowOnlyRestArgument: true # Option has been commented out since it produced warnings when running Rubocop on Ruby 3.3 applications. Not specifying it avoids warnings, and seems to be fine.
3110
+ UseAnonymousForwarding: false # Enforcing anonymous * or ** does not improve code readability.
3111
+ RedundantRestArgumentNames:
3112
+ - args
3113
+ - arguments
3114
+ RedundantKeywordRestArgumentNames:
3115
+ - kwargs
3116
+ - options
3117
+ - opts
3118
+ RedundantBlockArgumentNames:
3119
+ - blk
3120
+ - block
3121
+ - proc
2986
3122
  VersionAdded: '1.1'
3123
+ VersionChanged: '1.58'
2987
3124
 
2988
3125
  Style/ArrayCoercion:
2989
3126
  Description: >-
@@ -2994,6 +3131,19 @@ Style/ArrayCoercion:
2994
3131
  Enabled: true # We use this quite often exactly like described
2995
3132
  VersionAdded: '0.88'
2996
3133
 
3134
+ Style/ArrayFirstLast:
3135
+ Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3136
+ Reference: '#first-and-last'
3137
+ Enabled: false
3138
+ VersionAdded: '1.58'
3139
+ Safe: false
3140
+
3141
+ Style/ArrayIntersect:
3142
+ Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
3143
+ Enabled: 'pending'
3144
+ Safe: false
3145
+ VersionAdded: '1.40'
3146
+
2997
3147
  Style/ArrayJoin:
2998
3148
  Description: 'Use Array#join instead of Array#*.'
2999
3149
  StyleGuide: '#array-join'
@@ -3157,7 +3307,7 @@ Style/BlockDelimiters:
3157
3307
  # collection.each do |element| puts element end
3158
3308
  AllowBracesOnProceduralOneLiners: false
3159
3309
  # The BracesRequiredMethods overrides all other configurations except
3160
- # IgnoredMethods. It can be used to enforce that all blocks for specific
3310
+ # AllowedMethods. It can be used to enforce that all blocks for specific
3161
3311
  # methods use braces. For example, you can use this to enforce Sorbet
3162
3312
  # signatures use braces even when the rest of your codebase enforces
3163
3313
  # the `line_count_based` style.
@@ -3194,6 +3344,9 @@ Style/CaseLikeIf:
3194
3344
  Enabled: true
3195
3345
  Safe: false
3196
3346
  VersionAdded: '0.88'
3347
+ VersionChanged: '1.48'
3348
+ # `MinBranchesCount` defines the number of branches `if` needs to have to trigger this cop.
3349
+ MinBranchesCount: 3
3197
3350
 
3198
3351
  Style/CharacterLiteral:
3199
3352
  Description: 'Checks for uses of character literals.'
@@ -3206,7 +3359,7 @@ Style/ClassAndModuleChildren:
3206
3359
  StyleGuide: '#namespace-definition'
3207
3360
  # Moving from compact to nested children requires knowledge of whether the
3208
3361
  # outer parent is a module or a class. Moving from nested to compact requires
3209
- # verification that the outer parent is defined elsewhere. Rubocop does not
3362
+ # verification that the outer parent is defined elsewhere. RuboCop does not
3210
3363
  # have the knowledge to perform either operation safely and thus requires
3211
3364
  # manual oversight.
3212
3365
  SafeAutoCorrect: false
@@ -3245,7 +3398,9 @@ Style/ClassEqualityComparison:
3245
3398
  Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3246
3399
  StyleGuide: '#instance-of-vs-class-comparison'
3247
3400
  Enabled: true
3401
+ SafeAutoCorrect: false
3248
3402
  VersionAdded: '0.93'
3403
+ VersionChanged: '1.57'
3249
3404
  AllowedMethods:
3250
3405
  - ==
3251
3406
  - equal?
@@ -3281,6 +3436,7 @@ Style/CollectionCompact:
3281
3436
  Safe: false
3282
3437
  VersionAdded: '1.2'
3283
3438
  VersionChanged: '1.3'
3439
+ AllowedReceivers: []
3284
3440
 
3285
3441
  # Align with the style guide.
3286
3442
  Style/CollectionMethods:
@@ -3299,6 +3455,7 @@ Style/CollectionMethods:
3299
3455
  PreferredMethods:
3300
3456
  collect: 'map'
3301
3457
  collect!: 'map!'
3458
+ collect_concat: 'flat_map'
3302
3459
  inject: 'reduce'
3303
3460
  detect: 'find'
3304
3461
  find_all: 'select'
@@ -3371,6 +3528,17 @@ Style/CommentedKeyword:
3371
3528
  VersionAdded: '0.51'
3372
3529
  VersionChanged: '1.19'
3373
3530
 
3531
+ Style/ComparableClamp:
3532
+ Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3533
+ Enabled: pending
3534
+ VersionAdded: '1.44'
3535
+
3536
+ Style/ConcatArrayLiterals:
3537
+ Description: 'Enforces the use of `Array#push(item)` instead of `Array#concat([item])` to avoid redundant array literals.'
3538
+ Enabled: false
3539
+ Safe: false
3540
+ VersionAdded: '1.41'
3541
+
3374
3542
  Style/ConditionalAssignment:
3375
3543
  Description: >-
3376
3544
  Use the return value of `if` and `case` statements for
@@ -3426,9 +3594,17 @@ Style/Copyright:
3426
3594
  Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
3427
3595
  AutocorrectNotice: ''
3428
3596
 
3597
+ Style/DataInheritance:
3598
+ Description: 'Checks for inheritance from Data.define.'
3599
+ StyleGuide: '#no-extend-data-define'
3600
+ Enabled: false # decided to disable cop to be consistent with Style/StructInheritance
3601
+ SafeAutoCorrect: false
3602
+ VersionAdded: '1.49'
3603
+ VersionChanged: '1.51'
3604
+
3429
3605
  Style/DateTime:
3430
3606
  Description: 'Use Time over DateTime.'
3431
- StyleGuide: '#date--time'
3607
+ StyleGuide: '#date-time'
3432
3608
  Enabled: true # This cop allows DateTime, when used properly. You almost always want Date or Time, though. https://gist.github.com/pixeltrix/e2298822dd89d854444b
3433
3609
  VersionAdded: '0.51'
3434
3610
  VersionChanged: '0.92'
@@ -3449,6 +3625,12 @@ Style/Dir:
3449
3625
  Enabled: true
3450
3626
  VersionAdded: '0.50'
3451
3627
 
3628
+ Style/DirEmpty:
3629
+ Description: >-
3630
+ Prefer to use `Dir.empty?('path/to/dir')` when checking if a directory is empty.
3631
+ Enabled: pending
3632
+ VersionAdded: '1.48'
3633
+
3452
3634
  Style/DisableCopsWithinSourceCodeDirective:
3453
3635
  Description: >-
3454
3636
  Forbids disabling/enabling cops within source code.
@@ -3609,6 +3791,11 @@ Style/EvenOdd:
3609
3791
  VersionAdded: '0.12'
3610
3792
  VersionChanged: '0.29'
3611
3793
 
3794
+ Style/ExactRegexpMatch:
3795
+ Description: 'Checks for exact regexp match inside Regexp literals.'
3796
+ Enabled: pending
3797
+ VersionAdded: '1.51'
3798
+
3612
3799
  Style/ExpandPathArguments:
3613
3800
  Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3614
3801
  Enabled: true
@@ -3644,6 +3831,13 @@ Style/FetchEnvVar:
3644
3831
  # Environment variables to be excluded from the inspection.
3645
3832
  AllowedVars: []
3646
3833
 
3834
+ Style/FileEmpty:
3835
+ Description: >-
3836
+ Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
3837
+ Enabled: pending
3838
+ Safe: false
3839
+ VersionAdded: '1.48'
3840
+
3647
3841
  Style/FileRead:
3648
3842
  Description: 'Favor `File.(bin)read` convenience methods.'
3649
3843
  StyleGuide: '#file-read'
@@ -3780,8 +3974,9 @@ Style/HashConversion:
3780
3974
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3781
3975
  StyleGuide: '#avoid-hash-constructor'
3782
3976
  Enabled: true
3977
+ SafeAutoCorrect: false
3783
3978
  VersionAdded: '1.10'
3784
- VersionChanged: '1.11'
3979
+ VersionChanged: '1.55'
3785
3980
  AllowSplatArgument: true
3786
3981
 
3787
3982
  Style/HashEachMethods:
@@ -3791,15 +3986,17 @@ Style/HashEachMethods:
3791
3986
  Safe: false
3792
3987
  VersionAdded: '0.80'
3793
3988
  VersionChanged: '1.16'
3794
- AllowedReceivers: []
3989
+ AllowedReceivers:
3990
+ - Thread.current
3795
3991
 
3796
3992
  Style/HashExcept:
3797
3993
  Description: >-
3798
- Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3799
- that can be replaced with `Hash#except` method.
3994
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3995
+ that can be replaced with `Hash#except` method.
3800
3996
  Enabled: true
3997
+ Safe: false
3801
3998
  VersionAdded: '1.7'
3802
- VersionChanged: '1.31'
3999
+ VersionChanged: '1.39'
3803
4000
 
3804
4001
  Style/HashLikeCase:
3805
4002
  Description: >-
@@ -3838,7 +4035,7 @@ Style/HashSyntax:
3838
4035
  - never
3839
4036
  # accepts both shorthand and explicit use of hash literal value.
3840
4037
  - either
3841
- # like "always", but will avoid mixing styles in a single hash
4038
+ # forces use of the 3.1 syntax only if all values can be omitted in the hash.
3842
4039
  - consistent
3843
4040
  # Force hashes that have a symbol value to use hash rockets
3844
4041
  UseHashRocketsWithSymbolValues: false
@@ -3962,6 +4159,29 @@ Style/InverseMethods:
3962
4159
  :select: :reject
3963
4160
  :select!: :reject!
3964
4161
 
4162
+ Style/InvertibleUnlessCondition:
4163
+ Description: 'Favor `if` with inverted condition over `unless`.'
4164
+ Enabled: false
4165
+ Safe: false
4166
+ VersionAdded: '1.44'
4167
+ VersionChanged: '1.50'
4168
+ # `InverseMethods` are methods that can be inverted in a `unless` condition.
4169
+ # The relationship of inverse methods needs to be defined in both directions.
4170
+ # Keys and values both need to be defined as symbols.
4171
+ InverseMethods:
4172
+ :!=: :==
4173
+ :>: :<=
4174
+ :<=: :>
4175
+ :<: :>=
4176
+ :>=: :<
4177
+ :!~: :=~
4178
+ :zero?: :nonzero?
4179
+ :nonzero?: :zero?
4180
+ :any?: :none?
4181
+ :none?: :any?
4182
+ :even?: :odd?
4183
+ :odd?: :even?
4184
+
3965
4185
  Style/IpAddresses:
3966
4186
  Description: "Don't include literal IP addresses in code."
3967
4187
  Enabled: false
@@ -4047,6 +4267,12 @@ Style/MapToHash:
4047
4267
  VersionAdded: '1.24'
4048
4268
  Safe: false
4049
4269
 
4270
+ Style/MapToSet:
4271
+ Description: 'Prefer `to_set` with a block over `map.to_set`.'
4272
+ Enabled: pending
4273
+ Safe: false
4274
+ VersionAdded: '1.42'
4275
+
4050
4276
  Style/MethodCallWithArgsParentheses:
4051
4277
  Description: 'Use parentheses for method calls with arguments.'
4052
4278
  StyleGuide: '#method-invocation-parens'
@@ -4102,6 +4328,12 @@ Style/MinMax:
4102
4328
  Enabled: true
4103
4329
  VersionAdded: '0.50'
4104
4330
 
4331
+ Style/MinMaxComparison:
4332
+ Description: 'Enforces the use of `max` or `min` instead of comparison for greater or less.'
4333
+ Enabled: true
4334
+ Safe: false
4335
+ VersionAdded: '1.42'
4336
+
4105
4337
  Style/MissingElse:
4106
4338
  Description: >-
4107
4339
  Require if/case expressions to have an else branches.
@@ -4227,6 +4459,7 @@ Style/MultipleComparison:
4227
4459
  VersionAdded: '0.49'
4228
4460
  VersionChanged: '1.1'
4229
4461
  AllowMethodComparison: true
4462
+ ComparisonsThreshold: 2
4230
4463
 
4231
4464
  Style/MutableConstant:
4232
4465
  Description: 'Do not assign mutable objects to constants.'
@@ -4432,11 +4665,10 @@ Style/NumericPredicate:
4432
4665
  Checks for the use of predicate- or comparison methods for
4433
4666
  numeric comparisons.
4434
4667
  StyleGuide: '#predicate-methods'
4435
- Safe: false
4436
4668
  # This will change to a new method call which isn't guaranteed to be on the
4437
4669
  # object. Switching these methods has to be done with knowledge of the types
4438
4670
  # of the variables which rubocop doesn't have.
4439
- SafeAutoCorrect: false
4671
+ Safe: false
4440
4672
  Enabled: false
4441
4673
  VersionAdded: '0.42'
4442
4674
  VersionChanged: '0.59'
@@ -4482,10 +4714,19 @@ Style/OpenStructUse:
4482
4714
  - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4483
4715
 
4484
4716
  Enabled: pending
4717
+ Safe: false
4485
4718
  VersionAdded: '1.23'
4719
+ VersionChanged: '1.51'
4720
+
4721
+ Style/OperatorMethodCall:
4722
+ Description: 'Checks for redundant dot before operator method call.'
4723
+ StyleGuide: '#operator-method-call'
4724
+ Enabled: pending
4725
+ VersionAdded: '1.37'
4486
4726
 
4487
4727
  Style/OptionHash:
4488
4728
  Description: "Don't use option hashes when you can use keyword arguments."
4729
+ StyleGuide: '#keyword-arguments-vs-option-hashes'
4489
4730
  Enabled: false
4490
4731
  VersionAdded: '0.33'
4491
4732
  VersionChanged: '0.34'
@@ -4629,10 +4870,16 @@ Style/RedundantArgument:
4629
4870
  Enabled: true
4630
4871
  Safe: false
4631
4872
  VersionAdded: '1.4'
4632
- VersionChanged: '1.7'
4873
+ VersionChanged: '1.55'
4633
4874
  Methods:
4634
4875
  # Array#join
4635
4876
  join: ''
4877
+ # Array#sum
4878
+ sum: 0
4879
+ # Kernel.#exit
4880
+ exit: true
4881
+ # Kernel.#exit!
4882
+ exit!: false
4636
4883
  # String#split
4637
4884
  split: ' '
4638
4885
  # String#chomp
@@ -4640,6 +4887,11 @@ Style/RedundantArgument:
4640
4887
  # String#chomp!
4641
4888
  chomp!: "\n"
4642
4889
 
4890
+ Style/RedundantArrayConstructor:
4891
+ Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
4892
+ Enabled: pending
4893
+ VersionAdded: '1.52'
4894
+
4643
4895
  Style/RedundantAssignment:
4644
4896
  Description: 'Checks for redundant assignment before returning.'
4645
4897
  Enabled: true
@@ -4667,6 +4919,27 @@ Style/RedundantConditional:
4667
4919
  Enabled: true
4668
4920
  VersionAdded: '0.50'
4669
4921
 
4922
+ Style/RedundantConstantBase:
4923
+ Description: Avoid redundant `::` prefix on constant.
4924
+ Enabled: pending
4925
+ VersionAdded: '1.40'
4926
+
4927
+ Style/RedundantCurrentDirectoryInPath:
4928
+ Description: 'Checks for uses a redundant current directory in path.'
4929
+ Enabled: pending
4930
+ VersionAdded: '1.53'
4931
+
4932
+ Style/RedundantDoubleSplatHashBraces:
4933
+ Description: 'Checks for redundant uses of double splat hash braces.'
4934
+ Enabled: pending
4935
+ VersionAdded: '1.41'
4936
+
4937
+ Style/RedundantEach:
4938
+ Description: 'Checks for redundant `each`.'
4939
+ Enabled: pending
4940
+ Safe: false
4941
+ VersionAdded: '1.38'
4942
+
4670
4943
  Style/RedundantException:
4671
4944
  Description: "Checks for an obsolete RuntimeException argument in raise/fail."
4672
4945
  StyleGuide: '#no-explicit-runtimeerror'
@@ -4676,9 +4949,9 @@ Style/RedundantException:
4676
4949
 
4677
4950
  Style/RedundantFetchBlock:
4678
4951
  Description: >-
4679
- Use `fetch(key, value)` instead of `fetch(key) { value }`
4680
- when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4681
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4952
+ Use `fetch(key, value)` instead of `fetch(key) { value }`
4953
+ when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4954
+ Reference: 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4682
4955
  Enabled: true
4683
4956
  Safe: false
4684
4957
  # If enabled, this cop will autocorrect usages of
@@ -4695,12 +4968,26 @@ Style/RedundantFileExtensionInRequire:
4695
4968
  Enabled: true
4696
4969
  VersionAdded: '0.88'
4697
4970
 
4971
+ Style/RedundantFilterChain:
4972
+ Description: >-
4973
+ Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
4974
+ `select`/`filter`/`find_all` and change them to use predicate method instead.
4975
+ Enabled: pending
4976
+ SafeAutoCorrect: false
4977
+ VersionAdded: '1.52'
4978
+ VersionChanged: '1.57'
4979
+
4698
4980
  Style/RedundantFreeze:
4699
4981
  Description: "Checks usages of Object#freeze on immutable objects."
4700
4982
  Enabled: true
4701
4983
  VersionAdded: '0.34'
4702
4984
  VersionChanged: '0.66'
4703
4985
 
4986
+ Style/RedundantHeredocDelimiterQuotes:
4987
+ Description: 'Checks for redundant heredoc delimiter quotes.'
4988
+ Enabled: pending
4989
+ VersionAdded: '1.45'
4990
+
4704
4991
  Style/RedundantInitialize:
4705
4992
  Description: 'Checks for redundant `initialize` methods.'
4706
4993
  Enabled: true
@@ -4716,6 +5003,11 @@ Style/RedundantInterpolation:
4716
5003
  VersionAdded: '0.76'
4717
5004
  VersionChanged: '1.30'
4718
5005
 
5006
+ Style/RedundantLineContinuation:
5007
+ Description: 'Check for redundant line continuation.'
5008
+ Enabled: pending
5009
+ VersionAdded: '1.49'
5010
+
4719
5011
  Style/RedundantParentheses:
4720
5012
  Description: "Checks for parentheses that seem not to serve any purpose."
4721
5013
  Enabled: true
@@ -4727,11 +5019,21 @@ Style/RedundantPercentQ:
4727
5019
  Enabled: true
4728
5020
  VersionAdded: '0.76'
4729
5021
 
5022
+ Style/RedundantRegexpArgument:
5023
+ Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
5024
+ Enabled: pending
5025
+ VersionAdded: '1.53'
5026
+
4730
5027
  Style/RedundantRegexpCharacterClass:
4731
5028
  Description: 'Checks for unnecessary single-element Regexp character classes.'
4732
5029
  Enabled: true
4733
5030
  VersionAdded: '0.85'
4734
5031
 
5032
+ Style/RedundantRegexpConstructor:
5033
+ Description: 'Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.'
5034
+ Enabled: pending
5035
+ VersionAdded: '1.52'
5036
+
4735
5037
  Style/RedundantRegexpEscape:
4736
5038
  Description: 'Checks for redundant escapes in Regexps.'
4737
5039
  Enabled: true
@@ -4778,6 +5080,11 @@ Style/RedundantSortBy:
4778
5080
  Enabled: true
4779
5081
  VersionAdded: '0.36'
4780
5082
 
5083
+ Style/RedundantStringEscape:
5084
+ Description: 'Checks for redundant escapes in string literals.'
5085
+ Enabled: pending
5086
+ VersionAdded: '1.37'
5087
+
4781
5088
  Style/RegexpLiteral:
4782
5089
  Description: 'Use / or %r around regular expressions.'
4783
5090
  StyleGuide: '#percent-r'
@@ -4796,6 +5103,12 @@ Style/RegexpLiteral:
4796
5103
  # are found in the regexp string.
4797
5104
  AllowInnerSlashes: false
4798
5105
 
5106
+ Style/RequireOrder:
5107
+ Description: Sort `require` and `require_relative` in alphabetical order.
5108
+ Enabled: false
5109
+ SafeAutoCorrect: false
5110
+ VersionAdded: '1.40'
5111
+
4799
5112
  Style/RescueModifier:
4800
5113
  Description: 'Avoid using rescue in its modifier form.'
4801
5114
  StyleGuide: '#no-rescue-modifiers'
@@ -4823,6 +5136,15 @@ Style/ReturnNil:
4823
5136
  - return_nil
4824
5137
  VersionAdded: '0.50'
4825
5138
 
5139
+ Style/ReturnNilInPredicateMethodDefinition:
5140
+ Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
5141
+ StyleGuide: '#bool-methods-qmark'
5142
+ Enabled: pending
5143
+ SafeAutoCorrect: false
5144
+ AllowedMethods: []
5145
+ AllowedPatterns: []
5146
+ VersionAdded: '1.53'
5147
+
4826
5148
  Style/SafeNavigation:
4827
5149
  Description: >-
4828
5150
  Transforms usages of a method call safeguarded by
@@ -4848,9 +5170,9 @@ Style/SafeNavigation:
4848
5170
 
4849
5171
  Style/Sample:
4850
5172
  Description: >-
4851
- Use `sample` instead of `shuffle.first`,
4852
- `shuffle.last`, and `shuffle[Integer]`.
4853
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
5173
+ Use `sample` instead of `shuffle.first`,
5174
+ `shuffle.last`, and `shuffle[Integer]`.
5175
+ Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
4854
5176
  Enabled: true
4855
5177
  VersionAdded: '0.30'
4856
5178
 
@@ -4915,6 +5237,12 @@ Style/SingleLineBlockParams:
4915
5237
  - acc
4916
5238
  - elem
4917
5239
 
5240
+ Style/SingleLineDoEndBlock:
5241
+ Description: 'Checks for single-line `do`...`end` blocks.'
5242
+ StyleGuide: '#single-line-do-end-block'
5243
+ Enabled: pending
5244
+ VersionAdded: '1.57'
5245
+
4918
5246
  Style/SingleLineMethods:
4919
5247
  Description: 'Avoid single-line methods.'
4920
5248
  StyleGuide: '#no-single-line-methods'
@@ -4924,7 +5252,8 @@ Style/SingleLineMethods:
4924
5252
  AllowIfMethodIsEmpty: true
4925
5253
 
4926
5254
  Style/SlicingWithRange:
4927
- Description: 'Checks array slicing is done with endless ranges when suitable.'
5255
+ Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
5256
+ StyleGuide: '#slicing-with-ranges'
4928
5257
  Enabled: true
4929
5258
  VersionAdded: '0.83'
4930
5259
  Safe: false
@@ -5051,6 +5380,12 @@ Style/StructInheritance:
5051
5380
  VersionAdded: '0.29'
5052
5381
  VersionChanged: '1.20'
5053
5382
 
5383
+ Style/SuperWithArgsParentheses:
5384
+ Description: 'Use parentheses for `super` with arguments.'
5385
+ StyleGuide: '#super-with-args'
5386
+ Enabled: pending
5387
+ VersionAdded: '1.58'
5388
+
5054
5389
  Style/SwapValues:
5055
5390
  Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
5056
5391
  StyleGuide: '#values-swapping'
@@ -5080,12 +5415,11 @@ Style/SymbolProc:
5080
5415
  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.
5081
5416
  Safe: false
5082
5417
  VersionAdded: '0.26'
5083
- VersionChanged: '1.28'
5418
+ VersionChanged: '1.40'
5084
5419
  AllowMethodsWithArguments: false
5085
5420
  # A list of method names to be always allowed by the check.
5086
5421
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
5087
5422
  AllowedMethods:
5088
- - respond_to
5089
5423
  - define_method
5090
5424
  AllowedPatterns: []
5091
5425
  AllowComments: false
@@ -5308,6 +5642,11 @@ Style/WordArray:
5308
5642
  # The regular expression `WordRegex` decides what is considered a word.
5309
5643
  WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
5310
5644
 
5645
+ Style/YAMLFileRead:
5646
+ Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
5647
+ Enabled: pending
5648
+ VersionAdded: '1.53'
5649
+
5311
5650
  Style/YodaCondition:
5312
5651
  Description: 'Forbid or enforce yoda conditions.'
5313
5652
  Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
@@ -5326,6 +5665,19 @@ Style/YodaCondition:
5326
5665
  VersionAdded: '0.49'
5327
5666
  VersionChanged: '0.75'
5328
5667
 
5668
+ Style/YodaExpression:
5669
+ Description: 'Forbid the use of yoda expressions.'
5670
+ Enabled: false
5671
+ Safe: false
5672
+ VersionAdded: '1.42'
5673
+ VersionChanged: '1.43'
5674
+ SupportedOperators:
5675
+ - '*'
5676
+ - '+'
5677
+ - '&'
5678
+ - '|'
5679
+ - '^'
5680
+
5329
5681
  Style/ZeroLengthPredicate:
5330
5682
  Description: 'Use #empty? when testing for objects of length 0.'
5331
5683
  Enabled: false