rubocop 0.51.0 → 0.52.0

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