ffi-geos 2.3.1 → 2.5.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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +2 -2
  3. data/.rbenv-vars +1 -0
  4. data/.rubocop-minitest.yml +40 -17
  5. data/.rubocop.yml +664 -120
  6. data/.rubocop_todo.yml +30 -19
  7. data/MIT-LICENSE +1 -1
  8. data/README.rdoc +2 -0
  9. data/ffi-geos.gemspec +2 -2
  10. data/lib/ffi-geos/coordinate_sequence.rb +2 -1
  11. data/lib/ffi-geos/geojson_reader.rb +35 -0
  12. data/lib/ffi-geos/geojson_writer.rb +49 -0
  13. data/lib/ffi-geos/geometry.rb +101 -1
  14. data/lib/ffi-geos/geometry_collection.rb +1 -1
  15. data/lib/ffi-geos/line_string.rb +1 -1
  16. data/lib/ffi-geos/point.rb +9 -0
  17. data/lib/ffi-geos/polygon.rb +1 -1
  18. data/lib/ffi-geos/prepared_geometry.rb +20 -0
  19. data/lib/ffi-geos/version.rb +1 -1
  20. data/lib/ffi-geos/wkb_writer.rb +12 -0
  21. data/lib/ffi-geos.rb +156 -3
  22. data/test/coordinate_sequence_tests.rb +22 -4
  23. data/test/geojson_reader_tests.rb +174 -0
  24. data/test/geojson_writer_tests.rb +103 -0
  25. data/test/geometry/area_tests.rb +18 -0
  26. data/test/geometry/boundary_tests.rb +36 -0
  27. data/test/geometry/buffer_tests.rb +116 -0
  28. data/test/geometry/build_area_tests.rb +20 -0
  29. data/test/geometry/centroid_tests.rb +37 -0
  30. data/test/geometry/clip_by_rect_tests.rb +56 -0
  31. data/test/geometry/clone_tests.rb +29 -0
  32. data/test/geometry/concave_hull_of_polygons_tests.rb +28 -0
  33. data/test/geometry/concave_hull_tests.rb +38 -0
  34. data/test/geometry/convex_hull_tests.rb +26 -0
  35. data/test/geometry/coord_seq_tests.rb +27 -0
  36. data/test/geometry/delaunay_triangulation_tests.rb +82 -0
  37. data/test/geometry/densify_tests.rb +95 -0
  38. data/test/geometry/difference_tests.rb +108 -0
  39. data/test/geometry/dimensions_tests.rb +46 -0
  40. data/test/geometry/distance_tests.rb +29 -0
  41. data/test/geometry/dump_points_tests.rb +60 -0
  42. data/test/geometry/dup_tests.rb +29 -0
  43. data/test/geometry/empty_tests.rb +23 -0
  44. data/test/geometry/envelope_tests.rb +26 -0
  45. data/test/geometry/equal_identical_tests.rb +78 -0
  46. data/test/geometry/equal_tests.rb +62 -0
  47. data/test/geometry/exterior_ring_tests.rb +27 -0
  48. data/test/geometry/extract_unique_points_tests.rb +41 -0
  49. data/test/geometry/frecet_distance_tests.rb +24 -0
  50. data/test/geometry/get_geometry_n_tests.rb +21 -0
  51. data/test/geometry/hausdorff_distance_tests.rb +46 -0
  52. data/test/geometry/hilbert_code_tests.rb +45 -0
  53. data/test/geometry/interior_ring_n_tests.rb +64 -0
  54. data/test/geometry/interior_rings_tests.rb +36 -0
  55. data/test/geometry/interpolate_tests.rb +49 -0
  56. data/test/geometry/intersection_tests.rb +49 -0
  57. data/test/geometry/largest_empty_circle_tests.rb +26 -0
  58. data/test/geometry/length_tests.rb +18 -0
  59. data/test/geometry/line_merge_directed_tests.rb +28 -0
  60. data/test/geometry/line_merge_tests.rb +25 -0
  61. data/test/geometry/line_string_enumerator_tests.rb +20 -0
  62. data/test/geometry/line_substring_tests.rb +76 -0
  63. data/test/geometry/make_valid_tests.rb +27 -0
  64. data/test/geometry/maximum_inscribed_circle_tests.rb +21 -0
  65. data/test/geometry/minimum_bounding_circle_tests.rb +23 -0
  66. data/test/geometry/minimum_clearance_tests.rb +58 -0
  67. data/test/geometry/minimum_rotated_rectangle_tests.rb +28 -0
  68. data/test/geometry/minimum_width_tests.rb +26 -0
  69. data/test/geometry/misc_tests.rb +24 -0
  70. data/test/geometry/nearest_points_tests.rb +46 -0
  71. data/test/geometry/node_tests.rb +22 -0
  72. data/test/geometry/normalize_tests.rb +34 -0
  73. data/test/geometry/num_coordinates_tests.rb +39 -0
  74. data/test/geometry/num_goemetries_tests.rb +35 -0
  75. data/test/geometry/num_interior_rings_tests.rb +28 -0
  76. data/test/geometry/orient_polygons_tests.rb +101 -0
  77. data/test/geometry/point_on_surface_tests.rb +37 -0
  78. data/test/geometry/polygon_hull_simplify_tests.rb +55 -0
  79. data/test/geometry/polygonize_tests.rb +173 -0
  80. data/test/geometry/precision_tests.rb +42 -0
  81. data/test/geometry/project_tests.rb +56 -0
  82. data/test/geometry/relate_tests.rb +73 -0
  83. data/test/geometry/relationships_tests.rb +138 -0
  84. data/test/geometry/reverse_tests.rb +44 -0
  85. data/test/geometry/ring_tests.rb +18 -0
  86. data/test/geometry/shared_path_tests.rb +31 -0
  87. data/test/geometry/simple_tests.rb +18 -0
  88. data/test/geometry/simplify_tests.rb +21 -0
  89. data/test/geometry/snap_tests.rb +20 -0
  90. data/test/geometry/srid_copy_policy_tests.rb +94 -0
  91. data/test/geometry/start_and_end_point_tests.rb +24 -0
  92. data/test/geometry/sym_difference_tests.rb +114 -0
  93. data/test/geometry/topology_preserve_simplify_tests.rb +21 -0
  94. data/test/geometry/union_tests.rb +216 -0
  95. data/test/geometry/valid_tests.rb +56 -0
  96. data/test/geometry/voronoi_diagram_tests.rb +62 -0
  97. data/test/geometry_collection_tests.rb +14 -2
  98. data/test/interrupt_tests.rb +1 -1
  99. data/test/line_string_tests.rb +24 -3
  100. data/test/misc_tests.rb +1 -1
  101. data/test/point/has_m_tests.rb +43 -0
  102. data/test/point/x_y_z_m_tests.rb +51 -0
  103. data/test/point_tests.rb +25 -3
  104. data/test/polygon_tests.rb +14 -1
  105. data/test/prepared_geometry_tests.rb +31 -0
  106. data/test/strtree_tests.rb +11 -18
  107. data/test/test_helper.rb +2 -0
  108. data/test/tools_tests.rb +7 -0
  109. data/test/utils_tests.rb +14 -3
  110. data/test/wkb_reader_tests.rb +1 -0
  111. data/test/wkb_writer_tests.rb +46 -5
  112. data/test/wkt_reader_tests.rb +2 -0
  113. data/test/wkt_writer_tests.rb +20 -2
  114. metadata +160 -7
  115. data/test/geometry_tests.rb +0 -2096
data/.rubocop.yml CHANGED
@@ -42,6 +42,7 @@ AllCops:
42
42
  - '**/*.rbx'
43
43
  - '**/*.ru'
44
44
  - '**/*.ruby'
45
+ - '**/*.schema'
45
46
  - '**/*.spec'
46
47
  - '**/*.thor'
47
48
  - '**/*.watchr'
@@ -67,18 +68,17 @@ AllCops:
67
68
  - '**/Puppetfile'
68
69
  - '**/Rakefile'
69
70
  - '**/rakefile'
71
+ - '**/Schemafile'
70
72
  - '**/Snapfile'
71
73
  - '**/Steepfile'
72
74
  - '**/Thorfile'
73
75
  - '**/Vagabondfile'
74
76
  - '**/Vagrantfile'
75
77
  Exclude:
76
- - '.bundle/**/*'
77
- - 'node_modules/**/*'
78
78
  - 'tmp/**/*'
79
- - 'vendor/**/*'
80
79
  - '.git/**/*'
81
- - 'stuff/**/*'
80
+ - '.pryrc'
81
+
82
82
  # Default formatter will be used if no `-f/--format` option is given.
83
83
  DefaultFormatter: progress
84
84
  # Cop names are displayed in offense messages by default. Change behavior
@@ -122,7 +122,7 @@ AllCops:
122
122
  # the `--enable-pending-cops` command-line option.
123
123
  # When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
124
124
  # the `--disable-pending-cops` command-line option.
125
- NewCops: pending
125
+ NewCops: enable
126
126
  # Enables the result cache if `true`. Can be overridden by the `--cache` command
127
127
  # line option.
128
128
  UseCache: true
@@ -154,7 +154,7 @@ AllCops:
154
154
  # or gems.locked file. (Although the Ruby version is specified in the Gemfile
155
155
  # or gems.rb file, RuboCop reads the final value from the lock file.) If the
156
156
  # Ruby version is still unresolved, RuboCop will use the oldest officially
157
- # supported Ruby version (currently Ruby 2.5).
157
+ # supported Ruby version (currently Ruby 2.7).
158
158
  TargetRubyVersion: ~
159
159
  # Determines if a notification for extension libraries should be shown when
160
160
  # rubocop is run. Keys are the name of the extension, and values are an array
@@ -167,7 +167,19 @@ AllCops:
167
167
  Bundler/DuplicatedGem:
168
168
  Description: 'Checks for duplicate gem entries in Gemfile.'
169
169
  Enabled: true
170
+ Severity: warning
170
171
  VersionAdded: '0.46'
172
+ VersionChanged: '1.40'
173
+ Include:
174
+ - '**/*.gemfile'
175
+ - '**/Gemfile'
176
+ - '**/gems.rb'
177
+
178
+ Bundler/DuplicatedGroup:
179
+ Description: 'Checks for duplicate group entries in Gemfile.'
180
+ Enabled: true
181
+ Severity: warning
182
+ VersionAdded: '1.56'
171
183
  Include:
172
184
  - '**/*.gemfile'
173
185
  - '**/Gemfile'
@@ -219,7 +231,9 @@ Bundler/InsecureProtocolSource:
219
231
  because HTTP requests are insecure. Please change your source to
220
232
  'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
221
233
  Enabled: true
234
+ Severity: warning
222
235
  VersionAdded: '0.50'
236
+ VersionChanged: '1.40'
223
237
  AllowHttpProtocol: true
224
238
  Include:
225
239
  - '**/*.gemfile'
@@ -243,17 +257,48 @@ Bundler/OrderedGems:
243
257
 
244
258
  #################### Gemspec ###############################
245
259
 
246
- Gemspec/DateAssignment:
247
- Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
260
+ Gemspec/DependencyVersion:
261
+ Description: 'Requires or forbids specifying gem dependency versions.'
262
+ Enabled: false
263
+ VersionAdded: '1.29'
264
+ EnforcedStyle: 'required'
265
+ SupportedStyles:
266
+ - 'required'
267
+ - 'forbidden'
268
+ Include:
269
+ - '**/*.gemspec'
270
+ AllowedGems: []
271
+
272
+ Gemspec/DeprecatedAttributeAssignment:
273
+ Description: Checks that deprecated attribute assignments are not set in a gemspec file.
248
274
  Enabled: true
249
- VersionAdded: '1.10'
275
+ Severity: warning
276
+ VersionAdded: '1.30'
277
+ VersionChanged: '1.40'
278
+ Include:
279
+ - '**/*.gemspec'
280
+
281
+ Gemspec/DevelopmentDependencies:
282
+ Description: Checks that development dependencies are specified in Gemfile rather than gemspec.
283
+ Enabled: true
284
+ VersionAdded: '1.44'
285
+ EnforcedStyle: Gemfile
286
+ SupportedStyles:
287
+ - Gemfile
288
+ - gems.rb
289
+ - gemspec
290
+ AllowedGems: []
250
291
  Include:
251
292
  - '**/*.gemspec'
293
+ - '**/Gemfile'
294
+ - '**/gems.rb'
252
295
 
253
296
  Gemspec/DuplicatedAssignment:
254
297
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
255
298
  Enabled: true
299
+ Severity: warning
256
300
  VersionAdded: '0.52'
301
+ VersionChanged: '1.40'
257
302
  Include:
258
303
  - '**/*.gemspec'
259
304
 
@@ -270,9 +315,11 @@ Gemspec/OrderedDependencies:
270
315
  - '**/*.gemspec'
271
316
 
272
317
  Gemspec/RequireMFA:
273
- Description: 'Checks that the gemspec has metadata to require MFA from RubyGems.'
318
+ Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
274
319
  Enabled: true
320
+ Severity: warning
275
321
  VersionAdded: '1.23'
322
+ VersionChanged: '1.40'
276
323
  Reference:
277
324
  - https://guides.rubygems.org/mfa-requirement-opt-in/
278
325
  Include:
@@ -281,8 +328,9 @@ Gemspec/RequireMFA:
281
328
  Gemspec/RequiredRubyVersion:
282
329
  Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
283
330
  Enabled: true
331
+ Severity: warning
284
332
  VersionAdded: '0.52'
285
- VersionChanged: '1.22'
333
+ VersionChanged: '1.40'
286
334
  Include:
287
335
  - '**/*.gemspec'
288
336
 
@@ -290,7 +338,9 @@ Gemspec/RubyVersionGlobalsUsage:
290
338
  Description: Checks usage of RUBY_VERSION in gemspec.
291
339
  StyleGuide: '#no-ruby-version-in-the-gemspec'
292
340
  Enabled: true
341
+ Severity: warning
293
342
  VersionAdded: '0.72'
343
+ VersionChanged: '1.40'
294
344
  Include:
295
345
  - '**/*.gemspec'
296
346
 
@@ -359,7 +409,7 @@ Layout/ArrayAlignment:
359
409
  #
360
410
  # array = [1, 2, 3,
361
411
  # 4, 5, 6]
362
- EnforcedStyle: with_first_element
412
+ EnforcedStyle: with_fixed_indentation
363
413
  SupportedStyles:
364
414
  - with_first_element
365
415
  - with_fixed_indentation
@@ -373,7 +423,7 @@ Layout/AssignmentIndentation:
373
423
  right-hand-side of a multi-line assignment.
374
424
  Enabled: true
375
425
  VersionAdded: '0.49'
376
- VersionChanged: '0.77'
426
+ VersionChanged: '1.45'
377
427
  # By default the indentation width from `Layout/IndentationWidth` is used,
378
428
  # but it can be overridden by setting this parameter.
379
429
  IndentationWidth: ~
@@ -431,20 +481,22 @@ Layout/ClassStructure:
431
481
  Description: 'Enforces a configured order of definitions within a class body.'
432
482
  StyleGuide: '#consistent-classes'
433
483
  Enabled: false
484
+ SafeAutoCorrect: false
434
485
  VersionAdded: '0.52'
486
+ VersionChanged: '1.53'
435
487
  Categories:
436
488
  module_inclusion:
437
489
  - include
438
490
  - prepend
439
491
  - extend
440
492
  ExpectedOrder:
441
- - module_inclusion
442
- - constants
443
- - public_class_methods
444
- - initializer
445
- - public_methods
446
- - protected_methods
447
- - private_methods
493
+ - module_inclusion
494
+ - constants
495
+ - public_class_methods
496
+ - initializer
497
+ - public_methods
498
+ - protected_methods
499
+ - private_methods
448
500
 
449
501
  Layout/ClosingHeredocIndentation:
450
502
  Description: 'Checks the indentation of here document closings.'
@@ -491,7 +543,7 @@ Layout/DefEndAlignment:
491
543
  Layout/DotPosition:
492
544
  Description: 'Checks the position of the dot in multi-line method calls.'
493
545
  StyleGuide: '#consistent-multi-line-chains'
494
- Enabled: true
546
+ Enabled: false
495
547
  VersionAdded: '0.49'
496
548
  EnforcedStyle: leading
497
549
  SupportedStyles:
@@ -512,7 +564,7 @@ Layout/EmptyComment:
512
564
 
513
565
  Layout/EmptyLineAfterGuardClause:
514
566
  Description: 'Add empty line after guard clause.'
515
- Enabled: true
567
+ Enabled: false
516
568
  VersionAdded: '0.56'
517
569
  VersionChanged: '0.59'
518
570
 
@@ -539,9 +591,11 @@ Layout/EmptyLineBetweenDefs:
539
591
  EmptyLineBetweenMethodDefs: true
540
592
  EmptyLineBetweenClassDefs: true
541
593
  EmptyLineBetweenModuleDefs: true
594
+ # `DefLikeMacros` takes the name of any macro that you want to treat like a def.
595
+ DefLikeMacros: []
542
596
  # `AllowAdjacentOneLineDefs` means that single line method definitions don't
543
597
  # need an empty line between them. `true` by default.
544
- AllowAdjacentOneLineDefs: true
598
+ AllowAdjacentOneLineDefs: false
545
599
  # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
546
600
  NumberOfEmptyLines: 1
547
601
 
@@ -742,6 +796,7 @@ Layout/FirstArrayElementLineBreak:
742
796
  multi-line array.
743
797
  Enabled: false
744
798
  VersionAdded: '0.49'
799
+ AllowMultilineFinalElement: false
745
800
 
746
801
  Layout/FirstHashElementIndentation:
747
802
  Description: 'Checks the indentation of the first key in a hash literal.'
@@ -774,6 +829,7 @@ Layout/FirstHashElementLineBreak:
774
829
  multi-line hash.
775
830
  Enabled: false
776
831
  VersionAdded: '0.49'
832
+ AllowMultilineFinalElement: false
777
833
 
778
834
  Layout/FirstMethodArgumentLineBreak:
779
835
  Description: >-
@@ -781,6 +837,7 @@ Layout/FirstMethodArgumentLineBreak:
781
837
  multi-line method call.
782
838
  Enabled: false
783
839
  VersionAdded: '0.49'
840
+ AllowMultilineFinalElement: false
784
841
 
785
842
  Layout/FirstMethodParameterLineBreak:
786
843
  Description: >-
@@ -788,6 +845,7 @@ Layout/FirstMethodParameterLineBreak:
788
845
  multi-line method parameter definition.
789
846
  Enabled: false
790
847
  VersionAdded: '0.49'
848
+ AllowMultilineFinalElement: false
791
849
 
792
850
  Layout/FirstParameterIndentation:
793
851
  Description: >-
@@ -891,7 +949,7 @@ Layout/HeredocArgumentClosingParenthesis:
891
949
  VersionAdded: '0.68'
892
950
 
893
951
  Layout/HeredocIndentation:
894
- Description: 'This cop checks the indentation of the here document bodies.'
952
+ Description: 'Checks the indentation of the here document bodies.'
895
953
  StyleGuide: '#squiggly-heredocs'
896
954
  Enabled: true
897
955
  VersionAdded: '0.49'
@@ -924,7 +982,7 @@ Layout/IndentationStyle:
924
982
  VersionChanged: '0.82'
925
983
  # By default the indentation width from `Layout/IndentationWidth` is used,
926
984
  # but it can be overridden by setting this parameter.
927
- # It is used during auto-correction to determine how many spaces should
985
+ # It is used during autocorrection to determine how many spaces should
928
986
  # replace each tab.
929
987
  IndentationWidth: ~
930
988
  EnforcedStyle: spaces
@@ -939,7 +997,7 @@ Layout/IndentationWidth:
939
997
  VersionAdded: '0.49'
940
998
  # Number of spaces for each indentation level.
941
999
  Width: 2
942
- IgnoredPatterns: []
1000
+ AllowedPatterns: []
943
1001
 
944
1002
  Layout/InitialIndentation:
945
1003
  Description: >-
@@ -962,6 +1020,27 @@ Layout/LeadingEmptyLines:
962
1020
  VersionAdded: '0.57'
963
1021
  VersionChanged: '0.77'
964
1022
 
1023
+ Layout/LineContinuationLeadingSpace:
1024
+ Description: >-
1025
+ Use trailing spaces instead of leading spaces in strings
1026
+ broken over multiple lines (by a backslash).
1027
+ Enabled: true
1028
+ VersionAdded: '1.31'
1029
+ VersionChanged: '1.45'
1030
+ EnforcedStyle: trailing
1031
+ SupportedStyles:
1032
+ - leading
1033
+ - trailing
1034
+
1035
+ Layout/LineContinuationSpacing:
1036
+ Description: 'Checks the spacing in front of backslash in line continuations.'
1037
+ Enabled: true
1038
+ VersionAdded: '1.31'
1039
+ EnforcedStyle: space
1040
+ SupportedStyles:
1041
+ - space
1042
+ - no_space
1043
+
965
1044
  Layout/LineEndStringConcatenationIndentation:
966
1045
  Description: >-
967
1046
  Checks the indentation of the next line after a line that
@@ -993,10 +1072,10 @@ Layout/LineLength:
993
1072
  # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
994
1073
  # directives like '# rubocop: enable ...' when calculating a line's length.
995
1074
  IgnoreCopDirectives: true
996
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1075
+ # The AllowedPatterns option is a list of !ruby/regexp and/or string
997
1076
  # elements. Strings will be converted to Regexp objects. A line that matches
998
1077
  # any regular expression listed in this option will be ignored by LineLength.
999
- IgnoredPatterns: []
1078
+ AllowedPatterns: []
1000
1079
 
1001
1080
  Layout/MultilineArrayBraceLayout:
1002
1081
  Description: >-
@@ -1020,6 +1099,7 @@ Layout/MultilineArrayLineBreaks:
1020
1099
  starts on a separate line.
1021
1100
  Enabled: false
1022
1101
  VersionAdded: '0.67'
1102
+ AllowMultilineFinalElement: false
1023
1103
 
1024
1104
  Layout/MultilineAssignmentLayout:
1025
1105
  Description: 'Check for a newline after the assignment operator in multi-line assignments.'
@@ -1070,6 +1150,7 @@ Layout/MultilineHashKeyLineBreaks:
1070
1150
  starts on a separate line.
1071
1151
  Enabled: false
1072
1152
  VersionAdded: '0.67'
1153
+ AllowMultilineFinalElement: false
1073
1154
 
1074
1155
  Layout/MultilineMethodArgumentLineBreaks:
1075
1156
  Description: >-
@@ -1077,6 +1158,7 @@ Layout/MultilineMethodArgumentLineBreaks:
1077
1158
  starts on a separate line.
1078
1159
  Enabled: false
1079
1160
  VersionAdded: '0.67'
1161
+ AllowMultilineFinalElement: false
1080
1162
 
1081
1163
  Layout/MultilineMethodCallBraceLayout:
1082
1164
  Description: >-
@@ -1125,6 +1207,14 @@ Layout/MultilineMethodDefinitionBraceLayout:
1125
1207
  - new_line
1126
1208
  - same_line
1127
1209
 
1210
+ Layout/MultilineMethodParameterLineBreaks:
1211
+ Description: >-
1212
+ Checks that each parameter in a multi-line method definition
1213
+ starts on a separate line.
1214
+ Enabled: false
1215
+ VersionAdded: '1.32'
1216
+ AllowMultilineFinalElement: false
1217
+
1128
1218
  Layout/MultilineOperationIndentation:
1129
1219
  Description: >-
1130
1220
  Checks indentation of binary operations that span more than
@@ -1263,6 +1353,10 @@ Layout/SpaceAroundOperators:
1263
1353
  SupportedStylesForExponentOperator:
1264
1354
  - space
1265
1355
  - no_space
1356
+ EnforcedStyleForRationalLiterals: no_space
1357
+ SupportedStylesForRationalLiterals:
1358
+ - space
1359
+ - no_space
1266
1360
 
1267
1361
  Layout/SpaceBeforeBlockBraces:
1268
1362
  Description: >-
@@ -1458,11 +1552,11 @@ Lint/AmbiguousBlockAssociation:
1458
1552
  Description: >-
1459
1553
  Checks for ambiguous block association with method when param passed without
1460
1554
  parentheses.
1461
- StyleGuide: '#syntax'
1462
1555
  Enabled: true
1463
1556
  VersionAdded: '0.48'
1464
1557
  VersionChanged: '1.13'
1465
- IgnoredMethods: []
1558
+ AllowedMethods: []
1559
+ AllowedPatterns: []
1466
1560
 
1467
1561
  Lint/AmbiguousOperator:
1468
1562
  Description: >-
@@ -1499,7 +1593,9 @@ Lint/AssignmentInCondition:
1499
1593
  Description: "Don't use assignment in conditions."
1500
1594
  StyleGuide: '#safe-assignment-in-condition'
1501
1595
  Enabled: true
1596
+ SafeAutoCorrect: false
1502
1597
  VersionAdded: '0.9'
1598
+ VersionChanged: '1.45'
1503
1599
  AllowSafeAssignment: true
1504
1600
 
1505
1601
  Lint/BigDecimalNew:
@@ -1508,7 +1604,7 @@ Lint/BigDecimalNew:
1508
1604
  VersionAdded: '0.53'
1509
1605
 
1510
1606
  Lint/BinaryOperatorWithIdenticalOperands:
1511
- Description: 'This cop checks for places where binary operator has identical operands.'
1607
+ Description: 'Checks for places where binary operator has identical operands.'
1512
1608
  Enabled: true
1513
1609
  Safe: false
1514
1610
  VersionAdded: '0.89'
@@ -1537,6 +1633,11 @@ Lint/ConstantDefinitionInBlock:
1537
1633
  AllowedMethods:
1538
1634
  - enums
1539
1635
 
1636
+ Lint/ConstantOverwrittenInRescue:
1637
+ Description: 'Checks for overwriting an exception with an exception result by use `rescue =>`.'
1638
+ Enabled: true
1639
+ VersionAdded: '1.31'
1640
+
1540
1641
  Lint/ConstantResolution:
1541
1642
  Description: 'Check that constants are fully qualified with `::`.'
1542
1643
  Enabled: false
@@ -1550,13 +1651,13 @@ Lint/Debugger:
1550
1651
  Description: 'Check for debugger calls.'
1551
1652
  Enabled: true
1552
1653
  VersionAdded: '0.14'
1553
- VersionChanged: '1.10'
1554
- #DebuggerReceivers: [] # deprecated
1654
+ VersionChanged: '1.46'
1555
1655
  DebuggerMethods:
1556
1656
  # Groups are available so that a specific group can be disabled in
1557
1657
  # a user's configuration, but are otherwise not significant.
1558
1658
  Kernel:
1559
1659
  - binding.irb
1660
+ - Kernel.binding.irb
1560
1661
  Byebug:
1561
1662
  - byebug
1562
1663
  - remote_byebug
@@ -1574,7 +1675,11 @@ Lint/Debugger:
1574
1675
  - binding.pry
1575
1676
  - binding.remote_pry
1576
1677
  - binding.pry_remote
1678
+ - Kernel.binding.pry
1679
+ - Kernel.binding.remote_pry
1680
+ - Kernel.binding.pry_remote
1577
1681
  - Pry.rescue
1682
+ - pry
1578
1683
  Rails:
1579
1684
  - debugger
1580
1685
  - Kernel.debugger
@@ -1592,7 +1697,7 @@ Lint/DeprecatedConstants:
1592
1697
  Description: 'Checks for deprecated constants.'
1593
1698
  Enabled: true
1594
1699
  VersionAdded: '1.8'
1595
- VersionChanged: '1.22'
1700
+ VersionChanged: '1.40'
1596
1701
  # You can configure deprecated constants.
1597
1702
  # If there is an alternative method, you can set alternative value as `Alternative`.
1598
1703
  # And you can set the deprecated version as `DeprecatedVersion`.
@@ -1619,6 +1724,12 @@ Lint/DeprecatedConstants:
1619
1724
  'Random::DEFAULT':
1620
1725
  Alternative: 'Random.new'
1621
1726
  DeprecatedVersion: '3.0'
1727
+ 'Struct::Group':
1728
+ Alternative: 'Etc::Group'
1729
+ DeprecatedVersion: '3.0'
1730
+ 'Struct::Passwd':
1731
+ Alternative: 'Etc::Passwd'
1732
+ DeprecatedVersion: '3.0'
1622
1733
 
1623
1734
  Lint/DeprecatedOpenSSLConstant:
1624
1735
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
@@ -1656,6 +1767,16 @@ Lint/DuplicateHashKey:
1656
1767
  VersionAdded: '0.34'
1657
1768
  VersionChanged: '0.77'
1658
1769
 
1770
+ Lint/DuplicateMagicComment:
1771
+ Description: 'Check for duplicated magic comments.'
1772
+ Enabled: true
1773
+ VersionAdded: '1.37'
1774
+
1775
+ Lint/DuplicateMatchPattern:
1776
+ Description: 'Do not repeat patterns in `in` keywords.'
1777
+ Enabled: true
1778
+ VersionAdded: '1.50'
1779
+
1659
1780
  Lint/DuplicateMethods:
1660
1781
  Description: 'Check for duplicate method definitions.'
1661
1782
  Enabled: true
@@ -1669,7 +1790,9 @@ Lint/DuplicateRegexpCharacterClassElement:
1669
1790
  Lint/DuplicateRequire:
1670
1791
  Description: 'Check for duplicate `require`s and `require_relative`s.'
1671
1792
  Enabled: true
1793
+ SafeAutoCorrect: false
1672
1794
  VersionAdded: '0.90'
1795
+ VersionChanged: '1.28'
1673
1796
 
1674
1797
  Lint/DuplicateRescueException:
1675
1798
  Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
@@ -1688,7 +1811,7 @@ Lint/ElseLayout:
1688
1811
  VersionChanged: '1.2'
1689
1812
 
1690
1813
  Lint/EmptyBlock:
1691
- Description: 'This cop checks for blocks without a body.'
1814
+ Description: 'Checks for blocks without a body.'
1692
1815
  Enabled: true
1693
1816
  VersionAdded: '1.1'
1694
1817
  VersionChanged: '1.15'
@@ -1702,10 +1825,12 @@ Lint/EmptyClass:
1702
1825
  AllowComments: false
1703
1826
 
1704
1827
  Lint/EmptyConditionalBody:
1705
- Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1828
+ Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1706
1829
  Enabled: true
1830
+ SafeAutoCorrect: false
1707
1831
  AllowComments: true
1708
1832
  VersionAdded: '0.89'
1833
+ VersionChanged: '1.34'
1709
1834
 
1710
1835
  Lint/EmptyEnsure:
1711
1836
  Description: 'Checks for empty ensure block.'
@@ -1824,19 +1949,27 @@ Lint/IneffectiveAccessModifier:
1824
1949
  Lint/InheritException:
1825
1950
  Description: 'Avoid inheriting from the `Exception` class.'
1826
1951
  Enabled: true
1952
+ SafeAutoCorrect: false
1827
1953
  VersionAdded: '0.41'
1954
+ VersionChanged: '1.26'
1828
1955
  # The default base class in favour of `Exception`.
1829
- EnforcedStyle: runtime_error
1956
+ EnforcedStyle: standard_error
1830
1957
  SupportedStyles:
1831
- - runtime_error
1832
1958
  - standard_error
1959
+ - runtime_error
1833
1960
 
1834
1961
  Lint/InterpolationCheck:
1835
- Description: 'Raise warning for interpolation in single q strs.'
1962
+ Description: 'Checks for interpolation in a single quoted string.'
1836
1963
  Enabled: true
1837
- Safe: false
1964
+ SafeAutoCorrect: false
1838
1965
  VersionAdded: '0.50'
1839
- VersionChanged: '0.87'
1966
+ VersionChanged: '1.40'
1967
+
1968
+ Lint/ItWithoutArgumentsInBlock:
1969
+ Description: 'Checks uses of `it` calls without arguments in block.'
1970
+ Reference: 'https://bugs.ruby-lang.org/issues/18980'
1971
+ Enabled: true
1972
+ VersionAdded: '1.59'
1840
1973
 
1841
1974
  Lint/LambdaWithoutLiteralBlock:
1842
1975
  Description: 'Checks uses of lambda without a literal block.'
@@ -1848,6 +1981,11 @@ Lint/LiteralAsCondition:
1848
1981
  Enabled: true
1849
1982
  VersionAdded: '0.51'
1850
1983
 
1984
+ Lint/LiteralAssignmentInCondition:
1985
+ Description: 'Checks for literal assignments in the conditions.'
1986
+ Enabled: true
1987
+ VersionAdded: '1.58'
1988
+
1851
1989
  Lint/LiteralInInterpolation:
1852
1990
  Description: 'Checks for literals used in interpolation.'
1853
1991
  Enabled: true
@@ -1879,12 +2017,19 @@ Lint/MissingCopEnableDirective:
1879
2017
 
1880
2018
  Lint/MissingSuper:
1881
2019
  Description: >-
1882
- This cop checks for the presence of constructors and lifecycle callbacks
1883
- without calls to `super`'.
2020
+ Checks for the presence of constructors and lifecycle callbacks
2021
+ without calls to `super`.
1884
2022
  Enabled: true
2023
+ AllowedParentClasses: []
1885
2024
  VersionAdded: '0.89'
1886
2025
  VersionChanged: '1.4'
1887
2026
 
2027
+ Lint/MixedCaseRange:
2028
+ Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
2029
+ Enabled: true
2030
+ SafeAutoCorrect: false
2031
+ VersionAdded: '1.53'
2032
+
1888
2033
  Lint/MixedRegexpCaptureTypes:
1889
2034
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1890
2035
  Enabled: true
@@ -1900,6 +2045,8 @@ Lint/NestedMethodDefinition:
1900
2045
  Description: 'Do not use nested method definitions.'
1901
2046
  StyleGuide: '#no-nested-methods'
1902
2047
  Enabled: true
2048
+ AllowedMethods: []
2049
+ AllowedPatterns: []
1903
2050
  VersionAdded: '0.32'
1904
2051
 
1905
2052
  Lint/NestedPercentLiteral:
@@ -1908,7 +2055,7 @@ Lint/NestedPercentLiteral:
1908
2055
  VersionAdded: '0.52'
1909
2056
 
1910
2057
  Lint/NextWithoutAccumulator:
1911
- Description: >-
2058
+ Description: >-
1912
2059
  Do not omit the accumulator when calling `next`
1913
2060
  in a `reduce`/`inject` block.
1914
2061
  Enabled: true
@@ -1919,6 +2066,13 @@ Lint/NoReturnInBeginEndBlocks:
1919
2066
  Enabled: true
1920
2067
  VersionAdded: '1.2'
1921
2068
 
2069
+ Lint/NonAtomicFileOperation:
2070
+ Description: Checks for non-atomic file operations.
2071
+ StyleGuide: '#atomic-file-operations'
2072
+ Enabled: true
2073
+ VersionAdded: '1.31'
2074
+ SafeAutoCorrect: false
2075
+
1922
2076
  Lint/NonDeterministicRequireOrder:
1923
2077
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1924
2078
  Enabled: true
@@ -1936,7 +2090,8 @@ Lint/NumberConversion:
1936
2090
  VersionAdded: '0.53'
1937
2091
  VersionChanged: '1.1'
1938
2092
  SafeAutoCorrect: false
1939
- IgnoredMethods: []
2093
+ AllowedMethods: []
2094
+ AllowedPatterns: []
1940
2095
  IgnoredClasses:
1941
2096
  - Time
1942
2097
  - DateTime
@@ -1955,7 +2110,9 @@ Lint/OrAssignmentToConstant:
1955
2110
  Lint/OrderedMagicComments:
1956
2111
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1957
2112
  Enabled: true
2113
+ SafeAutoCorrect: false
1958
2114
  VersionAdded: '0.53'
2115
+ VersionChanged: '1.37'
1959
2116
 
1960
2117
  Lint/OutOfRangeRegexpRef:
1961
2118
  Description: 'Checks for out of range reference for Regexp because it always returns nil.'
@@ -2019,11 +2176,20 @@ Lint/RedundantDirGlobSort:
2019
2176
  Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
2020
2177
  Enabled: true
2021
2178
  VersionAdded: '1.8'
2179
+ VersionChanged: '1.26'
2180
+ SafeAutoCorrect: false
2181
+
2182
+ Lint/RedundantRegexpQuantifiers:
2183
+ Description: 'Checks for redundant quantifiers in Regexps.'
2184
+ Enabled: true
2185
+ VersionAdded: '1.53'
2022
2186
 
2023
2187
  Lint/RedundantRequireStatement:
2024
2188
  Description: 'Checks for unnecessary `require` statement.'
2025
2189
  Enabled: true
2190
+ SafeAutoCorrect: false
2026
2191
  VersionAdded: '0.76'
2192
+ VersionChanged: '1.57'
2027
2193
 
2028
2194
  Lint/RedundantSafeNavigation:
2029
2195
  Description: 'Checks for redundant safe navigation calls.'
@@ -2062,6 +2228,12 @@ Lint/RedundantWithObject:
2062
2228
  Enabled: true
2063
2229
  VersionAdded: '0.51'
2064
2230
 
2231
+ Lint/RefinementImportMethods:
2232
+ Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
2233
+ Enabled: true
2234
+ SafeAutoCorrect: false
2235
+ VersionAdded: '1.27'
2236
+
2065
2237
  Lint/RegexpAsCondition:
2066
2238
  Description: >-
2067
2239
  Do not use regexp literal as a condition.
@@ -2077,6 +2249,11 @@ Lint/RequireParentheses:
2077
2249
  Enabled: true
2078
2250
  VersionAdded: '0.18'
2079
2251
 
2252
+ Lint/RequireRangeParentheses:
2253
+ Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
2254
+ Enabled: true
2255
+ VersionAdded: '1.32'
2256
+
2080
2257
  Lint/RequireRelativeSelfPath:
2081
2258
  Description: 'Checks for uses a file requiring itself with `require_relative`.'
2082
2259
  Enabled: true
@@ -2200,7 +2377,7 @@ Lint/Syntax:
2200
2377
  VersionAdded: '0.9'
2201
2378
 
2202
2379
  Lint/ToEnumArguments:
2203
- Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2380
+ Description: 'Ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2204
2381
  Enabled: true
2205
2382
  VersionAdded: '1.1'
2206
2383
 
@@ -2210,12 +2387,15 @@ Lint/ToJSON:
2210
2387
  VersionAdded: '0.66'
2211
2388
 
2212
2389
  Lint/TopLevelReturnWithArgument:
2213
- Description: 'This cop detects top level return statements with argument.'
2390
+ Description: 'Detects top level return statements with argument.'
2214
2391
  Enabled: true
2215
2392
  VersionAdded: '0.89'
2393
+ # These codes are `eval`-ed in method and their return values may be used.
2394
+ Exclude:
2395
+ - '**/*.jb'
2216
2396
 
2217
2397
  Lint/TrailingCommaInAttributeDeclaration:
2218
- Description: 'This cop checks for trailing commas in attribute declarations.'
2398
+ Description: 'Checks for trailing commas in attribute declarations.'
2219
2399
  Enabled: true
2220
2400
  VersionAdded: '0.90'
2221
2401
 
@@ -2264,11 +2444,11 @@ Lint/UnreachableCode:
2264
2444
  VersionAdded: '0.9'
2265
2445
 
2266
2446
  Lint/UnreachableLoop:
2267
- Description: 'This cop checks for loops that will have at most one iteration.'
2447
+ Description: 'Checks for loops that will have at most one iteration.'
2268
2448
  Enabled: true
2269
2449
  VersionAdded: '0.89'
2270
2450
  VersionChanged: '1.7'
2271
- IgnoredPatterns:
2451
+ AllowedPatterns:
2272
2452
  # RSpec uses `times` in its message expectations
2273
2453
  # eg. `exactly(2).times`
2274
2454
  - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
@@ -2321,18 +2501,26 @@ Lint/UselessAssignment:
2321
2501
  StyleGuide: '#underscore-unused-vars'
2322
2502
  Enabled: true
2323
2503
  VersionAdded: '0.11'
2504
+ VersionChanged: '1.51'
2505
+ SafeAutoCorrect: false
2324
2506
 
2325
2507
  Lint/UselessElseWithoutRescue:
2326
2508
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2327
2509
  Enabled: true
2328
2510
  VersionAdded: '0.17'
2511
+ VersionChanged: '1.31'
2329
2512
 
2330
2513
  Lint/UselessMethodDefinition:
2331
2514
  Description: 'Checks for useless method definitions.'
2332
2515
  Enabled: true
2333
2516
  VersionAdded: '0.90'
2517
+ VersionChanged: '0.91'
2334
2518
  Safe: false
2335
- AllowComments: true
2519
+
2520
+ Lint/UselessRescue:
2521
+ Description: 'Checks for useless `rescue`s.'
2522
+ Enabled: true
2523
+ VersionAdded: '1.43'
2336
2524
 
2337
2525
  Lint/UselessRuby2Keywords:
2338
2526
  Description: 'Finds unnecessary uses of `ruby2_keywords`.'
@@ -2342,10 +2530,9 @@ Lint/UselessRuby2Keywords:
2342
2530
  Lint/UselessSetterCall:
2343
2531
  Description: 'Checks for useless setter call to a local variable.'
2344
2532
  Enabled: true
2345
- SafeAutoCorrect: false
2533
+ Safe: false
2346
2534
  VersionAdded: '0.13'
2347
2535
  VersionChanged: '1.2'
2348
- Safe: false
2349
2536
 
2350
2537
  Lint/UselessTimes:
2351
2538
  Description: 'Checks for useless `Integer#times` calls.'
@@ -2373,9 +2560,12 @@ Metrics/AbcSize:
2373
2560
  VersionChanged: '1.5'
2374
2561
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2375
2562
  # a Float.
2376
- IgnoredMethods: []
2563
+ AllowedMethods: []
2564
+ AllowedPatterns: []
2377
2565
  CountRepeatedAttributes: true
2378
2566
  Max: 30
2567
+ Exclude:
2568
+ - 'db/migrate/**/*'
2379
2569
 
2380
2570
  Metrics/BlockLength:
2381
2571
  Description: 'Avoid long blocks with many lines.'
@@ -2385,13 +2575,14 @@ Metrics/BlockLength:
2385
2575
  CountComments: false # count full line comments?
2386
2576
  Max: 50
2387
2577
  CountAsOne: []
2388
- #ExcludedMethods: [] # deprecated, retained for backwards compatibility
2389
- IgnoredMethods:
2578
+ AllowedMethods:
2390
2579
  # By default, exclude the `#refine` method, as it tends to have larger
2391
2580
  # associated blocks.
2392
2581
  - refine
2582
+ AllowedPatterns: []
2393
2583
  Exclude:
2394
2584
  - '**/*.gemspec'
2585
+ - 'app/avo/resources/**/*.rb'
2395
2586
 
2396
2587
  Metrics/BlockNesting:
2397
2588
  Description: 'Avoid excessive block nesting.'
@@ -2411,6 +2602,12 @@ Metrics/ClassLength:
2411
2602
  Max: 300
2412
2603
  CountAsOne: []
2413
2604
 
2605
+ Metrics/CollectionLiteralLength:
2606
+ Description: 'Checks for `Array` or `Hash` literals with many entries.'
2607
+ Enabled: true
2608
+ VersionAdded: '1.47'
2609
+ LengthThreshold: 250
2610
+
2414
2611
  # Avoid complex methods.
2415
2612
  Metrics/CyclomaticComplexity:
2416
2613
  Description: >-
@@ -2419,8 +2616,11 @@ Metrics/CyclomaticComplexity:
2419
2616
  Enabled: true
2420
2617
  VersionAdded: '0.25'
2421
2618
  VersionChanged: '0.81'
2422
- IgnoredMethods: []
2619
+ AllowedMethods: []
2620
+ AllowedPatterns: []
2423
2621
  Max: 10
2622
+ Exclude:
2623
+ - 'db/migrate/**/*'
2424
2624
 
2425
2625
  Metrics/MethodLength:
2426
2626
  Description: 'Avoid methods longer than 10 lines of code.'
@@ -2431,8 +2631,8 @@ Metrics/MethodLength:
2431
2631
  CountComments: false # count full line comments?
2432
2632
  Max: 50
2433
2633
  CountAsOne: []
2434
- #ExcludedMethods: [] # deprecated, retained for backwards compatibility
2435
- IgnoredMethods: []
2634
+ AllowedMethods: []
2635
+ AllowedPatterns: []
2436
2636
 
2437
2637
  Metrics/ModuleLength:
2438
2638
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2460,8 +2660,11 @@ Metrics/PerceivedComplexity:
2460
2660
  Enabled: true
2461
2661
  VersionAdded: '0.25'
2462
2662
  VersionChanged: '0.81'
2463
- IgnoredMethods: []
2663
+ AllowedMethods: []
2664
+ AllowedPatterns: []
2464
2665
  Max: 8
2666
+ Exclude:
2667
+ - 'db/migrate/**/*'
2465
2668
 
2466
2669
  ################## Migration #############################
2467
2670
 
@@ -2469,7 +2672,7 @@ Migration/DepartmentName:
2469
2672
  Description: >-
2470
2673
  Check that cop names in rubocop:disable (etc) comments are
2471
2674
  given with department name.
2472
- Enabled: true
2675
+ Enabled: false
2473
2676
  VersionAdded: '0.75'
2474
2677
 
2475
2678
  #################### Naming ##############################
@@ -2497,12 +2700,14 @@ Naming/BinaryOperatorParameterName:
2497
2700
 
2498
2701
  Naming/BlockForwarding:
2499
2702
  Description: 'Use anonymous block forwarding.'
2703
+ StyleGuide: '#block-forwarding'
2500
2704
  Enabled: true
2501
2705
  VersionAdded: '1.24'
2502
2706
  EnforcedStyle: anonymous
2503
2707
  SupportedStyles:
2504
2708
  - anonymous
2505
2709
  - explicit
2710
+ BlockForwardingName: block
2506
2711
 
2507
2712
  Naming/BlockParameterName:
2508
2713
  Description: >-
@@ -2541,6 +2746,7 @@ Naming/FileName:
2541
2746
  StyleGuide: '#snake-case-files'
2542
2747
  Enabled: true
2543
2748
  VersionAdded: '0.50'
2749
+ VersionChanged: '1.23'
2544
2750
  # Camel case file names listed in `AllCops:Include` and all file names listed
2545
2751
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2546
2752
  Exclude: []
@@ -2628,13 +2834,13 @@ Naming/HeredocDelimiterNaming:
2628
2834
  Enabled: true
2629
2835
  VersionAdded: '0.50'
2630
2836
  ForbiddenDelimiters:
2631
- - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2837
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/i'
2632
2838
 
2633
2839
  Naming/InclusiveLanguage:
2634
2840
  Description: 'Recommend the use of inclusive language instead of problematic terms.'
2635
- Enabled: false
2841
+ Enabled: true
2636
2842
  VersionAdded: '1.18'
2637
- VersionChanged: '1.21'
2843
+ VersionChanged: '1.49'
2638
2844
  CheckIdentifiers: true
2639
2845
  CheckConstants: true
2640
2846
  CheckVariables: true
@@ -2646,12 +2852,12 @@ Naming/InclusiveLanguage:
2646
2852
  whitelist:
2647
2853
  Regex: !ruby/regexp '/white[-_\s]?list/'
2648
2854
  Suggestions:
2649
- - allowlist
2855
+ - allow_list
2650
2856
  - permit
2651
2857
  blacklist:
2652
2858
  Regex: !ruby/regexp '/black[-_\s]?list/'
2653
2859
  Suggestions:
2654
- - denylist
2860
+ - deny_list
2655
2861
  - block
2656
2862
  slave:
2657
2863
  WholeWord: true
@@ -2681,36 +2887,36 @@ Naming/MethodName:
2681
2887
  - camelCase
2682
2888
  # Method names matching patterns are always allowed.
2683
2889
  #
2684
- # IgnoredPatterns:
2890
+ # AllowedPatterns:
2685
2891
  # - '\A\s*onSelectionBulkChange\s*'
2686
2892
  # - '\A\s*onSelectionCleared\s*'
2687
2893
  #
2688
- IgnoredPatterns: []
2894
+ AllowedPatterns: []
2689
2895
 
2690
2896
  Naming/MethodParameterName:
2691
2897
  Description: >-
2692
2898
  Checks for method parameter names that contain capital letters,
2693
2899
  end in numbers, or do not meet a minimal length.
2694
- Enabled: true
2900
+ Enabled: false
2695
2901
  VersionAdded: '0.53'
2696
2902
  VersionChanged: '0.77'
2697
2903
  # Parameter names may be equal to or greater than this value
2698
- MinNameLength: 1
2904
+ MinNameLength: 3
2699
2905
  AllowNamesEndingInNumbers: true
2700
2906
  # Allowed names that will not register an offense
2701
2907
  AllowedNames:
2908
+ - as
2702
2909
  - at
2703
2910
  - by
2911
+ - cc
2704
2912
  - db
2705
2913
  - id
2914
+ - if
2706
2915
  - in
2707
2916
  - io
2708
2917
  - ip
2709
2918
  - of
2710
2919
  - 'on'
2711
- - os
2712
- - pp
2713
- - to
2714
2920
  # Forbidden names that will register an offense
2715
2921
  ForbiddenNames: []
2716
2922
 
@@ -2761,6 +2967,7 @@ Naming/VariableName:
2761
2967
  - snake_case
2762
2968
  - camelCase
2763
2969
  AllowedIdentifiers: []
2970
+ AllowedPatterns: []
2764
2971
 
2765
2972
  Naming/VariableNumber:
2766
2973
  Description: 'Use the configured style when numbering symbols, methods and variables.'
@@ -2774,7 +2981,7 @@ Naming/VariableNumber:
2774
2981
  - normalcase
2775
2982
  - non_integer
2776
2983
  CheckMethodNames: true
2777
- CheckSymbols: true
2984
+ CheckSymbols: false
2778
2985
  AllowedIdentifiers:
2779
2986
  - capture3 # Open3.capture3
2780
2987
  - iso8601 # Time#iso8601
@@ -2782,9 +2989,18 @@ Naming/VariableNumber:
2782
2989
  - rfc822 # Time#rfc822
2783
2990
  - rfc2822 # Time#rfc2822
2784
2991
  - rfc3339 # DateTime.rfc3339
2992
+ - x86_64 # Allowed by default as an underscore separated CPU architecture name
2993
+ AllowedPatterns: []
2785
2994
 
2786
2995
  #################### Security ##############################
2787
2996
 
2997
+ Security/CompoundHash:
2998
+ Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
2999
+ Enabled: true
3000
+ Safe: false
3001
+ VersionAdded: '1.28'
3002
+ VersionChanged: '1.51'
3003
+
2788
3004
  Security/Eval:
2789
3005
  Description: 'The use of eval represents a serious security risk.'
2790
3006
  Enabled: true
@@ -2838,7 +3054,7 @@ Security/YAMLLoad:
2838
3054
 
2839
3055
  Style/AccessModifierDeclarations:
2840
3056
  Description: 'Checks style of how access modifiers are used.'
2841
- Enabled: true
3057
+ Enabled: false
2842
3058
  VersionAdded: '0.57'
2843
3059
  VersionChanged: '0.81'
2844
3060
  EnforcedStyle: group
@@ -2846,6 +3062,7 @@ Style/AccessModifierDeclarations:
2846
3062
  - inline
2847
3063
  - group
2848
3064
  AllowModifiersOnSymbols: true
3065
+ SafeAutoCorrect: false
2849
3066
 
2850
3067
  Style/AccessorGrouping:
2851
3068
  Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
@@ -2887,8 +3104,21 @@ Style/ArgumentsForwarding:
2887
3104
  Description: 'Use arguments forwarding.'
2888
3105
  StyleGuide: '#arguments-forwarding'
2889
3106
  Enabled: true
2890
- AllowOnlyRestArgument: true
3107
+ # AllowOnlyRestArgument: true
3108
+ UseAnonymousForwarding: true
3109
+ RedundantRestArgumentNames:
3110
+ - args
3111
+ - arguments
3112
+ RedundantKeywordRestArgumentNames:
3113
+ - kwargs
3114
+ - options
3115
+ - opts
3116
+ RedundantBlockArgumentNames:
3117
+ - blk
3118
+ - block
3119
+ - proc
2891
3120
  VersionAdded: '1.1'
3121
+ VersionChanged: '1.58'
2892
3122
 
2893
3123
  Style/ArrayCoercion:
2894
3124
  Description: >-
@@ -2899,6 +3129,19 @@ Style/ArrayCoercion:
2899
3129
  Enabled: true
2900
3130
  VersionAdded: '0.88'
2901
3131
 
3132
+ Style/ArrayFirstLast:
3133
+ Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
3134
+ Reference: '#first-and-last'
3135
+ Enabled: false
3136
+ VersionAdded: '1.58'
3137
+ Safe: false
3138
+
3139
+ Style/ArrayIntersect:
3140
+ Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
3141
+ Enabled: true
3142
+ Safe: false
3143
+ VersionAdded: '1.40'
3144
+
2902
3145
  Style/ArrayJoin:
2903
3146
  Description: 'Use Array#join instead of Array#*.'
2904
3147
  StyleGuide: '#array-join'
@@ -2980,7 +3223,7 @@ Style/BlockDelimiters:
2980
3223
  # This looks at the usage of a block's method to determine its type (e.g. is
2981
3224
  # the result of a `map` assigned to a variable or passed to another
2982
3225
  # method) but exceptions are permitted in the `ProceduralMethods`,
2983
- # `FunctionalMethods` and `IgnoredMethods` sections below.
3226
+ # `FunctionalMethods` and `AllowedMethods` sections below.
2984
3227
  - semantic
2985
3228
  # The `braces_for_chaining` style enforces braces around single line blocks
2986
3229
  # and do..end around multi-line blocks, except for multi-line blocks whose
@@ -3021,7 +3264,7 @@ Style/BlockDelimiters:
3021
3264
  - let!
3022
3265
  - subject
3023
3266
  - watch
3024
- IgnoredMethods:
3267
+ AllowedMethods:
3025
3268
  # Methods that can be either procedural or functional and cannot be
3026
3269
  # categorised from their usage alone, e.g.
3027
3270
  #
@@ -3038,6 +3281,7 @@ Style/BlockDelimiters:
3038
3281
  - lambda
3039
3282
  - proc
3040
3283
  - it
3284
+ AllowedPatterns: []
3041
3285
  # The AllowBracesOnProceduralOneLiners option is ignored unless the
3042
3286
  # EnforcedStyle is set to `semantic`. If so:
3043
3287
  #
@@ -3061,7 +3305,7 @@ Style/BlockDelimiters:
3061
3305
  # collection.each do |element| puts element end
3062
3306
  AllowBracesOnProceduralOneLiners: false
3063
3307
  # The BracesRequiredMethods overrides all other configurations except
3064
- # IgnoredMethods. It can be used to enforce that all blocks for specific
3308
+ # AllowedMethods. It can be used to enforce that all blocks for specific
3065
3309
  # methods use braces. For example, you can use this to enforce Sorbet
3066
3310
  # signatures use braces even when the rest of your codebase enforces
3067
3311
  # the `line_count_based` style.
@@ -3082,13 +3326,25 @@ Style/CaseEquality:
3082
3326
  # # good
3083
3327
  # String === "string"
3084
3328
  AllowOnConstant: false
3329
+ # If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
3330
+ # the case equality operator is `self.class`.
3331
+ #
3332
+ # # bad
3333
+ # some_class === object
3334
+ #
3335
+ # # good
3336
+ # self.class === object
3337
+ AllowOnSelfClass: false
3085
3338
 
3086
3339
  Style/CaseLikeIf:
3087
- Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
3340
+ Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
3088
3341
  StyleGuide: '#case-vs-if-else'
3089
3342
  Enabled: true
3090
3343
  Safe: false
3091
3344
  VersionAdded: '0.88'
3345
+ VersionChanged: '1.48'
3346
+ # `MinBranchesCount` defines the number of branches `if` needs to have to trigger this cop.
3347
+ MinBranchesCount: 3
3092
3348
 
3093
3349
  Style/CharacterLiteral:
3094
3350
  Description: 'Checks for uses of character literals.'
@@ -3101,11 +3357,11 @@ Style/ClassAndModuleChildren:
3101
3357
  StyleGuide: '#namespace-definition'
3102
3358
  # Moving from compact to nested children requires knowledge of whether the
3103
3359
  # outer parent is a module or a class. Moving from nested to compact requires
3104
- # verification that the outer parent is defined elsewhere. Rubocop does not
3360
+ # verification that the outer parent is defined elsewhere. RuboCop does not
3105
3361
  # have the knowledge to perform either operation safely and thus requires
3106
3362
  # manual oversight.
3107
3363
  SafeAutoCorrect: false
3108
- Enabled: true
3364
+ Enabled: false
3109
3365
  VersionAdded: '0.19'
3110
3366
  #
3111
3367
  # Basically there are two different styles:
@@ -3140,11 +3396,14 @@ Style/ClassEqualityComparison:
3140
3396
  Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3141
3397
  StyleGuide: '#instance-of-vs-class-comparison'
3142
3398
  Enabled: true
3399
+ SafeAutoCorrect: false
3143
3400
  VersionAdded: '0.93'
3144
- IgnoredMethods:
3401
+ VersionChanged: '1.57'
3402
+ AllowedMethods:
3145
3403
  - ==
3146
3404
  - equal?
3147
3405
  - eql?
3406
+ AllowedPatterns: []
3148
3407
 
3149
3408
  Style/ClassMethods:
3150
3409
  Description: 'Use self when defining module/class methods.'
@@ -3158,7 +3417,7 @@ Style/ClassMethodsDefinitions:
3158
3417
  StyleGuide: '#def-self-class-methods'
3159
3418
  Enabled: false
3160
3419
  VersionAdded: '0.89'
3161
- EnforcedStyle: def_self
3420
+ EnforcedStyle: def_self
3162
3421
  SupportedStyles:
3163
3422
  - def_self
3164
3423
  - self_class
@@ -3175,6 +3434,7 @@ Style/CollectionCompact:
3175
3434
  Safe: false
3176
3435
  VersionAdded: '1.2'
3177
3436
  VersionChanged: '1.3'
3437
+ AllowedReceivers: []
3178
3438
 
3179
3439
  # Align with the style guide.
3180
3440
  Style/CollectionMethods:
@@ -3193,6 +3453,7 @@ Style/CollectionMethods:
3193
3453
  PreferredMethods:
3194
3454
  collect: 'map'
3195
3455
  collect!: 'map!'
3456
+ collect_concat: 'flat_map'
3196
3457
  inject: 'reduce'
3197
3458
  detect: 'find'
3198
3459
  find_all: 'select'
@@ -3265,6 +3526,17 @@ Style/CommentedKeyword:
3265
3526
  VersionAdded: '0.51'
3266
3527
  VersionChanged: '1.19'
3267
3528
 
3529
+ Style/ComparableClamp:
3530
+ Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
3531
+ Enabled: true
3532
+ VersionAdded: '1.44'
3533
+
3534
+ Style/ConcatArrayLiterals:
3535
+ Description: 'Enforces the use of `Array#push(item)` instead of `Array#concat([item])` to avoid redundant array literals.'
3536
+ Enabled: true
3537
+ Safe: false
3538
+ VersionAdded: '1.41'
3539
+
3268
3540
  Style/ConditionalAssignment:
3269
3541
  Description: >-
3270
3542
  Use the return value of `if` and `case` statements for
@@ -3320,10 +3592,18 @@ Style/Copyright:
3320
3592
  Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
3321
3593
  AutocorrectNotice: ''
3322
3594
 
3595
+ Style/DataInheritance:
3596
+ Description: 'Checks for inheritance from Data.define.'
3597
+ StyleGuide: '#no-extend-data-define'
3598
+ Enabled: true
3599
+ SafeAutoCorrect: false
3600
+ VersionAdded: '1.49'
3601
+ VersionChanged: '1.51'
3602
+
3323
3603
  Style/DateTime:
3324
3604
  Description: 'Use Time over DateTime.'
3325
- StyleGuide: '#date--time'
3326
- Enabled: false
3605
+ StyleGuide: '#date-time'
3606
+ Enabled: true
3327
3607
  VersionAdded: '0.51'
3328
3608
  VersionChanged: '0.92'
3329
3609
  SafeAutoCorrect: false
@@ -3343,6 +3623,12 @@ Style/Dir:
3343
3623
  Enabled: true
3344
3624
  VersionAdded: '0.50'
3345
3625
 
3626
+ Style/DirEmpty:
3627
+ Description: >-
3628
+ Prefer to use `Dir.empty?('path/to/dir')` when checking if a directory is empty.
3629
+ Enabled: true
3630
+ VersionAdded: '1.48'
3631
+
3346
3632
  Style/DisableCopsWithinSourceCodeDirective:
3347
3633
  Description: >-
3348
3634
  Forbids disabling/enabling cops within source code.
@@ -3431,6 +3717,12 @@ Style/EmptyElse:
3431
3717
  - empty
3432
3718
  - nil
3433
3719
  - both
3720
+ AllowComments: false
3721
+
3722
+ Style/EmptyHeredoc:
3723
+ Description: 'Checks for using empty heredoc to reduce redundancy.'
3724
+ Enabled: true
3725
+ VersionAdded: '1.32'
3434
3726
 
3435
3727
  Style/EmptyLambdaParameter:
3436
3728
  Description: 'Omit parens for empty lambda parameters.'
@@ -3479,6 +3771,12 @@ Style/EndlessMethod:
3479
3771
  - allow_always
3480
3772
  - disallow
3481
3773
 
3774
+ Style/EnvHome:
3775
+ Description: "Checks for consistent usage of `ENV['HOME']`."
3776
+ Enabled: true
3777
+ Safe: false
3778
+ VersionAdded: '1.29'
3779
+
3482
3780
  Style/EvalWithLocation:
3483
3781
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
3484
3782
  Enabled: true
@@ -3491,6 +3789,11 @@ Style/EvenOdd:
3491
3789
  VersionAdded: '0.12'
3492
3790
  VersionChanged: '0.29'
3493
3791
 
3792
+ Style/ExactRegexpMatch:
3793
+ Description: 'Checks for exact regexp match inside Regexp literals.'
3794
+ Enabled: true
3795
+ VersionAdded: '1.51'
3796
+
3494
3797
  Style/ExpandPathArguments:
3495
3798
  Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
3496
3799
  Enabled: true
@@ -3516,6 +3819,23 @@ Style/ExponentialNotation:
3516
3819
  - engineering
3517
3820
  - integral
3518
3821
 
3822
+ Style/FetchEnvVar:
3823
+ Description: >-
3824
+ Suggests `ENV.fetch` for the replacement of `ENV[]`.
3825
+ Reference:
3826
+ - https://rubystyle.guide/#hash-fetch-defaults
3827
+ Enabled: true
3828
+ VersionAdded: '1.28'
3829
+ # Environment variables to be excluded from the inspection.
3830
+ AllowedVars: []
3831
+
3832
+ Style/FileEmpty:
3833
+ Description: >-
3834
+ Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
3835
+ Enabled: true
3836
+ Safe: false
3837
+ VersionAdded: '1.48'
3838
+
3519
3839
  Style/FileRead:
3520
3840
  Description: 'Favor `File.(bin)read` convenience methods.'
3521
3841
  StyleGuide: '#file-read'
@@ -3547,8 +3867,9 @@ Style/For:
3547
3867
  Description: 'Checks use of for or each in multiline loops.'
3548
3868
  StyleGuide: '#no-for-loops'
3549
3869
  Enabled: true
3870
+ SafeAutoCorrect: false
3550
3871
  VersionAdded: '0.13'
3551
- VersionChanged: '0.59'
3872
+ VersionChanged: '1.26'
3552
3873
  EnforcedStyle: each
3553
3874
  SupportedStyles:
3554
3875
  - each
@@ -3560,7 +3881,7 @@ Style/FormatString:
3560
3881
  Enabled: true
3561
3882
  VersionAdded: '0.19'
3562
3883
  VersionChanged: '0.49'
3563
- EnforcedStyle: format
3884
+ EnforcedStyle: sprintf
3564
3885
  SupportedStyles:
3565
3886
  - format
3566
3887
  - sprintf
@@ -3583,7 +3904,8 @@ Style/FormatStringToken:
3583
3904
  MaxUnannotatedPlaceholdersAllowed: 1
3584
3905
  VersionAdded: '0.49'
3585
3906
  VersionChanged: '1.0'
3586
- IgnoredMethods: []
3907
+ AllowedMethods: []
3908
+ AllowedPatterns: []
3587
3909
 
3588
3910
  Style/FrozenStringLiteralComment:
3589
3911
  Description: >-
@@ -3628,10 +3950,11 @@ Style/GuardClause:
3628
3950
  StyleGuide: '#no-nested-conditionals'
3629
3951
  Enabled: true
3630
3952
  VersionAdded: '0.20'
3631
- VersionChanged: '0.22'
3953
+ VersionChanged: '1.31'
3632
3954
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3633
3955
  # needs to have to trigger this cop
3634
3956
  MinBodyLength: 1
3957
+ AllowConsecutiveConditionals: false
3635
3958
 
3636
3959
  Style/HashAsLastArrayItem:
3637
3960
  Description: >-
@@ -3649,8 +3972,9 @@ Style/HashConversion:
3649
3972
  Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3650
3973
  StyleGuide: '#avoid-hash-constructor'
3651
3974
  Enabled: true
3975
+ SafeAutoCorrect: false
3652
3976
  VersionAdded: '1.10'
3653
- VersionChanged: '1.11'
3977
+ VersionChanged: '1.55'
3654
3978
  AllowSplatArgument: true
3655
3979
 
3656
3980
  Style/HashEachMethods:
@@ -3660,14 +3984,17 @@ Style/HashEachMethods:
3660
3984
  Safe: false
3661
3985
  VersionAdded: '0.80'
3662
3986
  VersionChanged: '1.16'
3663
- AllowedReceivers: []
3987
+ AllowedReceivers:
3988
+ - Thread.current
3664
3989
 
3665
3990
  Style/HashExcept:
3666
3991
  Description: >-
3667
3992
  Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3668
3993
  that can be replaced with `Hash#except` method.
3669
3994
  Enabled: true
3995
+ Safe: false
3670
3996
  VersionAdded: '1.7'
3997
+ VersionChanged: '1.39'
3671
3998
 
3672
3999
  Style/HashLikeCase:
3673
4000
  Description: >-
@@ -3698,12 +4025,16 @@ Style/HashSyntax:
3698
4025
  # enforces both ruby19 and no_mixed_keys styles
3699
4026
  - ruby19_no_mixed_keys
3700
4027
  # Force hashes that have a hash value omission
3701
- EnforcedShorthandSyntax: always
4028
+ EnforcedShorthandSyntax: either
3702
4029
  SupportedShorthandSyntax:
3703
4030
  # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
3704
4031
  - always
3705
4032
  # forces use of explicit hash literal value.
3706
4033
  - never
4034
+ # accepts both shorthand and explicit use of hash literal value.
4035
+ - either
4036
+ # forces use of the 3.1 syntax only if all values can be omitted in the hash.
4037
+ - consistent
3707
4038
  # Force hashes that have a symbol value to use hash rockets
3708
4039
  UseHashRocketsWithSymbolValues: false
3709
4040
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3816,16 +4147,35 @@ Style/InverseMethods:
3816
4147
  :=~: :!~
3817
4148
  :<: :>=
3818
4149
  :>: :<=
3819
- # `ActiveSupport` defines some common inverse methods. They are listed below,
3820
- # and not enabled by default.
3821
- #:present?: :blank?,
3822
- #:include?: :exclude?
3823
4150
  # `InverseBlocks` are methods that are inverted by inverting the return
3824
4151
  # of the block that is passed to the method
3825
4152
  InverseBlocks:
3826
4153
  :select: :reject
3827
4154
  :select!: :reject!
3828
4155
 
4156
+ Style/InvertibleUnlessCondition:
4157
+ Description: 'Favor `if` with inverted condition over `unless`.'
4158
+ Enabled: false
4159
+ Safe: false
4160
+ VersionAdded: '1.44'
4161
+ VersionChanged: '1.50'
4162
+ # `InverseMethods` are methods that can be inverted in a `unless` condition.
4163
+ # The relationship of inverse methods needs to be defined in both directions.
4164
+ # Keys and values both need to be defined as symbols.
4165
+ InverseMethods:
4166
+ :!=: :==
4167
+ :>: :<=
4168
+ :<=: :>
4169
+ :<: :>=
4170
+ :>=: :<
4171
+ :!~: :=~
4172
+ :zero?: :nonzero?
4173
+ :nonzero?: :zero?
4174
+ :any?: :none?
4175
+ :none?: :any?
4176
+ :even?: :odd?
4177
+ :odd?: :even?
4178
+
3829
4179
  Style/IpAddresses:
3830
4180
  Description: "Don't include literal IP addresses in code."
3831
4181
  Enabled: false
@@ -3851,7 +4201,7 @@ Style/KeywordParametersOrder:
3851
4201
  Style/Lambda:
3852
4202
  Description: 'Use the new lambda literal syntax for single-line blocks.'
3853
4203
  StyleGuide: '#lambda-multi-line'
3854
- Enabled: true
4204
+ Enabled: false
3855
4205
  VersionAdded: '0.9'
3856
4206
  VersionChanged: '0.40'
3857
4207
  EnforcedStyle: line_count_dependent
@@ -3880,12 +4230,43 @@ Style/LineEndConcatenation:
3880
4230
  VersionAdded: '0.18'
3881
4231
  VersionChanged: '0.64'
3882
4232
 
4233
+ Style/MagicCommentFormat:
4234
+ Description: 'Use a consistent style for magic comments.'
4235
+ Enabled: true
4236
+ VersionAdded: '1.35'
4237
+ EnforcedStyle: snake_case
4238
+ SupportedStyles:
4239
+ # `snake` will enforce the magic comment is written
4240
+ # in snake case (words separated by underscores).
4241
+ # Eg: froze_string_literal: true
4242
+ - snake_case
4243
+ # `kebab` will enforce the magic comment is written
4244
+ # in kebab case (words separated by hyphens).
4245
+ # Eg: froze-string-literal: true
4246
+ - kebab_case
4247
+ DirectiveCapitalization: lowercase
4248
+ ValueCapitalization: ~
4249
+ SupportedCapitalizations:
4250
+ - lowercase
4251
+ - uppercase
4252
+
4253
+ Style/MapCompactWithConditionalBlock:
4254
+ Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
4255
+ Enabled: true
4256
+ VersionAdded: '1.30'
4257
+
3883
4258
  Style/MapToHash:
3884
4259
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
3885
4260
  Enabled: true
3886
4261
  VersionAdded: '1.24'
3887
4262
  Safe: false
3888
4263
 
4264
+ Style/MapToSet:
4265
+ Description: 'Prefer `to_set` with a block over `map.to_set`.'
4266
+ Enabled: true
4267
+ Safe: false
4268
+ VersionAdded: '1.42'
4269
+
3889
4270
  Style/MethodCallWithArgsParentheses:
3890
4271
  Description: 'Use parentheses for method calls with arguments.'
3891
4272
  StyleGuide: '#method-invocation-parens'
@@ -3893,8 +4274,8 @@ Style/MethodCallWithArgsParentheses:
3893
4274
  VersionAdded: '0.47'
3894
4275
  VersionChanged: '1.7'
3895
4276
  IgnoreMacros: true
3896
- IgnoredMethods: []
3897
- IgnoredPatterns: []
4277
+ AllowedMethods: []
4278
+ AllowedPatterns: []
3898
4279
  IncludedMacros: []
3899
4280
  AllowParenthesesInMultilineCall: false
3900
4281
  AllowParenthesesInChaining: false
@@ -3909,7 +4290,8 @@ Style/MethodCallWithoutArgsParentheses:
3909
4290
  Description: 'Do not use parentheses for method calls with no arguments.'
3910
4291
  StyleGuide: '#method-invocation-parens'
3911
4292
  Enabled: true
3912
- IgnoredMethods: []
4293
+ AllowedMethods: []
4294
+ AllowedPatterns: []
3913
4295
  VersionAdded: '0.47'
3914
4296
  VersionChanged: '0.55'
3915
4297
 
@@ -3940,6 +4322,12 @@ Style/MinMax:
3940
4322
  Enabled: true
3941
4323
  VersionAdded: '0.50'
3942
4324
 
4325
+ Style/MinMaxComparison:
4326
+ Description: 'Enforces the use of `max` or `min` instead of comparison for greater or less.'
4327
+ Enabled: true
4328
+ Safe: false
4329
+ VersionAdded: '1.42'
4330
+
3943
4331
  Style/MissingElse:
3944
4332
  Description: >-
3945
4333
  Require if/case expressions to have an else branches.
@@ -4063,6 +4451,7 @@ Style/MultipleComparison:
4063
4451
  VersionAdded: '0.49'
4064
4452
  VersionChanged: '1.1'
4065
4453
  AllowMethodComparison: true
4454
+ ComparisonsThreshold: 2
4066
4455
 
4067
4456
  Style/MutableConstant:
4068
4457
  Description: 'Do not assign mutable objects to constants.'
@@ -4100,7 +4489,7 @@ Style/NegatedIf:
4100
4489
 
4101
4490
  Style/NegatedIfElseCondition:
4102
4491
  Description: >-
4103
- This cop checks for uses of `if-else` and ternary operators with a negated condition
4492
+ Checks for uses of `if-else` and ternary operators with a negated condition
4104
4493
  which can be simplified by inverting condition and swapping branches.
4105
4494
  Enabled: true
4106
4495
  VersionAdded: '1.2'
@@ -4125,6 +4514,11 @@ Style/NegatedWhile:
4125
4514
  Enabled: true
4126
4515
  VersionAdded: '0.20'
4127
4516
 
4517
+ Style/NestedFileDirname:
4518
+ Description: 'Checks for nested `File.dirname`.'
4519
+ Enabled: true
4520
+ VersionAdded: '1.26'
4521
+
4128
4522
  Style/NestedModifier:
4129
4523
  Description: 'Avoid using nested modifiers.'
4130
4524
  StyleGuide: '#no-nested-modifiers'
@@ -4249,24 +4643,24 @@ Style/NumericLiterals:
4249
4643
  Add underscores to large numeric literals to improve their
4250
4644
  readability.
4251
4645
  StyleGuide: '#underscores-in-numerics'
4252
- Enabled: true
4646
+ Enabled: false
4253
4647
  VersionAdded: '0.9'
4254
4648
  VersionChanged: '0.48'
4255
4649
  MinDigits: 5
4256
4650
  Strict: false
4257
4651
  # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4258
4652
  AllowedNumbers: []
4653
+ AllowedPatterns: []
4259
4654
 
4260
4655
  Style/NumericPredicate:
4261
4656
  Description: >-
4262
4657
  Checks for the use of predicate- or comparison methods for
4263
4658
  numeric comparisons.
4264
4659
  StyleGuide: '#predicate-methods'
4265
- Safe: false
4266
4660
  # This will change to a new method call which isn't guaranteed to be on the
4267
4661
  # object. Switching these methods has to be done with knowledge of the types
4268
4662
  # of the variables which rubocop doesn't have.
4269
- SafeAutoCorrect: false
4663
+ Safe: false
4270
4664
  Enabled: true
4271
4665
  VersionAdded: '0.42'
4272
4666
  VersionChanged: '0.59'
@@ -4274,12 +4668,26 @@ Style/NumericPredicate:
4274
4668
  SupportedStyles:
4275
4669
  - predicate
4276
4670
  - comparison
4277
- IgnoredMethods: []
4671
+ AllowedMethods: []
4672
+ AllowedPatterns: []
4278
4673
  # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
4279
4674
  # false positives.
4280
4675
  Exclude:
4281
4676
  - 'spec/**/*'
4282
4677
 
4678
+ Style/ObjectThen:
4679
+ Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
4680
+ StyleGuide: '#object-yield-self-vs-object-then'
4681
+ Enabled: true
4682
+ VersionAdded: '1.28'
4683
+ # Use `Object#yield_self` or `Object#then`?
4684
+ # Prefer `Object#yield_self` to `Object#then` (yield_self)
4685
+ # Prefer `Object#then` to `Object#yield_self` (then)
4686
+ EnforcedStyle: 'then'
4687
+ SupportedStyles:
4688
+ - then
4689
+ - yield_self
4690
+
4283
4691
  Style/OneLineConditional:
4284
4692
  Description: >-
4285
4693
  Favor the ternary operator (?:) or multi-line constructs over
@@ -4298,10 +4706,19 @@ Style/OpenStructUse:
4298
4706
  - https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
4299
4707
 
4300
4708
  Enabled: true
4709
+ Safe: false
4301
4710
  VersionAdded: '1.23'
4711
+ VersionChanged: '1.51'
4712
+
4713
+ Style/OperatorMethodCall:
4714
+ Description: 'Checks for redundant dot before operator method call.'
4715
+ StyleGuide: '#operator-method-call'
4716
+ Enabled: true
4717
+ VersionAdded: '1.37'
4302
4718
 
4303
4719
  Style/OptionHash:
4304
4720
  Description: "Don't use option hashes when you can use keyword arguments."
4721
+ StyleGuide: '#keyword-arguments-vs-option-hashes'
4305
4722
  Enabled: false
4306
4723
  VersionAdded: '0.33'
4307
4724
  VersionChanged: '0.34'
@@ -4371,6 +4788,7 @@ Style/PercentLiteralDelimiters:
4371
4788
  default: {}
4372
4789
  '%': '{}'
4373
4790
  '%i': '{}'
4791
+ '%I': '{}'
4374
4792
  '%q': '{}'
4375
4793
  '%Q': '{}'
4376
4794
  '%r': '{}'
@@ -4449,10 +4867,16 @@ Style/RedundantArgument:
4449
4867
  Enabled: true
4450
4868
  Safe: false
4451
4869
  VersionAdded: '1.4'
4452
- VersionChanged: '1.7'
4870
+ VersionChanged: '1.55'
4453
4871
  Methods:
4454
4872
  # Array#join
4455
4873
  join: ''
4874
+ # Array#sum
4875
+ sum: 0
4876
+ # Kernel.#exit
4877
+ exit: true
4878
+ # Kernel.#exit!
4879
+ exit!: false
4456
4880
  # String#split
4457
4881
  split: ' '
4458
4882
  # String#chomp
@@ -4460,6 +4884,11 @@ Style/RedundantArgument:
4460
4884
  # String#chomp!
4461
4885
  chomp!: "\n"
4462
4886
 
4887
+ Style/RedundantArrayConstructor:
4888
+ Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
4889
+ Enabled: true
4890
+ VersionAdded: '1.52'
4891
+
4463
4892
  Style/RedundantAssignment:
4464
4893
  Description: 'Checks for redundant assignment before returning.'
4465
4894
  Enabled: true
@@ -4487,6 +4916,27 @@ Style/RedundantConditional:
4487
4916
  Enabled: true
4488
4917
  VersionAdded: '0.50'
4489
4918
 
4919
+ Style/RedundantConstantBase:
4920
+ Description: Avoid redundant `::` prefix on constant.
4921
+ Enabled: true
4922
+ VersionAdded: '1.40'
4923
+
4924
+ Style/RedundantCurrentDirectoryInPath:
4925
+ Description: 'Checks for uses a redundant current directory in path.'
4926
+ Enabled: true
4927
+ VersionAdded: '1.53'
4928
+
4929
+ Style/RedundantDoubleSplatHashBraces:
4930
+ Description: 'Checks for redundant uses of double splat hash braces.'
4931
+ Enabled: true
4932
+ VersionAdded: '1.41'
4933
+
4934
+ Style/RedundantEach:
4935
+ Description: 'Checks for redundant `each`.'
4936
+ Enabled: true
4937
+ Safe: false
4938
+ VersionAdded: '1.38'
4939
+
4490
4940
  Style/RedundantException:
4491
4941
  Description: "Checks for an obsolete RuntimeException argument in raise/fail."
4492
4942
  StyleGuide: '#no-explicit-runtimeerror'
@@ -4515,16 +4965,45 @@ Style/RedundantFileExtensionInRequire:
4515
4965
  Enabled: true
4516
4966
  VersionAdded: '0.88'
4517
4967
 
4968
+ Style/RedundantFilterChain:
4969
+ Description: >-
4970
+ Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
4971
+ `select`/`filter`/`find_all` and change them to use predicate method instead.
4972
+ Enabled: true
4973
+ SafeAutoCorrect: false
4974
+ VersionAdded: '1.52'
4975
+ VersionChanged: '1.57'
4976
+
4518
4977
  Style/RedundantFreeze:
4519
4978
  Description: "Checks usages of Object#freeze on immutable objects."
4520
4979
  Enabled: true
4521
4980
  VersionAdded: '0.34'
4522
4981
  VersionChanged: '0.66'
4523
4982
 
4983
+ Style/RedundantHeredocDelimiterQuotes:
4984
+ Description: 'Checks for redundant heredoc delimiter quotes.'
4985
+ Enabled: true
4986
+ VersionAdded: '1.45'
4987
+
4988
+ Style/RedundantInitialize:
4989
+ Description: 'Checks for redundant `initialize` methods.'
4990
+ Enabled: true
4991
+ Safe: false
4992
+ AllowComments: true
4993
+ VersionAdded: '1.27'
4994
+ VersionChanged: '1.28'
4995
+
4524
4996
  Style/RedundantInterpolation:
4525
4997
  Description: 'Checks for strings that are just an interpolated expression.'
4526
4998
  Enabled: true
4999
+ SafeAutoCorrect: false
4527
5000
  VersionAdded: '0.76'
5001
+ VersionChanged: '1.30'
5002
+
5003
+ Style/RedundantLineContinuation:
5004
+ Description: 'Check for redundant line continuation.'
5005
+ Enabled: true
5006
+ VersionAdded: '1.49'
4528
5007
 
4529
5008
  Style/RedundantParentheses:
4530
5009
  Description: "Checks for parentheses that seem not to serve any purpose."
@@ -4537,11 +5016,21 @@ Style/RedundantPercentQ:
4537
5016
  Enabled: true
4538
5017
  VersionAdded: '0.76'
4539
5018
 
5019
+ Style/RedundantRegexpArgument:
5020
+ Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
5021
+ Enabled: true
5022
+ VersionAdded: '1.53'
5023
+
4540
5024
  Style/RedundantRegexpCharacterClass:
4541
5025
  Description: 'Checks for unnecessary single-element Regexp character classes.'
4542
5026
  Enabled: true
4543
5027
  VersionAdded: '0.85'
4544
5028
 
5029
+ Style/RedundantRegexpConstructor:
5030
+ Description: 'Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.'
5031
+ Enabled: true
5032
+ VersionAdded: '1.52'
5033
+
4545
5034
  Style/RedundantRegexpEscape:
4546
5035
  Description: 'Checks for redundant escapes in Regexps.'
4547
5036
  Enabled: true
@@ -4588,6 +5077,11 @@ Style/RedundantSortBy:
4588
5077
  Enabled: true
4589
5078
  VersionAdded: '0.36'
4590
5079
 
5080
+ Style/RedundantStringEscape:
5081
+ Description: 'Checks for redundant escapes in string literals.'
5082
+ Enabled: true
5083
+ VersionAdded: '1.37'
5084
+
4591
5085
  Style/RegexpLiteral:
4592
5086
  Description: 'Use / or %r around regular expressions.'
4593
5087
  StyleGuide: '#percent-r'
@@ -4606,6 +5100,12 @@ Style/RegexpLiteral:
4606
5100
  # are found in the regexp string.
4607
5101
  AllowInnerSlashes: false
4608
5102
 
5103
+ Style/RequireOrder:
5104
+ Description: Sort `require` and `require_relative` in alphabetical order.
5105
+ Enabled: false
5106
+ SafeAutoCorrect: false
5107
+ VersionAdded: '1.40'
5108
+
4609
5109
  Style/RescueModifier:
4610
5110
  Description: 'Avoid using rescue in its modifier form.'
4611
5111
  StyleGuide: '#no-rescue-modifiers'
@@ -4633,16 +5133,25 @@ Style/ReturnNil:
4633
5133
  - return_nil
4634
5134
  VersionAdded: '0.50'
4635
5135
 
5136
+ Style/ReturnNilInPredicateMethodDefinition:
5137
+ Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
5138
+ StyleGuide: '#bool-methods-qmark'
5139
+ Enabled: true
5140
+ SafeAutoCorrect: false
5141
+ AllowedMethods: []
5142
+ AllowedPatterns: []
5143
+ VersionAdded: '1.53'
5144
+
4636
5145
  Style/SafeNavigation:
4637
5146
  Description: >-
4638
- This cop transforms usages of a method call safeguarded by
5147
+ Transforms usages of a method call safeguarded by
4639
5148
  a check for the existence of the object to
4640
5149
  safe navigation (`&.`).
4641
- Auto-correction is unsafe as it assumes the object will
5150
+ Autocorrection is unsafe as it assumes the object will
4642
5151
  be `nil` or truthy, but never `false`.
4643
5152
  Enabled: true
4644
5153
  VersionAdded: '0.43'
4645
- VersionChanged: '0.77'
5154
+ VersionChanged: '1.27'
4646
5155
  # Safe navigation may cause a statement to start returning `nil` in addition
4647
5156
  # to whatever it used to return.
4648
5157
  ConvertCodeThatCanStartToReturnNil: false
@@ -4653,6 +5162,8 @@ Style/SafeNavigation:
4653
5162
  - try
4654
5163
  - try!
4655
5164
  SafeAutoCorrect: false
5165
+ # Maximum length of method chains for register an offense.
5166
+ MaxChainLength: 2
4656
5167
 
4657
5168
  Style/Sample:
4658
5169
  Description: >-
@@ -4723,6 +5234,12 @@ Style/SingleLineBlockParams:
4723
5234
  - acc
4724
5235
  - elem
4725
5236
 
5237
+ Style/SingleLineDoEndBlock:
5238
+ Description: 'Checks for single-line `do`...`end` blocks.'
5239
+ StyleGuide: '#single-line-do-end-block'
5240
+ Enabled: true
5241
+ VersionAdded: '1.57'
5242
+
4726
5243
  Style/SingleLineMethods:
4727
5244
  Description: 'Avoid single-line methods.'
4728
5245
  StyleGuide: '#no-single-line-methods'
@@ -4732,7 +5249,8 @@ Style/SingleLineMethods:
4732
5249
  AllowIfMethodIsEmpty: true
4733
5250
 
4734
5251
  Style/SlicingWithRange:
4735
- Description: 'Checks array slicing is done with endless ranges when suitable.'
5252
+ Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
5253
+ StyleGuide: '#slicing-with-ranges'
4736
5254
  Enabled: true
4737
5255
  VersionAdded: '0.83'
4738
5256
  Safe: false
@@ -4758,6 +5276,7 @@ Style/SpecialGlobalVars:
4758
5276
  SupportedStyles:
4759
5277
  - use_perl_names
4760
5278
  - use_english_names
5279
+ - use_builtin_english_names
4761
5280
 
4762
5281
  Style/StabbyLambdaParentheses:
4763
5282
  Description: 'Check for the usage of parentheses around stabby lambda arguments.'
@@ -4858,8 +5377,14 @@ Style/StructInheritance:
4858
5377
  VersionAdded: '0.29'
4859
5378
  VersionChanged: '1.20'
4860
5379
 
5380
+ Style/SuperWithArgsParentheses:
5381
+ Description: 'Use parentheses for `super` with arguments.'
5382
+ StyleGuide: '#super-with-args'
5383
+ Enabled: true
5384
+ VersionAdded: '1.58'
5385
+
4861
5386
  Style/SwapValues:
4862
- Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
5387
+ Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
4863
5388
  StyleGuide: '#values-swapping'
4864
5389
  Enabled: true
4865
5390
  VersionAdded: '1.1'
@@ -4868,10 +5393,10 @@ Style/SwapValues:
4868
5393
  Style/SymbolArray:
4869
5394
  Description: 'Use %i or %I for arrays of symbols.'
4870
5395
  StyleGuide: '#percent-i'
4871
- Enabled: false
5396
+ Enabled: true
4872
5397
  VersionAdded: '0.9'
4873
5398
  VersionChanged: '0.49'
4874
- EnforcedStyle: percent
5399
+ EnforcedStyle: brackets
4875
5400
  MinSize: 2
4876
5401
  SupportedStyles:
4877
5402
  - percent
@@ -4887,13 +5412,14 @@ Style/SymbolProc:
4887
5412
  Enabled: true
4888
5413
  Safe: false
4889
5414
  VersionAdded: '0.26'
4890
- VersionChanged: '1.5'
5415
+ VersionChanged: '1.40'
4891
5416
  AllowMethodsWithArguments: false
4892
- # A list of method names to be ignored by the check.
5417
+ # A list of method names to be always allowed by the check.
4893
5418
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4894
- IgnoredMethods:
4895
- - respond_to
5419
+ AllowedMethods:
4896
5420
  - define_method
5421
+ AllowedPatterns: []
5422
+ AllowComments: false
4897
5423
 
4898
5424
  Style/TernaryParentheses:
4899
5425
  Description: 'Checks for use of parentheses around ternary conditions.'
@@ -4908,7 +5434,7 @@ Style/TernaryParentheses:
4908
5434
  AllowSafeAssignment: true
4909
5435
 
4910
5436
  Style/TopLevelMethodDefinition:
4911
- Description: 'This cop looks for top-level method definitions.'
5437
+ Description: 'Looks for top-level method definitions.'
4912
5438
  StyleGuide: '#top-level-methods'
4913
5439
  Enabled: false
4914
5440
  VersionAdded: '1.15'
@@ -5018,7 +5544,7 @@ Style/TrivialAccessors:
5018
5544
  # on_exception :restart
5019
5545
  #
5020
5546
  # Commonly used in DSLs
5021
- AllowDSLWriters: true
5547
+ AllowDSLWriters: false
5022
5548
  IgnoreClassMethods: false
5023
5549
  AllowedMethods:
5024
5550
  - to_ary
@@ -5113,6 +5639,11 @@ Style/WordArray:
5113
5639
  # The regular expression `WordRegex` decides what is considered a word.
5114
5640
  WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
5115
5641
 
5642
+ Style/YAMLFileRead:
5643
+ Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
5644
+ Enabled: true
5645
+ VersionAdded: '1.53'
5646
+
5116
5647
  Style/YodaCondition:
5117
5648
  Description: 'Forbid or enforce yoda conditions.'
5118
5649
  Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
@@ -5131,6 +5662,19 @@ Style/YodaCondition:
5131
5662
  VersionAdded: '0.49'
5132
5663
  VersionChanged: '0.75'
5133
5664
 
5665
+ Style/YodaExpression:
5666
+ Description: 'Forbid the use of yoda expressions.'
5667
+ Enabled: false
5668
+ Safe: false
5669
+ VersionAdded: '1.42'
5670
+ VersionChanged: '1.43'
5671
+ SupportedOperators:
5672
+ - '*'
5673
+ - '+'
5674
+ - '&'
5675
+ - '|'
5676
+ - '^'
5677
+
5134
5678
  Style/ZeroLengthPredicate:
5135
5679
  Description: 'Use #empty? when testing for objects of length 0.'
5136
5680
  Enabled: true