rubocop 0.52.1 → 0.93.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (749) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.txt +1 -1
  3. data/README.md +49 -38
  4. data/assets/output.html.erb +1 -1
  5. data/bin/console +10 -0
  6. data/bin/rubocop-profile +32 -0
  7. data/bin/setup +7 -0
  8. data/config/default.yml +3332 -538
  9. data/{bin → exe}/rubocop +0 -0
  10. data/lib/rubocop.rb +206 -158
  11. data/lib/rubocop/ast_aliases.rb +8 -0
  12. data/lib/rubocop/cached_data.rb +4 -2
  13. data/lib/rubocop/cli.rb +50 -187
  14. data/lib/rubocop/cli/command.rb +22 -0
  15. data/lib/rubocop/cli/command/auto_genenerate_config.rb +141 -0
  16. data/lib/rubocop/cli/command/base.rb +35 -0
  17. data/lib/rubocop/cli/command/execute_runner.rb +85 -0
  18. data/lib/rubocop/cli/command/init_dotfile.rb +46 -0
  19. data/lib/rubocop/cli/command/show_cops.rb +77 -0
  20. data/lib/rubocop/cli/command/version.rb +18 -0
  21. data/lib/rubocop/cli/environment.rb +22 -0
  22. data/lib/rubocop/comment_config.rb +73 -12
  23. data/lib/rubocop/config.rb +117 -385
  24. data/lib/rubocop/config_loader.rb +145 -92
  25. data/lib/rubocop/config_loader_resolver.rb +124 -30
  26. data/lib/rubocop/config_obsoletion.rb +283 -0
  27. data/lib/rubocop/config_regeneration.rb +33 -0
  28. data/lib/rubocop/config_store.rb +19 -5
  29. data/lib/rubocop/config_validator.rb +224 -0
  30. data/lib/rubocop/cop/autocorrect_logic.rb +73 -4
  31. data/lib/rubocop/cop/badge.rb +7 -7
  32. data/lib/rubocop/cop/base.rb +430 -0
  33. data/lib/rubocop/cop/bundler/duplicated_gem.rb +9 -3
  34. data/lib/rubocop/cop/bundler/gem_comment.rb +138 -0
  35. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +19 -25
  36. data/lib/rubocop/cop/bundler/ordered_gems.rb +6 -4
  37. data/lib/rubocop/cop/commissioner.rb +102 -62
  38. data/lib/rubocop/cop/cop.rb +104 -181
  39. data/lib/rubocop/cop/corrector.rb +82 -98
  40. data/lib/rubocop/cop/correctors/alignment_corrector.rb +50 -29
  41. data/lib/rubocop/cop/correctors/condition_corrector.rb +3 -6
  42. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +53 -0
  43. data/lib/rubocop/cop/correctors/empty_line_corrector.rb +9 -10
  44. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +73 -0
  45. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +136 -0
  46. data/lib/rubocop/cop/correctors/line_break_corrector.rb +61 -0
  47. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +82 -45
  48. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +6 -9
  49. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +112 -0
  50. data/lib/rubocop/cop/correctors/punctuation_corrector.rb +8 -10
  51. data/lib/rubocop/cop/correctors/space_corrector.rb +15 -3
  52. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +2 -2
  53. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +18 -9
  54. data/lib/rubocop/cop/documentation.rb +22 -0
  55. data/lib/rubocop/cop/force.rb +2 -0
  56. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +7 -5
  57. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +5 -7
  58. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +49 -25
  59. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +55 -0
  60. data/lib/rubocop/cop/generator.rb +70 -37
  61. data/lib/rubocop/cop/generator/configuration_injector.rb +66 -0
  62. data/lib/rubocop/cop/generator/require_file_injector.rb +2 -2
  63. data/lib/rubocop/cop/ignored_node.rb +1 -3
  64. data/lib/rubocop/cop/internal_affairs.rb +1 -0
  65. data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +52 -0
  66. data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +13 -15
  67. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +14 -16
  68. data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +12 -11
  69. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +15 -22
  70. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +13 -11
  71. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +5 -5
  72. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +15 -27
  73. data/lib/rubocop/cop/layout/{align_parameters.rb → argument_alignment.rb} +21 -17
  74. data/lib/rubocop/cop/layout/array_alignment.rb +83 -0
  75. data/lib/rubocop/cop/layout/{indent_assignment.rb → assignment_indentation.rb} +12 -3
  76. data/lib/rubocop/cop/layout/begin_end_alignment.rb +77 -0
  77. data/lib/rubocop/cop/{lint → layout}/block_alignment.rb +36 -29
  78. data/lib/rubocop/cop/layout/block_end_newline.rb +9 -20
  79. data/lib/rubocop/cop/layout/case_indentation.rb +23 -26
  80. data/lib/rubocop/cop/layout/class_structure.rb +97 -98
  81. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +124 -0
  82. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +140 -30
  83. data/lib/rubocop/cop/layout/comment_indentation.rb +34 -7
  84. data/lib/rubocop/cop/{lint → layout}/condition_position.rb +18 -10
  85. data/lib/rubocop/cop/{lint → layout}/def_end_alignment.rb +11 -7
  86. data/lib/rubocop/cop/layout/dot_position.rb +31 -27
  87. data/lib/rubocop/cop/layout/else_alignment.rb +28 -15
  88. data/lib/rubocop/cop/layout/empty_comment.rb +158 -0
  89. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +160 -0
  90. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +17 -16
  91. data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +136 -0
  92. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +32 -29
  93. data/lib/rubocop/cop/layout/empty_lines.rb +11 -12
  94. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +147 -39
  95. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +29 -18
  96. data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +118 -0
  97. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +4 -8
  98. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +6 -7
  99. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +28 -11
  100. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +6 -9
  101. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +4 -7
  102. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +5 -9
  103. data/lib/rubocop/cop/{lint → layout}/end_alignment.rb +49 -23
  104. data/lib/rubocop/cop/layout/end_of_line.rb +48 -8
  105. data/lib/rubocop/cop/layout/extra_spacing.rb +71 -118
  106. data/lib/rubocop/cop/layout/first_argument_indentation.rb +251 -0
  107. data/lib/rubocop/cop/layout/{indent_array.rb → first_array_element_indentation.rb} +22 -16
  108. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +4 -7
  109. data/lib/rubocop/cop/layout/{indent_hash.rb → first_hash_element_indentation.rb} +10 -9
  110. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +3 -6
  111. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +8 -12
  112. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +3 -6
  113. data/lib/rubocop/cop/layout/first_parameter_indentation.rb +57 -76
  114. data/lib/rubocop/cop/layout/hash_alignment.rb +362 -0
  115. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +286 -0
  116. data/lib/rubocop/cop/layout/heredoc_indentation.rb +176 -0
  117. data/lib/rubocop/cop/layout/indentation_consistency.rb +155 -7
  118. data/lib/rubocop/cop/layout/indentation_style.rb +115 -0
  119. data/lib/rubocop/cop/layout/indentation_width.rb +72 -28
  120. data/lib/rubocop/cop/layout/initial_indentation.rb +24 -11
  121. data/lib/rubocop/cop/layout/leading_comment_space.rb +75 -12
  122. data/lib/rubocop/cop/layout/leading_empty_lines.rb +48 -0
  123. data/lib/rubocop/cop/layout/line_length.rb +280 -0
  124. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +13 -16
  125. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +36 -0
  126. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +18 -16
  127. data/lib/rubocop/cop/layout/multiline_block_layout.rb +74 -29
  128. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +6 -13
  129. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +47 -0
  130. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +48 -0
  131. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +68 -38
  132. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +7 -8
  133. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +80 -42
  134. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +29 -5
  135. data/lib/rubocop/cop/layout/parameter_alignment.rb +118 -0
  136. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +142 -30
  137. data/lib/rubocop/cop/layout/space_after_colon.rb +13 -9
  138. data/lib/rubocop/cop/layout/space_after_comma.rb +2 -5
  139. data/lib/rubocop/cop/layout/space_after_method_name.rb +11 -9
  140. data/lib/rubocop/cop/layout/space_after_not.rb +13 -13
  141. data/lib/rubocop/cop/layout/space_after_semicolon.rb +2 -5
  142. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +76 -47
  143. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +33 -24
  144. data/lib/rubocop/cop/layout/space_around_keyword.rb +42 -29
  145. data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +98 -0
  146. data/lib/rubocop/cop/layout/space_around_operators.rb +132 -48
  147. data/lib/rubocop/cop/layout/space_before_block_braces.rb +69 -25
  148. data/lib/rubocop/cop/layout/space_before_comma.rb +3 -5
  149. data/lib/rubocop/cop/layout/space_before_comment.rb +15 -11
  150. data/lib/rubocop/cop/layout/space_before_first_arg.rb +18 -8
  151. data/lib/rubocop/cop/layout/space_before_semicolon.rb +2 -5
  152. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +29 -40
  153. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +68 -77
  154. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +5 -10
  155. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +41 -24
  156. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +68 -62
  157. data/lib/rubocop/cop/layout/space_inside_parens.rb +72 -17
  158. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +8 -13
  159. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +10 -19
  160. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +76 -26
  161. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +26 -42
  162. data/lib/rubocop/cop/layout/trailing_empty_lines.rb +108 -0
  163. data/lib/rubocop/cop/layout/trailing_whitespace.rb +58 -9
  164. data/lib/rubocop/cop/legacy/corrections_proxy.rb +49 -0
  165. data/lib/rubocop/cop/legacy/corrector.rb +29 -0
  166. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +15 -7
  167. data/lib/rubocop/cop/lint/ambiguous_operator.rb +54 -6
  168. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +36 -7
  169. data/lib/rubocop/cop/lint/assignment_in_condition.rb +30 -27
  170. data/lib/rubocop/cop/lint/big_decimal_new.rb +43 -0
  171. data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +50 -0
  172. data/lib/rubocop/cop/lint/boolean_symbol.rb +23 -3
  173. data/lib/rubocop/cop/lint/circular_argument_reference.rb +3 -3
  174. data/lib/rubocop/cop/lint/constant_definition_in_block.rb +74 -0
  175. data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
  176. data/lib/rubocop/cop/lint/debugger.rb +14 -11
  177. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +41 -23
  178. data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +141 -0
  179. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +87 -0
  180. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +2 -2
  181. data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +39 -0
  182. data/lib/rubocop/cop/lint/{duplicated_key.rb → duplicate_hash_key.rb} +2 -2
  183. data/lib/rubocop/cop/lint/duplicate_methods.rb +44 -30
  184. data/lib/rubocop/cop/lint/duplicate_require.rb +46 -0
  185. data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +47 -0
  186. data/lib/rubocop/cop/lint/each_with_object_argument.rb +7 -3
  187. data/lib/rubocop/cop/lint/else_layout.rb +3 -2
  188. data/lib/rubocop/cop/lint/empty_conditional_body.rb +67 -0
  189. data/lib/rubocop/cop/lint/empty_ensure.rb +6 -6
  190. data/lib/rubocop/cop/lint/empty_expression.rb +3 -3
  191. data/lib/rubocop/cop/lint/empty_file.rb +50 -0
  192. data/lib/rubocop/cop/lint/empty_interpolation.rb +9 -10
  193. data/lib/rubocop/cop/lint/empty_when.rb +32 -9
  194. data/lib/rubocop/cop/lint/ensure_return.rb +31 -13
  195. data/lib/rubocop/cop/lint/erb_new_arguments.rb +165 -0
  196. data/lib/rubocop/cop/{style → lint}/flip_flop.rb +5 -4
  197. data/lib/rubocop/cop/lint/float_comparison.rb +93 -0
  198. data/lib/rubocop/cop/lint/float_out_of_range.rb +3 -3
  199. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +65 -46
  200. data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +37 -0
  201. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +155 -0
  202. data/lib/rubocop/cop/lint/identity_comparison.rb +51 -0
  203. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +26 -19
  204. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +43 -67
  205. data/lib/rubocop/cop/lint/inherit_exception.rb +34 -9
  206. data/lib/rubocop/cop/lint/interpolation_check.rb +24 -5
  207. data/lib/rubocop/cop/lint/literal_as_condition.rb +30 -24
  208. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +38 -16
  209. data/lib/rubocop/cop/lint/loop.rb +31 -8
  210. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +15 -11
  211. data/lib/rubocop/cop/lint/missing_super.rb +99 -0
  212. data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +37 -0
  213. data/lib/rubocop/cop/lint/{multiple_compare.rb → multiple_comparison.rb} +12 -13
  214. data/lib/rubocop/cop/lint/nested_method_definition.rb +21 -26
  215. data/lib/rubocop/cop/lint/nested_percent_literal.rb +7 -14
  216. data/lib/rubocop/cop/lint/next_without_accumulator.rb +3 -3
  217. data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +160 -0
  218. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +14 -16
  219. data/lib/rubocop/cop/lint/number_conversion.rb +79 -0
  220. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +84 -0
  221. data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +79 -0
  222. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +39 -15
  223. data/lib/rubocop/cop/lint/percent_string_array.rb +10 -17
  224. data/lib/rubocop/cop/lint/percent_symbol_array.rb +21 -17
  225. data/lib/rubocop/cop/lint/raise_exception.rb +86 -0
  226. data/lib/rubocop/cop/lint/rand_one.rb +7 -6
  227. data/lib/rubocop/cop/lint/{unneeded_disable.rb → redundant_cop_disable_directive.rb} +91 -76
  228. data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +125 -0
  229. data/lib/rubocop/cop/lint/{unneeded_require_statement.rb → redundant_require_statement.rb} +12 -15
  230. data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +78 -0
  231. data/lib/rubocop/cop/lint/{unneeded_splat_expansion.rb → redundant_splat_expansion.rb} +32 -23
  232. data/lib/rubocop/cop/lint/{string_conversion_in_interpolation.rb → redundant_string_coercion.rb} +15 -21
  233. data/lib/rubocop/cop/lint/redundant_with_index.rb +17 -18
  234. data/lib/rubocop/cop/lint/redundant_with_object.rb +18 -19
  235. data/lib/rubocop/cop/lint/regexp_as_condition.rb +7 -3
  236. data/lib/rubocop/cop/lint/require_parentheses.rb +6 -3
  237. data/lib/rubocop/cop/lint/rescue_exception.rb +4 -3
  238. data/lib/rubocop/cop/lint/rescue_type.rb +15 -12
  239. data/lib/rubocop/cop/lint/return_in_void_context.rb +4 -6
  240. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +21 -29
  241. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +98 -0
  242. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +46 -0
  243. data/lib/rubocop/cop/lint/script_permission.rb +40 -16
  244. data/lib/rubocop/cop/lint/self_assignment.rb +78 -0
  245. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +87 -0
  246. data/lib/rubocop/cop/lint/shadowed_argument.rb +51 -15
  247. data/lib/rubocop/cop/lint/shadowed_exception.rb +47 -28
  248. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +9 -9
  249. data/lib/rubocop/cop/lint/struct_new_override.rb +59 -0
  250. data/lib/rubocop/cop/lint/suppressed_exception.rb +89 -0
  251. data/lib/rubocop/cop/lint/syntax.rb +12 -28
  252. data/lib/rubocop/cop/lint/to_json.rb +50 -0
  253. data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +34 -0
  254. data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +57 -0
  255. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +30 -10
  256. data/lib/rubocop/cop/lint/unified_integer.rb +6 -8
  257. data/lib/rubocop/cop/lint/unreachable_code.rb +10 -8
  258. data/lib/rubocop/cop/lint/unreachable_loop.rb +171 -0
  259. data/lib/rubocop/cop/lint/unused_block_argument.rb +30 -9
  260. data/lib/rubocop/cop/lint/unused_method_argument.rb +64 -15
  261. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +19 -16
  262. data/lib/rubocop/cop/lint/uri_regexp.rb +12 -47
  263. data/lib/rubocop/cop/lint/useless_access_modifier.rb +110 -47
  264. data/lib/rubocop/cop/lint/useless_assignment.rb +12 -14
  265. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +10 -11
  266. data/lib/rubocop/cop/lint/useless_method_definition.rb +70 -0
  267. data/lib/rubocop/cop/lint/useless_setter_call.rb +17 -16
  268. data/lib/rubocop/cop/lint/useless_times.rb +106 -0
  269. data/lib/rubocop/cop/lint/void.rb +63 -35
  270. data/lib/rubocop/cop/message_annotator.rb +22 -11
  271. data/lib/rubocop/cop/metrics/abc_size.rb +4 -19
  272. data/lib/rubocop/cop/metrics/block_length.rb +46 -4
  273. data/lib/rubocop/cop/metrics/block_nesting.rb +4 -3
  274. data/lib/rubocop/cop/metrics/class_length.rb +43 -2
  275. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +38 -5
  276. data/lib/rubocop/cop/metrics/method_length.rb +31 -4
  277. data/lib/rubocop/cop/metrics/module_length.rb +35 -2
  278. data/lib/rubocop/cop/metrics/parameter_lists.rb +4 -8
  279. data/lib/rubocop/cop/metrics/perceived_complexity.rb +9 -11
  280. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +138 -0
  281. data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +158 -0
  282. data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
  283. data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +37 -0
  284. data/lib/rubocop/cop/migration/department_name.rb +83 -0
  285. data/lib/rubocop/cop/mixin/alignment.rb +12 -6
  286. data/lib/rubocop/cop/mixin/allowed_methods.rb +21 -0
  287. data/lib/rubocop/cop/mixin/annotation_comment.rb +6 -0
  288. data/lib/rubocop/cop/mixin/array_min_size.rb +2 -4
  289. data/lib/rubocop/cop/mixin/array_syntax.rb +1 -1
  290. data/lib/rubocop/cop/mixin/auto_corrector.rb +12 -0
  291. data/lib/rubocop/cop/mixin/check_assignment.rb +13 -9
  292. data/lib/rubocop/cop/mixin/check_line_breakable.rb +193 -0
  293. data/lib/rubocop/cop/mixin/code_length.rb +28 -3
  294. data/lib/rubocop/cop/mixin/comments_help.rb +48 -0
  295. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +8 -5
  296. data/lib/rubocop/cop/mixin/configurable_formatting.rb +4 -7
  297. data/lib/rubocop/cop/mixin/configurable_max.rb +4 -2
  298. data/lib/rubocop/cop/mixin/configurable_naming.rb +2 -2
  299. data/lib/rubocop/cop/mixin/configurable_numbering.rb +3 -3
  300. data/lib/rubocop/cop/mixin/def_node.rb +5 -1
  301. data/lib/rubocop/cop/mixin/documentation_comment.rb +13 -7
  302. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +35 -18
  303. data/lib/rubocop/cop/mixin/empty_parameter.rb +5 -2
  304. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +24 -6
  305. data/lib/rubocop/cop/mixin/enforce_superclass.rb +6 -4
  306. data/lib/rubocop/cop/mixin/first_element_line_break.rb +4 -2
  307. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +31 -6
  308. data/lib/rubocop/cop/mixin/{hash_alignment.rb → hash_alignment_styles.rb} +38 -7
  309. data/lib/rubocop/cop/mixin/hash_transform_method.rb +197 -0
  310. data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
  311. data/lib/rubocop/cop/mixin/ignored_methods.rb +19 -0
  312. data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
  313. data/lib/rubocop/cop/mixin/integer_node.rb +1 -1
  314. data/lib/rubocop/cop/mixin/interpolation.rb +27 -0
  315. data/lib/rubocop/cop/mixin/line_length_help.rb +87 -0
  316. data/lib/rubocop/cop/mixin/match_range.rb +2 -0
  317. data/lib/rubocop/cop/mixin/method_complexity.rb +18 -4
  318. data/lib/rubocop/cop/mixin/method_preference.rb +2 -1
  319. data/lib/rubocop/cop/mixin/min_body_length.rb +1 -1
  320. data/lib/rubocop/cop/mixin/{array_hash_indentation.rb → multiline_element_indentation.rb} +3 -2
  321. data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +35 -0
  322. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +42 -13
  323. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +17 -14
  324. data/lib/rubocop/cop/mixin/negative_conditional.rb +3 -3
  325. data/lib/rubocop/cop/mixin/nil_methods.rb +23 -0
  326. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +15 -2
  327. data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
  328. data/lib/rubocop/cop/mixin/percent_array.rb +18 -11
  329. data/lib/rubocop/cop/mixin/percent_literal.rb +3 -65
  330. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +96 -6
  331. data/lib/rubocop/cop/mixin/preferred_delimiters.rb +53 -0
  332. data/lib/rubocop/cop/mixin/range_help.rb +131 -0
  333. data/lib/rubocop/cop/mixin/rational_literal.rb +18 -0
  334. data/lib/rubocop/cop/mixin/rescue_node.rb +13 -4
  335. data/lib/rubocop/cop/mixin/safe_assignment.rb +2 -1
  336. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +13 -11
  337. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +16 -13
  338. data/lib/rubocop/cop/mixin/statement_modifier.rb +48 -18
  339. data/lib/rubocop/cop/mixin/string_literals_help.rb +2 -1
  340. data/lib/rubocop/cop/mixin/surrounding_space.rb +62 -42
  341. data/lib/rubocop/cop/mixin/target_ruby_version.rb +5 -1
  342. data/lib/rubocop/cop/mixin/trailing_body.rb +26 -0
  343. data/lib/rubocop/cop/mixin/trailing_comma.rb +96 -46
  344. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +106 -0
  345. data/lib/rubocop/cop/mixin/unused_argument.rb +4 -6
  346. data/lib/rubocop/cop/mixin/visibility_help.rb +38 -0
  347. data/lib/rubocop/cop/naming/accessor_method_name.rb +6 -4
  348. data/lib/rubocop/cop/naming/ascii_identifiers.rb +33 -7
  349. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +7 -6
  350. data/lib/rubocop/cop/naming/block_parameter_name.rb +49 -0
  351. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +15 -5
  352. data/lib/rubocop/cop/naming/constant_name.rb +35 -11
  353. data/lib/rubocop/cop/naming/file_name.rb +58 -33
  354. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +3 -3
  355. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +10 -14
  356. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +171 -0
  357. data/lib/rubocop/cop/naming/method_name.rb +41 -2
  358. data/lib/rubocop/cop/naming/method_parameter_name.rb +58 -0
  359. data/lib/rubocop/cop/naming/predicate_name.rb +18 -15
  360. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +113 -0
  361. data/lib/rubocop/cop/naming/variable_name.rb +4 -2
  362. data/lib/rubocop/cop/naming/variable_number.rb +3 -3
  363. data/lib/rubocop/cop/offense.rb +64 -13
  364. data/lib/rubocop/cop/registry.rb +118 -14
  365. data/lib/rubocop/cop/security/eval.rb +6 -4
  366. data/lib/rubocop/cop/security/json_load.rb +11 -12
  367. data/lib/rubocop/cop/security/marshal_load.rb +5 -6
  368. data/lib/rubocop/cop/security/open.rb +72 -0
  369. data/lib/rubocop/cop/security/yaml_load.rb +9 -8
  370. data/lib/rubocop/cop/severity.rb +2 -11
  371. data/lib/rubocop/cop/style/access_modifier_declarations.rb +135 -0
  372. data/lib/rubocop/cop/style/accessor_grouping.rb +152 -0
  373. data/lib/rubocop/cop/style/alias.rb +51 -38
  374. data/lib/rubocop/cop/style/and_or.rb +23 -25
  375. data/lib/rubocop/cop/style/array_coercion.rb +67 -0
  376. data/lib/rubocop/cop/style/array_join.rb +10 -11
  377. data/lib/rubocop/cop/style/ascii_comments.rb +7 -4
  378. data/lib/rubocop/cop/style/attr.rb +25 -14
  379. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +8 -8
  380. data/lib/rubocop/cop/style/bare_percent_literals.rb +14 -16
  381. data/lib/rubocop/cop/style/begin_block.rb +9 -3
  382. data/lib/rubocop/cop/style/bisected_attr_accessor.rb +141 -0
  383. data/lib/rubocop/cop/style/block_comments.rb +25 -19
  384. data/lib/rubocop/cop/style/block_delimiters.rb +131 -37
  385. data/lib/rubocop/cop/style/case_equality.rb +55 -5
  386. data/lib/rubocop/cop/style/case_like_if.rb +252 -0
  387. data/lib/rubocop/cop/style/character_literal.rb +3 -3
  388. data/lib/rubocop/cop/style/class_and_module_children.rb +43 -36
  389. data/lib/rubocop/cop/style/class_check.rb +7 -12
  390. data/lib/rubocop/cop/style/class_equality_comparison.rb +64 -0
  391. data/lib/rubocop/cop/style/class_methods.rb +19 -31
  392. data/lib/rubocop/cop/style/class_methods_definitions.rb +157 -0
  393. data/lib/rubocop/cop/style/class_vars.rb +47 -7
  394. data/lib/rubocop/cop/style/collection_methods.rb +40 -18
  395. data/lib/rubocop/cop/style/colon_method_call.rb +11 -13
  396. data/lib/rubocop/cop/style/colon_method_definition.rb +7 -6
  397. data/lib/rubocop/cop/style/combinable_loops.rb +91 -0
  398. data/lib/rubocop/cop/style/command_literal.rb +41 -34
  399. data/lib/rubocop/cop/style/comment_annotation.rb +35 -22
  400. data/lib/rubocop/cop/style/commented_keyword.rb +24 -33
  401. data/lib/rubocop/cop/style/conditional_assignment.rb +108 -138
  402. data/lib/rubocop/cop/style/constant_visibility.rb +78 -0
  403. data/lib/rubocop/cop/style/copyright.rb +39 -28
  404. data/lib/rubocop/cop/style/date_time.rb +55 -11
  405. data/lib/rubocop/cop/style/def_with_parentheses.rb +9 -11
  406. data/lib/rubocop/cop/style/dir.rb +11 -13
  407. data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +47 -0
  408. data/lib/rubocop/cop/style/documentation.rb +62 -23
  409. data/lib/rubocop/cop/style/documentation_method.rb +52 -3
  410. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +52 -0
  411. data/lib/rubocop/cop/style/double_negation.rb +46 -8
  412. data/lib/rubocop/cop/style/each_for_simple_loop.rb +7 -10
  413. data/lib/rubocop/cop/style/each_with_object.rb +30 -19
  414. data/lib/rubocop/cop/style/empty_block_parameter.rb +12 -12
  415. data/lib/rubocop/cop/style/empty_case_condition.rb +36 -12
  416. data/lib/rubocop/cop/style/empty_else.rb +28 -24
  417. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +13 -12
  418. data/lib/rubocop/cop/style/empty_literal.rb +34 -31
  419. data/lib/rubocop/cop/style/empty_method.rb +14 -18
  420. data/lib/rubocop/cop/style/encoding.rb +17 -14
  421. data/lib/rubocop/cop/style/end_block.rb +15 -3
  422. data/lib/rubocop/cop/style/eval_with_location.rb +15 -13
  423. data/lib/rubocop/cop/style/even_odd.rb +13 -16
  424. data/lib/rubocop/cop/style/expand_path_arguments.rb +195 -0
  425. data/lib/rubocop/cop/style/explicit_block_argument.rb +106 -0
  426. data/lib/rubocop/cop/style/exponential_notation.rb +117 -0
  427. data/lib/rubocop/cop/style/float_division.rb +93 -0
  428. data/lib/rubocop/cop/style/for.rb +48 -21
  429. data/lib/rubocop/cop/style/format_string.rb +52 -49
  430. data/lib/rubocop/cop/style/format_string_token.rb +32 -77
  431. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +131 -62
  432. data/lib/rubocop/cop/style/global_std_stream.rb +65 -0
  433. data/lib/rubocop/cop/style/global_vars.rb +5 -5
  434. data/lib/rubocop/cop/style/guard_clause.rb +69 -16
  435. data/lib/rubocop/cop/style/hash_as_last_array_item.rb +88 -0
  436. data/lib/rubocop/cop/style/hash_each_methods.rb +86 -0
  437. data/lib/rubocop/cop/style/hash_like_case.rb +76 -0
  438. data/lib/rubocop/cop/style/hash_syntax.rb +39 -31
  439. data/lib/rubocop/cop/style/hash_transform_keys.rb +91 -0
  440. data/lib/rubocop/cop/style/hash_transform_values.rb +88 -0
  441. data/lib/rubocop/cop/style/identical_conditional_branches.rb +11 -15
  442. data/lib/rubocop/cop/style/if_inside_else.rb +46 -4
  443. data/lib/rubocop/cop/style/if_unless_modifier.rb +114 -46
  444. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +12 -4
  445. data/lib/rubocop/cop/style/if_with_semicolon.rb +18 -4
  446. data/lib/rubocop/cop/style/implicit_runtime_error.rb +3 -2
  447. data/lib/rubocop/cop/style/infinite_loop.rb +64 -27
  448. data/lib/rubocop/cop/style/inline_comment.rb +6 -4
  449. data/lib/rubocop/cop/style/inverse_methods.rb +78 -40
  450. data/lib/rubocop/cop/style/ip_addresses.rb +76 -0
  451. data/lib/rubocop/cop/style/keyword_parameters_order.rb +53 -0
  452. data/lib/rubocop/cop/style/lambda.rb +15 -99
  453. data/lib/rubocop/cop/style/lambda_call.rb +17 -34
  454. data/lib/rubocop/cop/style/line_end_concatenation.rb +37 -28
  455. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +136 -35
  456. data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +174 -0
  457. data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +48 -0
  458. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +17 -18
  459. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +17 -5
  460. data/lib/rubocop/cop/style/method_def_parentheses.rb +27 -27
  461. data/lib/rubocop/cop/style/min_max.rb +10 -14
  462. data/lib/rubocop/cop/style/missing_else.rb +87 -31
  463. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +53 -0
  464. data/lib/rubocop/cop/style/mixin_grouping.rb +42 -42
  465. data/lib/rubocop/cop/style/mixin_usage.rb +16 -27
  466. data/lib/rubocop/cop/style/module_function.rb +85 -18
  467. data/lib/rubocop/cop/style/multiline_block_chain.rb +16 -5
  468. data/lib/rubocop/cop/style/multiline_if_modifier.rb +5 -12
  469. data/lib/rubocop/cop/style/multiline_if_then.rb +8 -13
  470. data/lib/rubocop/cop/style/multiline_memoization.rb +17 -14
  471. data/lib/rubocop/cop/style/multiline_method_signature.rb +61 -0
  472. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +32 -10
  473. data/lib/rubocop/cop/style/multiline_when_then.rb +73 -0
  474. data/lib/rubocop/cop/style/multiple_comparison.rb +20 -5
  475. data/lib/rubocop/cop/style/mutable_constant.rb +130 -19
  476. data/lib/rubocop/cop/style/negated_if.rb +10 -10
  477. data/lib/rubocop/cop/style/negated_unless.rb +89 -0
  478. data/lib/rubocop/cop/style/negated_while.rb +25 -15
  479. data/lib/rubocop/cop/style/nested_modifier.rb +37 -20
  480. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +26 -24
  481. data/lib/rubocop/cop/style/nested_ternary_operator.rb +41 -3
  482. data/lib/rubocop/cop/style/next.rb +40 -43
  483. data/lib/rubocop/cop/style/nil_comparison.rb +51 -9
  484. data/lib/rubocop/cop/style/non_nil_check.rb +55 -35
  485. data/lib/rubocop/cop/style/not.rb +26 -29
  486. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +43 -25
  487. data/lib/rubocop/cop/style/numeric_literals.rb +28 -15
  488. data/lib/rubocop/cop/style/numeric_predicate.rb +19 -27
  489. data/lib/rubocop/cop/style/one_line_conditional.rb +95 -27
  490. data/lib/rubocop/cop/style/option_hash.rb +14 -3
  491. data/lib/rubocop/cop/style/optional_arguments.rb +4 -7
  492. data/lib/rubocop/cop/style/optional_boolean_parameter.rb +53 -0
  493. data/lib/rubocop/cop/style/or_assignment.rb +27 -16
  494. data/lib/rubocop/cop/style/parallel_assignment.rb +20 -20
  495. data/lib/rubocop/cop/style/parentheses_around_condition.rb +50 -10
  496. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +26 -26
  497. data/lib/rubocop/cop/style/percent_q_literals.rb +10 -12
  498. data/lib/rubocop/cop/style/perl_backrefs.rb +9 -11
  499. data/lib/rubocop/cop/style/preferred_hash_methods.rb +12 -14
  500. data/lib/rubocop/cop/style/proc.rb +9 -9
  501. data/lib/rubocop/cop/style/raise_args.rb +30 -30
  502. data/lib/rubocop/cop/style/random_with_offset.rb +65 -72
  503. data/lib/rubocop/cop/style/redundant_assignment.rb +107 -0
  504. data/lib/rubocop/cop/style/redundant_begin.rb +69 -10
  505. data/lib/rubocop/cop/style/{unneeded_capital_w.rb → redundant_capital_w.rb} +7 -10
  506. data/lib/rubocop/cop/style/redundant_condition.rb +139 -0
  507. data/lib/rubocop/cop/style/redundant_conditional.rb +13 -12
  508. data/lib/rubocop/cop/style/redundant_exception.rb +28 -17
  509. data/lib/rubocop/cop/style/redundant_fetch_block.rb +113 -0
  510. data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +51 -0
  511. data/lib/rubocop/cop/style/redundant_freeze.rb +29 -9
  512. data/lib/rubocop/cop/style/{unneeded_interpolation.rb → redundant_interpolation.rb} +34 -28
  513. data/lib/rubocop/cop/style/redundant_parentheses.rb +73 -39
  514. data/lib/rubocop/cop/style/{unneeded_percent_q.rb → redundant_percent_q.rb} +36 -23
  515. data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +98 -0
  516. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +105 -0
  517. data/lib/rubocop/cop/style/redundant_return.rb +90 -55
  518. data/lib/rubocop/cop/style/redundant_self.rb +39 -25
  519. data/lib/rubocop/cop/style/redundant_self_assignment.rb +116 -0
  520. data/lib/rubocop/cop/style/redundant_sort.rb +162 -0
  521. data/lib/rubocop/cop/{performance → style}/redundant_sort_by.rb +10 -12
  522. data/lib/rubocop/cop/style/regexp_literal.rb +76 -34
  523. data/lib/rubocop/cop/style/rescue_modifier.rb +55 -10
  524. data/lib/rubocop/cop/style/rescue_standard_error.rb +27 -21
  525. data/lib/rubocop/cop/style/return_nil.rb +9 -9
  526. data/lib/rubocop/cop/style/safe_navigation.rb +130 -50
  527. data/lib/rubocop/cop/{performance → style}/sample.rb +28 -26
  528. data/lib/rubocop/cop/style/self_assignment.rb +27 -23
  529. data/lib/rubocop/cop/style/semicolon.rb +32 -14
  530. data/lib/rubocop/cop/style/send.rb +6 -6
  531. data/lib/rubocop/cop/style/signal_exception.rb +29 -22
  532. data/lib/rubocop/cop/style/single_argument_dig.rb +55 -0
  533. data/lib/rubocop/cop/style/single_line_block_params.rb +25 -3
  534. data/lib/rubocop/cop/style/single_line_methods.rb +31 -32
  535. data/lib/rubocop/cop/style/slicing_with_range.rb +37 -0
  536. data/lib/rubocop/cop/style/sole_nested_conditional.rb +66 -0
  537. data/lib/rubocop/cop/style/special_global_vars.rb +74 -33
  538. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +21 -27
  539. data/lib/rubocop/cop/style/stderr_puts.rb +17 -11
  540. data/lib/rubocop/cop/style/string_concatenation.rb +106 -0
  541. data/lib/rubocop/cop/style/string_hash_keys.rb +22 -9
  542. data/lib/rubocop/cop/style/string_literals.rb +3 -3
  543. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +1 -1
  544. data/lib/rubocop/cop/style/string_methods.rb +8 -17
  545. data/lib/rubocop/cop/style/strip.rb +41 -0
  546. data/lib/rubocop/cop/style/struct_inheritance.rb +34 -9
  547. data/lib/rubocop/cop/style/symbol_array.rb +47 -20
  548. data/lib/rubocop/cop/style/symbol_literal.rb +7 -9
  549. data/lib/rubocop/cop/style/symbol_proc.rb +32 -59
  550. data/lib/rubocop/cop/style/ternary_parentheses.rb +60 -35
  551. data/lib/rubocop/cop/style/trailing_body_on_class.rb +40 -0
  552. data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +12 -62
  553. data/lib/rubocop/cop/style/trailing_body_on_module.rb +40 -0
  554. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +49 -25
  555. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +96 -0
  556. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +90 -0
  557. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +97 -0
  558. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +12 -39
  559. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +20 -23
  560. data/lib/rubocop/cop/style/trivial_accessors.rb +42 -37
  561. data/lib/rubocop/cop/style/unless_else.rb +10 -12
  562. data/lib/rubocop/cop/style/unpack_first.rb +58 -0
  563. data/lib/rubocop/cop/style/variable_interpolation.rb +12 -25
  564. data/lib/rubocop/cop/style/when_then.rb +6 -8
  565. data/lib/rubocop/cop/style/while_until_do.rb +7 -17
  566. data/lib/rubocop/cop/style/while_until_modifier.rb +9 -23
  567. data/lib/rubocop/cop/style/word_array.rb +18 -28
  568. data/lib/rubocop/cop/style/yoda_condition.rb +84 -29
  569. data/lib/rubocop/cop/style/zero_length_predicate.rb +34 -24
  570. data/lib/rubocop/cop/team.rb +160 -91
  571. data/lib/rubocop/cop/util.rb +38 -216
  572. data/lib/rubocop/cop/utils/format_string.rb +135 -0
  573. data/lib/rubocop/cop/variable_force.rb +40 -35
  574. data/lib/rubocop/cop/variable_force/assignment.rb +5 -0
  575. data/lib/rubocop/cop/variable_force/branch.rb +6 -7
  576. data/lib/rubocop/cop/variable_force/branchable.rb +2 -0
  577. data/lib/rubocop/cop/variable_force/scope.rb +7 -0
  578. data/lib/rubocop/cop/variable_force/variable.rb +23 -10
  579. data/lib/rubocop/cop/variable_force/variable_table.rb +4 -3
  580. data/lib/rubocop/cops_documentation_generator.rb +284 -0
  581. data/lib/rubocop/core_ext/string.rb +23 -0
  582. data/lib/rubocop/directive_comment.rb +32 -0
  583. data/lib/rubocop/error.rb +24 -0
  584. data/lib/rubocop/ext/processed_source.rb +18 -0
  585. data/lib/rubocop/ext/regexp_node.rb +62 -0
  586. data/lib/rubocop/file_finder.rb +43 -0
  587. data/lib/rubocop/formatter/auto_gen_config_formatter.rb +17 -0
  588. data/lib/rubocop/formatter/base_formatter.rb +3 -7
  589. data/lib/rubocop/formatter/clang_style_formatter.rb +9 -6
  590. data/lib/rubocop/formatter/disabled_config_formatter.rb +69 -35
  591. data/lib/rubocop/formatter/emacs_style_formatter.rb +22 -9
  592. data/lib/rubocop/formatter/file_list_formatter.rb +2 -1
  593. data/lib/rubocop/formatter/formatter_set.rb +18 -17
  594. data/lib/rubocop/formatter/fuubar_style_formatter.rb +2 -2
  595. data/lib/rubocop/formatter/html_formatter.rb +15 -6
  596. data/lib/rubocop/formatter/json_formatter.rb +14 -13
  597. data/lib/rubocop/formatter/junit_formatter.rb +84 -0
  598. data/lib/rubocop/formatter/offense_count_formatter.rb +17 -0
  599. data/lib/rubocop/formatter/pacman_formatter.rb +80 -0
  600. data/lib/rubocop/formatter/progress_formatter.rb +3 -2
  601. data/lib/rubocop/formatter/quiet_formatter.rb +1 -1
  602. data/lib/rubocop/formatter/simple_text_formatter.rb +54 -11
  603. data/lib/rubocop/formatter/tap_formatter.rb +17 -6
  604. data/lib/rubocop/magic_comment.rb +15 -11
  605. data/lib/rubocop/name_similarity.rb +18 -10
  606. data/lib/rubocop/options.rb +267 -139
  607. data/lib/rubocop/path_util.rb +36 -17
  608. data/lib/rubocop/platform.rb +1 -1
  609. data/lib/rubocop/rake_task.rb +8 -9
  610. data/lib/rubocop/remote_config.rb +24 -9
  611. data/lib/rubocop/result_cache.rb +86 -31
  612. data/lib/rubocop/rspec/cop_helper.rb +14 -38
  613. data/lib/rubocop/rspec/expect_offense.rb +168 -14
  614. data/lib/rubocop/rspec/host_environment_simulation_helper.rb +1 -5
  615. data/lib/rubocop/rspec/shared_contexts.rb +93 -47
  616. data/lib/rubocop/rspec/support.rb +5 -1
  617. data/lib/rubocop/runner.rb +146 -77
  618. data/lib/rubocop/string_interpreter.rb +11 -8
  619. data/lib/rubocop/target_finder.rb +94 -95
  620. data/lib/rubocop/target_ruby.rb +160 -0
  621. data/lib/rubocop/version.rb +15 -5
  622. data/lib/rubocop/yaml_duplication_checker.rb +40 -0
  623. metadata +265 -192
  624. data/config/disabled.yml +0 -128
  625. data/config/enabled.yml +0 -1989
  626. data/lib/rubocop/ast/builder.rb +0 -72
  627. data/lib/rubocop/ast/node.rb +0 -634
  628. data/lib/rubocop/ast/node/and_node.rb +0 -37
  629. data/lib/rubocop/ast/node/args_node.rb +0 -29
  630. data/lib/rubocop/ast/node/array_node.rb +0 -57
  631. data/lib/rubocop/ast/node/block_node.rb +0 -116
  632. data/lib/rubocop/ast/node/case_node.rb +0 -64
  633. data/lib/rubocop/ast/node/def_node.rb +0 -71
  634. data/lib/rubocop/ast/node/ensure_node.rb +0 -25
  635. data/lib/rubocop/ast/node/for_node.rb +0 -61
  636. data/lib/rubocop/ast/node/hash_node.rb +0 -109
  637. data/lib/rubocop/ast/node/if_node.rb +0 -146
  638. data/lib/rubocop/ast/node/keyword_splat_node.rb +0 -45
  639. data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +0 -16
  640. data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +0 -23
  641. data/lib/rubocop/ast/node/mixin/collection_node.rb +0 -15
  642. data/lib/rubocop/ast/node/mixin/conditional_node.rb +0 -45
  643. data/lib/rubocop/ast/node/mixin/hash_element_node.rb +0 -125
  644. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +0 -174
  645. data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +0 -89
  646. data/lib/rubocop/ast/node/mixin/modifier_node.rb +0 -17
  647. data/lib/rubocop/ast/node/mixin/parameterized_node.rb +0 -61
  648. data/lib/rubocop/ast/node/mixin/predicate_operator_node.rb +0 -35
  649. data/lib/rubocop/ast/node/or_node.rb +0 -37
  650. data/lib/rubocop/ast/node/pair_node.rb +0 -64
  651. data/lib/rubocop/ast/node/regexp_node.rb +0 -35
  652. data/lib/rubocop/ast/node/resbody_node.rb +0 -25
  653. data/lib/rubocop/ast/node/send_node.rb +0 -45
  654. data/lib/rubocop/ast/node/str_node.rb +0 -14
  655. data/lib/rubocop/ast/node/super_node.rb +0 -21
  656. data/lib/rubocop/ast/node/symbol_node.rb +0 -20
  657. data/lib/rubocop/ast/node/until_node.rb +0 -43
  658. data/lib/rubocop/ast/node/when_node.rb +0 -61
  659. data/lib/rubocop/ast/node/while_node.rb +0 -43
  660. data/lib/rubocop/ast/node/yield_node.rb +0 -21
  661. data/lib/rubocop/ast/sexp.rb +0 -16
  662. data/lib/rubocop/ast/traversal.rb +0 -171
  663. data/lib/rubocop/cop/layout/align_array.rb +0 -39
  664. data/lib/rubocop/cop/layout/align_hash.rb +0 -235
  665. data/lib/rubocop/cop/layout/indent_heredoc.rb +0 -208
  666. data/lib/rubocop/cop/layout/tab.rb +0 -60
  667. data/lib/rubocop/cop/layout/trailing_blank_lines.rb +0 -80
  668. data/lib/rubocop/cop/lint/end_in_method.rb +0 -40
  669. data/lib/rubocop/cop/lint/handle_exceptions.rb +0 -56
  670. data/lib/rubocop/cop/lint/useless_comparison.rb +0 -28
  671. data/lib/rubocop/cop/metrics/line_length.rb +0 -171
  672. data/lib/rubocop/cop/mixin/classish_length.rb +0 -36
  673. data/lib/rubocop/cop/mixin/parser_diagnostic.rb +0 -37
  674. data/lib/rubocop/cop/mixin/safe_mode.rb +0 -22
  675. data/lib/rubocop/cop/mixin/target_rails_version.rb +0 -16
  676. data/lib/rubocop/cop/mixin/too_many_lines.rb +0 -39
  677. data/lib/rubocop/cop/performance/caller.rb +0 -69
  678. data/lib/rubocop/cop/performance/case_when_splat.rb +0 -172
  679. data/lib/rubocop/cop/performance/casecmp.rb +0 -108
  680. data/lib/rubocop/cop/performance/compare_with_block.rb +0 -117
  681. data/lib/rubocop/cop/performance/count.rb +0 -101
  682. data/lib/rubocop/cop/performance/detect.rb +0 -110
  683. data/lib/rubocop/cop/performance/double_start_end_with.rb +0 -94
  684. data/lib/rubocop/cop/performance/end_with.rb +0 -55
  685. data/lib/rubocop/cop/performance/fixed_size.rb +0 -56
  686. data/lib/rubocop/cop/performance/flat_map.rb +0 -76
  687. data/lib/rubocop/cop/performance/hash_each_methods.rb +0 -129
  688. data/lib/rubocop/cop/performance/lstrip_rstrip.rb +0 -44
  689. data/lib/rubocop/cop/performance/range_include.rb +0 -41
  690. data/lib/rubocop/cop/performance/redundant_block_call.rb +0 -93
  691. data/lib/rubocop/cop/performance/redundant_match.rb +0 -56
  692. data/lib/rubocop/cop/performance/redundant_merge.rb +0 -169
  693. data/lib/rubocop/cop/performance/regexp_match.rb +0 -224
  694. data/lib/rubocop/cop/performance/reverse_each.rb +0 -40
  695. data/lib/rubocop/cop/performance/size.rb +0 -71
  696. data/lib/rubocop/cop/performance/start_with.rb +0 -58
  697. data/lib/rubocop/cop/performance/string_replacement.rb +0 -170
  698. data/lib/rubocop/cop/performance/times_map.rb +0 -71
  699. data/lib/rubocop/cop/performance/unfreeze_string.rb +0 -50
  700. data/lib/rubocop/cop/performance/uri_default_parser.rb +0 -47
  701. data/lib/rubocop/cop/rails/action_filter.rb +0 -117
  702. data/lib/rubocop/cop/rails/active_support_aliases.rb +0 -68
  703. data/lib/rubocop/cop/rails/application_job.rb +0 -40
  704. data/lib/rubocop/cop/rails/application_record.rb +0 -40
  705. data/lib/rubocop/cop/rails/blank.rb +0 -142
  706. data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +0 -82
  707. data/lib/rubocop/cop/rails/date.rb +0 -136
  708. data/lib/rubocop/cop/rails/delegate.rb +0 -130
  709. data/lib/rubocop/cop/rails/delegate_allow_blank.rb +0 -51
  710. data/lib/rubocop/cop/rails/dynamic_find_by.rb +0 -82
  711. data/lib/rubocop/cop/rails/enum_uniqueness.rb +0 -45
  712. data/lib/rubocop/cop/rails/environment_comparison.rb +0 -66
  713. data/lib/rubocop/cop/rails/exit.rb +0 -68
  714. data/lib/rubocop/cop/rails/file_path.rb +0 -72
  715. data/lib/rubocop/cop/rails/find_by.rb +0 -52
  716. data/lib/rubocop/cop/rails/find_each.rb +0 -47
  717. data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +0 -25
  718. data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +0 -84
  719. data/lib/rubocop/cop/rails/http_positional_arguments.rb +0 -102
  720. data/lib/rubocop/cop/rails/inverse_of.rb +0 -218
  721. data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +0 -112
  722. data/lib/rubocop/cop/rails/not_null_column.rb +0 -67
  723. data/lib/rubocop/cop/rails/output.rb +0 -32
  724. data/lib/rubocop/cop/rails/output_safety.rb +0 -93
  725. data/lib/rubocop/cop/rails/pluralization_grammar.rb +0 -107
  726. data/lib/rubocop/cop/rails/presence.rb +0 -118
  727. data/lib/rubocop/cop/rails/present.rb +0 -143
  728. data/lib/rubocop/cop/rails/read_write_attribute.rb +0 -65
  729. data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +0 -133
  730. data/lib/rubocop/cop/rails/relative_date_constant.rb +0 -88
  731. data/lib/rubocop/cop/rails/request_referer.rb +0 -55
  732. data/lib/rubocop/cop/rails/reversible_migration.rb +0 -281
  733. data/lib/rubocop/cop/rails/safe_navigation.rb +0 -90
  734. data/lib/rubocop/cop/rails/save_bang.rb +0 -162
  735. data/lib/rubocop/cop/rails/scope_args.rb +0 -29
  736. data/lib/rubocop/cop/rails/skips_model_validations.rb +0 -70
  737. data/lib/rubocop/cop/rails/time_zone.rb +0 -198
  738. data/lib/rubocop/cop/rails/uniq_before_pluck.rb +0 -95
  739. data/lib/rubocop/cop/rails/unknown_env.rb +0 -63
  740. data/lib/rubocop/cop/rails/validation.rb +0 -64
  741. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +0 -202
  742. data/lib/rubocop/cop/style/method_missing.rb +0 -68
  743. data/lib/rubocop/cop/style/trailing_comma_in_literal.rb +0 -75
  744. data/lib/rubocop/formatter/disabled_lines_formatter.rb +0 -57
  745. data/lib/rubocop/node_pattern.rb +0 -560
  746. data/lib/rubocop/processed_source.rb +0 -150
  747. data/lib/rubocop/rspec/shared_examples.rb +0 -92
  748. data/lib/rubocop/string_util.rb +0 -158
  749. data/lib/rubocop/token.rb +0 -103
data/config/disabled.yml DELETED
@@ -1,128 +0,0 @@
1
- # These are all the cops that are disabled in the default configuration.
2
-
3
- Layout/ClassStructure:
4
- Description: 'Enforces a configured order of definitions within a class body.'
5
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-classes'
6
- Enabled: false
7
-
8
- Layout/FirstArrayElementLineBreak:
9
- Description: >-
10
- Checks for a line break before the first element in a
11
- multi-line array.
12
- Enabled: false
13
-
14
- Layout/FirstHashElementLineBreak:
15
- Description: >-
16
- Checks for a line break before the first element in a
17
- multi-line hash.
18
- Enabled: false
19
-
20
- Layout/FirstMethodArgumentLineBreak:
21
- Description: >-
22
- Checks for a line break before the first argument in a
23
- multi-line method call.
24
- Enabled: false
25
-
26
- Layout/FirstMethodParameterLineBreak:
27
- Description: >-
28
- Checks for a line break before the first parameter in a
29
- multi-line method parameter definition.
30
- Enabled: false
31
-
32
- Layout/MultilineAssignmentLayout:
33
- Description: 'Check for a newline after the assignment operator in multi-line assignments.'
34
- StyleGuide: '#indent-conditional-assignment'
35
- Enabled: false
36
-
37
- # By default, the rails cops are not run. Override in project or home
38
- # directory .rubocop.yml files, or by giving the -R/--rails option.
39
- Rails:
40
- Enabled: false
41
-
42
- Rails/SaveBang:
43
- Description: 'Identifies possible cases where Active Record save! or related should be used.'
44
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#save-bang'
45
- Enabled: false
46
-
47
- Style/AutoResourceCleanup:
48
- Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
49
- Enabled: false
50
-
51
- Style/CollectionMethods:
52
- Description: 'Preferred collection methods.'
53
- StyleGuide: '#map-find-select-reduce-size'
54
- Enabled: false
55
-
56
- Style/Copyright:
57
- Description: 'Include a copyright notice in each file before any code.'
58
- Enabled: false
59
-
60
- Style/DocumentationMethod:
61
- Description: 'Public methods.'
62
- Enabled: false
63
- Exclude:
64
- - 'spec/**/*'
65
- - 'test/**/*'
66
-
67
- Style/ImplicitRuntimeError:
68
- Description: >-
69
- Use `raise` or `fail` with an explicit exception class and
70
- message, rather than just a message.
71
- Enabled: false
72
-
73
- Style/InlineComment:
74
- Description: 'Avoid trailing inline comments.'
75
- Enabled: false
76
-
77
- Style/MethodCallWithArgsParentheses:
78
- Description: 'Use parentheses for method calls with arguments.'
79
- StyleGuide: '#method-invocation-parens'
80
- Enabled: false
81
-
82
- Style/MethodCalledOnDoEndBlock:
83
- Description: 'Avoid chaining a method call on a do...end block.'
84
- StyleGuide: '#single-line-blocks'
85
- Enabled: false
86
-
87
- Style/MissingElse:
88
- Description: >-
89
- Require if/case expressions to have an else branches.
90
- If enabled, it is recommended that
91
- Style/UnlessElse and Style/EmptyElse be enabled.
92
- This will conflict with Style/EmptyElse if
93
- Style/EmptyElse is configured to style "both"
94
- Enabled: false
95
- EnforcedStyle: both
96
- SupportedStyles:
97
- # if - warn when an if expression is missing an else branch
98
- # case - warn when a case expression is missing an else branch
99
- # both - warn when an if or case expression is missing an else branch
100
- - if
101
- - case
102
- - both
103
-
104
- Style/OptionHash:
105
- Description: "Don't use option hashes when you can use keyword arguments."
106
- Enabled: false
107
-
108
- Style/ReturnNil:
109
- Description: 'Use return instead of return nil.'
110
- Enabled: false
111
-
112
- Style/Send:
113
- Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
114
- StyleGuide: '#prefer-public-send'
115
- Enabled: false
116
-
117
- Style/SingleLineBlockParams:
118
- Description: 'Enforces the names of some block params.'
119
- Enabled: false
120
-
121
- Style/StringHashKeys:
122
- Description: 'Prefer symbols instead of strings as hash keys.'
123
- StyleGuide: '#symbols-as-keys'
124
- Enabled: false
125
-
126
- Style/StringMethods:
127
- Description: 'Checks if configured preferred methods are used over non-preferred.'
128
- Enabled: false
data/config/enabled.yml DELETED
@@ -1,1989 +0,0 @@
1
- # These are all the cops that are enabled in the default configuration.
2
-
3
- #################### Bundler ###############################
4
-
5
- Bundler/DuplicatedGem:
6
- Description: 'Checks for duplicate gem entries in Gemfile.'
7
- Enabled: true
8
- Include:
9
- - '**/Gemfile'
10
- - '**/gems.rb'
11
-
12
- Bundler/InsecureProtocolSource:
13
- Description: >-
14
- The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
15
- because HTTP requests are insecure. Please change your source to
16
- 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
17
- Enabled: true
18
- Include:
19
- - '**/Gemfile'
20
- - '**/gems.rb'
21
-
22
- Bundler/OrderedGems:
23
- Description: >-
24
- Gems within groups in the Gemfile should be alphabetically sorted.
25
- Enabled: true
26
- Include:
27
- - '**/Gemfile'
28
- - '**/gems.rb'
29
-
30
- #################### Gemspec ###############################
31
-
32
- Gemspec/DuplicatedAssignment:
33
- Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
34
- Enabled: true
35
- Include:
36
- - '**/*.gemspec'
37
-
38
- Gemspec/OrderedDependencies:
39
- Description: >-
40
- Dependencies in the gemspec should be alphabetically sorted.
41
- Enabled: true
42
- Include:
43
- - '**/*.gemspec'
44
-
45
- Gemspec/RequiredRubyVersion:
46
- Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
47
- Enabled: true
48
- Include:
49
- - '**/*.gemspec'
50
-
51
- #################### Layout ###############################
52
-
53
- Layout/AccessModifierIndentation:
54
- Description: Check indentation of private/protected visibility modifiers.
55
- StyleGuide: '#indent-public-private-protected'
56
- Enabled: true
57
-
58
- Layout/AlignArray:
59
- Description: >-
60
- Align the elements of an array literal if they span more than
61
- one line.
62
- StyleGuide: '#align-multiline-arrays'
63
- Enabled: true
64
-
65
- Layout/AlignHash:
66
- Description: >-
67
- Align the elements of a hash literal if they span more than
68
- one line.
69
- Enabled: true
70
-
71
- Layout/AlignParameters:
72
- Description: >-
73
- Align the parameters of a method call if they span more
74
- than one line.
75
- StyleGuide: '#no-double-indent'
76
- Enabled: true
77
-
78
- Layout/BlockEndNewline:
79
- Description: 'Put end statement of multiline block on its own line.'
80
- Enabled: true
81
-
82
- Layout/CaseIndentation:
83
- Description: 'Indentation of when in a case/when/[else/]end.'
84
- StyleGuide: '#indent-when-to-case'
85
- Enabled: true
86
-
87
- Layout/ClosingParenthesisIndentation:
88
- Description: 'Checks the indentation of hanging closing parentheses.'
89
- Enabled: true
90
-
91
- Layout/CommentIndentation:
92
- Description: 'Indentation of comments.'
93
- Enabled: true
94
-
95
- Layout/DotPosition:
96
- Description: 'Checks the position of the dot in multi-line method calls.'
97
- StyleGuide: '#consistent-multi-line-chains'
98
- Enabled: true
99
-
100
- Layout/ElseAlignment:
101
- Description: 'Align elses and elsifs correctly.'
102
- Enabled: true
103
-
104
- Layout/EmptyLineAfterMagicComment:
105
- Description: 'Add an empty line after magic comments to separate them from code.'
106
- StyleGuide: '#separate-magic-comments-from-code'
107
- Enabled: true
108
-
109
- Layout/EmptyLineBetweenDefs:
110
- Description: 'Use empty lines between defs.'
111
- StyleGuide: '#empty-lines-between-methods'
112
- Enabled: true
113
-
114
- Layout/EmptyLines:
115
- Description: "Don't use several empty lines in a row."
116
- StyleGuide: '#two-or-more-empty-lines'
117
- Enabled: true
118
-
119
- Layout/EmptyLinesAroundAccessModifier:
120
- Description: "Keep blank lines around access modifiers."
121
- StyleGuide: '#empty-lines-around-access-modifier'
122
- Enabled: true
123
-
124
- Layout/EmptyLinesAroundArguments:
125
- Description: "Keeps track of empty lines around method arguments."
126
- Enabled: true
127
-
128
- Layout/EmptyLinesAroundBeginBody:
129
- Description: "Keeps track of empty lines around begin-end bodies."
130
- StyleGuide: '#empty-lines-around-bodies'
131
- Enabled: true
132
-
133
- Layout/EmptyLinesAroundBlockBody:
134
- Description: "Keeps track of empty lines around block bodies."
135
- StyleGuide: '#empty-lines-around-bodies'
136
- Enabled: true
137
-
138
- Layout/EmptyLinesAroundClassBody:
139
- Description: "Keeps track of empty lines around class bodies."
140
- StyleGuide: '#empty-lines-around-bodies'
141
- Enabled: true
142
-
143
- Layout/EmptyLinesAroundExceptionHandlingKeywords:
144
- Description: "Keeps track of empty lines around exception handling keywords."
145
- StyleGuide: '#empty-lines-around-bodies'
146
- Enabled: true
147
-
148
- Layout/EmptyLinesAroundMethodBody:
149
- Description: "Keeps track of empty lines around method bodies."
150
- StyleGuide: '#empty-lines-around-bodies'
151
- Enabled: true
152
-
153
- Layout/EmptyLinesAroundModuleBody:
154
- Description: "Keeps track of empty lines around module bodies."
155
- StyleGuide: '#empty-lines-around-bodies'
156
- Enabled: true
157
-
158
- Layout/EndOfLine:
159
- Description: 'Use Unix-style line endings.'
160
- StyleGuide: '#crlf'
161
- Enabled: true
162
-
163
- Layout/ExtraSpacing:
164
- Description: 'Do not use unnecessary spacing.'
165
- Enabled: true
166
-
167
- Layout/FirstParameterIndentation:
168
- Description: 'Checks the indentation of the first parameter in a method call.'
169
- Enabled: true
170
-
171
- Layout/IndentArray:
172
- Description: >-
173
- Checks the indentation of the first element in an array
174
- literal.
175
- Enabled: true
176
-
177
- Layout/IndentAssignment:
178
- Description: >-
179
- Checks the indentation of the first line of the
180
- right-hand-side of a multi-line assignment.
181
- Enabled: true
182
-
183
- Layout/IndentHash:
184
- Description: 'Checks the indentation of the first key in a hash literal.'
185
- Enabled: true
186
-
187
- Layout/IndentHeredoc:
188
- Description: 'This cops checks the indentation of the here document bodies.'
189
- StyleGuide: '#squiggly-heredocs'
190
- Enabled: true
191
-
192
- Layout/IndentationConsistency:
193
- Description: 'Keep indentation straight.'
194
- StyleGuide: '#spaces-indentation'
195
- Enabled: true
196
-
197
- Layout/IndentationWidth:
198
- Description: 'Use 2 spaces for indentation.'
199
- StyleGuide: '#spaces-indentation'
200
- Enabled: true
201
-
202
- Layout/InitialIndentation:
203
- Description: >-
204
- Checks the indentation of the first non-blank non-comment line in a file.
205
- Enabled: true
206
-
207
- Layout/LeadingCommentSpace:
208
- Description: 'Comments should start with a space.'
209
- StyleGuide: '#hash-space'
210
- Enabled: true
211
-
212
- Layout/MultilineArrayBraceLayout:
213
- Description: >-
214
- Checks that the closing brace in an array literal is
215
- either on the same line as the last array element, or
216
- a new line.
217
- Enabled: true
218
-
219
- Layout/MultilineBlockLayout:
220
- Description: 'Ensures newlines after multiline block do statements.'
221
- Enabled: true
222
-
223
- Layout/MultilineHashBraceLayout:
224
- Description: >-
225
- Checks that the closing brace in a hash literal is
226
- either on the same line as the last hash element, or
227
- a new line.
228
- Enabled: true
229
-
230
- Layout/MultilineMethodCallBraceLayout:
231
- Description: >-
232
- Checks that the closing brace in a method call is
233
- either on the same line as the last method argument, or
234
- a new line.
235
- Enabled: true
236
-
237
- Layout/MultilineMethodCallIndentation:
238
- Description: >-
239
- Checks indentation of method calls with the dot operator
240
- that span more than one line.
241
- Enabled: true
242
-
243
- Layout/MultilineMethodDefinitionBraceLayout:
244
- Description: >-
245
- Checks that the closing brace in a method definition is
246
- either on the same line as the last method parameter, or
247
- a new line.
248
- Enabled: true
249
-
250
- Layout/MultilineOperationIndentation:
251
- Description: >-
252
- Checks indentation of binary operations that span more than
253
- one line.
254
- Enabled: true
255
-
256
- Layout/RescueEnsureAlignment:
257
- Description: 'Align rescues and ensures correctly.'
258
- Enabled: true
259
-
260
- Layout/SpaceAfterColon:
261
- Description: 'Use spaces after colons.'
262
- StyleGuide: '#spaces-operators'
263
- Enabled: true
264
-
265
- Layout/SpaceAfterComma:
266
- Description: 'Use spaces after commas.'
267
- StyleGuide: '#spaces-operators'
268
- Enabled: true
269
-
270
- Layout/SpaceAfterMethodName:
271
- Description: >-
272
- Do not put a space between a method name and the opening
273
- parenthesis in a method definition.
274
- StyleGuide: '#parens-no-spaces'
275
- Enabled: true
276
-
277
- Layout/SpaceAfterNot:
278
- Description: Tracks redundant space after the ! operator.
279
- StyleGuide: '#no-space-bang'
280
- Enabled: true
281
-
282
- Layout/SpaceAfterSemicolon:
283
- Description: 'Use spaces after semicolons.'
284
- StyleGuide: '#spaces-operators'
285
- Enabled: true
286
-
287
- Layout/SpaceAroundBlockParameters:
288
- Description: 'Checks the spacing inside and after block parameters pipes.'
289
- Enabled: true
290
-
291
- Layout/SpaceAroundEqualsInParameterDefault:
292
- Description: >-
293
- Checks that the equals signs in parameter default assignments
294
- have or don't have surrounding space depending on
295
- configuration.
296
- StyleGuide: '#spaces-around-equals'
297
- Enabled: true
298
-
299
- Layout/SpaceAroundKeyword:
300
- Description: 'Use a space around keywords if appropriate.'
301
- Enabled: true
302
-
303
- Layout/SpaceAroundOperators:
304
- Description: 'Use a single space around operators.'
305
- StyleGuide: '#spaces-operators'
306
- Enabled: true
307
-
308
- Layout/SpaceBeforeBlockBraces:
309
- Description: >-
310
- Checks that the left block brace has or doesn't have space
311
- before it.
312
- Enabled: true
313
-
314
- Layout/SpaceBeforeComma:
315
- Description: 'No spaces before commas.'
316
- Enabled: true
317
-
318
- Layout/SpaceBeforeComment:
319
- Description: >-
320
- Checks for missing space between code and a comment on the
321
- same line.
322
- Enabled: true
323
-
324
- Layout/SpaceBeforeFirstArg:
325
- Description: >-
326
- Checks that exactly one space is used between a method name
327
- and the first argument for method calls without parentheses.
328
- Enabled: true
329
-
330
- Layout/SpaceBeforeSemicolon:
331
- Description: 'No spaces before semicolons.'
332
- Enabled: true
333
-
334
- Layout/SpaceInLambdaLiteral:
335
- Description: 'Checks for spaces in lambda literals.'
336
- Enabled: true
337
-
338
- Layout/SpaceInsideArrayLiteralBrackets:
339
- Description: 'Checks the spacing inside array literal brackets.'
340
- Enabled: true
341
-
342
- Layout/SpaceInsideArrayPercentLiteral:
343
- Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
344
- Enabled: true
345
-
346
- Layout/SpaceInsideBlockBraces:
347
- Description: >-
348
- Checks that block braces have or don't have surrounding space.
349
- For blocks taking parameters, checks that the left brace has
350
- or doesn't have trailing space.
351
- Enabled: true
352
-
353
- Layout/SpaceInsideHashLiteralBraces:
354
- Description: "Use spaces inside hash literal braces - or don't."
355
- StyleGuide: '#spaces-operators'
356
- Enabled: true
357
-
358
- Layout/SpaceInsideParens:
359
- Description: 'No spaces after ( or before ).'
360
- StyleGuide: '#spaces-braces'
361
- Enabled: true
362
-
363
- Layout/SpaceInsidePercentLiteralDelimiters:
364
- Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
365
- Enabled: true
366
-
367
- Layout/SpaceInsideRangeLiteral:
368
- Description: 'No spaces inside range literals.'
369
- StyleGuide: '#no-space-inside-range-literals'
370
- Enabled: true
371
-
372
- Layout/SpaceInsideReferenceBrackets:
373
- Description: 'Checks the spacing inside referential brackets.'
374
- Enabled: true
375
-
376
- Layout/SpaceInsideStringInterpolation:
377
- Description: 'Checks for padding/surrounding spaces inside string interpolation.'
378
- StyleGuide: '#string-interpolation'
379
- Enabled: true
380
-
381
- Layout/Tab:
382
- Description: 'No hard tabs.'
383
- StyleGuide: '#spaces-indentation'
384
- Enabled: true
385
-
386
- Layout/TrailingBlankLines:
387
- Description: 'Checks trailing blank lines and final newline.'
388
- StyleGuide: '#newline-eof'
389
- Enabled: true
390
-
391
- Layout/TrailingWhitespace:
392
- Description: 'Avoid trailing whitespace.'
393
- StyleGuide: '#no-trailing-whitespace'
394
- Enabled: true
395
-
396
- #################### Lint ##################################
397
- ### Warnings
398
-
399
- Lint/AmbiguousBlockAssociation:
400
- Description: >-
401
- Checks for ambiguous block association with method when param passed without
402
- parentheses.
403
- StyleGuide: '#syntax'
404
- Enabled: true
405
-
406
- Lint/AmbiguousOperator:
407
- Description: >-
408
- Checks for ambiguous operators in the first argument of a
409
- method invocation without parentheses.
410
- StyleGuide: '#method-invocation-parens'
411
- Enabled: true
412
-
413
- Lint/AmbiguousRegexpLiteral:
414
- Description: >-
415
- Checks for ambiguous regexp literals in the first argument of
416
- a method invocation without parentheses.
417
- Enabled: true
418
-
419
- Lint/AssignmentInCondition:
420
- Description: "Don't use assignment in conditions."
421
- StyleGuide: '#safe-assignment-in-condition'
422
- Enabled: true
423
-
424
- Lint/BlockAlignment:
425
- Description: 'Align block ends correctly.'
426
- Enabled: true
427
-
428
- Lint/BooleanSymbol:
429
- Description: 'Check for `:true` and `:false` symbols.'
430
- Enabled: true
431
-
432
- Lint/CircularArgumentReference:
433
- Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
434
- Enabled: true
435
-
436
- Lint/ConditionPosition:
437
- Description: >-
438
- Checks for condition placed in a confusing position relative to
439
- the keyword.
440
- StyleGuide: '#same-line-condition'
441
- Enabled: true
442
-
443
- Lint/Debugger:
444
- Description: 'Check for debugger calls.'
445
- Enabled: true
446
-
447
- Lint/DefEndAlignment:
448
- Description: 'Align ends corresponding to defs correctly.'
449
- Enabled: true
450
-
451
- Lint/DeprecatedClassMethods:
452
- Description: 'Check for deprecated class method calls.'
453
- Enabled: true
454
-
455
- Lint/DuplicateCaseCondition:
456
- Description: 'Do not repeat values in case conditionals.'
457
- Enabled: true
458
-
459
- Lint/DuplicateMethods:
460
- Description: 'Check for duplicate method definitions.'
461
- Enabled: true
462
-
463
- Lint/DuplicatedKey:
464
- Description: 'Check for duplicate keys in hash literals.'
465
- Enabled: true
466
-
467
- Lint/EachWithObjectArgument:
468
- Description: 'Check for immutable argument given to each_with_object.'
469
- Enabled: true
470
-
471
- Lint/ElseLayout:
472
- Description: 'Check for odd code arrangement in an else block.'
473
- Enabled: true
474
-
475
- Lint/EmptyEnsure:
476
- Description: 'Checks for empty ensure block.'
477
- Enabled: true
478
- AutoCorrect: false
479
-
480
- Lint/EmptyExpression:
481
- Description: 'Checks for empty expressions.'
482
- Enabled: true
483
-
484
- Lint/EmptyInterpolation:
485
- Description: 'Checks for empty string interpolation.'
486
- Enabled: true
487
-
488
- Lint/EmptyWhen:
489
- Description: 'Checks for `when` branches with empty bodies.'
490
- Enabled: true
491
-
492
- Lint/EndAlignment:
493
- Description: 'Align ends correctly.'
494
- Enabled: true
495
-
496
- Lint/EndInMethod:
497
- Description: 'END blocks should not be placed inside method definitions.'
498
- Enabled: true
499
-
500
- Lint/EnsureReturn:
501
- Description: 'Do not use return in an ensure block.'
502
- StyleGuide: '#no-return-ensure'
503
- Enabled: true
504
-
505
- Lint/FloatOutOfRange:
506
- Description: >-
507
- Catches floating-point literals too large or small for Ruby to
508
- represent.
509
- Enabled: true
510
-
511
- Lint/FormatParameterMismatch:
512
- Description: 'The number of parameters to format/sprint must match the fields.'
513
- Enabled: true
514
-
515
- Lint/HandleExceptions:
516
- Description: "Don't suppress exception."
517
- StyleGuide: '#dont-hide-exceptions'
518
- Enabled: true
519
-
520
- Lint/ImplicitStringConcatenation:
521
- Description: >-
522
- Checks for adjacent string literals on the same line, which
523
- could better be represented as a single string literal.
524
- Enabled: true
525
-
526
- Lint/IneffectiveAccessModifier:
527
- Description: >-
528
- Checks for attempts to use `private` or `protected` to set
529
- the visibility of a class method, which does not work.
530
- Enabled: true
531
-
532
- Lint/InheritException:
533
- Description: 'Avoid inheriting from the `Exception` class.'
534
- Enabled: true
535
-
536
- Lint/InterpolationCheck:
537
- Description: 'Raise warning for interpolation in single q strs'
538
- Enabled: true
539
-
540
- Lint/LiteralAsCondition:
541
- Description: 'Checks of literals used in conditions.'
542
- Enabled: true
543
-
544
- Lint/LiteralInInterpolation:
545
- Description: 'Checks for literals used in interpolation.'
546
- Enabled: true
547
-
548
- Lint/Loop:
549
- Description: >-
550
- Use Kernel#loop with break rather than begin/end/until or
551
- begin/end/while for post-loop tests.
552
- StyleGuide: '#loop-with-break'
553
- Enabled: true
554
-
555
- Lint/MissingCopEnableDirective:
556
- Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
557
- Enabled: true
558
-
559
- Lint/MultipleCompare:
560
- Description: "Use `&&` operator to compare multiple value."
561
- Enabled: true
562
-
563
- Lint/NestedMethodDefinition:
564
- Description: 'Do not use nested method definitions.'
565
- StyleGuide: '#no-nested-methods'
566
- Enabled: true
567
-
568
- Lint/NestedPercentLiteral:
569
- Description: 'Checks for nested percent literals.'
570
- Enabled: true
571
-
572
- Lint/NextWithoutAccumulator:
573
- Description: >-
574
- Do not omit the accumulator when calling `next`
575
- in a `reduce`/`inject` block.
576
- Enabled: true
577
-
578
- Lint/NonLocalExitFromIterator:
579
- Description: 'Do not use return in iterator to cause non-local exit.'
580
- Enabled: true
581
-
582
- Lint/ParenthesesAsGroupedExpression:
583
- Description: >-
584
- Checks for method calls with a space before the opening
585
- parenthesis.
586
- StyleGuide: '#parens-no-spaces'
587
- Enabled: true
588
-
589
- Lint/PercentStringArray:
590
- Description: >-
591
- Checks for unwanted commas and quotes in %w/%W literals.
592
- Enabled: true
593
-
594
- Lint/PercentSymbolArray:
595
- Description: >-
596
- Checks for unwanted commas and colons in %i/%I literals.
597
- Enabled: true
598
-
599
- Lint/RandOne:
600
- Description: >-
601
- Checks for `rand(1)` calls. Such calls always return `0`
602
- and most likely a mistake.
603
- Enabled: true
604
-
605
- Lint/RedundantWithIndex:
606
- Description: 'Checks for redundant `with_index`.'
607
- Enabled: true
608
-
609
- Lint/RedundantWithObject:
610
- Description: 'Checks for redundant `with_object`.'
611
- Enabled: true
612
-
613
- Lint/RegexpAsCondition:
614
- Description: >-
615
- Do not use regexp literal as a condition.
616
- The regexp literal matches `$_` implicitly.
617
- Enabled: true
618
-
619
- Lint/RequireParentheses:
620
- Description: >-
621
- Use parentheses in the method call to avoid confusion
622
- about precedence.
623
- Enabled: true
624
-
625
- Lint/RescueException:
626
- Description: 'Avoid rescuing the Exception class.'
627
- StyleGuide: '#no-blind-rescues'
628
- Enabled: true
629
-
630
- Lint/RescueType:
631
- Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
632
- Enabled: true
633
-
634
- Lint/ReturnInVoidContext:
635
- Description: 'Checks for return in void context.'
636
- Enabled: true
637
-
638
- Lint/SafeNavigationChain:
639
- Description: 'Do not chain ordinary method call after safe navigation operator.'
640
- Enabled: true
641
-
642
- Lint/ScriptPermission:
643
- Description: 'Grant script file execute permission.'
644
- Enabled: true
645
-
646
- Lint/ShadowedArgument:
647
- Description: 'Avoid reassigning arguments before they were used.'
648
- Enabled: true
649
-
650
- Lint/ShadowedException:
651
- Description: >-
652
- Avoid rescuing a higher level exception
653
- before a lower level exception.
654
- Enabled: true
655
-
656
- Lint/ShadowingOuterLocalVariable:
657
- Description: >-
658
- Do not use the same name as outer local variable
659
- for block arguments or block local variables.
660
- Enabled: true
661
-
662
- Lint/StringConversionInInterpolation:
663
- Description: 'Checks for Object#to_s usage in string interpolation.'
664
- StyleGuide: '#no-to-s'
665
- Enabled: true
666
-
667
- Lint/Syntax:
668
- Description: 'Checks syntax error'
669
- Enabled: true
670
-
671
- Lint/UnderscorePrefixedVariableName:
672
- Description: 'Do not use prefix `_` for a variable that is used.'
673
- Enabled: true
674
-
675
- Lint/UnifiedInteger:
676
- Description: 'Use Integer instead of Fixnum or Bignum'
677
- Enabled: true
678
-
679
- Lint/UnneededDisable:
680
- Description: >-
681
- Checks for rubocop:disable comments that can be removed.
682
- Note: this cop is not disabled when disabling all cops.
683
- It must be explicitly disabled.
684
- Enabled: true
685
-
686
- Lint/UnneededRequireStatement:
687
- Description: 'Checks for unnecessary `require` statement.'
688
- Enabled: true
689
-
690
- Lint/UnneededSplatExpansion:
691
- Description: 'Checks for splat unnecessarily being called on literals'
692
- Enabled: true
693
-
694
- Lint/UnreachableCode:
695
- Description: 'Unreachable code.'
696
- Enabled: true
697
-
698
- Lint/UnusedBlockArgument:
699
- Description: 'Checks for unused block arguments.'
700
- StyleGuide: '#underscore-unused-vars'
701
- Enabled: true
702
-
703
- Lint/UnusedMethodArgument:
704
- Description: 'Checks for unused method arguments.'
705
- StyleGuide: '#underscore-unused-vars'
706
- Enabled: true
707
-
708
- Lint/UriEscapeUnescape:
709
- Description: >-
710
- `URI.escape` method is obsolete and should not be used. Instead, use
711
- `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
712
- depending on your specific use case.
713
- Also `URI.unescape` method is obsolete and should not be used. Instead, use
714
- `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
715
- depending on your specific use case.
716
- Enabled: true
717
-
718
- Lint/UriRegexp:
719
- Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
720
- Enabled: true
721
-
722
- Lint/UselessAccessModifier:
723
- Description: 'Checks for useless access modifiers.'
724
- Enabled: true
725
- ContextCreatingMethods: []
726
- MethodCreatingMethods: []
727
-
728
- Lint/UselessAssignment:
729
- Description: 'Checks for useless assignment to a local variable.'
730
- StyleGuide: '#underscore-unused-vars'
731
- Enabled: true
732
-
733
- Lint/UselessComparison:
734
- Description: 'Checks for comparison of something with itself.'
735
- Enabled: true
736
-
737
- Lint/UselessElseWithoutRescue:
738
- Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
739
- Enabled: true
740
-
741
- Lint/UselessSetterCall:
742
- Description: 'Checks for useless setter call to a local variable.'
743
- Enabled: true
744
-
745
- Lint/Void:
746
- Description: 'Possible use of operator/literal/variable in void context.'
747
- Enabled: true
748
-
749
- #################### Metrics ###############################
750
-
751
- Metrics/AbcSize:
752
- Description: >-
753
- A calculated magnitude based on number of assignments,
754
- branches, and conditions.
755
- Reference: 'http://c2.com/cgi/wiki?AbcMetric'
756
- Enabled: true
757
-
758
- Metrics/BlockLength:
759
- Description: 'Avoid long blocks with many lines.'
760
- Enabled: true
761
-
762
- Metrics/BlockNesting:
763
- Description: 'Avoid excessive block nesting'
764
- StyleGuide: '#three-is-the-number-thou-shalt-count'
765
- Enabled: true
766
-
767
- Metrics/ClassLength:
768
- Description: 'Avoid classes longer than 100 lines of code.'
769
- Enabled: true
770
-
771
- Metrics/CyclomaticComplexity:
772
- Description: >-
773
- A complexity metric that is strongly correlated to the number
774
- of test cases needed to validate a method.
775
- Enabled: true
776
-
777
- Metrics/LineLength:
778
- Description: 'Limit lines to 80 characters.'
779
- StyleGuide: '#80-character-limits'
780
- Enabled: true
781
-
782
- Metrics/MethodLength:
783
- Description: 'Avoid methods longer than 10 lines of code.'
784
- StyleGuide: '#short-methods'
785
- Enabled: true
786
-
787
- Metrics/ModuleLength:
788
- Description: 'Avoid modules longer than 100 lines of code.'
789
- Enabled: true
790
-
791
- Metrics/ParameterLists:
792
- Description: 'Avoid parameter lists longer than three or four parameters.'
793
- StyleGuide: '#too-many-params'
794
- Enabled: true
795
-
796
- Metrics/PerceivedComplexity:
797
- Description: >-
798
- A complexity metric geared towards measuring complexity for a
799
- human reader.
800
- Enabled: true
801
-
802
- #################### Naming ##############################
803
-
804
- Naming/AccessorMethodName:
805
- Description: Check the naming of accessor methods for get_/set_.
806
- StyleGuide: '#accessor_mutator_method_names'
807
- Enabled: true
808
-
809
- Naming/AsciiIdentifiers:
810
- Description: 'Use only ascii symbols in identifiers.'
811
- StyleGuide: '#english-identifiers'
812
- Enabled: true
813
-
814
- Naming/BinaryOperatorParameterName:
815
- Description: 'When defining binary operators, name the argument other.'
816
- StyleGuide: '#other-arg'
817
- Enabled: true
818
-
819
- Naming/ClassAndModuleCamelCase:
820
- Description: 'Use CamelCase for classes and modules.'
821
- StyleGuide: '#camelcase-classes'
822
- Enabled: true
823
-
824
- Naming/ConstantName:
825
- Description: 'Constants should use SCREAMING_SNAKE_CASE.'
826
- StyleGuide: '#screaming-snake-case'
827
- Enabled: true
828
-
829
- Naming/FileName:
830
- Description: 'Use snake_case for source file names.'
831
- StyleGuide: '#snake-case-files'
832
- Enabled: true
833
-
834
- Naming/HeredocDelimiterCase:
835
- Description: 'Use configured case for heredoc delimiters.'
836
- StyleGuide: '#heredoc-delimiters'
837
- Enabled: true
838
-
839
- Naming/HeredocDelimiterNaming:
840
- Description: 'Use descriptive heredoc delimiters.'
841
- StyleGuide: '#heredoc-delimiters'
842
- Enabled: true
843
-
844
- Naming/MethodName:
845
- Description: 'Use the configured style when naming methods.'
846
- StyleGuide: '#snake-case-symbols-methods-vars'
847
- Enabled: true
848
-
849
- Naming/PredicateName:
850
- Description: 'Check the names of predicate methods.'
851
- StyleGuide: '#bool-methods-qmark'
852
- Enabled: true
853
-
854
- Naming/VariableName:
855
- Description: 'Use the configured style when naming variables.'
856
- StyleGuide: '#snake-case-symbols-methods-vars'
857
- Enabled: true
858
-
859
- Naming/VariableNumber:
860
- Description: 'Use the configured style when numbering variables.'
861
- Enabled: true
862
-
863
- #################### Performance ###########################
864
-
865
- Performance/Caller:
866
- Description: >-
867
- Use `caller(n..n)` instead of `caller`.
868
- Enabled: true
869
-
870
- Performance/CaseWhenSplat:
871
- Description: >-
872
- Place `when` conditions that use splat at the end
873
- of the list of `when` branches.
874
- Enabled: true
875
-
876
- Performance/Casecmp:
877
- Description: >-
878
- Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
879
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
880
- Enabled: true
881
-
882
- Performance/CompareWithBlock:
883
- Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
884
- Enabled: true
885
-
886
- Performance/Count:
887
- Description: >-
888
- Use `count` instead of `select...size`, `reject...size`,
889
- `select...count`, `reject...count`, `select...length`,
890
- and `reject...length`.
891
- # This cop has known compatibility issues with `ActiveRecord` and other
892
- # frameworks. ActiveRecord's `count` ignores the block that is passed to it.
893
- # For more information, see the documentation in the cop itself.
894
- # If you understand the known risk, you can disable `SafeMode`.
895
- SafeMode: true
896
- Enabled: true
897
-
898
- Performance/Detect:
899
- Description: >-
900
- Use `detect` instead of `select.first`, `find_all.first`,
901
- `select.last`, and `find_all.last`.
902
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
903
- # This cop has known compatibility issues with `ActiveRecord` and other
904
- # frameworks. `ActiveRecord` does not implement a `detect` method and `find`
905
- # has its own meaning. Correcting `ActiveRecord` methods with this cop
906
- # should be considered unsafe.
907
- SafeMode: true
908
- Enabled: true
909
-
910
- Performance/DoubleStartEndWith:
911
- Description: >-
912
- Use `str.{start,end}_with?(x, ..., y, ...)`
913
- instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
914
- Enabled: true
915
-
916
- Performance/EndWith:
917
- Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
918
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
919
- # This will change to a new method call which isn't guaranteed to be on the
920
- # object. Switching these methods has to be done with knowledge of the types
921
- # of the variables which rubocop doesn't have.
922
- AutoCorrect: false
923
- Enabled: true
924
-
925
- Performance/FixedSize:
926
- Description: 'Do not compute the size of statically sized objects except in constants'
927
- Enabled: true
928
-
929
- Performance/FlatMap:
930
- Description: >-
931
- Use `Enumerable#flat_map`
932
- instead of `Enumerable#map...Array#flatten(1)`
933
- or `Enumberable#collect..Array#flatten(1)`
934
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
935
- Enabled: true
936
- EnabledForFlattenWithoutParams: false
937
- # If enabled, this cop will warn about usages of
938
- # `flatten` being called without any parameters.
939
- # This can be dangerous since `flat_map` will only flatten 1 level, and
940
- # `flatten` without any parameters can flatten multiple levels.
941
-
942
- Performance/HashEachMethods:
943
- Description: >-
944
- Use `Hash#each_key` and `Hash#each_value` instead of
945
- `Hash#keys.each` and `Hash#values.each`.
946
- StyleGuide: '#hash-each'
947
- Enabled: true
948
- AutoCorrect: false
949
-
950
- Performance/LstripRstrip:
951
- Description: 'Use `strip` instead of `lstrip.rstrip`.'
952
- Enabled: true
953
-
954
- Performance/RangeInclude:
955
- Description: 'Use `Range#cover?` instead of `Range#include?`.'
956
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
957
- Enabled: true
958
-
959
- Performance/RedundantBlockCall:
960
- Description: 'Use `yield` instead of `block.call`.'
961
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
962
- Enabled: true
963
-
964
- Performance/RedundantMatch:
965
- Description: >-
966
- Use `=~` instead of `String#match` or `Regexp#match` in a context where the
967
- returned `MatchData` is not needed.
968
- Enabled: true
969
-
970
- Performance/RedundantMerge:
971
- Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
972
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
973
- Enabled: true
974
-
975
- Performance/RedundantSortBy:
976
- Description: 'Use `sort` instead of `sort_by { |x| x }`.'
977
- Enabled: true
978
-
979
- Performance/RegexpMatch:
980
- Description: >-
981
- Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
982
- `Regexp#===`, or `=~` when `MatchData` is not used.
983
- Enabled: true
984
-
985
- Performance/ReverseEach:
986
- Description: 'Use `reverse_each` instead of `reverse.each`.'
987
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
988
- Enabled: true
989
-
990
- Performance/Sample:
991
- Description: >-
992
- Use `sample` instead of `shuffle.first`,
993
- `shuffle.last`, and `shuffle[Integer]`.
994
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
995
- Enabled: true
996
-
997
- Performance/Size:
998
- Description: >-
999
- Use `size` instead of `count` for counting
1000
- the number of elements in `Array` and `Hash`.
1001
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
1002
- Enabled: true
1003
-
1004
- Performance/StartWith:
1005
- Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
1006
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
1007
- # This will change to a new method call which isn't guaranteed to be on the
1008
- # object. Switching these methods has to be done with knowledge of the types
1009
- # of the variables which rubocop doesn't have.
1010
- AutoCorrect: false
1011
- Enabled: true
1012
-
1013
- Performance/StringReplacement:
1014
- Description: >-
1015
- Use `tr` instead of `gsub` when you are replacing the same
1016
- number of characters. Use `delete` instead of `gsub` when
1017
- you are deleting characters.
1018
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
1019
- Enabled: true
1020
-
1021
- Performance/TimesMap:
1022
- Description: 'Checks for .times.map calls.'
1023
- AutoCorrect: false
1024
- Enabled: true
1025
-
1026
- Performance/UnfreezeString:
1027
- Description: 'Use unary plus to get an unfrozen string literal.'
1028
- Enabled: true
1029
-
1030
- Performance/UriDefaultParser:
1031
- Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
1032
- Enabled: true
1033
-
1034
- #################### Rails #################################
1035
-
1036
- Rails/ActionFilter:
1037
- Description: 'Enforces consistent use of action filter methods.'
1038
- Enabled: true
1039
-
1040
- Rails/ActiveSupportAliases:
1041
- Description: >-
1042
- Avoid ActiveSupport aliases of standard ruby methods:
1043
- `String#starts_with?`, `String#ends_with?`,
1044
- `Array#append`, `Array#prepend`.
1045
- Enabled: true
1046
-
1047
- Rails/ApplicationJob:
1048
- Description: 'Check that jobs subclass ApplicationJob.'
1049
- Enabled: true
1050
-
1051
- Rails/ApplicationRecord:
1052
- Description: 'Check that models subclass ApplicationRecord.'
1053
- Enabled: true
1054
-
1055
- Rails/Blank:
1056
- Description: 'Enforce using `blank?` and `present?`.'
1057
- Enabled: true
1058
- # Convert checks for `nil` or `empty?` to `blank?`
1059
- NilOrEmpty: true
1060
- # Convert usages of not `present?` to `blank?`
1061
- NotPresent: true
1062
- # Convert usages of `unless` `present?` to `if` `blank?`
1063
- UnlessPresent: true
1064
-
1065
- Rails/CreateTableWithTimestamps:
1066
- Description: >-
1067
- Checks the migration for which timestamps are not included
1068
- when creating a new table.
1069
- Enabled: true
1070
-
1071
- Rails/Date:
1072
- Description: >-
1073
- Checks the correct usage of date aware methods,
1074
- such as Date.today, Date.current etc.
1075
- Enabled: true
1076
-
1077
- Rails/Delegate:
1078
- Description: 'Prefer delegate method for delegations.'
1079
- Enabled: true
1080
-
1081
- Rails/DelegateAllowBlank:
1082
- Description: 'Do not use allow_blank as an option to delegate.'
1083
- Enabled: true
1084
-
1085
- Rails/DynamicFindBy:
1086
- Description: 'Use `find_by` instead of dynamic `find_by_*`.'
1087
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
1088
- Enabled: true
1089
-
1090
- Rails/EnumUniqueness:
1091
- Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
1092
- Enabled: true
1093
-
1094
- Rails/EnvironmentComparison:
1095
- Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
1096
- Enabled: true
1097
-
1098
- Rails/Exit:
1099
- Description: >-
1100
- Favor `fail`, `break`, `return`, etc. over `exit` in
1101
- application or library code outside of Rake files to avoid
1102
- exits during unit testing or running in production.
1103
- Enabled: true
1104
-
1105
- Rails/FilePath:
1106
- Description: 'Use `Rails.root.join` for file path joining.'
1107
- Enabled: true
1108
-
1109
- Rails/FindBy:
1110
- Description: 'Prefer find_by over where.first.'
1111
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
1112
- Enabled: true
1113
-
1114
- Rails/FindEach:
1115
- Description: 'Prefer all.find_each over all.find.'
1116
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find-each'
1117
- Enabled: true
1118
-
1119
- Rails/HasAndBelongsToMany:
1120
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
1121
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
1122
- Enabled: true
1123
-
1124
- Rails/HasManyOrHasOneDependent:
1125
- Description: 'Define the dependent option to the has_many and has_one associations.'
1126
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has_many-has_one-dependent-option'
1127
- Enabled: true
1128
-
1129
- Rails/HttpPositionalArguments:
1130
- Description: 'Use keyword arguments instead of positional arguments in http method calls.'
1131
- Enabled: true
1132
- Include:
1133
- - 'spec/**/*'
1134
- - 'test/**/*'
1135
-
1136
- Rails/InverseOf:
1137
- Description: 'Checks for associations where the inverse cannot be determined automatically.'
1138
- Enabled: true
1139
-
1140
- Rails/LexicallyScopedActionFilter:
1141
- Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
1142
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#lexically-scoped-action-filter'
1143
- Enabled: true
1144
-
1145
- Rails/NotNullColumn:
1146
- Description: 'Do not add a NOT NULL column without a default value'
1147
- Enabled: true
1148
-
1149
- Rails/Output:
1150
- Description: 'Checks for calls to puts, print, etc.'
1151
- Enabled: true
1152
-
1153
- Rails/OutputSafety:
1154
- Description: 'The use of `html_safe` or `raw` may be a security risk.'
1155
- Enabled: true
1156
-
1157
- Rails/PluralizationGrammar:
1158
- Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
1159
- Enabled: true
1160
-
1161
- Rails/Presence:
1162
- Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
1163
- Enabled: true
1164
-
1165
- Rails/Present:
1166
- Description: 'Enforce using `blank?` and `present?`.'
1167
- Enabled: true
1168
- NotNilAndNotEmpty: true
1169
- # Convert checks for not `nil` and not `empty?` to `present?`
1170
- NotBlank: true
1171
- # Convert usages of not `blank?` to `present?`
1172
- UnlessBlank: true
1173
- # Convert usages of `unless` `blank?` to `if` `present?`
1174
-
1175
- Rails/ReadWriteAttribute:
1176
- Description: >-
1177
- Checks for read_attribute(:attr) and
1178
- write_attribute(:attr, val).
1179
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#read-attribute'
1180
- Enabled: true
1181
-
1182
- Rails/RedundantReceiverInWithOptions:
1183
- Description: 'Checks for redundant receiver in `with_options`.'
1184
- Enabled: true
1185
-
1186
- Rails/RelativeDateConstant:
1187
- Description: 'Do not assign relative date to constants.'
1188
- Enabled: true
1189
-
1190
- Rails/RequestReferer:
1191
- Description: 'Use consistent syntax for request.referer.'
1192
- Enabled: true
1193
-
1194
- Rails/ReversibleMigration:
1195
- Description: 'Checks whether the change method of the migration file is reversible.'
1196
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#reversible-migration'
1197
- Reference: 'http://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
1198
- Enabled: true
1199
-
1200
- Rails/SafeNavigation:
1201
- Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
1202
- Enabled: true
1203
-
1204
- Rails/ScopeArgs:
1205
- Description: 'Checks the arguments of ActiveRecord scopes.'
1206
- Enabled: true
1207
-
1208
- Rails/SkipsModelValidations:
1209
- Description: >-
1210
- Use methods that skips model validations with caution.
1211
- See reference for more information.
1212
- Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
1213
- Enabled: true
1214
-
1215
- Rails/TimeZone:
1216
- Description: 'Checks the correct usage of time zone aware methods.'
1217
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
1218
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
1219
- Enabled: true
1220
-
1221
- Rails/UniqBeforePluck:
1222
- Description: 'Prefer the use of uniq or distinct before pluck.'
1223
- Enabled: true
1224
-
1225
- Rails/UnknownEnv:
1226
- Description: 'Use correct environment name.'
1227
- Enabled: true
1228
-
1229
- Rails/Validation:
1230
- Description: 'Use validates :attribute, hash of validations.'
1231
- Enabled: true
1232
-
1233
- #################### Security ##############################
1234
-
1235
- Security/Eval:
1236
- Description: 'The use of eval represents a serious security risk.'
1237
- Enabled: true
1238
-
1239
- Security/JSONLoad:
1240
- Description: >-
1241
- Prefer usage of `JSON.parse` over `JSON.load` due to potential
1242
- security issues. See reference for more information.
1243
- Reference: 'http://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
1244
- Enabled: true
1245
- # Autocorrect here will change to a method that may cause crashes depending
1246
- # on the value of the argument.
1247
- AutoCorrect: false
1248
-
1249
- Security/MarshalLoad:
1250
- Description: >-
1251
- Avoid using of `Marshal.load` or `Marshal.restore` due to potential
1252
- security issues. See reference for more information.
1253
- Reference: 'http://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
1254
- Enabled: true
1255
-
1256
- Security/YAMLLoad:
1257
- Description: >-
1258
- Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
1259
- security issues. See reference for more information.
1260
- Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
1261
- Enabled: true
1262
-
1263
- #################### Style ###############################
1264
-
1265
- Style/Alias:
1266
- Description: 'Use alias instead of alias_method.'
1267
- StyleGuide: '#alias-method'
1268
- Enabled: true
1269
-
1270
- Style/AndOr:
1271
- Description: 'Use &&/|| instead of and/or.'
1272
- StyleGuide: '#no-and-or-or'
1273
- Enabled: true
1274
-
1275
- Style/ArrayJoin:
1276
- Description: 'Use Array#join instead of Array#*.'
1277
- StyleGuide: '#array-join'
1278
- Enabled: true
1279
-
1280
- Style/AsciiComments:
1281
- Description: 'Use only ascii symbols in comments.'
1282
- StyleGuide: '#english-comments'
1283
- Enabled: true
1284
-
1285
- Style/Attr:
1286
- Description: 'Checks for uses of Module#attr.'
1287
- StyleGuide: '#attr'
1288
- Enabled: true
1289
-
1290
- Style/BarePercentLiterals:
1291
- Description: 'Checks if usage of %() or %Q() matches configuration.'
1292
- StyleGuide: '#percent-q-shorthand'
1293
- Enabled: true
1294
-
1295
- Style/BeginBlock:
1296
- Description: 'Avoid the use of BEGIN blocks.'
1297
- StyleGuide: '#no-BEGIN-blocks'
1298
- Enabled: true
1299
-
1300
- Style/BlockComments:
1301
- Description: 'Do not use block comments.'
1302
- StyleGuide: '#no-block-comments'
1303
- Enabled: true
1304
-
1305
- Style/BlockDelimiters:
1306
- Description: >-
1307
- Avoid using {...} for multi-line blocks (multiline chaining is
1308
- always ugly).
1309
- Prefer {...} over do...end for single-line blocks.
1310
- StyleGuide: '#single-line-blocks'
1311
- Enabled: true
1312
-
1313
- Style/BracesAroundHashParameters:
1314
- Description: 'Enforce braces style around hash parameters.'
1315
- Enabled: true
1316
-
1317
- Style/CaseEquality:
1318
- Description: 'Avoid explicit use of the case equality operator(===).'
1319
- StyleGuide: '#no-case-equality'
1320
- Enabled: true
1321
-
1322
- Style/CharacterLiteral:
1323
- Description: 'Checks for uses of character literals.'
1324
- StyleGuide: '#no-character-literals'
1325
- Enabled: true
1326
-
1327
- Style/ClassAndModuleChildren:
1328
- Description: 'Checks style of children classes and modules.'
1329
- StyleGuide: '#namespace-definition'
1330
- # Moving from compact to nested children requires knowledge of whether the
1331
- # outer parent is a module or a class. Moving from nested to compact requires
1332
- # verification that the outer parent is defined elsewhere. Rubocop does not
1333
- # have the knowledge to perform either operation safely and thus requires
1334
- # manual oversight.
1335
- AutoCorrect: false
1336
- Enabled: true
1337
-
1338
- Style/ClassCheck:
1339
- Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
1340
- Enabled: true
1341
-
1342
- Style/ClassMethods:
1343
- Description: 'Use self when defining module/class methods.'
1344
- StyleGuide: '#def-self-class-methods'
1345
- Enabled: true
1346
-
1347
- Style/ClassVars:
1348
- Description: 'Avoid the use of class variables.'
1349
- StyleGuide: '#no-class-vars'
1350
- Enabled: true
1351
-
1352
- Style/ColonMethodCall:
1353
- Description: 'Do not use :: for method call.'
1354
- StyleGuide: '#double-colons'
1355
- Enabled: true
1356
-
1357
- Style/ColonMethodDefinition:
1358
- Description: 'Do not use :: for defining class methods.'
1359
- StyleGuide: '#colon-method-definition'
1360
- Enabled: true
1361
-
1362
- Style/CommandLiteral:
1363
- Description: 'Use `` or %x around command literals.'
1364
- StyleGuide: '#percent-x'
1365
- Enabled: true
1366
-
1367
- Style/CommentAnnotation:
1368
- Description: >-
1369
- Checks formatting of special comments
1370
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
1371
- StyleGuide: '#annotate-keywords'
1372
- Enabled: true
1373
-
1374
- Style/CommentedKeyword:
1375
- Description: 'Do not place comments on the same line as certain keywords.'
1376
- Enabled: true
1377
-
1378
- Style/ConditionalAssignment:
1379
- Description: >-
1380
- Use the return value of `if` and `case` statements for
1381
- assignment to a variable and variable comparison instead
1382
- of assigning that variable inside of each branch.
1383
- Enabled: true
1384
-
1385
- Style/DateTime:
1386
- Description: 'Use Date or Time over DateTime.'
1387
- StyleGuide: '#date--time'
1388
- Enabled: true
1389
-
1390
- Style/DefWithParentheses:
1391
- Description: 'Use def with parentheses when there are arguments.'
1392
- StyleGuide: '#method-parens'
1393
- Enabled: true
1394
-
1395
- Style/Dir:
1396
- Description: >-
1397
- Use the `__dir__` method to retrieve the canonicalized
1398
- absolute path to the current file.
1399
- Enabled: true
1400
-
1401
- Style/Documentation:
1402
- Description: 'Document classes and non-namespace modules.'
1403
- Enabled: true
1404
- Exclude:
1405
- - 'spec/**/*'
1406
- - 'test/**/*'
1407
-
1408
- Style/DoubleNegation:
1409
- Description: 'Checks for uses of double negation (!!).'
1410
- StyleGuide: '#no-bang-bang'
1411
- Enabled: true
1412
-
1413
- Style/EachForSimpleLoop:
1414
- Description: >-
1415
- Use `Integer#times` for a simple loop which iterates a fixed
1416
- number of times.
1417
- Enabled: true
1418
-
1419
- Style/EachWithObject:
1420
- Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
1421
- Enabled: true
1422
-
1423
- Style/EmptyBlockParameter:
1424
- Description: 'Omit pipes for empty block parameters.'
1425
- Enabled: true
1426
-
1427
- Style/EmptyCaseCondition:
1428
- Description: 'Avoid empty condition in case statements.'
1429
- Enabled: true
1430
-
1431
- Style/EmptyElse:
1432
- Description: 'Avoid empty else-clauses.'
1433
- Enabled: true
1434
-
1435
- Style/EmptyLambdaParameter:
1436
- Description: 'Omit parens for empty lambda parameters.'
1437
- Enabled: true
1438
-
1439
- Style/EmptyLiteral:
1440
- Description: 'Prefer literals to Array.new/Hash.new/String.new.'
1441
- StyleGuide: '#literal-array-hash'
1442
- Enabled: true
1443
-
1444
- Style/EmptyMethod:
1445
- Description: 'Checks the formatting of empty method definitions.'
1446
- StyleGuide: '#no-single-line-methods'
1447
- Enabled: true
1448
-
1449
- Style/Encoding:
1450
- Description: 'Use UTF-8 as the source file encoding.'
1451
- StyleGuide: '#utf-8'
1452
- Enabled: true
1453
-
1454
- Style/EndBlock:
1455
- Description: 'Avoid the use of END blocks.'
1456
- StyleGuide: '#no-END-blocks'
1457
- Enabled: true
1458
-
1459
- Style/EvalWithLocation:
1460
- Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
1461
- Enabled: true
1462
-
1463
- Style/EvenOdd:
1464
- Description: 'Favor the use of Integer#even? && Integer#odd?'
1465
- StyleGuide: '#predicate-methods'
1466
- Enabled: true
1467
-
1468
- Style/FlipFlop:
1469
- Description: 'Checks for flip flops'
1470
- StyleGuide: '#no-flip-flops'
1471
- Enabled: true
1472
-
1473
- Style/For:
1474
- Description: 'Checks use of for or each in multiline loops.'
1475
- StyleGuide: '#no-for-loops'
1476
- Enabled: true
1477
-
1478
- Style/FormatString:
1479
- Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
1480
- StyleGuide: '#sprintf'
1481
- Enabled: true
1482
-
1483
- Style/FormatStringToken:
1484
- Description: 'Use a consistent style for format string tokens.'
1485
- Enabled: true
1486
-
1487
- Style/FrozenStringLiteralComment:
1488
- Description: >-
1489
- Add the frozen_string_literal comment to the top of files
1490
- to help transition from Ruby 2.3.0 to Ruby 3.0.
1491
- Enabled: true
1492
-
1493
- Style/GlobalVars:
1494
- Description: 'Do not introduce global variables.'
1495
- StyleGuide: '#instance-vars'
1496
- Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
1497
- Enabled: true
1498
-
1499
- Style/GuardClause:
1500
- Description: 'Check for conditionals that can be replaced with guard clauses'
1501
- StyleGuide: '#no-nested-conditionals'
1502
- Enabled: true
1503
-
1504
- Style/HashSyntax:
1505
- Description: >-
1506
- Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
1507
- { :a => 1, :b => 2 }.
1508
- StyleGuide: '#hash-literals'
1509
- Enabled: true
1510
-
1511
- Style/IdenticalConditionalBranches:
1512
- Description: >-
1513
- Checks that conditional statements do not have an identical
1514
- line at the end of each branch, which can validly be moved
1515
- out of the conditional.
1516
- Enabled: true
1517
-
1518
- Style/IfInsideElse:
1519
- Description: 'Finds if nodes inside else, which can be converted to elsif.'
1520
- Enabled: true
1521
-
1522
- Style/IfUnlessModifier:
1523
- Description: >-
1524
- Favor modifier if/unless usage when you have a
1525
- single-line body.
1526
- StyleGuide: '#if-as-a-modifier'
1527
- Enabled: true
1528
-
1529
- Style/IfUnlessModifierOfIfUnless:
1530
- Description: >-
1531
- Avoid modifier if/unless usage on conditionals.
1532
- Enabled: true
1533
-
1534
- Style/IfWithSemicolon:
1535
- Description: 'Do not use if x; .... Use the ternary operator instead.'
1536
- StyleGuide: '#no-semicolon-ifs'
1537
- Enabled: true
1538
-
1539
- Style/InfiniteLoop:
1540
- Description: 'Use Kernel#loop for infinite loops.'
1541
- StyleGuide: '#infinite-loop'
1542
- Enabled: true
1543
-
1544
- Style/InverseMethods:
1545
- Description: >-
1546
- Use the inverse method instead of `!.method`
1547
- if an inverse method is defined.
1548
- Enabled: true
1549
-
1550
- Style/Lambda:
1551
- Description: 'Use the new lambda literal syntax for single-line blocks.'
1552
- StyleGuide: '#lambda-multi-line'
1553
- Enabled: true
1554
-
1555
- Style/LambdaCall:
1556
- Description: 'Use lambda.call(...) instead of lambda.(...).'
1557
- StyleGuide: '#proc-call'
1558
- Enabled: true
1559
-
1560
- Style/LineEndConcatenation:
1561
- Description: >-
1562
- Use \ instead of + or << to concatenate two string literals at
1563
- line end.
1564
- Enabled: true
1565
-
1566
- Style/MethodCallWithoutArgsParentheses:
1567
- Description: 'Do not use parentheses for method calls with no arguments.'
1568
- StyleGuide: '#method-invocation-parens'
1569
- Enabled: true
1570
-
1571
- Style/MethodDefParentheses:
1572
- Description: >-
1573
- Checks if the method definitions have or don't have
1574
- parentheses.
1575
- StyleGuide: '#method-parens'
1576
- Enabled: true
1577
-
1578
- Style/MethodMissing:
1579
- Description: 'Avoid using `method_missing`.'
1580
- StyleGuide: '#no-method-missing'
1581
- Enabled: true
1582
-
1583
- Style/MinMax:
1584
- Description: >-
1585
- Use `Enumerable#minmax` instead of `Enumerable#min`
1586
- and `Enumerable#max` in conjunction.'
1587
- Enabled: true
1588
-
1589
- Style/MixinGrouping:
1590
- Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
1591
- StyleGuide: '#mixin-grouping'
1592
- Enabled: true
1593
-
1594
- Style/MixinUsage:
1595
- Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
1596
- Enabled: true
1597
-
1598
- Style/ModuleFunction:
1599
- Description: 'Checks for usage of `extend self` in modules.'
1600
- StyleGuide: '#module-function'
1601
- Enabled: true
1602
-
1603
- Style/MultilineBlockChain:
1604
- Description: 'Avoid multi-line chains of blocks.'
1605
- StyleGuide: '#single-line-blocks'
1606
- Enabled: true
1607
-
1608
- Style/MultilineIfModifier:
1609
- Description: 'Only use if/unless modifiers on single line statements.'
1610
- StyleGuide: '#no-multiline-if-modifiers'
1611
- Enabled: true
1612
-
1613
- Style/MultilineIfThen:
1614
- Description: 'Do not use then for multi-line if/unless.'
1615
- StyleGuide: '#no-then'
1616
- Enabled: true
1617
-
1618
- Style/MultilineMemoization:
1619
- Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
1620
- Enabled: true
1621
-
1622
- Style/MultilineTernaryOperator:
1623
- Description: >-
1624
- Avoid multi-line ?: (the ternary operator);
1625
- use if/unless instead.
1626
- StyleGuide: '#no-multiline-ternary'
1627
- Enabled: true
1628
-
1629
- Style/MultipleComparison:
1630
- Description: >-
1631
- Avoid comparing a variable with multiple items in a conditional,
1632
- use Array#include? instead.
1633
- Enabled: true
1634
-
1635
- Style/MutableConstant:
1636
- Description: 'Do not assign mutable objects to constants.'
1637
- Enabled: true
1638
-
1639
- Style/NegatedIf:
1640
- Description: >-
1641
- Favor unless over if for negative conditions
1642
- (or control flow or).
1643
- StyleGuide: '#unless-for-negatives'
1644
- Enabled: true
1645
-
1646
- Style/NegatedWhile:
1647
- Description: 'Favor until over while for negative conditions.'
1648
- StyleGuide: '#until-for-negatives'
1649
- Enabled: true
1650
-
1651
- Style/NestedModifier:
1652
- Description: 'Avoid using nested modifiers.'
1653
- StyleGuide: '#no-nested-modifiers'
1654
- Enabled: true
1655
-
1656
- Style/NestedParenthesizedCalls:
1657
- Description: >-
1658
- Parenthesize method calls which are nested inside the
1659
- argument list of another parenthesized method call.
1660
- Enabled: true
1661
-
1662
- Style/NestedTernaryOperator:
1663
- Description: 'Use one expression per branch in a ternary operator.'
1664
- StyleGuide: '#no-nested-ternary'
1665
- Enabled: true
1666
-
1667
- Style/Next:
1668
- Description: 'Use `next` to skip iteration instead of a condition at the end.'
1669
- StyleGuide: '#no-nested-conditionals'
1670
- Enabled: true
1671
-
1672
- Style/NilComparison:
1673
- Description: 'Prefer x.nil? to x == nil.'
1674
- StyleGuide: '#predicate-methods'
1675
- Enabled: true
1676
-
1677
- Style/NonNilCheck:
1678
- Description: 'Checks for redundant nil checks.'
1679
- StyleGuide: '#no-non-nil-checks'
1680
- Enabled: true
1681
-
1682
- Style/Not:
1683
- Description: 'Use ! instead of not.'
1684
- StyleGuide: '#bang-not-not'
1685
- Enabled: true
1686
-
1687
- Style/NumericLiteralPrefix:
1688
- Description: 'Use smallcase prefixes for numeric literals.'
1689
- StyleGuide: '#numeric-literal-prefixes'
1690
- Enabled: true
1691
-
1692
- Style/NumericLiterals:
1693
- Description: >-
1694
- Add underscores to large numeric literals to improve their
1695
- readability.
1696
- StyleGuide: '#underscores-in-numerics'
1697
- Enabled: true
1698
-
1699
- Style/NumericPredicate:
1700
- Description: >-
1701
- Checks for the use of predicate- or comparison methods for
1702
- numeric comparisons.
1703
- StyleGuide: '#predicate-methods'
1704
- # This will change to a new method call which isn't guaranteed to be on the
1705
- # object. Switching these methods has to be done with knowledge of the types
1706
- # of the variables which rubocop doesn't have.
1707
- AutoCorrect: false
1708
- Enabled: true
1709
-
1710
- Style/OneLineConditional:
1711
- Description: >-
1712
- Favor the ternary operator(?:) over
1713
- if/then/else/end constructs.
1714
- StyleGuide: '#ternary-operator'
1715
- Enabled: true
1716
-
1717
- Style/OptionalArguments:
1718
- Description: >-
1719
- Checks for optional arguments that do not appear at the end
1720
- of the argument list
1721
- StyleGuide: '#optional-arguments'
1722
- Enabled: true
1723
-
1724
- Style/OrAssignment:
1725
- Description: 'Recommend usage of double pipe equals (||=) where applicable.'
1726
- StyleGuide: '#double-pipe-for-uninit'
1727
- Enabled: true
1728
-
1729
- Style/ParallelAssignment:
1730
- Description: >-
1731
- Check for simple usages of parallel assignment.
1732
- It will only warn when the number of variables
1733
- matches on both sides of the assignment.
1734
- StyleGuide: '#parallel-assignment'
1735
- Enabled: true
1736
-
1737
- Style/ParenthesesAroundCondition:
1738
- Description: >-
1739
- Don't use parentheses around the condition of an
1740
- if/unless/while.
1741
- StyleGuide: '#no-parens-around-condition'
1742
- Enabled: true
1743
-
1744
- Style/PercentLiteralDelimiters:
1745
- Description: 'Use `%`-literal delimiters consistently'
1746
- StyleGuide: '#percent-literal-braces'
1747
- Enabled: true
1748
-
1749
- Style/PercentQLiterals:
1750
- Description: 'Checks if uses of %Q/%q match the configured preference.'
1751
- Enabled: true
1752
-
1753
- Style/PerlBackrefs:
1754
- Description: 'Avoid Perl-style regex back references.'
1755
- StyleGuide: '#no-perl-regexp-last-matchers'
1756
- Enabled: true
1757
-
1758
- Style/PreferredHashMethods:
1759
- Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
1760
- StyleGuide: '#hash-key'
1761
- Enabled: true
1762
-
1763
- Style/Proc:
1764
- Description: 'Use proc instead of Proc.new.'
1765
- StyleGuide: '#proc'
1766
- Enabled: true
1767
-
1768
- Style/RaiseArgs:
1769
- Description: 'Checks the arguments passed to raise/fail.'
1770
- StyleGuide: '#exception-class-messages'
1771
- Enabled: true
1772
-
1773
- Style/RandomWithOffset:
1774
- Description: >-
1775
- Prefer to use ranges when generating random numbers instead of
1776
- integers with offsets.
1777
- StyleGuide: '#random-numbers'
1778
- Enabled: true
1779
-
1780
- Style/RedundantBegin:
1781
- Description: "Don't use begin blocks when they are not needed."
1782
- StyleGuide: '#begin-implicit'
1783
- Enabled: true
1784
-
1785
- Style/RedundantConditional:
1786
- Description: "Don't return true/false from a conditional."
1787
- Enabled: true
1788
-
1789
- Style/RedundantException:
1790
- Description: "Checks for an obsolete RuntimeException argument in raise/fail."
1791
- StyleGuide: '#no-explicit-runtimeerror'
1792
- Enabled: true
1793
-
1794
- Style/RedundantFreeze:
1795
- Description: "Checks usages of Object#freeze on immutable objects."
1796
- Enabled: true
1797
-
1798
- Style/RedundantParentheses:
1799
- Description: "Checks for parentheses that seem not to serve any purpose."
1800
- Enabled: true
1801
-
1802
- Style/RedundantReturn:
1803
- Description: "Don't use return where it's not required."
1804
- StyleGuide: '#no-explicit-return'
1805
- Enabled: true
1806
-
1807
- Style/RedundantSelf:
1808
- Description: "Don't use self where it's not needed."
1809
- StyleGuide: '#no-self-unless-required'
1810
- Enabled: true
1811
-
1812
- Style/RegexpLiteral:
1813
- Description: 'Use / or %r around regular expressions.'
1814
- StyleGuide: '#percent-r'
1815
- Enabled: true
1816
-
1817
- Style/RescueModifier:
1818
- Description: 'Avoid using rescue in its modifier form.'
1819
- StyleGuide: '#no-rescue-modifiers'
1820
- Enabled: true
1821
-
1822
- Style/RescueStandardError:
1823
- Description: 'Avoid rescuing without specifying an error class.'
1824
- Enabled: true
1825
-
1826
- Style/SafeNavigation:
1827
- Description: >-
1828
- This cop transforms usages of a method call safeguarded by
1829
- a check for the existence of the object to
1830
- safe navigation (`&.`).
1831
- Enabled: true
1832
-
1833
- Style/SelfAssignment:
1834
- Description: >-
1835
- Checks for places where self-assignment shorthand should have
1836
- been used.
1837
- StyleGuide: '#self-assignment'
1838
- Enabled: true
1839
-
1840
- Style/Semicolon:
1841
- Description: "Don't use semicolons to terminate expressions."
1842
- StyleGuide: '#no-semicolon'
1843
- Enabled: true
1844
-
1845
- Style/SignalException:
1846
- Description: 'Checks for proper usage of fail and raise.'
1847
- StyleGuide: '#prefer-raise-over-fail'
1848
- Enabled: true
1849
-
1850
- Style/SingleLineMethods:
1851
- Description: 'Avoid single-line methods.'
1852
- StyleGuide: '#no-single-line-methods'
1853
- Enabled: true
1854
-
1855
- Style/SpecialGlobalVars:
1856
- Description: 'Avoid Perl-style global variables.'
1857
- StyleGuide: '#no-cryptic-perlisms'
1858
- Enabled: true
1859
-
1860
- Style/StabbyLambdaParentheses:
1861
- Description: 'Check for the usage of parentheses around stabby lambda arguments.'
1862
- StyleGuide: '#stabby-lambda-with-args'
1863
- Enabled: true
1864
-
1865
- Style/StderrPuts:
1866
- Description: 'Use `warn` instead of `$stderr.puts`.'
1867
- StyleGuide: '#warn'
1868
- Enabled: true
1869
-
1870
- Style/StringLiterals:
1871
- Description: 'Checks if uses of quotes match the configured preference.'
1872
- StyleGuide: '#consistent-string-literals'
1873
- Enabled: true
1874
-
1875
- Style/StringLiteralsInInterpolation:
1876
- Description: >-
1877
- Checks if uses of quotes inside expressions in interpolated
1878
- strings match the configured preference.
1879
- Enabled: true
1880
-
1881
- Style/StructInheritance:
1882
- Description: 'Checks for inheritance from Struct.new.'
1883
- StyleGuide: '#no-extend-struct-new'
1884
- Enabled: true
1885
-
1886
- Style/SymbolArray:
1887
- Description: 'Use %i or %I for arrays of symbols.'
1888
- StyleGuide: '#percent-i'
1889
- Enabled: true
1890
-
1891
- Style/SymbolLiteral:
1892
- Description: 'Use plain symbols instead of string symbols when possible.'
1893
- Enabled: true
1894
-
1895
- Style/SymbolProc:
1896
- Description: 'Use symbols as procs instead of blocks when possible.'
1897
- Enabled: true
1898
-
1899
- Style/TernaryParentheses:
1900
- Description: 'Checks for use of parentheses around ternary conditions.'
1901
- Enabled: true
1902
-
1903
- Style/TrailingBodyOnMethodDefinition:
1904
- Description: 'Method body goes below definition.'
1905
- Enabled: true
1906
-
1907
- Style/TrailingCommaInArguments:
1908
- Description: 'Checks for trailing comma in argument lists.'
1909
- StyleGuide: '#no-trailing-params-comma'
1910
- Enabled: true
1911
-
1912
- Style/TrailingCommaInLiteral:
1913
- Description: 'Checks for trailing comma in array and hash literals.'
1914
- StyleGuide: '#no-trailing-array-commas'
1915
- Enabled: true
1916
-
1917
- Style/TrailingMethodEndStatement:
1918
- Description: 'Checks for trailing end statement on line of method body.'
1919
- Enabled: true
1920
-
1921
- Style/TrailingUnderscoreVariable:
1922
- Description: >-
1923
- Checks for the usage of unneeded trailing underscores at the
1924
- end of parallel variable assignment.
1925
- AllowNamedUnderscoreVariables: true
1926
- Enabled: true
1927
-
1928
- Style/TrivialAccessors:
1929
- Description: 'Prefer attr_* methods to trivial readers/writers.'
1930
- StyleGuide: '#attr_family'
1931
- Enabled: true
1932
-
1933
- Style/UnlessElse:
1934
- Description: >-
1935
- Do not use unless with else. Rewrite these with the positive
1936
- case first.
1937
- StyleGuide: '#no-else-with-unless'
1938
- Enabled: true
1939
-
1940
- Style/UnneededCapitalW:
1941
- Description: 'Checks for %W when interpolation is not needed.'
1942
- Enabled: true
1943
-
1944
- Style/UnneededInterpolation:
1945
- Description: 'Checks for strings that are just an interpolated expression.'
1946
- Enabled: true
1947
-
1948
- Style/UnneededPercentQ:
1949
- Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
1950
- StyleGuide: '#percent-q'
1951
- Enabled: true
1952
-
1953
- Style/VariableInterpolation:
1954
- Description: >-
1955
- Don't interpolate global, instance and class variables
1956
- directly in strings.
1957
- StyleGuide: '#curlies-interpolate'
1958
- Enabled: true
1959
-
1960
- Style/WhenThen:
1961
- Description: 'Use when x then ... for one-line cases.'
1962
- StyleGuide: '#one-line-cases'
1963
- Enabled: true
1964
-
1965
- Style/WhileUntilDo:
1966
- Description: 'Checks for redundant do after while or until.'
1967
- StyleGuide: '#no-multiline-while-do'
1968
- Enabled: true
1969
-
1970
- Style/WhileUntilModifier:
1971
- Description: >-
1972
- Favor modifier while/until usage when you have a
1973
- single-line body.
1974
- StyleGuide: '#while-as-a-modifier'
1975
- Enabled: true
1976
-
1977
- Style/WordArray:
1978
- Description: 'Use %w or %W for arrays of words.'
1979
- StyleGuide: '#percent-w'
1980
- Enabled: true
1981
-
1982
- Style/YodaCondition:
1983
- Description: 'Do not use literals as the first operand of a comparison.'
1984
- Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
1985
- Enabled: true
1986
-
1987
- Style/ZeroLengthPredicate:
1988
- Description: 'Use #empty? when testing for objects of length 0.'
1989
- Enabled: true