rubocop 0.74.0 → 0.78.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -2
  3. data/config/default.yml +366 -318
  4. data/lib/rubocop.rb +48 -32
  5. data/lib/rubocop/ast/builder.rb +1 -0
  6. data/lib/rubocop/ast/node.rb +5 -1
  7. data/lib/rubocop/ast/node/block_node.rb +2 -0
  8. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +1 -12
  9. data/lib/rubocop/ast/node/return_node.rb +24 -0
  10. data/lib/rubocop/cli.rb +11 -227
  11. data/lib/rubocop/cli/command.rb +21 -0
  12. data/lib/rubocop/cli/command/auto_genenerate_config.rb +105 -0
  13. data/lib/rubocop/cli/command/base.rb +33 -0
  14. data/lib/rubocop/cli/command/execute_runner.rb +76 -0
  15. data/lib/rubocop/cli/command/init_dotfile.rb +45 -0
  16. data/lib/rubocop/cli/command/show_cops.rb +73 -0
  17. data/lib/rubocop/cli/command/version.rb +17 -0
  18. data/lib/rubocop/cli/environment.rb +21 -0
  19. data/lib/rubocop/comment_config.rb +5 -4
  20. data/lib/rubocop/config.rb +12 -1
  21. data/lib/rubocop/config_loader.rb +21 -3
  22. data/lib/rubocop/config_loader_resolver.rb +4 -3
  23. data/lib/rubocop/config_obsoletion.rb +85 -11
  24. data/lib/rubocop/config_validator.rb +28 -19
  25. data/lib/rubocop/cop/autocorrect_logic.rb +3 -3
  26. data/lib/rubocop/cop/bundler/gem_comment.rb +4 -4
  27. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +2 -2
  28. data/lib/rubocop/cop/commissioner.rb +15 -7
  29. data/lib/rubocop/cop/cop.rb +35 -9
  30. data/lib/rubocop/cop/corrector.rb +8 -7
  31. data/lib/rubocop/cop/correctors/alignment_corrector.rb +43 -17
  32. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +2 -2
  33. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
  34. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -2
  35. data/lib/rubocop/cop/generator.rb +3 -3
  36. data/lib/rubocop/cop/generator/configuration_injector.rb +9 -4
  37. data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
  38. data/lib/rubocop/cop/internal_affairs.rb +1 -0
  39. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +59 -0
  40. data/lib/rubocop/cop/layout/{align_arguments.rb → argument_alignment.rb} +1 -1
  41. data/lib/rubocop/cop/layout/{align_array.rb → array_alignment.rb} +1 -1
  42. data/lib/rubocop/cop/layout/{indent_assignment.rb → assignment_indentation.rb} +11 -2
  43. data/lib/rubocop/cop/layout/block_alignment.rb +2 -2
  44. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
  45. data/lib/rubocop/cop/layout/comment_indentation.rb +10 -13
  46. data/lib/rubocop/cop/layout/empty_comment.rb +7 -16
  47. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +22 -7
  48. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +2 -2
  49. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +2 -2
  50. data/lib/rubocop/cop/layout/end_of_line.rb +8 -3
  51. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -7
  52. data/lib/rubocop/cop/layout/{indent_first_argument.rb → first_argument_indentation.rb} +14 -12
  53. data/lib/rubocop/cop/layout/{indent_first_array_element.rb → first_array_element_indentation.rb} +4 -4
  54. data/lib/rubocop/cop/layout/{indent_first_hash_element.rb → first_hash_element_indentation.rb} +4 -4
  55. data/lib/rubocop/cop/layout/{indent_first_parameter.rb → first_parameter_indentation.rb} +3 -3
  56. data/lib/rubocop/cop/layout/{align_hash.rb → hash_alignment.rb} +8 -4
  57. data/lib/rubocop/cop/layout/{indent_heredoc.rb → heredoc_indentation.rb} +6 -6
  58. data/lib/rubocop/cop/layout/{leading_blank_lines.rb → leading_empty_lines.rb} +1 -1
  59. data/lib/rubocop/cop/{metrics → layout}/line_length.rb +41 -114
  60. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
  61. data/lib/rubocop/cop/layout/multiline_block_layout.rb +24 -2
  62. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -1
  63. data/lib/rubocop/cop/layout/{align_parameters.rb → parameter_alignment.rb} +1 -1
  64. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -0
  65. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +5 -1
  66. data/lib/rubocop/cop/layout/space_around_keyword.rb +12 -0
  67. data/lib/rubocop/cop/layout/space_around_operators.rb +32 -7
  68. data/lib/rubocop/cop/layout/space_before_block_braces.rb +17 -0
  69. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +9 -7
  70. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +8 -5
  71. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +7 -0
  72. data/lib/rubocop/cop/layout/space_inside_parens.rb +6 -6
  73. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +2 -0
  74. data/lib/rubocop/cop/layout/{trailing_blank_lines.rb → trailing_empty_lines.rb} +1 -1
  75. data/lib/rubocop/cop/layout/trailing_whitespace.rb +18 -2
  76. data/lib/rubocop/cop/lint/assignment_in_condition.rb +17 -4
  77. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  78. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +1 -1
  79. data/lib/rubocop/cop/lint/{duplicated_key.rb → duplicate_hash_key.rb} +1 -1
  80. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  81. data/lib/rubocop/cop/lint/erb_new_arguments.rb +9 -8
  82. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +10 -36
  83. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
  84. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +2 -2
  85. data/lib/rubocop/cop/lint/{multiple_compare.rb → multiple_comparison.rb} +1 -1
  86. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +89 -0
  87. data/lib/rubocop/cop/lint/number_conversion.rb +1 -1
  88. data/lib/rubocop/cop/lint/{unneeded_cop_disable_directive.rb → redundant_cop_disable_directive.rb} +26 -26
  89. data/lib/rubocop/cop/lint/{unneeded_cop_enable_directive.rb → redundant_cop_enable_directive.rb} +10 -12
  90. data/lib/rubocop/cop/lint/{unneeded_require_statement.rb → redundant_require_statement.rb} +1 -1
  91. data/lib/rubocop/cop/lint/{unneeded_splat_expansion.rb → redundant_splat_expansion.rb} +6 -6
  92. data/lib/rubocop/cop/lint/{string_conversion_in_interpolation.rb → redundant_string_coercion.rb} +1 -1
  93. data/lib/rubocop/cop/lint/redundant_with_index.rb +2 -2
  94. data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -2
  95. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +5 -6
  96. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +91 -0
  97. data/lib/rubocop/cop/lint/{handle_exceptions.rb → suppressed_exception.rb} +1 -1
  98. data/lib/rubocop/cop/lint/unused_block_argument.rb +22 -6
  99. data/lib/rubocop/cop/lint/unused_method_argument.rb +23 -5
  100. data/lib/rubocop/cop/lint/useless_access_modifier.rb +57 -23
  101. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
  102. data/lib/rubocop/cop/lint/void.rb +7 -26
  103. data/lib/rubocop/cop/message_annotator.rb +16 -7
  104. data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
  105. data/lib/rubocop/cop/metrics/method_length.rb +1 -1
  106. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +23 -6
  107. data/lib/rubocop/cop/migration/department_name.rb +44 -0
  108. data/lib/rubocop/cop/mixin/alignment.rb +2 -2
  109. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -1
  110. data/lib/rubocop/cop/mixin/{hash_alignment.rb → hash_alignment_styles.rb} +1 -1
  111. data/lib/rubocop/cop/mixin/line_length_help.rb +88 -0
  112. data/lib/rubocop/cop/mixin/method_complexity.rb +2 -1
  113. data/lib/rubocop/cop/mixin/nil_methods.rb +4 -4
  114. data/lib/rubocop/cop/mixin/rational_literal.rb +18 -0
  115. data/lib/rubocop/cop/mixin/statement_modifier.rb +7 -4
  116. data/lib/rubocop/cop/mixin/trailing_comma.rb +14 -9
  117. data/lib/rubocop/cop/naming/{uncommunicative_block_param_name.rb → block_parameter_name.rb} +3 -3
  118. data/lib/rubocop/cop/naming/file_name.rb +12 -5
  119. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +5 -5
  120. data/lib/rubocop/cop/naming/method_name.rb +12 -1
  121. data/lib/rubocop/cop/naming/{uncommunicative_method_param_name.rb → method_parameter_name.rb} +3 -3
  122. data/lib/rubocop/cop/naming/predicate_name.rb +6 -6
  123. data/lib/rubocop/cop/naming/variable_name.rb +1 -0
  124. data/lib/rubocop/cop/offense.rb +29 -7
  125. data/lib/rubocop/cop/registry.rb +22 -1
  126. data/lib/rubocop/cop/style/access_modifier_declarations.rb +1 -0
  127. data/lib/rubocop/cop/style/alias.rb +1 -1
  128. data/lib/rubocop/cop/style/array_join.rb +1 -1
  129. data/lib/rubocop/cop/style/attr.rb +10 -2
  130. data/lib/rubocop/cop/style/block_delimiters.rb +2 -1
  131. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +35 -16
  132. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  133. data/lib/rubocop/cop/style/comment_annotation.rb +5 -5
  134. data/lib/rubocop/cop/style/commented_keyword.rb +8 -2
  135. data/lib/rubocop/cop/style/conditional_assignment.rb +6 -6
  136. data/lib/rubocop/cop/style/copyright.rb +11 -7
  137. data/lib/rubocop/cop/style/documentation_method.rb +44 -0
  138. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +10 -4
  139. data/lib/rubocop/cop/style/empty_case_condition.rb +2 -2
  140. data/lib/rubocop/cop/style/empty_literal.rb +2 -2
  141. data/lib/rubocop/cop/style/empty_method.rb +5 -5
  142. data/lib/rubocop/cop/style/eval_with_location.rb +1 -1
  143. data/lib/rubocop/cop/style/even_odd.rb +1 -1
  144. data/lib/rubocop/cop/style/expand_path_arguments.rb +1 -1
  145. data/lib/rubocop/cop/style/format_string.rb +10 -7
  146. data/lib/rubocop/cop/style/format_string_token.rb +19 -68
  147. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +28 -33
  148. data/lib/rubocop/cop/style/guard_clause.rb +3 -2
  149. data/lib/rubocop/cop/style/hash_syntax.rb +2 -2
  150. data/lib/rubocop/cop/style/if_unless_modifier.rb +93 -15
  151. data/lib/rubocop/cop/style/infinite_loop.rb +6 -5
  152. data/lib/rubocop/cop/style/inverse_methods.rb +19 -13
  153. data/lib/rubocop/cop/style/ip_addresses.rb +4 -4
  154. data/lib/rubocop/cop/style/line_end_concatenation.rb +14 -10
  155. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +25 -25
  156. data/lib/rubocop/cop/style/method_def_parentheses.rb +17 -9
  157. data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
  158. data/lib/rubocop/cop/style/mixin_usage.rb +11 -1
  159. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  160. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
  161. data/lib/rubocop/cop/style/multiline_when_then.rb +1 -1
  162. data/lib/rubocop/cop/style/nested_modifier.rb +22 -4
  163. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +5 -5
  164. data/lib/rubocop/cop/style/next.rb +5 -5
  165. data/lib/rubocop/cop/style/non_nil_check.rb +21 -9
  166. data/lib/rubocop/cop/style/numeric_literals.rb +7 -3
  167. data/lib/rubocop/cop/style/option_hash.rb +3 -3
  168. data/lib/rubocop/cop/style/or_assignment.rb +6 -1
  169. data/lib/rubocop/cop/style/parentheses_around_condition.rb +14 -0
  170. data/lib/rubocop/cop/style/{unneeded_capital_w.rb → redundant_capital_w.rb} +1 -1
  171. data/lib/rubocop/cop/style/{unneeded_condition.rb → redundant_condition.rb} +3 -3
  172. data/lib/rubocop/cop/style/{unneeded_interpolation.rb → redundant_interpolation.rb} +1 -1
  173. data/lib/rubocop/cop/style/redundant_parentheses.rb +16 -7
  174. data/lib/rubocop/cop/style/{unneeded_percent_q.rb → redundant_percent_q.rb} +1 -1
  175. data/lib/rubocop/cop/style/redundant_return.rb +39 -29
  176. data/lib/rubocop/cop/style/redundant_self.rb +18 -1
  177. data/lib/rubocop/cop/style/{unneeded_sort.rb → redundant_sort.rb} +5 -5
  178. data/lib/rubocop/cop/style/rescue_modifier.rb +24 -0
  179. data/lib/rubocop/cop/style/safe_navigation.rb +23 -3
  180. data/lib/rubocop/cop/style/semicolon.rb +13 -2
  181. data/lib/rubocop/cop/style/single_line_methods.rb +8 -1
  182. data/lib/rubocop/cop/style/special_global_vars.rb +5 -7
  183. data/lib/rubocop/cop/style/ternary_parentheses.rb +19 -0
  184. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +7 -1
  185. data/lib/rubocop/cop/style/trivial_accessors.rb +5 -5
  186. data/lib/rubocop/cop/style/while_until_modifier.rb +1 -1
  187. data/lib/rubocop/cop/team.rb +5 -0
  188. data/lib/rubocop/cop/util.rb +1 -1
  189. data/lib/rubocop/cop/utils/format_string.rb +120 -0
  190. data/lib/rubocop/cop/variable_force.rb +7 -5
  191. data/lib/rubocop/cop/variable_force/variable.rb +15 -2
  192. data/lib/rubocop/core_ext/string.rb +0 -24
  193. data/lib/rubocop/formatter/base_formatter.rb +2 -2
  194. data/lib/rubocop/formatter/clang_style_formatter.rb +9 -6
  195. data/lib/rubocop/formatter/emacs_style_formatter.rb +22 -9
  196. data/lib/rubocop/formatter/file_list_formatter.rb +1 -1
  197. data/lib/rubocop/formatter/formatter_set.rb +16 -15
  198. data/lib/rubocop/formatter/json_formatter.rb +6 -5
  199. data/lib/rubocop/formatter/pacman_formatter.rb +80 -0
  200. data/lib/rubocop/formatter/simple_text_formatter.rb +16 -4
  201. data/lib/rubocop/formatter/tap_formatter.rb +18 -7
  202. data/lib/rubocop/magic_comment.rb +4 -0
  203. data/lib/rubocop/node_pattern.rb +4 -2
  204. data/lib/rubocop/options.rb +21 -26
  205. data/lib/rubocop/processed_source.rb +1 -1
  206. data/lib/rubocop/rake_task.rb +1 -0
  207. data/lib/rubocop/result_cache.rb +24 -8
  208. data/lib/rubocop/runner.rb +60 -33
  209. data/lib/rubocop/target_finder.rb +12 -6
  210. data/lib/rubocop/version.rb +1 -1
  211. metadata +48 -33
  212. data/lib/rubocop/cop/mixin/ignored_method_patterns.rb +0 -19
  213. data/lib/rubocop/cop/mixin/safe_mode.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7299e4e21bbddcdbfec2725fec41c384d50867b70a986d87ea0f6f7f08dd3ebe
4
- data.tar.gz: 504dae598bbb526afed6bc9ecc56d86a27656d535bf52e30c85e7ab005af99f3
3
+ metadata.gz: a1c6769965ef19c24fed5115e5ee0e6949aef81f2d4f0c64a28e867b694b8f8b
4
+ data.tar.gz: 6785ee7c23edbb4b47414ca32a9cb7b7e24565c454c8e4a33f742b9a15de8e5b
5
5
  SHA512:
6
- metadata.gz: 57b94e3a5a06724249509077ada410188ad29b52ae6dfda9d8b56582cc08bdb443a60e75744abf0d2ac664b3124db18e3e5382f72ccacfd4be64faf2c489b0ae
7
- data.tar.gz: fb563b7256b89462268c6b3dc4b5cbf626764d2a3097dc5a332187a78c4f7d9d0c80c6dd2ba83692d48ba354696467329a87acf25474261a24bd9bffcd42f35a
6
+ metadata.gz: e3e28e9ed24f5e757ce4c24f4ee4d079eb5e7ac1c6f50bd50fb512c5b4986d84ec19b0ba426a9b077ca734177a5e5139a50c12f5fe331216abee67bd6a2436b4
7
+ data.tar.gz: 2f2739072557a141d69a51037e38a0973bee53caf40d216610eaffd3a8f14409e64562ed71a49803ad8b11b71fedc51312657efaecb27189900c7b5c44b2cb8c
data/README.md CHANGED
@@ -9,6 +9,7 @@
9
9
  [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
10
10
  [![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
11
11
  [![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
12
+ [![Tidelift](https://tidelift.com/badges/package/rubygems/rubocop)](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
12
13
 
13
14
  <p align="center">
14
15
  <img src="https://raw.githubusercontent.com/rubocop-hq/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
@@ -52,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
52
53
  might want to use a conservative version lock in your `Gemfile`:
53
54
 
54
55
  ```rb
55
- gem 'rubocop', '~> 0.74.0', require: false
56
+ gem 'rubocop', '~> 0.78.0', require: false
56
57
  ```
57
58
 
58
59
  ## Quickstart
@@ -73,7 +74,7 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
73
74
  RuboCop supports the following Ruby implementations:
74
75
 
75
76
  * MRI 2.3+
76
- * JRuby 9.1+
77
+ * JRuby 9.2+
77
78
 
78
79
  ## Team
79
80
 
@@ -59,6 +59,7 @@ AllCops:
59
59
  - '**/Vagrantfile'
60
60
  Exclude:
61
61
  - 'node_modules/**/*'
62
+ - 'tmp/**/*'
62
63
  - 'vendor/**/*'
63
64
  - '.git/**/*'
64
65
  # Default formatter will be used if no `-f/--format` option is given.
@@ -141,11 +142,12 @@ Bundler/GemComment:
141
142
  Description: 'Add a comment describing each gem.'
142
143
  Enabled: false
143
144
  VersionAdded: '0.59'
145
+ VersionChanged: '0.77'
144
146
  Include:
145
147
  - '**/*.gemfile'
146
148
  - '**/Gemfile'
147
149
  - '**/gems.rb'
148
- Whitelist: []
150
+ IgnoredGems: []
149
151
 
150
152
  Bundler/InsecureProtocolSource:
151
153
  Description: >-
@@ -195,9 +197,10 @@ Gemspec/RequiredRubyVersion:
195
197
  VersionAdded: '0.52'
196
198
  Include:
197
199
  - '**/*.gemspec'
198
- -
200
+
199
201
  Gemspec/RubyVersionGlobalsUsage:
200
202
  Description: Checks usage of RUBY_VERSION in gemspec.
203
+ StyleGuide: '#no-ruby-version-in-the-gemspec'
201
204
  Enabled: true
202
205
  VersionAdded: '0.72'
203
206
  Include:
@@ -218,13 +221,14 @@ Layout/AccessModifierIndentation:
218
221
  # But it can be overridden by setting this parameter
219
222
  IndentationWidth: ~
220
223
 
221
- Layout/AlignArguments:
224
+ Layout/ArgumentAlignment:
222
225
  Description: >-
223
226
  Align the arguments of a method call if they span more
224
227
  than one line.
225
228
  StyleGuide: '#no-double-indent'
226
229
  Enabled: true
227
230
  VersionAdded: '0.68'
231
+ VersionChanged: '0.77'
228
232
  # Alignment of arguments in multi-line method calls.
229
233
  #
230
234
  # The `with_first_argument` style aligns the following lines along the same
@@ -246,117 +250,23 @@ Layout/AlignArguments:
246
250
  # But it can be overridden by setting this parameter
247
251
  IndentationWidth: ~
248
252
 
249
- Layout/AlignArray:
253
+ Layout/ArrayAlignment:
250
254
  Description: >-
251
255
  Align the elements of an array literal if they span more than
252
256
  one line.
253
257
  StyleGuide: '#align-multiline-arrays'
254
258
  Enabled: true
255
259
  VersionAdded: '0.49'
260
+ VersionChanged: '0.77'
256
261
 
257
- Layout/AlignHash:
258
- Description: >-
259
- Align the elements of a hash literal if they span more than
260
- one line.
261
- Enabled: true
262
- AllowMultipleStyles: true
263
- 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:
262
+ Layout/AssignmentIndentation:
335
263
  Description: >-
336
- Align the parameters of a method definition if they span more
337
- than one line.
338
- StyleGuide: '#no-double-indent'
264
+ Checks the indentation of the first line of the
265
+ right-hand-side of a multi-line assignment.
339
266
  Enabled: true
340
267
  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
268
+ VersionChanged: '0.77'
269
+ # By default, the indentation width from `Layout/IndentationWidth` is used
360
270
  # But it can be overridden by setting this parameter
361
271
  IndentationWidth: ~
362
272
 
@@ -624,56 +534,11 @@ Layout/ExtraSpacing:
624
534
  # When true, forces the alignment of `=` in assignments on consecutive lines.
625
535
  ForceEqualSignAlignment: false
626
536
 
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:
537
+ Layout/FirstArgumentIndentation:
674
538
  Description: 'Checks the indentation of the first argument in a method call.'
675
539
  Enabled: true
676
540
  VersionAdded: '0.68'
541
+ VersionChanged: '0.77'
677
542
  EnforcedStyle: special_for_inner_method_call_in_parentheses
678
543
  SupportedStyles:
679
544
  # The first parameter should always be indented one step more than the
@@ -694,12 +559,13 @@ Layout/IndentFirstArgument:
694
559
  # But it can be overridden by setting this parameter
695
560
  IndentationWidth: ~
696
561
 
697
- Layout/IndentFirstArrayElement:
562
+ Layout/FirstArrayElementIndentation:
698
563
  Description: >-
699
564
  Checks the indentation of the first element in an array
700
565
  literal.
701
566
  Enabled: true
702
567
  VersionAdded: '0.68'
568
+ VersionChanged: '0.77'
703
569
  # The value `special_inside_parentheses` means that array literals with
704
570
  # brackets that have their opening bracket on the same line as a surrounding
705
571
  # opening round parenthesis, shall have their first element indented relative
@@ -720,10 +586,18 @@ Layout/IndentFirstArrayElement:
720
586
  # But it can be overridden by setting this parameter
721
587
  IndentationWidth: ~
722
588
 
723
- Layout/IndentFirstHashElement:
589
+ Layout/FirstArrayElementLineBreak:
590
+ Description: >-
591
+ Checks for a line break before the first element in a
592
+ multi-line array.
593
+ Enabled: false
594
+ VersionAdded: '0.49'
595
+
596
+ Layout/FirstHashElementIndentation:
724
597
  Description: 'Checks the indentation of the first key in a hash literal.'
725
598
  Enabled: true
726
599
  VersionAdded: '0.68'
600
+ VersionChanged: '0.77'
727
601
  # The value `special_inside_parentheses` means that hash literals with braces
728
602
  # that have their opening brace on the same line as a surrounding opening
729
603
  # round parenthesis, shall have their first key indented relative to the
@@ -744,13 +618,34 @@ Layout/IndentFirstHashElement:
744
618
  # But it can be overridden by setting this parameter
745
619
  IndentationWidth: ~
746
620
 
747
- Layout/IndentFirstParameter:
621
+ Layout/FirstHashElementLineBreak:
622
+ Description: >-
623
+ Checks for a line break before the first element in a
624
+ multi-line hash.
625
+ Enabled: false
626
+ VersionAdded: '0.49'
627
+
628
+ Layout/FirstMethodArgumentLineBreak:
629
+ Description: >-
630
+ Checks for a line break before the first argument in a
631
+ multi-line method call.
632
+ Enabled: false
633
+ VersionAdded: '0.49'
634
+
635
+ Layout/FirstMethodParameterLineBreak:
636
+ Description: >-
637
+ Checks for a line break before the first parameter in a
638
+ multi-line method parameter definition.
639
+ Enabled: false
640
+ VersionAdded: '0.49'
641
+
642
+ Layout/FirstParameterIndentation:
748
643
  Description: >-
749
644
  Checks the indentation of the first parameter in a
750
645
  method definition.
751
646
  Enabled: true
752
647
  VersionAdded: '0.49'
753
- VersionChanged: '0.68'
648
+ VersionChanged: '0.77'
754
649
  EnforcedStyle: consistent
755
650
  SupportedStyles:
756
651
  - consistent
@@ -759,12 +654,98 @@ Layout/IndentFirstParameter:
759
654
  # But it can be overridden by setting this parameter
760
655
  IndentationWidth: ~
761
656
 
762
- Layout/IndentHeredoc:
657
+ Layout/HashAlignment:
658
+ Description: >-
659
+ Align the elements of a hash literal if they span more than
660
+ one line.
661
+ Enabled: true
662
+ AllowMultipleStyles: true
663
+ VersionAdded: '0.49'
664
+ VersionChanged: '0.77'
665
+ # Alignment of entries using hash rocket as separator. Valid values are:
666
+ #
667
+ # key - left alignment of keys
668
+ # 'a' => 2
669
+ # 'bb' => 3
670
+ # separator - alignment of hash rockets, keys are right aligned
671
+ # 'a' => 2
672
+ # 'bb' => 3
673
+ # table - left alignment of keys, hash rockets, and values
674
+ # 'a' => 2
675
+ # 'bb' => 3
676
+ EnforcedHashRocketStyle: key
677
+ SupportedHashRocketStyles:
678
+ - key
679
+ - separator
680
+ - table
681
+ # Alignment of entries using colon as separator. Valid values are:
682
+ #
683
+ # key - left alignment of keys
684
+ # a: 0
685
+ # bb: 1
686
+ # separator - alignment of colons, keys are right aligned
687
+ # a: 0
688
+ # bb: 1
689
+ # table - left alignment of keys and values
690
+ # a: 0
691
+ # bb: 1
692
+ EnforcedColonStyle: key
693
+ SupportedColonStyles:
694
+ - key
695
+ - separator
696
+ - table
697
+ # Select whether hashes that are the last argument in a method call should be
698
+ # inspected? Valid values are:
699
+ #
700
+ # always_inspect - Inspect both implicit and explicit hashes.
701
+ # Registers an offense for:
702
+ # function(a: 1,
703
+ # b: 2)
704
+ # Registers an offense for:
705
+ # function({a: 1,
706
+ # b: 2})
707
+ # always_ignore - Ignore both implicit and explicit hashes.
708
+ # Accepts:
709
+ # function(a: 1,
710
+ # b: 2)
711
+ # Accepts:
712
+ # function({a: 1,
713
+ # b: 2})
714
+ # ignore_implicit - Ignore only implicit hashes.
715
+ # Accepts:
716
+ # function(a: 1,
717
+ # b: 2)
718
+ # Registers an offense for:
719
+ # function({a: 1,
720
+ # b: 2})
721
+ # ignore_explicit - Ignore only explicit hashes.
722
+ # Accepts:
723
+ # function({a: 1,
724
+ # b: 2})
725
+ # Registers an offense for:
726
+ # function(a: 1,
727
+ # b: 2)
728
+ EnforcedLastArgumentHashStyle: always_inspect
729
+ SupportedLastArgumentHashStyles:
730
+ - always_inspect
731
+ - always_ignore
732
+ - ignore_implicit
733
+ - ignore_explicit
734
+
735
+ Layout/HeredocArgumentClosingParenthesis:
736
+ Description: >-
737
+ Checks for the placement of the closing parenthesis in a
738
+ method call that passes a HEREDOC string as an argument.
739
+ Enabled: false
740
+ StyleGuide: '#heredoc-argument-closing-parentheses'
741
+ VersionAdded: '0.68'
742
+
743
+ Layout/HeredocIndentation:
763
744
  Description: 'This cop checks the indentation of the here document bodies.'
764
745
  StyleGuide: '#squiggly-heredocs'
765
746
  Enabled: true
766
747
  VersionAdded: '0.49'
767
- VersionChanged: '0.69'
748
+ VersionChanged: '0.77'
768
749
  EnforcedStyle: squiggly
769
750
  SupportedStyles:
770
751
  - squiggly
@@ -806,11 +787,6 @@ Layout/InitialIndentation:
806
787
  Enabled: true
807
788
  VersionAdded: '0.49'
808
789
 
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
790
  Layout/LeadingCommentSpace:
815
791
  Description: 'Comments should start with a space.'
816
792
  StyleGuide: '#hash-space'
@@ -819,6 +795,35 @@ Layout/LeadingCommentSpace:
819
795
  VersionChanged: '0.73'
820
796
  AllowDoxygenCommentStyle: false
821
797
 
798
+ Layout/LeadingEmptyLines:
799
+ Description: Check for unnecessary blank lines at the beginning of a file.
800
+ Enabled: true
801
+ VersionAdded: '0.57'
802
+ VersionChanged: '0.77'
803
+
804
+ Layout/LineLength:
805
+ Description: 'Limit lines to 80 characters.'
806
+ StyleGuide: '#80-character-limits'
807
+ Enabled: true
808
+ VersionAdded: '0.25'
809
+ VersionChanged: '0.78'
810
+ AutoCorrect: false
811
+ Max: 80
812
+ # To make it possible to copy or click on URIs in the code, we allow lines
813
+ # containing a URI to be longer than Max.
814
+ AllowHeredoc: true
815
+ AllowURI: true
816
+ URISchemes:
817
+ - http
818
+ - https
819
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
820
+ # directives like '# rubocop: enable ...' when calculating a line's length.
821
+ IgnoreCopDirectives: true
822
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
823
+ # elements. Strings will be converted to Regexp objects. A line that matches
824
+ # any regular expression listed in this option will be ignored by LineLength.
825
+ IgnoredPatterns: []
826
+
822
827
  Layout/MultilineArrayBraceLayout:
823
828
  Description: >-
824
829
  Checks that the closing brace in an array literal is
@@ -960,6 +965,35 @@ Layout/MultilineOperationIndentation:
960
965
  # But it can be overridden by setting this parameter
961
966
  IndentationWidth: ~
962
967
 
968
+ Layout/ParameterAlignment:
969
+ Description: >-
970
+ Align the parameters of a method definition if they span more
971
+ than one line.
972
+ StyleGuide: '#no-double-indent'
973
+ Enabled: true
974
+ VersionAdded: '0.49'
975
+ VersionChanged: '0.77'
976
+ # Alignment of parameters in multi-line method calls.
977
+ #
978
+ # The `with_first_parameter` style aligns the following lines along the same
979
+ # column as the first parameter.
980
+ #
981
+ # def method_foo(a,
982
+ # b)
983
+ #
984
+ # The `with_fixed_indentation` style aligns the following lines with one
985
+ # level of indentation relative to the start of the line with the method call.
986
+ #
987
+ # def method_foo(a,
988
+ # b)
989
+ EnforcedStyle: with_first_parameter
990
+ SupportedStyles:
991
+ - with_first_parameter
992
+ - with_fixed_indentation
993
+ # By default, the indentation width from Layout/IndentationWidth is used
994
+ # But it can be overridden by setting this parameter
995
+ IndentationWidth: ~
996
+
963
997
  Layout/RescueEnsureAlignment:
964
998
  Description: 'Align rescues and ensures correctly.'
965
999
  Enabled: true
@@ -1033,6 +1067,10 @@ Layout/SpaceAroundOperators:
1033
1067
  # with an operator on the previous or next line, not counting empty lines
1034
1068
  # or comment lines.
1035
1069
  AllowForAlignment: true
1070
+ EnforcedStyleForExponentOperator: no_space
1071
+ SupportedStylesForExponentOperator:
1072
+ - space
1073
+ - no_space
1036
1074
 
1037
1075
  Layout/SpaceBeforeBlockBraces:
1038
1076
  Description: >-
@@ -1202,11 +1240,12 @@ Layout/Tab:
1202
1240
  # replace each tab.
1203
1241
  IndentationWidth: ~
1204
1242
 
1205
- Layout/TrailingBlankLines:
1243
+ Layout/TrailingEmptyLines:
1206
1244
  Description: 'Checks trailing blank lines and final newline.'
1207
1245
  StyleGuide: '#newline-eof'
1208
1246
  Enabled: true
1209
1247
  VersionAdded: '0.49'
1248
+ VersionChanged: '0.77'
1210
1249
  EnforcedStyle: final_newline
1211
1250
  SupportedStyles:
1212
1251
  - final_newline
@@ -1290,16 +1329,17 @@ Lint/DuplicateCaseCondition:
1290
1329
  Enabled: true
1291
1330
  VersionAdded: '0.45'
1292
1331
 
1332
+ Lint/DuplicateHashKey:
1333
+ Description: 'Check for duplicate keys in hash literals.'
1334
+ Enabled: true
1335
+ VersionAdded: '0.34'
1336
+ VersionChanged: '0.77'
1337
+
1293
1338
  Lint/DuplicateMethods:
1294
1339
  Description: 'Check for duplicate method definitions.'
1295
1340
  Enabled: true
1296
1341
  VersionAdded: '0.29'
1297
1342
 
1298
- Lint/DuplicatedKey:
1299
- Description: 'Check for duplicate keys in hash literals.'
1300
- Enabled: true
1301
- VersionAdded: '0.34'
1302
-
1303
1343
  Lint/EachWithObjectArgument:
1304
1344
  Description: 'Check for immutable argument given to each_with_object.'
1305
1345
  Enabled: true
@@ -1367,14 +1407,6 @@ Lint/FormatParameterMismatch:
1367
1407
  Enabled: true
1368
1408
  VersionAdded: '0.33'
1369
1409
 
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
1410
  Lint/HeredocMethodCallPosition:
1379
1411
  Description: >-
1380
1412
  Checks for the ordering of a method call where
@@ -1444,10 +1476,11 @@ Lint/MissingCopEnableDirective:
1444
1476
  # .inf for any size
1445
1477
  MaximumRangeSize: .inf
1446
1478
 
1447
- Lint/MultipleCompare:
1448
- Description: "Use `&&` operator to compare multiple value."
1479
+ Lint/MultipleComparison:
1480
+ Description: "Use `&&` operator to compare multiple values."
1449
1481
  Enabled: true
1450
1482
  VersionAdded: '0.47'
1483
+ VersionChanged: '0.77'
1451
1484
 
1452
1485
  Lint/NestedMethodDefinition:
1453
1486
  Description: 'Do not use nested method definitions.'
@@ -1467,6 +1500,12 @@ Lint/NextWithoutAccumulator:
1467
1500
  Enabled: true
1468
1501
  VersionAdded: '0.36'
1469
1502
 
1503
+ Lint/NonDeterministicRequireOrder:
1504
+ Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1505
+ Enabled: true
1506
+ VersionAdded: '0.78'
1507
+ Safe: false
1508
+
1470
1509
  Lint/NonLocalExitFromIterator:
1471
1510
  Description: 'Do not use return in iterator to cause non-local exit.'
1472
1511
  Enabled: true
@@ -1512,6 +1551,36 @@ Lint/RandOne:
1512
1551
  Enabled: true
1513
1552
  VersionAdded: '0.36'
1514
1553
 
1554
+ Lint/RedundantCopDisableDirective:
1555
+ Description: >-
1556
+ Checks for rubocop:disable comments that can be removed.
1557
+ Note: this cop is not disabled when disabling all cops.
1558
+ It must be explicitly disabled.
1559
+ Enabled: true
1560
+ VersionAdded: '0.76'
1561
+
1562
+ Lint/RedundantCopEnableDirective:
1563
+ Description: Checks for rubocop:enable comments that can be removed.
1564
+ Enabled: true
1565
+ VersionAdded: '0.76'
1566
+
1567
+ Lint/RedundantRequireStatement:
1568
+ Description: 'Checks for unnecessary `require` statement.'
1569
+ Enabled: true
1570
+ VersionAdded: '0.76'
1571
+
1572
+ Lint/RedundantSplatExpansion:
1573
+ Description: 'Checks for splat unnecessarily being called on literals.'
1574
+ Enabled: true
1575
+ VersionChanged: '0.76'
1576
+
1577
+ Lint/RedundantStringCoercion:
1578
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1579
+ StyleGuide: '#no-to-s'
1580
+ Enabled: true
1581
+ VersionAdded: '0.19'
1582
+ VersionChanged: '0.77'
1583
+
1515
1584
  Lint/RedundantWithIndex:
1516
1585
  Description: 'Checks for redundant `with_index`.'
1517
1586
  Enabled: true
@@ -1557,8 +1626,8 @@ Lint/SafeNavigationChain:
1557
1626
  Description: 'Do not chain ordinary method call after safe navigation operator.'
1558
1627
  Enabled: true
1559
1628
  VersionAdded: '0.47'
1560
- VersionChanged: '0.56'
1561
- Whitelist:
1629
+ VersionChanged: '0.77'
1630
+ AllowedMethods:
1562
1631
  - present?
1563
1632
  - blank?
1564
1633
  - presence
@@ -1572,14 +1641,14 @@ Lint/SafeNavigationConsistency:
1572
1641
  for all method calls on that same object.
1573
1642
  Enabled: true
1574
1643
  VersionAdded: '0.55'
1575
- Whitelist:
1644
+ VersionChanged: '0.77'
1645
+ AllowedMethods:
1576
1646
  - present?
1577
1647
  - blank?
1578
1648
  - presence
1579
1649
  - try
1580
1650
  - try!
1581
1651
 
1582
-
1583
1652
  Lint/SafeNavigationWithEmpty:
1584
1653
  Description: 'Avoid `foo&.empty?` in conditionals.'
1585
1654
  Enabled: true
@@ -1591,6 +1660,11 @@ Lint/ScriptPermission:
1591
1660
  VersionAdded: '0.49'
1592
1661
  VersionChanged: '0.50'
1593
1662
 
1663
+ Lint/SendWithMixinArgument:
1664
+ Description: 'Checks for `send` method when using mixin.'
1665
+ Enabled: true
1666
+ VersionAdded: '0.75'
1667
+
1594
1668
  Lint/ShadowedArgument:
1595
1669
  Description: 'Avoid reassigning arguments before they were used.'
1596
1670
  Enabled: true
@@ -1612,12 +1686,13 @@ Lint/ShadowingOuterLocalVariable:
1612
1686
  Enabled: true
1613
1687
  VersionAdded: '0.9'
1614
1688
 
1615
- Lint/StringConversionInInterpolation:
1616
- Description: 'Checks for Object#to_s usage in string interpolation.'
1617
- StyleGuide: '#no-to-s'
1689
+ Lint/SuppressedException:
1690
+ Description: "Don't suppress exceptions."
1691
+ StyleGuide: '#dont-hide-exceptions'
1618
1692
  Enabled: true
1619
- VersionAdded: '0.19'
1620
- VersionChanged: '0.20'
1693
+ AllowComments: false
1694
+ VersionAdded: '0.9'
1695
+ VersionChanged: '0.77'
1621
1696
 
1622
1697
  Lint/Syntax:
1623
1698
  Description: 'Checks syntax error.'
@@ -1640,30 +1715,6 @@ Lint/UnifiedInteger:
1640
1715
  Enabled: true
1641
1716
  VersionAdded: '0.43'
1642
1717
 
1643
- Lint/UnneededCopDisableDirective:
1644
- Description: >-
1645
- Checks for rubocop:disable comments that can be removed.
1646
- Note: this cop is not disabled when disabling all cops.
1647
- It must be explicitly disabled.
1648
- Enabled: true
1649
- VersionAdded: '0.53'
1650
-
1651
- Lint/UnneededCopEnableDirective:
1652
- Description: Checks for rubocop:enable comments that can be removed.
1653
- Enabled: true
1654
- VersionAdded: '0.53'
1655
-
1656
- Lint/UnneededRequireStatement:
1657
- Description: 'Checks for unnecessary `require` statement.'
1658
- Enabled: true
1659
- VersionAdded: '0.51'
1660
-
1661
- Lint/UnneededSplatExpansion:
1662
- Description: 'Checks for splat unnecessarily being called on literals.'
1663
- Enabled: true
1664
- VersionAdded: '0.43'
1665
- VersionChanged: '0.74'
1666
-
1667
1718
  Lint/UnreachableCode:
1668
1719
  Description: 'Unreachable code.'
1669
1720
  Enabled: true
@@ -1746,7 +1797,7 @@ Metrics/AbcSize:
1746
1797
  branches, and conditions.
1747
1798
  Reference:
1748
1799
  - http://c2.com/cgi/wiki?AbcMetric
1749
- - https://en.wikipedia.org/wiki/ABC_Software_Metric'
1800
+ - https://en.wikipedia.org/wiki/ABC_Software_Metric
1750
1801
  Enabled: true
1751
1802
  VersionAdded: '0.27'
1752
1803
  VersionChanged: '0.66'
@@ -1793,29 +1844,6 @@ Metrics/CyclomaticComplexity:
1793
1844
  VersionAdded: '0.25'
1794
1845
  Max: 6
1795
1846
 
1796
- Metrics/LineLength:
1797
- Description: 'Limit lines to 80 characters.'
1798
- StyleGuide: '#80-character-limits'
1799
- Enabled: true
1800
- VersionAdded: '0.25'
1801
- VersionChanged: '0.68'
1802
- AutoCorrect: false
1803
- Max: 80
1804
- # To make it possible to copy or click on URIs in the code, we allow lines
1805
- # containing a URI to be longer than Max.
1806
- AllowHeredoc: true
1807
- AllowURI: true
1808
- URISchemes:
1809
- - http
1810
- - https
1811
- # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1812
- # directives like '# rubocop: enable ...' when calculating a line's length.
1813
- IgnoreCopDirectives: false
1814
- # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1815
- # elements. Strings will be converted to Regexp objects. A line that matches
1816
- # any regular expression listed in this option will be ignored by LineLength.
1817
- IgnoredPatterns: []
1818
-
1819
1847
  Metrics/MethodLength:
1820
1848
  Description: 'Avoid methods longer than 10 lines of code.'
1821
1849
  StyleGuide: '#short-methods'
@@ -1849,6 +1877,14 @@ Metrics/PerceivedComplexity:
1849
1877
  VersionAdded: '0.25'
1850
1878
  Max: 7
1851
1879
 
1880
+ ################## Migration #############################
1881
+
1882
+ Migration/DepartmentName:
1883
+ Description: >-
1884
+ Check that cop names in rubocop:disable (etc) comments are
1885
+ given with department name.
1886
+ Enabled: false
1887
+
1852
1888
  #################### Naming ##############################
1853
1889
 
1854
1890
  Naming/AccessorMethodName:
@@ -1869,6 +1905,21 @@ Naming/BinaryOperatorParameterName:
1869
1905
  Enabled: true
1870
1906
  VersionAdded: '0.50'
1871
1907
 
1908
+ Naming/BlockParameterName:
1909
+ Description: >-
1910
+ Checks for block parameter names that contain capital letters,
1911
+ end in numbers, or do not meet a minimal length.
1912
+ Enabled: true
1913
+ VersionAdded: '0.53'
1914
+ VersionChanged: '0.77'
1915
+ # Parameter names may be equal to or greater than this value
1916
+ MinNameLength: 1
1917
+ AllowNamesEndingInNumbers: true
1918
+ # Allowed names that will not register an offense
1919
+ AllowedNames: []
1920
+ # Forbidden names that will register an offense
1921
+ ForbiddenNames: []
1922
+
1872
1923
  Naming/ClassAndModuleCamelCase:
1873
1924
  Description: 'Use CamelCase for classes and modules.'
1874
1925
  StyleGuide: '#camelcase-classes'
@@ -1960,7 +2011,7 @@ Naming/HeredocDelimiterNaming:
1960
2011
  StyleGuide: '#heredoc-delimiters'
1961
2012
  Enabled: true
1962
2013
  VersionAdded: '0.50'
1963
- Blacklist:
2014
+ ForbiddenDelimiters:
1964
2015
  - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
1965
2016
 
1966
2017
  Naming/MemoizedInstanceVariableName:
@@ -1984,26 +2035,58 @@ Naming/MethodName:
1984
2035
  SupportedStyles:
1985
2036
  - snake_case
1986
2037
  - camelCase
2038
+ # Method names matching patterns are always allowed.
2039
+ #
2040
+ # IgnoredPatterns:
2041
+ # - '\A\s*onSelectionBulkChange\s*'
2042
+ # - '\A\s*onSelectionCleared\s*'
2043
+ #
2044
+ IgnoredPatterns: []
2045
+
2046
+ Naming/MethodParameterName:
2047
+ Description: >-
2048
+ Checks for method parameter names that contain capital letters,
2049
+ end in numbers, or do not meet a minimal length.
2050
+ Enabled: true
2051
+ VersionAdded: '0.53'
2052
+ VersionChanged: '0.77'
2053
+ # Parameter names may be equal to or greater than this value
2054
+ MinNameLength: 3
2055
+ AllowNamesEndingInNumbers: true
2056
+ # Allowed names that will not register an offense
2057
+ AllowedNames:
2058
+ - io
2059
+ - id
2060
+ - to
2061
+ - by
2062
+ - 'on'
2063
+ - in
2064
+ - at
2065
+ - ip
2066
+ - db
2067
+ - os
2068
+ # Forbidden names that will register an offense
2069
+ ForbiddenNames: []
1987
2070
 
1988
2071
  Naming/PredicateName:
1989
2072
  Description: 'Check the names of predicate methods.'
1990
2073
  StyleGuide: '#bool-methods-qmark'
1991
2074
  Enabled: true
1992
2075
  VersionAdded: '0.50'
1993
- VersionChanged: '0.51'
2076
+ VersionChanged: '0.77'
1994
2077
  # Predicate name prefixes.
1995
2078
  NamePrefix:
1996
2079
  - is_
1997
2080
  - has_
1998
2081
  - have_
1999
2082
  # Predicate name prefixes that should be removed.
2000
- NamePrefixBlacklist:
2083
+ ForbiddenPrefixes:
2001
2084
  - is_
2002
2085
  - has_
2003
2086
  - have_
2004
- # Predicate names which, despite having a blacklisted prefix, or no `?`,
2087
+ # Predicate names which, despite having a forbidden prefix, or no `?`,
2005
2088
  # should still be accepted
2006
- NameWhitelist:
2089
+ AllowedMethods:
2007
2090
  - is_a?
2008
2091
  # Method definition macros for dynamically generated methods.
2009
2092
  MethodDefinitionMacros:
@@ -2021,45 +2104,6 @@ Naming/RescuedExceptionsVariableName:
2021
2104
  VersionChanged: '0.68'
2022
2105
  PreferredName: e
2023
2106
 
2024
- Naming/UncommunicativeBlockParamName:
2025
- Description: >-
2026
- Checks for block parameter names that contain capital letters,
2027
- end in numbers, or do not meet a minimal length.
2028
- Enabled: true
2029
- VersionAdded: '0.53'
2030
- # Parameter names may be equal to or greater than this value
2031
- MinNameLength: 1
2032
- AllowNamesEndingInNumbers: true
2033
- # Whitelisted names that will not register an offense
2034
- AllowedNames: []
2035
- # Blacklisted names that will register an offense
2036
- ForbiddenNames: []
2037
-
2038
- Naming/UncommunicativeMethodParamName:
2039
- Description: >-
2040
- Checks for method parameter names that contain capital letters,
2041
- end in numbers, or do not meet a minimal length.
2042
- Enabled: true
2043
- VersionAdded: '0.53'
2044
- VersionChanged: '0.59'
2045
- # Parameter names may be equal to or greater than this value
2046
- MinNameLength: 3
2047
- AllowNamesEndingInNumbers: true
2048
- # Whitelisted names that will not register an offense
2049
- AllowedNames:
2050
- - io
2051
- - id
2052
- - to
2053
- - by
2054
- - 'on'
2055
- - in
2056
- - at
2057
- - ip
2058
- - db
2059
- # Blacklisted names that will register an offense
2060
- ForbiddenNames: []
2061
-
2062
-
2063
2107
  Naming/VariableName:
2064
2108
  Description: 'Use the configured style when naming variables.'
2065
2109
  StyleGuide: '#snake-case-symbols-methods-vars'
@@ -2706,7 +2750,7 @@ Style/FormatStringToken:
2706
2750
  - template
2707
2751
  - unannotated
2708
2752
  VersionAdded: '0.49'
2709
- VersionChanged: '0.52'
2753
+ VersionChanged: '0.75'
2710
2754
 
2711
2755
  Style/FrozenStringLiteralComment:
2712
2756
  Description: >-
@@ -2854,8 +2898,9 @@ Style/IpAddresses:
2854
2898
  Description: "Don't include literal IP addresses in code."
2855
2899
  Enabled: false
2856
2900
  VersionAdded: '0.58'
2857
- # Allow strings to be whitelisted
2858
- Whitelist:
2901
+ VersionChanged: '0.77'
2902
+ # Allow addresses to be permitted
2903
+ AllowedAddresses:
2859
2904
  - "::"
2860
2905
  # :: is a valid IPv6 address, but could potentially be legitimately in code
2861
2906
 
@@ -2899,6 +2944,7 @@ Style/MethodCallWithArgsParentheses:
2899
2944
  VersionChanged: '0.61'
2900
2945
  IgnoreMacros: true
2901
2946
  IgnoredMethods: []
2947
+ IgnoredPatterns: []
2902
2948
  IncludedMacros: []
2903
2949
  AllowParenthesesInMultilineCall: false
2904
2950
  AllowParenthesesInChaining: false
@@ -3127,8 +3173,8 @@ Style/NestedParenthesizedCalls:
3127
3173
  argument list of another parenthesized method call.
3128
3174
  Enabled: true
3129
3175
  VersionAdded: '0.36'
3130
- VersionChanged: '0.50'
3131
- Whitelist:
3176
+ VersionChanged: '0.77'
3177
+ AllowedMethods:
3132
3178
  - be
3133
3179
  - be_a
3134
3180
  - be_an
@@ -3381,6 +3427,16 @@ Style/RedundantBegin:
3381
3427
  VersionAdded: '0.10'
3382
3428
  VersionChanged: '0.21'
3383
3429
 
3430
+ Style/RedundantCapitalW:
3431
+ Description: 'Checks for %W when interpolation is not needed.'
3432
+ Enabled: true
3433
+ VersionAdded: '0.76'
3434
+
3435
+ Style/RedundantCondition:
3436
+ Description: 'Checks for unnecessary conditional expressions.'
3437
+ Enabled: true
3438
+ VersionAdded: '0.76'
3439
+
3384
3440
  Style/RedundantConditional:
3385
3441
  Description: "Don't return true/false from a conditional."
3386
3442
  Enabled: true
@@ -3399,11 +3455,22 @@ Style/RedundantFreeze:
3399
3455
  VersionAdded: '0.34'
3400
3456
  VersionChanged: '0.66'
3401
3457
 
3458
+ Style/RedundantInterpolation:
3459
+ Description: 'Checks for strings that are just an interpolated expression.'
3460
+ Enabled: true
3461
+ VersionAdded: '0.76'
3462
+
3402
3463
  Style/RedundantParentheses:
3403
3464
  Description: "Checks for parentheses that seem not to serve any purpose."
3404
3465
  Enabled: true
3405
3466
  VersionAdded: '0.36'
3406
3467
 
3468
+ Style/RedundantPercentQ:
3469
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
3470
+ StyleGuide: '#percent-q'
3471
+ Enabled: true
3472
+ VersionAdded: '0.76'
3473
+
3407
3474
  Style/RedundantReturn:
3408
3475
  Description: "Don't use return where it's not required."
3409
3476
  StyleGuide: '#no-explicit-return'
@@ -3420,6 +3487,13 @@ Style/RedundantSelf:
3420
3487
  VersionAdded: '0.10'
3421
3488
  VersionChanged: '0.13'
3422
3489
 
3490
+ Style/RedundantSort:
3491
+ Description: >-
3492
+ Use `min` instead of `sort.first`,
3493
+ `max_by` instead of `sort_by...last`, etc.
3494
+ Enabled: true
3495
+ VersionAdded: '0.76'
3496
+
3423
3497
  Style/RedundantSortBy:
3424
3498
  Description: 'Use `sort` instead of `sort_by { |x| x }`.'
3425
3499
  Enabled: true
@@ -3477,11 +3551,11 @@ Style/SafeNavigation:
3477
3551
  safe navigation (`&.`).
3478
3552
  Enabled: true
3479
3553
  VersionAdded: '0.43'
3480
- VersionChanged: '0.56'
3554
+ VersionChanged: '0.77'
3481
3555
  # Safe navigation may cause a statement to start returning `nil` in addition
3482
3556
  # to whatever it used to return.
3483
3557
  ConvertCodeThatCanStartToReturnNil: false
3484
- Whitelist:
3558
+ AllowedMethods:
3485
3559
  - present?
3486
3560
  - blank?
3487
3561
  - presence
@@ -3586,6 +3660,8 @@ Style/StringHashKeys:
3586
3660
  StyleGuide: '#symbols-as-keys'
3587
3661
  Enabled: false
3588
3662
  VersionAdded: '0.52'
3663
+ VersionChanged: '0.75'
3664
+ Safe: false
3589
3665
 
3590
3666
  Style/StringLiterals:
3591
3667
  Description: 'Checks if uses of quotes match the configured preference.'
@@ -3757,7 +3833,7 @@ Style/TrivialAccessors:
3757
3833
  StyleGuide: '#attr_family'
3758
3834
  Enabled: true
3759
3835
  VersionAdded: '0.9'
3760
- VersionChanged: '0.38'
3836
+ VersionChanged: '0.77'
3761
3837
  # When set to `false` the cop will suggest the use of accessor methods
3762
3838
  # in situations like:
3763
3839
  #
@@ -3778,7 +3854,7 @@ Style/TrivialAccessors:
3778
3854
  # Commonly used in DSLs
3779
3855
  AllowDSLWriters: false
3780
3856
  IgnoreClassMethods: false
3781
- Whitelist:
3857
+ AllowedMethods:
3782
3858
  - to_ary
3783
3859
  - to_a
3784
3860
  - to_c
@@ -3805,35 +3881,6 @@ Style/UnlessElse:
3805
3881
  Enabled: true
3806
3882
  VersionAdded: '0.9'
3807
3883
 
3808
- Style/UnneededCapitalW:
3809
- Description: 'Checks for %W when interpolation is not needed.'
3810
- Enabled: true
3811
- VersionAdded: '0.21'
3812
- VersionChanged: '0.24'
3813
-
3814
- Style/UnneededCondition:
3815
- Description: 'Checks for unnecessary conditional expressions.'
3816
- Enabled: true
3817
- VersionAdded: '0.57'
3818
-
3819
- Style/UnneededInterpolation:
3820
- Description: 'Checks for strings that are just an interpolated expression.'
3821
- Enabled: true
3822
- VersionAdded: '0.36'
3823
-
3824
- Style/UnneededPercentQ:
3825
- Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
3826
- StyleGuide: '#percent-q'
3827
- Enabled: true
3828
- VersionAdded: '0.24'
3829
-
3830
- Style/UnneededSort:
3831
- Description: >-
3832
- Use `min` instead of `sort.first`,
3833
- `max_by` instead of `sort_by...last`, etc.
3834
- Enabled: true
3835
- VersionAdded: '0.55'
3836
-
3837
3884
  Style/UnpackFirst:
3838
3885
  Description: >-
3839
3886
  Checks for accessing the first element of `String#unpack`
@@ -3904,8 +3951,9 @@ Style/YodaCondition:
3904
3951
  - require_for_all_comparison_operators
3905
3952
  # enforce yoda only for equality operators: `!=` and `==`
3906
3953
  - require_for_equality_operators_only
3954
+ Safe: false
3907
3955
  VersionAdded: '0.49'
3908
- VersionChanged: '0.63'
3956
+ VersionChanged: '0.75'
3909
3957
 
3910
3958
  Style/ZeroLengthPredicate:
3911
3959
  Description: 'Use #empty? when testing for objects of length 0.'