rubocop 0.82.0 → 1.18.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (744) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +69 -37
  4. data/assets/output.html.erb +1 -1
  5. data/config/default.yml +1025 -139
  6. data/config/obsoletion.yml +200 -0
  7. data/exe/rubocop +2 -4
  8. data/lib/rubocop.rb +137 -68
  9. data/lib/rubocop/ast_aliases.rb +8 -0
  10. data/lib/rubocop/cached_data.rb +4 -4
  11. data/lib/rubocop/cli.rb +11 -11
  12. data/lib/rubocop/cli/command.rb +1 -0
  13. data/lib/rubocop/cli/command/auto_genenerate_config.rb +46 -19
  14. data/lib/rubocop/cli/command/base.rb +2 -0
  15. data/lib/rubocop/cli/command/execute_runner.rb +36 -12
  16. data/lib/rubocop/cli/command/init_dotfile.rb +3 -4
  17. data/lib/rubocop/cli/command/show_cops.rb +6 -12
  18. data/lib/rubocop/cli/command/suggest_extensions.rb +81 -0
  19. data/lib/rubocop/cli/command/version.rb +3 -2
  20. data/lib/rubocop/cli/environment.rb +1 -0
  21. data/lib/rubocop/comment_config.rb +54 -103
  22. data/lib/rubocop/config.rb +45 -29
  23. data/lib/rubocop/config_loader.rb +101 -106
  24. data/lib/rubocop/config_loader_resolver.rb +100 -29
  25. data/lib/rubocop/config_obsoletion.rb +67 -242
  26. data/lib/rubocop/config_obsoletion/changed_enforced_styles.rb +33 -0
  27. data/lib/rubocop/config_obsoletion/changed_parameter.rb +21 -0
  28. data/lib/rubocop/config_obsoletion/cop_rule.rb +33 -0
  29. data/lib/rubocop/config_obsoletion/extracted_cop.rb +44 -0
  30. data/lib/rubocop/config_obsoletion/parameter_rule.rb +44 -0
  31. data/lib/rubocop/config_obsoletion/removed_cop.rb +41 -0
  32. data/lib/rubocop/config_obsoletion/renamed_cop.rb +34 -0
  33. data/lib/rubocop/config_obsoletion/rule.rb +41 -0
  34. data/lib/rubocop/config_obsoletion/split_cop.rb +27 -0
  35. data/lib/rubocop/config_regeneration.rb +33 -0
  36. data/lib/rubocop/config_store.rb +31 -7
  37. data/lib/rubocop/config_validator.rb +53 -28
  38. data/lib/rubocop/cop/autocorrect_logic.rb +37 -38
  39. data/lib/rubocop/cop/badge.rb +11 -27
  40. data/lib/rubocop/cop/base.rb +450 -0
  41. data/lib/rubocop/cop/bundler/duplicated_gem.rb +31 -7
  42. data/lib/rubocop/cop/bundler/gem_comment.rb +117 -10
  43. data/lib/rubocop/cop/bundler/gem_version.rb +133 -0
  44. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +13 -20
  45. data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -4
  46. data/lib/rubocop/cop/commissioner.rb +98 -74
  47. data/lib/rubocop/cop/cop.rb +84 -234
  48. data/lib/rubocop/cop/corrector.rb +41 -119
  49. data/lib/rubocop/cop/correctors/alignment_corrector.rb +11 -21
  50. data/lib/rubocop/cop/correctors/condition_corrector.rb +3 -5
  51. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +2 -4
  52. data/lib/rubocop/cop/correctors/empty_line_corrector.rb +9 -10
  53. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +1 -2
  54. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +1 -1
  55. data/lib/rubocop/cop/correctors/line_break_corrector.rb +8 -11
  56. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +35 -6
  57. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -3
  58. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -8
  59. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -21
  60. data/lib/rubocop/cop/correctors/punctuation_corrector.rb +8 -10
  61. data/lib/rubocop/cop/correctors/space_corrector.rb +1 -3
  62. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +6 -8
  63. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +15 -18
  64. data/lib/rubocop/cop/documentation.rb +22 -0
  65. data/lib/rubocop/cop/exclude_limit.rb +26 -0
  66. data/lib/rubocop/cop/force.rb +2 -1
  67. data/lib/rubocop/cop/gemspec/date_assignment.rb +57 -0
  68. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +6 -5
  69. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +3 -7
  70. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +48 -20
  71. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +4 -2
  72. data/lib/rubocop/cop/generator.rb +12 -22
  73. data/lib/rubocop/cop/generator/configuration_injector.rb +4 -5
  74. data/lib/rubocop/cop/generator/require_file_injector.rb +2 -5
  75. data/lib/rubocop/cop/ignored_node.rb +1 -3
  76. data/lib/rubocop/cop/internal_affairs.rb +7 -1
  77. data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +68 -0
  78. data/lib/rubocop/cop/internal_affairs/example_description.rb +92 -0
  79. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +8 -17
  80. data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +4 -4
  81. data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +151 -0
  82. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +11 -14
  83. data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +12 -10
  84. data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +62 -0
  85. data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +65 -0
  86. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +12 -7
  87. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +11 -8
  88. data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +148 -0
  89. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +6 -6
  90. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +12 -10
  91. data/lib/rubocop/cop/layout/argument_alignment.rb +36 -19
  92. data/lib/rubocop/cop/layout/array_alignment.rb +10 -8
  93. data/lib/rubocop/cop/layout/assignment_indentation.rb +8 -7
  94. data/lib/rubocop/cop/layout/begin_end_alignment.rb +74 -0
  95. data/lib/rubocop/cop/layout/block_alignment.rb +36 -44
  96. data/lib/rubocop/cop/layout/block_end_newline.rb +4 -8
  97. data/lib/rubocop/cop/layout/case_indentation.rb +72 -30
  98. data/lib/rubocop/cop/layout/class_structure.rb +62 -74
  99. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +4 -6
  100. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +24 -30
  101. data/lib/rubocop/cop/layout/comment_indentation.rb +22 -26
  102. data/lib/rubocop/cop/layout/condition_position.rb +16 -8
  103. data/lib/rubocop/cop/layout/def_end_alignment.rb +9 -10
  104. data/lib/rubocop/cop/layout/dot_position.rb +26 -21
  105. data/lib/rubocop/cop/layout/else_alignment.rb +25 -11
  106. data/lib/rubocop/cop/layout/empty_comment.rb +29 -29
  107. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +51 -36
  108. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +13 -13
  109. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +136 -0
  110. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +140 -40
  111. data/lib/rubocop/cop/layout/empty_lines.rb +7 -12
  112. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +29 -38
  113. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +13 -9
  114. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +118 -0
  115. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +2 -5
  116. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +2 -5
  117. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +2 -5
  118. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +4 -14
  119. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +2 -5
  120. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +2 -5
  121. data/lib/rubocop/cop/layout/end_alignment.rb +24 -23
  122. data/lib/rubocop/cop/layout/end_of_line.rb +8 -8
  123. data/lib/rubocop/cop/layout/extra_spacing.rb +23 -42
  124. data/lib/rubocop/cop/layout/first_argument_indentation.rb +40 -13
  125. data/lib/rubocop/cop/layout/first_array_element_indentation.rb +13 -13
  126. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +4 -8
  127. data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +36 -20
  128. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +3 -7
  129. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +6 -13
  130. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +3 -7
  131. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +9 -8
  132. data/lib/rubocop/cop/layout/hash_alignment.rb +76 -57
  133. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +45 -29
  134. data/lib/rubocop/cop/layout/heredoc_indentation.rb +32 -116
  135. data/lib/rubocop/cop/layout/indentation_consistency.rb +9 -6
  136. data/lib/rubocop/cop/layout/indentation_style.rb +25 -32
  137. data/lib/rubocop/cop/layout/indentation_width.rb +34 -15
  138. data/lib/rubocop/cop/layout/initial_indentation.rb +7 -11
  139. data/lib/rubocop/cop/layout/leading_comment_space.rb +12 -10
  140. data/lib/rubocop/cop/layout/leading_empty_lines.rb +6 -11
  141. data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +122 -0
  142. data/lib/rubocop/cop/layout/line_length.rb +37 -47
  143. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +8 -11
  144. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +3 -7
  145. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +38 -16
  146. data/lib/rubocop/cop/layout/multiline_block_layout.rb +41 -37
  147. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +8 -11
  148. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +3 -7
  149. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +6 -13
  150. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +8 -11
  151. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +29 -18
  152. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +8 -11
  153. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +26 -12
  154. data/lib/rubocop/cop/layout/parameter_alignment.rb +8 -7
  155. data/lib/rubocop/cop/layout/redundant_line_break.rb +139 -0
  156. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +37 -30
  157. data/lib/rubocop/cop/layout/single_line_block_chain.rb +53 -0
  158. data/lib/rubocop/cop/layout/space_after_colon.rb +10 -8
  159. data/lib/rubocop/cop/layout/space_after_comma.rb +2 -5
  160. data/lib/rubocop/cop/layout/space_after_method_name.rb +7 -10
  161. data/lib/rubocop/cop/layout/space_after_not.rb +9 -11
  162. data/lib/rubocop/cop/layout/space_after_semicolon.rb +2 -5
  163. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +45 -52
  164. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +19 -23
  165. data/lib/rubocop/cop/layout/space_around_keyword.rb +50 -26
  166. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +34 -69
  167. data/lib/rubocop/cop/layout/space_around_operators.rb +51 -25
  168. data/lib/rubocop/cop/layout/space_before_block_braces.rb +39 -23
  169. data/lib/rubocop/cop/layout/space_before_brackets.rb +65 -0
  170. data/lib/rubocop/cop/layout/space_before_comma.rb +3 -5
  171. data/lib/rubocop/cop/layout/space_before_comment.rb +8 -9
  172. data/lib/rubocop/cop/layout/space_before_first_arg.rb +9 -15
  173. data/lib/rubocop/cop/layout/space_before_semicolon.rb +2 -5
  174. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +11 -21
  175. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +30 -39
  176. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +5 -15
  177. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +32 -37
  178. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +22 -41
  179. data/lib/rubocop/cop/layout/space_inside_parens.rb +39 -22
  180. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +5 -10
  181. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +8 -17
  182. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +18 -29
  183. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +12 -13
  184. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +10 -15
  185. data/lib/rubocop/cop/layout/trailing_whitespace.rb +42 -18
  186. data/lib/rubocop/cop/legacy/corrections_proxy.rb +43 -0
  187. data/lib/rubocop/cop/legacy/corrector.rb +27 -0
  188. data/lib/rubocop/cop/lint/ambiguous_assignment.rb +54 -0
  189. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +21 -9
  190. data/lib/rubocop/cop/lint/ambiguous_operator.rb +53 -5
  191. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +36 -6
  192. data/lib/rubocop/cop/lint/assignment_in_condition.rb +2 -2
  193. data/lib/rubocop/cop/lint/big_decimal_new.rb +10 -10
  194. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +55 -0
  195. data/lib/rubocop/cop/lint/boolean_symbol.rb +21 -13
  196. data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
  197. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +100 -0
  198. data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
  199. data/lib/rubocop/cop/lint/debugger.rb +61 -21
  200. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +86 -47
  201. data/lib/rubocop/cop/lint/deprecated_constants.rb +80 -0
  202. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +148 -0
  203. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +8 -2
  204. data/lib/rubocop/cop/lint/duplicate_branch.rb +155 -0
  205. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +3 -13
  206. data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +39 -0
  207. data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -4
  208. data/lib/rubocop/cop/lint/duplicate_methods.rb +12 -16
  209. data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +77 -0
  210. data/lib/rubocop/cop/lint/duplicate_require.rb +47 -0
  211. data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +47 -0
  212. data/lib/rubocop/cop/lint/each_with_object_argument.rb +3 -1
  213. data/lib/rubocop/cop/lint/else_layout.rb +29 -5
  214. data/lib/rubocop/cop/lint/empty_block.rb +98 -0
  215. data/lib/rubocop/cop/lint/empty_class.rb +93 -0
  216. data/lib/rubocop/cop/lint/empty_conditional_body.rb +67 -0
  217. data/lib/rubocop/cop/lint/empty_ensure.rb +5 -7
  218. data/lib/rubocop/cop/lint/empty_expression.rb +2 -2
  219. data/lib/rubocop/cop/lint/empty_file.rb +48 -0
  220. data/lib/rubocop/cop/lint/empty_in_pattern.rb +62 -0
  221. data/lib/rubocop/cop/lint/empty_interpolation.rb +4 -7
  222. data/lib/rubocop/cop/lint/empty_when.rb +31 -8
  223. data/lib/rubocop/cop/lint/ensure_return.rb +29 -16
  224. data/lib/rubocop/cop/lint/erb_new_arguments.rb +18 -20
  225. data/lib/rubocop/cop/lint/flip_flop.rb +9 -3
  226. data/lib/rubocop/cop/lint/float_comparison.rb +93 -0
  227. data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -3
  228. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +45 -10
  229. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +38 -0
  230. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +14 -16
  231. data/lib/rubocop/cop/lint/identity_comparison.rb +51 -0
  232. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +6 -6
  233. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +14 -20
  234. data/lib/rubocop/cop/lint/inherit_exception.rb +14 -9
  235. data/lib/rubocop/cop/lint/interpolation_check.rb +20 -7
  236. data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +44 -0
  237. data/lib/rubocop/cop/lint/literal_as_condition.rb +37 -16
  238. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +44 -15
  239. data/lib/rubocop/cop/lint/loop.rb +25 -5
  240. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +35 -23
  241. data/lib/rubocop/cop/lint/missing_super.rb +101 -0
  242. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +36 -0
  243. data/lib/rubocop/cop/lint/multiple_comparison.rb +14 -14
  244. data/lib/rubocop/cop/lint/nested_method_definition.rb +19 -23
  245. data/lib/rubocop/cop/lint/nested_percent_literal.rb +18 -6
  246. data/lib/rubocop/cop/lint/next_without_accumulator.rb +2 -1
  247. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +58 -0
  248. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +95 -15
  249. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +12 -9
  250. data/lib/rubocop/cop/lint/number_conversion.rb +97 -23
  251. data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +47 -0
  252. data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +39 -0
  253. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +12 -15
  254. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +96 -0
  255. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +31 -12
  256. data/lib/rubocop/cop/lint/percent_string_array.rb +6 -11
  257. data/lib/rubocop/cop/lint/percent_symbol_array.rb +13 -14
  258. data/lib/rubocop/cop/lint/raise_exception.rb +19 -7
  259. data/lib/rubocop/cop/lint/rand_one.rb +5 -4
  260. data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +142 -115
  261. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +44 -30
  262. data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +50 -0
  263. data/lib/rubocop/cop/lint/redundant_require_statement.rb +9 -10
  264. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +77 -0
  265. data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +72 -35
  266. data/lib/rubocop/cop/lint/redundant_string_coercion.rb +8 -15
  267. data/lib/rubocop/cop/lint/redundant_with_index.rb +13 -18
  268. data/lib/rubocop/cop/lint/redundant_with_object.rb +13 -18
  269. data/lib/rubocop/cop/lint/regexp_as_condition.rb +4 -2
  270. data/lib/rubocop/cop/lint/require_parentheses.rb +4 -6
  271. data/lib/rubocop/cop/lint/rescue_exception.rb +3 -4
  272. data/lib/rubocop/cop/lint/rescue_type.rb +10 -16
  273. data/lib/rubocop/cop/lint/return_in_void_context.rb +3 -6
  274. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +5 -8
  275. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +15 -17
  276. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +12 -4
  277. data/lib/rubocop/cop/lint/script_permission.rb +10 -7
  278. data/lib/rubocop/cop/lint/self_assignment.rb +78 -0
  279. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +11 -19
  280. data/lib/rubocop/cop/lint/shadowed_argument.rb +8 -14
  281. data/lib/rubocop/cop/lint/shadowed_exception.rb +18 -30
  282. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +21 -7
  283. data/lib/rubocop/cop/lint/struct_new_override.rb +4 -3
  284. data/lib/rubocop/cop/lint/suppressed_exception.rb +53 -6
  285. data/lib/rubocop/cop/lint/symbol_conversion.rb +178 -0
  286. data/lib/rubocop/cop/lint/syntax.rb +11 -30
  287. data/lib/rubocop/cop/lint/to_enum_arguments.rb +89 -0
  288. data/lib/rubocop/cop/lint/to_json.rb +21 -13
  289. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +34 -0
  290. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +55 -0
  291. data/lib/rubocop/cop/lint/triple_quotes.rb +71 -0
  292. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +5 -7
  293. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +85 -0
  294. data/lib/rubocop/cop/lint/unified_integer.rb +5 -6
  295. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +204 -0
  296. data/lib/rubocop/cop/lint/unreachable_code.rb +5 -7
  297. data/lib/rubocop/cop/lint/unreachable_loop.rb +196 -0
  298. data/lib/rubocop/cop/lint/unused_block_argument.rb +18 -11
  299. data/lib/rubocop/cop/lint/unused_method_argument.rb +11 -6
  300. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +5 -2
  301. data/lib/rubocop/cop/lint/uri_regexp.rb +12 -47
  302. data/lib/rubocop/cop/lint/useless_access_modifier.rb +38 -22
  303. data/lib/rubocop/cop/lint/useless_assignment.rb +10 -14
  304. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +7 -11
  305. data/lib/rubocop/cop/lint/useless_method_definition.rb +68 -0
  306. data/lib/rubocop/cop/lint/useless_setter_call.rb +12 -10
  307. data/lib/rubocop/cop/lint/useless_times.rb +109 -0
  308. data/lib/rubocop/cop/lint/void.rb +8 -19
  309. data/lib/rubocop/cop/message_annotator.rb +5 -4
  310. data/lib/rubocop/cop/metrics/abc_size.rb +26 -2
  311. data/lib/rubocop/cop/metrics/block_length.rb +40 -10
  312. data/lib/rubocop/cop/metrics/block_nesting.rb +5 -10
  313. data/lib/rubocop/cop/metrics/class_length.rb +40 -11
  314. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +38 -6
  315. data/lib/rubocop/cop/metrics/method_length.rb +32 -4
  316. data/lib/rubocop/cop/metrics/module_length.rb +29 -9
  317. data/lib/rubocop/cop/metrics/parameter_lists.rb +74 -11
  318. data/lib/rubocop/cop/metrics/perceived_complexity.rb +7 -9
  319. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +76 -15
  320. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +160 -0
  321. data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
  322. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +143 -0
  323. data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +42 -0
  324. data/lib/rubocop/cop/migration/department_name.rb +25 -29
  325. data/lib/rubocop/cop/mixin/alignment.rb +18 -11
  326. data/lib/rubocop/cop/mixin/allowed_identifiers.rb +18 -0
  327. data/lib/rubocop/cop/mixin/allowed_methods.rb +21 -0
  328. data/lib/rubocop/cop/mixin/annotation_comment.rb +5 -0
  329. data/lib/rubocop/cop/mixin/array_min_size.rb +2 -4
  330. data/lib/rubocop/cop/mixin/auto_corrector.rb +12 -0
  331. data/lib/rubocop/cop/mixin/check_line_breakable.rb +51 -18
  332. data/lib/rubocop/cop/mixin/code_length.rb +29 -8
  333. data/lib/rubocop/cop/mixin/comments_help.rb +42 -0
  334. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +3 -5
  335. data/lib/rubocop/cop/mixin/configurable_formatting.rb +4 -11
  336. data/lib/rubocop/cop/mixin/configurable_max.rb +1 -0
  337. data/lib/rubocop/cop/mixin/configurable_naming.rb +2 -2
  338. data/lib/rubocop/cop/mixin/configurable_numbering.rb +4 -3
  339. data/lib/rubocop/cop/mixin/def_node.rb +3 -5
  340. data/lib/rubocop/cop/mixin/documentation_comment.rb +4 -7
  341. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +14 -14
  342. data/lib/rubocop/cop/mixin/empty_parameter.rb +2 -1
  343. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +11 -2
  344. data/lib/rubocop/cop/mixin/enforce_superclass.rb +16 -8
  345. data/lib/rubocop/cop/mixin/first_element_line_break.rb +3 -3
  346. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +14 -5
  347. data/lib/rubocop/cop/mixin/gem_declaration.rb +13 -0
  348. data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +17 -9
  349. data/lib/rubocop/cop/mixin/hash_transform_method.rb +48 -31
  350. data/lib/rubocop/cop/mixin/ignored_methods.rb +36 -3
  351. data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
  352. data/lib/rubocop/cop/mixin/interpolation.rb +1 -3
  353. data/lib/rubocop/cop/mixin/line_length_help.rb +17 -15
  354. data/lib/rubocop/cop/mixin/match_range.rb +2 -5
  355. data/lib/rubocop/cop/mixin/method_complexity.rb +21 -6
  356. data/lib/rubocop/cop/mixin/method_preference.rb +1 -2
  357. data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +4 -3
  358. data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +1 -1
  359. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +13 -42
  360. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +14 -14
  361. data/lib/rubocop/cop/mixin/negative_conditional.rb +6 -4
  362. data/lib/rubocop/cop/mixin/nil_methods.rb +3 -5
  363. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +7 -5
  364. data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
  365. data/lib/rubocop/cop/mixin/percent_array.rb +14 -9
  366. data/lib/rubocop/cop/mixin/percent_literal.rb +0 -6
  367. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +6 -12
  368. data/lib/rubocop/cop/mixin/preferred_delimiters.rb +6 -9
  369. data/lib/rubocop/cop/mixin/range_help.rb +24 -13
  370. data/lib/rubocop/cop/mixin/rational_literal.rb +1 -0
  371. data/lib/rubocop/cop/mixin/rescue_node.rb +13 -7
  372. data/lib/rubocop/cop/mixin/safe_assignment.rb +6 -2
  373. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +6 -7
  374. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +5 -5
  375. data/lib/rubocop/cop/mixin/statement_modifier.rb +45 -23
  376. data/lib/rubocop/cop/mixin/string_help.rb +4 -1
  377. data/lib/rubocop/cop/mixin/string_literals_help.rb +3 -5
  378. data/lib/rubocop/cop/mixin/surrounding_space.rb +15 -31
  379. data/lib/rubocop/cop/mixin/symbol_help.rb +13 -0
  380. data/lib/rubocop/cop/mixin/target_ruby_version.rb +5 -1
  381. data/lib/rubocop/cop/mixin/trailing_body.rb +1 -2
  382. data/lib/rubocop/cop/mixin/trailing_comma.rb +12 -17
  383. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +25 -32
  384. data/lib/rubocop/cop/mixin/unused_argument.rb +5 -9
  385. data/lib/rubocop/cop/mixin/visibility_help.rb +37 -0
  386. data/lib/rubocop/cop/naming/accessor_method_name.rb +19 -3
  387. data/lib/rubocop/cop/naming/ascii_identifiers.rb +29 -8
  388. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +17 -7
  389. data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
  390. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +13 -3
  391. data/lib/rubocop/cop/naming/constant_name.rb +4 -2
  392. data/lib/rubocop/cop/naming/file_name.rb +36 -34
  393. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +12 -6
  394. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -3
  395. data/lib/rubocop/cop/naming/inclusive_language.rb +249 -0
  396. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +134 -26
  397. data/lib/rubocop/cop/naming/method_name.rb +6 -8
  398. data/lib/rubocop/cop/naming/method_parameter_name.rb +2 -2
  399. data/lib/rubocop/cop/naming/predicate_name.rb +10 -13
  400. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +59 -15
  401. data/lib/rubocop/cop/naming/variable_name.rb +3 -1
  402. data/lib/rubocop/cop/naming/variable_number.rb +94 -9
  403. data/lib/rubocop/cop/offense.rb +35 -12
  404. data/lib/rubocop/cop/registry.rb +87 -23
  405. data/lib/rubocop/cop/security/eval.rb +4 -2
  406. data/lib/rubocop/cop/security/json_load.rb +8 -8
  407. data/lib/rubocop/cop/security/marshal_load.rb +4 -4
  408. data/lib/rubocop/cop/security/open.rb +15 -11
  409. data/lib/rubocop/cop/security/yaml_load.rb +8 -6
  410. data/lib/rubocop/cop/severity.rb +4 -14
  411. data/lib/rubocop/cop/style/access_modifier_declarations.rb +15 -11
  412. data/lib/rubocop/cop/style/accessor_grouping.rb +150 -0
  413. data/lib/rubocop/cop/style/alias.rb +46 -45
  414. data/lib/rubocop/cop/style/and_or.rb +25 -17
  415. data/lib/rubocop/cop/style/arguments_forwarding.rb +143 -0
  416. data/lib/rubocop/cop/style/array_coercion.rb +69 -0
  417. data/lib/rubocop/cop/style/array_join.rb +9 -9
  418. data/lib/rubocop/cop/style/ascii_comments.rb +6 -7
  419. data/lib/rubocop/cop/style/attr.rb +15 -15
  420. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +9 -12
  421. data/lib/rubocop/cop/style/bare_percent_literals.rb +12 -14
  422. data/lib/rubocop/cop/style/begin_block.rb +2 -2
  423. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +125 -0
  424. data/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb +60 -0
  425. data/lib/rubocop/cop/style/block_comments.rb +14 -18
  426. data/lib/rubocop/cop/style/block_delimiters.rb +41 -34
  427. data/lib/rubocop/cop/style/case_equality.rb +34 -6
  428. data/lib/rubocop/cop/style/case_like_if.rb +258 -0
  429. data/lib/rubocop/cop/style/character_literal.rb +12 -15
  430. data/lib/rubocop/cop/style/class_and_module_children.rb +57 -24
  431. data/lib/rubocop/cop/style/class_check.rb +6 -11
  432. data/lib/rubocop/cop/style/class_equality_comparison.rb +67 -0
  433. data/lib/rubocop/cop/style/class_methods.rb +8 -14
  434. data/lib/rubocop/cop/style/class_methods_definitions.rb +157 -0
  435. data/lib/rubocop/cop/style/class_vars.rb +23 -7
  436. data/lib/rubocop/cop/style/collection_compact.rb +91 -0
  437. data/lib/rubocop/cop/style/collection_methods.rb +22 -15
  438. data/lib/rubocop/cop/style/colon_method_call.rb +7 -9
  439. data/lib/rubocop/cop/style/colon_method_definition.rb +6 -6
  440. data/lib/rubocop/cop/style/combinable_loops.rb +92 -0
  441. data/lib/rubocop/cop/style/command_literal.rb +22 -28
  442. data/lib/rubocop/cop/style/comment_annotation.rb +73 -26
  443. data/lib/rubocop/cop/style/commented_keyword.rb +34 -21
  444. data/lib/rubocop/cop/style/conditional_assignment.rb +71 -87
  445. data/lib/rubocop/cop/style/constant_visibility.rb +31 -2
  446. data/lib/rubocop/cop/style/copyright.rb +20 -23
  447. data/lib/rubocop/cop/style/date_time.rb +16 -5
  448. data/lib/rubocop/cop/style/def_with_parentheses.rb +9 -12
  449. data/lib/rubocop/cop/style/dir.rb +11 -12
  450. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +51 -13
  451. data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +169 -0
  452. data/lib/rubocop/cop/style/documentation.rb +50 -14
  453. data/lib/rubocop/cop/style/documentation_method.rb +2 -1
  454. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +7 -16
  455. data/lib/rubocop/cop/style/double_negation.rb +50 -6
  456. data/lib/rubocop/cop/style/each_for_simple_loop.rb +7 -10
  457. data/lib/rubocop/cop/style/each_with_object.rb +17 -19
  458. data/lib/rubocop/cop/style/empty_block_parameter.rb +9 -10
  459. data/lib/rubocop/cop/style/empty_case_condition.rb +22 -26
  460. data/lib/rubocop/cop/style/empty_else.rb +14 -22
  461. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +9 -10
  462. data/lib/rubocop/cop/style/empty_literal.rb +46 -31
  463. data/lib/rubocop/cop/style/empty_method.rb +12 -23
  464. data/lib/rubocop/cop/style/encoding.rb +6 -10
  465. data/lib/rubocop/cop/style/end_block.rb +5 -8
  466. data/lib/rubocop/cop/style/endless_method.rb +101 -0
  467. data/lib/rubocop/cop/style/eval_with_location.rb +143 -54
  468. data/lib/rubocop/cop/style/even_odd.rb +9 -11
  469. data/lib/rubocop/cop/style/expand_path_arguments.rb +25 -23
  470. data/lib/rubocop/cop/style/explicit_block_argument.rb +114 -0
  471. data/lib/rubocop/cop/style/exponential_notation.rb +15 -18
  472. data/lib/rubocop/cop/style/float_division.rb +60 -11
  473. data/lib/rubocop/cop/style/for.rb +7 -13
  474. data/lib/rubocop/cop/style/format_string.rb +28 -22
  475. data/lib/rubocop/cop/style/format_string_token.rb +78 -22
  476. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +24 -51
  477. data/lib/rubocop/cop/style/global_std_stream.rb +66 -0
  478. data/lib/rubocop/cop/style/global_vars.rb +2 -2
  479. data/lib/rubocop/cop/style/guard_clause.rb +32 -13
  480. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +88 -0
  481. data/lib/rubocop/cop/style/hash_conversion.rb +133 -0
  482. data/lib/rubocop/cop/style/hash_each_methods.rb +26 -12
  483. data/lib/rubocop/cop/style/hash_except.rb +96 -0
  484. data/lib/rubocop/cop/style/hash_like_case.rb +77 -0
  485. data/lib/rubocop/cop/style/hash_syntax.rb +48 -41
  486. data/lib/rubocop/cop/style/hash_transform_keys.rb +23 -11
  487. data/lib/rubocop/cop/style/hash_transform_values.rb +22 -10
  488. data/lib/rubocop/cop/style/identical_conditional_branches.rb +64 -11
  489. data/lib/rubocop/cop/style/if_inside_else.rb +50 -2
  490. data/lib/rubocop/cop/style/if_unless_modifier.rb +58 -49
  491. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +11 -3
  492. data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +122 -0
  493. data/lib/rubocop/cop/style/if_with_semicolon.rb +51 -3
  494. data/lib/rubocop/cop/style/implicit_runtime_error.rb +3 -1
  495. data/lib/rubocop/cop/style/in_pattern_then.rb +56 -0
  496. data/lib/rubocop/cop/style/infinite_loop.rb +27 -26
  497. data/lib/rubocop/cop/style/inline_comment.rb +4 -4
  498. data/lib/rubocop/cop/style/inverse_methods.rb +28 -40
  499. data/lib/rubocop/cop/style/ip_addresses.rb +3 -4
  500. data/lib/rubocop/cop/style/keyword_parameters_order.rb +75 -0
  501. data/lib/rubocop/cop/style/lambda.rb +9 -16
  502. data/lib/rubocop/cop/style/lambda_call.rb +18 -35
  503. data/lib/rubocop/cop/style/line_end_concatenation.rb +21 -25
  504. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +62 -13
  505. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +53 -32
  506. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +8 -18
  507. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +19 -12
  508. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +14 -7
  509. data/lib/rubocop/cop/style/method_def_parentheses.rb +18 -24
  510. data/lib/rubocop/cop/style/min_max.rb +10 -14
  511. data/lib/rubocop/cop/style/missing_else.rb +13 -25
  512. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +11 -5
  513. data/lib/rubocop/cop/style/mixin_grouping.rb +26 -39
  514. data/lib/rubocop/cop/style/mixin_usage.rb +12 -30
  515. data/lib/rubocop/cop/style/module_function.rb +18 -19
  516. data/lib/rubocop/cop/style/multiline_block_chain.rb +13 -5
  517. data/lib/rubocop/cop/style/multiline_if_modifier.rb +3 -10
  518. data/lib/rubocop/cop/style/multiline_if_then.rb +5 -11
  519. data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +62 -0
  520. data/lib/rubocop/cop/style/multiline_memoization.rb +15 -13
  521. data/lib/rubocop/cop/style/multiline_method_signature.rb +33 -3
  522. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +32 -11
  523. data/lib/rubocop/cop/style/multiline_when_then.rb +25 -18
  524. data/lib/rubocop/cop/style/multiple_comparison.rb +77 -12
  525. data/lib/rubocop/cop/style/mutable_constant.rb +45 -37
  526. data/lib/rubocop/cop/style/negated_if.rb +10 -11
  527. data/lib/rubocop/cop/style/negated_if_else_condition.rb +128 -0
  528. data/lib/rubocop/cop/style/negated_unless.rb +10 -11
  529. data/lib/rubocop/cop/style/negated_while.rb +7 -15
  530. data/lib/rubocop/cop/style/nested_modifier.rb +10 -17
  531. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +20 -17
  532. data/lib/rubocop/cop/style/nested_ternary_operator.rb +30 -4
  533. data/lib/rubocop/cop/style/next.rb +16 -25
  534. data/lib/rubocop/cop/style/nil_comparison.rb +19 -11
  535. data/lib/rubocop/cop/style/nil_lambda.rb +70 -0
  536. data/lib/rubocop/cop/style/non_nil_check.rb +56 -34
  537. data/lib/rubocop/cop/style/not.rb +20 -26
  538. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +6 -11
  539. data/lib/rubocop/cop/style/numeric_literals.rb +19 -27
  540. data/lib/rubocop/cop/style/numeric_predicate.rb +15 -23
  541. data/lib/rubocop/cop/style/one_line_conditional.rb +73 -28
  542. data/lib/rubocop/cop/style/option_hash.rb +3 -4
  543. data/lib/rubocop/cop/style/optional_arguments.rb +4 -7
  544. data/lib/rubocop/cop/style/optional_boolean_parameter.rb +53 -0
  545. data/lib/rubocop/cop/style/or_assignment.rb +11 -10
  546. data/lib/rubocop/cop/style/parallel_assignment.rb +27 -24
  547. data/lib/rubocop/cop/style/parentheses_around_condition.rb +7 -6
  548. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +16 -24
  549. data/lib/rubocop/cop/style/percent_q_literals.rb +9 -12
  550. data/lib/rubocop/cop/style/perl_backrefs.rb +84 -16
  551. data/lib/rubocop/cop/style/preferred_hash_methods.rb +12 -18
  552. data/lib/rubocop/cop/style/proc.rb +8 -8
  553. data/lib/rubocop/cop/style/quoted_symbols.rb +110 -0
  554. data/lib/rubocop/cop/style/raise_args.rb +41 -37
  555. data/lib/rubocop/cop/style/random_with_offset.rb +30 -35
  556. data/lib/rubocop/cop/style/redundant_argument.rb +85 -0
  557. data/lib/rubocop/cop/style/redundant_assignment.rb +106 -0
  558. data/lib/rubocop/cop/style/redundant_begin.rb +79 -13
  559. data/lib/rubocop/cop/style/redundant_capital_w.rb +7 -11
  560. data/lib/rubocop/cop/style/redundant_condition.rb +28 -15
  561. data/lib/rubocop/cop/style/redundant_conditional.rb +13 -14
  562. data/lib/rubocop/cop/style/redundant_exception.rb +21 -16
  563. data/lib/rubocop/cop/style/redundant_fetch_block.rb +115 -0
  564. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +52 -0
  565. data/lib/rubocop/cop/style/redundant_freeze.rb +16 -14
  566. data/lib/rubocop/cop/style/redundant_interpolation.rb +32 -27
  567. data/lib/rubocop/cop/style/redundant_parentheses.rb +51 -38
  568. data/lib/rubocop/cop/style/redundant_percent_q.rb +13 -16
  569. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +104 -0
  570. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +118 -0
  571. data/lib/rubocop/cop/style/redundant_return.rb +24 -22
  572. data/lib/rubocop/cop/style/redundant_self.rb +46 -26
  573. data/lib/rubocop/cop/style/redundant_self_assignment.rb +118 -0
  574. data/lib/rubocop/cop/style/redundant_sort.rb +30 -35
  575. data/lib/rubocop/cop/style/redundant_sort_by.rb +6 -9
  576. data/lib/rubocop/cop/style/regexp_literal.rb +24 -30
  577. data/lib/rubocop/cop/style/rescue_modifier.rb +39 -12
  578. data/lib/rubocop/cop/style/rescue_standard_error.rb +25 -23
  579. data/lib/rubocop/cop/style/return_nil.rb +12 -7
  580. data/lib/rubocop/cop/style/safe_navigation.rb +44 -39
  581. data/lib/rubocop/cop/style/sample.rb +14 -15
  582. data/lib/rubocop/cop/style/self_assignment.rb +26 -22
  583. data/lib/rubocop/cop/style/semicolon.rb +10 -10
  584. data/lib/rubocop/cop/style/send.rb +5 -7
  585. data/lib/rubocop/cop/style/signal_exception.rb +32 -27
  586. data/lib/rubocop/cop/style/single_argument_dig.rb +55 -0
  587. data/lib/rubocop/cop/style/single_line_block_params.rb +34 -12
  588. data/lib/rubocop/cop/style/single_line_methods.rb +81 -19
  589. data/lib/rubocop/cop/style/slicing_with_range.rb +38 -0
  590. data/lib/rubocop/cop/style/sole_nested_conditional.rb +176 -0
  591. data/lib/rubocop/cop/style/special_global_vars.rb +21 -54
  592. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +18 -22
  593. data/lib/rubocop/cop/style/static_class.rb +97 -0
  594. data/lib/rubocop/cop/style/stderr_puts.rb +9 -13
  595. data/lib/rubocop/cop/style/string_chars.rb +39 -0
  596. data/lib/rubocop/cop/style/string_concatenation.rb +169 -0
  597. data/lib/rubocop/cop/style/string_hash_keys.rb +8 -7
  598. data/lib/rubocop/cop/style/string_literals.rb +19 -15
  599. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +5 -3
  600. data/lib/rubocop/cop/style/string_methods.rb +7 -17
  601. data/lib/rubocop/cop/style/strip.rb +10 -14
  602. data/lib/rubocop/cop/style/struct_inheritance.rb +33 -4
  603. data/lib/rubocop/cop/style/swap_values.rb +108 -0
  604. data/lib/rubocop/cop/style/symbol_array.rb +11 -22
  605. data/lib/rubocop/cop/style/symbol_literal.rb +4 -8
  606. data/lib/rubocop/cop/style/symbol_proc.rb +50 -32
  607. data/lib/rubocop/cop/style/ternary_parentheses.rb +29 -33
  608. data/lib/rubocop/cop/style/top_level_method_definition.rb +83 -0
  609. data/lib/rubocop/cop/style/trailing_body_on_class.rb +3 -6
  610. data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +10 -9
  611. data/lib/rubocop/cop/style/trailing_body_on_module.rb +3 -6
  612. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +5 -8
  613. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +5 -8
  614. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +22 -24
  615. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +5 -8
  616. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +12 -38
  617. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +16 -31
  618. data/lib/rubocop/cop/style/trivial_accessors.rb +101 -40
  619. data/lib/rubocop/cop/style/unless_else.rb +7 -11
  620. data/lib/rubocop/cop/style/unless_logical_operators.rb +105 -0
  621. data/lib/rubocop/cop/style/unpack_first.rb +7 -9
  622. data/lib/rubocop/cop/style/variable_interpolation.rb +8 -11
  623. data/lib/rubocop/cop/style/when_then.rb +7 -7
  624. data/lib/rubocop/cop/style/while_until_do.rb +6 -16
  625. data/lib/rubocop/cop/style/while_until_modifier.rb +16 -24
  626. data/lib/rubocop/cop/style/word_array.rb +6 -25
  627. data/lib/rubocop/cop/style/yoda_condition.rb +17 -18
  628. data/lib/rubocop/cop/style/zero_length_predicate.rb +25 -23
  629. data/lib/rubocop/cop/team.rb +147 -84
  630. data/lib/rubocop/cop/util.rb +43 -27
  631. data/lib/rubocop/cop/utils/format_string.rb +22 -9
  632. data/lib/rubocop/cop/variable_force.rb +11 -26
  633. data/lib/rubocop/cop/variable_force/assignment.rb +2 -2
  634. data/lib/rubocop/cop/variable_force/branch.rb +18 -9
  635. data/lib/rubocop/cop/variable_force/reference.rb +1 -3
  636. data/lib/rubocop/cop/variable_force/scope.rb +6 -9
  637. data/lib/rubocop/cop/variable_force/variable.rb +9 -12
  638. data/lib/rubocop/cop/variable_force/variable_table.rb +1 -1
  639. data/lib/rubocop/cops_documentation_generator.rb +270 -0
  640. data/lib/rubocop/core_ext/string.rb +2 -2
  641. data/lib/rubocop/directive_comment.rb +144 -0
  642. data/lib/rubocop/error.rb +1 -0
  643. data/lib/rubocop/ext/processed_source.rb +18 -0
  644. data/lib/rubocop/ext/regexp_node.rb +87 -0
  645. data/lib/rubocop/ext/regexp_parser.rb +92 -0
  646. data/lib/rubocop/file_finder.rb +12 -13
  647. data/lib/rubocop/formatter/auto_gen_config_formatter.rb +2 -1
  648. data/lib/rubocop/formatter/base_formatter.rb +0 -4
  649. data/lib/rubocop/formatter/clang_style_formatter.rb +4 -2
  650. data/lib/rubocop/formatter/disabled_config_formatter.rb +39 -30
  651. data/lib/rubocop/formatter/emacs_style_formatter.rb +2 -0
  652. data/lib/rubocop/formatter/formatter_set.rb +5 -5
  653. data/lib/rubocop/formatter/git_hub_actions_formatter.rb +44 -0
  654. data/lib/rubocop/formatter/html_formatter.rb +6 -10
  655. data/lib/rubocop/formatter/json_formatter.rb +1 -5
  656. data/lib/rubocop/formatter/junit_formatter.rb +34 -15
  657. data/lib/rubocop/formatter/offense_count_formatter.rb +2 -2
  658. data/lib/rubocop/formatter/progress_formatter.rb +3 -4
  659. data/lib/rubocop/formatter/quiet_formatter.rb +1 -1
  660. data/lib/rubocop/formatter/simple_text_formatter.rb +40 -7
  661. data/lib/rubocop/formatter/tap_formatter.rb +6 -2
  662. data/lib/rubocop/formatter/worst_offenders_formatter.rb +2 -2
  663. data/lib/rubocop/lockfile.rb +40 -0
  664. data/lib/rubocop/magic_comment.rb +33 -4
  665. data/lib/rubocop/name_similarity.rb +18 -10
  666. data/lib/rubocop/options.rb +126 -91
  667. data/lib/rubocop/path_util.rb +20 -22
  668. data/lib/rubocop/platform.rb +1 -1
  669. data/lib/rubocop/rake_task.rb +12 -11
  670. data/lib/rubocop/remote_config.rb +15 -11
  671. data/lib/rubocop/result_cache.rb +50 -31
  672. data/lib/rubocop/rspec/cop_helper.rb +11 -35
  673. data/lib/rubocop/rspec/expect_offense.rb +128 -39
  674. data/lib/rubocop/rspec/shared_contexts.rb +78 -32
  675. data/lib/rubocop/runner.rb +111 -74
  676. data/lib/rubocop/string_interpreter.rb +3 -0
  677. data/lib/rubocop/target_finder.rb +58 -48
  678. data/lib/rubocop/target_ruby.rb +126 -13
  679. data/lib/rubocop/util.rb +16 -0
  680. data/lib/rubocop/version.rb +71 -7
  681. data/lib/rubocop/yaml_duplication_checker.rb +1 -0
  682. metadata +189 -91
  683. data/bin/console +0 -10
  684. data/bin/setup +0 -7
  685. data/lib/rubocop/ast/builder.rb +0 -85
  686. data/lib/rubocop/ast/node.rb +0 -637
  687. data/lib/rubocop/ast/node/alias_node.rb +0 -24
  688. data/lib/rubocop/ast/node/and_node.rb +0 -29
  689. data/lib/rubocop/ast/node/args_node.rb +0 -29
  690. data/lib/rubocop/ast/node/array_node.rb +0 -70
  691. data/lib/rubocop/ast/node/block_node.rb +0 -121
  692. data/lib/rubocop/ast/node/break_node.rb +0 -17
  693. data/lib/rubocop/ast/node/case_match_node.rb +0 -56
  694. data/lib/rubocop/ast/node/case_node.rb +0 -56
  695. data/lib/rubocop/ast/node/class_node.rb +0 -31
  696. data/lib/rubocop/ast/node/def_node.rb +0 -82
  697. data/lib/rubocop/ast/node/defined_node.rb +0 -17
  698. data/lib/rubocop/ast/node/ensure_node.rb +0 -17
  699. data/lib/rubocop/ast/node/float_node.rb +0 -12
  700. data/lib/rubocop/ast/node/for_node.rb +0 -53
  701. data/lib/rubocop/ast/node/forward_args_node.rb +0 -18
  702. data/lib/rubocop/ast/node/hash_node.rb +0 -109
  703. data/lib/rubocop/ast/node/if_node.rb +0 -175
  704. data/lib/rubocop/ast/node/int_node.rb +0 -12
  705. data/lib/rubocop/ast/node/keyword_splat_node.rb +0 -45
  706. data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +0 -16
  707. data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +0 -43
  708. data/lib/rubocop/ast/node/mixin/collection_node.rb +0 -15
  709. data/lib/rubocop/ast/node/mixin/conditional_node.rb +0 -45
  710. data/lib/rubocop/ast/node/mixin/hash_element_node.rb +0 -125
  711. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +0 -269
  712. data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +0 -114
  713. data/lib/rubocop/ast/node/mixin/modifier_node.rb +0 -17
  714. data/lib/rubocop/ast/node/mixin/numeric_node.rb +0 -21
  715. data/lib/rubocop/ast/node/mixin/parameterized_node.rb +0 -61
  716. data/lib/rubocop/ast/node/mixin/predicate_operator_node.rb +0 -35
  717. data/lib/rubocop/ast/node/module_node.rb +0 -24
  718. data/lib/rubocop/ast/node/or_node.rb +0 -29
  719. data/lib/rubocop/ast/node/pair_node.rb +0 -63
  720. data/lib/rubocop/ast/node/range_node.rb +0 -18
  721. data/lib/rubocop/ast/node/regexp_node.rb +0 -33
  722. data/lib/rubocop/ast/node/resbody_node.rb +0 -24
  723. data/lib/rubocop/ast/node/retry_node.rb +0 -17
  724. data/lib/rubocop/ast/node/return_node.rb +0 -24
  725. data/lib/rubocop/ast/node/self_class_node.rb +0 -24
  726. data/lib/rubocop/ast/node/send_node.rb +0 -13
  727. data/lib/rubocop/ast/node/str_node.rb +0 -16
  728. data/lib/rubocop/ast/node/super_node.rb +0 -21
  729. data/lib/rubocop/ast/node/symbol_node.rb +0 -12
  730. data/lib/rubocop/ast/node/until_node.rb +0 -35
  731. data/lib/rubocop/ast/node/when_node.rb +0 -53
  732. data/lib/rubocop/ast/node/while_node.rb +0 -35
  733. data/lib/rubocop/ast/node/yield_node.rb +0 -21
  734. data/lib/rubocop/ast/sexp.rb +0 -16
  735. data/lib/rubocop/ast/traversal.rb +0 -202
  736. data/lib/rubocop/cop/lint/useless_comparison.rb +0 -28
  737. data/lib/rubocop/cop/mixin/classish_length.rb +0 -37
  738. data/lib/rubocop/cop/mixin/parser_diagnostic.rb +0 -37
  739. data/lib/rubocop/cop/mixin/too_many_lines.rb +0 -35
  740. data/lib/rubocop/cop/style/method_missing_super.rb +0 -34
  741. data/lib/rubocop/node_pattern.rb +0 -887
  742. data/lib/rubocop/processed_source.rb +0 -213
  743. data/lib/rubocop/string_util.rb +0 -14
  744. data/lib/rubocop/token.rb +0 -114
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e04c6e897293df4ef1c7bf05a0c0077512e2cba797a7caee484b1c08a7300ad
4
- data.tar.gz: 92fbc98b5068e5c30bf83d058e3cfe774a1a65cc90608027ff8d6624c8c2910c
3
+ metadata.gz: ca5a85edf6c093ecee74e82617e0c618424e907cbb6a71fb1f996492073a98e4
4
+ data.tar.gz: 1ceb28336ce8913d79d4260000f5a86ca93190f5e36f6809d690aa20559674fa
5
5
  SHA512:
6
- metadata.gz: cacf128617d233de65c2061d0300d345357840b151f65c78a2463fa23830115dcaa667cc2110ef39cacd14d957e626fc3fb4857443e40a1ab0fb485ce9cbfeed
7
- data.tar.gz: f7a095da673a5b32de33293c6056c580995d1b2ad913e2891c1740ab1ffb42896f1b0c69491eb75656907b60e4de6f6a58a119c8936cff26d1ed678bc1159e0c
6
+ metadata.gz: c020a6c2b13ad36e18afac1a2293f7c30fec5d2d62a36f5f7ffea8887816985ec27b94295fba1e08f9f1b7f462c8b4ca28a4949a32baadcea17e15ff4181b0e3
7
+ data.tar.gz: 06e9a6431dc25b8152b0b380d4de434409579fcb0b66da5335b434798889fd8f6d6a58064a044595b1a45b2bad7830e8045011c7e20e64f1337ccdd11a04e29c
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-20 Bozhidar Batsov
1
+ Copyright (c) 2012-21 Bozhidar Batsov
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,35 +1,35 @@
1
- [![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
2
- [![CircleCI Status](https://circleci.com/gh/rubocop-hq/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop/tree/master)
3
- [![AppVeyor Status](https://ci.appveyor.com/api/projects/status/sj3ye7n5690d0nvg?svg=true)](https://ci.appveyor.com/project/bbatsov/rubocop)
4
- [![Coverage Status](https://api.codeclimate.com/v1/badges/ad6e76460499c8c99697/test_coverage)](https://codeclimate.com/github/bbatsov/rubocop)
5
- [![Code Climate](https://codeclimate.com/github/bbatsov/rubocop/badges/gpa.svg)](https://codeclimate.com/github/bbatsov/rubocop)
6
- [![Inline docs](https://inch-ci.org/github/bbatsov/rubocop.svg)](https://inch-ci.org/github/bbatsov/rubocop)
7
- [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
8
-
9
- [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
10
- [![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
11
- [![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
12
- [![Tidelift](https://tidelift.com/badges/package/rubygems/rubocop)](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
13
-
14
1
  <p align="center">
15
- <img src="https://raw.githubusercontent.com/rubocop-hq/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
2
+ <img src="https://raw.githubusercontent.com/rubocop/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
16
3
  </p>
17
4
 
5
+ ----------
6
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
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)
10
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/test_coverage)](https://codeclimate.com/github/rubocop/rubocop/test_coverage)
11
+ [![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop/rubocop/maintainability)
12
+ [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
13
+ [![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg?sanitize=true)](https://discord.gg/wJjWvGRDmm)
14
+
18
15
  > Role models are important. <br/>
19
16
  > -- Officer Alex J. Murphy / RoboCop
20
17
 
21
- **RuboCop** is a Ruby static code analyzer and code formatter. Out of
22
- the box it will enforce many of the guidelines outlined in the
23
- community [Ruby Style
24
- Guide](https://rubystyle.guide).
18
+ **RuboCop** is a Ruby static code analyzer (a.k.a. `linter`) and code formatter. Out of the box it
19
+ will enforce many of the guidelines outlined in the community [Ruby Style
20
+ Guide](https://rubystyle.guide). Apart from reporting the problems discovered in your code,
21
+ RuboCop can also automatically fix many of them for you.
25
22
 
26
23
  RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
27
- [configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
24
+ [configuration options](https://github.com/rubocop/rubocop/blob/master/config/default.yml).
28
25
 
29
- Apart from reporting problems in your code, RuboCop can also
30
- automatically fix some of the problems for you.
26
+ ----------
27
+ [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
28
+ [![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
29
+ [![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
30
+ [![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)
31
31
 
32
- [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bbatsov/rubocop?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
32
+ Working on RuboCop is often fun, but it also requires a great deal of time and energy.
33
33
 
34
34
  **Please consider [financially supporting its ongoing development](#funding).**
35
35
 
@@ -47,15 +47,18 @@ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemf
47
47
  gem 'rubocop', require: false
48
48
  ```
49
49
 
50
- RuboCop's development is moving at a very rapid pace and there are
51
- often backward-incompatible changes between minor releases (since we
52
- haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
53
- might want to use a conservative version lock in your `Gemfile`:
50
+ RuboCop is stable between major versions, both in terms of API and cop configuration.
51
+ We aim to ease the maintenance of RuboCop extensions and the upgrades between RuboCop
52
+ releases. All big changes are reserved for major releases.
53
+ To prevent an unwanted RuboCop update you might want to use a conservative version lock
54
+ in your `Gemfile`:
54
55
 
55
56
  ```rb
56
- gem 'rubocop', '~> 0.82.0', require: false
57
+ gem 'rubocop', '~> 1.18', require: false
57
58
  ```
58
59
 
60
+ See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
61
+
59
62
  ## Quickstart
60
63
 
61
64
  Just type `rubocop` in a Ruby project's folder and watch the magic happen.
@@ -71,11 +74,30 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
71
74
 
72
75
  ## Compatibility
73
76
 
74
- RuboCop supports the following Ruby implementations:
77
+ RuboCop officially supports the following Ruby implementations:
75
78
 
76
- * MRI 2.4+
79
+ * MRI 2.5+
77
80
  * JRuby 9.2+
78
81
 
82
+ See the [compatibility documentation](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
83
+
84
+ ## Readme Badge
85
+
86
+ If you use RuboCop in your project, you can include one of these badges in your readme to let people know that your code is written following the community Ruby Style Guide.
87
+
88
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
89
+
90
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
91
+
92
+
93
+ Here are the Markdown snippets for the two badges:
94
+
95
+ ``` markdown
96
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
97
+
98
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
99
+ ```
100
+
79
101
  ## Team
80
102
 
81
103
  Here's a list of RuboCop's core developers:
@@ -88,18 +110,23 @@ Here's a list of RuboCop's core developers:
88
110
  * [Masataka Kuwabara](https://github.com/pocke)
89
111
  * [Koichi Ito](https://github.com/koic)
90
112
  * [Maxim Krizhanovski](https://github.com/darhazer)
113
+ * [Benjamin Quorning](https://github.com/bquorning)
114
+ * [Marc-André Lafortune](https://github.com/marcandre)
115
+ * [Daniel Vandersluis](https://github.com/dvandersluis)
116
+
117
+ See the [team page](https://docs.rubocop.org/rubocop/about/team.html) for more details.
91
118
 
92
119
  ## Logo
93
120
 
94
121
  RuboCop's logo was created by [Dimiter Petrov](https://www.chadomoto.com/). You can find the logo in various
95
- formats [here](https://github.com/rubocop-hq/rubocop/tree/master/logo).
122
+ formats [here](https://github.com/rubocop/rubocop/tree/master/logo).
96
123
 
97
124
  The logo is licensed under a
98
125
  [Creative Commons Attribution-NonCommercial 4.0 International License](https://creativecommons.org/licenses/by-nc/4.0/deed.en_GB).
99
126
 
100
127
  ## Contributors
101
128
 
102
- Here's a [list](https://github.com/rubocop-hq/rubocop/graphs/contributors) of
129
+ Here's a [list](https://github.com/rubocop/rubocop/graphs/contributors) of
103
130
  all the people who have contributed to the development of RuboCop.
104
131
 
105
132
  I'm extremely grateful to each and every one of them!
@@ -128,14 +155,19 @@ wide array of funding channels to account for your preferences
128
155
  currently [Open Collective](https://opencollective.com/rubocop) is our
129
156
  preferred funding platform).
130
157
 
131
- If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
132
- to become a RuboCop sponsor.
158
+ **If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
159
+ to become a RuboCop sponsor.**
133
160
 
134
161
  You can support the development of RuboCop via
135
- [Salt](https://salt.bountysource.com/teams/rubocop),
162
+ [GitHub Sponsors](https://github.com/sponsors/bbatsov),
136
163
  [Patreon](https://www.patreon.com/bbatsov),
137
- [PayPal](https://paypal.me/bbatsov)
138
- and [Open Collective](https://opencollective.com/rubocop).
164
+ [PayPal](https://paypal.me/bbatsov),
165
+ [Open Collective](https://opencollective.com/rubocop)
166
+ and [Tidelift](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
167
+ .
168
+
169
+ **Note:** If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we'd recommend
170
+ the use of Tidelift, where you can get a support-like subscription instead.
139
171
 
140
172
  ### Open Collective Backers
141
173
 
@@ -213,5 +245,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
213
245
 
214
246
  ## Copyright
215
247
 
216
- Copyright (c) 2012-2020 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
248
+ Copyright (c) 2012-2021 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
217
249
  further details.
@@ -254,7 +254,7 @@
254
254
  <% end %>
255
255
  </div>
256
256
  <footer>
257
- Generated by <a href="https://github.com/rubocop-hq/rubocop">RuboCop</a>
257
+ Generated by <a href="https://github.com/rubocop/rubocop">RuboCop</a>
258
258
  <span class="version"><%= RuboCop::Version::STRING %></span>
259
259
  </footer>
260
260
  </body>
data/config/default.yml CHANGED
@@ -35,6 +35,7 @@ AllCops:
35
35
  - '**/*.watchr'
36
36
  - '**/.irbrc'
37
37
  - '**/.pryrc'
38
+ - '**/.simplecov'
38
39
  - '**/buildfile'
39
40
  - '**/Appraisals'
40
41
  - '**/Berksfile'
@@ -53,6 +54,7 @@ AllCops:
53
54
  - '**/Podfile'
54
55
  - '**/Puppetfile'
55
56
  - '**/Rakefile'
57
+ - '**/rakefile'
56
58
  - '**/Snapfile'
57
59
  - '**/Steepfile'
58
60
  - '**/Thorfile'
@@ -115,6 +117,8 @@ AllCops:
115
117
  # CacheRootDirectory is ~ (nil), which it is by default, the root will be
116
118
  # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
117
119
  # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
120
+ # The CacheRootDirectory can be overwritten by passing the `--cache-root` command
121
+ # line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
118
122
  CacheRootDirectory: ~
119
123
  # It is possible for a malicious user to know the location of RuboCop's cache
120
124
  # directory by looking at CacheRootDirectory, and create a symlink in its
@@ -126,15 +130,26 @@ AllCops:
126
130
  # What MRI version of the Ruby interpreter is the inspected code intended to
127
131
  # run on? (If there is more than one, set this to the lowest version.)
128
132
  # If a value is specified for TargetRubyVersion then it is used. Acceptable
129
- # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
133
+ # values are specificed as a float (i.e. 3.0); the teeny version of Ruby
130
134
  # should not be included. If the project specifies a Ruby version in the
131
- # .ruby-version file, Gemfile or gems.rb file, RuboCop will try to determine
132
- # the desired version of Ruby by inspecting the .ruby-version file first,
133
- # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
134
- # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
135
- # from the lock file.) If the Ruby version is still unresolved, RuboCop will
136
- # use the oldest officially supported Ruby version (currently Ruby 2.4).
135
+ # .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
136
+ # try to determine the desired version of Ruby by inspecting the
137
+ # .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
138
+ # or gems.locked file. (Although the Ruby version is specified in the Gemfile
139
+ # or gems.rb file, RuboCop reads the final value from the lock file.) If the
140
+ # Ruby version is still unresolved, RuboCop will use the oldest officially
141
+ # supported Ruby version (currently Ruby 2.5).
137
142
  TargetRubyVersion: ~
143
+ # Determines if a notification for extension libraries should be shown when
144
+ # rubocop is run. Keys are the name of the extension, and values are an array
145
+ # of gems in the Gemfile that the extension is suggested for, if not already
146
+ # included.
147
+ SuggestExtensions:
148
+ rubocop-rails: [rails]
149
+ rubocop-rspec: [rspec, rspec-rails]
150
+ rubocop-minitest: [minitest]
151
+ rubocop-sequel: [sequel]
152
+ rubocop-rake: [rake]
138
153
 
139
154
  #################### Bundler ###############################
140
155
 
@@ -151,12 +166,27 @@ Bundler/GemComment:
151
166
  Description: 'Add a comment describing each gem.'
152
167
  Enabled: false
153
168
  VersionAdded: '0.59'
154
- VersionChanged: '0.77'
169
+ VersionChanged: '0.85'
155
170
  Include:
156
171
  - '**/*.gemfile'
157
172
  - '**/Gemfile'
158
173
  - '**/gems.rb'
159
174
  IgnoredGems: []
175
+ OnlyFor: []
176
+
177
+ Bundler/GemVersion:
178
+ Description: 'Requires or forbids specifying gem versions.'
179
+ Enabled: false
180
+ VersionAdded: '1.14'
181
+ EnforcedStyle: 'required'
182
+ SupportedStyles:
183
+ - 'required'
184
+ - 'forbidden'
185
+ Include:
186
+ - '**/*.gemfile'
187
+ - '**/Gemfile'
188
+ - '**/gems.rb'
189
+ AllowedGems: []
160
190
 
161
191
  Bundler/InsecureProtocolSource:
162
192
  Description: >-
@@ -177,6 +207,9 @@ Bundler/OrderedGems:
177
207
  VersionAdded: '0.46'
178
208
  VersionChanged: '0.47'
179
209
  TreatCommentsAsGroupSeparators: true
210
+ # By default, "-" and "_" are ignored for order purposes.
211
+ # This can be overridden by setting this parameter to true.
212
+ ConsiderPunctuation: false
180
213
  Include:
181
214
  - '**/*.gemfile'
182
215
  - '**/Gemfile'
@@ -184,6 +217,13 @@ Bundler/OrderedGems:
184
217
 
185
218
  #################### Gemspec ###############################
186
219
 
220
+ Gemspec/DateAssignment:
221
+ Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
222
+ Enabled: pending
223
+ VersionAdded: '1.10'
224
+ Include:
225
+ - '**/*.gemspec'
226
+
187
227
  Gemspec/DuplicatedAssignment:
188
228
  Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
189
229
  Enabled: true
@@ -197,13 +237,17 @@ Gemspec/OrderedDependencies:
197
237
  Enabled: true
198
238
  VersionAdded: '0.51'
199
239
  TreatCommentsAsGroupSeparators: true
240
+ # By default, "-" and "_" are ignored for order purposes.
241
+ # This can be overridden by setting this parameter to true.
242
+ ConsiderPunctuation: false
200
243
  Include:
201
244
  - '**/*.gemspec'
202
245
 
203
246
  Gemspec/RequiredRubyVersion:
204
- Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
247
+ Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
205
248
  Enabled: true
206
249
  VersionAdded: '0.52'
250
+ VersionChanged: '0.89'
207
251
  Include:
208
252
  - '**/*.gemspec'
209
253
 
@@ -226,8 +270,8 @@ Layout/AccessModifierIndentation:
226
270
  SupportedStyles:
227
271
  - outdent
228
272
  - indent
229
- # By default, the indentation width from Layout/IndentationWidth is used
230
- # But it can be overridden by setting this parameter
273
+ # By default the indentation width from `Layout/IndentationWidth` is used,
274
+ # but it can be overridden by setting this parameter.
231
275
  IndentationWidth: ~
232
276
 
233
277
  Layout/ArgumentAlignment:
@@ -255,8 +299,8 @@ Layout/ArgumentAlignment:
255
299
  SupportedStyles:
256
300
  - with_first_argument
257
301
  - with_fixed_indentation
258
- # By default, the indentation width from Layout/IndentationWidth is used
259
- # But it can be overridden by setting this parameter
302
+ # By default the indentation width from `Layout/IndentationWidth` is used,
303
+ # but it can be overridden by setting this parameter.
260
304
  IndentationWidth: ~
261
305
 
262
306
  Layout/ArrayAlignment:
@@ -284,8 +328,8 @@ Layout/ArrayAlignment:
284
328
  SupportedStyles:
285
329
  - with_first_element
286
330
  - with_fixed_indentation
287
- # By default, the indentation width from Layout/IndentationWidth is used
288
- # But it can be overridden by setting this parameter
331
+ # By default the indentation width from `Layout/IndentationWidth` is used,
332
+ # but it can be overridden by setting this parameter.
289
333
  IndentationWidth: ~
290
334
 
291
335
  Layout/AssignmentIndentation:
@@ -295,10 +339,23 @@ Layout/AssignmentIndentation:
295
339
  Enabled: true
296
340
  VersionAdded: '0.49'
297
341
  VersionChanged: '0.77'
298
- # By default, the indentation width from `Layout/IndentationWidth` is used
299
- # But it can be overridden by setting this parameter
342
+ # By default the indentation width from `Layout/IndentationWidth` is used,
343
+ # but it can be overridden by setting this parameter.
300
344
  IndentationWidth: ~
301
345
 
346
+ Layout/BeginEndAlignment:
347
+ Description: 'Align ends corresponding to begins correctly.'
348
+ Enabled: true
349
+ VersionAdded: '0.91'
350
+ # The value `start_of_line` means that `end` should be aligned the start of the line
351
+ # where the `begin` keyword is.
352
+ # The value `begin` means that `end` should be aligned with the `begin` keyword.
353
+ EnforcedStyleAlignWith: start_of_line
354
+ SupportedStylesAlignWith:
355
+ - start_of_line
356
+ - begin
357
+ Severity: warning
358
+
302
359
  Layout/BlockAlignment:
303
360
  Description: 'Align block ends correctly.'
304
361
  Enabled: true
@@ -320,18 +377,19 @@ Layout/BlockEndNewline:
320
377
  VersionAdded: '0.49'
321
378
 
322
379
  Layout/CaseIndentation:
323
- Description: 'Indentation of when in a case/when/[else/]end.'
380
+ Description: 'Indentation of when in a case/(when|in)/[else/]end.'
324
381
  StyleGuide: '#indent-when-to-case'
325
382
  Enabled: true
326
383
  VersionAdded: '0.49'
384
+ VersionChanged: '1.16'
327
385
  EnforcedStyle: case
328
386
  SupportedStyles:
329
387
  - case
330
388
  - end
331
389
  IndentOneStep: false
332
- # By default, the indentation width from `Layout/IndentationWidth` is used.
333
- # But it can be overridden by setting this parameter.
334
- # This only matters if `IndentOneStep` is `true`
390
+ # By default the indentation width from `Layout/IndentationWidth` is used,
391
+ # but it can be overridden by setting this parameter.
392
+ # This only matters if `IndentOneStep` is `true`.
335
393
  IndentationWidth: ~
336
394
 
337
395
  Layout/ClassStructure:
@@ -375,6 +433,7 @@ Layout/ConditionPosition:
375
433
  StyleGuide: '#same-line-condition'
376
434
  Enabled: true
377
435
  VersionAdded: '0.53'
436
+ VersionChanged: '0.83'
378
437
 
379
438
  Layout/DefEndAlignment:
380
439
  Description: 'Align ends corresponding to defs correctly.'
@@ -388,7 +447,6 @@ Layout/DefEndAlignment:
388
447
  SupportedStylesAlignWith:
389
448
  - start_of_line
390
449
  - def
391
- AutoCorrect: false
392
450
  Severity: warning
393
451
 
394
452
  Layout/DotPosition:
@@ -425,11 +483,23 @@ Layout/EmptyLineAfterMagicComment:
425
483
  Enabled: true
426
484
  VersionAdded: '0.49'
427
485
 
486
+ Layout/EmptyLineAfterMultilineCondition:
487
+ Description: 'Enforces empty line after multiline condition.'
488
+ # This is disabled, because this style is not very common in practice.
489
+ Enabled: false
490
+ VersionAdded: '0.90'
491
+ Reference:
492
+ - https://github.com/airbnb/ruby#multiline-if-newline
493
+
428
494
  Layout/EmptyLineBetweenDefs:
429
- Description: 'Use empty lines between defs.'
495
+ Description: 'Use empty lines between class/module/method defs.'
430
496
  StyleGuide: '#empty-lines-between-methods'
431
497
  Enabled: true
432
498
  VersionAdded: '0.49'
499
+ VersionChanged: '1.7'
500
+ EmptyLineBetweenMethodDefs: true
501
+ EmptyLineBetweenClassDefs: true
502
+ EmptyLineBetweenModuleDefs: true
433
503
  # If `true`, this parameter means that single line method definitions don't
434
504
  # need an empty line between them.
435
505
  AllowAdjacentOneLineDefs: false
@@ -460,6 +530,19 @@ Layout/EmptyLinesAroundArguments:
460
530
  Enabled: true
461
531
  VersionAdded: '0.52'
462
532
 
533
+ Layout/EmptyLinesAroundAttributeAccessor:
534
+ Description: "Keep blank lines around attribute accessors."
535
+ StyleGuide: '#empty-lines-around-attribute-accessor'
536
+ Enabled: true
537
+ VersionAdded: '0.83'
538
+ VersionChanged: '0.84'
539
+ AllowAliasSyntax: true
540
+ AllowedMethods:
541
+ - alias_method
542
+ - public
543
+ - protected
544
+ - private
545
+
463
546
  Layout/EmptyLinesAroundBeginBody:
464
547
  Description: "Keeps track of empty lines around begin-end bodies."
465
548
  StyleGuide: '#empty-lines-around-bodies'
@@ -531,7 +614,6 @@ Layout/EndAlignment:
531
614
  - keyword
532
615
  - variable
533
616
  - start_of_line
534
- AutoCorrect: false
535
617
  Severity: warning
536
618
 
537
619
  Layout/EndOfLine:
@@ -584,8 +666,8 @@ Layout/FirstArgumentIndentation:
584
666
  # Same as `special_for_inner_method_call` except that the special rule only
585
667
  # applies if the outer method call encloses its arguments in parentheses.
586
668
  - special_for_inner_method_call_in_parentheses
587
- # By default, the indentation width from `Layout/IndentationWidth` is used
588
- # But it can be overridden by setting this parameter
669
+ # By default the indentation width from `Layout/IndentationWidth` is used,
670
+ # but it can be overridden by setting this parameter.
589
671
  IndentationWidth: ~
590
672
 
591
673
  Layout/FirstArrayElementIndentation:
@@ -611,8 +693,8 @@ Layout/FirstArrayElementIndentation:
611
693
  - special_inside_parentheses
612
694
  - consistent
613
695
  - align_brackets
614
- # By default, the indentation width from `Layout/IndentationWidth` is used
615
- # But it can be overridden by setting this parameter
696
+ # By default the indentation width from `Layout/IndentationWidth` is used,
697
+ # but it can be overridden by setting this parameter.
616
698
  IndentationWidth: ~
617
699
 
618
700
  Layout/FirstArrayElementLineBreak:
@@ -643,8 +725,8 @@ Layout/FirstHashElementIndentation:
643
725
  - special_inside_parentheses
644
726
  - consistent
645
727
  - align_braces
646
- # By default, the indentation width from `Layout/IndentationWidth` is used
647
- # But it can be overridden by setting this parameter
728
+ # By default the indentation width from `Layout/IndentationWidth` is used,
729
+ # but it can be overridden by setting this parameter.
648
730
  IndentationWidth: ~
649
731
 
650
732
  Layout/FirstHashElementLineBreak:
@@ -679,8 +761,8 @@ Layout/FirstParameterIndentation:
679
761
  SupportedStyles:
680
762
  - consistent
681
763
  - align_parentheses
682
- # By default, the indentation width from `Layout/IndentationWidth` is used
683
- # But it can be overridden by setting this parameter
764
+ # By default the indentation width from `Layout/IndentationWidth` is used,
765
+ # but it can be overridden by setting this parameter.
684
766
  IndentationWidth: ~
685
767
 
686
768
  Layout/HashAlignment:
@@ -690,7 +772,7 @@ Layout/HashAlignment:
690
772
  Enabled: true
691
773
  AllowMultipleStyles: true
692
774
  VersionAdded: '0.49'
693
- VersionChanged: '0.77'
775
+ VersionChanged: '1.16'
694
776
  # Alignment of entries using hash rocket as separator. Valid values are:
695
777
  #
696
778
  # key - left alignment of keys
@@ -774,13 +856,7 @@ Layout/HeredocIndentation:
774
856
  StyleGuide: '#squiggly-heredocs'
775
857
  Enabled: true
776
858
  VersionAdded: '0.49'
777
- VersionChanged: '0.77'
778
- EnforcedStyle: squiggly
779
- SupportedStyles:
780
- - squiggly
781
- - active_support
782
- - powerpack
783
- - unindent
859
+ VersionChanged: '0.85'
784
860
 
785
861
  Layout/IndentationConsistency:
786
862
  Description: 'Keep indentation straight.'
@@ -807,8 +883,8 @@ Layout/IndentationStyle:
807
883
  Enabled: true
808
884
  VersionAdded: '0.49'
809
885
  VersionChanged: '0.82'
810
- # By default, the indentation width from Layout/IndentationWidth is used
811
- # But it can be overridden by setting this parameter
886
+ # By default the indentation width from `Layout/IndentationWidth` is used,
887
+ # but it can be overridden by setting this parameter.
812
888
  # It is used during auto-correction to determine how many spaces should
813
889
  # replace each tab.
814
890
  IndentationWidth: ~
@@ -847,14 +923,28 @@ Layout/LeadingEmptyLines:
847
923
  VersionAdded: '0.57'
848
924
  VersionChanged: '0.77'
849
925
 
926
+ Layout/LineEndStringConcatenationIndentation:
927
+ Description: >-
928
+ Checks the indentation of the next line after a line that
929
+ ends with a string literal and a backslash.
930
+ Enabled: pending
931
+ VersionAdded: '1.18'
932
+ EnforcedStyle: aligned
933
+ SupportedStyles:
934
+ - aligned
935
+ - indented
936
+ # By default the indentation width from `Layout/IndentationWidth` is used,
937
+ # but it can be overridden by setting this parameter.
938
+ IndentationWidth: ~
939
+
850
940
  Layout/LineLength:
851
- Description: 'Limit lines to 80 characters.'
852
- StyleGuide: '#80-character-limits'
941
+ Description: 'Checks that line length does not exceed the configured limit.'
942
+ StyleGuide: '#max-line-length'
853
943
  Enabled: true
854
944
  VersionAdded: '0.25'
855
- VersionChanged: '0.78'
856
- AutoCorrect: false
857
- Max: 80
945
+ VersionChanged: '1.4'
946
+ AutoCorrect: true
947
+ Max: 120
858
948
  # To make it possible to copy or click on URIs in the code, we allow lines
859
949
  # containing a URI to be longer than Max.
860
950
  AllowHeredoc: true
@@ -977,8 +1067,8 @@ Layout/MultilineMethodCallIndentation:
977
1067
  - aligned
978
1068
  - indented
979
1069
  - indented_relative_to_receiver
980
- # By default, the indentation width from Layout/IndentationWidth is used
981
- # But it can be overridden by setting this parameter
1070
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1071
+ # but it can be overridden by setting this parameter.
982
1072
  IndentationWidth: ~
983
1073
 
984
1074
  Layout/MultilineMethodDefinitionBraceLayout:
@@ -1007,8 +1097,8 @@ Layout/MultilineOperationIndentation:
1007
1097
  SupportedStyles:
1008
1098
  - aligned
1009
1099
  - indented
1010
- # By default, the indentation width from `Layout/IndentationWidth` is used
1011
- # But it can be overridden by setting this parameter
1100
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1101
+ # but it can be overridden by setting this parameter.
1012
1102
  IndentationWidth: ~
1013
1103
 
1014
1104
  Layout/ParameterAlignment:
@@ -1036,15 +1126,28 @@ Layout/ParameterAlignment:
1036
1126
  SupportedStyles:
1037
1127
  - with_first_parameter
1038
1128
  - with_fixed_indentation
1039
- # By default, the indentation width from Layout/IndentationWidth is used
1040
- # But it can be overridden by setting this parameter
1129
+ # By default the indentation width from `Layout/IndentationWidth` is used,
1130
+ # but it can be overridden by setting this parameter.
1041
1131
  IndentationWidth: ~
1042
1132
 
1133
+ Layout/RedundantLineBreak:
1134
+ Description: >-
1135
+ Do not break up an expression into multiple lines when it fits
1136
+ on a single line.
1137
+ Enabled: false
1138
+ InspectBlocks: false
1139
+ VersionAdded: '1.13'
1140
+
1043
1141
  Layout/RescueEnsureAlignment:
1044
1142
  Description: 'Align rescues and ensures correctly.'
1045
1143
  Enabled: true
1046
1144
  VersionAdded: '0.49'
1047
1145
 
1146
+ Layout/SingleLineBlockChain:
1147
+ Description: 'Put method call on a separate line if chained to a single line block.'
1148
+ Enabled: false
1149
+ VersionAdded: '1.14'
1150
+
1048
1151
  Layout/SpaceAfterColon:
1049
1152
  Description: 'Use spaces after colons.'
1050
1153
  StyleGuide: '#spaces-operators'
@@ -1106,7 +1209,7 @@ Layout/SpaceAroundKeyword:
1106
1209
 
1107
1210
  Layout/SpaceAroundMethodCallOperator:
1108
1211
  Description: 'Checks method call operators to not have spaces around them.'
1109
- Enabled: pending
1212
+ Enabled: true
1110
1213
  VersionAdded: '0.82'
1111
1214
 
1112
1215
  Layout/SpaceAroundOperators:
@@ -1137,7 +1240,13 @@ Layout/SpaceBeforeBlockBraces:
1137
1240
  SupportedStylesForEmptyBraces:
1138
1241
  - space
1139
1242
  - no_space
1140
- VersionChanged: '0.52.1'
1243
+ VersionChanged: '0.52'
1244
+
1245
+ Layout/SpaceBeforeBrackets:
1246
+ Description: 'Checks for receiver with a space before the opening brackets.'
1247
+ StyleGuide: '#space-in-brackets-access'
1248
+ Enabled: pending
1249
+ VersionAdded: '1.7'
1141
1250
 
1142
1251
  Layout/SpaceBeforeComma:
1143
1252
  Description: 'No spaces before commas.'
@@ -1217,7 +1326,7 @@ Layout/SpaceInsideBlockBraces:
1217
1326
 
1218
1327
  Layout/SpaceInsideHashLiteralBraces:
1219
1328
  Description: "Use spaces inside hash literal braces - or don't."
1220
- StyleGuide: '#spaces-operators'
1329
+ StyleGuide: '#spaces-braces'
1221
1330
  Enabled: true
1222
1331
  VersionAdded: '0.49'
1223
1332
  EnforcedStyle: space
@@ -1295,12 +1404,17 @@ Layout/TrailingWhitespace:
1295
1404
  StyleGuide: '#no-trailing-whitespace'
1296
1405
  Enabled: true
1297
1406
  VersionAdded: '0.49'
1298
- VersionChanged: '0.55'
1407
+ VersionChanged: '1.0'
1299
1408
  AllowInHeredoc: false
1300
1409
 
1301
1410
  #################### Lint ##################################
1302
1411
  ### Warnings
1303
1412
 
1413
+ Lint/AmbiguousAssignment:
1414
+ Description: 'Checks for mistyped shorthand assignments.'
1415
+ Enabled: pending
1416
+ VersionAdded: '1.7'
1417
+
1304
1418
  Lint/AmbiguousBlockAssociation:
1305
1419
  Description: >-
1306
1420
  Checks for ambiguous block association with method when param passed without
@@ -1308,6 +1422,8 @@ Lint/AmbiguousBlockAssociation:
1308
1422
  StyleGuide: '#syntax'
1309
1423
  Enabled: true
1310
1424
  VersionAdded: '0.48'
1425
+ VersionChanged: '1.13'
1426
+ IgnoredMethods: []
1311
1427
 
1312
1428
  Lint/AmbiguousOperator:
1313
1429
  Description: >-
@@ -1316,6 +1432,7 @@ Lint/AmbiguousOperator:
1316
1432
  StyleGuide: '#method-invocation-parens'
1317
1433
  Enabled: true
1318
1434
  VersionAdded: '0.17'
1435
+ VersionChanged: '0.83'
1319
1436
 
1320
1437
  Lint/AmbiguousRegexpLiteral:
1321
1438
  Description: >-
@@ -1323,6 +1440,7 @@ Lint/AmbiguousRegexpLiteral:
1323
1440
  a method invocation without parentheses.
1324
1441
  Enabled: true
1325
1442
  VersionAdded: '0.17'
1443
+ VersionChanged: '0.83'
1326
1444
 
1327
1445
  Lint/AssignmentInCondition:
1328
1446
  Description: "Don't use assignment in conditions."
@@ -1336,39 +1454,138 @@ Lint/BigDecimalNew:
1336
1454
  Enabled: true
1337
1455
  VersionAdded: '0.53'
1338
1456
 
1457
+ Lint/BinaryOperatorWithIdenticalOperands:
1458
+ Description: 'This cop checks for places where binary operator has identical operands.'
1459
+ Enabled: true
1460
+ Safe: false
1461
+ VersionAdded: '0.89'
1462
+ VersionChanged: '1.7'
1463
+
1339
1464
  Lint/BooleanSymbol:
1340
1465
  Description: 'Check for `:true` and `:false` symbols.'
1341
1466
  Enabled: true
1467
+ Safe: false
1342
1468
  VersionAdded: '0.50'
1343
- VersionChanged: '0.81'
1469
+ VersionChanged: '0.83'
1344
1470
 
1345
1471
  Lint/CircularArgumentReference:
1346
1472
  Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
1347
1473
  Enabled: true
1348
1474
  VersionAdded: '0.33'
1349
1475
 
1476
+ Lint/ConstantDefinitionInBlock:
1477
+ Description: 'Do not define constants within a block.'
1478
+ StyleGuide: '#no-constant-definition-in-block'
1479
+ Enabled: true
1480
+ VersionAdded: '0.91'
1481
+ VersionChanged: '1.3'
1482
+ # `enums` for Typed Enums via T::Enum in Sorbet.
1483
+ # https://sorbet.org/docs/tenum
1484
+ AllowedMethods:
1485
+ - enums
1486
+
1487
+ Lint/ConstantResolution:
1488
+ Description: 'Check that constants are fully qualified with `::`.'
1489
+ Enabled: false
1490
+ VersionAdded: '0.86'
1491
+ # Restrict this cop to only looking at certain names
1492
+ Only: []
1493
+ # Restrict this cop from only looking at certain names
1494
+ Ignore: []
1495
+
1350
1496
  Lint/Debugger:
1351
1497
  Description: 'Check for debugger calls.'
1352
1498
  Enabled: true
1353
1499
  VersionAdded: '0.14'
1354
- VersionChanged: '0.49'
1500
+ VersionChanged: '1.10'
1501
+ DebuggerReceivers: [] # deprecated
1502
+ DebuggerMethods:
1503
+ # Groups are available so that a specific group can be disabled in
1504
+ # a user's configuration, but are otherwise not significant.
1505
+ Kernel:
1506
+ - binding.irb
1507
+ Byebug:
1508
+ - byebug
1509
+ - remote_byebug
1510
+ - Kernel.byebug
1511
+ - Kernel.remote_byebug
1512
+ Capybara:
1513
+ - save_and_open_page
1514
+ - save_and_open_screenshot
1515
+ Pry:
1516
+ - binding.pry
1517
+ - binding.remote_pry
1518
+ - binding.pry_remote
1519
+ - Pry.rescue
1520
+ Rails:
1521
+ - debugger
1522
+ - Kernel.debugger
1523
+ WebConsole:
1524
+ - binding.console
1355
1525
 
1356
1526
  Lint/DeprecatedClassMethods:
1357
1527
  Description: 'Check for deprecated class method calls.'
1358
1528
  Enabled: true
1359
1529
  VersionAdded: '0.19'
1360
1530
 
1531
+ Lint/DeprecatedConstants:
1532
+ Description: 'Checks for deprecated constants.'
1533
+ Enabled: pending
1534
+ VersionAdded: '1.8'
1535
+ # You can configure deprecated constants.
1536
+ # If there is an alternative method, you can set alternative value as `Alternative`.
1537
+ # And you can set the deprecated version as `DeprecatedVersion`.
1538
+ # These options can be omitted if they are not needed.
1539
+ #
1540
+ # DeprecatedConstants:
1541
+ # 'DEPRECATED_CONSTANT':
1542
+ # Alternative: 'alternative_value'
1543
+ # DeprecatedVersion: 'deprecated_version'
1544
+ #
1545
+ DeprecatedConstants:
1546
+ 'NIL':
1547
+ Alternative: 'nil'
1548
+ DeprecatedVersion: '2.4'
1549
+ 'TRUE':
1550
+ Alternative: 'true'
1551
+ DeprecatedVersion: '2.4'
1552
+ 'FALSE':
1553
+ Alternative: 'false'
1554
+ DeprecatedVersion: '2.4'
1555
+ 'Random::DEFAULT':
1556
+ Alternative: 'Random.new'
1557
+ DeprecatedVersion: '3.0'
1558
+
1559
+ Lint/DeprecatedOpenSSLConstant:
1560
+ Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
1561
+ Enabled: true
1562
+ VersionAdded: '0.84'
1563
+
1361
1564
  Lint/DisjunctiveAssignmentInConstructor:
1362
1565
  Description: 'In constructor, plain assignment is preferred over disjunctive.'
1363
1566
  Enabled: true
1364
1567
  Safe: false
1365
1568
  VersionAdded: '0.62'
1569
+ VersionChanged: '0.88'
1570
+
1571
+ Lint/DuplicateBranch:
1572
+ Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
1573
+ Enabled: pending
1574
+ VersionAdded: '1.3'
1575
+ VersionChanged: '1.7'
1576
+ IgnoreLiteralBranches: false
1577
+ IgnoreConstantBranches: false
1366
1578
 
1367
1579
  Lint/DuplicateCaseCondition:
1368
1580
  Description: 'Do not repeat values in case conditionals.'
1369
1581
  Enabled: true
1370
1582
  VersionAdded: '0.45'
1371
1583
 
1584
+ Lint/DuplicateElsifCondition:
1585
+ Description: 'Do not repeat conditions used in if `elsif`.'
1586
+ Enabled: true
1587
+ VersionAdded: '0.88'
1588
+
1372
1589
  Lint/DuplicateHashKey:
1373
1590
  Description: 'Check for duplicate keys in hash literals.'
1374
1591
  Enabled: true
@@ -1380,6 +1597,21 @@ Lint/DuplicateMethods:
1380
1597
  Enabled: true
1381
1598
  VersionAdded: '0.29'
1382
1599
 
1600
+ Lint/DuplicateRegexpCharacterClassElement:
1601
+ Description: 'Checks for duplicate elements in Regexp character classes.'
1602
+ Enabled: pending
1603
+ VersionAdded: '1.1'
1604
+
1605
+ Lint/DuplicateRequire:
1606
+ Description: 'Check for duplicate `require`s and `require_relative`s.'
1607
+ Enabled: true
1608
+ VersionAdded: '0.90'
1609
+
1610
+ Lint/DuplicateRescueException:
1611
+ Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
1612
+ Enabled: true
1613
+ VersionAdded: '0.89'
1614
+
1383
1615
  Lint/EachWithObjectArgument:
1384
1616
  Description: 'Check for immutable argument given to each_with_object.'
1385
1617
  Enabled: true
@@ -1389,19 +1621,51 @@ Lint/ElseLayout:
1389
1621
  Description: 'Check for odd code arrangement in an else block.'
1390
1622
  Enabled: true
1391
1623
  VersionAdded: '0.17'
1624
+ VersionChanged: '1.2'
1625
+
1626
+ Lint/EmptyBlock:
1627
+ Description: 'This cop checks for blocks without a body.'
1628
+ Enabled: pending
1629
+ VersionAdded: '1.1'
1630
+ VersionChanged: '1.15'
1631
+ AllowComments: true
1632
+ AllowEmptyLambdas: true
1633
+
1634
+ Lint/EmptyClass:
1635
+ Description: 'Checks for classes and metaclasses without a body.'
1636
+ Enabled: pending
1637
+ VersionAdded: '1.3'
1638
+ AllowComments: false
1639
+
1640
+ Lint/EmptyConditionalBody:
1641
+ Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
1642
+ Enabled: true
1643
+ AllowComments: true
1644
+ VersionAdded: '0.89'
1392
1645
 
1393
1646
  Lint/EmptyEnsure:
1394
1647
  Description: 'Checks for empty ensure block.'
1395
1648
  Enabled: true
1396
1649
  VersionAdded: '0.10'
1397
1650
  VersionChanged: '0.48'
1398
- AutoCorrect: false
1399
1651
 
1400
1652
  Lint/EmptyExpression:
1401
1653
  Description: 'Checks for empty expressions.'
1402
1654
  Enabled: true
1403
1655
  VersionAdded: '0.45'
1404
1656
 
1657
+ Lint/EmptyFile:
1658
+ Description: 'Enforces that Ruby source files are not empty.'
1659
+ Enabled: true
1660
+ AllowComments: true
1661
+ VersionAdded: '0.90'
1662
+
1663
+ Lint/EmptyInPattern:
1664
+ Description: 'Checks for the presence of `in` pattern branches without a body.'
1665
+ Enabled: pending
1666
+ AllowComments: true
1667
+ VersionAdded: '1.16'
1668
+
1405
1669
  Lint/EmptyInterpolation:
1406
1670
  Description: 'Checks for empty string interpolation.'
1407
1671
  Enabled: true
@@ -1411,13 +1675,16 @@ Lint/EmptyInterpolation:
1411
1675
  Lint/EmptyWhen:
1412
1676
  Description: 'Checks for `when` branches with empty bodies.'
1413
1677
  Enabled: true
1678
+ AllowComments: true
1414
1679
  VersionAdded: '0.45'
1680
+ VersionChanged: '0.83'
1415
1681
 
1416
1682
  Lint/EnsureReturn:
1417
1683
  Description: 'Do not use return in an ensure block.'
1418
1684
  StyleGuide: '#no-return-ensure'
1419
1685
  Enabled: true
1420
1686
  VersionAdded: '0.9'
1687
+ VersionChanged: '0.83'
1421
1688
 
1422
1689
  Lint/ErbNewArguments:
1423
1690
  Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
@@ -1430,6 +1697,12 @@ Lint/FlipFlop:
1430
1697
  Enabled: true
1431
1698
  VersionAdded: '0.16'
1432
1699
 
1700
+ Lint/FloatComparison:
1701
+ Description: 'Checks for the presence of precise comparison of floating point numbers.'
1702
+ StyleGuide: '#float-comparison'
1703
+ Enabled: true
1704
+ VersionAdded: '0.89'
1705
+
1433
1706
  Lint/FloatOutOfRange:
1434
1707
  Description: >-
1435
1708
  Catches floating-point literals too large or small for Ruby to
@@ -1442,6 +1715,13 @@ Lint/FormatParameterMismatch:
1442
1715
  Enabled: true
1443
1716
  VersionAdded: '0.33'
1444
1717
 
1718
+ Lint/HashCompareByIdentity:
1719
+ Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
1720
+ StyleGuide: '#identity-comparison'
1721
+ Enabled: true
1722
+ Safe: false
1723
+ VersionAdded: '0.93'
1724
+
1445
1725
  Lint/HeredocMethodCallPosition:
1446
1726
  Description: >-
1447
1727
  Checks for the ordering of a method call where
@@ -1450,6 +1730,12 @@ Lint/HeredocMethodCallPosition:
1450
1730
  StyleGuide: '#heredoc-method-calls'
1451
1731
  VersionAdded: '0.68'
1452
1732
 
1733
+ Lint/IdentityComparison:
1734
+ Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
1735
+ Enabled: true
1736
+ StyleGuide: '#identity-comparison'
1737
+ VersionAdded: '0.91'
1738
+
1453
1739
  Lint/ImplicitStringConcatenation:
1454
1740
  Description: >-
1455
1741
  Checks for adjacent string literals on the same line, which
@@ -1477,7 +1763,14 @@ Lint/InheritException:
1477
1763
  Lint/InterpolationCheck:
1478
1764
  Description: 'Raise warning for interpolation in single q strs.'
1479
1765
  Enabled: true
1766
+ Safe: false
1480
1767
  VersionAdded: '0.50'
1768
+ VersionChanged: '0.87'
1769
+
1770
+ Lint/LambdaWithoutLiteralBlock:
1771
+ Description: 'Checks uses of lambda without a literal block.'
1772
+ Enabled: pending
1773
+ VersionAdded: '1.8'
1481
1774
 
1482
1775
  Lint/LiteralAsCondition:
1483
1776
  Description: 'Checks of literals used in conditions.'
@@ -1497,6 +1790,8 @@ Lint/Loop:
1497
1790
  StyleGuide: '#loop-with-break'
1498
1791
  Enabled: true
1499
1792
  VersionAdded: '0.9'
1793
+ VersionChanged: '1.3'
1794
+ Safe: false
1500
1795
 
1501
1796
  Lint/MissingCopEnableDirective:
1502
1797
  Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
@@ -1511,11 +1806,25 @@ Lint/MissingCopEnableDirective:
1511
1806
  # .inf for any size
1512
1807
  MaximumRangeSize: .inf
1513
1808
 
1809
+ Lint/MissingSuper:
1810
+ Description: >-
1811
+ This cop checks for the presence of constructors and lifecycle callbacks
1812
+ without calls to `super`.
1813
+ Enabled: true
1814
+ VersionAdded: '0.89'
1815
+ VersionChanged: '1.4'
1816
+
1817
+ Lint/MixedRegexpCaptureTypes:
1818
+ Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
1819
+ Enabled: true
1820
+ VersionAdded: '0.85'
1821
+
1514
1822
  Lint/MultipleComparison:
1515
1823
  Description: "Use `&&` operator to compare multiple values."
1516
1824
  Enabled: true
1517
1825
  VersionAdded: '0.47'
1518
- VersionChanged: '0.77'
1826
+ VersionChanged: '1.1'
1827
+ AllowMethodComparison: true
1519
1828
 
1520
1829
  Lint/NestedMethodDefinition:
1521
1830
  Description: 'Do not use nested method definitions.'
@@ -1535,6 +1844,11 @@ Lint/NextWithoutAccumulator:
1535
1844
  Enabled: true
1536
1845
  VersionAdded: '0.36'
1537
1846
 
1847
+ Lint/NoReturnInBeginEndBlocks:
1848
+ Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
1849
+ Enabled: pending
1850
+ VersionAdded: '1.2'
1851
+
1538
1852
  Lint/NonDeterministicRequireOrder:
1539
1853
  Description: 'Always sort arrays returned by Dir.glob when requiring files.'
1540
1854
  Enabled: true
@@ -1550,14 +1864,35 @@ Lint/NumberConversion:
1550
1864
  Description: 'Checks unsafe usage of number conversion methods.'
1551
1865
  Enabled: false
1552
1866
  VersionAdded: '0.53'
1553
- VersionChanged: '0.70'
1867
+ VersionChanged: '1.1'
1554
1868
  SafeAutoCorrect: false
1869
+ IgnoredMethods: []
1870
+ IgnoredClasses:
1871
+ - Time
1872
+ - DateTime
1873
+
1874
+ Lint/NumberedParameterAssignment:
1875
+ Description: 'Checks for uses of numbered parameter assignment.'
1876
+ Enabled: pending
1877
+ VersionAdded: '1.9'
1878
+
1879
+ Lint/OrAssignmentToConstant:
1880
+ Description: 'Checks unintended or-assignment to constant.'
1881
+ Enabled: pending
1882
+ Safe: false
1883
+ VersionAdded: '1.9'
1555
1884
 
1556
1885
  Lint/OrderedMagicComments:
1557
1886
  Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1558
1887
  Enabled: true
1559
1888
  VersionAdded: '0.53'
1560
1889
 
1890
+ Lint/OutOfRangeRegexpRef:
1891
+ Description: 'Checks for out of range reference for Regexp because it always returns nil.'
1892
+ Enabled: true
1893
+ Safe: false
1894
+ VersionAdded: '0.89'
1895
+
1561
1896
  Lint/ParenthesesAsGroupedExpression:
1562
1897
  Description: >-
1563
1898
  Checks for method calls with a space before the opening
@@ -1565,6 +1900,7 @@ Lint/ParenthesesAsGroupedExpression:
1565
1900
  StyleGuide: '#parens-no-spaces'
1566
1901
  Enabled: true
1567
1902
  VersionAdded: '0.12'
1903
+ VersionChanged: '0.83'
1568
1904
 
1569
1905
  Lint/PercentStringArray:
1570
1906
  Description: >-
@@ -1582,8 +1918,10 @@ Lint/PercentSymbolArray:
1582
1918
  Lint/RaiseException:
1583
1919
  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
1584
1920
  StyleGuide: '#raise-exception'
1585
- Enabled: pending
1921
+ Enabled: true
1922
+ Safe: false
1586
1923
  VersionAdded: '0.81'
1924
+ VersionChanged: '0.86'
1587
1925
  AllowedImplicitNamespaces:
1588
1926
  - 'Gem'
1589
1927
 
@@ -1607,15 +1945,35 @@ Lint/RedundantCopEnableDirective:
1607
1945
  Enabled: true
1608
1946
  VersionAdded: '0.76'
1609
1947
 
1948
+ Lint/RedundantDirGlobSort:
1949
+ Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
1950
+ Enabled: pending
1951
+ VersionAdded: '1.8'
1952
+
1610
1953
  Lint/RedundantRequireStatement:
1611
1954
  Description: 'Checks for unnecessary `require` statement.'
1612
1955
  Enabled: true
1613
1956
  VersionAdded: '0.76'
1614
1957
 
1958
+ Lint/RedundantSafeNavigation:
1959
+ Description: 'Checks for redundant safe navigation calls.'
1960
+ Enabled: true
1961
+ VersionAdded: '0.93'
1962
+ AllowedMethods:
1963
+ - instance_of?
1964
+ - kind_of?
1965
+ - is_a?
1966
+ - eql?
1967
+ - respond_to?
1968
+ - equal?
1969
+ Safe: false
1970
+
1615
1971
  Lint/RedundantSplatExpansion:
1616
1972
  Description: 'Checks for splat unnecessarily being called on literals.'
1617
1973
  Enabled: true
1618
1974
  VersionAdded: '0.76'
1975
+ VersionChanged: '1.7'
1976
+ AllowPercentLiteralArrayArgument: true
1619
1977
 
1620
1978
  Lint/RedundantStringCoercion:
1621
1979
  Description: 'Checks for Object#to_s usage in string interpolation.'
@@ -1640,6 +1998,7 @@ Lint/RegexpAsCondition:
1640
1998
  The regexp literal matches `$_` implicitly.
1641
1999
  Enabled: true
1642
2000
  VersionAdded: '0.51'
2001
+ VersionChanged: '0.86'
1643
2002
 
1644
2003
  Lint/RequireParentheses:
1645
2004
  Description: >-
@@ -1653,7 +2012,7 @@ Lint/RescueException:
1653
2012
  StyleGuide: '#no-blind-rescues'
1654
2013
  Enabled: true
1655
2014
  VersionAdded: '0.9'
1656
- VersionChanged: '0.27.1'
2015
+ VersionChanged: '0.27'
1657
2016
 
1658
2017
  Lint/RescueType:
1659
2018
  Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
@@ -1676,6 +2035,7 @@ Lint/SafeNavigationChain:
1676
2035
  - presence
1677
2036
  - try
1678
2037
  - try!
2038
+ - in?
1679
2039
 
1680
2040
  Lint/SafeNavigationConsistency:
1681
2041
  Description: >-
@@ -1696,6 +2056,7 @@ Lint/SafeNavigationWithEmpty:
1696
2056
  Description: 'Avoid `foo&.empty?` in conditionals.'
1697
2057
  Enabled: true
1698
2058
  VersionAdded: '0.62'
2059
+ VersionChanged: '0.87'
1699
2060
 
1700
2061
  Lint/ScriptPermission:
1701
2062
  Description: 'Grant script file execute permission.'
@@ -1703,6 +2064,11 @@ Lint/ScriptPermission:
1703
2064
  VersionAdded: '0.49'
1704
2065
  VersionChanged: '0.50'
1705
2066
 
2067
+ Lint/SelfAssignment:
2068
+ Description: 'Checks for self-assignments.'
2069
+ Enabled: true
2070
+ VersionAdded: '0.89'
2071
+
1706
2072
  Lint/SendWithMixinArgument:
1707
2073
  Description: 'Checks for `send` method when using mixin.'
1708
2074
  Enabled: true
@@ -1731,7 +2097,7 @@ Lint/ShadowingOuterLocalVariable:
1731
2097
 
1732
2098
  Lint/StructNewOverride:
1733
2099
  Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
1734
- Enabled: pending
2100
+ Enabled: true
1735
2101
  VersionAdded: '0.81'
1736
2102
 
1737
2103
  Lint/SuppressedException:
@@ -1739,36 +2105,99 @@ Lint/SuppressedException:
1739
2105
  StyleGuide: '#dont-hide-exceptions'
1740
2106
  Enabled: true
1741
2107
  AllowComments: true
2108
+ AllowNil: true
1742
2109
  VersionAdded: '0.9'
1743
- VersionChanged: '0.81'
2110
+ VersionChanged: '1.12'
2111
+
2112
+ Lint/SymbolConversion:
2113
+ Description: 'Checks for unnecessary symbol conversions.'
2114
+ Enabled: pending
2115
+ VersionAdded: '1.9'
2116
+ VersionChanged: '1.16'
2117
+ EnforcedStyle: strict
2118
+ SupportedStyles:
2119
+ - strict
2120
+ - consistent
1744
2121
 
1745
2122
  Lint/Syntax:
1746
- Description: 'Checks syntax error.'
2123
+ Description: 'Checks for syntax errors.'
1747
2124
  Enabled: true
1748
2125
  VersionAdded: '0.9'
1749
2126
 
2127
+ Lint/ToEnumArguments:
2128
+ Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
2129
+ Enabled: pending
2130
+ VersionAdded: '1.1'
1750
2131
 
1751
2132
  Lint/ToJSON:
1752
2133
  Description: 'Ensure #to_json includes an optional argument.'
1753
2134
  Enabled: true
1754
2135
  VersionAdded: '0.66'
1755
2136
 
2137
+ Lint/TopLevelReturnWithArgument:
2138
+ Description: 'This cop detects top level return statements with argument.'
2139
+ Enabled: true
2140
+ VersionAdded: '0.89'
2141
+
2142
+ Lint/TrailingCommaInAttributeDeclaration:
2143
+ Description: 'This cop checks for trailing commas in attribute declarations.'
2144
+ Enabled: true
2145
+ VersionAdded: '0.90'
2146
+
2147
+ Lint/TripleQuotes:
2148
+ Description: 'Checks for useless triple quote constructs.'
2149
+ Enabled: pending
2150
+ VersionAdded: '1.9'
2151
+
1756
2152
  Lint/UnderscorePrefixedVariableName:
1757
2153
  Description: 'Do not use prefix `_` for a variable that is used.'
1758
2154
  Enabled: true
1759
2155
  VersionAdded: '0.21'
1760
2156
  AllowKeywordBlockArguments: false
1761
2157
 
2158
+ Lint/UnexpectedBlockArity:
2159
+ Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
2160
+ Enabled: pending
2161
+ Safe: false
2162
+ VersionAdded: '1.5'
2163
+ Methods:
2164
+ chunk_while: 2
2165
+ each_with_index: 2
2166
+ each_with_object: 2
2167
+ inject: 2
2168
+ max: 2
2169
+ min: 2
2170
+ minmax: 2
2171
+ reduce: 2
2172
+ slice_when: 2
2173
+ sort: 2
2174
+
1762
2175
  Lint/UnifiedInteger:
1763
2176
  Description: 'Use Integer instead of Fixnum or Bignum.'
1764
2177
  Enabled: true
1765
2178
  VersionAdded: '0.43'
1766
2179
 
2180
+ Lint/UnmodifiedReduceAccumulator:
2181
+ Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
2182
+ Enabled: pending
2183
+ VersionAdded: '1.1'
2184
+ VersionChanged: '1.5'
2185
+
1767
2186
  Lint/UnreachableCode:
1768
2187
  Description: 'Unreachable code.'
1769
2188
  Enabled: true
1770
2189
  VersionAdded: '0.9'
1771
2190
 
2191
+ Lint/UnreachableLoop:
2192
+ Description: 'This cop checks for loops that will have at most one iteration.'
2193
+ Enabled: true
2194
+ VersionAdded: '0.89'
2195
+ VersionChanged: '1.7'
2196
+ IgnoredPatterns:
2197
+ # RSpec uses `times` in its message expectations
2198
+ # eg. `exactly(2).times`
2199
+ - !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
2200
+
1772
2201
  Lint/UnusedBlockArgument:
1773
2202
  Description: 'Checks for unused block arguments.'
1774
2203
  StyleGuide: '#underscore-unused-vars'
@@ -1808,7 +2237,7 @@ Lint/UselessAccessModifier:
1808
2237
  Description: 'Checks for useless access modifiers.'
1809
2238
  Enabled: true
1810
2239
  VersionAdded: '0.20'
1811
- VersionChanged: '0.47'
2240
+ VersionChanged: '0.83'
1812
2241
  ContextCreatingMethods: []
1813
2242
  MethodCreatingMethods: []
1814
2243
 
@@ -1818,21 +2247,30 @@ Lint/UselessAssignment:
1818
2247
  Enabled: true
1819
2248
  VersionAdded: '0.11'
1820
2249
 
1821
- Lint/UselessComparison:
1822
- Description: 'Checks for comparison of something with itself.'
1823
- Enabled: true
1824
- VersionAdded: '0.11'
1825
-
1826
2250
  Lint/UselessElseWithoutRescue:
1827
2251
  Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1828
2252
  Enabled: true
1829
2253
  VersionAdded: '0.17'
1830
2254
 
2255
+ Lint/UselessMethodDefinition:
2256
+ Description: 'Checks for useless method definitions.'
2257
+ Enabled: true
2258
+ VersionAdded: '0.90'
2259
+ Safe: false
2260
+ AllowComments: true
2261
+
1831
2262
  Lint/UselessSetterCall:
1832
2263
  Description: 'Checks for useless setter call to a local variable.'
1833
2264
  Enabled: true
2265
+ SafeAutoCorrect: false
1834
2266
  VersionAdded: '0.13'
1835
- VersionChanged: '0.80'
2267
+ VersionChanged: '1.2'
2268
+ Safe: false
2269
+
2270
+ Lint/UselessTimes:
2271
+ Description: 'Checks for useless `Integer#times` calls.'
2272
+ Enabled: true
2273
+ VersionAdded: '0.91'
1836
2274
  Safe: false
1837
2275
 
1838
2276
  Lint/Void:
@@ -1852,20 +2290,23 @@ Metrics/AbcSize:
1852
2290
  - https://en.wikipedia.org/wiki/ABC_Software_Metric
1853
2291
  Enabled: true
1854
2292
  VersionAdded: '0.27'
1855
- VersionChanged: '0.81'
2293
+ VersionChanged: '1.5'
1856
2294
  # The ABC size is a calculated magnitude, so this number can be an Integer or
1857
2295
  # a Float.
1858
2296
  IgnoredMethods: []
1859
- Max: 15
2297
+ CountRepeatedAttributes: true
2298
+ Max: 17
1860
2299
 
1861
2300
  Metrics/BlockLength:
1862
2301
  Description: 'Avoid long blocks with many lines.'
1863
2302
  Enabled: true
1864
2303
  VersionAdded: '0.44'
1865
- VersionChanged: '0.66'
2304
+ VersionChanged: '1.5'
1866
2305
  CountComments: false # count full line comments?
1867
2306
  Max: 25
1868
- ExcludedMethods:
2307
+ CountAsOne: []
2308
+ ExcludedMethods: [] # deprecated, retained for backwards compatibility
2309
+ IgnoredMethods:
1869
2310
  # By default, exclude the `#refine` method, as it tends to have larger
1870
2311
  # associated blocks.
1871
2312
  - refine
@@ -1885,8 +2326,10 @@ Metrics/ClassLength:
1885
2326
  Description: 'Avoid classes longer than 100 lines of code.'
1886
2327
  Enabled: true
1887
2328
  VersionAdded: '0.25'
2329
+ VersionChanged: '0.87'
1888
2330
  CountComments: false # count full line comments?
1889
2331
  Max: 100
2332
+ CountAsOne: []
1890
2333
 
1891
2334
  # Avoid complex methods.
1892
2335
  Metrics/CyclomaticComplexity:
@@ -1897,32 +2340,38 @@ Metrics/CyclomaticComplexity:
1897
2340
  VersionAdded: '0.25'
1898
2341
  VersionChanged: '0.81'
1899
2342
  IgnoredMethods: []
1900
- Max: 6
2343
+ Max: 7
1901
2344
 
1902
2345
  Metrics/MethodLength:
1903
2346
  Description: 'Avoid methods longer than 10 lines of code.'
1904
2347
  StyleGuide: '#short-methods'
1905
2348
  Enabled: true
1906
2349
  VersionAdded: '0.25'
1907
- VersionChanged: '0.59.2'
2350
+ VersionChanged: '1.5'
1908
2351
  CountComments: false # count full line comments?
1909
2352
  Max: 10
1910
- ExcludedMethods: []
2353
+ CountAsOne: []
2354
+ ExcludedMethods: [] # deprecated, retained for backwards compatibility
2355
+ IgnoredMethods: []
1911
2356
 
1912
2357
  Metrics/ModuleLength:
1913
2358
  Description: 'Avoid modules longer than 100 lines of code.'
1914
2359
  Enabled: true
1915
2360
  VersionAdded: '0.31'
2361
+ VersionChanged: '0.87'
1916
2362
  CountComments: false # count full line comments?
1917
2363
  Max: 100
2364
+ CountAsOne: []
1918
2365
 
1919
2366
  Metrics/ParameterLists:
1920
2367
  Description: 'Avoid parameter lists longer than three or four parameters.'
1921
2368
  StyleGuide: '#too-many-params'
1922
2369
  Enabled: true
1923
2370
  VersionAdded: '0.25'
2371
+ VersionChanged: '1.5'
1924
2372
  Max: 5
1925
2373
  CountKeywordArgs: true
2374
+ MaxOptionalParameters: 3
1926
2375
 
1927
2376
  Metrics/PerceivedComplexity:
1928
2377
  Description: >-
@@ -1932,7 +2381,7 @@ Metrics/PerceivedComplexity:
1932
2381
  VersionAdded: '0.25'
1933
2382
  VersionChanged: '0.81'
1934
2383
  IgnoredMethods: []
1935
- Max: 7
2384
+ Max: 8
1936
2385
 
1937
2386
  ################## Migration #############################
1938
2387
 
@@ -1952,16 +2401,19 @@ Naming/AccessorMethodName:
1952
2401
  VersionAdded: '0.50'
1953
2402
 
1954
2403
  Naming/AsciiIdentifiers:
1955
- Description: 'Use only ascii symbols in identifiers.'
2404
+ Description: 'Use only ascii symbols in identifiers and constants.'
1956
2405
  StyleGuide: '#english-identifiers'
1957
2406
  Enabled: true
1958
2407
  VersionAdded: '0.50'
2408
+ VersionChanged: '0.87'
2409
+ AsciiConstants: true
1959
2410
 
1960
2411
  Naming/BinaryOperatorParameterName:
1961
2412
  Description: 'When defining binary operators, name the argument other.'
1962
2413
  StyleGuide: '#other-arg'
1963
2414
  Enabled: true
1964
2415
  VersionAdded: '0.50'
2416
+ VersionChanged: '1.2'
1965
2417
 
1966
2418
  Naming/BlockParameterName:
1967
2419
  Description: >-
@@ -1983,6 +2435,11 @@ Naming/ClassAndModuleCamelCase:
1983
2435
  StyleGuide: '#camelcase-classes'
1984
2436
  Enabled: true
1985
2437
  VersionAdded: '0.50'
2438
+ VersionChanged: '0.85'
2439
+ # Allowed class/module names can be specified here.
2440
+ # These can be full or part of the name.
2441
+ AllowedNames:
2442
+ - module_parent
1986
2443
 
1987
2444
  Naming/ConstantName:
1988
2445
  Description: 'Constants should use SCREAMING_SNAKE_CASE.'
@@ -2003,6 +2460,10 @@ Naming/FileName:
2003
2460
  # It further expects it to be nested inside modules which match the names
2004
2461
  # of subdirectories in its path.
2005
2462
  ExpectMatchingDefinition: false
2463
+ # When `false`, changes the behavior of ExpectMatchingDefinition to match only
2464
+ # whether each source file's class or module name matches the file name --
2465
+ # not whether the nested module hierarchy matches the subdirectory path.
2466
+ CheckDefinitionPathHierarchy: true
2006
2467
  # If non-`nil`, expect all source file names to match the following regex.
2007
2468
  # Only the file name itself is matched, not the entire file path.
2008
2469
  # Use anchors as necessary if you want to match the entire name rather than
@@ -2059,6 +2520,7 @@ Naming/HeredocDelimiterCase:
2059
2520
  StyleGuide: '#heredoc-delimiters'
2060
2521
  Enabled: true
2061
2522
  VersionAdded: '0.50'
2523
+ VersionChanged: '1.2'
2062
2524
  EnforcedStyle: uppercase
2063
2525
  SupportedStyles:
2064
2526
  - lowercase
@@ -2072,17 +2534,43 @@ Naming/HeredocDelimiterNaming:
2072
2534
  ForbiddenDelimiters:
2073
2535
  - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
2074
2536
 
2537
+ Naming/InclusiveLanguage:
2538
+ Description: 'Recommend the use of inclusive language instead of problematic terms.'
2539
+ Enabled: pending
2540
+ VersionAdded: '1.18'
2541
+ CheckIdentifiers: true
2542
+ CheckConstants: true
2543
+ CheckVariables: true
2544
+ CheckStrings: false
2545
+ CheckSymbols: true
2546
+ CheckComments: true
2547
+ CheckFilepaths: true
2548
+ FlaggedTerms:
2549
+ whitelist:
2550
+ Regex: !ruby/regexp '/white[-_\s]?list/'
2551
+ Suggestions:
2552
+ - allowlist
2553
+ - permit
2554
+ blacklist:
2555
+ Regex: !ruby/regexp '/black[-_\s]?list/'
2556
+ Suggestions:
2557
+ - denylist
2558
+ - block
2559
+ slave:
2560
+ Suggestions: ['replica', 'secondary', 'follower']
2561
+
2075
2562
  Naming/MemoizedInstanceVariableName:
2076
2563
  Description: >-
2077
2564
  Memoized method name should match memo instance variable name.
2078
2565
  Enabled: true
2079
2566
  VersionAdded: '0.53'
2080
- VersionChanged: '0.58'
2567
+ VersionChanged: '1.2'
2081
2568
  EnforcedStyleForLeadingUnderscores: disallowed
2082
2569
  SupportedStylesForLeadingUnderscores:
2083
2570
  - disallowed
2084
2571
  - required
2085
2572
  - optional
2573
+ Safe: false
2086
2574
 
2087
2575
  Naming/MethodName:
2088
2576
  Description: 'Use the configured style when naming methods.'
@@ -2113,17 +2601,18 @@ Naming/MethodParameterName:
2113
2601
  AllowNamesEndingInNumbers: true
2114
2602
  # Allowed names that will not register an offense
2115
2603
  AllowedNames:
2116
- - io
2117
- - id
2118
- - to
2604
+ - at
2119
2605
  - by
2120
- - 'on'
2606
+ - db
2607
+ - id
2121
2608
  - in
2122
- - at
2609
+ - io
2123
2610
  - ip
2124
- - db
2611
+ - of
2612
+ - 'on'
2125
2613
  - os
2126
2614
  - pp
2615
+ - to
2127
2616
  # Forbidden names that will register an offense
2128
2617
  ForbiddenNames: []
2129
2618
 
@@ -2168,20 +2657,33 @@ Naming/VariableName:
2168
2657
  StyleGuide: '#snake-case-symbols-methods-vars'
2169
2658
  Enabled: true
2170
2659
  VersionAdded: '0.50'
2660
+ VersionChanged: '1.8'
2171
2661
  EnforcedStyle: snake_case
2172
2662
  SupportedStyles:
2173
2663
  - snake_case
2174
2664
  - camelCase
2665
+ AllowedIdentifiers: []
2175
2666
 
2176
2667
  Naming/VariableNumber:
2177
- Description: 'Use the configured style when numbering variables.'
2668
+ Description: 'Use the configured style when numbering symbols, methods and variables.'
2669
+ StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
2178
2670
  Enabled: true
2179
2671
  VersionAdded: '0.50'
2672
+ VersionChanged: '1.4'
2180
2673
  EnforcedStyle: normalcase
2181
2674
  SupportedStyles:
2182
2675
  - snake_case
2183
2676
  - normalcase
2184
2677
  - non_integer
2678
+ CheckMethodNames: true
2679
+ CheckSymbols: true
2680
+ AllowedIdentifiers:
2681
+ - capture3 # Open3.capture3
2682
+ - iso8601 # Time#iso8601
2683
+ - rfc1123_date # CGI.rfc1123_date
2684
+ - rfc822 # Time#rfc822
2685
+ - rfc2822 # Time#rfc2822
2686
+ - rfc3339 # DateTime.rfc3339
2185
2687
 
2186
2688
  #################### Security ##############################
2187
2689
 
@@ -2194,7 +2696,7 @@ Security/JSONLoad:
2194
2696
  Description: >-
2195
2697
  Prefer usage of `JSON.parse` over `JSON.load` due to potential
2196
2698
  security issues. See reference for more information.
2197
- Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2699
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
2198
2700
  Enabled: true
2199
2701
  VersionAdded: '0.43'
2200
2702
  VersionChanged: '0.44'
@@ -2207,21 +2709,22 @@ Security/MarshalLoad:
2207
2709
  Description: >-
2208
2710
  Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2209
2711
  security issues. See reference for more information.
2210
- Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2712
+ Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
2211
2713
  Enabled: true
2212
2714
  VersionAdded: '0.47'
2213
2715
 
2214
2716
  Security/Open:
2215
- Description: 'The use of Kernel#open represents a serious security risk.'
2717
+ Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
2216
2718
  Enabled: true
2217
2719
  VersionAdded: '0.53'
2720
+ VersionChanged: '1.0'
2218
2721
  Safe: false
2219
2722
 
2220
2723
  Security/YAMLLoad:
2221
2724
  Description: >-
2222
2725
  Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2223
2726
  security issues. See reference for more information.
2224
- Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2727
+ Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2225
2728
  Enabled: true
2226
2729
  VersionAdded: '0.47'
2227
2730
  SafeAutoCorrect: false
@@ -2239,6 +2742,17 @@ Style/AccessModifierDeclarations:
2239
2742
  - group
2240
2743
  AllowModifiersOnSymbols: true
2241
2744
 
2745
+ Style/AccessorGrouping:
2746
+ Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
2747
+ Enabled: true
2748
+ VersionAdded: '0.87'
2749
+ EnforcedStyle: grouped
2750
+ SupportedStyles:
2751
+ # separated: each accessor goes in a separate statement.
2752
+ # grouped: accessors are grouped into a single statement.
2753
+ - separated
2754
+ - grouped
2755
+
2242
2756
  Style/Alias:
2243
2757
  Description: 'Use alias instead of alias_method.'
2244
2758
  StyleGuide: '#alias-method-lexically'
@@ -2258,11 +2772,27 @@ Style/AndOr:
2258
2772
  VersionChanged: '0.25'
2259
2773
  # Whether `and` and `or` are banned only in conditionals (conditionals)
2260
2774
  # or completely (always).
2261
- EnforcedStyle: always
2775
+ EnforcedStyle: conditionals
2262
2776
  SupportedStyles:
2263
2777
  - always
2264
2778
  - conditionals
2265
2779
 
2780
+ Style/ArgumentsForwarding:
2781
+ Description: 'Use arguments forwarding.'
2782
+ StyleGuide: '#arguments-forwarding'
2783
+ Enabled: pending
2784
+ AllowOnlyRestArgument: true
2785
+ VersionAdded: '1.1'
2786
+
2787
+ Style/ArrayCoercion:
2788
+ Description: >-
2789
+ Use Array() instead of explicit Array check or [*var], when dealing
2790
+ with a variable you want to treat as an Array, but you're not certain it's an array.
2791
+ StyleGuide: '#array-coercion'
2792
+ Safe: false
2793
+ Enabled: false
2794
+ VersionAdded: '0.88'
2795
+
2266
2796
  Style/ArrayJoin:
2267
2797
  Description: 'Use Array#join instead of Array#*.'
2268
2798
  StyleGuide: '#array-join'
@@ -2276,7 +2806,8 @@ Style/AsciiComments:
2276
2806
  Enabled: true
2277
2807
  VersionAdded: '0.9'
2278
2808
  VersionChanged: '0.52'
2279
- AllowedChars: []
2809
+ AllowedChars:
2810
+ - ©
2280
2811
 
2281
2812
  Style/Attr:
2282
2813
  Description: 'Checks for uses of Module#attr.'
@@ -2306,6 +2837,13 @@ Style/BeginBlock:
2306
2837
  Enabled: true
2307
2838
  VersionAdded: '0.9'
2308
2839
 
2840
+ Style/BisectedAttrAccessor:
2841
+ Description: >-
2842
+ Checks for places where `attr_reader` and `attr_writer`
2843
+ for the same method can be combined into single `attr_accessor`.
2844
+ Enabled: true
2845
+ VersionAdded: '0.87'
2846
+
2309
2847
  Style/BlockComments:
2310
2848
  Description: 'Do not use block comments.'
2311
2849
  StyleGuide: '#no-block-comments'
@@ -2428,6 +2966,7 @@ Style/CaseEquality:
2428
2966
  StyleGuide: '#no-case-equality'
2429
2967
  Enabled: true
2430
2968
  VersionAdded: '0.9'
2969
+ VersionChanged: '0.89'
2431
2970
  # If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
2432
2971
  # the case equality operator is a constant.
2433
2972
  #
@@ -2438,6 +2977,13 @@ Style/CaseEquality:
2438
2977
  # String === "string"
2439
2978
  AllowOnConstant: false
2440
2979
 
2980
+ Style/CaseLikeIf:
2981
+ Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
2982
+ StyleGuide: '#case-vs-if-else'
2983
+ Enabled: true
2984
+ Safe: false
2985
+ VersionAdded: '0.88'
2986
+
2441
2987
  Style/CharacterLiteral:
2442
2988
  Description: 'Checks for uses of character literals.'
2443
2989
  StyleGuide: '#no-character-literals'
@@ -2453,7 +2999,6 @@ Style/ClassAndModuleChildren:
2453
2999
  # have the knowledge to perform either operation safely and thus requires
2454
3000
  # manual oversight.
2455
3001
  SafeAutoCorrect: false
2456
- AutoCorrect: false
2457
3002
  Enabled: true
2458
3003
  VersionAdded: '0.19'
2459
3004
  #
@@ -2485,6 +3030,16 @@ Style/ClassCheck:
2485
3030
  - is_a?
2486
3031
  - kind_of?
2487
3032
 
3033
+ Style/ClassEqualityComparison:
3034
+ Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
3035
+ StyleGuide: '#instance-of-vs-class-comparison'
3036
+ Enabled: true
3037
+ VersionAdded: '0.93'
3038
+ IgnoredMethods:
3039
+ - ==
3040
+ - equal?
3041
+ - eql?
3042
+
2488
3043
  Style/ClassMethods:
2489
3044
  Description: 'Use self when defining module/class methods.'
2490
3045
  StyleGuide: '#def-self-class-methods'
@@ -2492,19 +3047,36 @@ Style/ClassMethods:
2492
3047
  VersionAdded: '0.9'
2493
3048
  VersionChanged: '0.20'
2494
3049
 
3050
+ Style/ClassMethodsDefinitions:
3051
+ Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
3052
+ StyleGuide: '#def-self-class-methods'
3053
+ Enabled: false
3054
+ VersionAdded: '0.89'
3055
+ EnforcedStyle: def_self
3056
+ SupportedStyles:
3057
+ - def_self
3058
+ - self_class
3059
+
2495
3060
  Style/ClassVars:
2496
3061
  Description: 'Avoid the use of class variables.'
2497
3062
  StyleGuide: '#no-class-vars'
2498
3063
  Enabled: true
2499
3064
  VersionAdded: '0.13'
2500
3065
 
3066
+ Style/CollectionCompact:
3067
+ Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
3068
+ Enabled: pending
3069
+ Safe: false
3070
+ VersionAdded: '1.2'
3071
+ VersionChanged: '1.3'
3072
+
2501
3073
  # Align with the style guide.
2502
3074
  Style/CollectionMethods:
2503
3075
  Description: 'Preferred collection methods.'
2504
3076
  StyleGuide: '#map-find-select-reduce-include-size'
2505
3077
  Enabled: false
2506
3078
  VersionAdded: '0.9'
2507
- VersionChanged: '0.27'
3079
+ VersionChanged: '1.7'
2508
3080
  Safe: false
2509
3081
  # Mapping from undesired method to desired method
2510
3082
  # e.g. to use `detect` over `find`:
@@ -2519,6 +3091,11 @@ Style/CollectionMethods:
2519
3091
  detect: 'find'
2520
3092
  find_all: 'select'
2521
3093
  member?: 'include?'
3094
+ # Methods in this array accept a final symbol as an implicit block
3095
+ # eg. `inject(:+)`
3096
+ MethodsAcceptingSymbol:
3097
+ - inject
3098
+ - reduce
2522
3099
 
2523
3100
  Style/ColonMethodCall:
2524
3101
  Description: 'Do not use :: for method call.'
@@ -2532,6 +3109,14 @@ Style/ColonMethodDefinition:
2532
3109
  Enabled: true
2533
3110
  VersionAdded: '0.52'
2534
3111
 
3112
+ Style/CombinableLoops:
3113
+ Description: >-
3114
+ Checks for places where multiple consecutive loops over the same data
3115
+ can be combined into a single loop.
3116
+ Enabled: true
3117
+ Safe: false
3118
+ VersionAdded: '0.90'
3119
+
2535
3120
  Style/CommandLiteral:
2536
3121
  Description: 'Use `` or %x around command literals.'
2537
3122
  StyleGuide: '#percent-x'
@@ -2553,22 +3138,25 @@ Style/CommandLiteral:
2553
3138
  Style/CommentAnnotation:
2554
3139
  Description: >-
2555
3140
  Checks formatting of special comments
2556
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
3141
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
2557
3142
  StyleGuide: '#annotate-keywords'
2558
3143
  Enabled: true
2559
3144
  VersionAdded: '0.10'
2560
- VersionChanged: '0.31'
3145
+ VersionChanged: '1.3'
2561
3146
  Keywords:
2562
3147
  - TODO
2563
3148
  - FIXME
2564
3149
  - OPTIMIZE
2565
3150
  - HACK
2566
3151
  - REVIEW
3152
+ - NOTE
3153
+ RequireColon: true
2567
3154
 
2568
3155
  Style/CommentedKeyword:
2569
3156
  Description: 'Do not place comments on the same line as certain keywords.'
2570
3157
  Enabled: true
2571
3158
  VersionAdded: '0.51'
3159
+ VersionChanged: '1.7'
2572
3160
 
2573
3161
  Style/ConditionalAssignment:
2574
3162
  Description: >-
@@ -2597,6 +3185,8 @@ Style/ConstantVisibility:
2597
3185
  visibility declarations.
2598
3186
  Enabled: false
2599
3187
  VersionAdded: '0.66'
3188
+ VersionChanged: '1.10'
3189
+ IgnoreModules: false
2600
3190
 
2601
3191
  # Checks that you have put a copyright in a comment before any code.
2602
3192
  #
@@ -2628,7 +3218,8 @@ Style/DateTime:
2628
3218
  StyleGuide: '#date--time'
2629
3219
  Enabled: false
2630
3220
  VersionAdded: '0.51'
2631
- VersionChanged: '0.59'
3221
+ VersionChanged: '0.92'
3222
+ SafeAutoCorrect: false
2632
3223
  AllowCoercion: false
2633
3224
 
2634
3225
  Style/DefWithParentheses:
@@ -2650,11 +3241,23 @@ Style/DisableCopsWithinSourceCodeDirective:
2650
3241
  Forbids disabling/enabling cops within source code.
2651
3242
  Enabled: false
2652
3243
  VersionAdded: '0.82'
3244
+ VersionChanged: '1.9'
3245
+ AllowedCops: []
3246
+
3247
+ Style/DocumentDynamicEvalDefinition:
3248
+ Description: >-
3249
+ When using `class_eval` (or other `eval`) with string interpolation,
3250
+ add a comment block showing its appearance if interpolated.
3251
+ StyleGuide: '#eval-comment-docs'
3252
+ Enabled: pending
3253
+ VersionAdded: '1.1'
3254
+ VersionChanged: '1.3'
2653
3255
 
2654
3256
  Style/Documentation:
2655
3257
  Description: 'Document classes and non-namespace modules.'
2656
3258
  Enabled: true
2657
3259
  VersionAdded: '0.9'
3260
+ AllowedConstants: []
2658
3261
  Exclude:
2659
3262
  - 'spec/**/*'
2660
3263
  - 'test/**/*'
@@ -2678,6 +3281,12 @@ Style/DoubleNegation:
2678
3281
  StyleGuide: '#no-bang-bang'
2679
3282
  Enabled: true
2680
3283
  VersionAdded: '0.19'
3284
+ VersionChanged: '1.2'
3285
+ EnforcedStyle: allowed_in_returns
3286
+ SafeAutoCorrect: false
3287
+ SupportedStyles:
3288
+ - allowed_in_returns
3289
+ - forbidden
2681
3290
 
2682
3291
  Style/EachForSimpleLoop:
2683
3292
  Description: >-
@@ -2752,6 +3361,17 @@ Style/EndBlock:
2752
3361
  VersionAdded: '0.9'
2753
3362
  VersionChanged: '0.81'
2754
3363
 
3364
+ Style/EndlessMethod:
3365
+ Description: 'Avoid the use of multi-lined endless method definitions.'
3366
+ StyleGuide: '#endless-methods'
3367
+ Enabled: pending
3368
+ VersionAdded: '1.8'
3369
+ EnforcedStyle: allow_single_line
3370
+ SupportedStyles:
3371
+ - allow_single_line
3372
+ - allow_always
3373
+ - disallow
3374
+
2755
3375
  Style/EvalWithLocation:
2756
3376
  Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
2757
3377
  Enabled: true
@@ -2769,10 +3389,19 @@ Style/ExpandPathArguments:
2769
3389
  Enabled: true
2770
3390
  VersionAdded: '0.53'
2771
3391
 
3392
+ Style/ExplicitBlockArgument:
3393
+ Description: >-
3394
+ Consider using explicit block argument to avoid writing block literal
3395
+ that just passes its arguments to another block.
3396
+ StyleGuide: '#block-argument'
3397
+ Enabled: true
3398
+ VersionAdded: '0.89'
3399
+ VersionChanged: '1.8'
3400
+
2772
3401
  Style/ExponentialNotation:
2773
3402
  Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
2774
3403
  StyleGuide: '#exponential-notation'
2775
- Enabled: pending
3404
+ Enabled: true
2776
3405
  VersionAdded: '0.82'
2777
3406
  EnforcedStyle: scientific
2778
3407
  SupportedStyles:
@@ -2783,9 +3412,11 @@ Style/ExponentialNotation:
2783
3412
  Style/FloatDivision:
2784
3413
  Description: 'For performing float division, coerce one side only.'
2785
3414
  StyleGuide: '#float-division'
2786
- Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
3415
+ Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
2787
3416
  Enabled: true
2788
3417
  VersionAdded: '0.72'
3418
+ VersionChanged: '1.9'
3419
+ Safe: false
2789
3420
  EnforcedStyle: single_coerce
2790
3421
  SupportedStyles:
2791
3422
  - left_coerce
@@ -2827,8 +3458,13 @@ Style/FormatStringToken:
2827
3458
  # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
2828
3459
  - template
2829
3460
  - unannotated
3461
+ # `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
3462
+ # style token in a format string to be allowed when enforced style is not
3463
+ # `unannotated`.
3464
+ MaxUnannotatedPlaceholdersAllowed: 1
2830
3465
  VersionAdded: '0.49'
2831
- VersionChanged: '0.75'
3466
+ VersionChanged: '1.0'
3467
+ IgnoredMethods: []
2832
3468
 
2833
3469
  Style/FrozenStringLiteralComment:
2834
3470
  Description: >-
@@ -2841,8 +3477,7 @@ Style/FrozenStringLiteralComment:
2841
3477
  SupportedStyles:
2842
3478
  # `always` will always add the frozen string literal comment to a file
2843
3479
  # regardless of the Ruby version or if `freeze` or `<<` are called on a
2844
- # string literal. If you run code against multiple versions of Ruby, it is
2845
- # possible that this will create errors in Ruby 2.3.0+.
3480
+ # string literal. It is possible that this will create errors.
2846
3481
  - always
2847
3482
  # `always_true` will add the frozen string literal comment to a file,
2848
3483
  # similarly to the `always` style, but will also change any disabled
@@ -2851,7 +3486,14 @@ Style/FrozenStringLiteralComment:
2851
3486
  # `never` will enforce that the frozen string literal comment does not
2852
3487
  # exist in a file.
2853
3488
  - never
2854
- Safe: false
3489
+ SafeAutoCorrect: false
3490
+
3491
+ Style/GlobalStdStream:
3492
+ Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
3493
+ StyleGuide: '#global-stdout'
3494
+ Enabled: true
3495
+ VersionAdded: '0.89'
3496
+ SafeAutoCorrect: false
2855
3497
 
2856
3498
  Style/GlobalVars:
2857
3499
  Description: 'Do not introduce global variables.'
@@ -2872,12 +3514,51 @@ Style/GuardClause:
2872
3514
  # needs to have to trigger this cop
2873
3515
  MinBodyLength: 1
2874
3516
 
3517
+ Style/HashAsLastArrayItem:
3518
+ Description: >-
3519
+ Checks for presence or absence of braces around hash literal as a last
3520
+ array item depending on configuration.
3521
+ StyleGuide: '#hash-literal-as-last-array-item'
3522
+ Enabled: true
3523
+ VersionAdded: '0.88'
3524
+ EnforcedStyle: braces
3525
+ SupportedStyles:
3526
+ - braces
3527
+ - no_braces
3528
+
3529
+ Style/HashConversion:
3530
+ Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3531
+ StyleGuide: '#avoid-hash-constructor'
3532
+ Enabled: pending
3533
+ VersionAdded: '1.10'
3534
+ VersionChanged: '1.11'
3535
+ AllowSplatArgument: true
3536
+
2875
3537
  Style/HashEachMethods:
2876
3538
  Description: 'Use Hash#each_key and Hash#each_value.'
2877
3539
  StyleGuide: '#hash-each'
2878
- Enabled: pending
2879
- VersionAdded: '0.80'
3540
+ Enabled: true
2880
3541
  Safe: false
3542
+ VersionAdded: '0.80'
3543
+ VersionChanged: '1.16'
3544
+ AllowedReceivers: []
3545
+
3546
+ Style/HashExcept:
3547
+ Description: >-
3548
+ Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
3549
+ that can be replaced with `Hash#except` method.
3550
+ Enabled: pending
3551
+ VersionAdded: '1.7'
3552
+
3553
+ Style/HashLikeCase:
3554
+ Description: >-
3555
+ Checks for places where `case-when` represents a simple 1:1
3556
+ mapping and can be replaced with a hash lookup.
3557
+ Enabled: true
3558
+ VersionAdded: '0.88'
3559
+ # `MinBranchesCount` defines the number of branches `case` needs to have
3560
+ # to trigger this cop
3561
+ MinBranchesCount: 3
2881
3562
 
2882
3563
  Style/HashSyntax:
2883
3564
  Description: >-
@@ -2903,15 +3584,17 @@ Style/HashSyntax:
2903
3584
  PreferHashRocketsForNonAlnumEndingSymbols: false
2904
3585
 
2905
3586
  Style/HashTransformKeys:
2906
- Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
2907
- Enabled: 'pending'
3587
+ Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
3588
+ Enabled: true
2908
3589
  VersionAdded: '0.80'
3590
+ VersionChanged: '0.90'
2909
3591
  Safe: false
2910
3592
 
2911
3593
  Style/HashTransformValues:
2912
- Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
2913
- Enabled: 'pending'
3594
+ Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
3595
+ Enabled: true
2914
3596
  VersionAdded: '0.80'
3597
+ VersionChanged: '0.90'
2915
3598
  Safe: false
2916
3599
 
2917
3600
  Style/IdenticalConditionalBranches:
@@ -2921,12 +3604,14 @@ Style/IdenticalConditionalBranches:
2921
3604
  out of the conditional.
2922
3605
  Enabled: true
2923
3606
  VersionAdded: '0.36'
3607
+ VersionChanged: '1.16'
2924
3608
 
2925
3609
  Style/IfInsideElse:
2926
3610
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
2927
3611
  Enabled: true
2928
3612
  AllowIfModifier: false
2929
3613
  VersionAdded: '0.36'
3614
+ VersionChanged: '1.3'
2930
3615
 
2931
3616
  Style/IfUnlessModifier:
2932
3617
  Description: >-
@@ -2942,12 +3627,22 @@ Style/IfUnlessModifierOfIfUnless:
2942
3627
  Avoid modifier if/unless usage on conditionals.
2943
3628
  Enabled: true
2944
3629
  VersionAdded: '0.39'
3630
+ VersionChanged: '0.87'
3631
+
3632
+ Style/IfWithBooleanLiteralBranches:
3633
+ Description: 'Checks for redundant `if` with boolean literal branches.'
3634
+ Enabled: pending
3635
+ VersionAdded: '1.9'
3636
+ SafeAutoCorrect: false
3637
+ AllowedMethods:
3638
+ - nonzero?
2945
3639
 
2946
3640
  Style/IfWithSemicolon:
2947
3641
  Description: 'Do not use if x; .... Use the ternary operator instead.'
2948
3642
  StyleGuide: '#no-semicolon-ifs'
2949
3643
  Enabled: true
2950
3644
  VersionAdded: '0.9'
3645
+ VersionChanged: '0.83'
2951
3646
 
2952
3647
  Style/ImplicitRuntimeError:
2953
3648
  Description: >-
@@ -2956,13 +3651,21 @@ Style/ImplicitRuntimeError:
2956
3651
  Enabled: false
2957
3652
  VersionAdded: '0.41'
2958
3653
 
3654
+ Style/InPatternThen:
3655
+ Description: 'Checks for `in;` uses in `case` expressions.'
3656
+ StyleGuide: '#no-in-pattern-semicolons'
3657
+ Enabled: pending
3658
+ VersionAdded: '1.16'
3659
+
2959
3660
  Style/InfiniteLoop:
2960
- Description: 'Use Kernel#loop for infinite loops.'
3661
+ Description: >-
3662
+ Use Kernel#loop for infinite loops.
3663
+ This cop is unsafe in the body may raise a `StopIteration` exception.
3664
+ Safe: false
2961
3665
  StyleGuide: '#infinite-loop'
2962
3666
  Enabled: true
2963
3667
  VersionAdded: '0.26'
2964
3668
  VersionChanged: '0.61'
2965
- SafeAutoCorrect: true
2966
3669
 
2967
3670
  Style/InlineComment:
2968
3671
  Description: 'Avoid trailing inline comments.'
@@ -3000,11 +3703,23 @@ Style/IpAddresses:
3000
3703
  Description: "Don't include literal IP addresses in code."
3001
3704
  Enabled: false
3002
3705
  VersionAdded: '0.58'
3003
- VersionChanged: '0.77'
3706
+ VersionChanged: '0.91'
3004
3707
  # Allow addresses to be permitted
3005
3708
  AllowedAddresses:
3006
3709
  - "::"
3007
3710
  # :: is a valid IPv6 address, but could potentially be legitimately in code
3711
+ Exclude:
3712
+ - '**/*.gemfile'
3713
+ - '**/Gemfile'
3714
+ - '**/gems.rb'
3715
+ - '**/*.gemspec'
3716
+
3717
+ Style/KeywordParametersOrder:
3718
+ Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
3719
+ StyleGuide: '#keyword-parameters-order'
3720
+ Enabled: true
3721
+ VersionAdded: '0.90'
3722
+ VersionChanged: '1.7'
3008
3723
 
3009
3724
  Style/Lambda:
3010
3725
  Description: 'Use the new lambda literal syntax for single-line blocks.'
@@ -3043,7 +3758,7 @@ Style/MethodCallWithArgsParentheses:
3043
3758
  StyleGuide: '#method-invocation-parens'
3044
3759
  Enabled: false
3045
3760
  VersionAdded: '0.47'
3046
- VersionChanged: '0.61'
3761
+ VersionChanged: '1.7'
3047
3762
  IgnoreMacros: true
3048
3763
  IgnoredMethods: []
3049
3764
  IgnoredPatterns: []
@@ -3051,6 +3766,7 @@ Style/MethodCallWithArgsParentheses:
3051
3766
  AllowParenthesesInMultilineCall: false
3052
3767
  AllowParenthesesInChaining: false
3053
3768
  AllowParenthesesInCamelCaseMethod: false
3769
+ AllowParenthesesInStringInterpolation: false
3054
3770
  EnforcedStyle: require_parentheses
3055
3771
  SupportedStyles:
3056
3772
  - require_parentheses
@@ -3077,19 +3793,13 @@ Style/MethodDefParentheses:
3077
3793
  StyleGuide: '#method-parens'
3078
3794
  Enabled: true
3079
3795
  VersionAdded: '0.16'
3080
- VersionChanged: '0.35'
3796
+ VersionChanged: '1.7'
3081
3797
  EnforcedStyle: require_parentheses
3082
3798
  SupportedStyles:
3083
3799
  - require_parentheses
3084
3800
  - require_no_parentheses
3085
3801
  - require_no_parentheses_except_multiline
3086
3802
 
3087
- Style/MethodMissingSuper:
3088
- Description: Checks for `method_missing` to call `super`.
3089
- StyleGuide: '#no-method-missing'
3090
- Enabled: true
3091
- VersionAdded: '0.56'
3092
-
3093
3803
  Style/MinMax:
3094
3804
  Description: >-
3095
3805
  Use `Enumerable#minmax` instead of `Enumerable#min`
@@ -3175,6 +3885,12 @@ Style/MultilineIfThen:
3175
3885
  VersionAdded: '0.9'
3176
3886
  VersionChanged: '0.26'
3177
3887
 
3888
+ Style/MultilineInPatternThen:
3889
+ Description: 'Do not use `then` for multi-line `in` statement.'
3890
+ StyleGuide: '#no-then'
3891
+ Enabled: pending
3892
+ VersionAdded: '1.16'
3893
+
3178
3894
  Style/MultilineMemoization:
3179
3895
  Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3180
3896
  Enabled: true
@@ -3189,6 +3905,7 @@ Style/MultilineMethodSignature:
3189
3905
  Description: 'Avoid multi-line method signatures.'
3190
3906
  Enabled: false
3191
3907
  VersionAdded: '0.59'
3908
+ VersionChanged: '1.7'
3192
3909
 
3193
3910
  Style/MultilineTernaryOperator:
3194
3911
  Description: >-
@@ -3197,6 +3914,7 @@ Style/MultilineTernaryOperator:
3197
3914
  StyleGuide: '#no-multiline-ternary'
3198
3915
  Enabled: true
3199
3916
  VersionAdded: '0.9'
3917
+ VersionChanged: '0.86'
3200
3918
 
3201
3919
  Style/MultilineWhenThen:
3202
3920
  Description: 'Do not use then for multi-line when statement.'
@@ -3210,12 +3928,14 @@ Style/MultipleComparison:
3210
3928
  use Array#include? instead.
3211
3929
  Enabled: true
3212
3930
  VersionAdded: '0.49'
3931
+ VersionChanged: '1.1'
3213
3932
 
3214
3933
  Style/MutableConstant:
3215
3934
  Description: 'Do not assign mutable objects to constants.'
3216
3935
  Enabled: true
3217
3936
  VersionAdded: '0.34'
3218
- VersionChanged: '0.65'
3937
+ VersionChanged: '1.8'
3938
+ SafeAutoCorrect: false
3219
3939
  EnforcedStyle: literals
3220
3940
  SupportedStyles:
3221
3941
  # literals: freeze literals assigned to constants
@@ -3244,6 +3964,13 @@ Style/NegatedIf:
3244
3964
  - prefix
3245
3965
  - postfix
3246
3966
 
3967
+ Style/NegatedIfElseCondition:
3968
+ Description: >-
3969
+ This cop checks for uses of `if-else` and ternary operators with a negated condition
3970
+ which can be simplified by inverting condition and swapping branches.
3971
+ Enabled: pending
3972
+ VersionAdded: '1.2'
3973
+
3247
3974
  Style/NegatedUnless:
3248
3975
  Description: 'Favor if over unless for negative conditions.'
3249
3976
  StyleGuide: '#if-for-negatives'
@@ -3301,6 +4028,7 @@ Style/NestedTernaryOperator:
3301
4028
  StyleGuide: '#no-nested-ternary'
3302
4029
  Enabled: true
3303
4030
  VersionAdded: '0.9'
4031
+ VersionChanged: '0.86'
3304
4032
 
3305
4033
  Style/Next:
3306
4034
  Description: 'Use `next` to skip iteration instead of a condition at the end.'
@@ -3330,6 +4058,12 @@ Style/NilComparison:
3330
4058
  - predicate
3331
4059
  - comparison
3332
4060
 
4061
+ Style/NilLambda:
4062
+ Description: 'Prefer `-> {}` to `-> { nil }`.'
4063
+ Enabled: pending
4064
+ VersionAdded: '1.3'
4065
+ VersionChanged: '1.15'
4066
+
3333
4067
  Style/NonNilCheck:
3334
4068
  Description: 'Checks for redundant nil checks.'
3335
4069
  StyleGuide: '#no-non-nil-checks'
@@ -3383,7 +4117,6 @@ Style/NumericPredicate:
3383
4117
  # object. Switching these methods has to be done with knowledge of the types
3384
4118
  # of the variables which rubocop doesn't have.
3385
4119
  SafeAutoCorrect: false
3386
- AutoCorrect: false
3387
4120
  Enabled: true
3388
4121
  VersionAdded: '0.42'
3389
4122
  VersionChanged: '0.59'
@@ -3399,12 +4132,13 @@ Style/NumericPredicate:
3399
4132
 
3400
4133
  Style/OneLineConditional:
3401
4134
  Description: >-
3402
- Favor the ternary operator(?:) over
3403
- if/then/else/end constructs.
4135
+ Favor the ternary operator (?:) or multi-line constructs over
4136
+ single-line if/then/else/end constructs.
3404
4137
  StyleGuide: '#ternary-operator'
3405
4138
  Enabled: true
4139
+ AlwaysCorrectToMultiline: false
3406
4140
  VersionAdded: '0.9'
3407
- VersionChanged: '0.38'
4141
+ VersionChanged: '0.90'
3408
4142
 
3409
4143
  Style/OptionHash:
3410
4144
  Description: "Don't use option hashes when you can use keyword arguments."
@@ -3425,7 +4159,18 @@ Style/OptionalArguments:
3425
4159
  of the argument list.
3426
4160
  StyleGuide: '#optional-arguments'
3427
4161
  Enabled: true
4162
+ Safe: false
3428
4163
  VersionAdded: '0.33'
4164
+ VersionChanged: '0.83'
4165
+
4166
+ Style/OptionalBooleanParameter:
4167
+ Description: 'Use keyword arguments when defining method with boolean argument.'
4168
+ StyleGuide: '#boolean-keyword-arguments'
4169
+ Enabled: true
4170
+ Safe: false
4171
+ VersionAdded: '0.89'
4172
+ AllowedMethods:
4173
+ - respond_to_missing?
3429
4174
 
3430
4175
  Style/OrAssignment:
3431
4176
  Description: 'Recommend usage of double pipe equals (||=) where applicable.'
@@ -3468,7 +4213,7 @@ Style/PercentLiteralDelimiters:
3468
4213
  '%r': '{}'
3469
4214
  '%w': '[]'
3470
4215
  '%W': '[]'
3471
- VersionChanged: '0.48.1'
4216
+ VersionChanged: '0.48'
3472
4217
 
3473
4218
  Style/PercentQLiterals:
3474
4219
  Description: 'Checks if uses of %Q/%q match the configured preference.'
@@ -3504,16 +4249,27 @@ Style/Proc:
3504
4249
  VersionAdded: '0.9'
3505
4250
  VersionChanged: '0.18'
3506
4251
 
4252
+ Style/QuotedSymbols:
4253
+ Description: 'Use a consistent style for quoted symbols.'
4254
+ Enabled: pending
4255
+ VersionAdded: '1.16'
4256
+ EnforcedStyle: same_as_string_literals
4257
+ SupportedStyles:
4258
+ - same_as_string_literals
4259
+ - single_quotes
4260
+ - double_quotes
4261
+
3507
4262
  Style/RaiseArgs:
3508
4263
  Description: 'Checks the arguments passed to raise/fail.'
3509
4264
  StyleGuide: '#exception-class-messages'
3510
4265
  Enabled: true
3511
4266
  VersionAdded: '0.14'
3512
- VersionChanged: '0.40'
4267
+ VersionChanged: '1.2'
3513
4268
  EnforcedStyle: exploded
3514
4269
  SupportedStyles:
3515
4270
  - compact # raise Exception.new(msg)
3516
4271
  - exploded # raise Exception, msg
4272
+ AllowedCompactTypes: []
3517
4273
 
3518
4274
  Style/RandomWithOffset:
3519
4275
  Description: >-
@@ -3523,6 +4279,27 @@ Style/RandomWithOffset:
3523
4279
  Enabled: true
3524
4280
  VersionAdded: '0.52'
3525
4281
 
4282
+ Style/RedundantArgument:
4283
+ Description: 'Check for a redundant argument passed to certain methods.'
4284
+ Enabled: pending
4285
+ Safe: false
4286
+ VersionAdded: '1.4'
4287
+ VersionChanged: '1.7'
4288
+ Methods:
4289
+ # Array#join
4290
+ join: ''
4291
+ # String#split
4292
+ split: ' '
4293
+ # String#chomp
4294
+ chomp: "\n"
4295
+ # String#chomp!
4296
+ chomp!: "\n"
4297
+
4298
+ Style/RedundantAssignment:
4299
+ Description: 'Checks for redundant assignment before returning.'
4300
+ Enabled: true
4301
+ VersionAdded: '0.87'
4302
+
3526
4303
  Style/RedundantBegin:
3527
4304
  Description: "Don't use begin blocks when they are not needed."
3528
4305
  StyleGuide: '#begin-implicit'
@@ -3552,6 +4329,27 @@ Style/RedundantException:
3552
4329
  VersionAdded: '0.14'
3553
4330
  VersionChanged: '0.29'
3554
4331
 
4332
+ Style/RedundantFetchBlock:
4333
+ Description: >-
4334
+ Use `fetch(key, value)` instead of `fetch(key) { value }`
4335
+ when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
4336
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
4337
+ Enabled: true
4338
+ Safe: false
4339
+ # If enabled, this cop will autocorrect usages of
4340
+ # `fetch` being called with block returning a constant.
4341
+ # This can be dangerous since constants will not be defined at that moment.
4342
+ SafeForConstants: false
4343
+ VersionAdded: '0.86'
4344
+
4345
+ Style/RedundantFileExtensionInRequire:
4346
+ Description: >-
4347
+ Checks for the presence of superfluous `.rb` extension in
4348
+ the filename provided to `require` and `require_relative`.
4349
+ StyleGuide: '#no-explicit-rb-to-require'
4350
+ Enabled: true
4351
+ VersionAdded: '0.88'
4352
+
3555
4353
  Style/RedundantFreeze:
3556
4354
  Description: "Checks usages of Object#freeze on immutable objects."
3557
4355
  Enabled: true
@@ -3574,6 +4372,16 @@ Style/RedundantPercentQ:
3574
4372
  Enabled: true
3575
4373
  VersionAdded: '0.76'
3576
4374
 
4375
+ Style/RedundantRegexpCharacterClass:
4376
+ Description: 'Checks for unnecessary single-element Regexp character classes.'
4377
+ Enabled: true
4378
+ VersionAdded: '0.85'
4379
+
4380
+ Style/RedundantRegexpEscape:
4381
+ Description: 'Checks for redundant escapes in Regexps.'
4382
+ Enabled: true
4383
+ VersionAdded: '0.85'
4384
+
3577
4385
  Style/RedundantReturn:
3578
4386
  Description: "Don't use return where it's not required."
3579
4387
  StyleGuide: '#no-explicit-return'
@@ -3590,6 +4398,12 @@ Style/RedundantSelf:
3590
4398
  VersionAdded: '0.10'
3591
4399
  VersionChanged: '0.13'
3592
4400
 
4401
+ Style/RedundantSelfAssignment:
4402
+ Description: 'Checks for places where redundant assignments are made for in place modification methods.'
4403
+ Enabled: true
4404
+ Safe: false
4405
+ VersionAdded: '0.90'
4406
+
3593
4407
  Style/RedundantSort:
3594
4408
  Description: >-
3595
4409
  Use `min` instead of `sort.first`,
@@ -3652,6 +4466,8 @@ Style/SafeNavigation:
3652
4466
  This cop transforms usages of a method call safeguarded by
3653
4467
  a check for the existence of the object to
3654
4468
  safe navigation (`&.`).
4469
+ Auto-correction is unsafe as it assumes the object will
4470
+ be `nil` or truthy, but never `false`.
3655
4471
  Enabled: true
3656
4472
  VersionAdded: '0.43'
3657
4473
  VersionChanged: '0.77'
@@ -3664,6 +4480,7 @@ Style/SafeNavigation:
3664
4480
  - presence
3665
4481
  - try
3666
4482
  - try!
4483
+ SafeAutoCorrect: false
3667
4484
 
3668
4485
  Style/Sample:
3669
4486
  Description: >-
@@ -3709,11 +4526,17 @@ Style/SignalException:
3709
4526
  - only_fail
3710
4527
  - semantic
3711
4528
 
4529
+ Style/SingleArgumentDig:
4530
+ Description: 'Avoid using single argument dig method.'
4531
+ Enabled: true
4532
+ VersionAdded: '0.89'
4533
+ Safe: false
4534
+
3712
4535
  Style/SingleLineBlockParams:
3713
4536
  Description: 'Enforces the names of some block params.'
3714
4537
  Enabled: false
3715
4538
  VersionAdded: '0.16'
3716
- VersionChanged: '0.47'
4539
+ VersionChanged: '1.6'
3717
4540
  Methods:
3718
4541
  - reduce:
3719
4542
  - acc
@@ -3727,9 +4550,24 @@ Style/SingleLineMethods:
3727
4550
  StyleGuide: '#no-single-line-methods'
3728
4551
  Enabled: true
3729
4552
  VersionAdded: '0.9'
3730
- VersionChanged: '0.19'
4553
+ VersionChanged: '1.8'
3731
4554
  AllowIfMethodIsEmpty: true
3732
4555
 
4556
+ Style/SlicingWithRange:
4557
+ Description: 'Checks array slicing is done with endless ranges when suitable.'
4558
+ Enabled: true
4559
+ VersionAdded: '0.83'
4560
+ Safe: false
4561
+
4562
+ Style/SoleNestedConditional:
4563
+ Description: >-
4564
+ Finds sole nested conditional nodes
4565
+ which can be merged into outer conditional node.
4566
+ Enabled: true
4567
+ VersionAdded: '0.89'
4568
+ VersionChanged: '1.5'
4569
+ AllowModifier: false
4570
+
3733
4571
  Style/SpecialGlobalVars:
3734
4572
  Description: 'Avoid Perl-style global variables.'
3735
4573
  StyleGuide: '#no-cryptic-perlisms'
@@ -3752,12 +4590,35 @@ Style/StabbyLambdaParentheses:
3752
4590
  - require_parentheses
3753
4591
  - require_no_parentheses
3754
4592
 
4593
+ Style/StaticClass:
4594
+ Description: 'Prefer modules to classes with only class methods.'
4595
+ StyleGuide: '#modules-vs-classes'
4596
+ Enabled: false
4597
+ Safe: false
4598
+ VersionAdded: '1.3'
4599
+
3755
4600
  Style/StderrPuts:
3756
4601
  Description: 'Use `warn` instead of `$stderr.puts`.'
3757
4602
  StyleGuide: '#warn'
3758
4603
  Enabled: true
3759
4604
  VersionAdded: '0.51'
3760
4605
 
4606
+ Style/StringChars:
4607
+ Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
4608
+ StyleGuide: '#string-chars'
4609
+ Enabled: pending
4610
+ Safe: false
4611
+ VersionAdded: '1.12'
4612
+
4613
+ Style/StringConcatenation:
4614
+ Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
4615
+ StyleGuide: '#string-interpolation'
4616
+ Enabled: true
4617
+ Safe: false
4618
+ VersionAdded: '0.89'
4619
+ VersionChanged: '1.18'
4620
+ Mode: aggressive
4621
+
3761
4622
  Style/StringHashKeys:
3762
4623
  Description: 'Prefer symbols instead of strings as hash keys.'
3763
4624
  StyleGuide: '#symbols-as-keys'
@@ -3795,7 +4656,7 @@ Style/StringMethods:
3795
4656
  Description: 'Checks if configured preferred methods are used over non-preferred.'
3796
4657
  Enabled: false
3797
4658
  VersionAdded: '0.34'
3798
- VersionChanged: '0.34.2'
4659
+ VersionChanged: '0.34'
3799
4660
  # Mapping from undesired method to desired_method
3800
4661
  # e.g. to use `to_sym` over `intern`:
3801
4662
  #
@@ -3815,6 +4676,14 @@ Style/StructInheritance:
3815
4676
  StyleGuide: '#no-extend-struct-new'
3816
4677
  Enabled: true
3817
4678
  VersionAdded: '0.29'
4679
+ VersionChanged: '0.86'
4680
+
4681
+ Style/SwapValues:
4682
+ Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
4683
+ StyleGuide: '#values-swapping'
4684
+ Enabled: pending
4685
+ VersionAdded: '1.1'
4686
+ SafeAutoCorrect: false
3818
4687
 
3819
4688
  Style/SymbolArray:
3820
4689
  Description: 'Use %i or %I for arrays of symbols.'
@@ -3836,9 +4705,10 @@ Style/SymbolLiteral:
3836
4705
  Style/SymbolProc:
3837
4706
  Description: 'Use symbols as procs instead of blocks when possible.'
3838
4707
  Enabled: true
3839
- SafeAutoCorrect: false
4708
+ Safe: false
3840
4709
  VersionAdded: '0.26'
3841
- VersionChanged: '0.64'
4710
+ VersionChanged: '1.5'
4711
+ AllowMethodsWithArguments: false
3842
4712
  # A list of method names to be ignored by the check.
3843
4713
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
3844
4714
  IgnoredMethods:
@@ -3857,6 +4727,12 @@ Style/TernaryParentheses:
3857
4727
  - require_parentheses_when_complex
3858
4728
  AllowSafeAssignment: true
3859
4729
 
4730
+ Style/TopLevelMethodDefinition:
4731
+ Description: 'This cop looks for top-level method definitions.'
4732
+ StyleGuide: '#top-level-methods'
4733
+ Enabled: false
4734
+ VersionAdded: '1.15'
4735
+
3860
4736
  Style/TrailingBodyOnClass:
3861
4737
  Description: 'Class body goes below class statement.'
3862
4738
  Enabled: true
@@ -3943,7 +4819,7 @@ Style/TrivialAccessors:
3943
4819
  StyleGuide: '#attr_family'
3944
4820
  Enabled: true
3945
4821
  VersionAdded: '0.9'
3946
- VersionChanged: '0.77'
4822
+ VersionChanged: '1.15'
3947
4823
  # When set to `false` the cop will suggest the use of accessor methods
3948
4824
  # in situations like:
3949
4825
  #
@@ -3962,7 +4838,7 @@ Style/TrivialAccessors:
3962
4838
  # on_exception :restart
3963
4839
  #
3964
4840
  # Commonly used in DSLs
3965
- AllowDSLWriters: false
4841
+ AllowDSLWriters: true
3966
4842
  IgnoreClassMethods: false
3967
4843
  AllowedMethods:
3968
4844
  - to_ary
@@ -3991,6 +4867,16 @@ Style/UnlessElse:
3991
4867
  Enabled: true
3992
4868
  VersionAdded: '0.9'
3993
4869
 
4870
+ Style/UnlessLogicalOperators:
4871
+ Description: >-
4872
+ Checks for use of logical operators in an unless condition.
4873
+ Enabled: false
4874
+ VersionAdded: '1.11'
4875
+ EnforcedStyle: forbid_mixed_logical_operators
4876
+ SupportedStyles:
4877
+ - forbid_mixed_logical_operators
4878
+ - forbid_logical_operators
4879
+
3994
4880
  Style/UnpackFirst:
3995
4881
  Description: >-
3996
4882
  Checks for accessing the first element of `String#unpack`