rubocop 0.42.0 → 0.52.1

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