rubocop 1.29.1 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (586) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -3
  3. data/config/default.yml +193 -27
  4. data/config/obsoletion.yml +25 -1
  5. data/exe/rubocop +15 -7
  6. data/lib/rubocop/arguments_env.rb +17 -0
  7. data/lib/rubocop/arguments_file.rb +17 -0
  8. data/lib/rubocop/cache_config.rb +29 -0
  9. data/lib/rubocop/cli/command/{auto_genenerate_config.rb → auto_generate_config.rb} +20 -5
  10. data/lib/rubocop/cli/command/execute_runner.rb +8 -8
  11. data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
  12. data/lib/rubocop/cli/command/show_cops.rb +1 -1
  13. data/lib/rubocop/cli/command/suggest_extensions.rb +61 -16
  14. data/lib/rubocop/cli.rb +2 -0
  15. data/lib/rubocop/comment_config.rb +36 -1
  16. data/lib/rubocop/config.rb +6 -2
  17. data/lib/rubocop/config_finder.rb +68 -0
  18. data/lib/rubocop/config_loader.rb +15 -41
  19. data/lib/rubocop/config_loader_resolver.rb +2 -6
  20. data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
  21. data/lib/rubocop/config_obsoletion/parameter_rule.rb +4 -0
  22. data/lib/rubocop/config_obsoletion.rb +7 -2
  23. data/lib/rubocop/config_validator.rb +21 -4
  24. data/lib/rubocop/cop/autocorrect_logic.rb +4 -2
  25. data/lib/rubocop/cop/base.rb +6 -2
  26. data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -1
  27. data/lib/rubocop/cop/bundler/gem_filename.rb +5 -5
  28. data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -2
  29. data/lib/rubocop/cop/commissioner.rb +3 -1
  30. data/lib/rubocop/cop/cop.rb +1 -1
  31. data/lib/rubocop/cop/corrector.rb +2 -2
  32. data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
  33. data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -1
  34. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +1 -1
  35. data/lib/rubocop/cop/correctors/empty_line_corrector.rb +1 -1
  36. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +4 -2
  37. data/lib/rubocop/cop/correctors/if_then_corrector.rb +1 -1
  38. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +1 -1
  39. data/lib/rubocop/cop/correctors/line_break_corrector.rb +7 -1
  40. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +3 -3
  41. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -1
  42. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +59 -1
  43. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
  44. data/lib/rubocop/cop/correctors/punctuation_corrector.rb +1 -1
  45. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -1
  46. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +1 -1
  47. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +2 -2
  48. data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +92 -0
  49. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -1
  50. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  51. data/lib/rubocop/cop/gemspec/require_mfa.rb +21 -21
  52. data/lib/rubocop/cop/generator/require_file_injector.rb +2 -2
  53. data/lib/rubocop/cop/generator.rb +6 -3
  54. data/lib/rubocop/cop/internal_affairs/cop_description.rb +96 -0
  55. data/lib/rubocop/cop/internal_affairs/create_empty_file.rb +37 -0
  56. data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +1 -1
  57. data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +111 -0
  58. data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +1 -1
  59. data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +1 -1
  60. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -5
  61. data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
  62. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +1 -1
  63. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +1 -1
  64. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
  65. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
  66. data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +62 -0
  67. data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +60 -0
  68. data/lib/rubocop/cop/internal_affairs.rb +6 -0
  69. data/lib/rubocop/cop/layout/argument_alignment.rb +22 -1
  70. data/lib/rubocop/cop/layout/assignment_indentation.rb +1 -1
  71. data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -1
  72. data/lib/rubocop/cop/layout/block_alignment.rb +17 -13
  73. data/lib/rubocop/cop/layout/block_end_newline.rb +36 -6
  74. data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
  75. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
  76. data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
  77. data/lib/rubocop/cop/layout/condition_position.rb +1 -1
  78. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  79. data/lib/rubocop/cop/layout/dot_position.rb +1 -1
  80. data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
  81. data/lib/rubocop/cop/layout/empty_comment.rb +2 -2
  82. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
  83. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
  84. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +1 -1
  85. data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
  86. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +5 -2
  87. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
  88. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +25 -4
  89. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
  90. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +7 -5
  91. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +10 -10
  92. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +1 -1
  93. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
  94. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +10 -10
  95. data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
  96. data/lib/rubocop/cop/layout/end_of_line.rb +5 -5
  97. data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
  98. data/lib/rubocop/cop/layout/first_argument_indentation.rb +35 -29
  99. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +21 -14
  100. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
  101. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +52 -13
  102. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
  103. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
  104. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +1 -1
  105. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +1 -1
  106. data/lib/rubocop/cop/layout/hash_alignment.rb +2 -0
  107. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
  108. data/lib/rubocop/cop/layout/heredoc_indentation.rb +1 -1
  109. data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
  110. data/lib/rubocop/cop/layout/indentation_style.rb +2 -2
  111. data/lib/rubocop/cop/layout/indentation_width.rb +14 -7
  112. data/lib/rubocop/cop/layout/initial_indentation.rb +2 -2
  113. data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
  114. data/lib/rubocop/cop/layout/leading_empty_lines.rb +1 -1
  115. data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +133 -0
  116. data/lib/rubocop/cop/layout/line_continuation_spacing.rb +130 -0
  117. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +1 -1
  118. data/lib/rubocop/cop/layout/line_length.rb +7 -2
  119. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
  120. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +1 -1
  121. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +2 -2
  122. data/lib/rubocop/cop/layout/multiline_block_layout.rb +4 -2
  123. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +1 -1
  124. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
  125. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +5 -2
  126. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
  127. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +3 -3
  128. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
  129. data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +45 -0
  130. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +3 -3
  131. data/lib/rubocop/cop/layout/redundant_line_break.rb +2 -2
  132. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +1 -1
  133. data/lib/rubocop/cop/layout/single_line_block_chain.rb +1 -1
  134. data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
  135. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +2 -2
  136. data/lib/rubocop/cop/layout/space_around_keyword.rb +1 -1
  137. data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
  138. data/lib/rubocop/cop/layout/space_before_block_braces.rb +5 -3
  139. data/lib/rubocop/cop/layout/space_before_comment.rb +1 -1
  140. data/lib/rubocop/cop/layout/space_before_first_arg.rb +1 -1
  141. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +1 -1
  142. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +23 -19
  143. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -0
  144. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +33 -15
  145. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +30 -3
  146. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +34 -0
  147. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +6 -2
  148. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +1 -1
  149. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +8 -8
  150. data/lib/rubocop/cop/layout/trailing_whitespace.rb +2 -2
  151. data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
  152. data/lib/rubocop/cop/legacy/corrector.rb +1 -1
  153. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -1
  154. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +27 -7
  155. data/lib/rubocop/cop/lint/ambiguous_operator.rb +1 -1
  156. data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +1 -1
  157. data/lib/rubocop/cop/lint/ambiguous_range.rb +3 -3
  158. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +1 -1
  159. data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -1
  160. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +1 -1
  161. data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
  162. data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
  163. data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +51 -0
  164. data/lib/rubocop/cop/lint/debugger.rb +27 -17
  165. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +15 -9
  166. data/lib/rubocop/cop/lint/deprecated_constants.rb +1 -1
  167. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +1 -1
  168. data/lib/rubocop/cop/lint/duplicate_branch.rb +1 -1
  169. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
  170. data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +1 -1
  171. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +1 -1
  172. data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
  173. data/lib/rubocop/cop/lint/duplicate_methods.rb +29 -10
  174. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +26 -7
  175. data/lib/rubocop/cop/lint/duplicate_require.rb +1 -1
  176. data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +1 -1
  177. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  178. data/lib/rubocop/cop/lint/else_layout.rb +3 -3
  179. data/lib/rubocop/cop/lint/empty_block.rb +2 -2
  180. data/lib/rubocop/cop/lint/empty_class.rb +4 -2
  181. data/lib/rubocop/cop/lint/empty_conditional_body.rb +108 -2
  182. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
  183. data/lib/rubocop/cop/lint/empty_expression.rb +1 -1
  184. data/lib/rubocop/cop/lint/empty_file.rb +1 -1
  185. data/lib/rubocop/cop/lint/empty_in_pattern.rb +1 -1
  186. data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
  187. data/lib/rubocop/cop/lint/empty_when.rb +1 -1
  188. data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
  189. data/lib/rubocop/cop/lint/erb_new_arguments.rb +9 -9
  190. data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
  191. data/lib/rubocop/cop/lint/float_comparison.rb +1 -1
  192. data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
  193. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
  194. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
  195. data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +1 -1
  196. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
  197. data/lib/rubocop/cop/lint/inherit_exception.rb +1 -1
  198. data/lib/rubocop/cop/lint/interpolation_check.rb +2 -2
  199. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +2 -2
  200. data/lib/rubocop/cop/lint/literal_as_condition.rb +6 -1
  201. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +5 -1
  202. data/lib/rubocop/cop/lint/loop.rb +1 -1
  203. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +19 -4
  204. data/lib/rubocop/cop/lint/missing_super.rb +1 -1
  205. data/lib/rubocop/cop/lint/nested_method_definition.rb +51 -2
  206. data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
  207. data/lib/rubocop/cop/lint/next_without_accumulator.rb +25 -6
  208. data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +157 -0
  209. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +12 -0
  210. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
  211. data/lib/rubocop/cop/lint/number_conversion.rb +32 -10
  212. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -1
  213. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -3
  214. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +4 -5
  215. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +1 -1
  216. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
  217. data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
  218. data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
  219. data/lib/rubocop/cop/lint/raise_exception.rb +1 -1
  220. data/lib/rubocop/cop/lint/rand_one.rb +1 -1
  221. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +29 -7
  222. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +2 -2
  223. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +7 -0
  224. data/lib/rubocop/cop/lint/redundant_require_statement.rb +38 -7
  225. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +16 -3
  226. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
  227. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -1
  228. data/lib/rubocop/cop/lint/redundant_with_index.rb +14 -11
  229. data/lib/rubocop/cop/lint/redundant_with_object.rb +13 -12
  230. data/lib/rubocop/cop/lint/refinement_import_methods.rb +1 -1
  231. data/lib/rubocop/cop/lint/regexp_as_condition.rb +3 -3
  232. data/lib/rubocop/cop/lint/require_parentheses.rb +2 -2
  233. data/lib/rubocop/cop/lint/require_range_parentheses.rb +57 -0
  234. data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
  235. data/lib/rubocop/cop/lint/return_in_void_context.rb +1 -1
  236. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +40 -2
  237. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +1 -1
  238. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  239. data/lib/rubocop/cop/lint/script_permission.rb +1 -1
  240. data/lib/rubocop/cop/lint/self_assignment.rb +1 -1
  241. data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -1
  242. data/lib/rubocop/cop/lint/shadowed_exception.rb +16 -11
  243. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +28 -4
  244. data/lib/rubocop/cop/lint/struct_new_override.rb +3 -3
  245. data/lib/rubocop/cop/lint/suppressed_exception.rb +2 -2
  246. data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
  247. data/lib/rubocop/cop/lint/syntax.rb +1 -1
  248. data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
  249. data/lib/rubocop/cop/lint/to_json.rb +1 -1
  250. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
  251. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +2 -2
  252. data/lib/rubocop/cop/lint/triple_quotes.rb +1 -1
  253. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -1
  254. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +1 -1
  255. data/lib/rubocop/cop/lint/unified_integer.rb +3 -1
  256. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  257. data/lib/rubocop/cop/lint/unreachable_loop.rb +10 -4
  258. data/lib/rubocop/cop/lint/unused_block_argument.rb +1 -1
  259. data/lib/rubocop/cop/lint/unused_method_argument.rb +5 -1
  260. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
  261. data/lib/rubocop/cop/lint/uri_regexp.rb +1 -1
  262. data/lib/rubocop/cop/lint/useless_access_modifier.rb +9 -7
  263. data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
  264. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +44 -0
  265. data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
  266. data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +2 -2
  267. data/lib/rubocop/cop/lint/useless_setter_call.rb +2 -2
  268. data/lib/rubocop/cop/lint/useless_times.rb +1 -1
  269. data/lib/rubocop/cop/lint/void.rb +3 -1
  270. data/lib/rubocop/cop/metrics/abc_size.rb +5 -3
  271. data/lib/rubocop/cop/metrics/block_length.rb +7 -7
  272. data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
  273. data/lib/rubocop/cop/metrics/class_length.rb +1 -1
  274. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
  275. data/lib/rubocop/cop/metrics/method_length.rb +9 -8
  276. data/lib/rubocop/cop/metrics/module_length.rb +1 -1
  277. data/lib/rubocop/cop/metrics/parameter_lists.rb +1 -1
  278. data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
  279. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
  280. data/lib/rubocop/cop/mixin/allowed_methods.rb +20 -1
  281. data/lib/rubocop/cop/mixin/allowed_pattern.rb +17 -1
  282. data/lib/rubocop/cop/mixin/check_line_breakable.rb +5 -1
  283. data/lib/rubocop/cop/mixin/comments_help.rb +17 -1
  284. data/lib/rubocop/cop/mixin/def_node.rb +2 -7
  285. data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -1
  286. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -0
  287. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +88 -5
  288. data/lib/rubocop/cop/mixin/hash_transform_method.rb +10 -6
  289. data/lib/rubocop/cop/mixin/method_complexity.rb +8 -13
  290. data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +34 -12
  291. data/lib/rubocop/cop/mixin/percent_array.rb +60 -1
  292. data/lib/rubocop/cop/mixin/range_help.rb +33 -7
  293. data/lib/rubocop/cop/mixin/rescue_node.rb +3 -1
  294. data/lib/rubocop/cop/mixin/string_help.rb +1 -1
  295. data/lib/rubocop/cop/mixin/surrounding_space.rb +10 -8
  296. data/lib/rubocop/cop/mixin/visibility_help.rb +40 -5
  297. data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -2
  298. data/lib/rubocop/cop/naming/ascii_identifiers.rb +1 -1
  299. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  300. data/lib/rubocop/cop/naming/block_forwarding.rb +2 -2
  301. data/lib/rubocop/cop/naming/block_parameter_name.rb +2 -2
  302. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +1 -1
  303. data/lib/rubocop/cop/naming/constant_name.rb +3 -3
  304. data/lib/rubocop/cop/naming/file_name.rb +1 -1
  305. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
  306. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
  307. data/lib/rubocop/cop/naming/inclusive_language.rb +1 -1
  308. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +1 -1
  309. data/lib/rubocop/cop/naming/method_name.rb +1 -1
  310. data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
  311. data/lib/rubocop/cop/naming/predicate_name.rb +30 -1
  312. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +1 -1
  313. data/lib/rubocop/cop/naming/variable_name.rb +1 -1
  314. data/lib/rubocop/cop/naming/variable_number.rb +18 -18
  315. data/lib/rubocop/cop/registry.rb +10 -4
  316. data/lib/rubocop/cop/security/compound_hash.rb +1 -1
  317. data/lib/rubocop/cop/security/eval.rb +1 -1
  318. data/lib/rubocop/cop/security/json_load.rb +1 -1
  319. data/lib/rubocop/cop/security/marshal_load.rb +1 -1
  320. data/lib/rubocop/cop/security/open.rb +1 -1
  321. data/lib/rubocop/cop/security/yaml_load.rb +1 -1
  322. data/lib/rubocop/cop/style/access_modifier_declarations.rb +76 -2
  323. data/lib/rubocop/cop/style/accessor_grouping.rb +11 -7
  324. data/lib/rubocop/cop/style/alias.rb +1 -1
  325. data/lib/rubocop/cop/style/and_or.rb +11 -11
  326. data/lib/rubocop/cop/style/arguments_forwarding.rb +3 -3
  327. data/lib/rubocop/cop/style/array_coercion.rb +1 -1
  328. data/lib/rubocop/cop/style/array_join.rb +1 -1
  329. data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
  330. data/lib/rubocop/cop/style/attr.rb +1 -1
  331. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +1 -1
  332. data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
  333. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +1 -1
  334. data/lib/rubocop/cop/style/block_comments.rb +1 -1
  335. data/lib/rubocop/cop/style/block_delimiters.rb +31 -10
  336. data/lib/rubocop/cop/style/case_equality.rb +41 -11
  337. data/lib/rubocop/cop/style/case_like_if.rb +1 -1
  338. data/lib/rubocop/cop/style/character_literal.rb +1 -1
  339. data/lib/rubocop/cop/style/class_and_module_children.rb +5 -5
  340. data/lib/rubocop/cop/style/class_check.rb +1 -1
  341. data/lib/rubocop/cop/style/class_equality_comparison.rb +55 -6
  342. data/lib/rubocop/cop/style/class_methods.rb +1 -1
  343. data/lib/rubocop/cop/style/class_methods_definitions.rb +3 -2
  344. data/lib/rubocop/cop/style/class_vars.rb +1 -1
  345. data/lib/rubocop/cop/style/collection_compact.rb +13 -4
  346. data/lib/rubocop/cop/style/collection_methods.rb +3 -1
  347. data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
  348. data/lib/rubocop/cop/style/colon_method_definition.rb +1 -1
  349. data/lib/rubocop/cop/style/combinable_loops.rb +4 -2
  350. data/lib/rubocop/cop/style/command_literal.rb +1 -1
  351. data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
  352. data/lib/rubocop/cop/style/commented_keyword.rb +4 -4
  353. data/lib/rubocop/cop/style/conditional_assignment.rb +2 -1
  354. data/lib/rubocop/cop/style/constant_visibility.rb +1 -1
  355. data/lib/rubocop/cop/style/date_time.rb +1 -1
  356. data/lib/rubocop/cop/style/def_with_parentheses.rb +1 -1
  357. data/lib/rubocop/cop/style/dir.rb +4 -1
  358. data/lib/rubocop/cop/style/documentation.rb +1 -1
  359. data/lib/rubocop/cop/style/documentation_method.rb +1 -1
  360. data/lib/rubocop/cop/style/double_negation.rb +3 -1
  361. data/lib/rubocop/cop/style/each_for_simple_loop.rb +42 -7
  362. data/lib/rubocop/cop/style/each_with_object.rb +40 -9
  363. data/lib/rubocop/cop/style/empty_block_parameter.rb +2 -2
  364. data/lib/rubocop/cop/style/empty_case_condition.rb +1 -1
  365. data/lib/rubocop/cop/style/empty_else.rb +40 -3
  366. data/lib/rubocop/cop/style/empty_heredoc.rb +73 -0
  367. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +2 -2
  368. data/lib/rubocop/cop/style/empty_literal.rb +1 -1
  369. data/lib/rubocop/cop/style/empty_method.rb +18 -3
  370. data/lib/rubocop/cop/style/encoding.rb +2 -2
  371. data/lib/rubocop/cop/style/end_block.rb +1 -1
  372. data/lib/rubocop/cop/style/endless_method.rb +2 -2
  373. data/lib/rubocop/cop/style/env_home.rb +1 -1
  374. data/lib/rubocop/cop/style/eval_with_location.rb +1 -1
  375. data/lib/rubocop/cop/style/even_odd.rb +1 -1
  376. data/lib/rubocop/cop/style/expand_path_arguments.rb +1 -1
  377. data/lib/rubocop/cop/style/explicit_block_argument.rb +6 -2
  378. data/lib/rubocop/cop/style/exponential_notation.rb +1 -1
  379. data/lib/rubocop/cop/style/fetch_env_var.rb +37 -224
  380. data/lib/rubocop/cop/style/float_division.rb +1 -1
  381. data/lib/rubocop/cop/style/for.rb +3 -1
  382. data/lib/rubocop/cop/style/format_string.rb +1 -1
  383. data/lib/rubocop/cop/style/format_string_token.rb +73 -23
  384. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +6 -3
  385. data/lib/rubocop/cop/style/global_std_stream.rb +1 -1
  386. data/lib/rubocop/cop/style/global_vars.rb +1 -1
  387. data/lib/rubocop/cop/style/guard_clause.rb +96 -42
  388. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +2 -1
  389. data/lib/rubocop/cop/style/hash_conversion.rb +1 -1
  390. data/lib/rubocop/cop/style/hash_each_methods.rb +36 -12
  391. data/lib/rubocop/cop/style/hash_except.rb +89 -9
  392. data/lib/rubocop/cop/style/hash_like_case.rb +1 -1
  393. data/lib/rubocop/cop/style/hash_syntax.rb +20 -3
  394. data/lib/rubocop/cop/style/hash_transform_keys.rb +6 -1
  395. data/lib/rubocop/cop/style/hash_transform_values.rb +4 -1
  396. data/lib/rubocop/cop/style/identical_conditional_branches.rb +2 -2
  397. data/lib/rubocop/cop/style/if_unless_modifier.rb +1 -1
  398. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +29 -4
  399. data/lib/rubocop/cop/style/implicit_runtime_error.rb +3 -3
  400. data/lib/rubocop/cop/style/in_pattern_then.rb +1 -1
  401. data/lib/rubocop/cop/style/inline_comment.rb +1 -1
  402. data/lib/rubocop/cop/style/inverse_methods.rb +10 -8
  403. data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
  404. data/lib/rubocop/cop/style/keyword_parameters_order.rb +2 -2
  405. data/lib/rubocop/cop/style/lambda.rb +1 -1
  406. data/lib/rubocop/cop/style/lambda_call.rb +1 -1
  407. data/lib/rubocop/cop/style/line_end_concatenation.rb +2 -2
  408. data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
  409. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +136 -0
  410. data/lib/rubocop/cop/style/map_to_hash.rb +3 -3
  411. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +17 -6
  412. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +5 -1
  413. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +8 -8
  414. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +20 -3
  415. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +5 -2
  416. data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
  417. data/lib/rubocop/cop/style/min_max.rb +1 -1
  418. data/lib/rubocop/cop/style/missing_else.rb +24 -24
  419. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +1 -1
  420. data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
  421. data/lib/rubocop/cop/style/mixin_usage.rb +1 -1
  422. data/lib/rubocop/cop/style/module_function.rb +30 -8
  423. data/lib/rubocop/cop/style/multiline_block_chain.rb +4 -2
  424. data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -2
  425. data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
  426. data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +3 -5
  427. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  428. data/lib/rubocop/cop/style/multiline_method_signature.rb +2 -2
  429. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +3 -3
  430. data/lib/rubocop/cop/style/multiline_when_then.rb +2 -4
  431. data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
  432. data/lib/rubocop/cop/style/mutable_constant.rb +1 -1
  433. data/lib/rubocop/cop/style/negated_if_else_condition.rb +8 -2
  434. data/lib/rubocop/cop/style/nested_file_dirname.rb +1 -1
  435. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  436. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +11 -2
  437. data/lib/rubocop/cop/style/nested_ternary_operator.rb +20 -8
  438. data/lib/rubocop/cop/style/next.rb +3 -5
  439. data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
  440. data/lib/rubocop/cop/style/nil_lambda.rb +3 -3
  441. data/lib/rubocop/cop/style/non_nil_check.rb +1 -1
  442. data/lib/rubocop/cop/style/not.rb +2 -2
  443. data/lib/rubocop/cop/style/numbered_parameters.rb +1 -1
  444. data/lib/rubocop/cop/style/numbered_parameters_limit.rb +1 -1
  445. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
  446. data/lib/rubocop/cop/style/numeric_literals.rb +16 -1
  447. data/lib/rubocop/cop/style/numeric_predicate.rb +53 -11
  448. data/lib/rubocop/cop/style/object_then.rb +6 -1
  449. data/lib/rubocop/cop/style/one_line_conditional.rb +1 -1
  450. data/lib/rubocop/cop/style/open_struct_use.rb +1 -1
  451. data/lib/rubocop/cop/style/operator_method_call.rb +53 -0
  452. data/lib/rubocop/cop/style/option_hash.rb +1 -1
  453. data/lib/rubocop/cop/style/optional_arguments.rb +1 -1
  454. data/lib/rubocop/cop/style/optional_boolean_parameter.rb +1 -1
  455. data/lib/rubocop/cop/style/or_assignment.rb +1 -1
  456. data/lib/rubocop/cop/style/parentheses_around_condition.rb +1 -1
  457. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
  458. data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
  459. data/lib/rubocop/cop/style/perl_backrefs.rb +23 -2
  460. data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
  461. data/lib/rubocop/cop/style/proc.rb +5 -2
  462. data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
  463. data/lib/rubocop/cop/style/raise_args.rb +1 -1
  464. data/lib/rubocop/cop/style/random_with_offset.rb +1 -1
  465. data/lib/rubocop/cop/style/redundant_argument.rb +2 -2
  466. data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
  467. data/lib/rubocop/cop/style/redundant_begin.rb +20 -6
  468. data/lib/rubocop/cop/style/redundant_capital_w.rb +1 -1
  469. data/lib/rubocop/cop/style/redundant_condition.rb +33 -11
  470. data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
  471. data/lib/rubocop/cop/style/redundant_each.rb +116 -0
  472. data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
  473. data/lib/rubocop/cop/style/redundant_fetch_block.rb +2 -2
  474. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
  475. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  476. data/lib/rubocop/cop/style/redundant_initialize.rb +3 -1
  477. data/lib/rubocop/cop/style/redundant_interpolation.rb +22 -1
  478. data/lib/rubocop/cop/style/redundant_parentheses.rb +22 -24
  479. data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
  480. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +10 -3
  481. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +13 -4
  482. data/lib/rubocop/cop/style/redundant_return.rb +2 -2
  483. data/lib/rubocop/cop/style/redundant_self.rb +3 -1
  484. data/lib/rubocop/cop/style/redundant_self_assignment.rb +2 -2
  485. data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +1 -1
  486. data/lib/rubocop/cop/style/redundant_sort.rb +22 -7
  487. data/lib/rubocop/cop/style/redundant_sort_by.rb +25 -9
  488. data/lib/rubocop/cop/style/redundant_string_escape.rb +181 -0
  489. data/lib/rubocop/cop/style/regexp_literal.rb +1 -1
  490. data/lib/rubocop/cop/style/rescue_modifier.rb +2 -2
  491. data/lib/rubocop/cop/style/rescue_standard_error.rb +13 -13
  492. data/lib/rubocop/cop/style/return_nil.rb +1 -1
  493. data/lib/rubocop/cop/style/safe_navigation.rb +8 -3
  494. data/lib/rubocop/cop/style/sample.rb +1 -1
  495. data/lib/rubocop/cop/style/select_by_regexp.rb +1 -1
  496. data/lib/rubocop/cop/style/self_assignment.rb +1 -1
  497. data/lib/rubocop/cop/style/semicolon.rb +28 -4
  498. data/lib/rubocop/cop/style/send.rb +1 -1
  499. data/lib/rubocop/cop/style/signal_exception.rb +1 -1
  500. data/lib/rubocop/cop/style/single_line_block_params.rb +2 -2
  501. data/lib/rubocop/cop/style/single_line_methods.rb +2 -2
  502. data/lib/rubocop/cop/style/slicing_with_range.rb +1 -1
  503. data/lib/rubocop/cop/style/sole_nested_conditional.rb +42 -14
  504. data/lib/rubocop/cop/style/static_class.rb +33 -2
  505. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  506. data/lib/rubocop/cop/style/string_concatenation.rb +6 -7
  507. data/lib/rubocop/cop/style/string_hash_keys.rb +1 -1
  508. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +1 -1
  509. data/lib/rubocop/cop/style/string_methods.rb +1 -1
  510. data/lib/rubocop/cop/style/strip.rb +1 -1
  511. data/lib/rubocop/cop/style/struct_inheritance.rb +4 -4
  512. data/lib/rubocop/cop/style/swap_values.rb +2 -2
  513. data/lib/rubocop/cop/style/symbol_array.rb +11 -6
  514. data/lib/rubocop/cop/style/symbol_literal.rb +1 -1
  515. data/lib/rubocop/cop/style/symbol_proc.rb +48 -14
  516. data/lib/rubocop/cop/style/ternary_parentheses.rb +2 -14
  517. data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
  518. data/lib/rubocop/cop/style/trailing_body_on_class.rb +1 -1
  519. data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +1 -1
  520. data/lib/rubocop/cop/style/trailing_body_on_module.rb +1 -1
  521. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +1 -1
  522. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +1 -1
  523. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +2 -2
  524. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +1 -1
  525. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +1 -1
  526. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -1
  527. data/lib/rubocop/cop/style/trivial_accessors.rb +4 -1
  528. data/lib/rubocop/cop/style/unless_else.rb +1 -1
  529. data/lib/rubocop/cop/style/unless_logical_operators.rb +1 -1
  530. data/lib/rubocop/cop/style/unpack_first.rb +5 -2
  531. data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
  532. data/lib/rubocop/cop/style/when_then.rb +1 -1
  533. data/lib/rubocop/cop/style/word_array.rb +6 -5
  534. data/lib/rubocop/cop/style/yoda_condition.rb +1 -1
  535. data/lib/rubocop/cop/style/zero_length_predicate.rb +1 -1
  536. data/lib/rubocop/cop/team.rb +5 -6
  537. data/lib/rubocop/cop/util.rb +4 -4
  538. data/lib/rubocop/cop/variable_force/variable_table.rb +1 -1
  539. data/lib/rubocop/cops_documentation_generator.rb +20 -2
  540. data/lib/rubocop/ext/processed_source.rb +2 -0
  541. data/lib/rubocop/ext/range.rb +15 -0
  542. data/lib/rubocop/feature_loader.rb +94 -0
  543. data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
  544. data/lib/rubocop/formatter/disabled_config_formatter.rb +19 -10
  545. data/lib/rubocop/formatter/formatter_set.rb +20 -19
  546. data/lib/rubocop/formatter/git_hub_actions_formatter.rb +15 -2
  547. data/lib/rubocop/formatter/html_formatter.rb +3 -4
  548. data/lib/rubocop/formatter/markdown_formatter.rb +3 -1
  549. data/lib/rubocop/formatter/offense_count_formatter.rb +10 -5
  550. data/lib/rubocop/formatter/simple_text_formatter.rb +9 -8
  551. data/lib/rubocop/formatter/tap_formatter.rb +1 -1
  552. data/lib/rubocop/formatter/worst_offenders_formatter.rb +6 -3
  553. data/lib/rubocop/formatter.rb +31 -0
  554. data/lib/rubocop/magic_comment.rb +27 -2
  555. data/lib/rubocop/options.rb +99 -53
  556. data/lib/rubocop/rake_task.rb +34 -9
  557. data/lib/rubocop/result_cache.rb +24 -21
  558. data/lib/rubocop/rspec/cop_helper.rb +22 -2
  559. data/lib/rubocop/rspec/expect_offense.rb +3 -3
  560. data/lib/rubocop/rspec/shared_contexts.rb +42 -9
  561. data/lib/rubocop/rspec/support.rb +14 -0
  562. data/lib/rubocop/runner.rb +28 -16
  563. data/lib/rubocop/server/cache.rb +148 -0
  564. data/lib/rubocop/server/cli.rb +128 -0
  565. data/lib/rubocop/server/client_command/base.rb +44 -0
  566. data/lib/rubocop/server/client_command/exec.rb +64 -0
  567. data/lib/rubocop/server/client_command/restart.rb +25 -0
  568. data/lib/rubocop/server/client_command/start.rb +43 -0
  569. data/lib/rubocop/server/client_command/status.rb +28 -0
  570. data/lib/rubocop/server/client_command/stop.rb +31 -0
  571. data/lib/rubocop/server/client_command.rb +26 -0
  572. data/lib/rubocop/server/core.rb +96 -0
  573. data/lib/rubocop/server/errors.rb +23 -0
  574. data/lib/rubocop/server/helper.rb +34 -0
  575. data/lib/rubocop/server/server_command/base.rb +50 -0
  576. data/lib/rubocop/server/server_command/exec.rb +34 -0
  577. data/lib/rubocop/server/server_command/stop.rb +24 -0
  578. data/lib/rubocop/server/server_command.rb +21 -0
  579. data/lib/rubocop/server/socket_reader.rb +69 -0
  580. data/lib/rubocop/server.rb +53 -0
  581. data/lib/rubocop/target_ruby.rb +7 -5
  582. data/lib/rubocop/version.rb +22 -9
  583. data/lib/rubocop.rb +22 -30
  584. metadata +68 -10
  585. data/lib/rubocop/cop/gemspec/date_assignment.rb +0 -49
  586. data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc3f8c82f30de8d481011d509c430f07627740062258586008ada7a2e301935d
4
- data.tar.gz: 4a41b97adf892a9acce8faec7325b822734c717b03a46ead788f154e0db27a41
3
+ metadata.gz: 881807be0f0f6eea20bd13bd8f08fdb158a5b155c8d3a22fd748683a68c1fef1
4
+ data.tar.gz: 2a8e7d4b02f1ba468e02a4c20f8e3b830ce2a1d8ff0210f86aaeafab597c8c88
5
5
  SHA512:
6
- metadata.gz: 7222d77b9e5dcfe8908311c2d551da58959136fa9c560afd6aac17c53b0c9abcac9d9d241e31883e35e1276e5274d8b8a33cb5f5a7b917dff27602de1e3f10fb
7
- data.tar.gz: 296507dfa80b4166a3e4960bc56c43262ca25cc32feb280d49824c335cae916c2d45bfc353ac592857c2c83aa39cd90ffe6ff568ba2d3ed2329361e0788f3b26
6
+ metadata.gz: 11ea36bec754b07912e06b5481f964d10a6dbf5bfd56f99d8a8842ca46d56ae03a342a283d843336f977760c28a697ee995aa98268254a55b1218fa57a9fb5c7
7
+ data.tar.gz: b5096cb4589d9bafdab0b6ab409ea9e7841dc06b274aeb7f7d5a26e703cb216c2a428d695fb2a087637467f1cdd5ac005398c66ee3e7d28d49cb4b203a87667d
data/README.md CHANGED
@@ -46,14 +46,14 @@ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemf
46
46
  gem 'rubocop', require: false
47
47
  ```
48
48
 
49
- RuboCop is stable between major versions, both in terms of API and cop configuration.
49
+ RuboCop is stable between minor versions, both in terms of API and cop configuration.
50
50
  We aim to ease the maintenance of RuboCop extensions and the upgrades between RuboCop
51
51
  releases. All big changes are reserved for major releases.
52
52
  To prevent an unwanted RuboCop update you might want to use a conservative version lock
53
53
  in your `Gemfile`:
54
54
 
55
55
  ```rb
56
- gem 'rubocop', '~> 1.29', require: false
56
+ gem 'rubocop', '~> 1.39', require: false
57
57
  ```
58
58
 
59
59
  See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
@@ -73,11 +73,13 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
73
73
 
74
74
  ## Compatibility
75
75
 
76
- RuboCop officially supports the following Ruby implementations:
76
+ RuboCop officially supports the following runtime Ruby implementations:
77
77
 
78
78
  * MRI 2.6+
79
79
  * JRuby 9.3+
80
80
 
81
+ Targets Ruby 2.0+ code analysis.
82
+
81
83
  See the [compatibility documentation](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
82
84
 
83
85
  ## Readme Badge
data/config/default.yml CHANGED
@@ -153,6 +153,8 @@ AllCops:
153
153
  rubocop-sequel: [sequel]
154
154
  rubocop-rake: [rake]
155
155
  rubocop-graphql: [graphql]
156
+ # Enable/Disable checking the methods extended by Active Support.
157
+ ActiveSupportExtensionsEnabled: false
156
158
 
157
159
  #################### Bundler ###############################
158
160
 
@@ -235,13 +237,6 @@ Bundler/OrderedGems:
235
237
 
236
238
  #################### Gemspec ###############################
237
239
 
238
- Gemspec/DateAssignment:
239
- Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
240
- Enabled: pending
241
- VersionAdded: '1.10'
242
- Include:
243
- - '**/*.gemspec'
244
-
245
240
  Gemspec/DependencyVersion:
246
241
  Description: 'Requires or forbids specifying gem dependency versions.'
247
242
  Enabled: false
@@ -254,6 +249,13 @@ Gemspec/DependencyVersion:
254
249
  - '**/*.gemspec'
255
250
  AllowedGems: []
256
251
 
252
+ Gemspec/DeprecatedAttributeAssignment:
253
+ Description: Checks that deprecated attribute assignments are not set in a gemspec file.
254
+ Enabled: pending
255
+ VersionAdded: '1.30'
256
+ Include:
257
+ - '**/*.gemspec'
258
+
257
259
  Gemspec/DuplicatedAssignment:
258
260
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
259
261
  Enabled: true
@@ -928,7 +930,7 @@ Layout/IndentationStyle:
928
930
  VersionChanged: '0.82'
929
931
  # By default the indentation width from `Layout/IndentationWidth` is used,
930
932
  # but it can be overridden by setting this parameter.
931
- # It is used during auto-correction to determine how many spaces should
933
+ # It is used during autocorrection to determine how many spaces should
932
934
  # replace each tab.
933
935
  IndentationWidth: ~
934
936
  EnforcedStyle: spaces
@@ -967,6 +969,31 @@ Layout/LeadingEmptyLines:
967
969
  VersionAdded: '0.57'
968
970
  VersionChanged: '0.77'
969
971
 
972
+ Layout/LineContinuationLeadingSpace:
973
+ Description: >-
974
+ Use trailing spaces instead of leading spaces in strings
975
+ broken over multiple lines (by a backslash).
976
+ Enabled: pending
977
+ AutoCorrect: false
978
+ SafeAutoCorrect: false
979
+ VersionAdded: '1.31'
980
+ VersionChanged: '1.32'
981
+ EnforcedStyle: trailing
982
+ SupportedStyles:
983
+ - leading
984
+ - trailing
985
+
986
+ Layout/LineContinuationSpacing:
987
+ Description: 'Checks the spacing in front of backslash in line continuations.'
988
+ Enabled: pending
989
+ AutoCorrect: true
990
+ SafeAutoCorrect: true
991
+ VersionAdded: '1.31'
992
+ EnforcedStyle: space
993
+ SupportedStyles:
994
+ - space
995
+ - no_space
996
+
970
997
  Layout/LineEndStringConcatenationIndentation:
971
998
  Description: >-
972
999
  Checks the indentation of the next line after a line that
@@ -1131,6 +1158,13 @@ Layout/MultilineMethodDefinitionBraceLayout:
1131
1158
  - new_line
1132
1159
  - same_line
1133
1160
 
1161
+ Layout/MultilineMethodParameterLineBreaks:
1162
+ Description: >-
1163
+ Checks that each parameter in a multi-line method definition
1164
+ starts on a separate line.
1165
+ Enabled: false
1166
+ VersionAdded: '1.32'
1167
+
1134
1168
  Layout/MultilineOperationIndentation:
1135
1169
  Description: >-
1136
1170
  Checks indentation of binary operations that span more than
@@ -1468,7 +1502,9 @@ Lint/AmbiguousBlockAssociation:
1468
1502
  Enabled: true
1469
1503
  VersionAdded: '0.48'
1470
1504
  VersionChanged: '1.13'
1471
- IgnoredMethods: []
1505
+ AllowedMethods: []
1506
+ AllowedPatterns: []
1507
+ IgnoredMethods: [] # deprecated
1472
1508
 
1473
1509
  Lint/AmbiguousOperator:
1474
1510
  Description: >-
@@ -1543,6 +1579,11 @@ Lint/ConstantDefinitionInBlock:
1543
1579
  AllowedMethods:
1544
1580
  - enums
1545
1581
 
1582
+ Lint/ConstantOverwrittenInRescue:
1583
+ Description: 'Checks for overwriting an exception with an exception result by use `rescue =>`.'
1584
+ Enabled: pending
1585
+ VersionAdded: '1.31'
1586
+
1546
1587
  Lint/ConstantResolution:
1547
1588
  Description: 'Check that constants are fully qualified with `::`.'
1548
1589
  Enabled: false
@@ -1563,6 +1604,7 @@ Lint/Debugger:
1563
1604
  # a user's configuration, but are otherwise not significant.
1564
1605
  Kernel:
1565
1606
  - binding.irb
1607
+ - Kernel.binding.irb
1566
1608
  Byebug:
1567
1609
  - byebug
1568
1610
  - remote_byebug
@@ -1580,6 +1622,9 @@ Lint/Debugger:
1580
1622
  - binding.pry
1581
1623
  - binding.remote_pry
1582
1624
  - binding.pry_remote
1625
+ - Kernel.binding.pry
1626
+ - Kernel.binding.remote_pry
1627
+ - Kernel.binding.pry_remote
1583
1628
  - Pry.rescue
1584
1629
  Rails:
1585
1630
  - debugger
@@ -1662,6 +1707,11 @@ Lint/DuplicateHashKey:
1662
1707
  VersionAdded: '0.34'
1663
1708
  VersionChanged: '0.77'
1664
1709
 
1710
+ Lint/DuplicateMagicComment:
1711
+ Description: 'Check for duplicated magic comments.'
1712
+ Enabled: pending
1713
+ VersionAdded: '1.37'
1714
+
1665
1715
  Lint/DuplicateMethods:
1666
1716
  Description: 'Check for duplicate method definitions.'
1667
1717
  Enabled: true
@@ -1712,8 +1762,10 @@ Lint/EmptyClass:
1712
1762
  Lint/EmptyConditionalBody:
1713
1763
  Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1714
1764
  Enabled: true
1765
+ SafeAutoCorrect: false
1715
1766
  AllowComments: true
1716
1767
  VersionAdded: '0.89'
1768
+ VersionChanged: '1.34'
1717
1769
 
1718
1770
  Lint/EmptyEnsure:
1719
1771
  Description: 'Checks for empty ensure block.'
@@ -1910,6 +1962,8 @@ Lint/NestedMethodDefinition:
1910
1962
  Description: 'Do not use nested method definitions.'
1911
1963
  StyleGuide: '#no-nested-methods'
1912
1964
  Enabled: true
1965
+ AllowedMethods: []
1966
+ AllowedPatterns: []
1913
1967
  VersionAdded: '0.32'
1914
1968
 
1915
1969
  Lint/NestedPercentLiteral:
@@ -1929,6 +1983,13 @@ Lint/NoReturnInBeginEndBlocks:
1929
1983
  Enabled: pending
1930
1984
  VersionAdded: '1.2'
1931
1985
 
1986
+ Lint/NonAtomicFileOperation:
1987
+ Description: Checks for non-atomic file operations.
1988
+ StyleGuide: '#atomic-file-operations'
1989
+ Enabled: pending
1990
+ VersionAdded: '1.31'
1991
+ SafeAutoCorrect: false
1992
+
1932
1993
  Lint/NonDeterministicRequireOrder:
1933
1994
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1934
1995
  Enabled: true
@@ -1946,7 +2007,9 @@ Lint/NumberConversion:
1946
2007
  VersionAdded: '0.53'
1947
2008
  VersionChanged: '1.1'
1948
2009
  SafeAutoCorrect: false
1949
- IgnoredMethods: []
2010
+ AllowedMethods: []
2011
+ AllowedPatterns: []
2012
+ IgnoredMethods: [] # deprecated
1950
2013
  IgnoredClasses:
1951
2014
  - Time
1952
2015
  - DateTime
@@ -1965,7 +2028,9 @@ Lint/OrAssignmentToConstant:
1965
2028
  Lint/OrderedMagicComments:
1966
2029
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1967
2030
  Enabled: true
2031
+ SafeAutoCorrect: false
1968
2032
  VersionAdded: '0.53'
2033
+ VersionChanged: '1.37'
1969
2034
 
1970
2035
  Lint/OutOfRangeRegexpRef:
1971
2036
  Description: 'Checks for out of range reference for Regexp because it always returns nil.'
@@ -2095,6 +2160,11 @@ Lint/RequireParentheses:
2095
2160
  Enabled: true
2096
2161
  VersionAdded: '0.18'
2097
2162
 
2163
+ Lint/RequireRangeParentheses:
2164
+ Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
2165
+ Enabled: pending
2166
+ VersionAdded: '1.32'
2167
+
2098
2168
  Lint/RequireRelativeSelfPath:
2099
2169
  Description: 'Checks for uses a file requiring itself with `require_relative`.'
2100
2170
  Enabled: pending
@@ -2341,6 +2411,12 @@ Lint/UselessAssignment:
2341
2411
  Enabled: true
2342
2412
  VersionAdded: '0.11'
2343
2413
 
2414
+ Lint/UselessElseWithoutRescue:
2415
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
2416
+ Enabled: true
2417
+ VersionAdded: '0.17'
2418
+ VersionChanged: '1.31'
2419
+
2344
2420
  Lint/UselessMethodDefinition:
2345
2421
  Description: 'Checks for useless method definitions.'
2346
2422
  Enabled: true
@@ -2387,7 +2463,9 @@ Metrics/AbcSize:
2387
2463
  VersionChanged: '1.5'
2388
2464
  # The ABC size is a calculated magnitude, so this number can be an Integer or
2389
2465
  # a Float.
2390
- IgnoredMethods: []
2466
+ AllowedMethods: []
2467
+ AllowedPatterns: []
2468
+ IgnoredMethods: [] # deprecated
2391
2469
  CountRepeatedAttributes: true
2392
2470
  Max: 17
2393
2471
 
@@ -2400,10 +2478,12 @@ Metrics/BlockLength:
2400
2478
  Max: 25
2401
2479
  CountAsOne: []
2402
2480
  ExcludedMethods: [] # deprecated, retained for backwards compatibility
2403
- IgnoredMethods:
2481
+ AllowedMethods:
2404
2482
  # By default, exclude the `#refine` method, as it tends to have larger
2405
2483
  # associated blocks.
2406
2484
  - refine
2485
+ AllowedPatterns: []
2486
+ IgnoredMethods: [] # deprecated
2407
2487
  Exclude:
2408
2488
  - '**/*.gemspec'
2409
2489
 
@@ -2433,7 +2513,9 @@ Metrics/CyclomaticComplexity:
2433
2513
  Enabled: true
2434
2514
  VersionAdded: '0.25'
2435
2515
  VersionChanged: '0.81'
2436
- IgnoredMethods: []
2516
+ AllowedMethods: []
2517
+ AllowedPatterns: []
2518
+ IgnoredMethods: [] # deprecated
2437
2519
  Max: 7
2438
2520
 
2439
2521
  Metrics/MethodLength:
@@ -2446,7 +2528,9 @@ Metrics/MethodLength:
2446
2528
  Max: 10
2447
2529
  CountAsOne: []
2448
2530
  ExcludedMethods: [] # deprecated, retained for backwards compatibility
2449
- IgnoredMethods: []
2531
+ AllowedMethods: []
2532
+ AllowedPatterns: []
2533
+ IgnoredMethods: [] # deprecated
2450
2534
 
2451
2535
  Metrics/ModuleLength:
2452
2536
  Description: 'Avoid modules longer than 100 lines of code.'
@@ -2474,7 +2558,9 @@ Metrics/PerceivedComplexity:
2474
2558
  Enabled: true
2475
2559
  VersionAdded: '0.25'
2476
2560
  VersionChanged: '0.81'
2477
- IgnoredMethods: []
2561
+ AllowedMethods: []
2562
+ AllowedPatterns: []
2563
+ IgnoredMethods: [] # deprecated
2478
2564
  Max: 8
2479
2565
 
2480
2566
  ################## Migration #############################
@@ -2717,10 +2803,12 @@ Naming/MethodParameterName:
2717
2803
  AllowNamesEndingInNumbers: true
2718
2804
  # Allowed names that will not register an offense
2719
2805
  AllowedNames:
2806
+ - as
2720
2807
  - at
2721
2808
  - by
2722
2809
  - db
2723
2810
  - id
2811
+ - if
2724
2812
  - in
2725
2813
  - io
2726
2814
  - ip
@@ -2871,6 +2959,7 @@ Style/AccessModifierDeclarations:
2871
2959
  - inline
2872
2960
  - group
2873
2961
  AllowModifiersOnSymbols: true
2962
+ SafeAutoCorrect: false
2874
2963
 
2875
2964
  Style/AccessorGrouping:
2876
2965
  Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
@@ -3005,7 +3094,7 @@ Style/BlockDelimiters:
3005
3094
  # This looks at the usage of a block's method to determine its type (e.g. is
3006
3095
  # the result of a `map` assigned to a variable or passed to another
3007
3096
  # method) but exceptions are permitted in the `ProceduralMethods`,
3008
- # `FunctionalMethods` and `IgnoredMethods` sections below.
3097
+ # `FunctionalMethods` and `AllowedMethods` sections below.
3009
3098
  - semantic
3010
3099
  # The `braces_for_chaining` style enforces braces around single line blocks
3011
3100
  # and do..end around multi-line blocks, except for multi-line blocks whose
@@ -3046,7 +3135,7 @@ Style/BlockDelimiters:
3046
3135
  - let!
3047
3136
  - subject
3048
3137
  - watch
3049
- IgnoredMethods:
3138
+ AllowedMethods:
3050
3139
  # Methods that can be either procedural or functional and cannot be
3051
3140
  # categorised from their usage alone, e.g.
3052
3141
  #
@@ -3063,6 +3152,8 @@ Style/BlockDelimiters:
3063
3152
  - lambda
3064
3153
  - proc
3065
3154
  - it
3155
+ AllowedPatterns: []
3156
+ IgnoredMethods: [] # deprecated
3066
3157
  # The AllowBracesOnProceduralOneLiners option is ignored unless the
3067
3158
  # EnforcedStyle is set to `semantic`. If so:
3068
3159
  #
@@ -3107,6 +3198,15 @@ Style/CaseEquality:
3107
3198
  # # good
3108
3199
  # String === "string"
3109
3200
  AllowOnConstant: false
3201
+ # If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
3202
+ # the case equality operator is `self.class`.
3203
+ #
3204
+ # # bad
3205
+ # some_class === object
3206
+ #
3207
+ # # good
3208
+ # self.class === object
3209
+ AllowOnSelfClass: false
3110
3210
 
3111
3211
  Style/CaseLikeIf:
3112
3212
  Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
@@ -3166,10 +3266,12 @@ Style/ClassEqualityComparison:
3166
3266
  StyleGuide: '#instance-of-vs-class-comparison'
3167
3267
  Enabled: true
3168
3268
  VersionAdded: '0.93'
3169
- IgnoredMethods:
3269
+ AllowedMethods:
3170
3270
  - ==
3171
3271
  - equal?
3172
3272
  - eql?
3273
+ AllowedPatterns: []
3274
+ IgnoredMethods: [] # deprecated
3173
3275
 
3174
3276
  Style/ClassMethods:
3175
3277
  Description: 'Use self when defining module/class methods.'
@@ -3347,7 +3449,7 @@ Style/Copyright:
3347
3449
 
3348
3450
  Style/DateTime:
3349
3451
  Description: 'Use Time over DateTime.'
3350
- StyleGuide: '#date--time'
3452
+ StyleGuide: '#date-time'
3351
3453
  Enabled: false
3352
3454
  VersionAdded: '0.51'
3353
3455
  VersionChanged: '0.92'
@@ -3456,6 +3558,12 @@ Style/EmptyElse:
3456
3558
  - empty
3457
3559
  - nil
3458
3560
  - both
3561
+ AllowComments: false
3562
+
3563
+ Style/EmptyHeredoc:
3564
+ Description: 'Checks for using empty heredoc to reduce redundancy.'
3565
+ Enabled: pending
3566
+ VersionAdded: '1.32'
3459
3567
 
3460
3568
  Style/EmptyLambdaParameter:
3461
3569
  Description: 'Omit parens for empty lambda parameters.'
@@ -3625,7 +3733,9 @@ Style/FormatStringToken:
3625
3733
  MaxUnannotatedPlaceholdersAllowed: 1
3626
3734
  VersionAdded: '0.49'
3627
3735
  VersionChanged: '1.0'
3628
- IgnoredMethods: []
3736
+ AllowedMethods: []
3737
+ AllowedPatterns: []
3738
+ IgnoredMethods: [] # deprecated
3629
3739
 
3630
3740
  Style/FrozenStringLiteralComment:
3631
3741
  Description: >-
@@ -3670,7 +3780,7 @@ Style/GuardClause:
3670
3780
  StyleGuide: '#no-nested-conditionals'
3671
3781
  Enabled: true
3672
3782
  VersionAdded: '0.20'
3673
- VersionChanged: '1.28'
3783
+ VersionChanged: '1.31'
3674
3784
  # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3675
3785
  # needs to have to trigger this cop
3676
3786
  MinBodyLength: 1
@@ -3710,7 +3820,9 @@ Style/HashExcept:
3710
3820
  Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3711
3821
  that can be replaced with `Hash#except` method.
3712
3822
  Enabled: pending
3823
+ Safe: false
3713
3824
  VersionAdded: '1.7'
3825
+ VersionChanged: '1.39'
3714
3826
 
3715
3827
  Style/HashLikeCase:
3716
3828
  Description: >-
@@ -3749,6 +3861,8 @@ Style/HashSyntax:
3749
3861
  - never
3750
3862
  # accepts both shorthand and explicit use of hash literal value.
3751
3863
  - either
3864
+ # like "either", but will avoid mixing styles in a single hash
3865
+ - consistent
3752
3866
  # Force hashes that have a symbol value to use hash rockets
3753
3867
  UseHashRocketsWithSymbolValues: false
3754
3868
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -3925,6 +4039,31 @@ Style/LineEndConcatenation:
3925
4039
  VersionAdded: '0.18'
3926
4040
  VersionChanged: '0.64'
3927
4041
 
4042
+ Style/MagicCommentFormat:
4043
+ Description: 'Use a consistent style for magic comments.'
4044
+ Enabled: pending
4045
+ VersionAdded: '1.35'
4046
+ EnforcedStyle: snake_case
4047
+ SupportedStyles:
4048
+ # `snake` will enforce the magic comment is written
4049
+ # in snake case (words separated by underscores).
4050
+ # Eg: froze_string_literal: true
4051
+ - snake_case
4052
+ # `kebab` will enforce the magic comment is written
4053
+ # in kebab case (words separated by hyphens).
4054
+ # Eg: froze-string-literal: true
4055
+ - kebab_case
4056
+ DirectiveCapitalization: lowercase
4057
+ ValueCapitalization: ~
4058
+ SupportedCapitalizations:
4059
+ - lowercase
4060
+ - uppercase
4061
+
4062
+ Style/MapCompactWithConditionalBlock:
4063
+ Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
4064
+ Enabled: pending
4065
+ VersionAdded: '1.30'
4066
+
3928
4067
  Style/MapToHash:
3929
4068
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
3930
4069
  Enabled: pending
@@ -3938,7 +4077,8 @@ Style/MethodCallWithArgsParentheses:
3938
4077
  VersionAdded: '0.47'
3939
4078
  VersionChanged: '1.7'
3940
4079
  IgnoreMacros: true
3941
- IgnoredMethods: []
4080
+ AllowedMethods: []
4081
+ IgnoredMethods: [] # deprecated
3942
4082
  AllowedPatterns: []
3943
4083
  IgnoredPatterns: [] # deprecated
3944
4084
  IncludedMacros: []
@@ -3955,7 +4095,9 @@ Style/MethodCallWithoutArgsParentheses:
3955
4095
  Description: 'Do not use parentheses for method calls with no arguments.'
3956
4096
  StyleGuide: '#method-invocation-parens'
3957
4097
  Enabled: true
3958
- IgnoredMethods: []
4098
+ AllowedMethods: []
4099
+ AllowedPatterns: []
4100
+ IgnoredMethods: [] # deprecated
3959
4101
  VersionAdded: '0.47'
3960
4102
  VersionChanged: '0.55'
3961
4103
 
@@ -4307,6 +4449,7 @@ Style/NumericLiterals:
4307
4449
  Strict: false
4308
4450
  # You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
4309
4451
  AllowedNumbers: []
4452
+ AllowedPatterns: []
4310
4453
 
4311
4454
  Style/NumericPredicate:
4312
4455
  Description: >-
@@ -4325,7 +4468,9 @@ Style/NumericPredicate:
4325
4468
  SupportedStyles:
4326
4469
  - predicate
4327
4470
  - comparison
4328
- IgnoredMethods: []
4471
+ AllowedMethods: []
4472
+ AllowedPatterns: []
4473
+ IgnoredMethods: [] # deprecated
4329
4474
  # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
4330
4475
  # false positives.
4331
4476
  Exclude:
@@ -4364,6 +4509,12 @@ Style/OpenStructUse:
4364
4509
  Enabled: pending
4365
4510
  VersionAdded: '1.23'
4366
4511
 
4512
+ Style/OperatorMethodCall:
4513
+ Description: 'Checks for redundant dot before operator method call.'
4514
+ StyleGuide: '#operator-method-call'
4515
+ Enabled: pending
4516
+ VersionAdded: '1.37'
4517
+
4367
4518
  Style/OptionHash:
4368
4519
  Description: "Don't use option hashes when you can use keyword arguments."
4369
4520
  Enabled: false
@@ -4547,6 +4698,12 @@ Style/RedundantConditional:
4547
4698
  Enabled: true
4548
4699
  VersionAdded: '0.50'
4549
4700
 
4701
+ Style/RedundantEach:
4702
+ Description: 'Checks for redundant `each`.'
4703
+ Enabled: pending
4704
+ Safe: false
4705
+ VersionAdded: '1.38'
4706
+
4550
4707
  Style/RedundantException:
4551
4708
  Description: "Checks for an obsolete RuntimeException argument in raise/fail."
4552
4709
  StyleGuide: '#no-explicit-runtimeerror'
@@ -4592,7 +4749,9 @@ Style/RedundantInitialize:
4592
4749
  Style/RedundantInterpolation:
4593
4750
  Description: 'Checks for strings that are just an interpolated expression.'
4594
4751
  Enabled: true
4752
+ SafeAutoCorrect: false
4595
4753
  VersionAdded: '0.76'
4754
+ VersionChanged: '1.30'
4596
4755
 
4597
4756
  Style/RedundantParentheses:
4598
4757
  Description: "Checks for parentheses that seem not to serve any purpose."
@@ -4656,6 +4815,11 @@ Style/RedundantSortBy:
4656
4815
  Enabled: true
4657
4816
  VersionAdded: '0.36'
4658
4817
 
4818
+ Style/RedundantStringEscape:
4819
+ Description: 'Checks for redundant escapes in string literals.'
4820
+ Enabled: pending
4821
+ VersionAdded: '1.37'
4822
+
4659
4823
  Style/RegexpLiteral:
4660
4824
  Description: 'Use / or %r around regular expressions.'
4661
4825
  StyleGuide: '#percent-r'
@@ -4706,7 +4870,7 @@ Style/SafeNavigation:
4706
4870
  Transforms usages of a method call safeguarded by
4707
4871
  a check for the existence of the object to
4708
4872
  safe navigation (`&.`).
4709
- Auto-correction is unsafe as it assumes the object will
4873
+ Autocorrection is unsafe as it assumes the object will
4710
4874
  be `nil` or truthy, but never `false`.
4711
4875
  Enabled: true
4712
4876
  VersionAdded: '0.43'
@@ -4960,11 +5124,13 @@ Style/SymbolProc:
4960
5124
  VersionAdded: '0.26'
4961
5125
  VersionChanged: '1.28'
4962
5126
  AllowMethodsWithArguments: false
4963
- # A list of method names to be ignored by the check.
5127
+ # A list of method names to be always allowed by the check.
4964
5128
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
4965
- IgnoredMethods:
5129
+ AllowedMethods:
4966
5130
  - respond_to
4967
5131
  - define_method
5132
+ AllowedPatterns: []
5133
+ IgnoredMethods: [] # deprecated
4968
5134
  AllowComments: false
4969
5135
 
4970
5136
  Style/TernaryParentheses:
@@ -55,6 +55,8 @@ renamed:
55
55
 
56
56
  # Cops that were removed
57
57
  removed:
58
+ Gemspec/DateAssignment:
59
+ alternatives: Gemspec/DeprecatedAttributeAssignment
58
60
  Layout/SpaceAfterControlKeyword:
59
61
  alternatives: Layout/SpaceAroundKeyword
60
62
  Layout/SpaceBeforeModifierKeyword:
@@ -185,7 +187,9 @@ changed_parameters:
185
187
  - Metrics/BlockLength
186
188
  - Metrics/MethodLength
187
189
  parameters: ExcludedMethods
188
- alternative: IgnoredMethods
190
+ alternatives:
191
+ - AllowedMethods
192
+ - AllowedPatterns
189
193
  severity: warning
190
194
  - cops: Lint/Debugger
191
195
  parameters: DebuggerReceivers
@@ -200,6 +204,26 @@ changed_parameters:
200
204
  parameters: IgnoredPatterns
201
205
  alternative: AllowedPatterns
202
206
  severity: warning
207
+ - cops:
208
+ - Lint/AmbiguousBlockAssociation
209
+ - Lint/NumberConversion
210
+ - Metrics/AbcSize
211
+ - Metrics/BlockLength
212
+ - Metrics/CyclomaticComplexity
213
+ - Metrics/MethodLength
214
+ - Metrics/PerceivedComplexity
215
+ - Style/BlockDelimiters
216
+ - Style/ClassEqualityComparison
217
+ - Style/FormatStringToken
218
+ - Style/MethodCallWithArgsParentheses
219
+ - Style/MethodCallWithoutArgsParentheses
220
+ - Style/NumericPredicate
221
+ - Style/SymbolLiteral
222
+ parameters: IgnoredMethods
223
+ alternatives:
224
+ - AllowedMethods
225
+ - AllowedPatterns
226
+ severity: warning
203
227
 
204
228
  # Enforced styles that have been removed or replaced
205
229
  changed_enforced_styles:
data/exe/rubocop CHANGED
@@ -3,13 +3,21 @@
3
3
 
4
4
  $LOAD_PATH.unshift("#{__dir__}/../lib")
5
5
 
6
- require 'rubocop'
7
- require 'benchmark'
6
+ require 'rubocop/server'
7
+ server_cli = RuboCop::Server::CLI.new
8
+ exit_status = server_cli.run
9
+ exit exit_status if server_cli.exit?
8
10
 
9
- cli = RuboCop::CLI.new
10
- result = 0
11
+ if RuboCop::Server.running?
12
+ exit_status = RuboCop::Server::ClientCommand::Exec.new.run
13
+ else
14
+ require 'rubocop'
15
+ require 'benchmark'
11
16
 
12
- time = Benchmark.realtime { result = cli.run }
17
+ cli = RuboCop::CLI.new
13
18
 
14
- puts "Finished in #{time} seconds" if cli.options[:debug] || cli.options[:display_time]
15
- exit result
19
+ time = Benchmark.realtime { exit_status = cli.run }
20
+
21
+ puts "Finished in #{time} seconds" if cli.options[:debug] || cli.options[:display_time]
22
+ end
23
+ exit exit_status
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ # This is a class that reads optional command line arguments to rubocop from environment variable.
5
+ # @api private
6
+ class ArgumentsEnv
7
+ def self.read_as_arguments
8
+ if (arguments = ENV.fetch('RUBOCOP_OPTS', '')).empty?
9
+ []
10
+ else
11
+ require 'shellwords'
12
+
13
+ Shellwords.split(arguments)
14
+ end
15
+ end
16
+ end
17
+ end