ffi-geos 2.2.0 → 2.4.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +49 -0
  3. data/.rubocop-minitest.yml +240 -0
  4. data/.rubocop.yml +497 -111
  5. data/.rubocop_todo.yml +100 -0
  6. data/Gemfile +3 -6
  7. data/MIT-LICENSE +1 -1
  8. data/README.rdoc +2 -0
  9. data/ffi-geos.gemspec +5 -0
  10. data/lib/ffi-geos/buffer_params.rb +1 -1
  11. data/lib/ffi-geos/coordinate_sequence.rb +32 -32
  12. data/lib/ffi-geos/geojson_reader.rb +35 -0
  13. data/lib/ffi-geos/geojson_writer.rb +49 -0
  14. data/lib/ffi-geos/geometry.rb +11 -5
  15. data/lib/ffi-geos/geometry_collection.rb +5 -5
  16. data/lib/ffi-geos/line_string.rb +11 -11
  17. data/lib/ffi-geos/multi_line_string.rb +1 -1
  18. data/lib/ffi-geos/point.rb +4 -4
  19. data/lib/ffi-geos/polygon.rb +5 -5
  20. data/lib/ffi-geos/prepared_geometry.rb +21 -1
  21. data/lib/ffi-geos/strtree.rb +1 -1
  22. data/lib/ffi-geos/version.rb +1 -1
  23. data/lib/ffi-geos/wkb_reader.rb +1 -1
  24. data/lib/ffi-geos/wkb_writer.rb +14 -2
  25. data/lib/ffi-geos/wkt_reader.rb +1 -1
  26. data/lib/ffi-geos/wkt_writer.rb +2 -2
  27. data/lib/ffi-geos.rb +92 -4
  28. data/sonar-project.properties +4 -4
  29. data/test/coordinate_sequence_tests.rb +6 -6
  30. data/test/geojson_reader_tests.rb +170 -0
  31. data/test/geojson_writer_tests.rb +103 -0
  32. data/test/geometry_collection_tests.rb +4 -4
  33. data/test/geometry_tests.rb +75 -32
  34. data/test/line_string_tests.rb +13 -5
  35. data/test/point_tests.rb +3 -3
  36. data/test/polygon_tests.rb +3 -3
  37. data/test/prepared_geometry_tests.rb +30 -0
  38. data/test/strtree_tests.rb +8 -8
  39. data/test/test_helper.rb +43 -12
  40. data/test/wkb_writer_tests.rb +20 -0
  41. metadata +15 -6
  42. data/.travis.yml +0 -32
data/.rubocop.yml CHANGED
@@ -1,3 +1,15 @@
1
+
2
+ inherit_from:
3
+ - .rubocop-minitest.yml
4
+ - .rubocop_todo.yml
5
+
6
+ inherit_mode:
7
+ merge:
8
+ - Exclude
9
+
10
+ require:
11
+ - rubocop-minitest
12
+
1
13
  # Common configuration.
2
14
 
3
15
  AllCops:
@@ -80,6 +92,8 @@ AllCops:
80
92
  # When specifying style guide URLs, any paths and/or fragments will be
81
93
  # evaluated relative to the base URL.
82
94
  StyleGuideBaseURL: https://rubystyle.guide
95
+ # Documentation URLs will be constructed using the base URL.
96
+ DocumentationBaseURL: https://docs.rubocop.org/rubocop
83
97
  # Extra details are not displayed in offense messages by default. Change
84
98
  # behavior by overriding ExtraDetails, or by giving the
85
99
  # `-E/--extra-details` option.
@@ -132,7 +146,7 @@ AllCops:
132
146
  # What MRI version of the Ruby interpreter is the inspected code intended to
133
147
  # run on? (If there is more than one, set this to the lowest version.)
134
148
  # If a value is specified for TargetRubyVersion then it is used. Acceptable
135
- # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
149
+ # values are specified as a float (i.e. 3.0); the teeny version of Ruby
136
150
  # should not be included. If the project specifies a Ruby version in the
137
151
  # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
138
152
  # try to determine the desired version of Ruby by inspecting the
@@ -140,18 +154,13 @@ AllCops:
140
154
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
141
155
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
142
156
  # Ruby version is still unresolved, RuboCop will use the oldest officially
143
- # supported Ruby version (currently Ruby 2.4).
157
+ # supported Ruby version (currently Ruby 2.5).
144
158
  TargetRubyVersion: ~
145
159
  # Determines if a notification for extension libraries should be shown when
146
160
  # rubocop is run. Keys are the name of the extension, and values are an array
147
161
  # of gems in the Gemfile that the extension is suggested for, if not already
148
162
  # included.
149
- SuggestExtensions:
150
- rubocop-rails: [rails]
151
- rubocop-rspec: [rspec, rspec-rails]
152
- rubocop-minitest: [minitest]
153
- rubocop-sequel: [sequel]
154
- rubocop-rake: [rake]
163
+ SuggestExtensions: false
155
164
 
156
165
  #################### Bundler ###############################
157
166
 
@@ -176,6 +185,34 @@ Bundler/GemComment:
176
185
  IgnoredGems: []
177
186
  OnlyFor: []
178
187
 
188
+ Bundler/GemFilename:
189
+ Description: 'Enforces the filename for managing gems.'
190
+ Enabled: true
191
+ VersionAdded: '1.20'
192
+ EnforcedStyle: 'Gemfile'
193
+ SupportedStyles:
194
+ - 'Gemfile'
195
+ - 'gems.rb'
196
+ Include:
197
+ - '**/Gemfile'
198
+ - '**/gems.rb'
199
+ - '**/Gemfile.lock'
200
+ - '**/gems.locked'
201
+
202
+ Bundler/GemVersion:
203
+ Description: 'Requires or forbids specifying gem versions.'
204
+ Enabled: false
205
+ VersionAdded: '1.14'
206
+ EnforcedStyle: 'required'
207
+ SupportedStyles:
208
+ - 'required'
209
+ - 'forbidden'
210
+ Include:
211
+ - '**/*.gemfile'
212
+ - '**/Gemfile'
213
+ - '**/gems.rb'
214
+ AllowedGems: []
215
+
179
216
  Bundler/InsecureProtocolSource:
180
217
  Description: >-
181
218
  The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
@@ -183,6 +220,7 @@ Bundler/InsecureProtocolSource:
183
220
  'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
184
221
  Enabled: true
185
222
  VersionAdded: '0.50'
223
+ AllowHttpProtocol: true
186
224
  Include:
187
225
  - '**/*.gemfile'
188
226
  - '**/Gemfile'
@@ -212,6 +250,25 @@ Gemspec/DateAssignment:
212
250
  Include:
213
251
  - '**/*.gemspec'
214
252
 
253
+ Gemspec/DependencyVersion:
254
+ Description: 'Requires or forbids specifying gem dependency versions.'
255
+ Enabled: false
256
+ VersionAdded: '1.29'
257
+ EnforcedStyle: 'required'
258
+ SupportedStyles:
259
+ - 'required'
260
+ - 'forbidden'
261
+ Include:
262
+ - '**/*.gemspec'
263
+ AllowedGems: []
264
+
265
+ Gemspec/DeprecatedAttributeAssignment:
266
+ Description: Checks that deprecated attribute assignments are not set in a gemspec file.
267
+ Enabled: false
268
+ VersionAdded: '1.30'
269
+ Include:
270
+ - '**/*.gemspec'
271
+
215
272
  Gemspec/DuplicatedAssignment:
216
273
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
217
274
  Enabled: true
@@ -231,11 +288,20 @@ Gemspec/OrderedDependencies:
231
288
  Include:
232
289
  - '**/*.gemspec'
233
290
 
291
+ Gemspec/RequireMFA:
292
+ Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
293
+ Enabled: true
294
+ VersionAdded: '1.23'
295
+ Reference:
296
+ - https://guides.rubygems.org/mfa-requirement-opt-in/
297
+ Include:
298
+ - '**/*.gemspec'
299
+
234
300
  Gemspec/RequiredRubyVersion:
235
301
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
236
302
  Enabled: true
237
303
  VersionAdded: '0.52'
238
- VersionChanged: '0.89'
304
+ VersionChanged: '1.22'
239
305
  Include:
240
306
  - '**/*.gemspec'
241
307
 
@@ -258,8 +324,8 @@ Layout/AccessModifierIndentation:
258
324
  SupportedStyles:
259
325
  - outdent
260
326
  - indent
261
- # By default, the indentation width from Layout/IndentationWidth is used
262
- # But it can be overridden by setting this parameter
327
+ # By default the indentation width from `Layout/IndentationWidth` is used,
328
+ # but it can be overridden by setting this parameter.
263
329
  IndentationWidth: ~
264
330
 
265
331
  Layout/ArgumentAlignment:
@@ -287,8 +353,8 @@ Layout/ArgumentAlignment:
287
353
  SupportedStyles:
288
354
  - with_first_argument
289
355
  - with_fixed_indentation
290
- # By default, the indentation width from Layout/IndentationWidth is used
291
- # But it can be overridden by setting this parameter
356
+ # By default the indentation width from `Layout/IndentationWidth` is used,
357
+ # but it can be overridden by setting this parameter.
292
358
  IndentationWidth: ~
293
359
 
294
360
  Layout/ArrayAlignment:
@@ -316,8 +382,8 @@ Layout/ArrayAlignment:
316
382
  SupportedStyles:
317
383
  - with_first_element
318
384
  - with_fixed_indentation
319
- # By default, the indentation width from Layout/IndentationWidth is used
320
- # But it can be overridden by setting this parameter
385
+ # By default the indentation width from `Layout/IndentationWidth` is used,
386
+ # but it can be overridden by setting this parameter.
321
387
  IndentationWidth: ~
322
388
 
323
389
  Layout/AssignmentIndentation:
@@ -327,8 +393,8 @@ Layout/AssignmentIndentation:
327
393
  Enabled: true
328
394
  VersionAdded: '0.49'
329
395
  VersionChanged: '0.77'
330
- # By default, the indentation width from `Layout/IndentationWidth` is used
331
- # But it can be overridden by setting this parameter
396
+ # By default the indentation width from `Layout/IndentationWidth` is used,
397
+ # but it can be overridden by setting this parameter.
332
398
  IndentationWidth: ~
333
399
 
334
400
  Layout/BeginEndAlignment:
@@ -365,18 +431,19 @@ Layout/BlockEndNewline:
365
431
  VersionAdded: '0.49'
366
432
 
367
433
  Layout/CaseIndentation:
368
- Description: 'Indentation of when in a case/when/[else/]end.'
434
+ Description: 'Indentation of when in a case/(when|in)/[else/]end.'
369
435
  StyleGuide: '#indent-when-to-case'
370
436
  Enabled: true
371
437
  VersionAdded: '0.49'
438
+ VersionChanged: '1.16'
372
439
  EnforcedStyle: end
373
440
  SupportedStyles:
374
441
  - case
375
442
  - end
376
443
  IndentOneStep: true
377
- # By default, the indentation width from `Layout/IndentationWidth` is used.
378
- # But it can be overridden by setting this parameter.
379
- # This only matters if `IndentOneStep` is `true`
444
+ # By default the indentation width from `Layout/IndentationWidth` is used,
445
+ # but it can be overridden by setting this parameter.
446
+ # This only matters if `IndentOneStep` is `true`.
380
447
  IndentationWidth: ~
381
448
 
382
449
  Layout/ClassStructure:
@@ -390,13 +457,13 @@ Layout/ClassStructure:
390
457
  - prepend
391
458
  - extend
392
459
  ExpectedOrder:
393
- - module_inclusion
394
- - constants
395
- - public_class_methods
396
- - initializer
397
- - public_methods
398
- - protected_methods
399
- - private_methods
460
+ - module_inclusion
461
+ - constants
462
+ - public_class_methods
463
+ - initializer
464
+ - public_methods
465
+ - protected_methods
466
+ - private_methods
400
467
 
401
468
  Layout/ClosingHeredocIndentation:
402
469
  Description: 'Checks the indentation of here document closings.'
@@ -411,7 +478,11 @@ Layout/ClosingParenthesisIndentation:
411
478
  Layout/CommentIndentation:
412
479
  Description: 'Indentation of comments.'
413
480
  Enabled: true
481
+ # When true, allows comments to have extra indentation if that aligns them
482
+ # with a comment on the preceding line.
483
+ AllowForAlignment: false
414
484
  VersionAdded: '0.49'
485
+ VersionChanged: '1.24'
415
486
 
416
487
  Layout/ConditionPosition:
417
488
  Description: >-
@@ -483,13 +554,13 @@ Layout/EmptyLineBetweenDefs:
483
554
  StyleGuide: '#empty-lines-between-methods'
484
555
  Enabled: true
485
556
  VersionAdded: '0.49'
486
- VersionChanged: '1.7'
557
+ VersionChanged: '1.23'
487
558
  EmptyLineBetweenMethodDefs: true
488
559
  EmptyLineBetweenClassDefs: true
489
560
  EmptyLineBetweenModuleDefs: true
490
- # If `true`, this parameter means that single line method definitions don't
491
- # need an empty line between them.
492
- AllowAdjacentOneLineDefs: false
561
+ # `AllowAdjacentOneLineDefs` means that single line method definitions don't
562
+ # need an empty line between them. `true` by default.
563
+ AllowAdjacentOneLineDefs: true
493
564
  # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
494
565
  NumberOfEmptyLines: 1
495
566
 
@@ -653,8 +724,8 @@ Layout/FirstArgumentIndentation:
653
724
  # Same as `special_for_inner_method_call` except that the special rule only
654
725
  # applies if the outer method call encloses its arguments in parentheses.
655
726
  - special_for_inner_method_call_in_parentheses
656
- # By default, the indentation width from `Layout/IndentationWidth` is used
657
- # But it can be overridden by setting this parameter
727
+ # By default the indentation width from `Layout/IndentationWidth` is used,
728
+ # but it can be overridden by setting this parameter.
658
729
  IndentationWidth: ~
659
730
 
660
731
  Layout/FirstArrayElementIndentation:
@@ -680,8 +751,8 @@ Layout/FirstArrayElementIndentation:
680
751
  - special_inside_parentheses
681
752
  - consistent
682
753
  - align_brackets
683
- # By default, the indentation width from `Layout/IndentationWidth` is used
684
- # But it can be overridden by setting this parameter
754
+ # By default the indentation width from `Layout/IndentationWidth` is used,
755
+ # but it can be overridden by setting this parameter.
685
756
  IndentationWidth: ~
686
757
 
687
758
  Layout/FirstArrayElementLineBreak:
@@ -712,8 +783,8 @@ Layout/FirstHashElementIndentation:
712
783
  - special_inside_parentheses
713
784
  - consistent
714
785
  - align_braces
715
- # By default, the indentation width from `Layout/IndentationWidth` is used
716
- # But it can be overridden by setting this parameter
786
+ # By default the indentation width from `Layout/IndentationWidth` is used,
787
+ # but it can be overridden by setting this parameter.
717
788
  IndentationWidth: ~
718
789
 
719
790
  Layout/FirstHashElementLineBreak:
@@ -748,8 +819,8 @@ Layout/FirstParameterIndentation:
748
819
  SupportedStyles:
749
820
  - consistent
750
821
  - align_parentheses
751
- # By default, the indentation width from `Layout/IndentationWidth` is used
752
- # But it can be overridden by setting this parameter
822
+ # By default the indentation width from `Layout/IndentationWidth` is used,
823
+ # but it can be overridden by setting this parameter.
753
824
  IndentationWidth: ~
754
825
 
755
826
  Layout/HashAlignment:
@@ -759,7 +830,7 @@ Layout/HashAlignment:
759
830
  Enabled: true
760
831
  AllowMultipleStyles: true
761
832
  VersionAdded: '0.49'
762
- VersionChanged: '0.77'
833
+ VersionChanged: '1.16'
763
834
  # Alignment of entries using hash rocket as separator. Valid values are:
764
835
  #
765
836
  # key - left alignment of keys
@@ -839,7 +910,7 @@ Layout/HeredocArgumentClosingParenthesis:
839
910
  VersionAdded: '0.68'
840
911
 
841
912
  Layout/HeredocIndentation:
842
- Description: 'This cop checks the indentation of the here document bodies.'
913
+ Description: 'Checks the indentation of the here document bodies.'
843
914
  StyleGuide: '#squiggly-heredocs'
844
915
  Enabled: true
845
916
  VersionAdded: '0.49'
@@ -870,9 +941,9 @@ Layout/IndentationStyle:
870
941
  Enabled: true
871
942
  VersionAdded: '0.49'
872
943
  VersionChanged: '0.82'
873
- # By default, the indentation width from Layout/IndentationWidth is used
874
- # But it can be overridden by setting this parameter
875
- # It is used during auto-correction to determine how many spaces should
944
+ # By default the indentation width from `Layout/IndentationWidth` is used,
945
+ # but it can be overridden by setting this parameter.
946
+ # It is used during autocorrection to determine how many spaces should
876
947
  # replace each tab.
877
948
  IndentationWidth: ~
878
949
  EnforcedStyle: spaces
@@ -887,7 +958,8 @@ Layout/IndentationWidth:
887
958
  VersionAdded: '0.49'
888
959
  # Number of spaces for each indentation level.
889
960
  Width: 2
890
- IgnoredPatterns: []
961
+ AllowedPatterns: []
962
+ # IgnoredPatterns: [] # deprecated
891
963
 
892
964
  Layout/InitialIndentation:
893
965
  Description: >-
@@ -910,13 +982,26 @@ Layout/LeadingEmptyLines:
910
982
  VersionAdded: '0.57'
911
983
  VersionChanged: '0.77'
912
984
 
985
+ Layout/LineEndStringConcatenationIndentation:
986
+ Description: >-
987
+ Checks the indentation of the next line after a line that
988
+ ends with a string literal and a backslash.
989
+ Enabled: true
990
+ VersionAdded: '1.18'
991
+ EnforcedStyle: aligned
992
+ SupportedStyles:
993
+ - aligned
994
+ - indented
995
+ # By default the indentation width from `Layout/IndentationWidth` is used,
996
+ # but it can be overridden by setting this parameter.
997
+ IndentationWidth: ~
998
+
913
999
  Layout/LineLength:
914
1000
  Description: 'Checks that line length does not exceed the configured limit.'
915
1001
  StyleGuide: '#max-line-length'
916
1002
  Enabled: true
917
1003
  VersionAdded: '0.25'
918
1004
  VersionChanged: '1.4'
919
- AutoCorrect: true
920
1005
  Max: 300
921
1006
  # To make it possible to copy or click on URIs in the code, we allow lines
922
1007
  # containing a URI to be longer than Max.
@@ -928,10 +1013,11 @@ Layout/LineLength:
928
1013
  # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
929
1014
  # directives like '# rubocop: enable ...' when calculating a line's length.
930
1015
  IgnoreCopDirectives: true
931
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1016
+ # The AllowedPatterns option is a list of !ruby/regexp and/or string
932
1017
  # elements. Strings will be converted to Regexp objects. A line that matches
933
1018
  # any regular expression listed in this option will be ignored by LineLength.
934
- IgnoredPatterns: []
1019
+ AllowedPatterns: []
1020
+ # IgnoredPatterns: []
935
1021
 
936
1022
  Layout/MultilineArrayBraceLayout:
937
1023
  Description: >-
@@ -1040,8 +1126,8 @@ Layout/MultilineMethodCallIndentation:
1040
1126
  - aligned
1041
1127
  - indented
1042
1128
  - indented_relative_to_receiver
1043
- # By default, the indentation width from Layout/IndentationWidth is used
1044
- # But it can be overridden by setting this parameter
1129
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1130
+ # but it can be overridden by setting this parameter.
1045
1131
  IndentationWidth: ~
1046
1132
 
1047
1133
  Layout/MultilineMethodDefinitionBraceLayout:
@@ -1070,8 +1156,8 @@ Layout/MultilineOperationIndentation:
1070
1156
  SupportedStyles:
1071
1157
  - aligned
1072
1158
  - indented
1073
- # By default, the indentation width from `Layout/IndentationWidth` is used
1074
- # But it can be overridden by setting this parameter
1159
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1160
+ # but it can be overridden by setting this parameter.
1075
1161
  IndentationWidth: ~
1076
1162
 
1077
1163
  Layout/ParameterAlignment:
@@ -1099,15 +1185,28 @@ Layout/ParameterAlignment:
1099
1185
  SupportedStyles:
1100
1186
  - with_first_parameter
1101
1187
  - with_fixed_indentation
1102
- # By default, the indentation width from Layout/IndentationWidth is used
1103
- # But it can be overridden by setting this parameter
1188
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1189
+ # but it can be overridden by setting this parameter.
1104
1190
  IndentationWidth: ~
1105
1191
 
1192
+ Layout/RedundantLineBreak:
1193
+ Description: >-
1194
+ Do not break up an expression into multiple lines when it fits
1195
+ on a single line.
1196
+ Enabled: false
1197
+ InspectBlocks: false
1198
+ VersionAdded: '1.13'
1199
+
1106
1200
  Layout/RescueEnsureAlignment:
1107
1201
  Description: 'Align rescues and ensures correctly.'
1108
1202
  Enabled: true
1109
1203
  VersionAdded: '0.49'
1110
1204
 
1205
+ Layout/SingleLineBlockChain:
1206
+ Description: 'Put method call on a separate line if chained to a single line block.'
1207
+ Enabled: false
1208
+ VersionAdded: '1.14'
1209
+
1111
1210
  Layout/SpaceAfterColon:
1112
1211
  Description: 'Use spaces after colons.'
1113
1212
  StyleGuide: '#spaces-operators'
@@ -1286,7 +1385,7 @@ Layout/SpaceInsideBlockBraces:
1286
1385
 
1287
1386
  Layout/SpaceInsideHashLiteralBraces:
1288
1387
  Description: "Use spaces inside hash literal braces - or don't."
1289
- StyleGuide: '#spaces-operators'
1388
+ StyleGuide: '#spaces-braces'
1290
1389
  Enabled: true
1291
1390
  VersionAdded: '0.49'
1292
1391
  EnforcedStyle: space
@@ -1307,10 +1406,11 @@ Layout/SpaceInsideParens:
1307
1406
  StyleGuide: '#spaces-braces'
1308
1407
  Enabled: true
1309
1408
  VersionAdded: '0.49'
1310
- VersionChanged: '0.55'
1409
+ VersionChanged: '1.22'
1311
1410
  EnforcedStyle: no_space
1312
1411
  SupportedStyles:
1313
1412
  - space
1413
+ - compact
1314
1414
  - no_space
1315
1415
 
1316
1416
  Layout/SpaceInsidePercentLiteralDelimiters:
@@ -1382,6 +1482,8 @@ Lint/AmbiguousBlockAssociation:
1382
1482
  StyleGuide: '#syntax'
1383
1483
  Enabled: true
1384
1484
  VersionAdded: '0.48'
1485
+ VersionChanged: '1.13'
1486
+ IgnoredMethods: []
1385
1487
 
1386
1488
  Lint/AmbiguousOperator:
1387
1489
  Description: >-
@@ -1392,6 +1494,20 @@ Lint/AmbiguousOperator:
1392
1494
  VersionAdded: '0.17'
1393
1495
  VersionChanged: '0.83'
1394
1496
 
1497
+ Lint/AmbiguousOperatorPrecedence:
1498
+ Description: >-
1499
+ Checks for expressions containing multiple binary operations with
1500
+ ambiguous precedence.
1501
+ Enabled: true
1502
+ VersionAdded: '1.21'
1503
+
1504
+ Lint/AmbiguousRange:
1505
+ Description: Checks for ranges with ambiguous boundaries.
1506
+ Enabled: true
1507
+ VersionAdded: '1.19'
1508
+ SafeAutoCorrect: false
1509
+ RequireParenthesesForMethodChains: false
1510
+
1395
1511
  Lint/AmbiguousRegexpLiteral:
1396
1512
  Description: >-
1397
1513
  Checks for ambiguous regexp literals in the first argument of
@@ -1422,9 +1538,9 @@ Lint/BinaryOperatorWithIdenticalOperands:
1422
1538
  Lint/BooleanSymbol:
1423
1539
  Description: 'Check for `:true` and `:false` symbols.'
1424
1540
  Enabled: true
1425
- Safe: false
1541
+ SafeAutoCorrect: false
1426
1542
  VersionAdded: '0.50'
1427
- VersionChanged: '0.83'
1543
+ VersionChanged: '1.22'
1428
1544
 
1429
1545
  Lint/CircularArgumentReference:
1430
1546
  Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
@@ -1456,6 +1572,7 @@ Lint/Debugger:
1456
1572
  Enabled: true
1457
1573
  VersionAdded: '0.14'
1458
1574
  VersionChanged: '1.10'
1575
+ #DebuggerReceivers: [] # deprecated
1459
1576
  DebuggerMethods:
1460
1577
  # Groups are available so that a specific group can be disabled in
1461
1578
  # a user's configuration, but are otherwise not significant.
@@ -1469,6 +1586,11 @@ Lint/Debugger:
1469
1586
  Capybara:
1470
1587
  - save_and_open_page
1471
1588
  - save_and_open_screenshot
1589
+ debug.rb:
1590
+ - binding.b
1591
+ - binding.break
1592
+ - Kernel.binding.b
1593
+ - Kernel.binding.break
1472
1594
  Pry:
1473
1595
  - binding.pry
1474
1596
  - binding.remote_pry
@@ -1477,6 +1599,8 @@ Lint/Debugger:
1477
1599
  Rails:
1478
1600
  - debugger
1479
1601
  - Kernel.debugger
1602
+ RubyJard:
1603
+ - jard
1480
1604
  WebConsole:
1481
1605
  - binding.console
1482
1606
 
@@ -1489,6 +1613,7 @@ Lint/DeprecatedConstants:
1489
1613
  Description: 'Checks for deprecated constants.'
1490
1614
  Enabled: true
1491
1615
  VersionAdded: '1.8'
1616
+ VersionChanged: '1.22'
1492
1617
  # You can configure deprecated constants.
1493
1618
  # If there is an alternative method, you can set alternative value as `Alternative`.
1494
1619
  # And you can set the deprecated version as `DeprecatedVersion`.
@@ -1509,6 +1634,9 @@ Lint/DeprecatedConstants:
1509
1634
  'FALSE':
1510
1635
  Alternative: 'false'
1511
1636
  DeprecatedVersion: '2.4'
1637
+ 'Net::HTTPServerException':
1638
+ Alternative: 'Net::HTTPClientException'
1639
+ DeprecatedVersion: '2.6'
1512
1640
  'Random::DEFAULT':
1513
1641
  Alternative: 'Random.new'
1514
1642
  DeprecatedVersion: '3.0'
@@ -1562,7 +1690,9 @@ Lint/DuplicateRegexpCharacterClassElement:
1562
1690
  Lint/DuplicateRequire:
1563
1691
  Description: 'Check for duplicate `require`s and `require_relative`s.'
1564
1692
  Enabled: true
1693
+ SafeAutoCorrect: false
1565
1694
  VersionAdded: '0.90'
1695
+ VersionChanged: '1.28'
1566
1696
 
1567
1697
  Lint/DuplicateRescueException:
1568
1698
  Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
@@ -1581,10 +1711,10 @@ Lint/ElseLayout:
1581
1711
  VersionChanged: '1.2'
1582
1712
 
1583
1713
  Lint/EmptyBlock:
1584
- Description: 'This cop checks for blocks without a body.'
1714
+ Description: 'Checks for blocks without a body.'
1585
1715
  Enabled: true
1586
1716
  VersionAdded: '1.1'
1587
- VersionChanged: '1.3'
1717
+ VersionChanged: '1.15'
1588
1718
  AllowComments: true
1589
1719
  AllowEmptyLambdas: true
1590
1720
 
@@ -1595,7 +1725,7 @@ Lint/EmptyClass:
1595
1725
  AllowComments: false
1596
1726
 
1597
1727
  Lint/EmptyConditionalBody:
1598
- Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1728
+ Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1599
1729
  Enabled: true
1600
1730
  AllowComments: true
1601
1731
  VersionAdded: '0.89'
@@ -1617,6 +1747,12 @@ Lint/EmptyFile:
1617
1747
  AllowComments: true
1618
1748
  VersionAdded: '0.90'
1619
1749
 
1750
+ Lint/EmptyInPattern:
1751
+ Description: 'Checks for the presence of `in` pattern branches without a body.'
1752
+ Enabled: true
1753
+ AllowComments: true
1754
+ VersionAdded: '1.16'
1755
+
1620
1756
  Lint/EmptyInterpolation:
1621
1757
  Description: 'Checks for empty string interpolation.'
1622
1758
  Enabled: true
@@ -1694,6 +1830,13 @@ Lint/ImplicitStringConcatenation:
1694
1830
  Enabled: true
1695
1831
  VersionAdded: '0.36'
1696
1832
 
1833
+ Lint/IncompatibleIoSelectWithFiberScheduler:
1834
+ Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
1835
+ Enabled: true
1836
+ SafeAutoCorrect: false
1837
+ VersionAdded: '1.21'
1838
+ VersionChanged: '1.24'
1839
+
1697
1840
  Lint/IneffectiveAccessModifier:
1698
1841
  Description: >-
1699
1842
  Checks for attempts to use `private` or `protected` to set
@@ -1704,12 +1847,14 @@ Lint/IneffectiveAccessModifier:
1704
1847
  Lint/InheritException:
1705
1848
  Description: 'Avoid inheriting from the `Exception` class.'
1706
1849
  Enabled: true
1850
+ SafeAutoCorrect: false
1707
1851
  VersionAdded: '0.41'
1852
+ VersionChanged: '1.26'
1708
1853
  # The default base class in favour of `Exception`.
1709
- EnforcedStyle: runtime_error
1854
+ EnforcedStyle: standard_error
1710
1855
  SupportedStyles:
1711
- - runtime_error
1712
1856
  - standard_error
1857
+ - runtime_error
1713
1858
 
1714
1859
  Lint/InterpolationCheck:
1715
1860
  Description: 'Raise warning for interpolation in single q strs.'
@@ -1759,8 +1904,8 @@ Lint/MissingCopEnableDirective:
1759
1904
 
1760
1905
  Lint/MissingSuper:
1761
1906
  Description: >-
1762
- This cop checks for the presence of constructors and lifecycle callbacks
1763
- without calls to `super`'.
1907
+ Checks for the presence of constructors and lifecycle callbacks
1908
+ without calls to `super`.
1764
1909
  Enabled: true
1765
1910
  VersionAdded: '0.89'
1766
1911
  VersionChanged: '1.4'
@@ -1775,7 +1920,6 @@ Lint/MultipleComparison:
1775
1920
  Enabled: true
1776
1921
  VersionAdded: '0.47'
1777
1922
  VersionChanged: '1.1'
1778
- AllowMethodComparison: true
1779
1923
 
1780
1924
  Lint/NestedMethodDefinition:
1781
1925
  Description: 'Do not use nested method definitions.'
@@ -1789,7 +1933,7 @@ Lint/NestedPercentLiteral:
1789
1933
  VersionAdded: '0.52'
1790
1934
 
1791
1935
  Lint/NextWithoutAccumulator:
1792
- Description: >-
1936
+ Description: >-
1793
1937
  Do not omit the accumulator when calling `next`
1794
1938
  in a `reduce`/`inject` block.
1795
1939
  Enabled: true
@@ -1900,6 +2044,8 @@ Lint/RedundantDirGlobSort:
1900
2044
  Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1901
2045
  Enabled: true
1902
2046
  VersionAdded: '1.8'
2047
+ VersionChanged: '1.26'
2048
+ SafeAutoCorrect: false
1903
2049
 
1904
2050
  Lint/RedundantRequireStatement:
1905
2051
  Description: 'Checks for unnecessary `require` statement.'
@@ -1943,6 +2089,12 @@ Lint/RedundantWithObject:
1943
2089
  Enabled: true
1944
2090
  VersionAdded: '0.51'
1945
2091
 
2092
+ Lint/RefinementImportMethods:
2093
+ Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
2094
+ Enabled: true
2095
+ SafeAutoCorrect: false
2096
+ VersionAdded: '1.27'
2097
+
1946
2098
  Lint/RegexpAsCondition:
1947
2099
  Description: >-
1948
2100
  Do not use regexp literal as a condition.
@@ -1958,6 +2110,11 @@ Lint/RequireParentheses:
1958
2110
  Enabled: true
1959
2111
  VersionAdded: '0.18'
1960
2112
 
2113
+ Lint/RequireRelativeSelfPath:
2114
+ Description: 'Checks for uses a file requiring itself with `require_relative`.'
2115
+ Enabled: true
2116
+ VersionAdded: '1.22'
2117
+
1961
2118
  Lint/RescueException:
1962
2119
  Description: 'Avoid rescuing the Exception class.'
1963
2120
  StyleGuide: '#no-blind-rescues'
@@ -2064,6 +2221,7 @@ Lint/SymbolConversion:
2064
2221
  Description: 'Checks for unnecessary symbol conversions.'
2065
2222
  Enabled: true
2066
2223
  VersionAdded: '1.9'
2224
+ VersionChanged: '1.16'
2067
2225
  EnforcedStyle: strict
2068
2226
  SupportedStyles:
2069
2227
  - strict
@@ -2075,7 +2233,7 @@ Lint/Syntax:
2075
2233
  VersionAdded: '0.9'
2076
2234
 
2077
2235
  Lint/ToEnumArguments:
2078
- Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2236
+ Description: 'Ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2079
2237
  Enabled: true
2080
2238
  VersionAdded: '1.1'
2081
2239
 
@@ -2085,12 +2243,12 @@ Lint/ToJSON:
2085
2243
  VersionAdded: '0.66'
2086
2244
 
2087
2245
  Lint/TopLevelReturnWithArgument:
2088
- Description: 'This cop detects top level return statements with argument.'
2246
+ Description: 'Detects top level return statements with argument.'
2089
2247
  Enabled: true
2090
2248
  VersionAdded: '0.89'
2091
2249
 
2092
2250
  Lint/TrailingCommaInAttributeDeclaration:
2093
- Description: 'This cop checks for trailing commas in attribute declarations.'
2251
+ Description: 'Checks for trailing commas in attribute declarations.'
2094
2252
  Enabled: true
2095
2253
  VersionAdded: '0.90'
2096
2254
 
@@ -2139,14 +2297,15 @@ Lint/UnreachableCode:
2139
2297
  VersionAdded: '0.9'
2140
2298
 
2141
2299
  Lint/UnreachableLoop:
2142
- Description: 'This cop checks for loops that will have at most one iteration.'
2300
+ Description: 'Checks for loops that will have at most one iteration.'
2143
2301
  Enabled: true
2144
2302
  VersionAdded: '0.89'
2145
2303
  VersionChanged: '1.7'
2146
- IgnoredPatterns:
2304
+ AllowedPatterns:
2147
2305
  # RSpec uses `times` in its message expectations
2148
2306
  # eg. `exactly(2).times`
2149
2307
  - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2308
+ # IgnoredPatterns: [] # deprecated
2150
2309
 
2151
2310
  Lint/UnusedBlockArgument:
2152
2311
  Description: 'Checks for unused block arguments.'
@@ -2197,17 +2356,17 @@ Lint/UselessAssignment:
2197
2356
  Enabled: true
2198
2357
  VersionAdded: '0.11'
2199
2358
 
2200
- Lint/UselessElseWithoutRescue:
2201
- Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2202
- Enabled: true
2203
- VersionAdded: '0.17'
2204
-
2205
2359
  Lint/UselessMethodDefinition:
2206
2360
  Description: 'Checks for useless method definitions.'
2207
2361
  Enabled: true
2208
2362
  VersionAdded: '0.90'
2363
+ VersionChanged: '0.91'
2209
2364
  Safe: false
2210
- AllowComments: true
2365
+
2366
+ Lint/UselessRuby2Keywords:
2367
+ Description: 'Finds unnecessary uses of `ruby2_keywords`.'
2368
+ Enabled: true
2369
+ VersionAdded: '1.23'
2211
2370
 
2212
2371
  Lint/UselessSetterCall:
2213
2372
  Description: 'Checks for useless setter call to a local variable.'
@@ -2255,6 +2414,7 @@ Metrics/BlockLength:
2255
2414
  CountComments: false # count full line comments?
2256
2415
  Max: 50
2257
2416
  CountAsOne: []
2417
+ #ExcludedMethods: [] # deprecated, retained for backwards compatibility
2258
2418
  IgnoredMethods:
2259
2419
  # By default, exclude the `#refine` method, as it tends to have larger
2260
2420
  # associated blocks.
@@ -2300,6 +2460,7 @@ Metrics/MethodLength:
2300
2460
  CountComments: false # count full line comments?
2301
2461
  Max: 50
2302
2462
  CountAsOne: []
2463
+ #ExcludedMethods: [] # deprecated, retained for backwards compatibility
2303
2464
  IgnoredMethods: []
2304
2465
 
2305
2466
  Metrics/ModuleLength:
@@ -2363,6 +2524,17 @@ Naming/BinaryOperatorParameterName:
2363
2524
  VersionAdded: '0.50'
2364
2525
  VersionChanged: '1.2'
2365
2526
 
2527
+ Naming/BlockForwarding:
2528
+ Description: 'Use anonymous block forwarding.'
2529
+ StyleGuide: '#block-forwarding'
2530
+ Enabled: true
2531
+ VersionAdded: '1.24'
2532
+ EnforcedStyle: anonymous
2533
+ SupportedStyles:
2534
+ - anonymous
2535
+ - explicit
2536
+ BlockForwardingName: block
2537
+
2366
2538
  Naming/BlockParameterName:
2367
2539
  Description: >-
2368
2540
  Checks for block parameter names that contain capital letters,
@@ -2400,6 +2572,7 @@ Naming/FileName:
2400
2572
  StyleGuide: '#snake-case-files'
2401
2573
  Enabled: true
2402
2574
  VersionAdded: '0.50'
2575
+ VersionChanged: '1.23'
2403
2576
  # Camel case file names listed in `AllCops:Include` and all file names listed
2404
2577
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2405
2578
  Exclude: []
@@ -2412,6 +2585,13 @@ Naming/FileName:
2412
2585
  # whether each source file's class or module name matches the file name --
2413
2586
  # not whether the nested module hierarchy matches the subdirectory path.
2414
2587
  CheckDefinitionPathHierarchy: true
2588
+ # paths that are considered root directories, for example "lib" in most ruby projects
2589
+ # or "app/models" in rails projects
2590
+ CheckDefinitionPathHierarchyRoots:
2591
+ - lib
2592
+ - spec
2593
+ - test
2594
+ - src
2415
2595
  # If non-`nil`, expect all source file names to match the following regex.
2416
2596
  # Only the file name itself is matched, not the entire file path.
2417
2597
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2482,6 +2662,33 @@ Naming/HeredocDelimiterNaming:
2482
2662
  ForbiddenDelimiters:
2483
2663
  - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2484
2664
 
2665
+ Naming/InclusiveLanguage:
2666
+ Description: 'Recommend the use of inclusive language instead of problematic terms.'
2667
+ Enabled: false
2668
+ VersionAdded: '1.18'
2669
+ VersionChanged: '1.21'
2670
+ CheckIdentifiers: true
2671
+ CheckConstants: true
2672
+ CheckVariables: true
2673
+ CheckStrings: false
2674
+ CheckSymbols: true
2675
+ CheckComments: true
2676
+ CheckFilepaths: true
2677
+ FlaggedTerms:
2678
+ whitelist:
2679
+ Regex: !ruby/regexp '/white[-_\s]?list/'
2680
+ Suggestions:
2681
+ - allowlist
2682
+ - permit
2683
+ blacklist:
2684
+ Regex: !ruby/regexp '/black[-_\s]?list/'
2685
+ Suggestions:
2686
+ - denylist
2687
+ - block
2688
+ slave:
2689
+ WholeWord: true
2690
+ Suggestions: ['replica', 'secondary', 'follower']
2691
+
2485
2692
  Naming/MemoizedInstanceVariableName:
2486
2693
  Description: >-
2487
2694
  Memoized method name should match memo instance variable name.
@@ -2506,11 +2713,12 @@ Naming/MethodName:
2506
2713
  - camelCase
2507
2714
  # Method names matching patterns are always allowed.
2508
2715
  #
2509
- # IgnoredPatterns:
2716
+ # AllowedPatterns:
2510
2717
  # - '\A\s*onSelectionBulkChange\s*'
2511
2718
  # - '\A\s*onSelectionCleared\s*'
2512
2719
  #
2513
- IgnoredPatterns: []
2720
+ AllowedPatterns: []
2721
+ # IgnoredPatterns: [] # deprecated
2514
2722
 
2515
2723
  Naming/MethodParameterName:
2516
2724
  Description: >-
@@ -2586,6 +2794,7 @@ Naming/VariableName:
2586
2794
  - snake_case
2587
2795
  - camelCase
2588
2796
  AllowedIdentifiers: []
2797
+ AllowedPatterns: []
2589
2798
 
2590
2799
  Naming/VariableNumber:
2591
2800
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2607,14 +2816,28 @@ Naming/VariableNumber:
2607
2816
  - rfc822 # Time#rfc822
2608
2817
  - rfc2822 # Time#rfc2822
2609
2818
  - rfc3339 # DateTime.rfc3339
2819
+ AllowedPatterns: []
2610
2820
 
2611
2821
  #################### Security ##############################
2612
2822
 
2823
+ Security/CompoundHash:
2824
+ Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
2825
+ Enabled: true
2826
+ VersionAdded: '1.28'
2827
+
2613
2828
  Security/Eval:
2614
2829
  Description: 'The use of eval represents a serious security risk.'
2615
2830
  Enabled: true
2616
2831
  VersionAdded: '0.47'
2617
2832
 
2833
+ Security/IoMethods:
2834
+ Description: >-
2835
+ Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
2836
+ `IO.foreach`, and `IO.readlines`.
2837
+ Enabled: true
2838
+ Safe: false
2839
+ VersionAdded: '1.22'
2840
+
2618
2841
  Security/JSONLoad:
2619
2842
  Description: >-
2620
2843
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
@@ -2622,10 +2845,9 @@ Security/JSONLoad:
2622
2845
  Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2623
2846
  Enabled: true
2624
2847
  VersionAdded: '0.43'
2625
- VersionChanged: '0.44'
2848
+ VersionChanged: '1.22'
2626
2849
  # Autocorrect here will change to a method that may cause crashes depending
2627
2850
  # on the value of the argument.
2628
- AutoCorrect: false
2629
2851
  SafeAutoCorrect: false
2630
2852
 
2631
2853
  Security/MarshalLoad:
@@ -2691,8 +2913,9 @@ Style/AndOr:
2691
2913
  Description: 'Use &&/|| instead of and/or.'
2692
2914
  StyleGuide: '#no-and-or-or'
2693
2915
  Enabled: true
2916
+ SafeAutoCorrect: false
2694
2917
  VersionAdded: '0.9'
2695
- VersionChanged: '0.25'
2918
+ VersionChanged: '1.21'
2696
2919
  # Whether `and` and `or` are banned only in conditionals (conditionals)
2697
2920
  # or completely (always).
2698
2921
  EnforcedStyle: conditionals
@@ -2728,7 +2951,7 @@ Style/AsciiComments:
2728
2951
  StyleGuide: '#english-comments'
2729
2952
  Enabled: true
2730
2953
  VersionAdded: '0.9'
2731
- VersionChanged: '0.52'
2954
+ VersionChanged: '1.21'
2732
2955
  AllowedChars:
2733
2956
  - ©
2734
2957
 
@@ -2890,7 +3113,7 @@ Style/CaseEquality:
2890
3113
  Enabled: true
2891
3114
  VersionAdded: '0.9'
2892
3115
  VersionChanged: '0.89'
2893
- # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
3116
+ # If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
2894
3117
  # the case equality operator is a constant.
2895
3118
  #
2896
3119
  # # bad
@@ -2901,7 +3124,7 @@ Style/CaseEquality:
2901
3124
  AllowOnConstant: false
2902
3125
 
2903
3126
  Style/CaseLikeIf:
2904
- Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
3127
+ Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2905
3128
  StyleGuide: '#case-vs-if-else'
2906
3129
  Enabled: true
2907
3130
  Safe: false
@@ -2975,7 +3198,7 @@ Style/ClassMethodsDefinitions:
2975
3198
  StyleGuide: '#def-self-class-methods'
2976
3199
  Enabled: false
2977
3200
  VersionAdded: '0.89'
2978
- EnforcedStyle: def_self
3201
+ EnforcedStyle: def_self
2979
3202
  SupportedStyles:
2980
3203
  - def_self
2981
3204
  - self_class
@@ -3065,7 +3288,7 @@ Style/CommentAnnotation:
3065
3288
  StyleGuide: '#annotate-keywords'
3066
3289
  Enabled: true
3067
3290
  VersionAdded: '0.10'
3068
- VersionChanged: '1.3'
3291
+ VersionChanged: '1.20'
3069
3292
  Keywords:
3070
3293
  - TODO
3071
3294
  - FIXME
@@ -3073,12 +3296,14 @@ Style/CommentAnnotation:
3073
3296
  - HACK
3074
3297
  - REVIEW
3075
3298
  - NOTE
3299
+ RequireColon: true
3076
3300
 
3077
3301
  Style/CommentedKeyword:
3078
3302
  Description: 'Do not place comments on the same line as certain keywords.'
3079
3303
  Enabled: true
3304
+ SafeAutoCorrect: false
3080
3305
  VersionAdded: '0.51'
3081
- VersionChanged: '1.7'
3306
+ VersionChanged: '1.19'
3082
3307
 
3083
3308
  Style/ConditionalAssignment:
3084
3309
  Description: >-
@@ -3294,6 +3519,12 @@ Style/EndlessMethod:
3294
3519
  - allow_always
3295
3520
  - disallow
3296
3521
 
3522
+ Style/EnvHome:
3523
+ Description: "Checks for consistent usage of `ENV['HOME']`."
3524
+ Enabled: true
3525
+ Safe: false
3526
+ VersionAdded: '1.29'
3527
+
3297
3528
  Style/EvalWithLocation:
3298
3529
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3299
3530
  Enabled: true
@@ -3331,6 +3562,28 @@ Style/ExponentialNotation:
3331
3562
  - engineering
3332
3563
  - integral
3333
3564
 
3565
+ Style/FetchEnvVar:
3566
+ Description: >-
3567
+ Suggests `ENV.fetch` for the replacement of `ENV[]`.
3568
+ Reference:
3569
+ - https://rubystyle.guide/#hash-fetch-defaults
3570
+ Enabled: true
3571
+ VersionAdded: '1.28'
3572
+ # Environment variables to be excluded from the inspection.
3573
+ AllowedVars: []
3574
+
3575
+ Style/FileRead:
3576
+ Description: 'Favor `File.(bin)read` convenience methods.'
3577
+ StyleGuide: '#file-read'
3578
+ Enabled: true
3579
+ VersionAdded: '1.24'
3580
+
3581
+ Style/FileWrite:
3582
+ Description: 'Favor `File.(bin)write` convenience methods.'
3583
+ StyleGuide: '#file-write'
3584
+ Enabled: true
3585
+ VersionAdded: '1.24'
3586
+
3334
3587
  Style/FloatDivision:
3335
3588
  Description: 'For performing float division, coerce one side only.'
3336
3589
  StyleGuide: '#float-division'
@@ -3350,8 +3603,9 @@ Style/For:
3350
3603
  Description: 'Checks use of for or each in multiline loops.'
3351
3604
  StyleGuide: '#no-for-loops'
3352
3605
  Enabled: true
3606
+ SafeAutoCorrect: false
3353
3607
  VersionAdded: '0.13'
3354
- VersionChanged: '0.59'
3608
+ VersionChanged: '1.26'
3355
3609
  EnforcedStyle: each
3356
3610
  SupportedStyles:
3357
3611
  - each
@@ -3431,10 +3685,11 @@ Style/GuardClause:
3431
3685
  StyleGuide: '#no-nested-conditionals'
3432
3686
  Enabled: true
3433
3687
  VersionAdded: '0.20'
3434
- VersionChanged: '0.22'
3688
+ VersionChanged: '1.28'
3435
3689
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3436
3690
  # needs to have to trigger this cop
3437
3691
  MinBodyLength: 1
3692
+ AllowConsecutiveConditionals: false
3438
3693
 
3439
3694
  Style/HashAsLastArrayItem:
3440
3695
  Description: >-
@@ -3450,6 +3705,7 @@ Style/HashAsLastArrayItem:
3450
3705
 
3451
3706
  Style/HashConversion:
3452
3707
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3708
+ StyleGuide: '#avoid-hash-constructor'
3453
3709
  Enabled: true
3454
3710
  VersionAdded: '1.10'
3455
3711
  VersionChanged: '1.11'
@@ -3459,8 +3715,10 @@ Style/HashEachMethods:
3459
3715
  Description: 'Use Hash#each_key and Hash#each_value.'
3460
3716
  StyleGuide: '#hash-each'
3461
3717
  Enabled: true
3462
- VersionAdded: '0.80'
3463
3718
  Safe: false
3719
+ VersionAdded: '0.80'
3720
+ VersionChanged: '1.16'
3721
+ AllowedReceivers: []
3464
3722
 
3465
3723
  Style/HashExcept:
3466
3724
  Description: >-
@@ -3486,7 +3744,7 @@ Style/HashSyntax:
3486
3744
  StyleGuide: '#hash-literals'
3487
3745
  Enabled: true
3488
3746
  VersionAdded: '0.9'
3489
- VersionChanged: '0.43'
3747
+ VersionChanged: '1.24'
3490
3748
  EnforcedStyle: ruby19
3491
3749
  SupportedStyles:
3492
3750
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -3497,6 +3755,15 @@ Style/HashSyntax:
3497
3755
  - no_mixed_keys
3498
3756
  # enforces both ruby19 and no_mixed_keys styles
3499
3757
  - ruby19_no_mixed_keys
3758
+ # Force hashes that have a hash value omission
3759
+ EnforcedShorthandSyntax: always
3760
+ SupportedShorthandSyntax:
3761
+ # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3762
+ - always
3763
+ # forces use of explicit hash literal value.
3764
+ - never
3765
+ # accepts both shorthand and explicit use of hash literal value.
3766
+ - either
3500
3767
  # Force hashes that have a symbol value to use hash rockets
3501
3768
  UseHashRocketsWithSymbolValues: false
3502
3769
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3522,7 +3789,9 @@ Style/IdenticalConditionalBranches:
3522
3789
  line at the end of each branch, which can validly be moved
3523
3790
  out of the conditional.
3524
3791
  Enabled: true
3792
+ SafeAutoCorrect: false
3525
3793
  VersionAdded: '0.36'
3794
+ VersionChanged: '1.19'
3526
3795
 
3527
3796
  Style/IfInsideElse:
3528
3797
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
@@ -3569,10 +3838,16 @@ Style/ImplicitRuntimeError:
3569
3838
  Enabled: false
3570
3839
  VersionAdded: '0.41'
3571
3840
 
3841
+ Style/InPatternThen:
3842
+ Description: 'Checks for `in;` uses in `case` expressions.'
3843
+ StyleGuide: '#no-in-pattern-semicolons'
3844
+ Enabled: true
3845
+ VersionAdded: '1.16'
3846
+
3572
3847
  Style/InfiniteLoop:
3573
3848
  Description: >-
3574
3849
  Use Kernel#loop for infinite loops.
3575
- This cop is unsafe in the body may raise a `StopIteration` exception.
3850
+ This cop is unsafe if the body may raise a `StopIteration` exception.
3576
3851
  Safe: false
3577
3852
  StyleGuide: '#infinite-loop'
3578
3853
  Enabled: true
@@ -3603,8 +3878,8 @@ Style/InverseMethods:
3603
3878
  :>: :<=
3604
3879
  # `ActiveSupport` defines some common inverse methods. They are listed below,
3605
3880
  # and not enabled by default.
3606
- #:present?: :blank?,
3607
- #:include?: :exclude?
3881
+ # :present?: :blank?,
3882
+ # :include?: :exclude?
3608
3883
  # `InverseBlocks` are methods that are inverted by inverting the return
3609
3884
  # of the block that is passed to the method
3610
3885
  InverseBlocks:
@@ -3665,6 +3940,17 @@ Style/LineEndConcatenation:
3665
3940
  VersionAdded: '0.18'
3666
3941
  VersionChanged: '0.64'
3667
3942
 
3943
+ Style/MapCompactWithConditionalBlock:
3944
+ Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
3945
+ Enabled: true
3946
+ VersionAdded: '1.30'
3947
+
3948
+ Style/MapToHash:
3949
+ Description: 'Prefer `to_h` with a block over `map.to_h`.'
3950
+ Enabled: true
3951
+ VersionAdded: '1.24'
3952
+ Safe: false
3953
+
3668
3954
  Style/MethodCallWithArgsParentheses:
3669
3955
  Description: 'Use parentheses for method calls with arguments.'
3670
3956
  StyleGuide: '#method-invocation-parens'
@@ -3673,7 +3959,8 @@ Style/MethodCallWithArgsParentheses:
3673
3959
  VersionChanged: '1.7'
3674
3960
  IgnoreMacros: true
3675
3961
  IgnoredMethods: []
3676
- IgnoredPatterns: []
3962
+ AllowedPatterns: []
3963
+ # IgnoredPatterns: [] # deprecated
3677
3964
  IncludedMacros: []
3678
3965
  AllowParenthesesInMultilineCall: false
3679
3966
  AllowParenthesesInChaining: false
@@ -3797,6 +4084,12 @@ Style/MultilineIfThen:
3797
4084
  VersionAdded: '0.9'
3798
4085
  VersionChanged: '0.26'
3799
4086
 
4087
+ Style/MultilineInPatternThen:
4088
+ Description: 'Do not use `then` for multi-line `in` statement.'
4089
+ StyleGuide: '#no-then'
4090
+ Enabled: true
4091
+ VersionAdded: '1.16'
4092
+
3800
4093
  Style/MultilineMemoization:
3801
4094
  Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3802
4095
  Enabled: true
@@ -3835,6 +4128,7 @@ Style/MultipleComparison:
3835
4128
  Enabled: true
3836
4129
  VersionAdded: '0.49'
3837
4130
  VersionChanged: '1.1'
4131
+ AllowMethodComparison: true
3838
4132
 
3839
4133
  Style/MutableConstant:
3840
4134
  Description: 'Do not assign mutable objects to constants.'
@@ -3872,7 +4166,7 @@ Style/NegatedIf:
3872
4166
 
3873
4167
  Style/NegatedIfElseCondition:
3874
4168
  Description: >-
3875
- This cop checks for uses of `if-else` and ternary operators with a negated condition
4169
+ Checks for uses of `if-else` and ternary operators with a negated condition
3876
4170
  which can be simplified by inverting condition and swapping branches.
3877
4171
  Enabled: true
3878
4172
  VersionAdded: '1.2'
@@ -3897,6 +4191,11 @@ Style/NegatedWhile:
3897
4191
  Enabled: true
3898
4192
  VersionAdded: '0.20'
3899
4193
 
4194
+ Style/NestedFileDirname:
4195
+ Description: 'Checks for nested `File.dirname`.'
4196
+ Enabled: true
4197
+ VersionAdded: '1.26'
4198
+
3900
4199
  Style/NestedModifier:
3901
4200
  Description: 'Avoid using nested modifiers.'
3902
4201
  StyleGuide: '#no-nested-modifiers'
@@ -3968,6 +4267,7 @@ Style/NilLambda:
3968
4267
  Description: 'Prefer `-> {}` to `-> { nil }`.'
3969
4268
  Enabled: true
3970
4269
  VersionAdded: '1.3'
4270
+ VersionChanged: '1.15'
3971
4271
 
3972
4272
  Style/NonNilCheck:
3973
4273
  Description: 'Checks for redundant nil checks.'
@@ -3990,6 +4290,21 @@ Style/Not:
3990
4290
  VersionAdded: '0.9'
3991
4291
  VersionChanged: '0.20'
3992
4292
 
4293
+ Style/NumberedParameters:
4294
+ Description: 'Restrict the usage of numbered parameters.'
4295
+ Enabled: true
4296
+ VersionAdded: '1.22'
4297
+ EnforcedStyle: allow_single_line
4298
+ SupportedStyles:
4299
+ - allow_single_line
4300
+ - disallow
4301
+
4302
+ Style/NumberedParametersLimit:
4303
+ Description: 'Avoid excessive numbered params in a single block.'
4304
+ Enabled: true
4305
+ VersionAdded: '1.22'
4306
+ Max: 1
4307
+
3993
4308
  Style/NumericLiteralPrefix:
3994
4309
  Description: 'Use smallcase prefixes for numeric literals.'
3995
4310
  StyleGuide: '#numeric-literal-prefixes'
@@ -4000,7 +4315,6 @@ Style/NumericLiteralPrefix:
4000
4315
  - zero_with_o
4001
4316
  - zero_only
4002
4317
 
4003
-
4004
4318
  Style/NumericLiterals:
4005
4319
  Description: >-
4006
4320
  Add underscores to large numeric literals to improve their
@@ -4011,6 +4325,8 @@ Style/NumericLiterals:
4011
4325
  VersionChanged: '0.48'
4012
4326
  MinDigits: 5
4013
4327
  Strict: false
4328
+ # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4329
+ AllowedNumbers: []
4014
4330
 
4015
4331
  Style/NumericPredicate:
4016
4332
  Description: >-
@@ -4035,6 +4351,19 @@ Style/NumericPredicate:
4035
4351
  Exclude:
4036
4352
  - 'spec/**/*'
4037
4353
 
4354
+ Style/ObjectThen:
4355
+ Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
4356
+ StyleGuide: '#object-yield-self-vs-object-then'
4357
+ Enabled: true
4358
+ VersionAdded: '1.28'
4359
+ # Use `Object#yield_self` or `Object#then`?
4360
+ # Prefer `Object#yield_self` to `Object#then` (yield_self)
4361
+ # Prefer `Object#then` to `Object#yield_self` (then)
4362
+ EnforcedStyle: 'then'
4363
+ SupportedStyles:
4364
+ - then
4365
+ - yield_self
4366
+
4038
4367
  Style/OneLineConditional:
4039
4368
  Description: >-
4040
4369
  Favor the ternary operator (?:) or multi-line constructs over
@@ -4045,6 +4374,16 @@ Style/OneLineConditional:
4045
4374
  VersionAdded: '0.9'
4046
4375
  VersionChanged: '0.90'
4047
4376
 
4377
+ Style/OpenStructUse:
4378
+ Description: >-
4379
+ Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
4380
+ version compatibility, and potential security issues.
4381
+ Reference:
4382
+ - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4383
+
4384
+ Enabled: true
4385
+ VersionAdded: '1.23'
4386
+
4048
4387
  Style/OptionHash:
4049
4388
  Description: "Don't use option hashes when you can use keyword arguments."
4050
4389
  Enabled: false
@@ -4057,6 +4396,7 @@ Style/OptionHash:
4057
4396
  - args
4058
4397
  - params
4059
4398
  - parameters
4399
+ Allowlist: []
4060
4400
 
4061
4401
  Style/OptionalArguments:
4062
4402
  Description: >-
@@ -4158,6 +4498,16 @@ Style/Proc:
4158
4498
  VersionAdded: '0.9'
4159
4499
  VersionChanged: '0.18'
4160
4500
 
4501
+ Style/QuotedSymbols:
4502
+ Description: 'Use a consistent style for quoted symbols.'
4503
+ Enabled: true
4504
+ VersionAdded: '1.16'
4505
+ EnforcedStyle: same_as_string_literals
4506
+ SupportedStyles:
4507
+ - same_as_string_literals
4508
+ - single_quotes
4509
+ - double_quotes
4510
+
4161
4511
  Style/RaiseArgs:
4162
4512
  Description: 'Checks the arguments passed to raise/fail.'
4163
4513
  StyleGuide: '#exception-class-messages'
@@ -4255,10 +4605,20 @@ Style/RedundantFreeze:
4255
4605
  VersionAdded: '0.34'
4256
4606
  VersionChanged: '0.66'
4257
4607
 
4608
+ Style/RedundantInitialize:
4609
+ Description: 'Checks for redundant `initialize` methods.'
4610
+ Enabled: true
4611
+ Safe: false
4612
+ AllowComments: true
4613
+ VersionAdded: '1.27'
4614
+ VersionChanged: '1.28'
4615
+
4258
4616
  Style/RedundantInterpolation:
4259
4617
  Description: 'Checks for strings that are just an interpolated expression.'
4260
4618
  Enabled: true
4619
+ SafeAutoCorrect: false
4261
4620
  VersionAdded: '0.76'
4621
+ VersionChanged: '1.30'
4262
4622
 
4263
4623
  Style/RedundantParentheses:
4264
4624
  Description: "Checks for parentheses that seem not to serve any purpose."
@@ -4303,12 +4663,19 @@ Style/RedundantSelfAssignment:
4303
4663
  Safe: false
4304
4664
  VersionAdded: '0.90'
4305
4665
 
4666
+ Style/RedundantSelfAssignmentBranch:
4667
+ Description: 'Checks for places where conditional branch makes redundant self-assignment.'
4668
+ Enabled: true
4669
+ VersionAdded: '1.19'
4670
+
4306
4671
  Style/RedundantSort:
4307
4672
  Description: >-
4308
4673
  Use `min` instead of `sort.first`,
4309
4674
  `max_by` instead of `sort_by...last`, etc.
4310
4675
  Enabled: true
4311
4676
  VersionAdded: '0.76'
4677
+ VersionChanged: '1.22'
4678
+ Safe: false
4312
4679
 
4313
4680
  Style/RedundantSortBy:
4314
4681
  Description: 'Use `sort` instead of `sort_by { |x| x }`.'
@@ -4362,14 +4729,14 @@ Style/ReturnNil:
4362
4729
 
4363
4730
  Style/SafeNavigation:
4364
4731
  Description: >-
4365
- This cop transforms usages of a method call safeguarded by
4732
+ Transforms usages of a method call safeguarded by
4366
4733
  a check for the existence of the object to
4367
4734
  safe navigation (`&.`).
4368
- Auto-correction is unsafe as it assumes the object will
4735
+ Autocorrection is unsafe as it assumes the object will
4369
4736
  be `nil` or truthy, but never `false`.
4370
4737
  Enabled: true
4371
4738
  VersionAdded: '0.43'
4372
- VersionChanged: '0.77'
4739
+ VersionChanged: '1.27'
4373
4740
  # Safe navigation may cause a statement to start returning `nil` in addition
4374
4741
  # to whatever it used to return.
4375
4742
  ConvertCodeThatCanStartToReturnNil: false
@@ -4380,6 +4747,8 @@ Style/SafeNavigation:
4380
4747
  - try
4381
4748
  - try!
4382
4749
  SafeAutoCorrect: false
4750
+ # Maximum length of method chains for register an offense.
4751
+ MaxChainLength: 2
4383
4752
 
4384
4753
  Style/Sample:
4385
4754
  Description: >-
@@ -4389,6 +4758,12 @@ Style/Sample:
4389
4758
  Enabled: true
4390
4759
  VersionAdded: '0.30'
4391
4760
 
4761
+ Style/SelectByRegexp:
4762
+ Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
4763
+ Enabled: true
4764
+ SafeAutoCorrect: false
4765
+ VersionAdded: '1.22'
4766
+
4392
4767
  Style/SelfAssignment:
4393
4768
  Description: >-
4394
4769
  Checks for places where self-assignment shorthand should have
@@ -4474,10 +4849,12 @@ Style/SpecialGlobalVars:
4474
4849
  VersionAdded: '0.13'
4475
4850
  VersionChanged: '0.36'
4476
4851
  SafeAutoCorrect: false
4852
+ RequireEnglish: true
4477
4853
  EnforcedStyle: use_english_names
4478
4854
  SupportedStyles:
4479
4855
  - use_perl_names
4480
4856
  - use_english_names
4857
+ - use_builtin_english_names
4481
4858
 
4482
4859
  Style/StabbyLambdaParentheses:
4483
4860
  Description: 'Check for the usage of parentheses around stabby lambda arguments.'
@@ -4515,7 +4892,8 @@ Style/StringConcatenation:
4515
4892
  Enabled: true
4516
4893
  Safe: false
4517
4894
  VersionAdded: '0.89'
4518
- VersionChanged: '1.6'
4895
+ VersionChanged: '1.18'
4896
+ Mode: aggressive
4519
4897
 
4520
4898
  Style/StringHashKeys:
4521
4899
  Description: 'Prefer symbols instead of strings as hash keys.'
@@ -4573,11 +4951,12 @@ Style/StructInheritance:
4573
4951
  Description: 'Checks for inheritance from Struct.new.'
4574
4952
  StyleGuide: '#no-extend-struct-new'
4575
4953
  Enabled: true
4954
+ SafeAutoCorrect: false
4576
4955
  VersionAdded: '0.29'
4577
- VersionChanged: '0.86'
4956
+ VersionChanged: '1.20'
4578
4957
 
4579
4958
  Style/SwapValues:
4580
- Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
4959
+ Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
4581
4960
  StyleGuide: '#values-swapping'
4582
4961
  Enabled: true
4583
4962
  VersionAdded: '1.1'
@@ -4605,13 +4984,14 @@ Style/SymbolProc:
4605
4984
  Enabled: true
4606
4985
  Safe: false
4607
4986
  VersionAdded: '0.26'
4608
- VersionChanged: '1.5'
4987
+ VersionChanged: '1.28'
4609
4988
  AllowMethodsWithArguments: false
4610
4989
  # A list of method names to be ignored by the check.
4611
4990
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4612
4991
  IgnoredMethods:
4613
4992
  - respond_to
4614
4993
  - define_method
4994
+ AllowComments: false
4615
4995
 
4616
4996
  Style/TernaryParentheses:
4617
4997
  Description: 'Checks for use of parentheses around ternary conditions.'
@@ -4625,6 +5005,12 @@ Style/TernaryParentheses:
4625
5005
  - require_parentheses_when_complex
4626
5006
  AllowSafeAssignment: true
4627
5007
 
5008
+ Style/TopLevelMethodDefinition:
5009
+ Description: 'Looks for top-level method definitions.'
5010
+ StyleGuide: '#top-level-methods'
5011
+ Enabled: false
5012
+ VersionAdded: '1.15'
5013
+
4628
5014
  Style/TrailingBodyOnClass:
4629
5015
  Description: 'Class body goes below class statement.'
4630
5016
  Enabled: true
@@ -4711,7 +5097,7 @@ Style/TrivialAccessors:
4711
5097
  StyleGuide: '#attr_family'
4712
5098
  Enabled: true
4713
5099
  VersionAdded: '0.9'
4714
- VersionChanged: '0.77'
5100
+ VersionChanged: '1.15'
4715
5101
  # When set to `false` the cop will suggest the use of accessor methods
4716
5102
  # in situations like:
4717
5103
  #
@@ -4730,7 +5116,7 @@ Style/TrivialAccessors:
4730
5116
  # on_exception :restart
4731
5117
  #
4732
5118
  # Commonly used in DSLs
4733
- AllowDSLWriters: false
5119
+ AllowDSLWriters: true
4734
5120
  IgnoreClassMethods: false
4735
5121
  AllowedMethods:
4736
5122
  - to_ary
@@ -4787,7 +5173,7 @@ Style/VariableInterpolation:
4787
5173
 
4788
5174
  Style/WhenThen:
4789
5175
  Description: 'Use when x then ... for one-line cases.'
4790
- StyleGuide: '#one-line-cases'
5176
+ StyleGuide: '#no-when-semicolons'
4791
5177
  Enabled: true
4792
5178
  VersionAdded: '0.9'
4793
5179
 
@@ -4811,7 +5197,7 @@ Style/WordArray:
4811
5197
  StyleGuide: '#percent-w'
4812
5198
  Enabled: false
4813
5199
  VersionAdded: '0.9'
4814
- VersionChanged: '0.36'
5200
+ VersionChanged: '1.19'
4815
5201
  EnforcedStyle: percent
4816
5202
  SupportedStyles:
4817
5203
  # percent style: %w(word1 word2)