rubocop 0.70.0 → 0.75.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (274) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -10
  3. data/bin/console +1 -0
  4. data/config/default.yml +91 -494
  5. data/lib/rubocop.rb +16 -54
  6. data/lib/rubocop/ast/builder.rb +2 -0
  7. data/lib/rubocop/ast/node.rb +9 -15
  8. data/lib/rubocop/ast/node/float_node.rb +12 -0
  9. data/lib/rubocop/ast/node/int_node.rb +12 -0
  10. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +4 -4
  11. data/lib/rubocop/ast/node/mixin/numeric_node.rb +21 -0
  12. data/lib/rubocop/ast/node/resbody_node.rb +1 -6
  13. data/lib/rubocop/ast/traversal.rb +3 -3
  14. data/lib/rubocop/cached_data.rb +1 -1
  15. data/lib/rubocop/comment_config.rb +3 -2
  16. data/lib/rubocop/config.rb +21 -508
  17. data/lib/rubocop/config_loader.rb +22 -4
  18. data/lib/rubocop/config_loader_resolver.rb +2 -8
  19. data/lib/rubocop/config_obsoletion.rb +213 -0
  20. data/lib/rubocop/config_validator.rb +239 -0
  21. data/lib/rubocop/cop/autocorrect_logic.rb +71 -1
  22. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +1 -1
  23. data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
  24. data/lib/rubocop/cop/commissioner.rb +3 -9
  25. data/lib/rubocop/cop/cop.rb +39 -12
  26. data/lib/rubocop/cop/corrector.rb +2 -3
  27. data/lib/rubocop/cop/correctors/alignment_corrector.rb +43 -17
  28. data/lib/rubocop/cop/correctors/empty_line_corrector.rb +2 -2
  29. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +2 -2
  30. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +2 -2
  31. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
  32. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +1 -1
  33. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +55 -0
  34. data/lib/rubocop/cop/generator.rb +4 -4
  35. data/lib/rubocop/cop/generator/configuration_injector.rb +9 -4
  36. data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
  37. data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +2 -2
  38. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
  39. data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +2 -2
  40. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
  41. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +2 -2
  42. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -2
  43. data/lib/rubocop/cop/layout/block_alignment.rb +3 -3
  44. data/lib/rubocop/cop/layout/class_structure.rb +2 -2
  45. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
  46. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +3 -1
  47. data/lib/rubocop/cop/layout/extra_spacing.rb +14 -59
  48. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +4 -0
  49. data/lib/rubocop/cop/layout/indent_assignment.rb +9 -1
  50. data/lib/rubocop/cop/layout/indent_first_argument.rb +7 -3
  51. data/lib/rubocop/cop/layout/indent_first_parameter.rb +7 -3
  52. data/lib/rubocop/cop/layout/indent_heredoc.rb +4 -4
  53. data/lib/rubocop/cop/layout/indentation_consistency.rb +13 -12
  54. data/lib/rubocop/cop/layout/indentation_width.rb +28 -10
  55. data/lib/rubocop/cop/layout/leading_comment_space.rb +28 -0
  56. data/lib/rubocop/cop/layout/multiline_block_layout.rb +24 -2
  57. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +2 -0
  58. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +18 -4
  59. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +5 -1
  60. data/lib/rubocop/cop/layout/space_around_operators.rb +42 -23
  61. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +1 -1
  62. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +21 -2
  63. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +24 -40
  64. data/lib/rubocop/cop/layout/tab.rb +10 -22
  65. data/lib/rubocop/cop/lint/assignment_in_condition.rb +17 -4
  66. data/lib/rubocop/cop/lint/big_decimal_new.rb +1 -1
  67. data/lib/rubocop/cop/lint/debugger.rb +4 -6
  68. data/lib/rubocop/cop/lint/duplicate_methods.rb +3 -3
  69. data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
  70. data/lib/rubocop/cop/lint/empty_interpolation.rb +4 -4
  71. data/lib/rubocop/cop/lint/erb_new_arguments.rb +57 -1
  72. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +11 -37
  73. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
  74. data/lib/rubocop/cop/lint/inherit_exception.rb +1 -1
  75. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +7 -8
  76. data/lib/rubocop/cop/lint/multiple_compare.rb +1 -1
  77. data/lib/rubocop/cop/lint/nested_method_definition.rb +3 -3
  78. data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
  79. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
  80. data/lib/rubocop/cop/lint/number_conversion.rb +4 -4
  81. data/lib/rubocop/cop/lint/rand_one.rb +1 -1
  82. data/lib/rubocop/cop/lint/redundant_with_index.rb +1 -1
  83. data/lib/rubocop/cop/lint/redundant_with_object.rb +1 -1
  84. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +5 -5
  85. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
  86. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +91 -0
  87. data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +6 -6
  88. data/lib/rubocop/cop/lint/unified_integer.rb +1 -1
  89. data/lib/rubocop/cop/lint/unneeded_cop_disable_directive.rb +1 -1
  90. data/lib/rubocop/cop/lint/unneeded_require_statement.rb +1 -1
  91. data/lib/rubocop/cop/lint/unneeded_splat_expansion.rb +7 -2
  92. data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
  93. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
  94. data/lib/rubocop/cop/lint/uri_regexp.rb +2 -2
  95. data/lib/rubocop/cop/lint/useless_access_modifier.rb +6 -6
  96. data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
  97. data/lib/rubocop/cop/message_annotator.rb +16 -7
  98. data/lib/rubocop/cop/metrics/class_length.rb +1 -1
  99. data/lib/rubocop/cop/metrics/line_length.rb +6 -0
  100. data/lib/rubocop/cop/metrics/module_length.rb +1 -1
  101. data/lib/rubocop/cop/metrics/parameter_lists.rb +1 -1
  102. data/lib/rubocop/cop/migration/department_name.rb +44 -0
  103. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  104. data/lib/rubocop/cop/mixin/def_node.rb +1 -1
  105. data/lib/rubocop/cop/mixin/documentation_comment.rb +0 -2
  106. data/lib/rubocop/cop/mixin/empty_parameter.rb +1 -1
  107. data/lib/rubocop/cop/mixin/enforce_superclass.rb +4 -4
  108. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -1
  109. data/lib/rubocop/cop/mixin/hash_alignment.rb +4 -0
  110. data/lib/rubocop/cop/mixin/interpolation.rb +27 -0
  111. data/lib/rubocop/cop/mixin/method_complexity.rb +1 -1
  112. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +3 -3
  113. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +87 -0
  114. data/lib/rubocop/cop/mixin/safe_mode.rb +2 -0
  115. data/lib/rubocop/cop/mixin/surrounding_space.rb +7 -5
  116. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
  117. data/lib/rubocop/cop/naming/constant_name.rb +2 -2
  118. data/lib/rubocop/cop/naming/method_name.rb +12 -1
  119. data/lib/rubocop/cop/naming/predicate_name.rb +1 -1
  120. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +20 -22
  121. data/lib/rubocop/cop/naming/variable_name.rb +1 -0
  122. data/lib/rubocop/cop/offense.rb +18 -7
  123. data/lib/rubocop/cop/registry.rb +22 -1
  124. data/lib/rubocop/cop/security/eval.rb +1 -1
  125. data/lib/rubocop/cop/security/json_load.rb +1 -1
  126. data/lib/rubocop/cop/security/marshal_load.rb +1 -1
  127. data/lib/rubocop/cop/security/open.rb +1 -1
  128. data/lib/rubocop/cop/security/yaml_load.rb +1 -1
  129. data/lib/rubocop/cop/style/access_modifier_declarations.rb +1 -0
  130. data/lib/rubocop/cop/style/alias.rb +1 -1
  131. data/lib/rubocop/cop/style/block_delimiters.rb +2 -1
  132. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +29 -10
  133. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  134. data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
  135. data/lib/rubocop/cop/style/commented_keyword.rb +16 -30
  136. data/lib/rubocop/cop/style/conditional_assignment.rb +8 -9
  137. data/lib/rubocop/cop/style/constant_visibility.rb +14 -3
  138. data/lib/rubocop/cop/style/date_time.rb +3 -3
  139. data/lib/rubocop/cop/style/dir.rb +1 -1
  140. data/lib/rubocop/cop/style/documentation_method.rb +1 -1
  141. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +55 -0
  142. data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -1
  143. data/lib/rubocop/cop/style/each_with_object.rb +1 -1
  144. data/lib/rubocop/cop/style/eval_with_location.rb +2 -2
  145. data/lib/rubocop/cop/style/even_odd.rb +1 -1
  146. data/lib/rubocop/cop/style/expand_path_arguments.rb +3 -3
  147. data/lib/rubocop/cop/style/float_division.rb +94 -0
  148. data/lib/rubocop/cop/style/format_string.rb +13 -9
  149. data/lib/rubocop/cop/style/format_string_token.rb +10 -40
  150. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +18 -33
  151. data/lib/rubocop/cop/style/guard_clause.rb +39 -10
  152. data/lib/rubocop/cop/style/hash_syntax.rb +2 -2
  153. data/lib/rubocop/cop/style/if_inside_else.rb +42 -0
  154. data/lib/rubocop/cop/style/if_unless_modifier.rb +51 -15
  155. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  156. data/lib/rubocop/cop/style/inverse_methods.rb +2 -2
  157. data/lib/rubocop/cop/style/lambda.rb +0 -2
  158. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +12 -6
  159. data/lib/rubocop/cop/style/min_max.rb +1 -1
  160. data/lib/rubocop/cop/style/mixin_usage.rb +12 -2
  161. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  162. data/lib/rubocop/cop/style/multiline_when_then.rb +55 -0
  163. data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
  164. data/lib/rubocop/cop/style/mutable_constant.rb +3 -3
  165. data/lib/rubocop/cop/style/nested_modifier.rb +18 -2
  166. data/lib/rubocop/cop/style/numeric_predicate.rb +3 -3
  167. data/lib/rubocop/cop/style/option_hash.rb +1 -1
  168. data/lib/rubocop/cop/style/or_assignment.rb +8 -3
  169. data/lib/rubocop/cop/style/parentheses_around_condition.rb +15 -1
  170. data/lib/rubocop/cop/style/random_with_offset.rb +6 -6
  171. data/lib/rubocop/cop/style/redundant_conditional.rb +2 -2
  172. data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
  173. data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
  174. data/lib/rubocop/cop/style/redundant_parentheses.rb +15 -6
  175. data/lib/rubocop/cop/style/redundant_self.rb +18 -1
  176. data/lib/rubocop/cop/style/redundant_sort_by.rb +1 -1
  177. data/lib/rubocop/cop/style/rescue_modifier.rb +24 -0
  178. data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
  179. data/lib/rubocop/cop/style/return_nil.rb +1 -1
  180. data/lib/rubocop/cop/style/safe_navigation.rb +11 -2
  181. data/lib/rubocop/cop/style/sample.rb +1 -1
  182. data/lib/rubocop/cop/style/single_line_methods.rb +8 -1
  183. data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
  184. data/lib/rubocop/cop/style/string_hash_keys.rb +2 -2
  185. data/lib/rubocop/cop/style/strip.rb +1 -1
  186. data/lib/rubocop/cop/style/struct_inheritance.rb +3 -3
  187. data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
  188. data/lib/rubocop/cop/style/ternary_parentheses.rb +32 -3
  189. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +4 -0
  190. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +4 -6
  191. data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
  192. data/lib/rubocop/cop/style/unneeded_sort.rb +1 -1
  193. data/lib/rubocop/cop/style/unpack_first.rb +1 -1
  194. data/lib/rubocop/cop/style/variable_interpolation.rb +6 -16
  195. data/lib/rubocop/cop/style/word_array.rb +2 -2
  196. data/lib/rubocop/cop/style/zero_length_predicate.rb +6 -6
  197. data/lib/rubocop/cop/team.rb +15 -14
  198. data/lib/rubocop/cop/utils/format_string.rb +128 -0
  199. data/lib/rubocop/cop/variable_force/variable.rb +15 -2
  200. data/lib/rubocop/core_ext/string.rb +0 -24
  201. data/lib/rubocop/error.rb +23 -0
  202. data/lib/rubocop/formatter/emacs_style_formatter.rb +8 -5
  203. data/lib/rubocop/formatter/formatter_set.rb +2 -1
  204. data/lib/rubocop/formatter/pacman_formatter.rb +80 -0
  205. data/lib/rubocop/formatter/simple_text_formatter.rb +9 -1
  206. data/lib/rubocop/formatter/tap_formatter.rb +9 -1
  207. data/lib/rubocop/magic_comment.rb +4 -0
  208. data/lib/rubocop/node_pattern.rb +86 -7
  209. data/lib/rubocop/options.rb +18 -2
  210. data/lib/rubocop/path_util.rb +1 -1
  211. data/lib/rubocop/processed_source.rb +9 -1
  212. data/lib/rubocop/rspec/cop_helper.rb +0 -1
  213. data/lib/rubocop/rspec/expect_offense.rb +4 -1
  214. data/lib/rubocop/rspec/shared_contexts.rb +12 -17
  215. data/lib/rubocop/rspec/support.rb +0 -1
  216. data/lib/rubocop/runner.rb +20 -15
  217. data/lib/rubocop/target_finder.rb +6 -4
  218. data/lib/rubocop/version.rb +1 -1
  219. data/lib/rubocop/yaml_duplication_checker.rb +8 -2
  220. metadata +16 -70
  221. data/lib/rubocop/cop/mixin/ignored_method_patterns.rb +0 -19
  222. data/lib/rubocop/cop/mixin/target_rails_version.rb +0 -16
  223. data/lib/rubocop/cop/rails/action_filter.rb +0 -117
  224. data/lib/rubocop/cop/rails/active_record_aliases.rb +0 -48
  225. data/lib/rubocop/cop/rails/active_record_override.rb +0 -82
  226. data/lib/rubocop/cop/rails/active_support_aliases.rb +0 -69
  227. data/lib/rubocop/cop/rails/application_job.rb +0 -40
  228. data/lib/rubocop/cop/rails/application_record.rb +0 -40
  229. data/lib/rubocop/cop/rails/assert_not.rb +0 -44
  230. data/lib/rubocop/cop/rails/belongs_to.rb +0 -102
  231. data/lib/rubocop/cop/rails/blank.rb +0 -164
  232. data/lib/rubocop/cop/rails/bulk_change_table.rb +0 -289
  233. data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +0 -91
  234. data/lib/rubocop/cop/rails/date.rb +0 -161
  235. data/lib/rubocop/cop/rails/delegate.rb +0 -132
  236. data/lib/rubocop/cop/rails/delegate_allow_blank.rb +0 -37
  237. data/lib/rubocop/cop/rails/dynamic_find_by.rb +0 -91
  238. data/lib/rubocop/cop/rails/enum_uniqueness.rb +0 -45
  239. data/lib/rubocop/cop/rails/environment_comparison.rb +0 -68
  240. data/lib/rubocop/cop/rails/exit.rb +0 -67
  241. data/lib/rubocop/cop/rails/file_path.rb +0 -108
  242. data/lib/rubocop/cop/rails/find_by.rb +0 -55
  243. data/lib/rubocop/cop/rails/find_each.rb +0 -51
  244. data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +0 -25
  245. data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +0 -106
  246. data/lib/rubocop/cop/rails/http_positional_arguments.rb +0 -117
  247. data/lib/rubocop/cop/rails/http_status.rb +0 -179
  248. data/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +0 -94
  249. data/lib/rubocop/cop/rails/inverse_of.rb +0 -246
  250. data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +0 -175
  251. data/lib/rubocop/cop/rails/link_to_blank.rb +0 -98
  252. data/lib/rubocop/cop/rails/not_null_column.rb +0 -67
  253. data/lib/rubocop/cop/rails/output.rb +0 -49
  254. data/lib/rubocop/cop/rails/output_safety.rb +0 -99
  255. data/lib/rubocop/cop/rails/pluralization_grammar.rb +0 -107
  256. data/lib/rubocop/cop/rails/presence.rb +0 -124
  257. data/lib/rubocop/cop/rails/present.rb +0 -153
  258. data/lib/rubocop/cop/rails/read_write_attribute.rb +0 -74
  259. data/lib/rubocop/cop/rails/redundant_allow_nil.rb +0 -111
  260. data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +0 -136
  261. data/lib/rubocop/cop/rails/reflection_class_name.rb +0 -37
  262. data/lib/rubocop/cop/rails/refute_methods.rb +0 -76
  263. data/lib/rubocop/cop/rails/relative_date_constant.rb +0 -93
  264. data/lib/rubocop/cop/rails/request_referer.rb +0 -56
  265. data/lib/rubocop/cop/rails/reversible_migration.rb +0 -286
  266. data/lib/rubocop/cop/rails/safe_navigation.rb +0 -87
  267. data/lib/rubocop/cop/rails/save_bang.rb +0 -316
  268. data/lib/rubocop/cop/rails/scope_args.rb +0 -29
  269. data/lib/rubocop/cop/rails/skips_model_validations.rb +0 -87
  270. data/lib/rubocop/cop/rails/time_zone.rb +0 -238
  271. data/lib/rubocop/cop/rails/uniq_before_pluck.rb +0 -105
  272. data/lib/rubocop/cop/rails/unknown_env.rb +0 -63
  273. data/lib/rubocop/cop/rails/validation.rb +0 -109
  274. data/lib/rubocop/rspec/shared_examples.rb +0 -59
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f98c70ae4897b3f4c793fa73cb716986f9d63815928c278accf6879a0190e97e
4
- data.tar.gz: 89111e2312bdf926aab76ca58bfb90a414ff3b5f58ba48257e5d1949763d4776
3
+ metadata.gz: 78f22d960f9c7b85730f215741a8e083b3b63396f414478d4831762e4c4cf7cb
4
+ data.tar.gz: b933d30e9d959fd0ef51958f5815349cab06f8dc7069b4f10c16907e43be53a5
5
5
  SHA512:
6
- metadata.gz: 83462908a6383ab72503c4af338d395a118e435d8f4f73e7cdda54b6d8d1cc05f40a5ebdb6a3197bf9a2734046665c7c2d6616e0bb0847f198d11b410ae4b7f8
7
- data.tar.gz: 39c1a0fca5a9251e3a60f9ca3958d228d79f5797de21da608f69cb133611c683913673bbdc426a537c9578bc4394607a20617d394d1abc3454878373589a0fdd
6
+ metadata.gz: 070a442e799b151ea2be23c3eb0d00ad25cc269ed6296ca3862fb6b3b25bfff238886423e7ae52cea853041038fefa354f818377cfde730b4464d7503b0680da
7
+ data.tar.gz: b14a228097fd48fc7c3dd4c7674b607574f99fba7b9870b64e97b836340181b57563794dd1d5371929fa1dac7e33430eb14189447b05caba84e8ce2b5034f12e
data/README.md CHANGED
@@ -7,9 +7,9 @@
7
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
8
 
9
9
  [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
10
- [![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/bbatsov/donate)
11
10
  [![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
12
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
13
 
14
14
  <p align="center">
15
15
  <img src="https://raw.githubusercontent.com/rubocop-hq/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
@@ -21,7 +21,7 @@
21
21
  **RuboCop** is a Ruby static code analyzer and code formatter. Out of
22
22
  the box it will enforce many of the guidelines outlined in the
23
23
  community [Ruby Style
24
- Guide](https://github.com/rubocop-hq/ruby-style-guide).
24
+ Guide](https://rubystyle.guide).
25
25
 
26
26
  RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
27
27
  [configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
53
53
  might want to use a conservative version lock in your `Gemfile`:
54
54
 
55
55
  ```rb
56
- gem 'rubocop', '~> 0.70.0', require: false
56
+ gem 'rubocop', '~> 0.75.0', require: false
57
57
  ```
58
58
 
59
59
  ## Quickstart
@@ -65,9 +65,9 @@ $ cd my/cool/ruby/project
65
65
  $ rubocop
66
66
  ```
67
67
 
68
- ## Official manual
68
+ ## Documentation
69
69
 
70
- You can read a ton more about RuboCop in its [official manual](https://docs.rubocop.org).
70
+ You can read a lot more about RuboCop in its [official docs](https://docs.rubocop.org).
71
71
 
72
72
  ## Compatibility
73
73
 
@@ -76,10 +76,6 @@ RuboCop supports the following Ruby implementations:
76
76
  * MRI 2.3+
77
77
  * JRuby 9.1+
78
78
 
79
- The Rails cops support the following versions:
80
-
81
- * Rails 4.0+
82
-
83
79
  ## Team
84
80
 
85
81
  Here's a list of RuboCop's core developers:
@@ -138,7 +134,7 @@ to become a RuboCop sponsor.
138
134
  You can support the development of RuboCop via
139
135
  [Salt](https://salt.bountysource.com/teams/rubocop),
140
136
  [Patreon](https://www.patreon.com/bbatsov),
141
- [Liberapay](https://liberapay.com/bbatsov/donate),
137
+ [PayPal](https://paypal.me/bbatsov)
142
138
  and [Open Collective](https://opencollective.com/rubocop).
143
139
 
144
140
  ### Open Collective Backers
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'bundler/setup'
4
5
  require 'pry'
5
6
  require 'rubocop'
6
7
 
@@ -73,7 +73,7 @@ AllCops:
73
73
  DisplayStyleGuide: false
74
74
  # When specifying style guide URLs, any paths and/or fragments will be
75
75
  # evaluated relative to the base URL.
76
- StyleGuideBaseURL: https://github.com/rubocop-hq/ruby-style-guide
76
+ StyleGuideBaseURL: https://rubystyle.guide
77
77
  # Extra details are not displayed in offense messages by default. Change
78
78
  # behavior by overriding ExtraDetails, or by giving the
79
79
  # `-E/--extra-details` option.
@@ -125,14 +125,6 @@ AllCops:
125
125
  # from the lock file.) If the Ruby version is still unresolved, RuboCop will
126
126
  # use the oldest officially supported Ruby version (currently Ruby 2.3).
127
127
  TargetRubyVersion: ~
128
- # What version of Rails is the inspected code using? If a value is specified
129
- # for TargetRailsVersion then it is used. Acceptable values are specificed
130
- # as a float (i.e. 5.1); the patch version of Rails should not be included.
131
- # If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
132
- # gems.locked file to find the version of Rails that has been bound to the
133
- # application. If neither of those files exist, RuboCop will use Rails 5.0
134
- # as the default.
135
- TargetRailsVersion: ~
136
128
 
137
129
  #################### Bundler ###############################
138
130
 
@@ -203,6 +195,13 @@ Gemspec/RequiredRubyVersion:
203
195
  VersionAdded: '0.52'
204
196
  Include:
205
197
  - '**/*.gemspec'
198
+ -
199
+ Gemspec/RubyVersionGlobalsUsage:
200
+ Description: Checks usage of RUBY_VERSION in gemspec.
201
+ Enabled: true
202
+ VersionAdded: '0.72'
203
+ Include:
204
+ - '**/*.gemspec'
206
205
 
207
206
  #################### Layout ###########################
208
207
 
@@ -778,8 +777,8 @@ Layout/IndentationConsistency:
778
777
  StyleGuide: '#spaces-indentation'
779
778
  Enabled: true
780
779
  VersionAdded: '0.49'
781
- # The difference between `rails` and `normal` is that the `rails` style
782
- # prescribes that in classes and modules the `protected` and `private`
780
+ # The difference between `indented` and `normal` is that the `indented_internal_methods`
781
+ # style prescribes that in classes and modules the `protected` and `private`
783
782
  # modifier keywords shall be indented the same as public methods and that
784
783
  # protected and private members shall be indented one step more than the
785
784
  # modifiers. Other than that, both styles mean that entities on the same
@@ -787,9 +786,9 @@ Layout/IndentationConsistency:
787
786
  EnforcedStyle: normal
788
787
  SupportedStyles:
789
788
  - normal
790
- - rails
789
+ - indented_internal_methods
791
790
  Reference:
792
- # A reference to `EnforcedStyle: rails`.
791
+ # A reference to `EnforcedStyle: indented_internal_methods`.
793
792
  - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
794
793
 
795
794
  Layout/IndentationWidth:
@@ -817,6 +816,8 @@ Layout/LeadingCommentSpace:
817
816
  StyleGuide: '#hash-space'
818
817
  Enabled: true
819
818
  VersionAdded: '0.49'
819
+ VersionChanged: '0.73'
820
+ AllowDoxygenCommentStyle: false
820
821
 
821
822
  Layout/MultilineArrayBraceLayout:
822
823
  Description: >-
@@ -1349,7 +1350,7 @@ Lint/ErbNewArguments:
1349
1350
  VersionAdded: '0.56'
1350
1351
 
1351
1352
  Lint/FlipFlop:
1352
- Description: 'Checks for flip-flops'
1353
+ Description: 'Checks for flip-flops.'
1353
1354
  StyleGuide: '#no-flip-flops'
1354
1355
  Enabled: true
1355
1356
  VersionAdded: '0.16'
@@ -1407,7 +1408,7 @@ Lint/InheritException:
1407
1408
  - standard_error
1408
1409
 
1409
1410
  Lint/InterpolationCheck:
1410
- Description: 'Raise warning for interpolation in single q strs'
1411
+ Description: 'Raise warning for interpolation in single q strs.'
1411
1412
  Enabled: true
1412
1413
  VersionAdded: '0.50'
1413
1414
 
@@ -1431,7 +1432,7 @@ Lint/Loop:
1431
1432
  VersionAdded: '0.9'
1432
1433
 
1433
1434
  Lint/MissingCopEnableDirective:
1434
- Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
1435
+ Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
1435
1436
  Enabled: true
1436
1437
  VersionAdded: '0.52'
1437
1438
  # Maximum number of consecutive lines the cop can be disabled for.
@@ -1495,6 +1496,7 @@ Lint/PercentStringArray:
1495
1496
  Description: >-
1496
1497
  Checks for unwanted commas and quotes in %w/%W literals.
1497
1498
  Enabled: true
1499
+ Safe: false
1498
1500
  VersionAdded: '0.41'
1499
1501
 
1500
1502
  Lint/PercentSymbolArray:
@@ -1589,6 +1591,11 @@ Lint/ScriptPermission:
1589
1591
  VersionAdded: '0.49'
1590
1592
  VersionChanged: '0.50'
1591
1593
 
1594
+ Lint/SendWithMixinArgument:
1595
+ Description: 'Checks for `send` method when using mixin.'
1596
+ Enabled: true
1597
+ VersionAdded: '0.75'
1598
+
1592
1599
  Lint/ShadowedArgument:
1593
1600
  Description: 'Avoid reassigning arguments before they were used.'
1594
1601
  Enabled: true
@@ -1618,7 +1625,7 @@ Lint/StringConversionInInterpolation:
1618
1625
  VersionChanged: '0.20'
1619
1626
 
1620
1627
  Lint/Syntax:
1621
- Description: 'Checks syntax error'
1628
+ Description: 'Checks syntax error.'
1622
1629
  Enabled: true
1623
1630
  VersionAdded: '0.9'
1624
1631
 
@@ -1634,7 +1641,7 @@ Lint/UnderscorePrefixedVariableName:
1634
1641
  AllowKeywordBlockArguments: false
1635
1642
 
1636
1643
  Lint/UnifiedInteger:
1637
- Description: 'Use Integer instead of Fixnum or Bignum'
1644
+ Description: 'Use Integer instead of Fixnum or Bignum.'
1638
1645
  Enabled: true
1639
1646
  VersionAdded: '0.43'
1640
1647
 
@@ -1657,9 +1664,10 @@ Lint/UnneededRequireStatement:
1657
1664
  VersionAdded: '0.51'
1658
1665
 
1659
1666
  Lint/UnneededSplatExpansion:
1660
- Description: 'Checks for splat unnecessarily being called on literals'
1667
+ Description: 'Checks for splat unnecessarily being called on literals.'
1661
1668
  Enabled: true
1662
1669
  VersionAdded: '0.43'
1670
+ VersionChanged: '0.74'
1663
1671
 
1664
1672
  Lint/UnreachableCode:
1665
1673
  Description: 'Unreachable code.'
@@ -1743,7 +1751,7 @@ Metrics/AbcSize:
1743
1751
  branches, and conditions.
1744
1752
  Reference:
1745
1753
  - http://c2.com/cgi/wiki?AbcMetric
1746
- - https://en.wikipedia.org/wiki/ABC_Software_Metric'
1754
+ - https://en.wikipedia.org/wiki/ABC_Software_Metric
1747
1755
  Enabled: true
1748
1756
  VersionAdded: '0.27'
1749
1757
  VersionChanged: '0.66'
@@ -1766,7 +1774,7 @@ Metrics/BlockLength:
1766
1774
  - '**/*.gemspec'
1767
1775
 
1768
1776
  Metrics/BlockNesting:
1769
- Description: 'Avoid excessive block nesting'
1777
+ Description: 'Avoid excessive block nesting.'
1770
1778
  StyleGuide: '#three-is-the-number-thou-shalt-count'
1771
1779
  Enabled: true
1772
1780
  VersionAdded: '0.25'
@@ -1846,6 +1854,14 @@ Metrics/PerceivedComplexity:
1846
1854
  VersionAdded: '0.25'
1847
1855
  Max: 7
1848
1856
 
1857
+ ################## Migration #############################
1858
+
1859
+ Migration/DepartmentName:
1860
+ Description: >-
1861
+ Check that cop names in rubocop:disable (etc) comments are
1862
+ given with department name.
1863
+ Enabled: false
1864
+
1849
1865
  #################### Naming ##############################
1850
1866
 
1851
1867
  Naming/AccessorMethodName:
@@ -1981,6 +1997,13 @@ Naming/MethodName:
1981
1997
  SupportedStyles:
1982
1998
  - snake_case
1983
1999
  - camelCase
2000
+ # Method names matching patterns are always allowed.
2001
+ #
2002
+ # IgnoredPatterns:
2003
+ # - '\A\s*onSelectionBulkChange\s*'
2004
+ # - '\A\s*onSelectionCleared\s*'
2005
+ #
2006
+ IgnoredPatterns: []
1984
2007
 
1985
2008
  Naming/PredicateName:
1986
2009
  Description: 'Check the names of predicate methods.'
@@ -2077,461 +2100,6 @@ Naming/VariableNumber:
2077
2100
  - normalcase
2078
2101
  - non_integer
2079
2102
 
2080
- #################### Rails #################################
2081
-
2082
- # By default, the rails cops are not run. Override in project or home
2083
- # directory .rubocop.yml files, or by giving the -R/--rails option.
2084
- Rails:
2085
- Enabled: false
2086
-
2087
- Rails/ActionFilter:
2088
- Description: 'Enforces consistent use of action filter methods.'
2089
- Enabled: true
2090
- VersionAdded: '0.19'
2091
- EnforcedStyle: action
2092
- SupportedStyles:
2093
- - action
2094
- - filter
2095
- Include:
2096
- - app/controllers/**/*.rb
2097
-
2098
- Rails/ActiveRecordAliases:
2099
- Description: >-
2100
- Avoid Active Record aliases:
2101
- Use `update` instead of `update_attributes`.
2102
- Use `update!` instead of `update_attributes!`.
2103
- Enabled: true
2104
- VersionAdded: '0.53'
2105
-
2106
- Rails/ActiveRecordOverride:
2107
- Description: >-
2108
- Check for overriding Active Record methods instead of using
2109
- callbacks.
2110
- Enabled: true
2111
- VersionAdded: '0.67'
2112
- Include:
2113
- - app/models/**/*.rb
2114
-
2115
- Rails/ActiveSupportAliases:
2116
- Description: >-
2117
- Avoid ActiveSupport aliases of standard ruby methods:
2118
- `String#starts_with?`, `String#ends_with?`,
2119
- `Array#append`, `Array#prepend`.
2120
- Enabled: true
2121
- VersionAdded: '0.48'
2122
-
2123
- Rails/ApplicationJob:
2124
- Description: 'Check that jobs subclass ApplicationJob.'
2125
- Enabled: true
2126
- VersionAdded: '0.49'
2127
-
2128
- Rails/ApplicationRecord:
2129
- Description: 'Check that models subclass ApplicationRecord.'
2130
- Enabled: true
2131
- VersionAdded: '0.49'
2132
-
2133
- Rails/AssertNot:
2134
- Description: 'Use `assert_not` instead of `assert !`.'
2135
- Enabled: true
2136
- VersionAdded: '0.56'
2137
- Include:
2138
- - '**/test/**/*'
2139
-
2140
- Rails/BelongsTo:
2141
- Description: >-
2142
- Use `optional: true` instead of `required: false` for
2143
- `belongs_to` relations'
2144
- Enabled: true
2145
- VersionAdded: '0.62'
2146
-
2147
- Rails/Blank:
2148
- Description: 'Enforces use of `blank?`.'
2149
- Enabled: true
2150
- VersionAdded: '0.48'
2151
- VersionChanged: '0.67'
2152
- # Convert usages of `nil? || empty?` to `blank?`
2153
- NilOrEmpty: true
2154
- # Convert usages of `!present?` to `blank?`
2155
- NotPresent: true
2156
- # Convert usages of `unless present?` to `if blank?`
2157
- UnlessPresent: true
2158
-
2159
- Rails/BulkChangeTable:
2160
- Description: 'Check whether alter queries are combinable.'
2161
- Enabled: true
2162
- VersionAdded: '0.57'
2163
- Database: null
2164
- SupportedDatabases:
2165
- - mysql
2166
- - postgresql
2167
- Include:
2168
- - db/migrate/*.rb
2169
-
2170
- Rails/CreateTableWithTimestamps:
2171
- Description: >-
2172
- Checks the migration for which timestamps are not included
2173
- when creating a new table.
2174
- Enabled: true
2175
- VersionAdded: '0.52'
2176
- Include:
2177
- - db/migrate/*.rb
2178
-
2179
- Rails/Date:
2180
- Description: >-
2181
- Checks the correct usage of date aware methods,
2182
- such as Date.today, Date.current etc.
2183
- Enabled: true
2184
- VersionAdded: '0.30'
2185
- VersionChanged: '0.33'
2186
- # The value `strict` disallows usage of `Date.today`, `Date.current`,
2187
- # `Date#to_time` etc.
2188
- # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
2189
- # (but not `Date.today`) which are overridden by ActiveSupport to handle current
2190
- # time zone.
2191
- EnforcedStyle: flexible
2192
- SupportedStyles:
2193
- - strict
2194
- - flexible
2195
-
2196
- Rails/Delegate:
2197
- Description: 'Prefer delegate method for delegations.'
2198
- Enabled: true
2199
- VersionAdded: '0.21'
2200
- VersionChanged: '0.50'
2201
- # When set to true, using the target object as a prefix of the
2202
- # method name without using the `delegate` method will be a
2203
- # violation. When set to false, this case is legal.
2204
- EnforceForPrefixed: true
2205
-
2206
- Rails/DelegateAllowBlank:
2207
- Description: 'Do not use allow_blank as an option to delegate.'
2208
- Enabled: true
2209
- VersionAdded: '0.44'
2210
-
2211
- Rails/DynamicFindBy:
2212
- Description: 'Use `find_by` instead of dynamic `find_by_*`.'
2213
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
2214
- Enabled: true
2215
- VersionAdded: '0.44'
2216
- Whitelist:
2217
- - find_by_sql
2218
-
2219
- Rails/EnumUniqueness:
2220
- Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
2221
- Enabled: true
2222
- VersionAdded: '0.46'
2223
- Include:
2224
- - app/models/**/*.rb
2225
-
2226
- Rails/EnvironmentComparison:
2227
- Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
2228
- Enabled: true
2229
- VersionAdded: '0.52'
2230
-
2231
- Rails/Exit:
2232
- Description: >-
2233
- Favor `fail`, `break`, `return`, etc. over `exit` in
2234
- application or library code outside of Rake files to avoid
2235
- exits during unit testing or running in production.
2236
- Enabled: true
2237
- VersionAdded: '0.41'
2238
- Include:
2239
- - app/**/*.rb
2240
- - config/**/*.rb
2241
- - lib/**/*.rb
2242
- Exclude:
2243
- - lib/**/*.rake
2244
-
2245
- Rails/FilePath:
2246
- Description: 'Use `Rails.root.join` for file path joining.'
2247
- Enabled: true
2248
- VersionAdded: '0.47'
2249
- VersionChanged: '0.57'
2250
- EnforcedStyle: arguments
2251
- SupportedStyles:
2252
- - slashes
2253
- - arguments
2254
-
2255
- Rails/FindBy:
2256
- Description: 'Prefer find_by over where.first.'
2257
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
2258
- Enabled: true
2259
- VersionAdded: '0.30'
2260
- Include:
2261
- - app/models/**/*.rb
2262
-
2263
- Rails/FindEach:
2264
- Description: 'Prefer all.find_each over all.find.'
2265
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
2266
- Enabled: true
2267
- VersionAdded: '0.30'
2268
- Include:
2269
- - app/models/**/*.rb
2270
-
2271
- Rails/HasAndBelongsToMany:
2272
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
2273
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
2274
- Enabled: true
2275
- VersionAdded: '0.12'
2276
- Include:
2277
- - app/models/**/*.rb
2278
-
2279
- Rails/HasManyOrHasOneDependent:
2280
- Description: 'Define the dependent option to the has_many and has_one associations.'
2281
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
2282
- Enabled: true
2283
- VersionAdded: '0.50'
2284
- Include:
2285
- - app/models/**/*.rb
2286
-
2287
- Rails/HttpPositionalArguments:
2288
- Description: 'Use keyword arguments instead of positional arguments in http method calls.'
2289
- Enabled: true
2290
- VersionAdded: '0.44'
2291
- Include:
2292
- - 'spec/**/*'
2293
- - 'test/**/*'
2294
-
2295
- Rails/HttpStatus:
2296
- Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
2297
- Enabled: true
2298
- VersionAdded: '0.54'
2299
- EnforcedStyle: symbolic
2300
- SupportedStyles:
2301
- - numeric
2302
- - symbolic
2303
-
2304
- Rails/IgnoredSkipActionFilterOption:
2305
- Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
2306
- Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
2307
- Enabled: true
2308
- VersionAdded: '0.63'
2309
- Include:
2310
- - app/controllers/**/*.rb
2311
-
2312
- Rails/InverseOf:
2313
- Description: 'Checks for associations where the inverse cannot be determined automatically.'
2314
- Enabled: true
2315
- VersionAdded: '0.52'
2316
- Include:
2317
- - app/models/**/*.rb
2318
-
2319
- Rails/LexicallyScopedActionFilter:
2320
- Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
2321
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
2322
- Enabled: true
2323
- Safe: false
2324
- VersionAdded: '0.52'
2325
- Include:
2326
- - app/controllers/**/*.rb
2327
-
2328
- Rails/LinkToBlank:
2329
- Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
2330
- Reference:
2331
- - https://mathiasbynens.github.io/rel-noopener/
2332
- - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
2333
- - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
2334
- Enabled: true
2335
- VersionAdded: '0.62'
2336
-
2337
- Rails/NotNullColumn:
2338
- Description: 'Do not add a NOT NULL column without a default value'
2339
- Enabled: true
2340
- VersionAdded: '0.43'
2341
- Include:
2342
- - db/migrate/*.rb
2343
-
2344
- Rails/Output:
2345
- Description: 'Checks for calls to puts, print, etc.'
2346
- Enabled: true
2347
- VersionAdded: '0.15'
2348
- VersionChanged: '0.19'
2349
- Include:
2350
- - app/**/*.rb
2351
- - config/**/*.rb
2352
- - db/**/*.rb
2353
- - lib/**/*.rb
2354
-
2355
- Rails/OutputSafety:
2356
- Description: 'The use of `html_safe` or `raw` may be a security risk.'
2357
- Enabled: true
2358
- VersionAdded: '0.41'
2359
-
2360
- Rails/PluralizationGrammar:
2361
- Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
2362
- Enabled: true
2363
- VersionAdded: '0.35'
2364
-
2365
- Rails/Presence:
2366
- Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
2367
- Enabled: true
2368
- VersionAdded: '0.52'
2369
-
2370
- Rails/Present:
2371
- Description: 'Enforces use of `present?`.'
2372
- Enabled: true
2373
- VersionAdded: '0.48'
2374
- VersionChanged: '0.67'
2375
- # Convert usages of `!nil? && !empty?` to `present?`
2376
- NotNilAndNotEmpty: true
2377
- # Convert usages of `!blank?` to `present?`
2378
- NotBlank: true
2379
- # Convert usages of `unless blank?` to `if present?`
2380
- UnlessBlank: true
2381
-
2382
- Rails/ReadWriteAttribute:
2383
- Description: >-
2384
- Checks for read_attribute(:attr) and
2385
- write_attribute(:attr, val).
2386
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
2387
- Enabled: true
2388
- VersionAdded: '0.20'
2389
- VersionChanged: '0.29'
2390
- Include:
2391
- - app/models/**/*.rb
2392
-
2393
- Rails/RedundantAllowNil:
2394
- Description: >-
2395
- Finds redundant use of `allow_nil` when `allow_blank` is set to
2396
- certain values in model validations.
2397
- Enabled: true
2398
- VersionAdded: '0.67'
2399
- Include:
2400
- - app/models/**/*.rb
2401
-
2402
- Rails/RedundantReceiverInWithOptions:
2403
- Description: 'Checks for redundant receiver in `with_options`.'
2404
- Enabled: true
2405
- VersionAdded: '0.52'
2406
-
2407
- Rails/ReflectionClassName:
2408
- Description: 'Use a string for `class_name` option value in the definition of a reflection.'
2409
- Enabled: true
2410
- VersionAdded: '0.64'
2411
-
2412
- Rails/RefuteMethods:
2413
- Description: 'Use `assert_not` methods instead of `refute` methods.'
2414
- Enabled: true
2415
- VersionAdded: '0.56'
2416
- Include:
2417
- - '**/test/**/*'
2418
-
2419
- Rails/RelativeDateConstant:
2420
- Description: 'Do not assign relative date to constants.'
2421
- Enabled: true
2422
- VersionAdded: '0.48'
2423
- VersionChanged: '0.59'
2424
- AutoCorrect: false
2425
-
2426
- Rails/RequestReferer:
2427
- Description: 'Use consistent syntax for request.referer.'
2428
- Enabled: true
2429
- VersionAdded: '0.41'
2430
- EnforcedStyle: referer
2431
- SupportedStyles:
2432
- - referer
2433
- - referrer
2434
-
2435
- Rails/ReversibleMigration:
2436
- Description: 'Checks whether the change method of the migration file is reversible.'
2437
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
2438
- Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
2439
- Enabled: true
2440
- VersionAdded: '0.47'
2441
- Include:
2442
- - db/migrate/*.rb
2443
-
2444
- Rails/SafeNavigation:
2445
- Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
2446
- Enabled: true
2447
- VersionAdded: '0.43'
2448
- # This will convert usages of `try` to use safe navigation as well as `try!`.
2449
- # `try` and `try!` work slightly differently. `try!` and safe navigation will
2450
- # both raise a `NoMethodError` if the receiver of the method call does not
2451
- # implement the intended method. `try` will not raise an exception for this.
2452
- ConvertTry: false
2453
-
2454
- Rails/SaveBang:
2455
- Description: 'Identifies possible cases where Active Record save! or related should be used.'
2456
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
2457
- Enabled: false
2458
- VersionAdded: '0.42'
2459
- VersionChanged: '0.59'
2460
- AllowImplicitReturn: true
2461
- AllowedReceivers: []
2462
-
2463
- Rails/ScopeArgs:
2464
- Description: 'Checks the arguments of ActiveRecord scopes.'
2465
- Enabled: true
2466
- VersionAdded: '0.19'
2467
- Include:
2468
- - app/models/**/*.rb
2469
-
2470
- Rails/SkipsModelValidations:
2471
- Description: >-
2472
- Use methods that skips model validations with caution.
2473
- See reference for more information.
2474
- Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
2475
- Enabled: true
2476
- VersionAdded: '0.47'
2477
- VersionChanged: '0.60'
2478
- Blacklist:
2479
- - decrement!
2480
- - decrement_counter
2481
- - increment!
2482
- - increment_counter
2483
- - toggle!
2484
- - touch
2485
- - update_all
2486
- - update_attribute
2487
- - update_column
2488
- - update_columns
2489
- - update_counters
2490
- Whitelist: []
2491
-
2492
- Rails/TimeZone:
2493
- Description: 'Checks the correct usage of time zone aware methods.'
2494
- StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
2495
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
2496
- Enabled: true
2497
- Safe: false
2498
- VersionAdded: '0.30'
2499
- VersionChanged: '0.68'
2500
- # The value `strict` means that `Time` should be used with `zone`.
2501
- # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
2502
- EnforcedStyle: flexible
2503
- SupportedStyles:
2504
- - strict
2505
- - flexible
2506
-
2507
- Rails/UniqBeforePluck:
2508
- Description: 'Prefer the use of uniq or distinct before pluck.'
2509
- Enabled: true
2510
- VersionAdded: '0.40'
2511
- VersionChanged: '0.47'
2512
- EnforcedStyle: conservative
2513
- SupportedStyles:
2514
- - conservative
2515
- - aggressive
2516
- AutoCorrect: false
2517
-
2518
- Rails/UnknownEnv:
2519
- Description: 'Use correct environment name.'
2520
- Enabled: true
2521
- VersionAdded: '0.51'
2522
- Environments:
2523
- - development
2524
- - test
2525
- - production
2526
-
2527
- Rails/Validation:
2528
- Description: 'Use validates :attribute, hash of validations.'
2529
- Enabled: true
2530
- VersionAdded: '0.9'
2531
- VersionChanged: '0.41'
2532
- Include:
2533
- - app/models/**/*.rb
2534
-
2535
2103
  #################### Security ##############################
2536
2104
 
2537
2105
  Security/Eval:
@@ -2588,7 +2156,7 @@ Style/AccessModifierDeclarations:
2588
2156
 
2589
2157
  Style/Alias:
2590
2158
  Description: 'Use alias instead of alias_method.'
2591
- StyleGuide: '#alias-method'
2159
+ StyleGuide: '#alias-method-lexically'
2592
2160
  Enabled: true
2593
2161
  VersionAdded: '0.9'
2594
2162
  VersionChanged: '0.36'
@@ -2939,6 +2507,13 @@ Style/ConditionalAssignment:
2939
2507
  SingleLineConditionsOnly: true
2940
2508
  IncludeTernaryExpressions: true
2941
2509
 
2510
+ Style/ConstantVisibility:
2511
+ Description: >-
2512
+ Check that class- and module constants have
2513
+ visibility declarations.
2514
+ Enabled: false
2515
+ VersionAdded: '0.66'
2516
+
2942
2517
  # Checks that you have put a copyright in a comment before any code.
2943
2518
  #
2944
2519
  # You can override the default Notice in your .rubocop.yml file.
@@ -2957,13 +2532,6 @@ Style/ConditionalAssignment:
2957
2532
  # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
2958
2533
  # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
2959
2534
  #
2960
- Style/ConstantVisibility:
2961
- Description: >-
2962
- Check that class- and module constants have
2963
- visibility declarations.
2964
- Enabled: false
2965
- VersionAdded: '0.66'
2966
-
2967
2535
  Style/Copyright:
2968
2536
  Description: 'Include a copyright notice in each file before any code.'
2969
2537
  Enabled: false
@@ -3010,6 +2578,11 @@ Style/DocumentationMethod:
3010
2578
  - 'test/**/*'
3011
2579
  RequireForNonPublicMethods: false
3012
2580
 
2581
+ Style/DoubleCopDisableDirective:
2582
+ Description: 'Checks for double rubocop:disable comments on a single line.'
2583
+ Enabled: true
2584
+ VersionAdded: '0.73'
2585
+
3013
2586
  Style/DoubleNegation:
3014
2587
  Description: 'Checks for uses of double negation (!!).'
3015
2588
  StyleGuide: '#no-bang-bang'
@@ -3094,7 +2667,7 @@ Style/EvalWithLocation:
3094
2667
  VersionAdded: '0.52'
3095
2668
 
3096
2669
  Style/EvenOdd:
3097
- Description: 'Favor the use of Integer#even? && Integer#odd?'
2670
+ Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
3098
2671
  StyleGuide: '#predicate-methods'
3099
2672
  Enabled: true
3100
2673
  VersionAdded: '0.12'
@@ -3105,6 +2678,19 @@ Style/ExpandPathArguments:
3105
2678
  Enabled: true
3106
2679
  VersionAdded: '0.53'
3107
2680
 
2681
+ Style/FloatDivision:
2682
+ Description: 'For performing float division, coerce one side only.'
2683
+ StyleGuide: '#float-division'
2684
+ Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
2685
+ Enabled: true
2686
+ VersionAdded: '0.72'
2687
+ EnforcedStyle: single_coerce
2688
+ SupportedStyles:
2689
+ - left_coerce
2690
+ - right_coerce
2691
+ - single_coerce
2692
+ - fdiv
2693
+
3108
2694
  Style/For:
3109
2695
  Description: 'Checks use of for or each in multiline loops.'
3110
2696
  StyleGuide: '#no-for-loops'
@@ -3140,7 +2726,7 @@ Style/FormatStringToken:
3140
2726
  - template
3141
2727
  - unannotated
3142
2728
  VersionAdded: '0.49'
3143
- VersionChanged: '0.52'
2729
+ VersionChanged: '0.75'
3144
2730
 
3145
2731
  Style/FrozenStringLiteralComment:
3146
2732
  Description: >-
@@ -3170,7 +2756,7 @@ Style/GlobalVars:
3170
2756
  AllowedVariables: []
3171
2757
 
3172
2758
  Style/GuardClause:
3173
- Description: 'Check for conditionals that can be replaced with guard clauses'
2759
+ Description: 'Check for conditionals that can be replaced with guard clauses.'
3174
2760
  StyleGuide: '#no-nested-conditionals'
3175
2761
  Enabled: true
3176
2762
  VersionAdded: '0.20'
@@ -3213,6 +2799,7 @@ Style/IdenticalConditionalBranches:
3213
2799
  Style/IfInsideElse:
3214
2800
  Description: 'Finds if nodes inside else, which can be converted to elsif.'
3215
2801
  Enabled: true
2802
+ AllowIfModifier: false
3216
2803
  VersionAdded: '0.36'
3217
2804
 
3218
2805
  Style/IfUnlessModifier:
@@ -3332,6 +2919,7 @@ Style/MethodCallWithArgsParentheses:
3332
2919
  VersionChanged: '0.61'
3333
2920
  IgnoreMacros: true
3334
2921
  IgnoredMethods: []
2922
+ IgnoredPatterns: []
3335
2923
  IncludedMacros: []
3336
2924
  AllowParenthesesInMultilineCall: false
3337
2925
  AllowParenthesesInChaining: false
@@ -3378,7 +2966,7 @@ Style/MethodMissingSuper:
3378
2966
  Style/MinMax:
3379
2967
  Description: >-
3380
2968
  Use `Enumerable#minmax` instead of `Enumerable#min`
3381
- and `Enumerable#max` in conjunction.'
2969
+ and `Enumerable#max` in conjunction.
3382
2970
  Enabled: true
3383
2971
  VersionAdded: '0.50'
3384
2972
 
@@ -3388,7 +2976,7 @@ Style/MissingElse:
3388
2976
  If enabled, it is recommended that
3389
2977
  Style/UnlessElse and Style/EmptyElse be enabled.
3390
2978
  This will conflict with Style/EmptyElse if
3391
- Style/EmptyElse is configured to style "both"
2979
+ Style/EmptyElse is configured to style "both".
3392
2980
  Enabled: false
3393
2981
  VersionAdded: '0.30'
3394
2982
  VersionChanged: '0.38'
@@ -3482,6 +3070,12 @@ Style/MultilineTernaryOperator:
3482
3070
  Enabled: true
3483
3071
  VersionAdded: '0.9'
3484
3072
 
3073
+ Style/MultilineWhenThen:
3074
+ Description: 'Do not use then for multi-line when statement.'
3075
+ StyleGuide: '#no-then'
3076
+ Enabled: true
3077
+ VersionAdded: '0.73'
3078
+
3485
3079
  Style/MultipleComparison:
3486
3080
  Description: >-
3487
3081
  Avoid comparing a variable with multiple items in a conditional,
@@ -3700,7 +3294,7 @@ Style/OptionHash:
3700
3294
  Style/OptionalArguments:
3701
3295
  Description: >-
3702
3296
  Checks for optional arguments that do not appear at the end
3703
- of the argument list
3297
+ of the argument list.
3704
3298
  StyleGuide: '#optional-arguments'
3705
3299
  Enabled: true
3706
3300
  VersionAdded: '0.33'
@@ -3732,7 +3326,7 @@ Style/ParenthesesAroundCondition:
3732
3326
  AllowInMultilineConditions: false
3733
3327
 
3734
3328
  Style/PercentLiteralDelimiters:
3735
- Description: 'Use `%`-literal delimiters consistently'
3329
+ Description: 'Use `%`-literal delimiters consistently.'
3736
3330
  StyleGuide: '#percent-literal-braces'
3737
3331
  Enabled: true
3738
3332
  VersionAdded: '0.19'
@@ -4013,6 +3607,8 @@ Style/StringHashKeys:
4013
3607
  StyleGuide: '#symbols-as-keys'
4014
3608
  Enabled: false
4015
3609
  VersionAdded: '0.52'
3610
+ VersionChanged: '0.75'
3611
+ Safe: false
4016
3612
 
4017
3613
  Style/StringLiterals:
4018
3614
  Description: 'Checks if uses of quotes match the configured preference.'
@@ -4264,7 +3860,7 @@ Style/UnneededSort:
4264
3860
  Style/UnpackFirst:
4265
3861
  Description: >-
4266
3862
  Checks for accessing the first element of `String#unpack`
4267
- instead of using `unpack1`
3863
+ instead of using `unpack1`.
4268
3864
  Enabled: true
4269
3865
  VersionAdded: '0.54'
4270
3866
 
@@ -4315,7 +3911,7 @@ Style/WordArray:
4315
3911
  # whose element count is greater than or equal to `MinSize`.
4316
3912
  MinSize: 2
4317
3913
  # The regular expression `WordRegex` decides what is considered a word.
4318
- WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
3914
+ WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
4319
3915
 
4320
3916
  Style/YodaCondition:
4321
3917
  Description: 'Forbid or enforce yoda conditions.'
@@ -4331,8 +3927,9 @@ Style/YodaCondition:
4331
3927
  - require_for_all_comparison_operators
4332
3928
  # enforce yoda only for equality operators: `!=` and `==`
4333
3929
  - require_for_equality_operators_only
3930
+ Safe: false
4334
3931
  VersionAdded: '0.49'
4335
- VersionChanged: '0.63'
3932
+ VersionChanged: '0.75'
4336
3933
 
4337
3934
  Style/ZeroLengthPredicate:
4338
3935
  Description: 'Use #empty? when testing for objects of length 0.'