rubocop 0.88.0 → 0.89.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/rubocop-profile +1 -0
  4. data/config/default.yml +96 -16
  5. data/lib/rubocop.rb +16 -4
  6. data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
  7. data/lib/rubocop/cli/command/base.rb +1 -0
  8. data/lib/rubocop/cli/command/execute_runner.rb +1 -1
  9. data/lib/rubocop/cli/command/show_cops.rb +1 -1
  10. data/lib/rubocop/cli/command/version.rb +2 -2
  11. data/lib/rubocop/comment_config.rb +2 -2
  12. data/lib/rubocop/config.rb +19 -2
  13. data/lib/rubocop/config_loader.rb +1 -1
  14. data/lib/rubocop/config_loader_resolver.rb +3 -3
  15. data/lib/rubocop/config_obsoletion.rb +6 -1
  16. data/lib/rubocop/config_validator.rb +1 -3
  17. data/lib/rubocop/cop/base.rb +2 -2
  18. data/lib/rubocop/cop/commissioner.rb +0 -1
  19. data/lib/rubocop/cop/correctors/line_break_corrector.rb +3 -3
  20. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
  21. data/lib/rubocop/cop/correctors/punctuation_corrector.rb +1 -1
  22. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +15 -18
  23. data/lib/rubocop/cop/force.rb +1 -0
  24. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +32 -11
  25. data/lib/rubocop/cop/generator/configuration_injector.rb +2 -2
  26. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +4 -12
  27. data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +1 -1
  28. data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +8 -8
  29. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +10 -7
  30. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +7 -8
  31. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -2
  32. data/lib/rubocop/cop/layout/block_alignment.rb +1 -1
  33. data/lib/rubocop/cop/layout/empty_lines.rb +0 -2
  34. data/lib/rubocop/cop/layout/extra_spacing.rb +9 -16
  35. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
  36. data/lib/rubocop/cop/layout/heredoc_indentation.rb +2 -2
  37. data/lib/rubocop/cop/layout/indentation_style.rb +0 -2
  38. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -1
  39. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +0 -2
  40. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +9 -1
  41. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +7 -4
  42. data/lib/rubocop/cop/lint/ambiguous_operator.rb +15 -10
  43. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +11 -13
  44. data/lib/rubocop/cop/lint/assignment_in_condition.rb +2 -2
  45. data/lib/rubocop/cop/lint/big_decimal_new.rb +10 -10
  46. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +49 -0
  47. data/lib/rubocop/cop/lint/boolean_symbol.rb +16 -11
  48. data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
  49. data/lib/rubocop/cop/lint/constant_resolution.rb +1 -1
  50. data/lib/rubocop/cop/lint/debugger.rb +7 -1
  51. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +9 -10
  52. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +17 -13
  53. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
  54. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +1 -1
  55. data/lib/rubocop/cop/lint/duplicate_methods.rb +7 -4
  56. data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +60 -0
  57. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  58. data/lib/rubocop/cop/lint/else_layout.rb +1 -1
  59. data/lib/rubocop/cop/lint/empty_conditional_body.rb +67 -0
  60. data/lib/rubocop/cop/lint/empty_ensure.rb +5 -5
  61. data/lib/rubocop/cop/lint/empty_expression.rb +2 -2
  62. data/lib/rubocop/cop/lint/empty_interpolation.rb +5 -6
  63. data/lib/rubocop/cop/lint/empty_when.rb +2 -2
  64. data/lib/rubocop/cop/lint/ensure_return.rb +27 -29
  65. data/lib/rubocop/cop/lint/erb_new_arguments.rb +11 -10
  66. data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
  67. data/lib/rubocop/cop/lint/float_comparison.rb +93 -0
  68. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  69. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +5 -4
  70. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +13 -14
  71. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +2 -2
  72. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +8 -8
  73. data/lib/rubocop/cop/lint/inherit_exception.rb +12 -7
  74. data/lib/rubocop/cop/lint/interpolation_check.rb +18 -15
  75. data/lib/rubocop/cop/lint/literal_as_condition.rb +4 -2
  76. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +7 -7
  77. data/lib/rubocop/cop/lint/loop.rb +23 -2
  78. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +6 -5
  79. data/lib/rubocop/cop/lint/missing_super.rb +99 -0
  80. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
  81. data/lib/rubocop/cop/lint/multiple_comparison.rb +6 -9
  82. data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -1
  83. data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
  84. data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
  85. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +27 -23
  86. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +2 -2
  87. data/lib/rubocop/cop/lint/number_conversion.rb +6 -9
  88. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +11 -13
  89. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +61 -0
  90. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +4 -10
  91. data/lib/rubocop/cop/lint/percent_string_array.rb +13 -12
  92. data/lib/rubocop/cop/lint/percent_symbol_array.rb +13 -12
  93. data/lib/rubocop/cop/lint/raise_exception.rb +12 -10
  94. data/lib/rubocop/cop/lint/rand_one.rb +2 -2
  95. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +2 -2
  96. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +7 -11
  97. data/lib/rubocop/cop/lint/redundant_require_statement.rb +4 -7
  98. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +13 -9
  99. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +6 -13
  100. data/lib/rubocop/cop/lint/redundant_with_index.rb +11 -14
  101. data/lib/rubocop/cop/lint/redundant_with_object.rb +11 -14
  102. data/lib/rubocop/cop/lint/regexp_as_condition.rb +4 -6
  103. data/lib/rubocop/cop/lint/require_parentheses.rb +2 -2
  104. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  105. data/lib/rubocop/cop/lint/rescue_type.rb +8 -8
  106. data/lib/rubocop/cop/lint/return_in_void_context.rb +2 -4
  107. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +3 -6
  108. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +14 -10
  109. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +7 -7
  110. data/lib/rubocop/cop/lint/script_permission.rb +10 -7
  111. data/lib/rubocop/cop/lint/self_assignment.rb +78 -0
  112. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +5 -11
  113. data/lib/rubocop/cop/lint/shadowed_argument.rb +3 -3
  114. data/lib/rubocop/cop/lint/shadowed_exception.rb +2 -2
  115. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +3 -3
  116. data/lib/rubocop/cop/lint/struct_new_override.rb +1 -1
  117. data/lib/rubocop/cop/lint/suppressed_exception.rb +4 -7
  118. data/lib/rubocop/cop/lint/to_json.rb +4 -6
  119. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +34 -0
  120. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +4 -4
  121. data/lib/rubocop/cop/lint/unified_integer.rb +4 -6
  122. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  123. data/lib/rubocop/cop/lint/unreachable_loop.rb +174 -0
  124. data/lib/rubocop/cop/lint/unused_block_argument.rb +8 -3
  125. data/lib/rubocop/cop/lint/unused_method_argument.rb +8 -3
  126. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
  127. data/lib/rubocop/cop/lint/uri_regexp.rb +11 -31
  128. data/lib/rubocop/cop/lint/useless_access_modifier.rb +25 -15
  129. data/lib/rubocop/cop/lint/useless_assignment.rb +4 -4
  130. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +6 -15
  131. data/lib/rubocop/cop/lint/useless_setter_call.rb +4 -6
  132. data/lib/rubocop/cop/lint/void.rb +3 -7
  133. data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
  134. data/lib/rubocop/cop/metrics/block_length.rb +2 -2
  135. data/lib/rubocop/cop/metrics/block_nesting.rb +2 -2
  136. data/lib/rubocop/cop/metrics/class_length.rb +2 -2
  137. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +2 -1
  138. data/lib/rubocop/cop/metrics/method_length.rb +2 -2
  139. data/lib/rubocop/cop/metrics/module_length.rb +2 -2
  140. data/lib/rubocop/cop/metrics/parameter_lists.rb +2 -6
  141. data/lib/rubocop/cop/metrics/perceived_complexity.rb +7 -8
  142. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +48 -5
  143. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +52 -24
  144. data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +37 -0
  145. data/lib/rubocop/cop/migration/department_name.rb +13 -15
  146. data/lib/rubocop/cop/mixin/array_min_size.rb +1 -1
  147. data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
  148. data/lib/rubocop/cop/mixin/code_length.rb +22 -5
  149. data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -0
  150. data/lib/rubocop/cop/mixin/method_complexity.rb +10 -2
  151. data/lib/rubocop/cop/mixin/statement_modifier.rb +35 -6
  152. data/lib/rubocop/cop/mixin/surrounding_space.rb +0 -25
  153. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +6 -13
  154. data/lib/rubocop/cop/mixin/unused_argument.rb +4 -6
  155. data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -2
  156. data/lib/rubocop/cop/naming/ascii_identifiers.rb +3 -3
  157. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  158. data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
  159. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +2 -2
  160. data/lib/rubocop/cop/naming/constant_name.rb +2 -2
  161. data/lib/rubocop/cop/naming/file_name.rb +3 -3
  162. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +2 -2
  163. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +2 -2
  164. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +2 -2
  165. data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
  166. data/lib/rubocop/cop/naming/predicate_name.rb +3 -5
  167. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +12 -11
  168. data/lib/rubocop/cop/registry.rb +3 -3
  169. data/lib/rubocop/cop/security/eval.rb +2 -2
  170. data/lib/rubocop/cop/security/json_load.rb +6 -8
  171. data/lib/rubocop/cop/security/marshal_load.rb +2 -4
  172. data/lib/rubocop/cop/security/open.rb +2 -2
  173. data/lib/rubocop/cop/security/yaml_load.rb +6 -6
  174. data/lib/rubocop/cop/style/access_modifier_declarations.rb +11 -1
  175. data/lib/rubocop/cop/style/accessor_grouping.rb +9 -7
  176. data/lib/rubocop/cop/style/alias.rb +7 -3
  177. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +0 -2
  178. data/lib/rubocop/cop/style/case_equality.rb +22 -3
  179. data/lib/rubocop/cop/style/case_like_if.rb +2 -2
  180. data/lib/rubocop/cop/style/colon_method_call.rb +3 -3
  181. data/lib/rubocop/cop/style/conditional_assignment.rb +11 -2
  182. data/lib/rubocop/cop/style/documentation.rb +4 -4
  183. data/lib/rubocop/cop/style/each_with_object.rb +0 -2
  184. data/lib/rubocop/cop/style/empty_method.rb +5 -5
  185. data/lib/rubocop/cop/style/eval_with_location.rb +4 -0
  186. data/lib/rubocop/cop/style/expand_path_arguments.rb +4 -0
  187. data/lib/rubocop/cop/style/explicit_block_argument.rb +102 -0
  188. data/lib/rubocop/cop/style/format_string.rb +4 -0
  189. data/lib/rubocop/cop/style/format_string_token.rb +1 -0
  190. data/lib/rubocop/cop/style/global_std_stream.rb +65 -0
  191. data/lib/rubocop/cop/style/guard_clause.rb +2 -2
  192. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +8 -1
  193. data/lib/rubocop/cop/style/hash_syntax.rb +6 -3
  194. data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
  195. data/lib/rubocop/cop/style/if_inside_else.rb +1 -1
  196. data/lib/rubocop/cop/style/if_unless_modifier.rb +0 -20
  197. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  198. data/lib/rubocop/cop/style/inverse_methods.rb +2 -3
  199. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +5 -0
  200. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +1 -1
  201. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +9 -2
  202. data/lib/rubocop/cop/style/multiline_memoization.rb +2 -2
  203. data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
  204. data/lib/rubocop/cop/style/numeric_predicate.rb +4 -0
  205. data/lib/rubocop/cop/style/optional_boolean_parameter.rb +42 -0
  206. data/lib/rubocop/cop/style/parallel_assignment.rb +2 -2
  207. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +2 -2
  208. data/lib/rubocop/cop/style/random_with_offset.rb +1 -0
  209. data/lib/rubocop/cop/style/redundant_condition.rb +15 -3
  210. data/lib/rubocop/cop/style/redundant_exception.rb +4 -0
  211. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +9 -9
  212. data/lib/rubocop/cop/style/redundant_sort.rb +25 -10
  213. data/lib/rubocop/cop/style/signal_exception.rb +2 -0
  214. data/lib/rubocop/cop/style/single_argument_dig.rb +54 -0
  215. data/lib/rubocop/cop/style/string_concatenation.rb +92 -0
  216. data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
  217. data/lib/rubocop/cop/style/symbol_array.rb +1 -1
  218. data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
  219. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +1 -1
  220. data/lib/rubocop/cop/style/zero_length_predicate.rb +10 -6
  221. data/lib/rubocop/cop/team.rb +1 -1
  222. data/lib/rubocop/cop/tokens_util.rb +84 -0
  223. data/lib/rubocop/cop/util.rb +1 -13
  224. data/lib/rubocop/cop/variable_force.rb +0 -2
  225. data/lib/rubocop/cop/variable_force/branch.rb +1 -0
  226. data/lib/rubocop/cop/variable_force/variable.rb +2 -2
  227. data/lib/rubocop/cops_documentation_generator.rb +282 -0
  228. data/lib/rubocop/error.rb +1 -0
  229. data/lib/rubocop/formatter/formatter_set.rb +1 -0
  230. data/lib/rubocop/path_util.rb +19 -4
  231. data/lib/rubocop/rake_task.rb +1 -0
  232. data/lib/rubocop/rspec/expect_offense.rb +1 -1
  233. data/lib/rubocop/target_finder.rb +12 -9
  234. data/lib/rubocop/version.rb +2 -2
  235. metadata +19 -6
  236. data/lib/rubocop/cop/lint/useless_comparison.rb +0 -28
  237. data/lib/rubocop/cop/mixin/parser_diagnostic.rb +0 -37
  238. data/lib/rubocop/cop/mixin/too_many_lines.rb +0 -25
  239. data/lib/rubocop/cop/style/method_missing_super.rb +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f95eb2bcf68a27cd9069d1e7cf4fa1b9f4eb499649ccb8c60dcc7327b8bad6b1
4
- data.tar.gz: 693a6483669b3c11ba0c181b5c1d502c937f34ea73b44710062f9a2a58b34c09
3
+ metadata.gz: 220e683b0838a3b02076023d5a65ff57267b1eff2c250bb8fa65d03db9ff09ec
4
+ data.tar.gz: 8fd50157ec4a8a007ab30cfb5ea34dd9b30bf4d6fa8c3d475268f73e2937bd99
5
5
  SHA512:
6
- metadata.gz: a49ca9e1823323f4478552d8217eb924d42e451b909169893e74ce3164c4438a6fce3d2222b1cfc08dc8f88131eae488dee6a98865887e561a8f298a3456dc07
7
- data.tar.gz: 516d28b2f1d612e9e5a0abfd364ecab6940ef68ec0c2e755b170c43e1961621041b6346478fb59f044494e9d5c9300bfa1307bd580968468586b755b40fc161e
6
+ metadata.gz: fb33582bad5b4b07308a11670c8fc173db0261e384160727057e8714f2dfb24d552663e0e14a5be1ad537bc269919e0182b2a1ca63f6ee13f471a422cae98fff
7
+ data.tar.gz: 214a09139a2a0c85438e2724d289e3fb5e8e1b4d81e6a42231143803842423795867c9da4e0347df1b26e5dfaeaf108d347a1e4758a8604484e370a3e1343a74
data/README.md CHANGED
@@ -49,7 +49,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
49
49
  might want to use a conservative version lock in your `Gemfile`:
50
50
 
51
51
  ```rb
52
- gem 'rubocop', '~> 0.88.0', require: false
52
+ gem 'rubocop', '~> 0.89.0', require: false
53
53
  ```
54
54
 
55
55
  ## Quickstart
@@ -7,6 +7,7 @@ if ARGV.include?('-h') || ARGV.include?('--help')
7
7
  exit(0)
8
8
  end
9
9
  with_mem = ARGV.delete('--memory')
10
+ ARGV.unshift '--cache', 'false' unless ARGV.include?('--cache')
10
11
 
11
12
  require 'stackprof'
12
13
  if with_mem
@@ -210,9 +210,10 @@ Gemspec/OrderedDependencies:
210
210
  - '**/*.gemspec'
211
211
 
212
212
  Gemspec/RequiredRubyVersion:
213
- Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
213
+ Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
214
214
  Enabled: true
215
215
  VersionAdded: '0.52'
216
+ VersionChanged: '0.89'
216
217
  Include:
217
218
  - '**/*.gemspec'
218
219
 
@@ -1234,7 +1235,7 @@ Layout/SpaceInsideBlockBraces:
1234
1235
 
1235
1236
  Layout/SpaceInsideHashLiteralBraces:
1236
1237
  Description: "Use spaces inside hash literal braces - or don't."
1237
- StyleGuide: '#spaces-operators'
1238
+ StyleGuide: '#spaces-braces'
1238
1239
  Enabled: true
1239
1240
  VersionAdded: '0.49'
1240
1241
  EnforcedStyle: space
@@ -1355,6 +1356,12 @@ Lint/BigDecimalNew:
1355
1356
  Enabled: true
1356
1357
  VersionAdded: '0.53'
1357
1358
 
1359
+ Lint/BinaryOperatorWithIdenticalOperands:
1360
+ Description: 'This cop checks for places where binary operator has identical operands.'
1361
+ Enabled: pending
1362
+ Safe: false
1363
+ VersionAdded: '0.89'
1364
+
1358
1365
  Lint/BooleanSymbol:
1359
1366
  Description: 'Check for `:true` and `:false` symbols.'
1360
1367
  Enabled: true
@@ -1420,6 +1427,11 @@ Lint/DuplicateMethods:
1420
1427
  Enabled: true
1421
1428
  VersionAdded: '0.29'
1422
1429
 
1430
+ Lint/DuplicateRescueException:
1431
+ Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1432
+ Enabled: pending
1433
+ VersionAdded: '0.89'
1434
+
1423
1435
  Lint/EachWithObjectArgument:
1424
1436
  Description: 'Check for immutable argument given to each_with_object.'
1425
1437
  Enabled: true
@@ -1430,6 +1442,12 @@ Lint/ElseLayout:
1430
1442
  Enabled: true
1431
1443
  VersionAdded: '0.17'
1432
1444
 
1445
+ Lint/EmptyConditionalBody:
1446
+ Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1447
+ Enabled: 'pending'
1448
+ AllowComments: true
1449
+ VersionAdded: '0.89'
1450
+
1433
1451
  Lint/EmptyEnsure:
1434
1452
  Description: 'Checks for empty ensure block.'
1435
1453
  Enabled: true
@@ -1473,6 +1491,12 @@ Lint/FlipFlop:
1473
1491
  Enabled: true
1474
1492
  VersionAdded: '0.16'
1475
1493
 
1494
+ Lint/FloatComparison:
1495
+ Description: 'Checks for the presence of precise comparison of floating point numbers.'
1496
+ StyleGuide: '#float-comparison'
1497
+ Enabled: pending
1498
+ VersionAdded: '0.89'
1499
+
1476
1500
  Lint/FloatOutOfRange:
1477
1501
  Description: >-
1478
1502
  Catches floating-point literals too large or small for Ruby to
@@ -1520,7 +1544,7 @@ Lint/InheritException:
1520
1544
  Lint/InterpolationCheck:
1521
1545
  Description: 'Raise warning for interpolation in single q strs.'
1522
1546
  Enabled: true
1523
- SafeAutoCorrect: false
1547
+ Safe: false
1524
1548
  VersionAdded: '0.50'
1525
1549
  VersionChanged: '0.87'
1526
1550
 
@@ -1542,6 +1566,7 @@ Lint/Loop:
1542
1566
  StyleGuide: '#loop-with-break'
1543
1567
  Enabled: true
1544
1568
  VersionAdded: '0.9'
1569
+ VersionChanged: '0.89'
1545
1570
 
1546
1571
  Lint/MissingCopEnableDirective:
1547
1572
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
@@ -1556,6 +1581,13 @@ Lint/MissingCopEnableDirective:
1556
1581
  # .inf for any size
1557
1582
  MaximumRangeSize: .inf
1558
1583
 
1584
+ Lint/MissingSuper:
1585
+ Description: >-
1586
+ This cop checks for the presence of constructors and lifecycle callbacks
1587
+ without calls to `super`'.
1588
+ Enabled: pending
1589
+ VersionAdded: '0.89'
1590
+
1559
1591
  Lint/MixedRegexpCaptureTypes:
1560
1592
  Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1561
1593
  Enabled: pending
@@ -1608,6 +1640,12 @@ Lint/OrderedMagicComments:
1608
1640
  Enabled: true
1609
1641
  VersionAdded: '0.53'
1610
1642
 
1643
+ Lint/OutOfRangeRegexpRef:
1644
+ Description: 'Checks for out of range reference for Regexp because it always returns nil.'
1645
+ Enabled: pending
1646
+ Safe: false
1647
+ VersionAdded: '0.89'
1648
+
1611
1649
  Lint/ParenthesesAsGroupedExpression:
1612
1650
  Description: >-
1613
1651
  Checks for method calls with a space before the opening
@@ -1758,6 +1796,11 @@ Lint/ScriptPermission:
1758
1796
  VersionAdded: '0.49'
1759
1797
  VersionChanged: '0.50'
1760
1798
 
1799
+ Lint/SelfAssignment:
1800
+ Description: 'Checks for self-assignments.'
1801
+ Enabled: pending
1802
+ VersionAdded: '0.89'
1803
+
1761
1804
  Lint/SendWithMixinArgument:
1762
1805
  Description: 'Checks for `send` method when using mixin.'
1763
1806
  Enabled: true
@@ -1808,6 +1851,11 @@ Lint/ToJSON:
1808
1851
  Enabled: true
1809
1852
  VersionAdded: '0.66'
1810
1853
 
1854
+ Lint/TopLevelReturnWithArgument:
1855
+ Description: 'This cop detects top level return statements with argument.'
1856
+ Enabled: 'pending'
1857
+ VersionAdded: '0.89'
1858
+
1811
1859
  Lint/UnderscorePrefixedVariableName:
1812
1860
  Description: 'Do not use prefix `_` for a variable that is used.'
1813
1861
  Enabled: true
@@ -1824,6 +1872,11 @@ Lint/UnreachableCode:
1824
1872
  Enabled: true
1825
1873
  VersionAdded: '0.9'
1826
1874
 
1875
+ Lint/UnreachableLoop:
1876
+ Description: 'This cop checks for loops that will have at most one iteration.'
1877
+ Enabled: pending
1878
+ VersionAdded: '0.89'
1879
+
1827
1880
  Lint/UnusedBlockArgument:
1828
1881
  Description: 'Checks for unused block arguments.'
1829
1882
  StyleGuide: '#underscore-unused-vars'
@@ -1873,11 +1926,6 @@ Lint/UselessAssignment:
1873
1926
  Enabled: true
1874
1927
  VersionAdded: '0.11'
1875
1928
 
1876
- Lint/UselessComparison:
1877
- Description: 'Checks for comparison of something with itself.'
1878
- Enabled: true
1879
- VersionAdded: '0.11'
1880
-
1881
1929
  Lint/UselessElseWithoutRescue:
1882
1930
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1883
1931
  Enabled: true
@@ -1911,7 +1959,7 @@ Metrics/AbcSize:
1911
1959
  # The ABC size is a calculated magnitude, so this number can be an Integer or
1912
1960
  # a Float.
1913
1961
  IgnoredMethods: []
1914
- Max: 15
1962
+ Max: 17
1915
1963
 
1916
1964
  Metrics/BlockLength:
1917
1965
  Description: 'Avoid long blocks with many lines.'
@@ -1993,7 +2041,7 @@ Metrics/PerceivedComplexity:
1993
2041
  VersionAdded: '0.25'
1994
2042
  VersionChanged: '0.81'
1995
2043
  IgnoredMethods: []
1996
- Max: 7
2044
+ Max: 8
1997
2045
 
1998
2046
  ################## Migration #############################
1999
2047
 
@@ -2352,6 +2400,7 @@ Style/ArrayCoercion:
2352
2400
  Use Array() instead of explicit Array check or [*var], when dealing
2353
2401
  with a variable you want to treat as an Array, but you're not certain it's an array.
2354
2402
  StyleGuide: '#array-coercion'
2403
+ Safe: false
2355
2404
  Enabled: 'pending'
2356
2405
  VersionAdded: '0.88'
2357
2406
 
@@ -2527,6 +2576,7 @@ Style/CaseEquality:
2527
2576
  StyleGuide: '#no-case-equality'
2528
2577
  Enabled: true
2529
2578
  VersionAdded: '0.9'
2579
+ VersionChanged: '0.89'
2530
2580
  # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
2531
2581
  # the case equality operator is a constant.
2532
2582
  #
@@ -2880,6 +2930,16 @@ Style/ExpandPathArguments:
2880
2930
  Enabled: true
2881
2931
  VersionAdded: '0.53'
2882
2932
 
2933
+ Style/ExplicitBlockArgument:
2934
+ Description: >-
2935
+ Consider using explicit block argument to avoid writing block literal
2936
+ that just passes its arguments to another block.
2937
+ StyleGuide: '#block-argument'
2938
+ Enabled: pending
2939
+ # May change the yielding arity.
2940
+ Safe: false
2941
+ VersionAdded: '0.89'
2942
+
2883
2943
  Style/ExponentialNotation:
2884
2944
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
2885
2945
  StyleGuide: '#exponential-notation'
@@ -2963,6 +3023,12 @@ Style/FrozenStringLiteralComment:
2963
3023
  - never
2964
3024
  Safe: false
2965
3025
 
3026
+ Style/GlobalStdStream:
3027
+ Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
3028
+ StyleGuide: '#global-stdout'
3029
+ Enabled: pending
3030
+ VersionAdded: '0.89'
3031
+
2966
3032
  Style/GlobalVars:
2967
3033
  Description: 'Do not introduce global variables.'
2968
3034
  StyleGuide: '#instance-vars'
@@ -3218,12 +3284,6 @@ Style/MethodDefParentheses:
3218
3284
  - require_no_parentheses
3219
3285
  - require_no_parentheses_except_multiline
3220
3286
 
3221
- Style/MethodMissingSuper:
3222
- Description: Checks for `method_missing` to call `super`.
3223
- StyleGuide: '#no-method-missing'
3224
- Enabled: true
3225
- VersionAdded: '0.56'
3226
-
3227
3287
  Style/MinMax:
3228
3288
  Description: >-
3229
3289
  Use `Enumerable#minmax` instead of `Enumerable#min`
@@ -3565,6 +3625,13 @@ Style/OptionalArguments:
3565
3625
  VersionAdded: '0.33'
3566
3626
  VersionChanged: '0.83'
3567
3627
 
3628
+ Style/OptionalBooleanParameter:
3629
+ Description: 'Use keyword arguments when defining method with boolean argument.'
3630
+ StyleGuide: '#boolean-keyword-arguments'
3631
+ Enabled: pending
3632
+ Safe: false
3633
+ VersionAdded: '0.89'
3634
+
3568
3635
  Style/OrAssignment:
3569
3636
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
3570
3637
  StyleGuide: '#double-pipe-for-uninit'
@@ -3883,6 +3950,12 @@ Style/SignalException:
3883
3950
  - only_fail
3884
3951
  - semantic
3885
3952
 
3953
+ Style/SingleArgumentDig:
3954
+ Description: 'Avoid using single argument dig method.'
3955
+ Enabled: pending
3956
+ VersionAdded: '0.89'
3957
+ Safe: false
3958
+
3886
3959
  Style/SingleLineBlockParams:
3887
3960
  Description: 'Enforces the names of some block params.'
3888
3961
  Enabled: false
@@ -3938,6 +4011,13 @@ Style/StderrPuts:
3938
4011
  Enabled: true
3939
4012
  VersionAdded: '0.51'
3940
4013
 
4014
+ Style/StringConcatenation:
4015
+ Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4016
+ StyleGuide: '#string-interpolation'
4017
+ Enabled: pending
4018
+ Safe: false
4019
+ VersionAdded: '0.89'
4020
+
3941
4021
  Style/StringHashKeys:
3942
4022
  Description: 'Prefer symbols instead of strings as hash keys.'
3943
4023
  StyleGuide: '#symbols-as-keys'
@@ -23,6 +23,7 @@ require_relative 'rubocop/string_interpreter'
23
23
  require_relative 'rubocop/error'
24
24
  require_relative 'rubocop/warning'
25
25
 
26
+ require_relative 'rubocop/cop/tokens_util'
26
27
  require_relative 'rubocop/cop/util'
27
28
  require_relative 'rubocop/cop/offense'
28
29
  require_relative 'rubocop/cop/message_annotator'
@@ -81,6 +82,7 @@ require_relative 'rubocop/cop/mixin/integer_node'
81
82
  require_relative 'rubocop/cop/mixin/interpolation'
82
83
  require_relative 'rubocop/cop/mixin/line_length_help'
83
84
  require_relative 'rubocop/cop/mixin/match_range'
85
+ require_relative 'rubocop/cop/metrics/utils/repeated_csend_discount'
84
86
  require_relative 'rubocop/cop/mixin/method_complexity'
85
87
  require_relative 'rubocop/cop/mixin/method_preference'
86
88
  require_relative 'rubocop/cop/mixin/min_body_length'
@@ -94,7 +96,6 @@ require_relative 'rubocop/cop/mixin/nil_methods'
94
96
  require_relative 'rubocop/cop/mixin/on_normal_if_unless'
95
97
  require_relative 'rubocop/cop/mixin/ordered_gem_node'
96
98
  require_relative 'rubocop/cop/mixin/parentheses'
97
- require_relative 'rubocop/cop/mixin/parser_diagnostic'
98
99
  require_relative 'rubocop/cop/mixin/percent_array'
99
100
  require_relative 'rubocop/cop/mixin/percent_literal'
100
101
  require_relative 'rubocop/cop/mixin/preceding_following_alignment'
@@ -110,7 +111,6 @@ require_relative 'rubocop/cop/mixin/statement_modifier'
110
111
  require_relative 'rubocop/cop/mixin/string_help'
111
112
  require_relative 'rubocop/cop/mixin/string_literals_help'
112
113
  require_relative 'rubocop/cop/mixin/target_ruby_version'
113
- require_relative 'rubocop/cop/mixin/too_many_lines'
114
114
  require_relative 'rubocop/cop/mixin/trailing_body'
115
115
  require_relative 'rubocop/cop/mixin/trailing_comma'
116
116
  require_relative 'rubocop/cop/mixin/uncommunicative_name'
@@ -243,6 +243,7 @@ require_relative 'rubocop/cop/lint/ambiguous_operator'
243
243
  require_relative 'rubocop/cop/lint/ambiguous_regexp_literal'
244
244
  require_relative 'rubocop/cop/lint/assignment_in_condition'
245
245
  require_relative 'rubocop/cop/lint/big_decimal_new'
246
+ require_relative 'rubocop/cop/lint/binary_operator_with_identical_operands'
246
247
  require_relative 'rubocop/cop/lint/boolean_symbol'
247
248
  require_relative 'rubocop/cop/lint/circular_argument_reference'
248
249
  require_relative 'rubocop/cop/lint/constant_resolution'
@@ -254,8 +255,10 @@ require_relative 'rubocop/cop/lint/duplicate_case_condition'
254
255
  require_relative 'rubocop/cop/lint/duplicate_elsif_condition'
255
256
  require_relative 'rubocop/cop/lint/duplicate_hash_key'
256
257
  require_relative 'rubocop/cop/lint/duplicate_methods'
258
+ require_relative 'rubocop/cop/lint/duplicate_rescue_exception'
257
259
  require_relative 'rubocop/cop/lint/each_with_object_argument'
258
260
  require_relative 'rubocop/cop/lint/else_layout'
261
+ require_relative 'rubocop/cop/lint/empty_conditional_body'
259
262
  require_relative 'rubocop/cop/lint/empty_ensure'
260
263
  require_relative 'rubocop/cop/lint/empty_expression'
261
264
  require_relative 'rubocop/cop/lint/empty_interpolation'
@@ -263,6 +266,7 @@ require_relative 'rubocop/cop/lint/empty_when'
263
266
  require_relative 'rubocop/cop/lint/ensure_return'
264
267
  require_relative 'rubocop/cop/lint/erb_new_arguments'
265
268
  require_relative 'rubocop/cop/lint/flip_flop'
269
+ require_relative 'rubocop/cop/lint/float_comparison'
266
270
  require_relative 'rubocop/cop/lint/float_out_of_range'
267
271
  require_relative 'rubocop/cop/lint/format_parameter_mismatch'
268
272
  require_relative 'rubocop/cop/lint/heredoc_method_call_position'
@@ -274,6 +278,7 @@ require_relative 'rubocop/cop/lint/literal_as_condition'
274
278
  require_relative 'rubocop/cop/lint/literal_in_interpolation'
275
279
  require_relative 'rubocop/cop/lint/loop'
276
280
  require_relative 'rubocop/cop/lint/missing_cop_enable_directive'
281
+ require_relative 'rubocop/cop/lint/missing_super'
277
282
  require_relative 'rubocop/cop/lint/mixed_regexp_capture_types'
278
283
  require_relative 'rubocop/cop/lint/multiple_comparison'
279
284
  require_relative 'rubocop/cop/lint/nested_method_definition'
@@ -283,6 +288,7 @@ require_relative 'rubocop/cop/lint/non_deterministic_require_order'
283
288
  require_relative 'rubocop/cop/lint/non_local_exit_from_iterator'
284
289
  require_relative 'rubocop/cop/lint/number_conversion'
285
290
  require_relative 'rubocop/cop/lint/ordered_magic_comments'
291
+ require_relative 'rubocop/cop/lint/out_of_range_regexp_ref'
286
292
  require_relative 'rubocop/cop/lint/parentheses_as_grouped_expression'
287
293
  require_relative 'rubocop/cop/lint/percent_string_array'
288
294
  require_relative 'rubocop/cop/lint/percent_symbol_array'
@@ -304,6 +310,7 @@ require_relative 'rubocop/cop/lint/safe_navigation_consistency'
304
310
  require_relative 'rubocop/cop/lint/safe_navigation_chain'
305
311
  require_relative 'rubocop/cop/lint/safe_navigation_with_empty'
306
312
  require_relative 'rubocop/cop/lint/script_permission'
313
+ require_relative 'rubocop/cop/lint/self_assignment'
307
314
  require_relative 'rubocop/cop/lint/send_with_mixin_argument'
308
315
  require_relative 'rubocop/cop/lint/shadowed_argument'
309
316
  require_relative 'rubocop/cop/lint/shadowed_exception'
@@ -312,16 +319,17 @@ require_relative 'rubocop/cop/lint/struct_new_override'
312
319
  require_relative 'rubocop/cop/lint/suppressed_exception'
313
320
  require_relative 'rubocop/cop/lint/syntax'
314
321
  require_relative 'rubocop/cop/lint/to_json'
322
+ require_relative 'rubocop/cop/lint/top_level_return_with_argument'
315
323
  require_relative 'rubocop/cop/lint/underscore_prefixed_variable_name'
316
324
  require_relative 'rubocop/cop/lint/unified_integer'
317
325
  require_relative 'rubocop/cop/lint/unreachable_code'
326
+ require_relative 'rubocop/cop/lint/unreachable_loop'
318
327
  require_relative 'rubocop/cop/lint/unused_block_argument'
319
328
  require_relative 'rubocop/cop/lint/unused_method_argument'
320
329
  require_relative 'rubocop/cop/lint/uri_escape_unescape'
321
330
  require_relative 'rubocop/cop/lint/uri_regexp'
322
331
  require_relative 'rubocop/cop/lint/useless_access_modifier'
323
332
  require_relative 'rubocop/cop/lint/useless_assignment'
324
- require_relative 'rubocop/cop/lint/useless_comparison'
325
333
  require_relative 'rubocop/cop/lint/useless_else_without_rescue'
326
334
  require_relative 'rubocop/cop/lint/useless_setter_call'
327
335
  require_relative 'rubocop/cop/lint/void'
@@ -408,12 +416,14 @@ require_relative 'rubocop/cop/style/end_block'
408
416
  require_relative 'rubocop/cop/style/eval_with_location'
409
417
  require_relative 'rubocop/cop/style/even_odd'
410
418
  require_relative 'rubocop/cop/style/expand_path_arguments'
419
+ require_relative 'rubocop/cop/style/explicit_block_argument'
411
420
  require_relative 'rubocop/cop/style/exponential_notation'
412
421
  require_relative 'rubocop/cop/style/float_division'
413
422
  require_relative 'rubocop/cop/style/for'
414
423
  require_relative 'rubocop/cop/style/format_string'
415
424
  require_relative 'rubocop/cop/style/format_string_token'
416
425
  require_relative 'rubocop/cop/style/frozen_string_literal_comment'
426
+ require_relative 'rubocop/cop/style/global_std_stream'
417
427
  require_relative 'rubocop/cop/style/global_vars'
418
428
  require_relative 'rubocop/cop/style/guard_clause'
419
429
  require_relative 'rubocop/cop/style/hash_as_last_array_item'
@@ -444,7 +454,6 @@ require_relative 'rubocop/cop/style/method_call_with_args_parentheses/omit_paren
444
454
  require_relative 'rubocop/cop/style/method_call_with_args_parentheses/require_parentheses'
445
455
  require_relative 'rubocop/cop/style/method_called_on_do_end_block'
446
456
  require_relative 'rubocop/cop/style/method_def_parentheses'
447
- require_relative 'rubocop/cop/style/method_missing_super'
448
457
  require_relative 'rubocop/cop/style/min_max'
449
458
  require_relative 'rubocop/cop/style/missing_else'
450
459
  require_relative 'rubocop/cop/style/missing_respond_to_missing'
@@ -477,6 +486,7 @@ require_relative 'rubocop/cop/style/one_line_conditional'
477
486
  require_relative 'rubocop/cop/style/or_assignment'
478
487
  require_relative 'rubocop/cop/style/option_hash'
479
488
  require_relative 'rubocop/cop/style/optional_arguments'
489
+ require_relative 'rubocop/cop/style/optional_boolean_parameter'
480
490
  require_relative 'rubocop/cop/style/parallel_assignment'
481
491
  require_relative 'rubocop/cop/style/parentheses_around_condition'
482
492
  require_relative 'rubocop/cop/style/percent_literal_delimiters'
@@ -511,12 +521,14 @@ require_relative 'rubocop/cop/style/self_assignment'
511
521
  require_relative 'rubocop/cop/style/semicolon'
512
522
  require_relative 'rubocop/cop/style/send'
513
523
  require_relative 'rubocop/cop/style/signal_exception'
524
+ require_relative 'rubocop/cop/style/single_argument_dig'
514
525
  require_relative 'rubocop/cop/style/single_line_block_params'
515
526
  require_relative 'rubocop/cop/style/single_line_methods'
516
527
  require_relative 'rubocop/cop/style/slicing_with_range'
517
528
  require_relative 'rubocop/cop/style/special_global_vars'
518
529
  require_relative 'rubocop/cop/style/stabby_lambda_parentheses'
519
530
  require_relative 'rubocop/cop/style/stderr_puts'
531
+ require_relative 'rubocop/cop/style/string_concatenation'
520
532
  require_relative 'rubocop/cop/style/string_hash_keys'
521
533
  require_relative 'rubocop/cop/style/string_literals'
522
534
  require_relative 'rubocop/cop/style/string_literals_in_interpolation'
@@ -113,7 +113,7 @@ module RuboCop
113
113
  return if files.include?(AUTO_GENERATED_FILE)
114
114
 
115
115
  files.unshift(AUTO_GENERATED_FILE)
116
- file_string = "\n - " + files.join("\n - ") if files.size > 1
116
+ file_string = "\n - #{files.join("\n - ")}" if files.size > 1
117
117
  rubocop_yml_contents = existing_configuration(config_file)
118
118
  end
119
119