rubbycop 0.49.0

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