rubocop 0.93.1 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -16
  3. data/config/default.yml +276 -82
  4. data/config/obsoletion.yml +196 -0
  5. data/exe/rubocop +1 -1
  6. data/lib/rubocop.rb +31 -2
  7. data/lib/rubocop/cli.rb +5 -1
  8. data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
  9. data/lib/rubocop/cli/command/execute_runner.rb +26 -11
  10. data/lib/rubocop/cli/command/suggest_extensions.rb +80 -0
  11. data/lib/rubocop/cli/command/version.rb +1 -1
  12. data/lib/rubocop/comment_config.rb +1 -1
  13. data/lib/rubocop/config.rb +4 -0
  14. data/lib/rubocop/config_loader.rb +34 -8
  15. data/lib/rubocop/config_loader_resolver.rb +12 -6
  16. data/lib/rubocop/config_obsoletion.rb +65 -247
  17. data/lib/rubocop/config_obsoletion/changed_enforced_styles.rb +33 -0
  18. data/lib/rubocop/config_obsoletion/changed_parameter.rb +21 -0
  19. data/lib/rubocop/config_obsoletion/cop_rule.rb +34 -0
  20. data/lib/rubocop/config_obsoletion/extracted_cop.rb +44 -0
  21. data/lib/rubocop/config_obsoletion/parameter_rule.rb +44 -0
  22. data/lib/rubocop/config_obsoletion/removed_cop.rb +41 -0
  23. data/lib/rubocop/config_obsoletion/renamed_cop.rb +34 -0
  24. data/lib/rubocop/config_obsoletion/rule.rb +41 -0
  25. data/lib/rubocop/config_obsoletion/split_cop.rb +27 -0
  26. data/lib/rubocop/config_regeneration.rb +1 -1
  27. data/lib/rubocop/config_validator.rb +25 -10
  28. data/lib/rubocop/cop/autocorrect_logic.rb +21 -6
  29. data/lib/rubocop/cop/badge.rb +9 -24
  30. data/lib/rubocop/cop/base.rb +33 -16
  31. data/lib/rubocop/cop/bundler/duplicated_gem.rb +26 -6
  32. data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
  33. data/lib/rubocop/cop/commissioner.rb +37 -23
  34. data/lib/rubocop/cop/cop.rb +2 -2
  35. data/lib/rubocop/cop/corrector.rb +3 -1
  36. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -2
  37. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +6 -8
  38. data/lib/rubocop/cop/force.rb +1 -1
  39. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +3 -3
  40. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +4 -5
  41. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +1 -1
  42. data/lib/rubocop/cop/generator.rb +3 -10
  43. data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
  44. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +1 -1
  45. data/lib/rubocop/cop/layout/block_alignment.rb +3 -4
  46. data/lib/rubocop/cop/layout/class_structure.rb +22 -3
  47. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  48. data/lib/rubocop/cop/layout/else_alignment.rb +15 -2
  49. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +80 -10
  50. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +1 -0
  51. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +6 -1
  52. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -1
  53. data/lib/rubocop/cop/layout/end_alignment.rb +3 -3
  54. data/lib/rubocop/cop/layout/end_of_line.rb +5 -5
  55. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -2
  56. data/lib/rubocop/cop/layout/first_argument_indentation.rb +7 -2
  57. data/lib/rubocop/cop/layout/hash_alignment.rb +4 -4
  58. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +12 -0
  59. data/lib/rubocop/cop/layout/line_length.rb +10 -13
  60. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +7 -3
  61. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +24 -18
  62. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
  63. data/lib/rubocop/cop/layout/space_around_operators.rb +4 -1
  64. data/lib/rubocop/cop/layout/space_inside_parens.rb +35 -13
  65. data/lib/rubocop/cop/layout/trailing_whitespace.rb +37 -13
  66. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +2 -1
  67. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +26 -2
  68. data/lib/rubocop/cop/lint/debugger.rb +17 -28
  69. data/lib/rubocop/cop/lint/duplicate_branch.rb +93 -0
  70. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +2 -12
  71. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +77 -0
  72. data/lib/rubocop/cop/lint/else_layout.rb +29 -3
  73. data/lib/rubocop/cop/lint/empty_block.rb +82 -0
  74. data/lib/rubocop/cop/lint/empty_class.rb +93 -0
  75. data/lib/rubocop/cop/lint/flip_flop.rb +8 -2
  76. data/lib/rubocop/cop/lint/interpolation_check.rb +7 -2
  77. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +39 -7
  78. data/lib/rubocop/cop/lint/loop.rb +4 -4
  79. data/lib/rubocop/cop/lint/missing_super.rb +7 -4
  80. data/lib/rubocop/cop/lint/nested_percent_literal.rb +14 -0
  81. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +58 -0
  82. data/lib/rubocop/cop/lint/number_conversion.rb +46 -13
  83. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +27 -8
  84. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +19 -16
  85. data/lib/rubocop/cop/lint/shadowed_exception.rb +4 -5
  86. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +13 -0
  87. data/lib/rubocop/cop/lint/to_enum_arguments.rb +86 -0
  88. data/lib/rubocop/cop/lint/to_json.rb +1 -1
  89. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +85 -0
  90. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +199 -0
  91. data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -2
  92. data/lib/rubocop/cop/lint/useless_method_definition.rb +2 -4
  93. data/lib/rubocop/cop/lint/useless_setter_call.rb +6 -1
  94. data/lib/rubocop/cop/metrics/abc_size.rb +25 -1
  95. data/lib/rubocop/cop/metrics/block_length.rb +13 -7
  96. data/lib/rubocop/cop/metrics/method_length.rb +7 -2
  97. data/lib/rubocop/cop/metrics/parameter_lists.rb +68 -2
  98. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +20 -10
  99. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +146 -0
  100. data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +6 -1
  101. data/lib/rubocop/cop/migration/department_name.rb +1 -1
  102. data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
  103. data/lib/rubocop/cop/mixin/configurable_numbering.rb +4 -3
  104. data/lib/rubocop/cop/mixin/enforce_superclass.rb +9 -1
  105. data/lib/rubocop/cop/mixin/ignored_methods.rb +36 -3
  106. data/lib/rubocop/cop/mixin/line_length_help.rb +1 -1
  107. data/lib/rubocop/cop/mixin/method_complexity.rb +6 -0
  108. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
  109. data/lib/rubocop/cop/mixin/statement_modifier.rb +9 -4
  110. data/lib/rubocop/cop/mixin/string_help.rb +4 -1
  111. data/lib/rubocop/cop/mixin/visibility_help.rb +1 -3
  112. data/lib/rubocop/cop/naming/accessor_method_name.rb +15 -1
  113. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +12 -2
  114. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +11 -5
  115. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +67 -18
  116. data/lib/rubocop/cop/naming/predicate_name.rb +2 -1
  117. data/lib/rubocop/cop/naming/variable_number.rb +100 -8
  118. data/lib/rubocop/cop/offense.rb +3 -3
  119. data/lib/rubocop/cop/security/open.rb +12 -10
  120. data/lib/rubocop/cop/style/accessor_grouping.rb +1 -1
  121. data/lib/rubocop/cop/style/and_or.rb +11 -3
  122. data/lib/rubocop/cop/style/arguments_forwarding.rb +142 -0
  123. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +0 -4
  124. data/lib/rubocop/cop/style/case_like_if.rb +0 -4
  125. data/lib/rubocop/cop/style/character_literal.rb +10 -11
  126. data/lib/rubocop/cop/style/class_and_module_children.rb +8 -3
  127. data/lib/rubocop/cop/style/collection_compact.rb +91 -0
  128. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +169 -0
  129. data/lib/rubocop/cop/style/documentation.rb +12 -1
  130. data/lib/rubocop/cop/style/double_negation.rb +6 -1
  131. data/lib/rubocop/cop/style/float_division.rb +44 -1
  132. data/lib/rubocop/cop/style/format_string.rb +8 -3
  133. data/lib/rubocop/cop/style/format_string_token.rb +47 -2
  134. data/lib/rubocop/cop/style/hash_syntax.rb +3 -3
  135. data/lib/rubocop/cop/style/identical_conditional_branches.rb +7 -2
  136. data/lib/rubocop/cop/style/if_inside_else.rb +37 -1
  137. data/lib/rubocop/cop/style/if_unless_modifier.rb +11 -3
  138. data/lib/rubocop/cop/style/if_with_semicolon.rb +39 -4
  139. data/lib/rubocop/cop/style/infinite_loop.rb +4 -0
  140. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  141. data/lib/rubocop/cop/style/keyword_parameters_order.rb +12 -0
  142. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +10 -13
  143. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +8 -13
  144. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +7 -11
  145. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +11 -2
  146. data/lib/rubocop/cop/style/mixin_grouping.rb +0 -4
  147. data/lib/rubocop/cop/style/multiple_comparison.rb +55 -7
  148. data/lib/rubocop/cop/style/negated_if_else_condition.rb +106 -0
  149. data/lib/rubocop/cop/style/nil_lambda.rb +52 -0
  150. data/lib/rubocop/cop/style/numeric_literals.rb +14 -11
  151. data/lib/rubocop/cop/style/perl_backrefs.rb +86 -9
  152. data/lib/rubocop/cop/style/raise_args.rb +21 -6
  153. data/lib/rubocop/cop/style/redundant_argument.rb +88 -0
  154. data/lib/rubocop/cop/style/redundant_condition.rb +2 -1
  155. data/lib/rubocop/cop/style/redundant_parentheses.rb +4 -0
  156. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +7 -1
  157. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +24 -8
  158. data/lib/rubocop/cop/style/redundant_self.rb +3 -0
  159. data/lib/rubocop/cop/style/safe_navigation.rb +16 -4
  160. data/lib/rubocop/cop/style/semicolon.rb +3 -0
  161. data/lib/rubocop/cop/style/single_line_block_params.rb +30 -7
  162. data/lib/rubocop/cop/style/sole_nested_conditional.rb +65 -3
  163. data/lib/rubocop/cop/style/special_global_vars.rb +1 -13
  164. data/lib/rubocop/cop/style/static_class.rb +97 -0
  165. data/lib/rubocop/cop/style/string_concatenation.rb +39 -2
  166. data/lib/rubocop/cop/style/string_literals.rb +14 -8
  167. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +4 -3
  168. data/lib/rubocop/cop/style/swap_values.rb +108 -0
  169. data/lib/rubocop/cop/style/symbol_proc.rb +5 -3
  170. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +3 -1
  171. data/lib/rubocop/cop/style/while_until_modifier.rb +9 -0
  172. data/lib/rubocop/cop/team.rb +6 -1
  173. data/lib/rubocop/cop/util.rb +6 -2
  174. data/lib/rubocop/cop/variable_force/branch.rb +1 -1
  175. data/lib/rubocop/cop/variable_force/scope.rb +1 -1
  176. data/lib/rubocop/core_ext/hash.rb +20 -0
  177. data/lib/rubocop/ext/regexp_node.rb +36 -11
  178. data/lib/rubocop/ext/regexp_parser.rb +95 -0
  179. data/lib/rubocop/formatter/disabled_config_formatter.rb +21 -6
  180. data/lib/rubocop/formatter/emacs_style_formatter.rb +2 -0
  181. data/lib/rubocop/formatter/formatter_set.rb +2 -1
  182. data/lib/rubocop/formatter/git_hub_actions_formatter.rb +47 -0
  183. data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
  184. data/lib/rubocop/formatter/simple_text_formatter.rb +2 -0
  185. data/lib/rubocop/formatter/tap_formatter.rb +2 -0
  186. data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -1
  187. data/lib/rubocop/lockfile.rb +40 -0
  188. data/lib/rubocop/magic_comment.rb +2 -2
  189. data/lib/rubocop/options.rb +11 -1
  190. data/lib/rubocop/rake_task.rb +2 -2
  191. data/lib/rubocop/rspec/shared_contexts.rb +4 -0
  192. data/lib/rubocop/runner.rb +1 -1
  193. data/lib/rubocop/target_finder.rb +1 -1
  194. data/lib/rubocop/target_ruby.rb +65 -1
  195. data/lib/rubocop/version.rb +56 -6
  196. metadata +50 -9
  197. data/bin/console +0 -10
  198. data/bin/rubocop-profile +0 -32
  199. data/bin/setup +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8ce11205d6a6bb518654cbe498544aa799fbb8d9c9057afd2f551edfc35bbb8
4
- data.tar.gz: a1f79001991b28508ca7c9a79d75ed58f39ae0dcf2bad419d6a75919b3a3d539
3
+ metadata.gz: e7e78bdb76ac54d034e71f715292180a9982c1c08096fd8546c52f8786b703bd
4
+ data.tar.gz: e94b644cff4449332cd0be3dda1e41d2911f3bfd88fb14862534c0e29736a374
5
5
  SHA512:
6
- metadata.gz: a32001a91575c41b5ca71b6a148af79f45b2a7b8cbc3909a0dcbb7a652f5e62b6a79a84c14189eda64fd3d2a9e8c40d207c37c0f5a78a156e1f636c5191b995e
7
- data.tar.gz: 9ac5df57938099031807a96bd87a7fb9c5f7f40c314528b4c3254edb45b1386ce199fa9c394c9e7531655d117df9d3d5215bd66e4a927b9b2b0878e0eac2a1f6
6
+ metadata.gz: 54d96669e8524f0fc27ccc4ed75c44c2ce6c143298ed26affe5739eff1dd3aa9f24d0278e9df8e764c6ceb53b7f868764df783ccfd51d8a9bd633623124e150c
7
+ data.tar.gz: f6516450c7473cf56f6d330da24fd2b73827a07603ecda6bba672c470ae7490e97071a118d168f4288e37792289e97cb4503362915e9daa0ce1c79bd1d0def28
data/README.md CHANGED
@@ -11,11 +11,6 @@
11
11
  [![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop-hq/rubocop/maintainability)
12
12
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
13
13
 
14
- [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
15
- [![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
16
- [![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
17
- [![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)
18
-
19
14
  > Role models are important. <br/>
20
15
  > -- Officer Alex J. Murphy / RoboCop
21
16
 
@@ -27,6 +22,12 @@ RuboCop can also automatically fix many of them for you.
27
22
  RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
28
23
  [configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
29
24
 
25
+ ----------
26
+ [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
27
+ [![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
28
+ [![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
29
+ [![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)
30
+
30
31
  **Please consider [financially supporting its ongoing development](#funding).**
31
32
 
32
33
  ## Installation
@@ -43,15 +44,18 @@ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemf
43
44
  gem 'rubocop', require: false
44
45
  ```
45
46
 
46
- RuboCop's development is moving at a very rapid pace and there are
47
- often backward-incompatible changes between minor releases (since we
48
- haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
49
- might want to use a conservative version lock in your `Gemfile`:
47
+ RuboCop is stable between major versions, both in terms of API and cop configuration.
48
+ We aim the ease the maintenance of RuboCop extensions and the upgrades between RuboCop
49
+ releases. All big changes are reserved for major releases.
50
+ To prevent an unwanted RuboCop update you might want to use a conservative version lock
51
+ in your `Gemfile`:
50
52
 
51
53
  ```rb
52
- gem 'rubocop', '~> 0.93.1', require: false
54
+ gem 'rubocop', '~> 1.6', require: false
53
55
  ```
54
56
 
57
+ See [versioning](https://docs.rubocop.org/rubocop/1.0/versioning.html) for further details.
58
+
55
59
  ## Quickstart
56
60
 
57
61
  Just type `rubocop` in a Ruby project's folder and watch the magic happen.
@@ -67,12 +71,12 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
67
71
 
68
72
  ## Compatibility
69
73
 
70
- RuboCop supports the following Ruby implementations:
74
+ RuboCop officially supports the following Ruby implementations:
71
75
 
72
76
  * MRI 2.4+
73
77
  * JRuby 9.2+
74
78
 
75
- See [compatibility](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
79
+ See the [compatibility documentation](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
76
80
 
77
81
  ## Readme Badge
78
82
 
@@ -82,6 +86,15 @@ If you use RuboCop in your project, you can include one of these badges in your
82
86
 
83
87
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
84
88
 
89
+
90
+ Here are the Markdown snippets for the two badges:
91
+
92
+ ``` markdown
93
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
94
+
95
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
96
+ ```
97
+
85
98
  ## Team
86
99
 
87
100
  Here's a list of RuboCop's core developers:
@@ -97,6 +110,8 @@ Here's a list of RuboCop's core developers:
97
110
  * [Benjamin Quorning](https://github.com/bquorning)
98
111
  * [Marc-André Lafortune](https://github.com/marcandre)
99
112
 
113
+ See the [team page](https://docs.rubocop.org/rubocop/about/team.html) for more details.
114
+
100
115
  ## Logo
101
116
 
102
117
  RuboCop's logo was created by [Dimiter Petrov](https://www.chadomoto.com/). You can find the logo in various
@@ -136,14 +151,19 @@ wide array of funding channels to account for your preferences
136
151
  currently [Open Collective](https://opencollective.com/rubocop) is our
137
152
  preferred funding platform).
138
153
 
139
- If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
140
- to become a RuboCop sponsor.
154
+ **If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
155
+ to become a RuboCop sponsor.**
141
156
 
142
157
  You can support the development of RuboCop via
143
158
  [GitHub Sponsors](https://github.com/sponsors/bbatsov),
144
159
  [Patreon](https://www.patreon.com/bbatsov),
145
- [PayPal](https://paypal.me/bbatsov)
146
- and [Open Collective](https://opencollective.com/rubocop).
160
+ [PayPal](https://paypal.me/bbatsov),
161
+ [Open Collective](https://opencollective.com/rubocop)
162
+ and [Tidelift](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
163
+ .
164
+
165
+ **Note:** If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we'd recommend
166
+ the use of Tidelift, where you can get a support-like subscription instead.
147
167
 
148
168
  ### Open Collective Backers
149
169
 
@@ -139,6 +139,16 @@ AllCops:
139
139
  # from the lock file.) If the Ruby version is still unresolved, RuboCop will
140
140
  # use the oldest officially supported Ruby version (currently Ruby 2.4).
141
141
  TargetRubyVersion: ~
142
+ # Determines if a notification for extension libraries should be shown when
143
+ # rubocop is run. Keys are the name of the extension, and values are an array
144
+ # of gems in the Gemfile that the extension is suggested for, if not already
145
+ # included.
146
+ SuggestExtensions:
147
+ rubocop-rails: [rails]
148
+ rubocop-rspec: [rspec, rspec-rails]
149
+ rubocop-minitest: [minitest]
150
+ rubocop-sequel: [sequel]
151
+ rubocop-rake: [rake]
142
152
 
143
153
  #################### Bundler ###############################
144
154
 
@@ -313,7 +323,7 @@ Layout/AssignmentIndentation:
313
323
 
314
324
  Layout/BeginEndAlignment:
315
325
  Description: 'Align ends corresponding to begins correctly.'
316
- Enabled: pending
326
+ Enabled: true
317
327
  VersionAdded: '0.91'
318
328
  # The value `start_of_line` means that `end` should be aligned the start of the line
319
329
  # where the `begin` keyword is.
@@ -459,10 +469,14 @@ Layout/EmptyLineAfterMultilineCondition:
459
469
  - https://github.com/airbnb/ruby#multiline-if-newline
460
470
 
461
471
  Layout/EmptyLineBetweenDefs:
462
- Description: 'Use empty lines between defs.'
472
+ Description: 'Use empty lines between class/module/method defs.'
463
473
  StyleGuide: '#empty-lines-between-methods'
464
474
  Enabled: true
465
475
  VersionAdded: '0.49'
476
+ VersionChanged: '1.4'
477
+ EmptyLineBetweenMethodDefs: true
478
+ EmptyLineBetweenClassDefs: true
479
+ EmptyLineBetweenModuleDefs: true
466
480
  # If `true`, this parameter means that single line method definitions don't
467
481
  # need an empty line between them.
468
482
  AllowAdjacentOneLineDefs: false
@@ -496,7 +510,7 @@ Layout/EmptyLinesAroundArguments:
496
510
  Layout/EmptyLinesAroundAttributeAccessor:
497
511
  Description: "Keep blank lines around attribute accessors."
498
512
  StyleGuide: '#empty-lines-around-attribute-accessor'
499
- Enabled: pending
513
+ Enabled: true
500
514
  VersionAdded: '0.83'
501
515
  VersionChanged: '0.84'
502
516
  AllowAliasSyntax: true
@@ -891,8 +905,8 @@ Layout/LineLength:
891
905
  StyleGuide: '#max-line-length'
892
906
  Enabled: true
893
907
  VersionAdded: '0.25'
894
- VersionChanged: '0.84'
895
- AutoCorrect: false
908
+ VersionChanged: '1.4'
909
+ AutoCorrect: true
896
910
  Max: 120
897
911
  # To make it possible to copy or click on URIs in the code, we allow lines
898
912
  # containing a URI to be longer than Max.
@@ -1145,7 +1159,7 @@ Layout/SpaceAroundKeyword:
1145
1159
 
1146
1160
  Layout/SpaceAroundMethodCallOperator:
1147
1161
  Description: 'Checks method call operators to not have spaces around them.'
1148
- Enabled: pending
1162
+ Enabled: true
1149
1163
  VersionAdded: '0.82'
1150
1164
 
1151
1165
  Layout/SpaceAroundOperators:
@@ -1176,7 +1190,7 @@ Layout/SpaceBeforeBlockBraces:
1176
1190
  SupportedStylesForEmptyBraces:
1177
1191
  - space
1178
1192
  - no_space
1179
- VersionChanged: '0.52.1'
1193
+ VersionChanged: '0.52'
1180
1194
 
1181
1195
  Layout/SpaceBeforeComma:
1182
1196
  Description: 'No spaces before commas.'
@@ -1334,8 +1348,8 @@ Layout/TrailingWhitespace:
1334
1348
  StyleGuide: '#no-trailing-whitespace'
1335
1349
  Enabled: true
1336
1350
  VersionAdded: '0.49'
1337
- VersionChanged: '0.83'
1338
- AllowInHeredoc: true
1351
+ VersionChanged: '1.0'
1352
+ AllowInHeredoc: false
1339
1353
 
1340
1354
  #################### Lint ##################################
1341
1355
  ### Warnings
@@ -1379,7 +1393,7 @@ Lint/BigDecimalNew:
1379
1393
 
1380
1394
  Lint/BinaryOperatorWithIdenticalOperands:
1381
1395
  Description: 'This cop checks for places where binary operator has identical operands.'
1382
- Enabled: pending
1396
+ Enabled: true
1383
1397
  Safe: false
1384
1398
  VersionAdded: '0.89'
1385
1399
 
@@ -1398,8 +1412,13 @@ Lint/CircularArgumentReference:
1398
1412
  Lint/ConstantDefinitionInBlock:
1399
1413
  Description: 'Do not define constants within a block.'
1400
1414
  StyleGuide: '#no-constant-definition-in-block'
1401
- Enabled: pending
1415
+ Enabled: true
1402
1416
  VersionAdded: '0.91'
1417
+ VersionChanged: '1.3'
1418
+ # `enums` for Typed Enums via T::Enum in Sorbet.
1419
+ # https://sorbet.org/docs/tenum
1420
+ AllowedMethods:
1421
+ - enums
1403
1422
 
1404
1423
  Lint/ConstantResolution:
1405
1424
  Description: 'Check that constants are fully qualified with `::`.'
@@ -1415,6 +1434,22 @@ Lint/Debugger:
1415
1434
  Enabled: true
1416
1435
  VersionAdded: '0.14'
1417
1436
  VersionChanged: '0.49'
1437
+ DebuggerReceivers:
1438
+ - binding
1439
+ - Kernel
1440
+ - Pry
1441
+ DebuggerMethods:
1442
+ - debugger
1443
+ - byebug
1444
+ - remote_byebug
1445
+ - pry
1446
+ - remote_pry
1447
+ - pry_remote
1448
+ - console
1449
+ - rescue
1450
+ - save_and_open_page
1451
+ - save_and_open_screenshot
1452
+ - irb
1418
1453
 
1419
1454
  Lint/DeprecatedClassMethods:
1420
1455
  Description: 'Check for deprecated class method calls.'
@@ -1423,7 +1458,7 @@ Lint/DeprecatedClassMethods:
1423
1458
 
1424
1459
  Lint/DeprecatedOpenSSLConstant:
1425
1460
  Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1426
- Enabled: pending
1461
+ Enabled: true
1427
1462
  VersionAdded: '0.84'
1428
1463
 
1429
1464
  Lint/DisjunctiveAssignmentInConstructor:
@@ -1433,6 +1468,11 @@ Lint/DisjunctiveAssignmentInConstructor:
1433
1468
  VersionAdded: '0.62'
1434
1469
  VersionChanged: '0.88'
1435
1470
 
1471
+ Lint/DuplicateBranch:
1472
+ Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
1473
+ Enabled: pending
1474
+ VersionAdded: '1.3'
1475
+
1436
1476
  Lint/DuplicateCaseCondition:
1437
1477
  Description: 'Do not repeat values in case conditionals.'
1438
1478
  Enabled: true
@@ -1440,7 +1480,7 @@ Lint/DuplicateCaseCondition:
1440
1480
 
1441
1481
  Lint/DuplicateElsifCondition:
1442
1482
  Description: 'Do not repeat conditions used in if `elsif`.'
1443
- Enabled: 'pending'
1483
+ Enabled: true
1444
1484
  VersionAdded: '0.88'
1445
1485
 
1446
1486
  Lint/DuplicateHashKey:
@@ -1454,14 +1494,19 @@ Lint/DuplicateMethods:
1454
1494
  Enabled: true
1455
1495
  VersionAdded: '0.29'
1456
1496
 
1497
+ Lint/DuplicateRegexpCharacterClassElement:
1498
+ Description: 'Checks for duplicate elements in Regexp character classes.'
1499
+ Enabled: pending
1500
+ VersionAdded: '1.1'
1501
+
1457
1502
  Lint/DuplicateRequire:
1458
1503
  Description: 'Check for duplicate `require`s and `require_relative`s.'
1459
- Enabled: pending
1504
+ Enabled: true
1460
1505
  VersionAdded: '0.90'
1461
1506
 
1462
1507
  Lint/DuplicateRescueException:
1463
1508
  Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1464
- Enabled: pending
1509
+ Enabled: true
1465
1510
  VersionAdded: '0.89'
1466
1511
 
1467
1512
  Lint/EachWithObjectArgument:
@@ -1473,10 +1518,25 @@ Lint/ElseLayout:
1473
1518
  Description: 'Check for odd code arrangement in an else block.'
1474
1519
  Enabled: true
1475
1520
  VersionAdded: '0.17'
1521
+ VersionChanged: '1.2'
1522
+
1523
+ Lint/EmptyBlock:
1524
+ Description: 'This cop checks for blocks without a body.'
1525
+ Enabled: pending
1526
+ VersionAdded: '1.1'
1527
+ VersionChanged: '1.3'
1528
+ AllowComments: true
1529
+ AllowEmptyLambdas: true
1530
+
1531
+ Lint/EmptyClass:
1532
+ Description: 'Checks for classes and metaclasses without a body.'
1533
+ Enabled: pending
1534
+ VersionAdded: '1.3'
1535
+ AllowComments: false
1476
1536
 
1477
1537
  Lint/EmptyConditionalBody:
1478
1538
  Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1479
- Enabled: 'pending'
1539
+ Enabled: true
1480
1540
  AllowComments: true
1481
1541
  VersionAdded: '0.89'
1482
1542
 
@@ -1493,7 +1553,7 @@ Lint/EmptyExpression:
1493
1553
 
1494
1554
  Lint/EmptyFile:
1495
1555
  Description: 'Enforces that Ruby source files are not empty.'
1496
- Enabled: pending
1556
+ Enabled: true
1497
1557
  AllowComments: true
1498
1558
  VersionAdded: '0.90'
1499
1559
 
@@ -1531,7 +1591,7 @@ Lint/FlipFlop:
1531
1591
  Lint/FloatComparison:
1532
1592
  Description: 'Checks for the presence of precise comparison of floating point numbers.'
1533
1593
  StyleGuide: '#float-comparison'
1534
- Enabled: pending
1594
+ Enabled: true
1535
1595
  VersionAdded: '0.89'
1536
1596
 
1537
1597
  Lint/FloatOutOfRange:
@@ -1549,7 +1609,7 @@ Lint/FormatParameterMismatch:
1549
1609
  Lint/HashCompareByIdentity:
1550
1610
  Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
1551
1611
  StyleGuide: '#identity-comparison'
1552
- Enabled: pending
1612
+ Enabled: true
1553
1613
  Safe: false
1554
1614
  VersionAdded: '0.93'
1555
1615
 
@@ -1563,7 +1623,7 @@ Lint/HeredocMethodCallPosition:
1563
1623
 
1564
1624
  Lint/IdentityComparison:
1565
1625
  Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1566
- Enabled: pending
1626
+ Enabled: true
1567
1627
  StyleGuide: '#identity-comparison'
1568
1628
  VersionAdded: '0.91'
1569
1629
 
@@ -1616,7 +1676,8 @@ Lint/Loop:
1616
1676
  StyleGuide: '#loop-with-break'
1617
1677
  Enabled: true
1618
1678
  VersionAdded: '0.9'
1619
- VersionChanged: '0.89'
1679
+ VersionChanged: '1.3'
1680
+ Safe: false
1620
1681
 
1621
1682
  Lint/MissingCopEnableDirective:
1622
1683
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
@@ -1635,19 +1696,21 @@ Lint/MissingSuper:
1635
1696
  Description: >-
1636
1697
  This cop checks for the presence of constructors and lifecycle callbacks
1637
1698
  without calls to `super`'.
1638
- Enabled: pending
1699
+ Enabled: true
1639
1700
  VersionAdded: '0.89'
1701
+ VersionChanged: '1.4'
1640
1702
 
1641
1703
  Lint/MixedRegexpCaptureTypes:
1642
1704
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1643
- Enabled: pending
1705
+ Enabled: true
1644
1706
  VersionAdded: '0.85'
1645
1707
 
1646
1708
  Lint/MultipleComparison:
1647
1709
  Description: "Use `&&` operator to compare multiple values."
1648
1710
  Enabled: true
1649
1711
  VersionAdded: '0.47'
1650
- VersionChanged: '0.77'
1712
+ VersionChanged: '1.1'
1713
+ AllowMethodComparison: true
1651
1714
 
1652
1715
  Lint/NestedMethodDefinition:
1653
1716
  Description: 'Do not use nested method definitions.'
@@ -1667,6 +1730,11 @@ Lint/NextWithoutAccumulator:
1667
1730
  Enabled: true
1668
1731
  VersionAdded: '0.36'
1669
1732
 
1733
+ Lint/NoReturnInBeginEndBlocks:
1734
+ Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
1735
+ Enabled: pending
1736
+ VersionAdded: '1.2'
1737
+
1670
1738
  Lint/NonDeterministicRequireOrder:
1671
1739
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1672
1740
  Enabled: true
@@ -1682,8 +1750,12 @@ Lint/NumberConversion:
1682
1750
  Description: 'Checks unsafe usage of number conversion methods.'
1683
1751
  Enabled: false
1684
1752
  VersionAdded: '0.53'
1685
- VersionChanged: '0.70'
1753
+ VersionChanged: '1.1'
1686
1754
  SafeAutoCorrect: false
1755
+ IgnoredMethods: []
1756
+ IgnoredClasses:
1757
+ - Time
1758
+ - DateTime
1687
1759
 
1688
1760
  Lint/OrderedMagicComments:
1689
1761
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
@@ -1692,7 +1764,7 @@ Lint/OrderedMagicComments:
1692
1764
 
1693
1765
  Lint/OutOfRangeRegexpRef:
1694
1766
  Description: 'Checks for out of range reference for Regexp because it always returns nil.'
1695
- Enabled: pending
1767
+ Enabled: true
1696
1768
  Safe: false
1697
1769
  VersionAdded: '0.89'
1698
1770
 
@@ -1721,7 +1793,7 @@ Lint/PercentSymbolArray:
1721
1793
  Lint/RaiseException:
1722
1794
  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1723
1795
  StyleGuide: '#raise-exception'
1724
- Enabled: pending
1796
+ Enabled: true
1725
1797
  Safe: false
1726
1798
  VersionAdded: '0.81'
1727
1799
  VersionChanged: '0.86'
@@ -1755,7 +1827,7 @@ Lint/RedundantRequireStatement:
1755
1827
 
1756
1828
  Lint/RedundantSafeNavigation:
1757
1829
  Description: 'Checks for redundant safe navigation calls.'
1758
- Enabled: pending
1830
+ Enabled: true
1759
1831
  VersionAdded: '0.93'
1760
1832
  AllowedMethods:
1761
1833
  - instance_of?
@@ -1808,7 +1880,7 @@ Lint/RescueException:
1808
1880
  StyleGuide: '#no-blind-rescues'
1809
1881
  Enabled: true
1810
1882
  VersionAdded: '0.9'
1811
- VersionChanged: '0.27.1'
1883
+ VersionChanged: '0.27'
1812
1884
 
1813
1885
  Lint/RescueType:
1814
1886
  Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
@@ -1862,7 +1934,7 @@ Lint/ScriptPermission:
1862
1934
 
1863
1935
  Lint/SelfAssignment:
1864
1936
  Description: 'Checks for self-assignments.'
1865
- Enabled: pending
1937
+ Enabled: true
1866
1938
  VersionAdded: '0.89'
1867
1939
 
1868
1940
  Lint/SendWithMixinArgument:
@@ -1893,7 +1965,7 @@ Lint/ShadowingOuterLocalVariable:
1893
1965
 
1894
1966
  Lint/StructNewOverride:
1895
1967
  Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
1896
- Enabled: pending
1968
+ Enabled: true
1897
1969
  VersionAdded: '0.81'
1898
1970
 
1899
1971
  Lint/SuppressedException:
@@ -1910,6 +1982,11 @@ Lint/Syntax:
1910
1982
  VersionAdded: '0.9'
1911
1983
 
1912
1984
 
1985
+ Lint/ToEnumArguments:
1986
+ Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
1987
+ Enabled: pending
1988
+ VersionAdded: '1.1'
1989
+
1913
1990
  Lint/ToJSON:
1914
1991
  Description: 'Ensure #to_json includes an optional argument.'
1915
1992
  Enabled: true
@@ -1917,12 +1994,12 @@ Lint/ToJSON:
1917
1994
 
1918
1995
  Lint/TopLevelReturnWithArgument:
1919
1996
  Description: 'This cop detects top level return statements with argument.'
1920
- Enabled: 'pending'
1997
+ Enabled: true
1921
1998
  VersionAdded: '0.89'
1922
1999
 
1923
2000
  Lint/TrailingCommaInAttributeDeclaration:
1924
2001
  Description: 'This cop checks for trailing commas in attribute declarations.'
1925
- Enabled: pending
2002
+ Enabled: true
1926
2003
  VersionAdded: '0.90'
1927
2004
 
1928
2005
  Lint/UnderscorePrefixedVariableName:
@@ -1931,11 +2008,34 @@ Lint/UnderscorePrefixedVariableName:
1931
2008
  VersionAdded: '0.21'
1932
2009
  AllowKeywordBlockArguments: false
1933
2010
 
2011
+ Lint/UnexpectedBlockArity:
2012
+ Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2013
+ Enabled: pending
2014
+ Safe: false
2015
+ VersionAdded: '1.5'
2016
+ Methods:
2017
+ chunk_while: 2
2018
+ each_with_index: 2
2019
+ each_with_object: 2
2020
+ inject: 2
2021
+ max: 2
2022
+ min: 2
2023
+ minmax: 2
2024
+ reduce: 2
2025
+ slice_when: 2
2026
+ sort: 2
2027
+
1934
2028
  Lint/UnifiedInteger:
1935
2029
  Description: 'Use Integer instead of Fixnum or Bignum.'
1936
2030
  Enabled: true
1937
2031
  VersionAdded: '0.43'
1938
2032
 
2033
+ Lint/UnmodifiedReduceAccumulator:
2034
+ Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
2035
+ Enabled: pending
2036
+ VersionAdded: '1.1'
2037
+ VersionChanged: '1.5'
2038
+
1939
2039
  Lint/UnreachableCode:
1940
2040
  Description: 'Unreachable code.'
1941
2041
  Enabled: true
@@ -1943,7 +2043,7 @@ Lint/UnreachableCode:
1943
2043
 
1944
2044
  Lint/UnreachableLoop:
1945
2045
  Description: 'This cop checks for loops that will have at most one iteration.'
1946
- Enabled: pending
2046
+ Enabled: true
1947
2047
  VersionAdded: '0.89'
1948
2048
 
1949
2049
  Lint/UnusedBlockArgument:
@@ -2002,7 +2102,7 @@ Lint/UselessElseWithoutRescue:
2002
2102
 
2003
2103
  Lint/UselessMethodDefinition:
2004
2104
  Description: 'Checks for useless method definitions.'
2005
- Enabled: pending
2105
+ Enabled: true
2006
2106
  VersionAdded: '0.90'
2007
2107
  Safe: false
2008
2108
  AllowComments: true
@@ -2010,13 +2110,14 @@ Lint/UselessMethodDefinition:
2010
2110
  Lint/UselessSetterCall:
2011
2111
  Description: 'Checks for useless setter call to a local variable.'
2012
2112
  Enabled: true
2113
+ SafeAutoCorrect: false
2013
2114
  VersionAdded: '0.13'
2014
- VersionChanged: '0.80'
2115
+ VersionChanged: '1.2'
2015
2116
  Safe: false
2016
2117
 
2017
2118
  Lint/UselessTimes:
2018
2119
  Description: 'Checks for useless `Integer#times` calls.'
2019
- Enabled: pending
2120
+ Enabled: true
2020
2121
  VersionAdded: '0.91'
2021
2122
  Safe: false
2022
2123
 
@@ -2037,21 +2138,23 @@ Metrics/AbcSize:
2037
2138
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
2038
2139
  Enabled: true
2039
2140
  VersionAdded: '0.27'
2040
- VersionChanged: '0.81'
2141
+ VersionChanged: '1.5'
2041
2142
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2042
2143
  # a Float.
2043
2144
  IgnoredMethods: []
2145
+ CountRepeatedAttributes: true
2044
2146
  Max: 17
2045
2147
 
2046
2148
  Metrics/BlockLength:
2047
2149
  Description: 'Avoid long blocks with many lines.'
2048
2150
  Enabled: true
2049
2151
  VersionAdded: '0.44'
2050
- VersionChanged: '0.87'
2152
+ VersionChanged: '1.5'
2051
2153
  CountComments: false # count full line comments?
2052
2154
  Max: 25
2053
2155
  CountAsOne: []
2054
- ExcludedMethods:
2156
+ ExcludedMethods: [] # deprecated, retained for backwards compatibility
2157
+ IgnoredMethods:
2055
2158
  # By default, exclude the `#refine` method, as it tends to have larger
2056
2159
  # associated blocks.
2057
2160
  - refine
@@ -2092,11 +2195,12 @@ Metrics/MethodLength:
2092
2195
  StyleGuide: '#short-methods'
2093
2196
  Enabled: true
2094
2197
  VersionAdded: '0.25'
2095
- VersionChanged: '0.87'
2198
+ VersionChanged: '1.5'
2096
2199
  CountComments: false # count full line comments?
2097
2200
  Max: 10
2098
2201
  CountAsOne: []
2099
- ExcludedMethods: []
2202
+ ExcludedMethods: [] # deprecated, retained for backwards compatibility
2203
+ IgnoredMethods: []
2100
2204
 
2101
2205
  Metrics/ModuleLength:
2102
2206
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2112,8 +2216,10 @@ Metrics/ParameterLists:
2112
2216
  StyleGuide: '#too-many-params'
2113
2217
  Enabled: true
2114
2218
  VersionAdded: '0.25'
2219
+ VersionChanged: '1.5'
2115
2220
  Max: 5
2116
2221
  CountKeywordArgs: true
2222
+ MaxOptionalParameters: 3
2117
2223
 
2118
2224
  Metrics/PerceivedComplexity:
2119
2225
  Description: >-
@@ -2155,6 +2261,7 @@ Naming/BinaryOperatorParameterName:
2155
2261
  StyleGuide: '#other-arg'
2156
2262
  Enabled: true
2157
2263
  VersionAdded: '0.50'
2264
+ VersionChanged: '1.2'
2158
2265
 
2159
2266
  Naming/BlockParameterName:
2160
2267
  Description: >-
@@ -2261,6 +2368,7 @@ Naming/HeredocDelimiterCase:
2261
2368
  StyleGuide: '#heredoc-delimiters'
2262
2369
  Enabled: true
2263
2370
  VersionAdded: '0.50'
2371
+ VersionChanged: '1.2'
2264
2372
  EnforcedStyle: uppercase
2265
2373
  SupportedStyles:
2266
2374
  - lowercase
@@ -2279,7 +2387,7 @@ Naming/MemoizedInstanceVariableName:
2279
2387
  Memoized method name should match memo instance variable name.
2280
2388
  Enabled: true
2281
2389
  VersionAdded: '0.53'
2282
- VersionChanged: '0.58'
2390
+ VersionChanged: '1.2'
2283
2391
  EnforcedStyleForLeadingUnderscores: disallowed
2284
2392
  SupportedStylesForLeadingUnderscores:
2285
2393
  - disallowed
@@ -2377,14 +2485,25 @@ Naming/VariableName:
2377
2485
  - camelCase
2378
2486
 
2379
2487
  Naming/VariableNumber:
2380
- Description: 'Use the configured style when numbering variables.'
2488
+ Description: 'Use the configured style when numbering symbols, methods and variables.'
2489
+ StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
2381
2490
  Enabled: true
2382
2491
  VersionAdded: '0.50'
2492
+ VersionChanged: '1.4'
2383
2493
  EnforcedStyle: normalcase
2384
2494
  SupportedStyles:
2385
2495
  - snake_case
2386
2496
  - normalcase
2387
2497
  - non_integer
2498
+ CheckMethodNames: true
2499
+ CheckSymbols: true
2500
+ AllowedIdentifiers:
2501
+ - capture3 # Open3.capture3
2502
+ - iso8601 # Time#iso8601
2503
+ - rfc1123_date # CGI.rfc1123_date
2504
+ - rfc822 # Time#rfc822
2505
+ - rfc2822 # Time#rfc2822
2506
+ - rfc3339 # DateTime.rfc3339
2388
2507
 
2389
2508
  #################### Security ##############################
2390
2509
 
@@ -2415,9 +2534,10 @@ Security/MarshalLoad:
2415
2534
  VersionAdded: '0.47'
2416
2535
 
2417
2536
  Security/Open:
2418
- Description: 'The use of Kernel#open represents a serious security risk.'
2537
+ Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
2419
2538
  Enabled: true
2420
2539
  VersionAdded: '0.53'
2540
+ VersionChanged: '1.0'
2421
2541
  Safe: false
2422
2542
 
2423
2543
  Security/YAMLLoad:
@@ -2444,7 +2564,7 @@ Style/AccessModifierDeclarations:
2444
2564
 
2445
2565
  Style/AccessorGrouping:
2446
2566
  Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2447
- Enabled: 'pending'
2567
+ Enabled: true
2448
2568
  VersionAdded: '0.87'
2449
2569
  EnforcedStyle: grouped
2450
2570
  SupportedStyles:
@@ -2477,6 +2597,13 @@ Style/AndOr:
2477
2597
  - always
2478
2598
  - conditionals
2479
2599
 
2600
+ Style/ArgumentsForwarding:
2601
+ Description: 'Use arguments forwarding.'
2602
+ StyleGuide: '#arguments-forwarding'
2603
+ Enabled: pending
2604
+ AllowOnlyRestArgument: true
2605
+ VersionAdded: '1.1'
2606
+
2480
2607
  Style/ArrayCoercion:
2481
2608
  Description: >-
2482
2609
  Use Array() instead of explicit Array check or [*var], when dealing
@@ -2533,7 +2660,7 @@ Style/BisectedAttrAccessor:
2533
2660
  Description: >-
2534
2661
  Checks for places where `attr_reader` and `attr_writer`
2535
2662
  for the same method can be combined into single `attr_accessor`.
2536
- Enabled: 'pending'
2663
+ Enabled: true
2537
2664
  VersionAdded: '0.87'
2538
2665
 
2539
2666
  Style/BlockComments:
@@ -2672,7 +2799,7 @@ Style/CaseEquality:
2672
2799
  Style/CaseLikeIf:
2673
2800
  Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2674
2801
  StyleGuide: '#case-vs-if-else'
2675
- Enabled: 'pending'
2802
+ Enabled: true
2676
2803
  Safe: false
2677
2804
  VersionAdded: '0.88'
2678
2805
 
@@ -2725,7 +2852,7 @@ Style/ClassCheck:
2725
2852
  Style/ClassEqualityComparison:
2726
2853
  Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
2727
2854
  StyleGuide: '#instance-of-vs-class-comparison'
2728
- Enabled: pending
2855
+ Enabled: true
2729
2856
  VersionAdded: '0.93'
2730
2857
  IgnoredMethods:
2731
2858
  - ==
@@ -2755,6 +2882,13 @@ Style/ClassVars:
2755
2882
  Enabled: true
2756
2883
  VersionAdded: '0.13'
2757
2884
 
2885
+ Style/CollectionCompact:
2886
+ Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
2887
+ Enabled: pending
2888
+ Safe: false
2889
+ VersionAdded: '1.2'
2890
+ VersionChanged: '1.3'
2891
+
2758
2892
  # Align with the style guide.
2759
2893
  Style/CollectionMethods:
2760
2894
  Description: 'Preferred collection methods.'
@@ -2793,7 +2927,7 @@ Style/CombinableLoops:
2793
2927
  Description: >-
2794
2928
  Checks for places where multiple consecutive loops over the same data
2795
2929
  can be combined into a single loop.
2796
- Enabled: pending
2930
+ Enabled: true
2797
2931
  Safe: false
2798
2932
  VersionAdded: '0.90'
2799
2933
 
@@ -2818,17 +2952,18 @@ Style/CommandLiteral:
2818
2952
  Style/CommentAnnotation:
2819
2953
  Description: >-
2820
2954
  Checks formatting of special comments
2821
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
2955
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
2822
2956
  StyleGuide: '#annotate-keywords'
2823
2957
  Enabled: true
2824
2958
  VersionAdded: '0.10'
2825
- VersionChanged: '0.31'
2959
+ VersionChanged: '1.3'
2826
2960
  Keywords:
2827
2961
  - TODO
2828
2962
  - FIXME
2829
2963
  - OPTIMIZE
2830
2964
  - HACK
2831
2965
  - REVIEW
2966
+ - NOTE
2832
2967
 
2833
2968
  Style/CommentedKeyword:
2834
2969
  Description: 'Do not place comments on the same line as certain keywords.'
@@ -2917,6 +3052,15 @@ Style/DisableCopsWithinSourceCodeDirective:
2917
3052
  Enabled: false
2918
3053
  VersionAdded: '0.82'
2919
3054
 
3055
+ Style/DocumentDynamicEvalDefinition:
3056
+ Description: >-
3057
+ When using `class_eval` (or other `eval`) with string interpolation,
3058
+ add a comment block showing its appearance if interpolated.
3059
+ StyleGuide: '#eval-comment-docs'
3060
+ Enabled: pending
3061
+ VersionAdded: '1.1'
3062
+ VersionChanged: '1.3'
3063
+
2920
3064
  Style/Documentation:
2921
3065
  Description: 'Document classes and non-namespace modules.'
2922
3066
  Enabled: true
@@ -2944,7 +3088,7 @@ Style/DoubleNegation:
2944
3088
  StyleGuide: '#no-bang-bang'
2945
3089
  Enabled: true
2946
3090
  VersionAdded: '0.19'
2947
- VersionChanged: '0.84'
3091
+ VersionChanged: '1.2'
2948
3092
  EnforcedStyle: allowed_in_returns
2949
3093
  SafeAutoCorrect: false
2950
3094
  SupportedStyles:
@@ -3046,7 +3190,7 @@ Style/ExplicitBlockArgument:
3046
3190
  Consider using explicit block argument to avoid writing block literal
3047
3191
  that just passes its arguments to another block.
3048
3192
  StyleGuide: '#block-argument'
3049
- Enabled: pending
3193
+ Enabled: true
3050
3194
  # May change the yielding arity.
3051
3195
  Safe: false
3052
3196
  VersionAdded: '0.89'
@@ -3054,7 +3198,7 @@ Style/ExplicitBlockArgument:
3054
3198
  Style/ExponentialNotation:
3055
3199
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
3056
3200
  StyleGuide: '#exponential-notation'
3057
- Enabled: pending
3201
+ Enabled: true
3058
3202
  VersionAdded: '0.82'
3059
3203
  EnforcedStyle: scientific
3060
3204
  SupportedStyles:
@@ -3065,9 +3209,10 @@ Style/ExponentialNotation:
3065
3209
  Style/FloatDivision:
3066
3210
  Description: 'For performing float division, coerce one side only.'
3067
3211
  StyleGuide: '#float-division'
3068
- Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
3212
+ Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
3069
3213
  Enabled: true
3070
3214
  VersionAdded: '0.72'
3215
+ VersionChanged: '1.6'
3071
3216
  EnforcedStyle: single_coerce
3072
3217
  SupportedStyles:
3073
3218
  - left_coerce
@@ -3109,8 +3254,12 @@ Style/FormatStringToken:
3109
3254
  # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
3110
3255
  - template
3111
3256
  - unannotated
3257
+ # `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
3258
+ # style token in a format string to be allowed when enforced style is not
3259
+ # `unannotated`.
3260
+ MaxUnannotatedPlaceholdersAllowed: 1
3112
3261
  VersionAdded: '0.49'
3113
- VersionChanged: '0.75'
3262
+ VersionChanged: '1.0'
3114
3263
 
3115
3264
  Style/FrozenStringLiteralComment:
3116
3265
  Description: >-
@@ -3137,7 +3286,7 @@ Style/FrozenStringLiteralComment:
3137
3286
  Style/GlobalStdStream:
3138
3287
  Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
3139
3288
  StyleGuide: '#global-stdout'
3140
- Enabled: pending
3289
+ Enabled: true
3141
3290
  VersionAdded: '0.89'
3142
3291
  SafeAutoCorrect: false
3143
3292
 
@@ -3165,7 +3314,7 @@ Style/HashAsLastArrayItem:
3165
3314
  Checks for presence or absence of braces around hash literal as a last
3166
3315
  array item depending on configuration.
3167
3316
  StyleGuide: '#hash-literal-as-last-array-item'
3168
- Enabled: 'pending'
3317
+ Enabled: true
3169
3318
  VersionAdded: '0.88'
3170
3319
  EnforcedStyle: braces
3171
3320
  SupportedStyles:
@@ -3175,7 +3324,7 @@ Style/HashAsLastArrayItem:
3175
3324
  Style/HashEachMethods:
3176
3325
  Description: 'Use Hash#each_key and Hash#each_value.'
3177
3326
  StyleGuide: '#hash-each'
3178
- Enabled: pending
3327
+ Enabled: true
3179
3328
  VersionAdded: '0.80'
3180
3329
  Safe: false
3181
3330
 
@@ -3183,7 +3332,7 @@ Style/HashLikeCase:
3183
3332
  Description: >-
3184
3333
  Checks for places where `case-when` represents a simple 1:1
3185
3334
  mapping and can be replaced with a hash lookup.
3186
- Enabled: 'pending'
3335
+ Enabled: true
3187
3336
  VersionAdded: '0.88'
3188
3337
  # `MinBranchesCount` defines the number of branches `case` needs to have
3189
3338
  # to trigger this cop
@@ -3214,14 +3363,14 @@ Style/HashSyntax:
3214
3363
 
3215
3364
  Style/HashTransformKeys:
3216
3365
  Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
3217
- Enabled: 'pending'
3366
+ Enabled: true
3218
3367
  VersionAdded: '0.80'
3219
3368
  VersionChanged: '0.90'
3220
3369
  Safe: false
3221
3370
 
3222
3371
  Style/HashTransformValues:
3223
3372
  Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
3224
- Enabled: 'pending'
3373
+ Enabled: true
3225
3374
  VersionAdded: '0.80'
3226
3375
  VersionChanged: '0.90'
3227
3376
  Safe: false
@@ -3239,6 +3388,7 @@ Style/IfInsideElse:
3239
3388
  Enabled: true
3240
3389
  AllowIfModifier: false
3241
3390
  VersionAdded: '0.36'
3391
+ VersionChanged: '1.3'
3242
3392
 
3243
3393
  Style/IfUnlessModifier:
3244
3394
  Description: >-
@@ -3271,12 +3421,14 @@ Style/ImplicitRuntimeError:
3271
3421
  VersionAdded: '0.41'
3272
3422
 
3273
3423
  Style/InfiniteLoop:
3274
- Description: 'Use Kernel#loop for infinite loops.'
3424
+ Description: >-
3425
+ Use Kernel#loop for infinite loops.
3426
+ This cop is unsafe in the body may raise a `StopIteration` exception.
3427
+ Safe: false
3275
3428
  StyleGuide: '#infinite-loop'
3276
3429
  Enabled: true
3277
3430
  VersionAdded: '0.26'
3278
3431
  VersionChanged: '0.61'
3279
- SafeAutoCorrect: true
3280
3432
 
3281
3433
  Style/InlineComment:
3282
3434
  Description: 'Avoid trailing inline comments.'
@@ -3328,7 +3480,7 @@ Style/IpAddresses:
3328
3480
  Style/KeywordParametersOrder:
3329
3481
  Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
3330
3482
  StyleGuide: '#keyword-parameters-order'
3331
- Enabled: pending
3483
+ Enabled: true
3332
3484
  VersionAdded: '0.90'
3333
3485
 
3334
3486
  Style/Lambda:
@@ -3530,6 +3682,7 @@ Style/MultipleComparison:
3530
3682
  use Array#include? instead.
3531
3683
  Enabled: true
3532
3684
  VersionAdded: '0.49'
3685
+ VersionChanged: '1.1'
3533
3686
 
3534
3687
  Style/MutableConstant:
3535
3688
  Description: 'Do not assign mutable objects to constants.'
@@ -3564,6 +3717,13 @@ Style/NegatedIf:
3564
3717
  - prefix
3565
3718
  - postfix
3566
3719
 
3720
+ Style/NegatedIfElseCondition:
3721
+ Description: >-
3722
+ This cop checks for uses of `if-else` and ternary operators with a negated condition
3723
+ which can be simplified by inverting condition and swapping branches.
3724
+ Enabled: pending
3725
+ VersionAdded: '1.2'
3726
+
3567
3727
  Style/NegatedUnless:
3568
3728
  Description: 'Favor if over unless for negative conditions.'
3569
3729
  StyleGuide: '#if-for-negatives'
@@ -3651,6 +3811,11 @@ Style/NilComparison:
3651
3811
  - predicate
3652
3812
  - comparison
3653
3813
 
3814
+ Style/NilLambda:
3815
+ Description: 'Prefer `-> {}` to `-> { nil }`.'
3816
+ Enabled: pending
3817
+ VersionAdded: '1.3'
3818
+
3654
3819
  Style/NonNilCheck:
3655
3820
  Description: 'Checks for redundant nil checks.'
3656
3821
  StyleGuide: '#no-non-nil-checks'
@@ -3753,7 +3918,7 @@ Style/OptionalArguments:
3753
3918
  Style/OptionalBooleanParameter:
3754
3919
  Description: 'Use keyword arguments when defining method with boolean argument.'
3755
3920
  StyleGuide: '#boolean-keyword-arguments'
3756
- Enabled: pending
3921
+ Enabled: true
3757
3922
  Safe: false
3758
3923
  VersionAdded: '0.89'
3759
3924
  AllowedMethods:
@@ -3800,7 +3965,7 @@ Style/PercentLiteralDelimiters:
3800
3965
  '%r': '{}'
3801
3966
  '%w': '[]'
3802
3967
  '%W': '[]'
3803
- VersionChanged: '0.48.1'
3968
+ VersionChanged: '0.48'
3804
3969
 
3805
3970
  Style/PercentQLiterals:
3806
3971
  Description: 'Checks if uses of %Q/%q match the configured preference.'
@@ -3841,11 +4006,12 @@ Style/RaiseArgs:
3841
4006
  StyleGuide: '#exception-class-messages'
3842
4007
  Enabled: true
3843
4008
  VersionAdded: '0.14'
3844
- VersionChanged: '0.40'
4009
+ VersionChanged: '1.2'
3845
4010
  EnforcedStyle: exploded
3846
4011
  SupportedStyles:
3847
4012
  - compact # raise Exception.new(msg)
3848
4013
  - exploded # raise Exception, msg
4014
+ AllowedCompactTypes: []
3849
4015
 
3850
4016
  Style/RandomWithOffset:
3851
4017
  Description: >-
@@ -3855,9 +4021,21 @@ Style/RandomWithOffset:
3855
4021
  Enabled: true
3856
4022
  VersionAdded: '0.52'
3857
4023
 
4024
+ Style/RedundantArgument:
4025
+ Description: 'Check for a redundant argument passed to certain methods.'
4026
+ Enabled: pending
4027
+ Safe: false
4028
+ VersionAdded: '1.4'
4029
+ VersionChanged: '1.6'
4030
+ Methods:
4031
+ # Array#join
4032
+ join: ''
4033
+ # String#split
4034
+ split: ' '
4035
+
3858
4036
  Style/RedundantAssignment:
3859
4037
  Description: 'Checks for redundant assignment before returning.'
3860
- Enabled: 'pending'
4038
+ Enabled: true
3861
4039
  VersionAdded: '0.87'
3862
4040
 
3863
4041
  Style/RedundantBegin:
@@ -3894,7 +4072,7 @@ Style/RedundantFetchBlock:
3894
4072
  Use `fetch(key, value)` instead of `fetch(key) { value }`
3895
4073
  when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
3896
4074
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
3897
- Enabled: 'pending'
4075
+ Enabled: true
3898
4076
  Safe: false
3899
4077
  # If enabled, this cop will autocorrect usages of
3900
4078
  # `fetch` being called with block returning a constant.
@@ -3907,7 +4085,7 @@ Style/RedundantFileExtensionInRequire:
3907
4085
  Checks for the presence of superfluous `.rb` extension in
3908
4086
  the filename provided to `require` and `require_relative`.
3909
4087
  StyleGuide: '#no-explicit-rb-to-require'
3910
- Enabled: 'pending'
4088
+ Enabled: true
3911
4089
  VersionAdded: '0.88'
3912
4090
 
3913
4091
  Style/RedundantFreeze:
@@ -3934,12 +4112,12 @@ Style/RedundantPercentQ:
3934
4112
 
3935
4113
  Style/RedundantRegexpCharacterClass:
3936
4114
  Description: 'Checks for unnecessary single-element Regexp character classes.'
3937
- Enabled: pending
4115
+ Enabled: true
3938
4116
  VersionAdded: '0.85'
3939
4117
 
3940
4118
  Style/RedundantRegexpEscape:
3941
4119
  Description: 'Checks for redundant escapes in Regexps.'
3942
- Enabled: pending
4120
+ Enabled: true
3943
4121
  VersionAdded: '0.85'
3944
4122
 
3945
4123
  Style/RedundantReturn:
@@ -3960,7 +4138,7 @@ Style/RedundantSelf:
3960
4138
 
3961
4139
  Style/RedundantSelfAssignment:
3962
4140
  Description: 'Checks for places where redundant assignments are made for in place modification methods.'
3963
- Enabled: pending
4141
+ Enabled: true
3964
4142
  Safe: false
3965
4143
  VersionAdded: '0.90'
3966
4144
 
@@ -4088,7 +4266,7 @@ Style/SignalException:
4088
4266
 
4089
4267
  Style/SingleArgumentDig:
4090
4268
  Description: 'Avoid using single argument dig method.'
4091
- Enabled: pending
4269
+ Enabled: true
4092
4270
  VersionAdded: '0.89'
4093
4271
  Safe: false
4094
4272
 
@@ -4096,7 +4274,7 @@ Style/SingleLineBlockParams:
4096
4274
  Description: 'Enforces the names of some block params.'
4097
4275
  Enabled: false
4098
4276
  VersionAdded: '0.16'
4099
- VersionChanged: '0.47'
4277
+ VersionChanged: '1.6'
4100
4278
  Methods:
4101
4279
  - reduce:
4102
4280
  - acc
@@ -4115,7 +4293,7 @@ Style/SingleLineMethods:
4115
4293
 
4116
4294
  Style/SlicingWithRange:
4117
4295
  Description: 'Checks array slicing is done with endless ranges when suitable.'
4118
- Enabled: pending
4296
+ Enabled: true
4119
4297
  VersionAdded: '0.83'
4120
4298
  Safe: false
4121
4299
 
@@ -4123,8 +4301,9 @@ Style/SoleNestedConditional:
4123
4301
  Description: >-
4124
4302
  Finds sole nested conditional nodes
4125
4303
  which can be merged into outer conditional node.
4126
- Enabled: pending
4304
+ Enabled: true
4127
4305
  VersionAdded: '0.89'
4306
+ VersionChanged: '1.5'
4128
4307
  AllowModifier: false
4129
4308
 
4130
4309
  Style/SpecialGlobalVars:
@@ -4149,6 +4328,13 @@ Style/StabbyLambdaParentheses:
4149
4328
  - require_parentheses
4150
4329
  - require_no_parentheses
4151
4330
 
4331
+ Style/StaticClass:
4332
+ Description: 'Prefer modules to classes with only class methods.'
4333
+ StyleGuide: '#modules-vs-classes'
4334
+ Enabled: false
4335
+ Safe: false
4336
+ VersionAdded: '1.3'
4337
+
4152
4338
  Style/StderrPuts:
4153
4339
  Description: 'Use `warn` instead of `$stderr.puts`.'
4154
4340
  StyleGuide: '#warn'
@@ -4158,9 +4344,10 @@ Style/StderrPuts:
4158
4344
  Style/StringConcatenation:
4159
4345
  Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4160
4346
  StyleGuide: '#string-interpolation'
4161
- Enabled: pending
4347
+ Enabled: true
4162
4348
  Safe: false
4163
4349
  VersionAdded: '0.89'
4350
+ VersionChanged: '1.6'
4164
4351
 
4165
4352
  Style/StringHashKeys:
4166
4353
  Description: 'Prefer symbols instead of strings as hash keys.'
@@ -4199,7 +4386,7 @@ Style/StringMethods:
4199
4386
  Description: 'Checks if configured preferred methods are used over non-preferred.'
4200
4387
  Enabled: false
4201
4388
  VersionAdded: '0.34'
4202
- VersionChanged: '0.34.2'
4389
+ VersionChanged: '0.34'
4203
4390
  # Mapping from undesired method to desired_method
4204
4391
  # e.g. to use `to_sym` over `intern`:
4205
4392
  #
@@ -4221,6 +4408,13 @@ Style/StructInheritance:
4221
4408
  VersionAdded: '0.29'
4222
4409
  VersionChanged: '0.86'
4223
4410
 
4411
+ Style/SwapValues:
4412
+ Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
4413
+ StyleGuide: '#values-swapping'
4414
+ Enabled: pending
4415
+ VersionAdded: '1.1'
4416
+ SafeAutoCorrect: false
4417
+
4224
4418
  Style/SymbolArray:
4225
4419
  Description: 'Use %i or %I for arrays of symbols.'
4226
4420
  StyleGuide: '#percent-i'
@@ -4243,7 +4437,7 @@ Style/SymbolProc:
4243
4437
  Enabled: true
4244
4438
  Safe: false
4245
4439
  VersionAdded: '0.26'
4246
- VersionChanged: '0.64'
4440
+ VersionChanged: '1.5'
4247
4441
  # A list of method names to be ignored by the check.
4248
4442
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4249
4443
  IgnoredMethods: