rubocop 0.75.1 → 0.80.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +4 -4
  4. data/config/default.yml +374 -335
  5. data/lib/rubocop.rb +53 -32
  6. data/lib/rubocop/ast/builder.rb +43 -41
  7. data/lib/rubocop/ast/node.rb +5 -13
  8. data/lib/rubocop/ast/node/block_node.rb +2 -0
  9. data/lib/rubocop/ast/node/def_node.rb +11 -0
  10. data/lib/rubocop/ast/node/forward_args_node.rb +18 -0
  11. data/lib/rubocop/ast/node/regexp_node.rb +2 -4
  12. data/lib/rubocop/ast/node/return_node.rb +24 -0
  13. data/lib/rubocop/ast/traversal.rb +20 -3
  14. data/lib/rubocop/cli.rb +11 -227
  15. data/lib/rubocop/cli/command.rb +21 -0
  16. data/lib/rubocop/cli/command/auto_genenerate_config.rb +105 -0
  17. data/lib/rubocop/cli/command/base.rb +33 -0
  18. data/lib/rubocop/cli/command/execute_runner.rb +76 -0
  19. data/lib/rubocop/cli/command/init_dotfile.rb +45 -0
  20. data/lib/rubocop/cli/command/show_cops.rb +80 -0
  21. data/lib/rubocop/cli/command/version.rb +17 -0
  22. data/lib/rubocop/cli/environment.rb +21 -0
  23. data/lib/rubocop/comment_config.rb +8 -3
  24. data/lib/rubocop/config.rb +8 -1
  25. data/lib/rubocop/config_loader.rb +20 -20
  26. data/lib/rubocop/config_loader_resolver.rb +2 -1
  27. data/lib/rubocop/config_obsoletion.rb +73 -10
  28. data/lib/rubocop/config_validator.rb +77 -110
  29. data/lib/rubocop/cop/autocorrect_logic.rb +7 -4
  30. data/lib/rubocop/cop/bundler/gem_comment.rb +4 -4
  31. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +2 -2
  32. data/lib/rubocop/cop/commissioner.rb +15 -7
  33. data/lib/rubocop/cop/cop.rb +31 -6
  34. data/lib/rubocop/cop/corrector.rb +8 -7
  35. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -2
  36. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  37. data/lib/rubocop/cop/generator.rb +3 -4
  38. data/lib/rubocop/cop/generator/configuration_injector.rb +2 -2
  39. data/lib/rubocop/cop/internal_affairs.rb +1 -0
  40. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +59 -0
  41. data/lib/rubocop/cop/layout/{align_arguments.rb → argument_alignment.rb} +1 -1
  42. data/lib/rubocop/cop/layout/{align_array.rb → array_alignment.rb} +1 -1
  43. data/lib/rubocop/cop/layout/{indent_assignment.rb → assignment_indentation.rb} +1 -1
  44. data/lib/rubocop/cop/layout/comment_indentation.rb +10 -13
  45. data/lib/rubocop/cop/layout/empty_comment.rb +7 -16
  46. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -1
  47. data/lib/rubocop/cop/layout/end_of_line.rb +8 -3
  48. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
  49. data/lib/rubocop/cop/layout/{indent_first_argument.rb → first_argument_indentation.rb} +14 -12
  50. data/lib/rubocop/cop/layout/{indent_first_array_element.rb → first_array_element_indentation.rb} +4 -4
  51. data/lib/rubocop/cop/layout/{indent_first_hash_element.rb → first_hash_element_indentation.rb} +4 -4
  52. data/lib/rubocop/cop/layout/{indent_first_parameter.rb → first_parameter_indentation.rb} +3 -3
  53. data/lib/rubocop/cop/layout/{align_hash.rb → hash_alignment.rb} +16 -8
  54. data/lib/rubocop/cop/layout/{indent_heredoc.rb → heredoc_indentation.rb} +5 -5
  55. data/lib/rubocop/cop/layout/leading_comment_space.rb +33 -2
  56. data/lib/rubocop/cop/layout/{leading_blank_lines.rb → leading_empty_lines.rb} +1 -1
  57. data/lib/rubocop/cop/{metrics → layout}/line_length.rb +68 -112
  58. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
  59. data/lib/rubocop/cop/layout/multiline_block_layout.rb +14 -5
  60. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +0 -4
  61. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -1
  62. data/lib/rubocop/cop/layout/{align_parameters.rb → parameter_alignment.rb} +1 -1
  63. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -0
  64. data/lib/rubocop/cop/layout/space_around_keyword.rb +12 -0
  65. data/lib/rubocop/cop/layout/space_around_operators.rb +50 -7
  66. data/lib/rubocop/cop/layout/space_before_block_braces.rb +17 -0
  67. data/lib/rubocop/cop/layout/space_before_first_arg.rb +8 -0
  68. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +9 -7
  69. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +7 -4
  70. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +2 -9
  71. data/lib/rubocop/cop/layout/space_inside_parens.rb +6 -6
  72. data/lib/rubocop/cop/layout/{trailing_blank_lines.rb → trailing_empty_lines.rb} +1 -1
  73. data/lib/rubocop/cop/layout/trailing_whitespace.rb +18 -2
  74. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  75. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +1 -1
  76. data/lib/rubocop/cop/lint/{duplicated_key.rb → duplicate_hash_key.rb} +1 -1
  77. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  78. data/lib/rubocop/cop/lint/erb_new_arguments.rb +9 -8
  79. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
  80. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +2 -2
  81. data/lib/rubocop/cop/lint/{multiple_compare.rb → multiple_comparison.rb} +1 -1
  82. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +89 -0
  83. data/lib/rubocop/cop/lint/{unneeded_cop_disable_directive.rb → redundant_cop_disable_directive.rb} +26 -26
  84. data/lib/rubocop/cop/lint/{unneeded_cop_enable_directive.rb → redundant_cop_enable_directive.rb} +18 -15
  85. data/lib/rubocop/cop/lint/{unneeded_require_statement.rb → redundant_require_statement.rb} +1 -1
  86. data/lib/rubocop/cop/lint/{unneeded_splat_expansion.rb → redundant_splat_expansion.rb} +6 -6
  87. data/lib/rubocop/cop/lint/{string_conversion_in_interpolation.rb → redundant_string_coercion.rb} +1 -1
  88. data/lib/rubocop/cop/lint/redundant_with_index.rb +2 -2
  89. data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -2
  90. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +5 -6
  91. data/lib/rubocop/cop/lint/{handle_exceptions.rb → suppressed_exception.rb} +1 -1
  92. data/lib/rubocop/cop/lint/useless_access_modifier.rb +57 -23
  93. data/lib/rubocop/cop/lint/useless_setter_call.rb +5 -1
  94. data/lib/rubocop/cop/lint/void.rb +4 -4
  95. data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
  96. data/lib/rubocop/cop/metrics/method_length.rb +1 -1
  97. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +23 -6
  98. data/lib/rubocop/cop/migration/department_name.rb +30 -2
  99. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  100. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +4 -0
  101. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +7 -7
  102. data/lib/rubocop/cop/mixin/{hash_alignment.rb → hash_alignment_styles.rb} +1 -1
  103. data/lib/rubocop/cop/mixin/hash_transform_method.rb +172 -0
  104. data/lib/rubocop/cop/mixin/line_length_help.rb +88 -0
  105. data/lib/rubocop/cop/mixin/method_complexity.rb +2 -1
  106. data/lib/rubocop/cop/mixin/nil_methods.rb +4 -4
  107. data/lib/rubocop/cop/mixin/rational_literal.rb +18 -0
  108. data/lib/rubocop/cop/mixin/statement_modifier.rb +7 -4
  109. data/lib/rubocop/cop/mixin/trailing_comma.rb +16 -18
  110. data/lib/rubocop/cop/naming/{uncommunicative_block_param_name.rb → block_parameter_name.rb} +3 -3
  111. data/lib/rubocop/cop/naming/file_name.rb +12 -5
  112. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +5 -5
  113. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +1 -1
  114. data/lib/rubocop/cop/naming/{uncommunicative_method_param_name.rb → method_parameter_name.rb} +4 -4
  115. data/lib/rubocop/cop/naming/predicate_name.rb +6 -6
  116. data/lib/rubocop/cop/offense.rb +11 -0
  117. data/lib/rubocop/cop/registry.rb +8 -3
  118. data/lib/rubocop/cop/style/alias.rb +1 -1
  119. data/lib/rubocop/cop/style/array_join.rb +1 -1
  120. data/lib/rubocop/cop/style/attr.rb +10 -2
  121. data/lib/rubocop/cop/style/block_delimiters.rb +60 -1
  122. data/lib/rubocop/cop/style/comment_annotation.rb +5 -5
  123. data/lib/rubocop/cop/style/conditional_assignment.rb +2 -2
  124. data/lib/rubocop/cop/style/copyright.rb +11 -7
  125. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +2 -2
  126. data/lib/rubocop/cop/style/empty_case_condition.rb +2 -2
  127. data/lib/rubocop/cop/style/empty_literal.rb +2 -2
  128. data/lib/rubocop/cop/style/empty_method.rb +5 -5
  129. data/lib/rubocop/cop/style/eval_with_location.rb +1 -1
  130. data/lib/rubocop/cop/style/even_odd.rb +1 -1
  131. data/lib/rubocop/cop/style/format_string.rb +10 -7
  132. data/lib/rubocop/cop/style/format_string_token.rb +2 -0
  133. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +99 -11
  134. data/lib/rubocop/cop/style/guard_clause.rb +3 -2
  135. data/lib/rubocop/cop/style/hash_each_methods.rb +87 -0
  136. data/lib/rubocop/cop/style/hash_syntax.rb +2 -2
  137. data/lib/rubocop/cop/style/hash_transform_keys.rb +79 -0
  138. data/lib/rubocop/cop/style/hash_transform_values.rb +79 -0
  139. data/lib/rubocop/cop/style/if_unless_modifier.rb +45 -3
  140. data/lib/rubocop/cop/style/infinite_loop.rb +5 -4
  141. data/lib/rubocop/cop/style/inverse_methods.rb +19 -13
  142. data/lib/rubocop/cop/style/ip_addresses.rb +4 -4
  143. data/lib/rubocop/cop/style/line_end_concatenation.rb +14 -10
  144. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -205
  145. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +169 -0
  146. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +54 -0
  147. data/lib/rubocop/cop/style/method_def_parentheses.rb +17 -9
  148. data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
  149. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
  150. data/lib/rubocop/cop/style/multiline_when_then.rb +6 -2
  151. data/lib/rubocop/cop/style/nested_modifier.rb +4 -2
  152. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +5 -5
  153. data/lib/rubocop/cop/style/next.rb +5 -5
  154. data/lib/rubocop/cop/style/non_nil_check.rb +21 -9
  155. data/lib/rubocop/cop/style/numeric_literals.rb +7 -3
  156. data/lib/rubocop/cop/style/numeric_predicate.rb +4 -3
  157. data/lib/rubocop/cop/style/option_hash.rb +3 -3
  158. data/lib/rubocop/cop/style/or_assignment.rb +3 -2
  159. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +7 -7
  160. data/lib/rubocop/cop/style/{unneeded_capital_w.rb → redundant_capital_w.rb} +1 -1
  161. data/lib/rubocop/cop/style/{unneeded_condition.rb → redundant_condition.rb} +3 -3
  162. data/lib/rubocop/cop/style/{unneeded_interpolation.rb → redundant_interpolation.rb} +1 -1
  163. data/lib/rubocop/cop/style/redundant_parentheses.rb +3 -3
  164. data/lib/rubocop/cop/style/{unneeded_percent_q.rb → redundant_percent_q.rb} +1 -1
  165. data/lib/rubocop/cop/style/redundant_return.rb +27 -29
  166. data/lib/rubocop/cop/style/{unneeded_sort.rb → redundant_sort.rb} +5 -5
  167. data/lib/rubocop/cop/style/safe_navigation.rb +13 -10
  168. data/lib/rubocop/cop/style/semicolon.rb +2 -2
  169. data/lib/rubocop/cop/style/special_global_vars.rb +5 -7
  170. data/lib/rubocop/cop/style/symbol_array.rb +2 -2
  171. data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
  172. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +0 -22
  173. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +7 -1
  174. data/lib/rubocop/cop/style/trivial_accessors.rb +5 -5
  175. data/lib/rubocop/cop/style/while_until_modifier.rb +1 -1
  176. data/lib/rubocop/cop/style/yoda_condition.rb +16 -1
  177. data/lib/rubocop/cop/team.rb +5 -0
  178. data/lib/rubocop/cop/util.rb +1 -1
  179. data/lib/rubocop/cop/utils/format_string.rb +10 -18
  180. data/lib/rubocop/cop/variable_force.rb +11 -6
  181. data/lib/rubocop/formatter/base_formatter.rb +2 -2
  182. data/lib/rubocop/formatter/clang_style_formatter.rb +1 -3
  183. data/lib/rubocop/formatter/formatter_set.rb +1 -0
  184. data/lib/rubocop/formatter/json_formatter.rb +6 -5
  185. data/lib/rubocop/formatter/junit_formatter.rb +63 -0
  186. data/lib/rubocop/formatter/tap_formatter.rb +1 -3
  187. data/lib/rubocop/node_pattern.rb +100 -12
  188. data/lib/rubocop/options.rb +17 -11
  189. data/lib/rubocop/processed_source.rb +1 -1
  190. data/lib/rubocop/rake_task.rb +1 -0
  191. data/lib/rubocop/result_cache.rb +24 -8
  192. data/lib/rubocop/rspec/shared_contexts.rb +5 -0
  193. data/lib/rubocop/runner.rb +50 -29
  194. data/lib/rubocop/target_finder.rb +12 -6
  195. data/lib/rubocop/target_ruby.rb +151 -0
  196. data/lib/rubocop/version.rb +1 -1
  197. metadata +69 -35
  198. data/lib/rubocop/cop/mixin/safe_mode.rb +0 -24
  199. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +0 -209
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 354a14aa737b4743d04d65393e8caae409513d2302b31aca36090441100f1bdb
4
- data.tar.gz: 7bdbb625ae97e5e0f1a5ca6bfe0d93c71ac4a86a566ba13b987a293949486e51
3
+ metadata.gz: 7143484124cd6cb7ebff12de736d4ed5a17b5189d26ab6da3f8072cf9b3d6f7e
4
+ data.tar.gz: acd2182467726955151e8dc249833ed1fffacae4dc988037ec5fe73e1d5bb0c7
5
5
  SHA512:
6
- metadata.gz: bf54a562c567c28f118f5bf6bf0a9fb9e5987351559a001f80de025cb08793cd546731e80d3690dcce3ce8e0eda96381563ae307a5b0df303322c75331b8f14b
7
- data.tar.gz: 76fb85901be4d90de0697874bf0bea52c2a23e2b39fa9607ec797d6768465c4f903bc2645ebf41a504f526064aee2e0000f7bbd2701735787425770682b79ec8
6
+ metadata.gz: ae462c69bb5933c60f6254c4778fcddf4c778776b1d4c64247091bf36837c6899636d0d79a433c99aa5c64d1c4cccfbb9d1d8531a2b3a8418558899f6be61481
7
+ data.tar.gz: 844dd51ef4fef218ab42a742dbd7717b1a47c18b4cee630ba3da77279832292417a8e4c07486b59f821bc7d28ace0cdfaa917f574b1a35fa52bca7fc17da822f
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-19 Bozhidar Batsov
1
+ Copyright (c) 2012-20 Bozhidar Batsov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -41,7 +41,7 @@ automatically fix some of the problems for you.
41
41
  $ gem install rubocop
42
42
  ```
43
43
 
44
- If you'd rather install RuboCop using `bundler`, don't require it in your `Gemfile`:
44
+ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemfile` (but set the `require` option to `false`, as it is a standalone tool):
45
45
 
46
46
  ```rb
47
47
  gem 'rubocop', require: false
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
53
53
  might want to use a conservative version lock in your `Gemfile`:
54
54
 
55
55
  ```rb
56
- gem 'rubocop', '~> 0.75.1', require: false
56
+ gem 'rubocop', '~> 0.80.0', require: false
57
57
  ```
58
58
 
59
59
  ## Quickstart
@@ -74,7 +74,7 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
74
74
  RuboCop supports the following Ruby implementations:
75
75
 
76
76
  * MRI 2.3+
77
- * JRuby 9.1+
77
+ * JRuby 9.2+
78
78
 
79
79
  ## Team
80
80
 
@@ -213,5 +213,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
213
213
 
214
214
  ## Copyright
215
215
 
216
- Copyright (c) 2012-2019 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
216
+ Copyright (c) 2012-2020 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
217
217
  further details.
@@ -54,11 +54,13 @@ AllCops:
54
54
  - '**/Puppetfile'
55
55
  - '**/Rakefile'
56
56
  - '**/Snapfile'
57
+ - '**/Steepfile'
57
58
  - '**/Thorfile'
58
59
  - '**/Vagabondfile'
59
60
  - '**/Vagrantfile'
60
61
  Exclude:
61
62
  - 'node_modules/**/*'
63
+ - 'tmp/**/*'
62
64
  - 'vendor/**/*'
63
65
  - '.git/**/*'
64
66
  # Default formatter will be used if no `-f/--format` option is given.
@@ -141,11 +143,12 @@ Bundler/GemComment:
141
143
  Description: 'Add a comment describing each gem.'
142
144
  Enabled: false
143
145
  VersionAdded: '0.59'
146
+ VersionChanged: '0.77'
144
147
  Include:
145
148
  - '**/*.gemfile'
146
149
  - '**/Gemfile'
147
150
  - '**/gems.rb'
148
- Whitelist: []
151
+ IgnoredGems: []
149
152
 
150
153
  Bundler/InsecureProtocolSource:
151
154
  Description: >-
@@ -195,9 +198,10 @@ Gemspec/RequiredRubyVersion:
195
198
  VersionAdded: '0.52'
196
199
  Include:
197
200
  - '**/*.gemspec'
198
- -
201
+
199
202
  Gemspec/RubyVersionGlobalsUsage:
200
203
  Description: Checks usage of RUBY_VERSION in gemspec.
204
+ StyleGuide: '#no-ruby-version-in-the-gemspec'
201
205
  Enabled: true
202
206
  VersionAdded: '0.72'
203
207
  Include:
@@ -218,13 +222,14 @@ Layout/AccessModifierIndentation:
218
222
  # But it can be overridden by setting this parameter
219
223
  IndentationWidth: ~
220
224
 
221
- Layout/AlignArguments:
225
+ Layout/ArgumentAlignment:
222
226
  Description: >-
223
227
  Align the arguments of a method call if they span more
224
228
  than one line.
225
229
  StyleGuide: '#no-double-indent'
226
230
  Enabled: true
227
231
  VersionAdded: '0.68'
232
+ VersionChanged: '0.77'
228
233
  # Alignment of arguments in multi-line method calls.
229
234
  #
230
235
  # The `with_first_argument` style aligns the following lines along the same
@@ -246,117 +251,23 @@ Layout/AlignArguments:
246
251
  # But it can be overridden by setting this parameter
247
252
  IndentationWidth: ~
248
253
 
249
- Layout/AlignArray:
254
+ Layout/ArrayAlignment:
250
255
  Description: >-
251
256
  Align the elements of an array literal if they span more than
252
257
  one line.
253
258
  StyleGuide: '#align-multiline-arrays'
254
259
  Enabled: true
255
260
  VersionAdded: '0.49'
261
+ VersionChanged: '0.77'
256
262
 
257
- Layout/AlignHash:
263
+ Layout/AssignmentIndentation:
258
264
  Description: >-
259
- Align the elements of a hash literal if they span more than
260
- one line.
265
+ Checks the indentation of the first line of the
266
+ right-hand-side of a multi-line assignment.
261
267
  Enabled: true
262
- AllowMultipleStyles: true
263
268
  VersionAdded: '0.49'
264
- # Alignment of entries using hash rocket as separator. Valid values are:
265
- #
266
- # key - left alignment of keys
267
- # 'a' => 2
268
- # 'bb' => 3
269
- # separator - alignment of hash rockets, keys are right aligned
270
- # 'a' => 2
271
- # 'bb' => 3
272
- # table - left alignment of keys, hash rockets, and values
273
- # 'a' => 2
274
- # 'bb' => 3
275
- EnforcedHashRocketStyle: key
276
- SupportedHashRocketStyles:
277
- - key
278
- - separator
279
- - table
280
- # Alignment of entries using colon as separator. Valid values are:
281
- #
282
- # key - left alignment of keys
283
- # a: 0
284
- # bb: 1
285
- # separator - alignment of colons, keys are right aligned
286
- # a: 0
287
- # bb: 1
288
- # table - left alignment of keys and values
289
- # a: 0
290
- # bb: 1
291
- EnforcedColonStyle: key
292
- SupportedColonStyles:
293
- - key
294
- - separator
295
- - table
296
- # Select whether hashes that are the last argument in a method call should be
297
- # inspected? Valid values are:
298
- #
299
- # always_inspect - Inspect both implicit and explicit hashes.
300
- # Registers an offense for:
301
- # function(a: 1,
302
- # b: 2)
303
- # Registers an offense for:
304
- # function({a: 1,
305
- # b: 2})
306
- # always_ignore - Ignore both implicit and explicit hashes.
307
- # Accepts:
308
- # function(a: 1,
309
- # b: 2)
310
- # Accepts:
311
- # function({a: 1,
312
- # b: 2})
313
- # ignore_implicit - Ignore only implicit hashes.
314
- # Accepts:
315
- # function(a: 1,
316
- # b: 2)
317
- # Registers an offense for:
318
- # function({a: 1,
319
- # b: 2})
320
- # ignore_explicit - Ignore only explicit hashes.
321
- # Accepts:
322
- # function({a: 1,
323
- # b: 2})
324
- # Registers an offense for:
325
- # function(a: 1,
326
- # b: 2)
327
- EnforcedLastArgumentHashStyle: always_inspect
328
- SupportedLastArgumentHashStyles:
329
- - always_inspect
330
- - always_ignore
331
- - ignore_implicit
332
- - ignore_explicit
333
-
334
- Layout/AlignParameters:
335
- Description: >-
336
- Align the parameters of a method definition if they span more
337
- than one line.
338
- StyleGuide: '#no-double-indent'
339
- Enabled: true
340
- VersionAdded: '0.49'
341
- VersionChanged: '0.68'
342
- # Alignment of parameters in multi-line method calls.
343
- #
344
- # The `with_first_parameter` style aligns the following lines along the same
345
- # column as the first parameter.
346
- #
347
- # def method_foo(a,
348
- # b)
349
- #
350
- # The `with_fixed_indentation` style aligns the following lines with one
351
- # level of indentation relative to the start of the line with the method call.
352
- #
353
- # def method_foo(a,
354
- # b)
355
- EnforcedStyle: with_first_parameter
356
- SupportedStyles:
357
- - with_first_parameter
358
- - with_fixed_indentation
359
- # By default, the indentation width from Layout/IndentationWidth is used
269
+ VersionChanged: '0.77'
270
+ # By default, the indentation width from `Layout/IndentationWidth` is used
360
271
  # But it can be overridden by setting this parameter
361
272
  IndentationWidth: ~
362
273
 
@@ -624,56 +535,11 @@ Layout/ExtraSpacing:
624
535
  # When true, forces the alignment of `=` in assignments on consecutive lines.
625
536
  ForceEqualSignAlignment: false
626
537
 
627
- Layout/FirstArrayElementLineBreak:
628
- Description: >-
629
- Checks for a line break before the first element in a
630
- multi-line array.
631
- Enabled: false
632
- VersionAdded: '0.49'
633
-
634
- Layout/FirstHashElementLineBreak:
635
- Description: >-
636
- Checks for a line break before the first element in a
637
- multi-line hash.
638
- Enabled: false
639
- VersionAdded: '0.49'
640
-
641
- Layout/FirstMethodArgumentLineBreak:
642
- Description: >-
643
- Checks for a line break before the first argument in a
644
- multi-line method call.
645
- Enabled: false
646
- VersionAdded: '0.49'
647
-
648
- Layout/FirstMethodParameterLineBreak:
649
- Description: >-
650
- Checks for a line break before the first parameter in a
651
- multi-line method parameter definition.
652
- Enabled: false
653
- VersionAdded: '0.49'
654
-
655
- Layout/HeredocArgumentClosingParenthesis:
656
- Description: >-
657
- Checks for the placement of the closing parenthesis in a
658
- method call that passes a HEREDOC string as an argument.
659
- Enabled: false
660
- StyleGuide: '#heredoc-argument-closing-parentheses'
661
- VersionAdded: '0.68'
662
-
663
- Layout/IndentAssignment:
664
- Description: >-
665
- Checks the indentation of the first line of the
666
- right-hand-side of a multi-line assignment.
667
- Enabled: true
668
- VersionAdded: '0.49'
669
- # By default, the indentation width from `Layout/IndentationWidth` is used
670
- # But it can be overridden by setting this parameter
671
- IndentationWidth: ~
672
-
673
- Layout/IndentFirstArgument:
538
+ Layout/FirstArgumentIndentation:
674
539
  Description: 'Checks the indentation of the first argument in a method call.'
675
540
  Enabled: true
676
541
  VersionAdded: '0.68'
542
+ VersionChanged: '0.77'
677
543
  EnforcedStyle: special_for_inner_method_call_in_parentheses
678
544
  SupportedStyles:
679
545
  # The first parameter should always be indented one step more than the
@@ -694,12 +560,13 @@ Layout/IndentFirstArgument:
694
560
  # But it can be overridden by setting this parameter
695
561
  IndentationWidth: ~
696
562
 
697
- Layout/IndentFirstArrayElement:
563
+ Layout/FirstArrayElementIndentation:
698
564
  Description: >-
699
565
  Checks the indentation of the first element in an array
700
566
  literal.
701
567
  Enabled: true
702
568
  VersionAdded: '0.68'
569
+ VersionChanged: '0.77'
703
570
  # The value `special_inside_parentheses` means that array literals with
704
571
  # brackets that have their opening bracket on the same line as a surrounding
705
572
  # opening round parenthesis, shall have their first element indented relative
@@ -720,10 +587,18 @@ Layout/IndentFirstArrayElement:
720
587
  # But it can be overridden by setting this parameter
721
588
  IndentationWidth: ~
722
589
 
723
- Layout/IndentFirstHashElement:
590
+ Layout/FirstArrayElementLineBreak:
591
+ Description: >-
592
+ Checks for a line break before the first element in a
593
+ multi-line array.
594
+ Enabled: false
595
+ VersionAdded: '0.49'
596
+
597
+ Layout/FirstHashElementIndentation:
724
598
  Description: 'Checks the indentation of the first key in a hash literal.'
725
599
  Enabled: true
726
600
  VersionAdded: '0.68'
601
+ VersionChanged: '0.77'
727
602
  # The value `special_inside_parentheses` means that hash literals with braces
728
603
  # that have their opening brace on the same line as a surrounding opening
729
604
  # round parenthesis, shall have their first key indented relative to the
@@ -744,13 +619,34 @@ Layout/IndentFirstHashElement:
744
619
  # But it can be overridden by setting this parameter
745
620
  IndentationWidth: ~
746
621
 
747
- Layout/IndentFirstParameter:
622
+ Layout/FirstHashElementLineBreak:
623
+ Description: >-
624
+ Checks for a line break before the first element in a
625
+ multi-line hash.
626
+ Enabled: false
627
+ VersionAdded: '0.49'
628
+
629
+ Layout/FirstMethodArgumentLineBreak:
630
+ Description: >-
631
+ Checks for a line break before the first argument in a
632
+ multi-line method call.
633
+ Enabled: false
634
+ VersionAdded: '0.49'
635
+
636
+ Layout/FirstMethodParameterLineBreak:
637
+ Description: >-
638
+ Checks for a line break before the first parameter in a
639
+ multi-line method parameter definition.
640
+ Enabled: false
641
+ VersionAdded: '0.49'
642
+
643
+ Layout/FirstParameterIndentation:
748
644
  Description: >-
749
645
  Checks the indentation of the first parameter in a
750
646
  method definition.
751
647
  Enabled: true
752
648
  VersionAdded: '0.49'
753
- VersionChanged: '0.68'
649
+ VersionChanged: '0.77'
754
650
  EnforcedStyle: consistent
755
651
  SupportedStyles:
756
652
  - consistent
@@ -759,12 +655,98 @@ Layout/IndentFirstParameter:
759
655
  # But it can be overridden by setting this parameter
760
656
  IndentationWidth: ~
761
657
 
762
- Layout/IndentHeredoc:
658
+ Layout/HashAlignment:
659
+ Description: >-
660
+ Align the elements of a hash literal if they span more than
661
+ one line.
662
+ Enabled: true
663
+ AllowMultipleStyles: true
664
+ VersionAdded: '0.49'
665
+ VersionChanged: '0.77'
666
+ # Alignment of entries using hash rocket as separator. Valid values are:
667
+ #
668
+ # key - left alignment of keys
669
+ # 'a' => 2
670
+ # 'bb' => 3
671
+ # separator - alignment of hash rockets, keys are right aligned
672
+ # 'a' => 2
673
+ # 'bb' => 3
674
+ # table - left alignment of keys, hash rockets, and values
675
+ # 'a' => 2
676
+ # 'bb' => 3
677
+ EnforcedHashRocketStyle: key
678
+ SupportedHashRocketStyles:
679
+ - key
680
+ - separator
681
+ - table
682
+ # Alignment of entries using colon as separator. Valid values are:
683
+ #
684
+ # key - left alignment of keys
685
+ # a: 0
686
+ # bb: 1
687
+ # separator - alignment of colons, keys are right aligned
688
+ # a: 0
689
+ # bb: 1
690
+ # table - left alignment of keys and values
691
+ # a: 0
692
+ # bb: 1
693
+ EnforcedColonStyle: key
694
+ SupportedColonStyles:
695
+ - key
696
+ - separator
697
+ - table
698
+ # Select whether hashes that are the last argument in a method call should be
699
+ # inspected? Valid values are:
700
+ #
701
+ # always_inspect - Inspect both implicit and explicit hashes.
702
+ # Registers an offense for:
703
+ # function(a: 1,
704
+ # b: 2)
705
+ # Registers an offense for:
706
+ # function({a: 1,
707
+ # b: 2})
708
+ # always_ignore - Ignore both implicit and explicit hashes.
709
+ # Accepts:
710
+ # function(a: 1,
711
+ # b: 2)
712
+ # Accepts:
713
+ # function({a: 1,
714
+ # b: 2})
715
+ # ignore_implicit - Ignore only implicit hashes.
716
+ # Accepts:
717
+ # function(a: 1,
718
+ # b: 2)
719
+ # Registers an offense for:
720
+ # function({a: 1,
721
+ # b: 2})
722
+ # ignore_explicit - Ignore only explicit hashes.
723
+ # Accepts:
724
+ # function({a: 1,
725
+ # b: 2})
726
+ # Registers an offense for:
727
+ # function(a: 1,
728
+ # b: 2)
729
+ EnforcedLastArgumentHashStyle: always_inspect
730
+ SupportedLastArgumentHashStyles:
731
+ - always_inspect
732
+ - always_ignore
733
+ - ignore_implicit
734
+ - ignore_explicit
735
+
736
+ Layout/HeredocArgumentClosingParenthesis:
737
+ Description: >-
738
+ Checks for the placement of the closing parenthesis in a
739
+ method call that passes a HEREDOC string as an argument.
740
+ Enabled: false
741
+ StyleGuide: '#heredoc-argument-closing-parentheses'
742
+ VersionAdded: '0.68'
743
+
744
+ Layout/HeredocIndentation:
763
745
  Description: 'This cop checks the indentation of the here document bodies.'
764
746
  StyleGuide: '#squiggly-heredocs'
765
747
  Enabled: true
766
748
  VersionAdded: '0.49'
767
- VersionChanged: '0.69'
749
+ VersionChanged: '0.77'
768
750
  EnforcedStyle: squiggly
769
751
  SupportedStyles:
770
752
  - squiggly
@@ -806,11 +788,6 @@ Layout/InitialIndentation:
806
788
  Enabled: true
807
789
  VersionAdded: '0.49'
808
790
 
809
- Layout/LeadingBlankLines:
810
- Description: Check for unnecessary blank lines at the beginning of a file.
811
- Enabled: true
812
- VersionAdded: '0.57'
813
-
814
791
  Layout/LeadingCommentSpace:
815
792
  Description: 'Comments should start with a space.'
816
793
  StyleGuide: '#hash-space'
@@ -818,6 +795,36 @@ Layout/LeadingCommentSpace:
818
795
  VersionAdded: '0.49'
819
796
  VersionChanged: '0.73'
820
797
  AllowDoxygenCommentStyle: false
798
+ AllowGemfileRubyComment: false
799
+
800
+ Layout/LeadingEmptyLines:
801
+ Description: Check for unnecessary blank lines at the beginning of a file.
802
+ Enabled: true
803
+ VersionAdded: '0.57'
804
+ VersionChanged: '0.77'
805
+
806
+ Layout/LineLength:
807
+ Description: 'Limit lines to 80 characters.'
808
+ StyleGuide: '#80-character-limits'
809
+ Enabled: true
810
+ VersionAdded: '0.25'
811
+ VersionChanged: '0.78'
812
+ AutoCorrect: false
813
+ Max: 80
814
+ # To make it possible to copy or click on URIs in the code, we allow lines
815
+ # containing a URI to be longer than Max.
816
+ AllowHeredoc: true
817
+ AllowURI: true
818
+ URISchemes:
819
+ - http
820
+ - https
821
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
822
+ # directives like '# rubocop: enable ...' when calculating a line's length.
823
+ IgnoreCopDirectives: true
824
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
825
+ # elements. Strings will be converted to Regexp objects. A line that matches
826
+ # any regular expression listed in this option will be ignored by LineLength.
827
+ IgnoredPatterns: []
821
828
 
822
829
  Layout/MultilineArrayBraceLayout:
823
830
  Description: >-
@@ -960,6 +967,35 @@ Layout/MultilineOperationIndentation:
960
967
  # But it can be overridden by setting this parameter
961
968
  IndentationWidth: ~
962
969
 
970
+ Layout/ParameterAlignment:
971
+ Description: >-
972
+ Align the parameters of a method definition if they span more
973
+ than one line.
974
+ StyleGuide: '#no-double-indent'
975
+ Enabled: true
976
+ VersionAdded: '0.49'
977
+ VersionChanged: '0.77'
978
+ # Alignment of parameters in multi-line method calls.
979
+ #
980
+ # The `with_first_parameter` style aligns the following lines along the same
981
+ # column as the first parameter.
982
+ #
983
+ # def method_foo(a,
984
+ # b)
985
+ #
986
+ # The `with_fixed_indentation` style aligns the following lines with one
987
+ # level of indentation relative to the start of the line with the method call.
988
+ #
989
+ # def method_foo(a,
990
+ # b)
991
+ EnforcedStyle: with_first_parameter
992
+ SupportedStyles:
993
+ - with_first_parameter
994
+ - with_fixed_indentation
995
+ # By default, the indentation width from Layout/IndentationWidth is used
996
+ # But it can be overridden by setting this parameter
997
+ IndentationWidth: ~
998
+
963
999
  Layout/RescueEnsureAlignment:
964
1000
  Description: 'Align rescues and ensures correctly.'
965
1001
  Enabled: true
@@ -1033,6 +1069,10 @@ Layout/SpaceAroundOperators:
1033
1069
  # with an operator on the previous or next line, not counting empty lines
1034
1070
  # or comment lines.
1035
1071
  AllowForAlignment: true
1072
+ EnforcedStyleForExponentOperator: no_space
1073
+ SupportedStylesForExponentOperator:
1074
+ - space
1075
+ - no_space
1036
1076
 
1037
1077
  Layout/SpaceBeforeBlockBraces:
1038
1078
  Description: >-
@@ -1202,11 +1242,12 @@ Layout/Tab:
1202
1242
  # replace each tab.
1203
1243
  IndentationWidth: ~
1204
1244
 
1205
- Layout/TrailingBlankLines:
1245
+ Layout/TrailingEmptyLines:
1206
1246
  Description: 'Checks trailing blank lines and final newline.'
1207
1247
  StyleGuide: '#newline-eof'
1208
1248
  Enabled: true
1209
1249
  VersionAdded: '0.49'
1250
+ VersionChanged: '0.77'
1210
1251
  EnforcedStyle: final_newline
1211
1252
  SupportedStyles:
1212
1253
  - final_newline
@@ -1290,16 +1331,17 @@ Lint/DuplicateCaseCondition:
1290
1331
  Enabled: true
1291
1332
  VersionAdded: '0.45'
1292
1333
 
1334
+ Lint/DuplicateHashKey:
1335
+ Description: 'Check for duplicate keys in hash literals.'
1336
+ Enabled: true
1337
+ VersionAdded: '0.34'
1338
+ VersionChanged: '0.77'
1339
+
1293
1340
  Lint/DuplicateMethods:
1294
1341
  Description: 'Check for duplicate method definitions.'
1295
1342
  Enabled: true
1296
1343
  VersionAdded: '0.29'
1297
1344
 
1298
- Lint/DuplicatedKey:
1299
- Description: 'Check for duplicate keys in hash literals.'
1300
- Enabled: true
1301
- VersionAdded: '0.34'
1302
-
1303
1345
  Lint/EachWithObjectArgument:
1304
1346
  Description: 'Check for immutable argument given to each_with_object.'
1305
1347
  Enabled: true
@@ -1367,14 +1409,6 @@ Lint/FormatParameterMismatch:
1367
1409
  Enabled: true
1368
1410
  VersionAdded: '0.33'
1369
1411
 
1370
- Lint/HandleExceptions:
1371
- Description: "Don't suppress exception."
1372
- StyleGuide: '#dont-hide-exceptions'
1373
- Enabled: true
1374
- AllowComments: false
1375
- VersionAdded: '0.9'
1376
- VersionChanged: '0.70'
1377
-
1378
1412
  Lint/HeredocMethodCallPosition:
1379
1413
  Description: >-
1380
1414
  Checks for the ordering of a method call where
@@ -1444,10 +1478,11 @@ Lint/MissingCopEnableDirective:
1444
1478
  # .inf for any size
1445
1479
  MaximumRangeSize: .inf
1446
1480
 
1447
- Lint/MultipleCompare:
1448
- Description: "Use `&&` operator to compare multiple value."
1481
+ Lint/MultipleComparison:
1482
+ Description: "Use `&&` operator to compare multiple values."
1449
1483
  Enabled: true
1450
1484
  VersionAdded: '0.47'
1485
+ VersionChanged: '0.77'
1451
1486
 
1452
1487
  Lint/NestedMethodDefinition:
1453
1488
  Description: 'Do not use nested method definitions.'
@@ -1467,6 +1502,12 @@ Lint/NextWithoutAccumulator:
1467
1502
  Enabled: true
1468
1503
  VersionAdded: '0.36'
1469
1504
 
1505
+ Lint/NonDeterministicRequireOrder:
1506
+ Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1507
+ Enabled: true
1508
+ VersionAdded: '0.78'
1509
+ Safe: false
1510
+
1470
1511
  Lint/NonLocalExitFromIterator:
1471
1512
  Description: 'Do not use return in iterator to cause non-local exit.'
1472
1513
  Enabled: true
@@ -1512,6 +1553,36 @@ Lint/RandOne:
1512
1553
  Enabled: true
1513
1554
  VersionAdded: '0.36'
1514
1555
 
1556
+ Lint/RedundantCopDisableDirective:
1557
+ Description: >-
1558
+ Checks for rubocop:disable comments that can be removed.
1559
+ Note: this cop is not disabled when disabling all cops.
1560
+ It must be explicitly disabled.
1561
+ Enabled: true
1562
+ VersionAdded: '0.76'
1563
+
1564
+ Lint/RedundantCopEnableDirective:
1565
+ Description: Checks for rubocop:enable comments that can be removed.
1566
+ Enabled: true
1567
+ VersionAdded: '0.76'
1568
+
1569
+ Lint/RedundantRequireStatement:
1570
+ Description: 'Checks for unnecessary `require` statement.'
1571
+ Enabled: true
1572
+ VersionAdded: '0.76'
1573
+
1574
+ Lint/RedundantSplatExpansion:
1575
+ Description: 'Checks for splat unnecessarily being called on literals.'
1576
+ Enabled: true
1577
+ VersionChanged: '0.76'
1578
+
1579
+ Lint/RedundantStringCoercion:
1580
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1581
+ StyleGuide: '#no-to-s'
1582
+ Enabled: true
1583
+ VersionAdded: '0.19'
1584
+ VersionChanged: '0.77'
1585
+
1515
1586
  Lint/RedundantWithIndex:
1516
1587
  Description: 'Checks for redundant `with_index`.'
1517
1588
  Enabled: true
@@ -1557,8 +1628,8 @@ Lint/SafeNavigationChain:
1557
1628
  Description: 'Do not chain ordinary method call after safe navigation operator.'
1558
1629
  Enabled: true
1559
1630
  VersionAdded: '0.47'
1560
- VersionChanged: '0.56'
1561
- Whitelist:
1631
+ VersionChanged: '0.77'
1632
+ AllowedMethods:
1562
1633
  - present?
1563
1634
  - blank?
1564
1635
  - presence
@@ -1572,14 +1643,14 @@ Lint/SafeNavigationConsistency:
1572
1643
  for all method calls on that same object.
1573
1644
  Enabled: true
1574
1645
  VersionAdded: '0.55'
1575
- Whitelist:
1646
+ VersionChanged: '0.77'
1647
+ AllowedMethods:
1576
1648
  - present?
1577
1649
  - blank?
1578
1650
  - presence
1579
1651
  - try
1580
1652
  - try!
1581
1653
 
1582
-
1583
1654
  Lint/SafeNavigationWithEmpty:
1584
1655
  Description: 'Avoid `foo&.empty?` in conditionals.'
1585
1656
  Enabled: true
@@ -1617,12 +1688,13 @@ Lint/ShadowingOuterLocalVariable:
1617
1688
  Enabled: true
1618
1689
  VersionAdded: '0.9'
1619
1690
 
1620
- Lint/StringConversionInInterpolation:
1621
- Description: 'Checks for Object#to_s usage in string interpolation.'
1622
- StyleGuide: '#no-to-s'
1691
+ Lint/SuppressedException:
1692
+ Description: "Don't suppress exceptions."
1693
+ StyleGuide: '#dont-hide-exceptions'
1623
1694
  Enabled: true
1624
- VersionAdded: '0.19'
1625
- VersionChanged: '0.20'
1695
+ AllowComments: false
1696
+ VersionAdded: '0.9'
1697
+ VersionChanged: '0.77'
1626
1698
 
1627
1699
  Lint/Syntax:
1628
1700
  Description: 'Checks syntax error.'
@@ -1645,30 +1717,6 @@ Lint/UnifiedInteger:
1645
1717
  Enabled: true
1646
1718
  VersionAdded: '0.43'
1647
1719
 
1648
- Lint/UnneededCopDisableDirective:
1649
- Description: >-
1650
- Checks for rubocop:disable comments that can be removed.
1651
- Note: this cop is not disabled when disabling all cops.
1652
- It must be explicitly disabled.
1653
- Enabled: true
1654
- VersionAdded: '0.53'
1655
-
1656
- Lint/UnneededCopEnableDirective:
1657
- Description: Checks for rubocop:enable comments that can be removed.
1658
- Enabled: true
1659
- VersionAdded: '0.53'
1660
-
1661
- Lint/UnneededRequireStatement:
1662
- Description: 'Checks for unnecessary `require` statement.'
1663
- Enabled: true
1664
- VersionAdded: '0.51'
1665
-
1666
- Lint/UnneededSplatExpansion:
1667
- Description: 'Checks for splat unnecessarily being called on literals.'
1668
- Enabled: true
1669
- VersionAdded: '0.43'
1670
- VersionChanged: '0.74'
1671
-
1672
1720
  Lint/UnreachableCode:
1673
1721
  Description: 'Unreachable code.'
1674
1722
  Enabled: true
@@ -1736,6 +1784,8 @@ Lint/UselessSetterCall:
1736
1784
  Description: 'Checks for useless setter call to a local variable.'
1737
1785
  Enabled: true
1738
1786
  VersionAdded: '0.13'
1787
+ VersionChanged: '0.80'
1788
+ Safe: false
1739
1789
 
1740
1790
  Lint/Void:
1741
1791
  Description: 'Possible use of operator/literal/variable in void context.'
@@ -1798,29 +1848,6 @@ Metrics/CyclomaticComplexity:
1798
1848
  VersionAdded: '0.25'
1799
1849
  Max: 6
1800
1850
 
1801
- Metrics/LineLength:
1802
- Description: 'Limit lines to 80 characters.'
1803
- StyleGuide: '#80-character-limits'
1804
- Enabled: true
1805
- VersionAdded: '0.25'
1806
- VersionChanged: '0.68'
1807
- AutoCorrect: false
1808
- Max: 80
1809
- # To make it possible to copy or click on URIs in the code, we allow lines
1810
- # containing a URI to be longer than Max.
1811
- AllowHeredoc: true
1812
- AllowURI: true
1813
- URISchemes:
1814
- - http
1815
- - https
1816
- # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1817
- # directives like '# rubocop: enable ...' when calculating a line's length.
1818
- IgnoreCopDirectives: true
1819
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1820
- # elements. Strings will be converted to Regexp objects. A line that matches
1821
- # any regular expression listed in this option will be ignored by LineLength.
1822
- IgnoredPatterns: []
1823
-
1824
1851
  Metrics/MethodLength:
1825
1852
  Description: 'Avoid methods longer than 10 lines of code.'
1826
1853
  StyleGuide: '#short-methods'
@@ -1860,7 +1887,7 @@ Migration/DepartmentName:
1860
1887
  Description: >-
1861
1888
  Check that cop names in rubocop:disable (etc) comments are
1862
1889
  given with department name.
1863
- Enabled: false
1890
+ Enabled: true
1864
1891
 
1865
1892
  #################### Naming ##############################
1866
1893
 
@@ -1882,6 +1909,21 @@ Naming/BinaryOperatorParameterName:
1882
1909
  Enabled: true
1883
1910
  VersionAdded: '0.50'
1884
1911
 
1912
+ Naming/BlockParameterName:
1913
+ Description: >-
1914
+ Checks for block parameter names that contain capital letters,
1915
+ end in numbers, or do not meet a minimal length.
1916
+ Enabled: true
1917
+ VersionAdded: '0.53'
1918
+ VersionChanged: '0.77'
1919
+ # Parameter names may be equal to or greater than this value
1920
+ MinNameLength: 1
1921
+ AllowNamesEndingInNumbers: true
1922
+ # Allowed names that will not register an offense
1923
+ AllowedNames: []
1924
+ # Forbidden names that will register an offense
1925
+ ForbiddenNames: []
1926
+
1885
1927
  Naming/ClassAndModuleCamelCase:
1886
1928
  Description: 'Use CamelCase for classes and modules.'
1887
1929
  StyleGuide: '#camelcase-classes'
@@ -1973,7 +2015,7 @@ Naming/HeredocDelimiterNaming:
1973
2015
  StyleGuide: '#heredoc-delimiters'
1974
2016
  Enabled: true
1975
2017
  VersionAdded: '0.50'
1976
- Blacklist:
2018
+ ForbiddenDelimiters:
1977
2019
  - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
1978
2020
 
1979
2021
  Naming/MemoizedInstanceVariableName:
@@ -2005,25 +2047,51 @@ Naming/MethodName:
2005
2047
  #
2006
2048
  IgnoredPatterns: []
2007
2049
 
2050
+ Naming/MethodParameterName:
2051
+ Description: >-
2052
+ Checks for method parameter names that contain capital letters,
2053
+ end in numbers, or do not meet a minimal length.
2054
+ Enabled: true
2055
+ VersionAdded: '0.53'
2056
+ VersionChanged: '0.77'
2057
+ # Parameter names may be equal to or greater than this value
2058
+ MinNameLength: 3
2059
+ AllowNamesEndingInNumbers: true
2060
+ # Allowed names that will not register an offense
2061
+ AllowedNames:
2062
+ - io
2063
+ - id
2064
+ - to
2065
+ - by
2066
+ - 'on'
2067
+ - in
2068
+ - at
2069
+ - ip
2070
+ - db
2071
+ - os
2072
+ - pp
2073
+ # Forbidden names that will register an offense
2074
+ ForbiddenNames: []
2075
+
2008
2076
  Naming/PredicateName:
2009
2077
  Description: 'Check the names of predicate methods.'
2010
2078
  StyleGuide: '#bool-methods-qmark'
2011
2079
  Enabled: true
2012
2080
  VersionAdded: '0.50'
2013
- VersionChanged: '0.51'
2081
+ VersionChanged: '0.77'
2014
2082
  # Predicate name prefixes.
2015
2083
  NamePrefix:
2016
2084
  - is_
2017
2085
  - has_
2018
2086
  - have_
2019
2087
  # Predicate name prefixes that should be removed.
2020
- NamePrefixBlacklist:
2088
+ ForbiddenPrefixes:
2021
2089
  - is_
2022
2090
  - has_
2023
2091
  - have_
2024
- # Predicate names which, despite having a blacklisted prefix, or no `?`,
2092
+ # Predicate names which, despite having a forbidden prefix, or no `?`,
2025
2093
  # should still be accepted
2026
- NameWhitelist:
2094
+ AllowedMethods:
2027
2095
  - is_a?
2028
2096
  # Method definition macros for dynamically generated methods.
2029
2097
  MethodDefinitionMacros:
@@ -2041,45 +2109,6 @@ Naming/RescuedExceptionsVariableName:
2041
2109
  VersionChanged: '0.68'
2042
2110
  PreferredName: e
2043
2111
 
2044
- Naming/UncommunicativeBlockParamName:
2045
- Description: >-
2046
- Checks for block parameter names that contain capital letters,
2047
- end in numbers, or do not meet a minimal length.
2048
- Enabled: true
2049
- VersionAdded: '0.53'
2050
- # Parameter names may be equal to or greater than this value
2051
- MinNameLength: 1
2052
- AllowNamesEndingInNumbers: true
2053
- # Whitelisted names that will not register an offense
2054
- AllowedNames: []
2055
- # Blacklisted names that will register an offense
2056
- ForbiddenNames: []
2057
-
2058
- Naming/UncommunicativeMethodParamName:
2059
- Description: >-
2060
- Checks for method parameter names that contain capital letters,
2061
- end in numbers, or do not meet a minimal length.
2062
- Enabled: true
2063
- VersionAdded: '0.53'
2064
- VersionChanged: '0.59'
2065
- # Parameter names may be equal to or greater than this value
2066
- MinNameLength: 3
2067
- AllowNamesEndingInNumbers: true
2068
- # Whitelisted names that will not register an offense
2069
- AllowedNames:
2070
- - io
2071
- - id
2072
- - to
2073
- - by
2074
- - 'on'
2075
- - in
2076
- - at
2077
- - ip
2078
- - db
2079
- # Blacklisted names that will register an offense
2080
- ForbiddenNames: []
2081
-
2082
-
2083
2112
  Naming/VariableName:
2084
2113
  Description: 'Use the configured style when naming variables.'
2085
2114
  StyleGuide: '#snake-case-symbols-methods-vars'
@@ -2331,24 +2360,12 @@ Style/BlockDelimiters:
2331
2360
  # # also good
2332
2361
  # collection.each do |element| puts element end
2333
2362
  AllowBracesOnProceduralOneLiners: false
2334
-
2335
- Style/BracesAroundHashParameters:
2336
- Description: 'Enforce braces style around hash parameters.'
2337
- Enabled: true
2338
- VersionAdded: '0.14.1'
2339
- VersionChanged: '0.28'
2340
- EnforcedStyle: no_braces
2341
- SupportedStyles:
2342
- # The `braces` style enforces braces around all method parameters that are
2343
- # hashes.
2344
- - braces
2345
- # The `no_braces` style checks that the last parameter doesn't have braces
2346
- # around it.
2347
- - no_braces
2348
- # The `context_dependent` style checks that the last parameter doesn't have
2349
- # braces around it, but requires braces if the second to last parameter is
2350
- # also a hash literal.
2351
- - context_dependent
2363
+ # The BracesRequiredMethods overrides all other configurations except
2364
+ # IgnoredMethods. It can be used to enforce that all blocks for specific
2365
+ # methods use braces. For example, you can use this to enforce Sorbet
2366
+ # signatures use braces even when the rest of your codebase enforces
2367
+ # the `line_count_based` style.
2368
+ BracesRequiredMethods: []
2352
2369
 
2353
2370
  Style/CaseEquality:
2354
2371
  Description: 'Avoid explicit use of the case equality operator(===).'
@@ -2734,7 +2751,7 @@ Style/FrozenStringLiteralComment:
2734
2751
  to help transition to frozen string literals by default.
2735
2752
  Enabled: true
2736
2753
  VersionAdded: '0.36'
2737
- VersionChanged: '0.69'
2754
+ VersionChanged: '0.79'
2738
2755
  EnforcedStyle: always
2739
2756
  SupportedStyles:
2740
2757
  # `always` will always add the frozen string literal comment to a file
@@ -2742,9 +2759,14 @@ Style/FrozenStringLiteralComment:
2742
2759
  # string literal. If you run code against multiple versions of Ruby, it is
2743
2760
  # possible that this will create errors in Ruby 2.3.0+.
2744
2761
  - always
2762
+ # `always_true` will add the frozen string literal comment to a file,
2763
+ # similarly to the `always` style, but will also change any disabled
2764
+ # comments (e.g. `# frozen_string_literal: false`) to be enabled.
2765
+ - always_true
2745
2766
  # `never` will enforce that the frozen string literal comment does not
2746
2767
  # exist in a file.
2747
2768
  - never
2769
+ Safe: false
2748
2770
 
2749
2771
  Style/GlobalVars:
2750
2772
  Description: 'Do not introduce global variables.'
@@ -2765,6 +2787,13 @@ Style/GuardClause:
2765
2787
  # needs to have to trigger this cop
2766
2788
  MinBodyLength: 1
2767
2789
 
2790
+ Style/HashEachMethods:
2791
+ Description: 'Use Hash#each_key and Hash#each_value.'
2792
+ StyleGuide: '#hash-each'
2793
+ Enabled: pending
2794
+ VersionAdded: '0.80'
2795
+ Safe: false
2796
+
2768
2797
  Style/HashSyntax:
2769
2798
  Description: >-
2770
2799
  Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
@@ -2788,6 +2817,16 @@ Style/HashSyntax:
2788
2817
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
2789
2818
  PreferHashRocketsForNonAlnumEndingSymbols: false
2790
2819
 
2820
+ Style/HashTransformKeys:
2821
+ Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
2822
+ Enabled: 'pending'
2823
+ Safe: false
2824
+
2825
+ Style/HashTransformValues:
2826
+ Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
2827
+ Enabled: 'pending'
2828
+ Safe: false
2829
+
2791
2830
  Style/IdenticalConditionalBranches:
2792
2831
  Description: >-
2793
2832
  Checks that conditional statements do not have an identical
@@ -2874,8 +2913,9 @@ Style/IpAddresses:
2874
2913
  Description: "Don't include literal IP addresses in code."
2875
2914
  Enabled: false
2876
2915
  VersionAdded: '0.58'
2877
- # Allow strings to be whitelisted
2878
- Whitelist:
2916
+ VersionChanged: '0.77'
2917
+ # Allow addresses to be permitted
2918
+ AllowedAddresses:
2879
2919
  - "::"
2880
2920
  # :: is a valid IPv6 address, but could potentially be legitimately in code
2881
2921
 
@@ -3148,8 +3188,8 @@ Style/NestedParenthesizedCalls:
3148
3188
  argument list of another parenthesized method call.
3149
3189
  Enabled: true
3150
3190
  VersionAdded: '0.36'
3151
- VersionChanged: '0.50'
3152
- Whitelist:
3191
+ VersionChanged: '0.77'
3192
+ AllowedMethods:
3153
3193
  - be
3154
3194
  - be_a
3155
3195
  - be_an
@@ -3402,6 +3442,16 @@ Style/RedundantBegin:
3402
3442
  VersionAdded: '0.10'
3403
3443
  VersionChanged: '0.21'
3404
3444
 
3445
+ Style/RedundantCapitalW:
3446
+ Description: 'Checks for %W when interpolation is not needed.'
3447
+ Enabled: true
3448
+ VersionAdded: '0.76'
3449
+
3450
+ Style/RedundantCondition:
3451
+ Description: 'Checks for unnecessary conditional expressions.'
3452
+ Enabled: true
3453
+ VersionAdded: '0.76'
3454
+
3405
3455
  Style/RedundantConditional:
3406
3456
  Description: "Don't return true/false from a conditional."
3407
3457
  Enabled: true
@@ -3420,11 +3470,22 @@ Style/RedundantFreeze:
3420
3470
  VersionAdded: '0.34'
3421
3471
  VersionChanged: '0.66'
3422
3472
 
3473
+ Style/RedundantInterpolation:
3474
+ Description: 'Checks for strings that are just an interpolated expression.'
3475
+ Enabled: true
3476
+ VersionAdded: '0.76'
3477
+
3423
3478
  Style/RedundantParentheses:
3424
3479
  Description: "Checks for parentheses that seem not to serve any purpose."
3425
3480
  Enabled: true
3426
3481
  VersionAdded: '0.36'
3427
3482
 
3483
+ Style/RedundantPercentQ:
3484
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
3485
+ StyleGuide: '#percent-q'
3486
+ Enabled: true
3487
+ VersionAdded: '0.76'
3488
+
3428
3489
  Style/RedundantReturn:
3429
3490
  Description: "Don't use return where it's not required."
3430
3491
  StyleGuide: '#no-explicit-return'
@@ -3441,6 +3502,13 @@ Style/RedundantSelf:
3441
3502
  VersionAdded: '0.10'
3442
3503
  VersionChanged: '0.13'
3443
3504
 
3505
+ Style/RedundantSort:
3506
+ Description: >-
3507
+ Use `min` instead of `sort.first`,
3508
+ `max_by` instead of `sort_by...last`, etc.
3509
+ Enabled: true
3510
+ VersionAdded: '0.76'
3511
+
3444
3512
  Style/RedundantSortBy:
3445
3513
  Description: 'Use `sort` instead of `sort_by { |x| x }`.'
3446
3514
  Enabled: true
@@ -3498,11 +3566,11 @@ Style/SafeNavigation:
3498
3566
  safe navigation (`&.`).
3499
3567
  Enabled: true
3500
3568
  VersionAdded: '0.43'
3501
- VersionChanged: '0.56'
3569
+ VersionChanged: '0.77'
3502
3570
  # Safe navigation may cause a statement to start returning `nil` in addition
3503
3571
  # to whatever it used to return.
3504
3572
  ConvertCodeThatCanStartToReturnNil: false
3505
- Whitelist:
3573
+ AllowedMethods:
3506
3574
  - present?
3507
3575
  - blank?
3508
3576
  - presence
@@ -3780,7 +3848,7 @@ Style/TrivialAccessors:
3780
3848
  StyleGuide: '#attr_family'
3781
3849
  Enabled: true
3782
3850
  VersionAdded: '0.9'
3783
- VersionChanged: '0.38'
3851
+ VersionChanged: '0.77'
3784
3852
  # When set to `false` the cop will suggest the use of accessor methods
3785
3853
  # in situations like:
3786
3854
  #
@@ -3801,7 +3869,7 @@ Style/TrivialAccessors:
3801
3869
  # Commonly used in DSLs
3802
3870
  AllowDSLWriters: false
3803
3871
  IgnoreClassMethods: false
3804
- Whitelist:
3872
+ AllowedMethods:
3805
3873
  - to_ary
3806
3874
  - to_a
3807
3875
  - to_c
@@ -3828,35 +3896,6 @@ Style/UnlessElse:
3828
3896
  Enabled: true
3829
3897
  VersionAdded: '0.9'
3830
3898
 
3831
- Style/UnneededCapitalW:
3832
- Description: 'Checks for %W when interpolation is not needed.'
3833
- Enabled: true
3834
- VersionAdded: '0.21'
3835
- VersionChanged: '0.24'
3836
-
3837
- Style/UnneededCondition:
3838
- Description: 'Checks for unnecessary conditional expressions.'
3839
- Enabled: true
3840
- VersionAdded: '0.57'
3841
-
3842
- Style/UnneededInterpolation:
3843
- Description: 'Checks for strings that are just an interpolated expression.'
3844
- Enabled: true
3845
- VersionAdded: '0.36'
3846
-
3847
- Style/UnneededPercentQ:
3848
- Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
3849
- StyleGuide: '#percent-q'
3850
- Enabled: true
3851
- VersionAdded: '0.24'
3852
-
3853
- Style/UnneededSort:
3854
- Description: >-
3855
- Use `min` instead of `sort.first`,
3856
- `max_by` instead of `sort_by...last`, etc.
3857
- Enabled: true
3858
- VersionAdded: '0.55'
3859
-
3860
3899
  Style/UnpackFirst:
3861
3900
  Description: >-
3862
3901
  Checks for accessing the first element of `String#unpack`