rubocop 0.49.1 → 0.52.0

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