makandra-rubocop 6.2.0 → 8.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.
data/config/default.yml CHANGED
@@ -82,6 +82,8 @@ AllCops:
82
82
  # When specifying style guide URLs, any paths and/or fragments will be
83
83
  # evaluated relative to the base URL.
84
84
  StyleGuideBaseURL: https://rubystyle.guide
85
+ # Documentation URLs will be constructed using the base URL.
86
+ DocumentationBaseURL: https://docs.rubocop.org/rubocop
85
87
  # Extra details are not displayed in offense messages by default. Change
86
88
  # behavior by overriding ExtraDetails, or by giving the
87
89
  # `-E/--extra-details` option.
@@ -134,7 +136,7 @@ AllCops:
134
136
  # What MRI version of the Ruby interpreter is the inspected code intended to
135
137
  # run on? (If there is more than one, set this to the lowest version.)
136
138
  # If a value is specified for TargetRubyVersion then it is used. Acceptable
137
- # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
139
+ # values are specified as a float (i.e. 3.0); the teeny version of Ruby
138
140
  # should not be included. If the project specifies a Ruby version in the
139
141
  # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
140
142
  # try to determine the desired version of Ruby by inspecting the
@@ -142,7 +144,7 @@ AllCops:
142
144
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
143
145
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
144
146
  # Ruby version is still unresolved, RuboCop will use the oldest officially
145
- # supported Ruby version (currently Ruby 2.4).
147
+ # supported Ruby version (currently Ruby 2.5).
146
148
  TargetRubyVersion: ~
147
149
  # Determines if a notification for extension libraries should be shown when
148
150
  # rubocop is run. Keys are the name of the extension, and values are an array
@@ -154,6 +156,7 @@ AllCops:
154
156
  rubocop-minitest: [minitest]
155
157
  rubocop-sequel: [sequel]
156
158
  rubocop-rake: [rake]
159
+ rubocop-graphql: [graphql]
157
160
 
158
161
  #################### Bundler ###############################
159
162
 
@@ -178,6 +181,34 @@ Bundler/GemComment:
178
181
  IgnoredGems: []
179
182
  OnlyFor: []
180
183
 
184
+ Bundler/GemFilename:
185
+ Description: 'Enforces the filename for managing gems.'
186
+ Enabled: true
187
+ VersionAdded: '1.20'
188
+ EnforcedStyle: 'Gemfile'
189
+ SupportedStyles:
190
+ - 'Gemfile'
191
+ - 'gems.rb'
192
+ Include:
193
+ - '**/Gemfile'
194
+ - '**/gems.rb'
195
+ - '**/Gemfile.lock'
196
+ - '**/gems.locked'
197
+
198
+ Bundler/GemVersion:
199
+ Description: 'Requires or forbids specifying gem versions.'
200
+ Enabled: false
201
+ VersionAdded: '1.14'
202
+ EnforcedStyle: 'required'
203
+ SupportedStyles:
204
+ - 'required'
205
+ - 'forbidden'
206
+ Include:
207
+ - '**/*.gemfile'
208
+ - '**/Gemfile'
209
+ - '**/gems.rb'
210
+ AllowedGems: []
211
+
181
212
  Bundler/InsecureProtocolSource:
182
213
  Description: >-
183
214
  The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
@@ -185,6 +216,7 @@ Bundler/InsecureProtocolSource:
185
216
  'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
186
217
  Enabled: true
187
218
  VersionAdded: '0.50'
219
+ AllowHttpProtocol: true
188
220
  Include:
189
221
  - '**/*.gemfile'
190
222
  - '**/Gemfile'
@@ -207,6 +239,13 @@ Bundler/OrderedGems:
207
239
 
208
240
  #################### Gemspec ###############################
209
241
 
242
+ Gemspec/DateAssignment:
243
+ Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
244
+ Enabled: true
245
+ VersionAdded: '1.10'
246
+ Include:
247
+ - '**/*.gemspec'
248
+
210
249
  Gemspec/DuplicatedAssignment:
211
250
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
212
251
  Enabled: true
@@ -226,11 +265,20 @@ Gemspec/OrderedDependencies:
226
265
  Include:
227
266
  - '**/*.gemspec'
228
267
 
268
+ Gemspec/RequireMFA:
269
+ Description: 'Checks that the gemspec has metadata to require MFA from RubyGems.'
270
+ Enabled: pending
271
+ VersionAdded: '1.23'
272
+ Reference:
273
+ - https://guides.rubygems.org/mfa-requirement-opt-in/
274
+ Include:
275
+ - '**/*.gemspec'
276
+
229
277
  Gemspec/RequiredRubyVersion:
230
278
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
231
279
  Enabled: true
232
280
  VersionAdded: '0.52'
233
- VersionChanged: '0.89'
281
+ VersionChanged: '1.22'
234
282
  Include:
235
283
  - '**/*.gemspec'
236
284
 
@@ -360,10 +408,11 @@ Layout/BlockEndNewline:
360
408
  VersionAdded: '0.49'
361
409
 
362
410
  Layout/CaseIndentation:
363
- Description: 'Indentation of when in a case/when/[else/]end.'
411
+ Description: 'Indentation of when in a case/(when|in)/[else/]end.'
364
412
  StyleGuide: '#indent-when-to-case'
365
413
  Enabled: true
366
414
  VersionAdded: '0.49'
415
+ VersionChanged: '1.16'
367
416
  EnforcedStyle: end
368
417
  SupportedStyles:
369
418
  - case
@@ -406,7 +455,11 @@ Layout/ClosingParenthesisIndentation:
406
455
  Layout/CommentIndentation:
407
456
  Description: 'Indentation of comments.'
408
457
  Enabled: true
458
+ # When true, allows comments to have extra indentation if that aligns them
459
+ # with a comment on the preceding line.
460
+ AllowForAlignment: false
409
461
  VersionAdded: '0.49'
462
+ VersionChanged: '1.24'
410
463
 
411
464
  Layout/ConditionPosition:
412
465
  Description: >-
@@ -478,13 +531,13 @@ Layout/EmptyLineBetweenDefs:
478
531
  StyleGuide: '#empty-lines-between-methods'
479
532
  Enabled: true
480
533
  VersionAdded: '0.49'
481
- VersionChanged: '1.7'
534
+ VersionChanged: '1.23'
482
535
  EmptyLineBetweenMethodDefs: true
483
536
  EmptyLineBetweenClassDefs: true
484
537
  EmptyLineBetweenModuleDefs: true
485
- # If `true`, this parameter means that single line method definitions don't
486
- # need an empty line between them.
487
- AllowAdjacentOneLineDefs: false
538
+ # `AllowAdjacentOneLineDefs` means that single line method definitions don't
539
+ # need an empty line between them. `true` by default.
540
+ AllowAdjacentOneLineDefs: true
488
541
  # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
489
542
  NumberOfEmptyLines: 1
490
543
 
@@ -754,7 +807,7 @@ Layout/HashAlignment:
754
807
  Enabled: false
755
808
  AllowMultipleStyles: true
756
809
  VersionAdded: '0.49'
757
- VersionChanged: '0.77'
810
+ VersionChanged: '1.16'
758
811
  # Alignment of entries using hash rocket as separator. Valid values are:
759
812
  #
760
813
  # key - left alignment of keys
@@ -865,8 +918,8 @@ Layout/IndentationStyle:
865
918
  Enabled: true
866
919
  VersionAdded: '0.49'
867
920
  VersionChanged: '0.82'
868
- # By default, the indentation width from Layout/IndentationWidth is used
869
- # But it can be overridden by setting this parameter
921
+ # By default the indentation width from `Layout/IndentationWidth` is used,
922
+ # but it can be overridden by setting this parameter.
870
923
  # It is used during auto-correction to determine how many spaces should
871
924
  # replace each tab.
872
925
  IndentationWidth: ~
@@ -905,13 +958,26 @@ Layout/LeadingEmptyLines:
905
958
  VersionAdded: '0.57'
906
959
  VersionChanged: '0.77'
907
960
 
961
+ Layout/LineEndStringConcatenationIndentation:
962
+ Description: >-
963
+ Checks the indentation of the next line after a line that
964
+ ends with a string literal and a backslash.
965
+ Enabled: false
966
+ VersionAdded: '1.18'
967
+ EnforcedStyle: aligned
968
+ SupportedStyles:
969
+ - aligned
970
+ - indented
971
+ # By default the indentation width from `Layout/IndentationWidth` is used,
972
+ # but it can be overridden by setting this parameter.
973
+ IndentationWidth: ~
974
+
908
975
  Layout/LineLength:
909
976
  Description: 'Checks that line length does not exceed the configured limit.'
910
977
  StyleGuide: '#max-line-length'
911
978
  Enabled: false
912
979
  VersionAdded: '0.25'
913
980
  VersionChanged: '1.4'
914
- AutoCorrect: true
915
981
  Max: 120
916
982
  # To make it possible to copy or click on URIs in the code, we allow lines
917
983
  # containing a URI to be longer than Max.
@@ -1035,8 +1101,8 @@ Layout/MultilineMethodCallIndentation:
1035
1101
  - aligned
1036
1102
  - indented
1037
1103
  - indented_relative_to_receiver
1038
- # By default, the indentation width from Layout/IndentationWidth is used
1039
- # But it can be overridden by setting this parameter
1104
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1105
+ # but it can be overridden by setting this parameter.
1040
1106
  IndentationWidth: ~
1041
1107
 
1042
1108
  Layout/MultilineMethodDefinitionBraceLayout:
@@ -1065,8 +1131,8 @@ Layout/MultilineOperationIndentation:
1065
1131
  SupportedStyles:
1066
1132
  - aligned
1067
1133
  - indented
1068
- # By default, the indentation width from `Layout/IndentationWidth` is used
1069
- # But it can be overridden by setting this parameter
1134
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1135
+ # but it can be overridden by setting this parameter.
1070
1136
  IndentationWidth: ~
1071
1137
 
1072
1138
  Layout/ParameterAlignment:
@@ -1094,15 +1160,28 @@ Layout/ParameterAlignment:
1094
1160
  SupportedStyles:
1095
1161
  - with_first_parameter
1096
1162
  - with_fixed_indentation
1097
- # By default, the indentation width from Layout/IndentationWidth is used
1098
- # But it can be overridden by setting this parameter
1163
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1164
+ # but it can be overridden by setting this parameter.
1099
1165
  IndentationWidth: ~
1100
1166
 
1167
+ Layout/RedundantLineBreak:
1168
+ Description: >-
1169
+ Do not break up an expression into multiple lines when it fits
1170
+ on a single line.
1171
+ Enabled: false
1172
+ InspectBlocks: false
1173
+ VersionAdded: '1.13'
1174
+
1101
1175
  Layout/RescueEnsureAlignment:
1102
1176
  Description: 'Align rescues and ensures correctly.'
1103
1177
  Enabled: true
1104
1178
  VersionAdded: '0.49'
1105
1179
 
1180
+ Layout/SingleLineBlockChain:
1181
+ Description: 'Put method call on a separate line if chained to a single line block.'
1182
+ Enabled: false
1183
+ VersionAdded: '1.14'
1184
+
1106
1185
  Layout/SpaceAfterColon:
1107
1186
  Description: 'Use spaces after colons.'
1108
1187
  StyleGuide: '#spaces-operators'
@@ -1302,10 +1381,11 @@ Layout/SpaceInsideParens:
1302
1381
  StyleGuide: '#spaces-braces'
1303
1382
  Enabled: true
1304
1383
  VersionAdded: '0.49'
1305
- VersionChanged: '0.55'
1384
+ VersionChanged: '1.22'
1306
1385
  EnforcedStyle: no_space
1307
1386
  SupportedStyles:
1308
1387
  - space
1388
+ - compact
1309
1389
  - no_space
1310
1390
 
1311
1391
  Layout/SpaceInsidePercentLiteralDelimiters:
@@ -1377,6 +1457,8 @@ Lint/AmbiguousBlockAssociation:
1377
1457
  StyleGuide: '#syntax'
1378
1458
  Enabled: false
1379
1459
  VersionAdded: '0.48'
1460
+ VersionChanged: '1.13'
1461
+ IgnoredMethods: []
1380
1462
 
1381
1463
  Lint/AmbiguousOperator:
1382
1464
  Description: >-
@@ -1387,6 +1469,20 @@ Lint/AmbiguousOperator:
1387
1469
  VersionAdded: '0.17'
1388
1470
  VersionChanged: '0.83'
1389
1471
 
1472
+ Lint/AmbiguousOperatorPrecedence:
1473
+ Description: >-
1474
+ Checks for expressions containing multiple binary operations with
1475
+ ambiguous precedence.
1476
+ Enabled: pending
1477
+ VersionAdded: '1.21'
1478
+
1479
+ Lint/AmbiguousRange:
1480
+ Description: Checks for ranges with ambiguous boundaries.
1481
+ Enabled: pending
1482
+ VersionAdded: '1.19'
1483
+ SafeAutoCorrect: false
1484
+ RequireParenthesesForMethodChains: false
1485
+
1390
1486
  Lint/AmbiguousRegexpLiteral:
1391
1487
  Description: >-
1392
1488
  Checks for ambiguous regexp literals in the first argument of
@@ -1417,9 +1513,9 @@ Lint/BinaryOperatorWithIdenticalOperands:
1417
1513
  Lint/BooleanSymbol:
1418
1514
  Description: 'Check for `:true` and `:false` symbols.'
1419
1515
  Enabled: true
1420
- Safe: false
1516
+ SafeAutoCorrect: false
1421
1517
  VersionAdded: '0.50'
1422
- VersionChanged: '0.83'
1518
+ VersionChanged: '1.22'
1423
1519
 
1424
1520
  Lint/CircularArgumentReference:
1425
1521
  Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
@@ -1453,23 +1549,37 @@ Lint/Debugger:
1453
1549
  Description: 'Check for debugger calls.'
1454
1550
  Enabled: false
1455
1551
  VersionAdded: '0.14'
1456
- VersionChanged: '0.49'
1457
- DebuggerReceivers:
1458
- - binding
1459
- - Kernel
1460
- - Pry
1552
+ VersionChanged: '1.10'
1461
1553
  DebuggerMethods:
1462
- - debugger
1463
- - byebug
1464
- - remote_byebug
1465
- - pry
1466
- - remote_pry
1467
- - pry_remote
1468
- - console
1469
- - rescue
1470
- - save_and_open_page
1471
- - save_and_open_screenshot
1472
- - irb
1554
+ # Groups are available so that a specific group can be disabled in
1555
+ # a user's configuration, but are otherwise not significant.
1556
+ Kernel:
1557
+ - binding.irb
1558
+ Byebug:
1559
+ - byebug
1560
+ - remote_byebug
1561
+ - Kernel.byebug
1562
+ - Kernel.remote_byebug
1563
+ Capybara:
1564
+ - save_and_open_page
1565
+ - save_and_open_screenshot
1566
+ debug.rb:
1567
+ - binding.b
1568
+ - binding.break
1569
+ - Kernel.binding.b
1570
+ - Kernel.binding.break
1571
+ Pry:
1572
+ - binding.pry
1573
+ - binding.remote_pry
1574
+ - binding.pry_remote
1575
+ - Pry.rescue
1576
+ Rails:
1577
+ - debugger
1578
+ - Kernel.debugger
1579
+ RubyJard:
1580
+ - jard
1581
+ WebConsole:
1582
+ - binding.console
1473
1583
 
1474
1584
  Lint/DeprecatedClassMethods:
1475
1585
  Description: 'Check for deprecated class method calls.'
@@ -1480,6 +1590,7 @@ Lint/DeprecatedConstants:
1480
1590
  Description: 'Checks for deprecated constants.'
1481
1591
  Enabled: true
1482
1592
  VersionAdded: '1.8'
1593
+ VersionChanged: '1.22'
1483
1594
  # You can configure deprecated constants.
1484
1595
  # If there is an alternative method, you can set alternative value as `Alternative`.
1485
1596
  # And you can set the deprecated version as `DeprecatedVersion`.
@@ -1500,6 +1611,9 @@ Lint/DeprecatedConstants:
1500
1611
  'FALSE':
1501
1612
  Alternative: 'false'
1502
1613
  DeprecatedVersion: '2.4'
1614
+ 'Net::HTTPServerException':
1615
+ Alternative: 'Net::HTTPClientException'
1616
+ DeprecatedVersion: '2.6'
1503
1617
  'Random::DEFAULT':
1504
1618
  Alternative: 'Random.new'
1505
1619
  DeprecatedVersion: '3.0'
@@ -1608,6 +1722,12 @@ Lint/EmptyFile:
1608
1722
  AllowComments: true
1609
1723
  VersionAdded: '0.90'
1610
1724
 
1725
+ Lint/EmptyInPattern:
1726
+ Description: 'Checks for the presence of `in` pattern branches without a body.'
1727
+ Enabled: true
1728
+ AllowComments: true
1729
+ VersionAdded: '1.16'
1730
+
1611
1731
  Lint/EmptyInterpolation:
1612
1732
  Description: 'Checks for empty string interpolation.'
1613
1733
  Enabled: true
@@ -1685,6 +1805,13 @@ Lint/ImplicitStringConcatenation:
1685
1805
  Enabled: true
1686
1806
  VersionAdded: '0.36'
1687
1807
 
1808
+ Lint/IncompatibleIoSelectWithFiberScheduler:
1809
+ Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
1810
+ Enabled: pending
1811
+ SafeAutoCorrect: false
1812
+ VersionAdded: '1.21'
1813
+ VersionChanged: '1.24'
1814
+
1688
1815
  Lint/IneffectiveAccessModifier:
1689
1816
  Description: >-
1690
1817
  Checks for attempts to use `private` or `protected` to set
@@ -1766,7 +1893,6 @@ Lint/MultipleComparison:
1766
1893
  Enabled: true
1767
1894
  VersionAdded: '0.47'
1768
1895
  VersionChanged: '1.1'
1769
- AllowMethodComparison: true
1770
1896
 
1771
1897
  Lint/NestedMethodDefinition:
1772
1898
  Description: 'Do not use nested method definitions.'
@@ -1949,6 +2075,11 @@ Lint/RequireParentheses:
1949
2075
  Enabled: true
1950
2076
  VersionAdded: '0.18'
1951
2077
 
2078
+ Lint/RequireRelativeSelfPath:
2079
+ Description: 'Checks for uses a file requiring itself with `require_relative`.'
2080
+ Enabled: pending
2081
+ VersionAdded: '1.22'
2082
+
1952
2083
  Lint/RescueException:
1953
2084
  Description: 'Avoid rescuing the Exception class.'
1954
2085
  StyleGuide: '#no-blind-rescues'
@@ -2047,13 +2178,19 @@ Lint/SuppressedException:
2047
2178
  StyleGuide: '#dont-hide-exceptions'
2048
2179
  Enabled: true
2049
2180
  AllowComments: true
2181
+ AllowNil: true
2050
2182
  VersionAdded: '0.9'
2051
- VersionChanged: '0.81'
2183
+ VersionChanged: '1.12'
2052
2184
 
2053
2185
  Lint/SymbolConversion:
2054
2186
  Description: 'Checks for unnecessary symbol conversions.'
2055
2187
  Enabled: true
2056
2188
  VersionAdded: '1.9'
2189
+ VersionChanged: '1.16'
2190
+ EnforcedStyle: strict
2191
+ SupportedStyles:
2192
+ - strict
2193
+ - consistent
2057
2194
 
2058
2195
  Lint/Syntax:
2059
2196
  Description: 'Checks for syntax errors.'
@@ -2195,6 +2332,11 @@ Lint/UselessMethodDefinition:
2195
2332
  Safe: false
2196
2333
  AllowComments: true
2197
2334
 
2335
+ Lint/UselessRuby2Keywords:
2336
+ Description: 'Finds unnecessary uses of `ruby2_keywords`.'
2337
+ Enabled: pending
2338
+ VersionAdded: '1.23'
2339
+
2198
2340
  Lint/UselessSetterCall:
2199
2341
  Description: 'Checks for useless setter call to a local variable.'
2200
2342
  Enabled: true
@@ -2349,6 +2491,17 @@ Naming/BinaryOperatorParameterName:
2349
2491
  VersionAdded: '0.50'
2350
2492
  VersionChanged: '1.2'
2351
2493
 
2494
+ Naming/BlockForwarding:
2495
+ Description: 'Use anonymous block forwarding.'
2496
+ StyleGuide: '#block-forwarding'
2497
+ Enabled: pending
2498
+ VersionAdded: '1.24'
2499
+ EnforcedStyle: anonymous
2500
+ SupportedStyles:
2501
+ - anonymous
2502
+ - explicit
2503
+ BlockForwardingName: block
2504
+
2352
2505
  Naming/BlockParameterName:
2353
2506
  Description: >-
2354
2507
  Checks for block parameter names that contain capital letters,
@@ -2386,6 +2539,7 @@ Naming/FileName:
2386
2539
  StyleGuide: '#snake-case-files'
2387
2540
  Enabled: true
2388
2541
  VersionAdded: '0.50'
2542
+ VersionChanged: '1.23'
2389
2543
  # Camel case file names listed in `AllCops:Include` and all file names listed
2390
2544
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2391
2545
  Exclude: []
@@ -2398,6 +2552,13 @@ Naming/FileName:
2398
2552
  # whether each source file's class or module name matches the file name --
2399
2553
  # not whether the nested module hierarchy matches the subdirectory path.
2400
2554
  CheckDefinitionPathHierarchy: true
2555
+ # paths that are considered root directories, for example "lib" in most ruby projects
2556
+ # or "app/models" in rails projects
2557
+ CheckDefinitionPathHierarchyRoots:
2558
+ - lib
2559
+ - spec
2560
+ - test
2561
+ - src
2401
2562
  # If non-`nil`, expect all source file names to match the following regex.
2402
2563
  # Only the file name itself is matched, not the entire file path.
2403
2564
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2468,6 +2629,33 @@ Naming/HeredocDelimiterNaming:
2468
2629
  ForbiddenDelimiters:
2469
2630
  - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2470
2631
 
2632
+ Naming/InclusiveLanguage:
2633
+ Description: 'Recommend the use of inclusive language instead of problematic terms.'
2634
+ Enabled: true
2635
+ VersionAdded: '1.18'
2636
+ VersionChanged: '1.21'
2637
+ CheckIdentifiers: true
2638
+ CheckConstants: true
2639
+ CheckVariables: true
2640
+ CheckStrings: false
2641
+ CheckSymbols: true
2642
+ CheckComments: true
2643
+ CheckFilepaths: true
2644
+ FlaggedTerms:
2645
+ whitelist:
2646
+ Regex: !ruby/regexp '/white[-_\s]?list/'
2647
+ Suggestions:
2648
+ - allowlist
2649
+ - permit
2650
+ blacklist:
2651
+ Regex: !ruby/regexp '/black[-_\s]?list/'
2652
+ Suggestions:
2653
+ - denylist
2654
+ - block
2655
+ slave:
2656
+ WholeWord: true
2657
+ Suggestions: ['replica', 'secondary', 'follower']
2658
+
2471
2659
  Naming/MemoizedInstanceVariableName:
2472
2660
  Description: >-
2473
2661
  Memoized method name should match memo instance variable name.
@@ -2479,6 +2667,7 @@ Naming/MemoizedInstanceVariableName:
2479
2667
  - disallowed
2480
2668
  - required
2481
2669
  - optional
2670
+ Safe: false
2482
2671
 
2483
2672
  Naming/MethodName:
2484
2673
  Description: 'Use the configured style when naming methods.'
@@ -2606,6 +2795,14 @@ Security/Eval:
2606
2795
  Enabled: false # We all know not to eval. If we need to, there will be a reason.
2607
2796
  VersionAdded: '0.47'
2608
2797
 
2798
+ Security/IoMethods:
2799
+ Description: >-
2800
+ Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
2801
+ `IO.foreach`, and `IO.readlines`.
2802
+ Enabled: pending
2803
+ Safe: false
2804
+ VersionAdded: '1.22'
2805
+
2609
2806
  Security/JSONLoad:
2610
2807
  Description: >-
2611
2808
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
@@ -2613,10 +2810,9 @@ Security/JSONLoad:
2613
2810
  Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2614
2811
  Enabled: true
2615
2812
  VersionAdded: '0.43'
2616
- VersionChanged: '0.44'
2813
+ VersionChanged: '1.22'
2617
2814
  # Autocorrect here will change to a method that may cause crashes depending
2618
2815
  # on the value of the argument.
2619
- AutoCorrect: false
2620
2816
  SafeAutoCorrect: false
2621
2817
 
2622
2818
  Security/MarshalLoad:
@@ -2682,8 +2878,9 @@ Style/AndOr:
2682
2878
  Description: 'Use &&/|| instead of and/or.'
2683
2879
  StyleGuide: '#no-and-or-or'
2684
2880
  Enabled: true
2881
+ SafeAutoCorrect: false
2685
2882
  VersionAdded: '0.9'
2686
- VersionChanged: '0.25'
2883
+ VersionChanged: '1.21'
2687
2884
  # Whether `and` and `or` are banned only in conditionals (conditionals)
2688
2885
  # or completely (always).
2689
2886
  EnforcedStyle: always
@@ -2719,7 +2916,7 @@ Style/AsciiComments:
2719
2916
  StyleGuide: '#english-comments'
2720
2917
  Enabled: false
2721
2918
  VersionAdded: '0.9'
2722
- VersionChanged: '0.52'
2919
+ VersionChanged: '1.21'
2723
2920
  AllowedChars:
2724
2921
  - ©
2725
2922
 
@@ -2881,7 +3078,7 @@ Style/CaseEquality:
2881
3078
  Enabled: true
2882
3079
  VersionAdded: '0.9'
2883
3080
  VersionChanged: '0.89'
2884
- # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
3081
+ # If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
2885
3082
  # the case equality operator is a constant.
2886
3083
  #
2887
3084
  # # bad
@@ -3056,7 +3253,7 @@ Style/CommentAnnotation:
3056
3253
  StyleGuide: '#annotate-keywords'
3057
3254
  Enabled: true
3058
3255
  VersionAdded: '0.10'
3059
- VersionChanged: '1.3'
3256
+ VersionChanged: '1.20'
3060
3257
  Keywords:
3061
3258
  - TODO
3062
3259
  - FIXME
@@ -3064,12 +3261,14 @@ Style/CommentAnnotation:
3064
3261
  - HACK
3065
3262
  - REVIEW
3066
3263
  - NOTE
3264
+ RequireColon: true
3067
3265
 
3068
3266
  Style/CommentedKeyword:
3069
3267
  Description: 'Do not place comments on the same line as certain keywords.'
3070
3268
  Enabled: false
3269
+ SafeAutoCorrect: false
3071
3270
  VersionAdded: '0.51'
3072
- VersionChanged: '1.7'
3271
+ VersionChanged: '1.19'
3073
3272
 
3074
3273
  Style/ConditionalAssignment:
3075
3274
  Description: >-
@@ -3098,6 +3297,8 @@ Style/ConstantVisibility:
3098
3297
  visibility declarations.
3099
3298
  Enabled: false
3100
3299
  VersionAdded: '0.66'
3300
+ VersionChanged: '1.10'
3301
+ IgnoreModules: false
3101
3302
 
3102
3303
  # Checks that you have put a copyright in a comment before any code.
3103
3304
  #
@@ -3168,6 +3369,7 @@ Style/Documentation:
3168
3369
  Description: 'Document classes and non-namespace modules.'
3169
3370
  Enabled: false
3170
3371
  VersionAdded: '0.9'
3372
+ AllowedConstants: []
3171
3373
  Exclude:
3172
3374
  - 'spec/**/*'
3173
3375
  - 'test/**/*'
@@ -3319,6 +3521,18 @@ Style/ExponentialNotation:
3319
3521
  - engineering
3320
3522
  - integral
3321
3523
 
3524
+ Style/FileRead:
3525
+ Description: 'Favor `File.(bin)read` convenience methods.'
3526
+ StyleGuide: '#file-read'
3527
+ Enabled: pending
3528
+ VersionAdded: '1.24'
3529
+
3530
+ Style/FileWrite:
3531
+ Description: 'Favor `File.(bin)write` convenience methods.'
3532
+ StyleGuide: '#file-write'
3533
+ Enabled: pending
3534
+ VersionAdded: '1.24'
3535
+
3322
3536
  Style/FloatDivision:
3323
3537
  Description: 'For performing float division, coerce one side only.'
3324
3538
  StyleGuide: '#float-division'
@@ -3436,12 +3650,22 @@ Style/HashAsLastArrayItem:
3436
3650
  - braces
3437
3651
  - no_braces
3438
3652
 
3653
+ Style/HashConversion:
3654
+ Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3655
+ StyleGuide: '#avoid-hash-constructor'
3656
+ Enabled: true
3657
+ VersionAdded: '1.10'
3658
+ VersionChanged: '1.11'
3659
+ AllowSplatArgument: true
3660
+
3439
3661
  Style/HashEachMethods:
3440
3662
  Description: 'Use Hash#each_key and Hash#each_value.'
3441
3663
  StyleGuide: '#hash-each'
3442
3664
  Enabled: true
3443
- VersionAdded: '0.80'
3444
3665
  Safe: false
3666
+ VersionAdded: '0.80'
3667
+ VersionChanged: '1.16'
3668
+ AllowedReceivers: []
3445
3669
 
3446
3670
  Style/HashExcept:
3447
3671
  Description: >-
@@ -3467,7 +3691,7 @@ Style/HashSyntax:
3467
3691
  StyleGuide: '#hash-literals'
3468
3692
  Enabled: true
3469
3693
  VersionAdded: '0.9'
3470
- VersionChanged: '0.43'
3694
+ VersionChanged: '1.24'
3471
3695
  EnforcedStyle: ruby19
3472
3696
  SupportedStyles:
3473
3697
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -3478,6 +3702,15 @@ Style/HashSyntax:
3478
3702
  - no_mixed_keys
3479
3703
  # enforces both ruby19 and no_mixed_keys styles
3480
3704
  - ruby19_no_mixed_keys
3705
+ # Force hashes that have a hash value omission
3706
+ EnforcedShorthandSyntax: always
3707
+ SupportedShorthandSyntax:
3708
+ # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3709
+ - always
3710
+ # forces use of explicit hash literal value.
3711
+ - never
3712
+ # accepts both shorthand and explicit use of hash literal value.
3713
+ - either
3481
3714
  # Force hashes that have a symbol value to use hash rockets
3482
3715
  UseHashRocketsWithSymbolValues: false
3483
3716
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3503,7 +3736,9 @@ Style/IdenticalConditionalBranches:
3503
3736
  line at the end of each branch, which can validly be moved
3504
3737
  out of the conditional.
3505
3738
  Enabled: true
3739
+ SafeAutoCorrect: false
3506
3740
  VersionAdded: '0.36'
3741
+ VersionChanged: '1.19'
3507
3742
 
3508
3743
  Style/IfInsideElse:
3509
3744
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
@@ -3550,10 +3785,16 @@ Style/ImplicitRuntimeError:
3550
3785
  Enabled: false
3551
3786
  VersionAdded: '0.41'
3552
3787
 
3788
+ Style/InPatternThen:
3789
+ Description: 'Checks for `in;` uses in `case` expressions.'
3790
+ StyleGuide: '#no-in-pattern-semicolons'
3791
+ Enabled: true
3792
+ VersionAdded: '1.16'
3793
+
3553
3794
  Style/InfiniteLoop:
3554
3795
  Description: >-
3555
3796
  Use Kernel#loop for infinite loops.
3556
- This cop is unsafe in the body may raise a `StopIteration` exception.
3797
+ This cop is unsafe if the body may raise a `StopIteration` exception.
3557
3798
  Safe: false
3558
3799
  StyleGuide: '#infinite-loop'
3559
3800
  Enabled: true
@@ -3646,6 +3887,12 @@ Style/LineEndConcatenation:
3646
3887
  VersionAdded: '0.18'
3647
3888
  VersionChanged: '0.64'
3648
3889
 
3890
+ Style/MapToHash:
3891
+ Description: 'Prefer `to_h` with a block over `map.to_h`.'
3892
+ Enabled: pending
3893
+ VersionAdded: '1.24'
3894
+ Safe: false
3895
+
3649
3896
  Style/MethodCallWithArgsParentheses:
3650
3897
  Description: 'Use parentheses for method calls with arguments.'
3651
3898
  StyleGuide: '#method-invocation-parens'
@@ -3659,6 +3906,7 @@ Style/MethodCallWithArgsParentheses:
3659
3906
  AllowParenthesesInMultilineCall: false
3660
3907
  AllowParenthesesInChaining: false
3661
3908
  AllowParenthesesInCamelCaseMethod: false
3909
+ AllowParenthesesInStringInterpolation: false
3662
3910
  EnforcedStyle: require_parentheses
3663
3911
  SupportedStyles:
3664
3912
  - require_parentheses
@@ -3779,6 +4027,12 @@ Style/MultilineIfThen:
3779
4027
  VersionAdded: '0.9'
3780
4028
  VersionChanged: '0.26'
3781
4029
 
4030
+ Style/MultilineInPatternThen:
4031
+ Description: 'Do not use `then` for multi-line `in` statement.'
4032
+ StyleGuide: '#no-then'
4033
+ Enabled: true
4034
+ VersionAdded: '1.16'
4035
+
3782
4036
  Style/MultilineMemoization:
3783
4037
  Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3784
4038
  Enabled: true
@@ -3817,6 +4071,7 @@ Style/MultipleComparison:
3817
4071
  Enabled: true
3818
4072
  VersionAdded: '0.49'
3819
4073
  VersionChanged: '1.1'
4074
+ AllowMethodComparison: true
3820
4075
 
3821
4076
  Style/MutableConstant:
3822
4077
  Description: 'Do not assign mutable objects to constants.'
@@ -3950,6 +4205,7 @@ Style/NilLambda:
3950
4205
  Description: 'Prefer `-> {}` to `-> { nil }`.'
3951
4206
  Enabled: true
3952
4207
  VersionAdded: '1.3'
4208
+ VersionChanged: '1.15'
3953
4209
 
3954
4210
  Style/NonNilCheck:
3955
4211
  Description: 'Checks for redundant nil checks.'
@@ -3972,6 +4228,21 @@ Style/Not:
3972
4228
  VersionAdded: '0.9'
3973
4229
  VersionChanged: '0.20'
3974
4230
 
4231
+ Style/NumberedParameters:
4232
+ Description: 'Restrict the usage of numbered parameters.'
4233
+ Enabled: pending
4234
+ VersionAdded: '1.22'
4235
+ EnforcedStyle: allow_single_line
4236
+ SupportedStyles:
4237
+ - allow_single_line
4238
+ - disallow
4239
+
4240
+ Style/NumberedParametersLimit:
4241
+ Description: 'Avoid excessive numbered params in a single block.'
4242
+ Enabled: pending
4243
+ VersionAdded: '1.22'
4244
+ Max: 1
4245
+
3975
4246
  Style/NumericLiteralPrefix:
3976
4247
  Description: 'Use smallcase prefixes for numeric literals.'
3977
4248
  StyleGuide: '#numeric-literal-prefixes'
@@ -3982,7 +4253,6 @@ Style/NumericLiteralPrefix:
3982
4253
  - zero_with_o
3983
4254
  - zero_only
3984
4255
 
3985
-
3986
4256
  Style/NumericLiterals:
3987
4257
  Description: >-
3988
4258
  Add underscores to large numeric literals to improve their
@@ -3993,6 +4263,8 @@ Style/NumericLiterals:
3993
4263
  VersionChanged: '0.48'
3994
4264
  MinDigits: 5
3995
4265
  Strict: false
4266
+ # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4267
+ AllowedNumbers: []
3996
4268
 
3997
4269
  Style/NumericPredicate:
3998
4270
  Description: >-
@@ -4027,6 +4299,16 @@ Style/OneLineConditional:
4027
4299
  VersionAdded: '0.9'
4028
4300
  VersionChanged: '0.90'
4029
4301
 
4302
+ Style/OpenStructUse:
4303
+ Description: >-
4304
+ Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4305
+ version compatibility, and potential security issues.
4306
+ Reference:
4307
+ - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4308
+
4309
+ Enabled: pending
4310
+ VersionAdded: '1.23'
4311
+
4030
4312
  Style/OptionHash:
4031
4313
  Description: "Don't use option hashes when you can use keyword arguments."
4032
4314
  Enabled: false
@@ -4039,6 +4321,7 @@ Style/OptionHash:
4039
4321
  - args
4040
4322
  - params
4041
4323
  - parameters
4324
+ Allowlist: []
4042
4325
 
4043
4326
  Style/OptionalArguments:
4044
4327
  Description: >-
@@ -4136,6 +4419,16 @@ Style/Proc:
4136
4419
  VersionAdded: '0.9'
4137
4420
  VersionChanged: '0.18'
4138
4421
 
4422
+ Style/QuotedSymbols:
4423
+ Description: 'Use a consistent style for quoted symbols.'
4424
+ Enabled: true
4425
+ VersionAdded: '1.16'
4426
+ EnforcedStyle: same_as_string_literals
4427
+ SupportedStyles:
4428
+ - same_as_string_literals
4429
+ - single_quotes
4430
+ - double_quotes
4431
+
4139
4432
  Style/RaiseArgs:
4140
4433
  Description: 'Checks the arguments passed to raise/fail.'
4141
4434
  StyleGuide: '#exception-class-messages'
@@ -4281,12 +4574,19 @@ Style/RedundantSelfAssignment:
4281
4574
  Safe: false
4282
4575
  VersionAdded: '0.90'
4283
4576
 
4577
+ Style/RedundantSelfAssignmentBranch:
4578
+ Description: 'Checks for places where conditional branch makes redundant self-assignment.'
4579
+ Enabled: pending
4580
+ VersionAdded: '1.19'
4581
+
4284
4582
  Style/RedundantSort:
4285
4583
  Description: >-
4286
4584
  Use `min` instead of `sort.first`,
4287
4585
  `max_by` instead of `sort_by...last`, etc.
4288
4586
  Enabled: true
4289
4587
  VersionAdded: '0.76'
4588
+ VersionChanged: '1.22'
4589
+ Safe: false
4290
4590
 
4291
4591
  Style/RedundantSortBy:
4292
4592
  Description: 'Use `sort` instead of `sort_by { |x| x }`.'
@@ -4367,6 +4667,12 @@ Style/Sample:
4367
4667
  Enabled: true
4368
4668
  VersionAdded: '0.30'
4369
4669
 
4670
+ Style/SelectByRegexp:
4671
+ Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
4672
+ Enabled: pending
4673
+ SafeAutoCorrect: false
4674
+ VersionAdded: '1.22'
4675
+
4370
4676
  Style/SelfAssignment:
4371
4677
  Description: >-
4372
4678
  Checks for places where self-assignment shorthand should have
@@ -4452,6 +4758,7 @@ Style/SpecialGlobalVars:
4452
4758
  VersionAdded: '0.13'
4453
4759
  VersionChanged: '0.36'
4454
4760
  SafeAutoCorrect: false
4761
+ RequireEnglish: true
4455
4762
  EnforcedStyle: use_english_names
4456
4763
  SupportedStyles:
4457
4764
  - use_perl_names
@@ -4480,13 +4787,21 @@ Style/StderrPuts:
4480
4787
  Enabled: true
4481
4788
  VersionAdded: '0.51'
4482
4789
 
4790
+ Style/StringChars:
4791
+ Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
4792
+ StyleGuide: '#string-chars'
4793
+ Enabled: true
4794
+ Safe: false
4795
+ VersionAdded: '1.12'
4796
+
4483
4797
  Style/StringConcatenation:
4484
4798
  Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4485
4799
  StyleGuide: '#string-interpolation'
4486
4800
  Enabled: true
4487
4801
  Safe: false
4488
4802
  VersionAdded: '0.89'
4489
- VersionChanged: '1.6'
4803
+ VersionChanged: '1.18'
4804
+ Mode: aggressive
4490
4805
 
4491
4806
  Style/StringHashKeys:
4492
4807
  Description: 'Prefer symbols instead of strings as hash keys.'
@@ -4544,8 +4859,9 @@ Style/StructInheritance:
4544
4859
  Description: 'Checks for inheritance from Struct.new.'
4545
4860
  StyleGuide: '#no-extend-struct-new'
4546
4861
  Enabled: false
4862
+ SafeAutoCorrect: false
4547
4863
  VersionAdded: '0.29'
4548
- VersionChanged: '0.86'
4864
+ VersionChanged: '1.20'
4549
4865
 
4550
4866
  Style/SwapValues:
4551
4867
  Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
@@ -4577,6 +4893,7 @@ Style/SymbolProc:
4577
4893
  Safe: false
4578
4894
  VersionAdded: '0.26'
4579
4895
  VersionChanged: '1.5'
4896
+ AllowMethodsWithArguments: false
4580
4897
  # A list of method names to be ignored by the check.
4581
4898
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4582
4899
  IgnoredMethods:
@@ -4595,6 +4912,12 @@ Style/TernaryParentheses:
4595
4912
  - require_parentheses_when_complex
4596
4913
  AllowSafeAssignment: true
4597
4914
 
4915
+ Style/TopLevelMethodDefinition:
4916
+ Description: 'This cop looks for top-level method definitions.'
4917
+ StyleGuide: '#top-level-methods'
4918
+ Enabled: false
4919
+ VersionAdded: '1.15'
4920
+
4598
4921
  Style/TrailingBodyOnClass:
4599
4922
  Description: 'Class body goes below class statement.'
4600
4923
  Enabled: true
@@ -4681,7 +5004,7 @@ Style/TrivialAccessors:
4681
5004
  StyleGuide: '#attr_family'
4682
5005
  Enabled: false
4683
5006
  VersionAdded: '0.9'
4684
- VersionChanged: '0.77'
5007
+ VersionChanged: '1.15'
4685
5008
  # When set to `false` the cop will suggest the use of accessor methods
4686
5009
  # in situations like:
4687
5010
  #
@@ -4729,6 +5052,16 @@ Style/UnlessElse:
4729
5052
  Enabled: true
4730
5053
  VersionAdded: '0.9'
4731
5054
 
5055
+ Style/UnlessLogicalOperators:
5056
+ Description: >-
5057
+ Checks for use of logical operators in an unless condition.
5058
+ Enabled: false
5059
+ VersionAdded: '1.11'
5060
+ EnforcedStyle: forbid_mixed_logical_operators
5061
+ SupportedStyles:
5062
+ - forbid_mixed_logical_operators
5063
+ - forbid_logical_operators
5064
+
4732
5065
  Style/UnpackFirst:
4733
5066
  Description: >-
4734
5067
  Checks for accessing the first element of `String#unpack`
@@ -4747,7 +5080,7 @@ Style/VariableInterpolation:
4747
5080
 
4748
5081
  Style/WhenThen:
4749
5082
  Description: 'Use when x then ... for one-line cases.'
4750
- StyleGuide: '#one-line-cases'
5083
+ StyleGuide: '#no-when-semicolons'
4751
5084
  Enabled: true
4752
5085
  VersionAdded: '0.9'
4753
5086
 
@@ -4771,7 +5104,7 @@ Style/WordArray:
4771
5104
  StyleGuide: '#percent-w'
4772
5105
  Enabled: false
4773
5106
  VersionAdded: '0.9'
4774
- VersionChanged: '0.36'
5107
+ VersionChanged: '1.19'
4775
5108
  EnforcedStyle: percent
4776
5109
  SupportedStyles:
4777
5110
  # percent style: %w(word1 word2)