rubocop 1.62.1 → 1.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +67 -68
  3. data/config/default.yml +82 -12
  4. data/config/internal_affairs.yml +11 -0
  5. data/exe/rubocop +4 -3
  6. data/lib/rubocop/cached_data.rb +11 -3
  7. data/lib/rubocop/cli/command/auto_generate_config.rb +6 -7
  8. data/lib/rubocop/cli/command/lsp.rb +2 -2
  9. data/lib/rubocop/cli/command/show_docs_url.rb +2 -2
  10. data/lib/rubocop/cli.rb +4 -0
  11. data/lib/rubocop/comment_config.rb +1 -1
  12. data/lib/rubocop/config.rb +37 -11
  13. data/lib/rubocop/config_loader.rb +15 -9
  14. data/lib/rubocop/config_loader_resolver.rb +13 -8
  15. data/lib/rubocop/config_obsoletion.rb +1 -1
  16. data/lib/rubocop/config_validator.rb +3 -2
  17. data/lib/rubocop/cop/base.rb +56 -16
  18. data/lib/rubocop/cop/bundler/gem_version.rb +4 -5
  19. data/lib/rubocop/cop/cop.rb +30 -4
  20. data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -0
  21. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +1 -1
  22. data/lib/rubocop/cop/documentation.rb +32 -5
  23. data/lib/rubocop/cop/force.rb +12 -0
  24. data/lib/rubocop/cop/gemspec/add_runtime_dependency.rb +38 -0
  25. data/lib/rubocop/cop/gemspec/dependency_version.rb +3 -5
  26. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +2 -2
  27. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +3 -3
  28. data/lib/rubocop/cop/internal_affairs/cop_description.rb +0 -4
  29. data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +2 -1
  30. data/lib/rubocop/cop/internal_affairs/example_description.rb +2 -1
  31. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -1
  32. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +6 -21
  33. data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +8 -1
  34. data/lib/rubocop/cop/internal_affairs/undefined_config.rb +11 -1
  35. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +0 -5
  36. data/lib/rubocop/cop/internal_affairs.rb +16 -0
  37. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +5 -1
  38. data/lib/rubocop/cop/layout/assignment_indentation.rb +3 -2
  39. data/lib/rubocop/cop/layout/block_alignment.rb +30 -12
  40. data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
  41. data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
  42. data/lib/rubocop/cop/layout/condition_position.rb +0 -4
  43. data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
  44. data/lib/rubocop/cop/layout/empty_comment.rb +3 -1
  45. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
  46. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
  47. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -1
  48. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +8 -3
  49. data/lib/rubocop/cop/layout/first_argument_indentation.rb +2 -2
  50. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -3
  51. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +8 -0
  52. data/lib/rubocop/cop/layout/heredoc_indentation.rb +1 -1
  53. data/lib/rubocop/cop/layout/indentation_width.rb +5 -6
  54. data/lib/rubocop/cop/layout/leading_comment_space.rb +28 -1
  55. data/lib/rubocop/cop/layout/line_length.rb +20 -20
  56. data/lib/rubocop/cop/layout/space_around_operators.rb +3 -0
  57. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +3 -4
  58. data/lib/rubocop/cop/legacy/corrector.rb +12 -2
  59. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +0 -2
  60. data/lib/rubocop/cop/lint/ambiguous_operator.rb +0 -2
  61. data/lib/rubocop/cop/lint/ambiguous_range.rb +4 -1
  62. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +0 -2
  63. data/lib/rubocop/cop/lint/assignment_in_condition.rb +2 -2
  64. data/lib/rubocop/cop/lint/big_decimal_new.rb +4 -7
  65. data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -3
  66. data/lib/rubocop/cop/lint/circular_argument_reference.rb +0 -13
  67. data/lib/rubocop/cop/lint/debugger.rb +27 -6
  68. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
  69. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +0 -10
  70. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -5
  71. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +0 -4
  72. data/lib/rubocop/cop/lint/duplicate_methods.rb +0 -10
  73. data/lib/rubocop/cop/lint/duplicate_set_element.rb +74 -0
  74. data/lib/rubocop/cop/lint/each_with_object_argument.rb +0 -4
  75. data/lib/rubocop/cop/lint/else_layout.rb +0 -2
  76. data/lib/rubocop/cop/lint/empty_conditional_body.rb +28 -7
  77. data/lib/rubocop/cop/lint/empty_ensure.rb +1 -11
  78. data/lib/rubocop/cop/lint/empty_interpolation.rb +0 -4
  79. data/lib/rubocop/cop/lint/empty_when.rb +1 -3
  80. data/lib/rubocop/cop/lint/ensure_return.rb +1 -9
  81. data/lib/rubocop/cop/lint/erb_new_arguments.rb +21 -14
  82. data/lib/rubocop/cop/lint/float_comparison.rb +1 -1
  83. data/lib/rubocop/cop/lint/float_out_of_range.rb +0 -4
  84. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +0 -10
  85. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +23 -12
  86. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +0 -7
  87. data/lib/rubocop/cop/lint/interpolation_check.rb +0 -4
  88. data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +5 -14
  89. data/lib/rubocop/cop/lint/literal_as_condition.rb +1 -1
  90. data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +1 -1
  91. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +25 -6
  92. data/lib/rubocop/cop/lint/loop.rb +6 -12
  93. data/lib/rubocop/cop/lint/mixed_case_range.rb +9 -4
  94. data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -7
  95. data/lib/rubocop/cop/lint/next_without_accumulator.rb +0 -4
  96. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +0 -5
  97. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +1 -1
  98. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +5 -6
  99. data/lib/rubocop/cop/lint/percent_string_array.rb +0 -4
  100. data/lib/rubocop/cop/lint/percent_symbol_array.rb +0 -4
  101. data/lib/rubocop/cop/lint/rand_one.rb +0 -4
  102. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +3 -1
  103. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +1 -1
  104. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
  105. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +0 -4
  106. data/lib/rubocop/cop/lint/redundant_with_index.rb +3 -0
  107. data/lib/rubocop/cop/lint/require_parentheses.rb +0 -4
  108. data/lib/rubocop/cop/lint/rescue_exception.rb +0 -4
  109. data/lib/rubocop/cop/lint/return_in_void_context.rb +0 -2
  110. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +0 -4
  111. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +105 -41
  112. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +6 -10
  113. data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
  114. data/lib/rubocop/cop/lint/to_enum_arguments.rb +2 -9
  115. data/lib/rubocop/cop/lint/unified_integer.rb +0 -4
  116. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +1 -0
  117. data/lib/rubocop/cop/lint/unreachable_code.rb +4 -7
  118. data/lib/rubocop/cop/lint/unreachable_loop.rb +8 -2
  119. data/lib/rubocop/cop/lint/uri_regexp.rb +25 -7
  120. data/lib/rubocop/cop/lint/useless_assignment.rb +19 -16
  121. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +0 -4
  122. data/lib/rubocop/cop/lint/useless_numeric_operation.rb +77 -0
  123. data/lib/rubocop/cop/lint/useless_setter_call.rb +0 -4
  124. data/lib/rubocop/cop/lint/void.rb +35 -8
  125. data/lib/rubocop/cop/metrics/block_length.rb +6 -5
  126. data/lib/rubocop/cop/metrics/block_nesting.rb +19 -7
  127. data/lib/rubocop/cop/metrics/class_length.rb +6 -5
  128. data/lib/rubocop/cop/metrics/method_length.rb +6 -5
  129. data/lib/rubocop/cop/metrics/module_length.rb +6 -5
  130. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +5 -5
  131. data/lib/rubocop/cop/mixin/alignment.rb +5 -1
  132. data/lib/rubocop/cop/mixin/allowed_methods.rb +7 -1
  133. data/lib/rubocop/cop/mixin/allowed_pattern.rb +15 -3
  134. data/lib/rubocop/cop/mixin/annotation_comment.rb +0 -2
  135. data/lib/rubocop/cop/mixin/code_length.rb +12 -1
  136. data/lib/rubocop/cop/mixin/configurable_max.rb +5 -1
  137. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +19 -9
  138. data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +9 -2
  139. data/lib/rubocop/cop/mixin/line_length_help.rb +7 -2
  140. data/lib/rubocop/cop/mixin/method_complexity.rb +15 -6
  141. data/lib/rubocop/cop/mixin/percent_array.rb +1 -1
  142. data/lib/rubocop/cop/mixin/rescue_node.rb +4 -0
  143. data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
  144. data/lib/rubocop/cop/mixin/statement_modifier.rb +3 -2
  145. data/lib/rubocop/cop/mixin/string_literals_help.rb +12 -0
  146. data/lib/rubocop/cop/naming/accessor_method_name.rb +5 -0
  147. data/lib/rubocop/cop/naming/block_forwarding.rb +31 -12
  148. data/lib/rubocop/cop/naming/file_name.rb +2 -2
  149. data/lib/rubocop/cop/naming/inclusive_language.rb +13 -5
  150. data/lib/rubocop/cop/naming/predicate_name.rb +53 -27
  151. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +10 -1
  152. data/lib/rubocop/cop/offense.rb +2 -2
  153. data/lib/rubocop/cop/security/compound_hash.rb +2 -2
  154. data/lib/rubocop/cop/style/access_modifier_declarations.rb +62 -2
  155. data/lib/rubocop/cop/style/accessor_grouping.rb +10 -2
  156. data/lib/rubocop/cop/style/alias.rb +2 -1
  157. data/lib/rubocop/cop/style/arguments_forwarding.rb +59 -11
  158. data/lib/rubocop/cop/style/block_delimiters.rb +14 -1
  159. data/lib/rubocop/cop/style/collection_compact.rb +9 -9
  160. data/lib/rubocop/cop/style/combinable_loops.rb +7 -0
  161. data/lib/rubocop/cop/style/commented_keyword.rb +7 -1
  162. data/lib/rubocop/cop/style/conditional_assignment.rb +2 -2
  163. data/lib/rubocop/cop/style/copyright.rb +31 -21
  164. data/lib/rubocop/cop/style/data_inheritance.rb +1 -1
  165. data/lib/rubocop/cop/style/def_with_parentheses.rb +0 -2
  166. data/lib/rubocop/cop/style/documentation.rb +24 -24
  167. data/lib/rubocop/cop/style/documentation_method.rb +20 -0
  168. data/lib/rubocop/cop/style/each_for_simple_loop.rb +0 -1
  169. data/lib/rubocop/cop/style/empty_else.rb +6 -5
  170. data/lib/rubocop/cop/style/empty_heredoc.rb +1 -14
  171. data/lib/rubocop/cop/style/empty_literal.rb +31 -22
  172. data/lib/rubocop/cop/style/eval_with_location.rb +16 -13
  173. data/lib/rubocop/cop/style/exact_regexp_match.rb +2 -1
  174. data/lib/rubocop/cop/style/file_read.rb +2 -5
  175. data/lib/rubocop/cop/style/file_write.rb +2 -5
  176. data/lib/rubocop/cop/style/format_string.rb +9 -9
  177. data/lib/rubocop/cop/style/format_string_token.rb +2 -2
  178. data/lib/rubocop/cop/style/global_std_stream.rb +7 -1
  179. data/lib/rubocop/cop/style/guard_clause.rb +3 -1
  180. data/lib/rubocop/cop/style/hash_each_methods.rb +6 -0
  181. data/lib/rubocop/cop/style/hash_except.rb +8 -5
  182. data/lib/rubocop/cop/style/hash_syntax.rb +20 -2
  183. data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
  184. data/lib/rubocop/cop/style/if_inside_else.rb +1 -1
  185. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +5 -4
  186. data/lib/rubocop/cop/style/if_with_semicolon.rb +49 -6
  187. data/lib/rubocop/cop/style/in_pattern_then.rb +6 -2
  188. data/lib/rubocop/cop/style/invertible_unless_condition.rb +2 -2
  189. data/lib/rubocop/cop/style/lambda.rb +1 -1
  190. data/lib/rubocop/cop/style/magic_comment_format.rb +1 -1
  191. data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +77 -43
  192. data/lib/rubocop/cop/style/map_into_array.rb +228 -0
  193. data/lib/rubocop/cop/style/map_to_hash.rb +1 -1
  194. data/lib/rubocop/cop/style/map_to_set.rb +1 -1
  195. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +17 -7
  196. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +1 -1
  197. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +2 -2
  198. data/lib/rubocop/cop/style/missing_else.rb +0 -4
  199. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  200. data/lib/rubocop/cop/style/multiline_when_then.rb +0 -4
  201. data/lib/rubocop/cop/style/multiple_comparison.rb +3 -11
  202. data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
  203. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
  204. data/lib/rubocop/cop/style/numeric_predicate.rb +12 -4
  205. data/lib/rubocop/cop/style/one_line_conditional.rb +6 -2
  206. data/lib/rubocop/cop/style/operator_method_call.rb +25 -6
  207. data/lib/rubocop/cop/style/parallel_assignment.rb +5 -4
  208. data/lib/rubocop/cop/style/quoted_symbols.rb +1 -3
  209. data/lib/rubocop/cop/style/redundant_argument.rb +24 -1
  210. data/lib/rubocop/cop/style/redundant_begin.rb +5 -1
  211. data/lib/rubocop/cop/style/redundant_condition.rb +4 -4
  212. data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +1 -1
  213. data/lib/rubocop/cop/style/redundant_each.rb +1 -1
  214. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
  215. data/lib/rubocop/cop/style/redundant_filter_chain.rb +1 -1
  216. data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +46 -0
  217. data/lib/rubocop/cop/style/redundant_line_continuation.rb +15 -18
  218. data/lib/rubocop/cop/style/redundant_parentheses.rb +1 -1
  219. data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
  220. data/lib/rubocop/cop/style/redundant_regexp_argument.rb +4 -1
  221. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +8 -24
  222. data/lib/rubocop/cop/style/require_order.rb +2 -2
  223. data/lib/rubocop/cop/style/rescue_modifier.rb +13 -1
  224. data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +54 -12
  225. data/lib/rubocop/cop/style/safe_navigation.rb +94 -52
  226. data/lib/rubocop/cop/style/select_by_regexp.rb +9 -6
  227. data/lib/rubocop/cop/style/semicolon.rb +1 -1
  228. data/lib/rubocop/cop/style/send.rb +4 -4
  229. data/lib/rubocop/cop/style/send_with_literal_method_name.rb +104 -0
  230. data/lib/rubocop/cop/style/sole_nested_conditional.rb +21 -2
  231. data/lib/rubocop/cop/style/special_global_vars.rb +1 -2
  232. data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
  233. data/lib/rubocop/cop/style/super_arguments.rb +174 -0
  234. data/lib/rubocop/cop/style/symbol_proc.rb +39 -5
  235. data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
  236. data/lib/rubocop/cop/style/top_level_method_definition.rb +1 -1
  237. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  238. data/lib/rubocop/cop/style/while_until_do.rb +0 -2
  239. data/lib/rubocop/cop/style/while_until_modifier.rb +0 -1
  240. data/lib/rubocop/cop/style/zero_length_predicate.rb +32 -24
  241. data/lib/rubocop/cop/team.rb +27 -3
  242. data/lib/rubocop/cop/util.rb +8 -2
  243. data/lib/rubocop/cop/variable_force.rb +13 -1
  244. data/lib/rubocop/cops_documentation_generator.rb +73 -34
  245. data/lib/rubocop/core_ext/string.rb +2 -6
  246. data/lib/rubocop/ext/regexp_node.rb +9 -31
  247. data/lib/rubocop/ext/regexp_parser.rb +4 -21
  248. data/lib/rubocop/file_finder.rb +9 -4
  249. data/lib/rubocop/formatter/clang_style_formatter.rb +3 -7
  250. data/lib/rubocop/formatter/disabled_config_formatter.rb +13 -9
  251. data/lib/rubocop/formatter/formatter_set.rb +7 -1
  252. data/lib/rubocop/formatter/html_formatter.rb +3 -1
  253. data/lib/rubocop/formatter/junit_formatter.rb +70 -23
  254. data/lib/rubocop/formatter/tap_formatter.rb +3 -7
  255. data/lib/rubocop/lockfile.rb +58 -7
  256. data/lib/rubocop/lsp/routes.rb +10 -13
  257. data/lib/rubocop/lsp/runtime.rb +2 -0
  258. data/lib/rubocop/lsp/server.rb +2 -1
  259. data/lib/rubocop/lsp.rb +9 -2
  260. data/lib/rubocop/options.rb +6 -4
  261. data/lib/rubocop/rake_task.rb +1 -1
  262. data/lib/rubocop/remote_config.rb +5 -1
  263. data/lib/rubocop/result_cache.rb +2 -8
  264. data/lib/rubocop/rspec/expect_offense.rb +9 -0
  265. data/lib/rubocop/rspec/shared_contexts.rb +35 -3
  266. data/lib/rubocop/rspec/support.rb +1 -0
  267. data/lib/rubocop/runner.rb +8 -1
  268. data/lib/rubocop/server/cache.rb +16 -1
  269. data/lib/rubocop/server/client_command/exec.rb +2 -2
  270. data/lib/rubocop/server/client_command/start.rb +1 -1
  271. data/lib/rubocop/server/core.rb +5 -0
  272. data/lib/rubocop/target_ruby.rb +19 -15
  273. data/lib/rubocop/version.rb +7 -5
  274. data/lib/rubocop/yaml_duplication_checker.rb +20 -26
  275. data/lib/rubocop.rb +13 -1
  276. metadata +20 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8daa4ef7dd74b8608039d7dfda5f1e3fe739738949390a6f1347acaccf7bd1c4
4
- data.tar.gz: 271a978db956def596a5b06a7fd69d189d807b27db0acdda03fd6200b95ef541
3
+ metadata.gz: d8127fcc41c5b7ffb95a175f82e8a411dfdec0be2b126c7e0868114519d92d01
4
+ data.tar.gz: 2760fa954ef847d049bdd065dec77518c912f5b9050320fe419b9476393b58ea
5
5
  SHA512:
6
- metadata.gz: 484294f43781f114ba01470b22331ef17648219e26dc4ba2f28073f609c909af2997c47e1f1aad62860124f6f4594a2e536cd793f05352a78d588f979732a290
7
- data.tar.gz: 6a8313e61422bcd568eea747c0f9a88f61f50620b4dd4f478da0bdd3e067c1aa8bcf70e15744e02118d4c525eb0632fae3cc19caf73db6db1f63ea76dbb84b45
6
+ metadata.gz: 87ac1904b5fac462a0b76627aac384ddb57493a3620c3ebc929efa9429ee8ad355038caaef2d41192abfcb726d70d85309a442eb93feab8d034544368be32dfd
7
+ data.tar.gz: a011cbaced00ecab1ba1f6ea57983e92c7c872a08c88e450b9aea054bad61cc0f6acae3e1a50c4e4bf545e86ff339000d19995527ff906f0282e2613e7b2638d
data/README.md CHANGED
@@ -5,8 +5,7 @@
5
5
  ----------
6
6
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
7
7
  [![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
8
- [![CircleCI Status](https://circleci.com/gh/rubocop/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop/tree/master)
9
- [![Actions Status](https://github.com/rubocop/rubocop/workflows/CI/badge.svg?branch=master)](https://github.com/rubocop/rubocop/actions?query=workflow%3ACI)
8
+ [![CI](https://github.com/rubocop/rubocop/actions/workflows/rubocop.yml/badge.svg)](https://github.com/rubocop/rubocop/actions/workflows/rubocop.yml)
10
9
  [![Test Coverage](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/test_coverage)](https://codeclimate.com/github/rubocop/rubocop/test_coverage)
11
10
  [![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop/rubocop/maintainability)
12
11
  [![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg?sanitize=true)](https://discord.gg/wJjWvGRDmm)
@@ -24,8 +23,8 @@ RuboCop is extremely flexible and most aspects of its behavior can be tweaked vi
24
23
 
25
24
  ----------
26
25
  [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
27
- [![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
28
- [![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
26
+ [![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-for-individuals)
27
+ [![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-for-organizations)
29
28
  [![Tidelift](https://tidelift.com/badges/package/rubygems/rubocop)](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
30
29
 
31
30
  Working on RuboCop is often fun, but it also requires a great deal of time and energy.
@@ -53,7 +52,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
53
52
  in your `Gemfile`:
54
53
 
55
54
  ```rb
56
- gem 'rubocop', '~> 1.62', require: false
55
+ gem 'rubocop', '~> 1.67', require: false
57
56
  ```
58
57
 
59
58
  See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
@@ -172,75 +171,75 @@ and [Tidelift](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source
172
171
  **Note:** If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we'd recommend
173
172
  the use of Tidelift, where you can get a support-like subscription instead.
174
173
 
175
- ### Open Collective Backers
174
+ ### Open Collective for Individuals
176
175
 
177
176
  Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/rubocop#backer)]
178
177
 
179
- <a href="https://opencollective.com/rubocop/backer/0/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/0/avatar.svg"></a>
180
- <a href="https://opencollective.com/rubocop/backer/1/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/1/avatar.svg"></a>
181
- <a href="https://opencollective.com/rubocop/backer/2/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/2/avatar.svg"></a>
182
- <a href="https://opencollective.com/rubocop/backer/3/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/3/avatar.svg"></a>
183
- <a href="https://opencollective.com/rubocop/backer/4/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/4/avatar.svg"></a>
184
- <a href="https://opencollective.com/rubocop/backer/5/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/5/avatar.svg"></a>
185
- <a href="https://opencollective.com/rubocop/backer/6/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/6/avatar.svg"></a>
186
- <a href="https://opencollective.com/rubocop/backer/7/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/7/avatar.svg"></a>
187
- <a href="https://opencollective.com/rubocop/backer/8/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/8/avatar.svg"></a>
188
- <a href="https://opencollective.com/rubocop/backer/9/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/9/avatar.svg"></a>
189
- <a href="https://opencollective.com/rubocop/backer/10/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/10/avatar.svg"></a>
190
- <a href="https://opencollective.com/rubocop/backer/11/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/11/avatar.svg"></a>
191
- <a href="https://opencollective.com/rubocop/backer/12/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/12/avatar.svg"></a>
192
- <a href="https://opencollective.com/rubocop/backer/13/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/13/avatar.svg"></a>
193
- <a href="https://opencollective.com/rubocop/backer/14/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/14/avatar.svg"></a>
194
- <a href="https://opencollective.com/rubocop/backer/15/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/15/avatar.svg"></a>
195
- <a href="https://opencollective.com/rubocop/backer/16/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/16/avatar.svg"></a>
196
- <a href="https://opencollective.com/rubocop/backer/17/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/17/avatar.svg"></a>
197
- <a href="https://opencollective.com/rubocop/backer/18/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/18/avatar.svg"></a>
198
- <a href="https://opencollective.com/rubocop/backer/19/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/19/avatar.svg"></a>
199
- <a href="https://opencollective.com/rubocop/backer/20/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/20/avatar.svg"></a>
200
- <a href="https://opencollective.com/rubocop/backer/21/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/21/avatar.svg"></a>
201
- <a href="https://opencollective.com/rubocop/backer/22/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/22/avatar.svg"></a>
202
- <a href="https://opencollective.com/rubocop/backer/23/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/23/avatar.svg"></a>
203
- <a href="https://opencollective.com/rubocop/backer/24/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/24/avatar.svg"></a>
204
- <a href="https://opencollective.com/rubocop/backer/25/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/25/avatar.svg"></a>
205
- <a href="https://opencollective.com/rubocop/backer/26/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/26/avatar.svg"></a>
206
- <a href="https://opencollective.com/rubocop/backer/27/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/27/avatar.svg"></a>
207
- <a href="https://opencollective.com/rubocop/backer/28/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/28/avatar.svg"></a>
208
- <a href="https://opencollective.com/rubocop/backer/29/website" target="_blank"><img src="https://opencollective.com/rubocop/backer/29/avatar.svg"></a>
209
-
210
- ### Open Collective Sponsors
178
+ <a href="https://opencollective.com/rubocop/individual/0/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/0/avatar.svg"></a>
179
+ <a href="https://opencollective.com/rubocop/individual/1/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/1/avatar.svg"></a>
180
+ <a href="https://opencollective.com/rubocop/individual/2/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/2/avatar.svg"></a>
181
+ <a href="https://opencollective.com/rubocop/individual/3/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/3/avatar.svg"></a>
182
+ <a href="https://opencollective.com/rubocop/individual/4/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/4/avatar.svg"></a>
183
+ <a href="https://opencollective.com/rubocop/individual/5/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/5/avatar.svg"></a>
184
+ <a href="https://opencollective.com/rubocop/individual/6/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/6/avatar.svg"></a>
185
+ <a href="https://opencollective.com/rubocop/individual/7/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/7/avatar.svg"></a>
186
+ <a href="https://opencollective.com/rubocop/individual/8/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/8/avatar.svg"></a>
187
+ <a href="https://opencollective.com/rubocop/individual/9/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/9/avatar.svg"></a>
188
+ <a href="https://opencollective.com/rubocop/individual/10/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/10/avatar.svg"></a>
189
+ <a href="https://opencollective.com/rubocop/individual/11/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/11/avatar.svg"></a>
190
+ <a href="https://opencollective.com/rubocop/individual/12/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/12/avatar.svg"></a>
191
+ <a href="https://opencollective.com/rubocop/individual/13/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/13/avatar.svg"></a>
192
+ <a href="https://opencollective.com/rubocop/individual/14/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/14/avatar.svg"></a>
193
+ <a href="https://opencollective.com/rubocop/individual/15/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/15/avatar.svg"></a>
194
+ <a href="https://opencollective.com/rubocop/individual/16/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/16/avatar.svg"></a>
195
+ <a href="https://opencollective.com/rubocop/individual/17/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/17/avatar.svg"></a>
196
+ <a href="https://opencollective.com/rubocop/individual/18/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/18/avatar.svg"></a>
197
+ <a href="https://opencollective.com/rubocop/individual/19/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/19/avatar.svg"></a>
198
+ <a href="https://opencollective.com/rubocop/individual/20/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/20/avatar.svg"></a>
199
+ <a href="https://opencollective.com/rubocop/individual/21/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/21/avatar.svg"></a>
200
+ <a href="https://opencollective.com/rubocop/individual/22/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/22/avatar.svg"></a>
201
+ <a href="https://opencollective.com/rubocop/individual/23/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/23/avatar.svg"></a>
202
+ <a href="https://opencollective.com/rubocop/individual/24/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/24/avatar.svg"></a>
203
+ <a href="https://opencollective.com/rubocop/individual/25/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/25/avatar.svg"></a>
204
+ <a href="https://opencollective.com/rubocop/individual/26/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/26/avatar.svg"></a>
205
+ <a href="https://opencollective.com/rubocop/individual/27/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/27/avatar.svg"></a>
206
+ <a href="https://opencollective.com/rubocop/individual/28/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/28/avatar.svg"></a>
207
+ <a href="https://opencollective.com/rubocop/individual/29/website" target="_blank"><img src="https://opencollective.com/rubocop/individual/29/avatar.svg"></a>
208
+
209
+ ### Open Collective for Organizations
211
210
 
212
211
  Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/rubocop#sponsor)]
213
212
 
214
- <a href="https://opencollective.com/rubocop/sponsor/0/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/0/avatar.svg"></a>
215
- <a href="https://opencollective.com/rubocop/sponsor/1/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/1/avatar.svg"></a>
216
- <a href="https://opencollective.com/rubocop/sponsor/2/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/2/avatar.svg"></a>
217
- <a href="https://opencollective.com/rubocop/sponsor/3/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/3/avatar.svg"></a>
218
- <a href="https://opencollective.com/rubocop/sponsor/4/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/4/avatar.svg"></a>
219
- <a href="https://opencollective.com/rubocop/sponsor/5/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/5/avatar.svg"></a>
220
- <a href="https://opencollective.com/rubocop/sponsor/6/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/6/avatar.svg"></a>
221
- <a href="https://opencollective.com/rubocop/sponsor/7/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/7/avatar.svg"></a>
222
- <a href="https://opencollective.com/rubocop/sponsor/8/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/8/avatar.svg"></a>
223
- <a href="https://opencollective.com/rubocop/sponsor/9/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/9/avatar.svg"></a>
224
- <a href="https://opencollective.com/rubocop/sponsor/10/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/10/avatar.svg"></a>
225
- <a href="https://opencollective.com/rubocop/sponsor/11/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/11/avatar.svg"></a>
226
- <a href="https://opencollective.com/rubocop/sponsor/12/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/12/avatar.svg"></a>
227
- <a href="https://opencollective.com/rubocop/sponsor/13/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/13/avatar.svg"></a>
228
- <a href="https://opencollective.com/rubocop/sponsor/14/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/14/avatar.svg"></a>
229
- <a href="https://opencollective.com/rubocop/sponsor/15/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/15/avatar.svg"></a>
230
- <a href="https://opencollective.com/rubocop/sponsor/16/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/16/avatar.svg"></a>
231
- <a href="https://opencollective.com/rubocop/sponsor/17/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/17/avatar.svg"></a>
232
- <a href="https://opencollective.com/rubocop/sponsor/18/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/18/avatar.svg"></a>
233
- <a href="https://opencollective.com/rubocop/sponsor/19/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/19/avatar.svg"></a>
234
- <a href="https://opencollective.com/rubocop/sponsor/20/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/20/avatar.svg"></a>
235
- <a href="https://opencollective.com/rubocop/sponsor/21/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/21/avatar.svg"></a>
236
- <a href="https://opencollective.com/rubocop/sponsor/22/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/22/avatar.svg"></a>
237
- <a href="https://opencollective.com/rubocop/sponsor/23/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/23/avatar.svg"></a>
238
- <a href="https://opencollective.com/rubocop/sponsor/24/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/24/avatar.svg"></a>
239
- <a href="https://opencollective.com/rubocop/sponsor/25/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/25/avatar.svg"></a>
240
- <a href="https://opencollective.com/rubocop/sponsor/26/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/26/avatar.svg"></a>
241
- <a href="https://opencollective.com/rubocop/sponsor/27/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/27/avatar.svg"></a>
242
- <a href="https://opencollective.com/rubocop/sponsor/28/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/28/avatar.svg"></a>
243
- <a href="https://opencollective.com/rubocop/sponsor/29/website" target="_blank"><img src="https://opencollective.com/rubocop/sponsor/29/avatar.svg"></a>
213
+ <a href="https://opencollective.com/rubocop/organization/0/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/0/avatar.svg"></a>
214
+ <a href="https://opencollective.com/rubocop/organization/1/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/1/avatar.svg"></a>
215
+ <a href="https://opencollective.com/rubocop/organization/2/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/2/avatar.svg"></a>
216
+ <a href="https://opencollective.com/rubocop/organization/3/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/3/avatar.svg"></a>
217
+ <a href="https://opencollective.com/rubocop/organization/4/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/4/avatar.svg"></a>
218
+ <a href="https://opencollective.com/rubocop/organization/5/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/5/avatar.svg"></a>
219
+ <a href="https://opencollective.com/rubocop/organization/6/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/6/avatar.svg"></a>
220
+ <a href="https://opencollective.com/rubocop/organization/7/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/7/avatar.svg"></a>
221
+ <a href="https://opencollective.com/rubocop/organization/8/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/8/avatar.svg"></a>
222
+ <a href="https://opencollective.com/rubocop/organization/9/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/9/avatar.svg"></a>
223
+ <a href="https://opencollective.com/rubocop/organization/10/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/10/avatar.svg"></a>
224
+ <a href="https://opencollective.com/rubocop/organization/11/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/11/avatar.svg"></a>
225
+ <a href="https://opencollective.com/rubocop/organization/12/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/12/avatar.svg"></a>
226
+ <a href="https://opencollective.com/rubocop/organization/13/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/13/avatar.svg"></a>
227
+ <a href="https://opencollective.com/rubocop/organization/14/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/14/avatar.svg"></a>
228
+ <a href="https://opencollective.com/rubocop/organization/15/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/15/avatar.svg"></a>
229
+ <a href="https://opencollective.com/rubocop/organization/16/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/16/avatar.svg"></a>
230
+ <a href="https://opencollective.com/rubocop/organization/17/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/17/avatar.svg"></a>
231
+ <a href="https://opencollective.com/rubocop/organization/18/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/18/avatar.svg"></a>
232
+ <a href="https://opencollective.com/rubocop/organization/19/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/19/avatar.svg"></a>
233
+ <a href="https://opencollective.com/rubocop/organization/20/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/20/avatar.svg"></a>
234
+ <a href="https://opencollective.com/rubocop/organization/21/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/21/avatar.svg"></a>
235
+ <a href="https://opencollective.com/rubocop/organization/22/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/22/avatar.svg"></a>
236
+ <a href="https://opencollective.com/rubocop/organization/23/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/23/avatar.svg"></a>
237
+ <a href="https://opencollective.com/rubocop/organization/24/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/24/avatar.svg"></a>
238
+ <a href="https://opencollective.com/rubocop/organization/25/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/25/avatar.svg"></a>
239
+ <a href="https://opencollective.com/rubocop/organization/26/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/26/avatar.svg"></a>
240
+ <a href="https://opencollective.com/rubocop/organization/27/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/27/avatar.svg"></a>
241
+ <a href="https://opencollective.com/rubocop/organization/28/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/28/avatar.svg"></a>
242
+ <a href="https://opencollective.com/rubocop/organization/29/website" target="_blank"><img src="https://opencollective.com/rubocop/organization/29/avatar.svg"></a>
244
243
 
245
244
  ## Changelog
246
245
 
data/config/default.yml CHANGED
@@ -82,6 +82,8 @@ AllCops:
82
82
  StyleGuideBaseURL: https://rubystyle.guide
83
83
  # Documentation URLs will be constructed using the base URL.
84
84
  DocumentationBaseURL: https://docs.rubocop.org/rubocop
85
+ # Documentation URLs will end with this extension.
86
+ DocumentationExtension: .html
85
87
  # Extra details are not displayed in offense messages by default. Change
86
88
  # behavior by overriding ExtraDetails, or by giving the
87
89
  # `-E/--extra-details` option.
@@ -163,8 +165,14 @@ AllCops:
163
165
  rubocop-graphql: [graphql]
164
166
  rubocop-capybara: [capybara]
165
167
  rubocop-factory_bot: [factory_bot, factory_bot_rails]
168
+ rubocop-rspec_rails: [rspec-rails]
166
169
  # Enable/Disable checking the methods extended by Active Support.
167
170
  ActiveSupportExtensionsEnabled: false
171
+ # Future version of Ruby will freeze string literals by default.
172
+ # This allows to opt in early, for example when enabled through RUBYOPT.
173
+ # For now this will behave as if set to false but in future ruby versions
174
+ # (likely 4.0) it will be true by default.
175
+ StringLiteralsFrozenByDefault: ~
168
176
 
169
177
  #################### Bundler ###############################
170
178
 
@@ -261,6 +269,15 @@ Bundler/OrderedGems:
261
269
 
262
270
  #################### Gemspec ###############################
263
271
 
272
+ Gemspec/AddRuntimeDependency:
273
+ Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
274
+ StyleGuide: '#add_dependency_vs_add_runtime_dependency'
275
+ Reference: https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
276
+ Enabled: pending
277
+ VersionAdded: '1.65'
278
+ Include:
279
+ - '**/*.gemspec'
280
+
264
281
  Gemspec/DependencyVersion:
265
282
  Description: 'Requires or forbids specifying gem dependency versions.'
266
283
  Enabled: false
@@ -844,6 +861,7 @@ Layout/FirstMethodArgumentLineBreak:
844
861
  Enabled: false
845
862
  VersionAdded: '0.49'
846
863
  AllowMultilineFinalElement: false
864
+ AllowedMethods: []
847
865
 
848
866
  Layout/FirstMethodParameterLineBreak:
849
867
  Description: >-
@@ -1019,6 +1037,7 @@ Layout/LeadingCommentSpace:
1019
1037
  VersionChanged: '0.73'
1020
1038
  AllowDoxygenCommentStyle: false
1021
1039
  AllowGemfileRubyComment: false
1040
+ AllowRBSInlineAnnotation: false
1022
1041
 
1023
1042
  Layout/LeadingEmptyLines:
1024
1043
  Description: Check for unnecessary blank lines at the beginning of a file.
@@ -1657,7 +1676,7 @@ Lint/Debugger:
1657
1676
  Description: 'Check for debugger calls.'
1658
1677
  Enabled: true
1659
1678
  VersionAdded: '0.14'
1660
- VersionChanged: '1.46'
1679
+ VersionChanged: '1.63'
1661
1680
  DebuggerMethods:
1662
1681
  # Groups are available so that a specific group can be disabled in
1663
1682
  # a user's configuration, but are otherwise not significant.
@@ -1670,8 +1689,14 @@ Lint/Debugger:
1670
1689
  - Kernel.byebug
1671
1690
  - Kernel.remote_byebug
1672
1691
  Capybara:
1692
+ - page.save_and_open_page
1693
+ - page.save_and_open_screenshot
1694
+ - page.save_page
1695
+ - page.save_screenshot
1673
1696
  - save_and_open_page
1674
1697
  - save_and_open_screenshot
1698
+ - save_page
1699
+ - save_screenshot
1675
1700
  debug.rb:
1676
1701
  - binding.b
1677
1702
  - binding.break
@@ -1693,6 +1718,10 @@ Lint/Debugger:
1693
1718
  - jard
1694
1719
  WebConsole:
1695
1720
  - binding.console
1721
+ DebuggerRequires:
1722
+ debug.rb:
1723
+ - debug/open
1724
+ - debug/start
1696
1725
 
1697
1726
  Lint/DeprecatedClassMethods:
1698
1727
  Description: 'Check for deprecated class method calls.'
@@ -1805,6 +1834,11 @@ Lint/DuplicateRescueException:
1805
1834
  Enabled: true
1806
1835
  VersionAdded: '0.89'
1807
1836
 
1837
+ Lint/DuplicateSetElement:
1838
+ Description: 'Checks for duplicate elements in Set.'
1839
+ Enabled: pending
1840
+ VersionAdded: '1.67'
1841
+
1808
1842
  Lint/EachWithObjectArgument:
1809
1843
  Description: 'Check for immutable argument given to each_with_object.'
1810
1844
  Enabled: true
@@ -2300,9 +2334,9 @@ Lint/SafeNavigationChain:
2300
2334
 
2301
2335
  Lint/SafeNavigationConsistency:
2302
2336
  Description: >-
2303
- Check to make sure that if safe navigation is used for a method
2304
- call in an `&&` or `||` condition that safe navigation is used
2305
- for all method calls on that same object.
2337
+ Check to make sure that if safe navigation is used in an `&&` or `||` condition,
2338
+ consistent and appropriate safe navigation, without excess or deficiency,
2339
+ is used for all method calls on the same object.
2306
2340
  Enabled: true
2307
2341
  VersionAdded: '0.55'
2308
2342
  VersionChanged: '0.77'
@@ -2516,8 +2550,7 @@ Lint/UselessAssignment:
2516
2550
  Enabled: true
2517
2551
  AutoCorrect: contextual
2518
2552
  VersionAdded: '0.11'
2519
- VersionChanged: '1.61'
2520
- SafeAutoCorrect: false
2553
+ VersionChanged: '1.66'
2521
2554
 
2522
2555
  Lint/UselessElseWithoutRescue:
2523
2556
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
@@ -2533,6 +2566,11 @@ Lint/UselessMethodDefinition:
2533
2566
  VersionChanged: '1.61'
2534
2567
  Safe: false
2535
2568
 
2569
+ Lint/UselessNumericOperation:
2570
+ Description: 'Checks for useless numeric operations.'
2571
+ Enabled: pending
2572
+ VersionAdded: '1.66'
2573
+
2536
2574
  Lint/UselessRescue:
2537
2575
  Description: 'Checks for useless `rescue`s.'
2538
2576
  Enabled: pending
@@ -2606,8 +2644,9 @@ Metrics/BlockNesting:
2606
2644
  StyleGuide: '#three-is-the-number-thou-shalt-count'
2607
2645
  Enabled: true
2608
2646
  VersionAdded: '0.25'
2609
- VersionChanged: '0.47'
2647
+ VersionChanged: '1.65'
2610
2648
  CountBlocks: false
2649
+ CountModifierForms: false
2611
2650
  Max: 3
2612
2651
 
2613
2652
  Metrics/ClassLength:
@@ -2762,7 +2801,8 @@ Naming/FileName:
2762
2801
  VersionChanged: '1.23'
2763
2802
  # Camel case file names listed in `AllCops:Include` and all file names listed
2764
2803
  # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
2765
- Exclude: []
2804
+ Exclude:
2805
+ - Rakefile.rb
2766
2806
  # When `true`, requires that each source file should define a class or module
2767
2807
  # with a name which matches the file name (converted to ... case).
2768
2808
  # It further expects it to be nested inside modules which match the names
@@ -3078,6 +3118,7 @@ Style/AccessModifierDeclarations:
3078
3118
  - inline
3079
3119
  - group
3080
3120
  AllowModifiersOnSymbols: true
3121
+ AllowModifiersOnAttrs: true
3081
3122
  SafeAutoCorrect: false
3082
3123
 
3083
3124
  Style/AccessorGrouping:
@@ -3675,6 +3716,7 @@ Style/DocumentationMethod:
3675
3716
  Description: 'Checks for missing documentation comment for public methods.'
3676
3717
  Enabled: false
3677
3718
  VersionAdded: '0.43'
3719
+ AllowedMethods: []
3678
3720
  Exclude:
3679
3721
  - 'spec/**/*'
3680
3722
  - 'test/**/*'
@@ -4034,7 +4076,7 @@ Style/HashSyntax:
4034
4076
  StyleGuide: '#hash-literals'
4035
4077
  Enabled: true
4036
4078
  VersionAdded: '0.9'
4037
- VersionChanged: '1.24'
4079
+ VersionChanged: '1.67'
4038
4080
  EnforcedStyle: ruby19
4039
4081
  SupportedStyles:
4040
4082
  # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
@@ -4046,7 +4088,7 @@ Style/HashSyntax:
4046
4088
  # enforces both ruby19 and no_mixed_keys styles
4047
4089
  - ruby19_no_mixed_keys
4048
4090
  # Force hashes that have a hash value omission
4049
- EnforcedShorthandSyntax: always
4091
+ EnforcedShorthandSyntax: either
4050
4092
  SupportedShorthandSyntax:
4051
4093
  # forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
4052
4094
  - always
@@ -4056,6 +4098,8 @@ Style/HashSyntax:
4056
4098
  - either
4057
4099
  # forces use of the 3.1 syntax only if all values can be omitted in the hash.
4058
4100
  - consistent
4101
+ # allow either (implicit or explicit) syntax but enforce consistency within a single hash
4102
+ - either_consistent
4059
4103
  # Force hashes that have a symbol value to use hash rockets
4060
4104
  UseHashRocketsWithSymbolValues: false
4061
4105
  # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
@@ -4276,6 +4320,14 @@ Style/MapCompactWithConditionalBlock:
4276
4320
  Enabled: pending
4277
4321
  VersionAdded: '1.30'
4278
4322
 
4323
+ Style/MapIntoArray:
4324
+ Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
4325
+ StyleGuide: '#functional-code'
4326
+ Enabled: pending
4327
+ VersionAdded: '1.63'
4328
+ VersionChanged: '1.67'
4329
+ Safe: false
4330
+
4279
4331
  Style/MapToHash:
4280
4332
  Description: 'Prefer `to_h` with a block over `map.to_h`.'
4281
4333
  Enabled: pending
@@ -5018,6 +5070,11 @@ Style/RedundantInterpolation:
5018
5070
  VersionAdded: '0.76'
5019
5071
  VersionChanged: '1.30'
5020
5072
 
5073
+ Style/RedundantInterpolationUnfreeze:
5074
+ Description: 'Checks for redundant unfreezing of interpolated strings.'
5075
+ Enabled: pending
5076
+ VersionAdded: '1.66'
5077
+
5021
5078
  Style/RedundantLineContinuation:
5022
5079
  Description: 'Check for redundant line continuation.'
5023
5080
  Enabled: pending
@@ -5159,6 +5216,7 @@ Style/ReturnNilInPredicateMethodDefinition:
5159
5216
  AllowedMethods: []
5160
5217
  AllowedPatterns: []
5161
5218
  VersionAdded: '1.53'
5219
+ VersionChanged: '1.67'
5162
5220
 
5163
5221
  Style/SafeNavigation:
5164
5222
  Description: >-
@@ -5169,7 +5227,7 @@ Style/SafeNavigation:
5169
5227
  be `nil` or truthy, but never `false`.
5170
5228
  Enabled: true
5171
5229
  VersionAdded: '0.43'
5172
- VersionChanged: '1.27'
5230
+ VersionChanged: '1.67'
5173
5231
  # Safe navigation may cause a statement to start returning `nil` in addition
5174
5232
  # to whatever it used to return.
5175
5233
  ConvertCodeThatCanStartToReturnNil: false
@@ -5221,6 +5279,13 @@ Style/Send:
5221
5279
  Enabled: false
5222
5280
  VersionAdded: '0.33'
5223
5281
 
5282
+ Style/SendWithLiteralMethodName:
5283
+ Description: 'Detects the use of the `public_send` method with a static method name argument.'
5284
+ Enabled: pending
5285
+ Safe: false
5286
+ AllowSend: true
5287
+ VersionAdded: '1.64'
5288
+
5224
5289
  Style/SignalException:
5225
5290
  Description: 'Checks for proper usage of fail and raise.'
5226
5291
  StyleGuide: '#prefer-raise-over-fail'
@@ -5395,6 +5460,11 @@ Style/StructInheritance:
5395
5460
  VersionAdded: '0.29'
5396
5461
  VersionChanged: '1.20'
5397
5462
 
5463
+ Style/SuperArguments:
5464
+ Description: 'Call `super` without arguments and parentheses when the signature is identical.'
5465
+ Enabled: pending
5466
+ VersionAdded: '1.64'
5467
+
5398
5468
  Style/SuperWithArgsParentheses:
5399
5469
  Description: 'Use parentheses for `super` with arguments.'
5400
5470
  StyleGuide: '#super-with-args'
@@ -5430,7 +5500,7 @@ Style/SymbolProc:
5430
5500
  Enabled: true
5431
5501
  Safe: false
5432
5502
  VersionAdded: '0.26'
5433
- VersionChanged: '1.40'
5503
+ VersionChanged: '1.64'
5434
5504
  AllowMethodsWithArguments: false
5435
5505
  # A list of method names to be always allowed by the check.
5436
5506
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
@@ -0,0 +1,11 @@
1
+ # Configuration for InternalAffairs cops. This file will be
2
+ # automatically loaded when `rubocop/cop/internal_affairs` is required.
3
+ # Only do this when developing custom cops or a RuboCop extension.
4
+
5
+ InternalAffairs/CopDescription:
6
+ Include:
7
+ - 'lib/rubocop/cop/**/*.rb'
8
+
9
+ InternalAffairs/UselessMessageAssertion:
10
+ Include:
11
+ - '**/*_spec.rb'
data/exe/rubocop CHANGED
@@ -11,13 +11,14 @@ exit exit_status if server_cli.exit?
11
11
  if RuboCop::Server.running?
12
12
  exit_status = RuboCop::Server::ClientCommand::Exec.new.run
13
13
  else
14
- require 'benchmark'
15
14
  require 'rubocop'
16
15
 
17
16
  cli = RuboCop::CLI.new
18
17
 
19
- time = Benchmark.realtime { exit_status = cli.run }
18
+ time_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
19
+ exit_status = cli.run
20
+ elapsed_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - time_start
20
21
 
21
- puts "Finished in #{time} seconds" if cli.options[:debug] || cli.options[:display_time]
22
+ puts "Finished in #{elapsed_time} seconds" if cli.options[:debug] || cli.options[:display_time]
22
23
  end
23
24
  exit exit_status
@@ -48,11 +48,19 @@ module RuboCop
48
48
  source_buffer = Parser::Source::Buffer.new(@filename)
49
49
  source_buffer.source = File.read(@filename, encoding: Encoding::UTF_8)
50
50
  offenses.map! do |o|
51
- location = Parser::Source::Range.new(source_buffer,
52
- o['location']['begin_pos'],
53
- o['location']['end_pos'])
51
+ location = location_from_source_buffer(o, source_buffer)
54
52
  Cop::Offense.new(o['severity'], location, o['message'], o['cop_name'], o['status'].to_sym)
55
53
  end
56
54
  end
55
+
56
+ def location_from_source_buffer(offense, source_buffer)
57
+ begin_pos = offense['location']['begin_pos']
58
+ end_pos = offense['location']['end_pos']
59
+ if begin_pos.zero? && end_pos.zero?
60
+ Cop::Offense::NO_LOCATION
61
+ else
62
+ Parser::Source::Range.new(source_buffer, begin_pos, end_pos)
63
+ end
64
+ end
57
65
  end
58
66
  end
@@ -151,16 +151,15 @@ module RuboCop
151
151
  end
152
152
 
153
153
  def relative_path_to_todo_from_options_config
154
- return AUTO_GENERATED_FILE if !@options[:config] || options_config_in_root?
154
+ return AUTO_GENERATED_FILE unless @options[:config]
155
155
 
156
- base = Pathname.new('.')
157
- config_dir = Pathname.new(File.dirname(@options[:config]))
156
+ base = Pathname.new(Dir.pwd)
157
+ config_dir = Pathname.new(@options[:config]).realpath.dirname
158
158
 
159
- "#{base.relative_path_from(config_dir)}/#{AUTO_GENERATED_FILE}"
160
- end
159
+ # Don't have the path start with `/`
160
+ return AUTO_GENERATED_FILE if config_dir == base
161
161
 
162
- def options_config_in_root?
163
- File.dirname(@options[:config]) == '.'
162
+ "#{base.relative_path_from(config_dir)}/#{AUTO_GENERATED_FILE}"
164
163
  end
165
164
  end
166
165
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../../lsp/server'
4
-
5
3
  module RuboCop
6
4
  class CLI
7
5
  module Command
@@ -11,6 +9,8 @@ module RuboCop
11
9
  self.command_name = :lsp
12
10
 
13
11
  def run
12
+ # Load on demand, `languge-server-protocol` is heavy to require.
13
+ require_relative '../../lsp/server'
14
14
  RuboCop::LSP::Server.new(@config_store).start
15
15
  end
16
16
  end
@@ -26,10 +26,10 @@ module RuboCop
26
26
 
27
27
  cops_array.each do |cop_name|
28
28
  cop = registry_hash[cop_name]
29
-
30
29
  next if cop.empty?
31
30
 
32
- puts Cop::Documentation.url_for(cop.first, @config)
31
+ url = Cop::Documentation.url_for(cop.first, @config)
32
+ puts url if url
33
33
  end
34
34
 
35
35
  puts
data/lib/rubocop/cli.rb CHANGED
@@ -57,6 +57,10 @@ module RuboCop
57
57
  rescue RuboCop::Error => e
58
58
  warn Rainbow("Error: #{e.message}").red
59
59
  STATUS_ERROR
60
+ rescue Interrupt
61
+ warn ''
62
+ warn 'Exiting...'
63
+ STATUS_INTERRUPTED
60
64
  rescue Finished
61
65
  STATUS_SUCCESS
62
66
  rescue OptionParser::InvalidOption => e
@@ -4,7 +4,7 @@ module RuboCop
4
4
  # This class parses the special `rubocop:disable` comments in a source
5
5
  # and provides a way to check if each cop is enabled at arbitrary line.
6
6
  class CommentConfig
7
- extend Forwardable
7
+ extend SimpleForwardable
8
8
 
9
9
  CONFIG_DISABLED_LINE_RANGE_MIN = -Float::INFINITY
10
10