rubocop 0.75.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (602) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +217 -0
  4. data/assets/logo.png +0 -0
  5. data/assets/output.html.erb +261 -0
  6. data/bin/console +10 -0
  7. data/bin/setup +7 -0
  8. data/config/default.yml +3939 -0
  9. data/exe/rubocop +17 -0
  10. data/lib/rubocop.rb +608 -0
  11. data/lib/rubocop/ast/builder.rb +81 -0
  12. data/lib/rubocop/ast/node.rb +640 -0
  13. data/lib/rubocop/ast/node/alias_node.rb +24 -0
  14. data/lib/rubocop/ast/node/and_node.rb +29 -0
  15. data/lib/rubocop/ast/node/args_node.rb +29 -0
  16. data/lib/rubocop/ast/node/array_node.rb +57 -0
  17. data/lib/rubocop/ast/node/block_node.rb +115 -0
  18. data/lib/rubocop/ast/node/break_node.rb +17 -0
  19. data/lib/rubocop/ast/node/case_node.rb +56 -0
  20. data/lib/rubocop/ast/node/class_node.rb +31 -0
  21. data/lib/rubocop/ast/node/def_node.rb +71 -0
  22. data/lib/rubocop/ast/node/defined_node.rb +17 -0
  23. data/lib/rubocop/ast/node/ensure_node.rb +17 -0
  24. data/lib/rubocop/ast/node/float_node.rb +12 -0
  25. data/lib/rubocop/ast/node/for_node.rb +53 -0
  26. data/lib/rubocop/ast/node/hash_node.rb +109 -0
  27. data/lib/rubocop/ast/node/if_node.rb +175 -0
  28. data/lib/rubocop/ast/node/int_node.rb +12 -0
  29. data/lib/rubocop/ast/node/keyword_splat_node.rb +45 -0
  30. data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +16 -0
  31. data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +43 -0
  32. data/lib/rubocop/ast/node/mixin/collection_node.rb +15 -0
  33. data/lib/rubocop/ast/node/mixin/conditional_node.rb +45 -0
  34. data/lib/rubocop/ast/node/mixin/hash_element_node.rb +125 -0
  35. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +261 -0
  36. data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +114 -0
  37. data/lib/rubocop/ast/node/mixin/modifier_node.rb +17 -0
  38. data/lib/rubocop/ast/node/mixin/numeric_node.rb +21 -0
  39. data/lib/rubocop/ast/node/mixin/parameterized_node.rb +61 -0
  40. data/lib/rubocop/ast/node/mixin/predicate_operator_node.rb +35 -0
  41. data/lib/rubocop/ast/node/module_node.rb +24 -0
  42. data/lib/rubocop/ast/node/or_node.rb +29 -0
  43. data/lib/rubocop/ast/node/pair_node.rb +63 -0
  44. data/lib/rubocop/ast/node/range_node.rb +18 -0
  45. data/lib/rubocop/ast/node/regexp_node.rb +35 -0
  46. data/lib/rubocop/ast/node/resbody_node.rb +24 -0
  47. data/lib/rubocop/ast/node/retry_node.rb +17 -0
  48. data/lib/rubocop/ast/node/self_class_node.rb +24 -0
  49. data/lib/rubocop/ast/node/send_node.rb +13 -0
  50. data/lib/rubocop/ast/node/str_node.rb +16 -0
  51. data/lib/rubocop/ast/node/super_node.rb +21 -0
  52. data/lib/rubocop/ast/node/symbol_node.rb +12 -0
  53. data/lib/rubocop/ast/node/until_node.rb +35 -0
  54. data/lib/rubocop/ast/node/when_node.rb +53 -0
  55. data/lib/rubocop/ast/node/while_node.rb +35 -0
  56. data/lib/rubocop/ast/node/yield_node.rb +21 -0
  57. data/lib/rubocop/ast/sexp.rb +16 -0
  58. data/lib/rubocop/ast/traversal.rb +183 -0
  59. data/lib/rubocop/cached_data.rb +58 -0
  60. data/lib/rubocop/cli.rb +343 -0
  61. data/lib/rubocop/comment_config.rb +201 -0
  62. data/lib/rubocop/config.rb +244 -0
  63. data/lib/rubocop/config_loader.rb +273 -0
  64. data/lib/rubocop/config_loader_resolver.rb +194 -0
  65. data/lib/rubocop/config_obsoletion.rb +213 -0
  66. data/lib/rubocop/config_store.rb +48 -0
  67. data/lib/rubocop/config_validator.rb +239 -0
  68. data/lib/rubocop/cop/autocorrect_logic.rb +103 -0
  69. data/lib/rubocop/cop/badge.rb +73 -0
  70. data/lib/rubocop/cop/bundler/duplicated_gem.rb +73 -0
  71. data/lib/rubocop/cop/bundler/gem_comment.rb +64 -0
  72. data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +69 -0
  73. data/lib/rubocop/cop/bundler/ordered_gems.rb +73 -0
  74. data/lib/rubocop/cop/commissioner.rb +137 -0
  75. data/lib/rubocop/cop/cop.rb +271 -0
  76. data/lib/rubocop/cop/corrector.rb +171 -0
  77. data/lib/rubocop/cop/correctors/alignment_corrector.rb +146 -0
  78. data/lib/rubocop/cop/correctors/condition_corrector.rb +28 -0
  79. data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +53 -0
  80. data/lib/rubocop/cop/correctors/empty_line_corrector.rb +26 -0
  81. data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +73 -0
  82. data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +136 -0
  83. data/lib/rubocop/cop/correctors/line_break_corrector.rb +61 -0
  84. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +68 -0
  85. data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +44 -0
  86. data/lib/rubocop/cop/correctors/parentheses_corrector.rb +31 -0
  87. data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +117 -0
  88. data/lib/rubocop/cop/correctors/punctuation_corrector.rb +29 -0
  89. data/lib/rubocop/cop/correctors/space_corrector.rb +49 -0
  90. data/lib/rubocop/cop/correctors/string_literal_corrector.rb +25 -0
  91. data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +43 -0
  92. data/lib/rubocop/cop/force.rb +42 -0
  93. data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +104 -0
  94. data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +106 -0
  95. data/lib/rubocop/cop/gemspec/required_ruby_version.rb +85 -0
  96. data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +55 -0
  97. data/lib/rubocop/cop/generator.rb +223 -0
  98. data/lib/rubocop/cop/generator/configuration_injector.rb +66 -0
  99. data/lib/rubocop/cop/generator/require_file_injector.rb +78 -0
  100. data/lib/rubocop/cop/ignored_node.rb +38 -0
  101. data/lib/rubocop/cop/internal_affairs.rb +8 -0
  102. data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +44 -0
  103. data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +44 -0
  104. data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +54 -0
  105. data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +48 -0
  106. data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +73 -0
  107. data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +52 -0
  108. data/lib/rubocop/cop/layout/access_modifier_indentation.rb +98 -0
  109. data/lib/rubocop/cop/layout/align_arguments.rb +93 -0
  110. data/lib/rubocop/cop/layout/align_array.rb +39 -0
  111. data/lib/rubocop/cop/layout/align_hash.rb +358 -0
  112. data/lib/rubocop/cop/layout/align_parameters.rb +118 -0
  113. data/lib/rubocop/cop/layout/block_alignment.rb +244 -0
  114. data/lib/rubocop/cop/layout/block_end_newline.rb +62 -0
  115. data/lib/rubocop/cop/layout/case_indentation.rb +161 -0
  116. data/lib/rubocop/cop/layout/class_structure.rb +340 -0
  117. data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +126 -0
  118. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +203 -0
  119. data/lib/rubocop/cop/layout/comment_indentation.rb +144 -0
  120. data/lib/rubocop/cop/layout/condition_position.rb +56 -0
  121. data/lib/rubocop/cop/layout/def_end_alignment.rb +74 -0
  122. data/lib/rubocop/cop/layout/dot_position.rb +105 -0
  123. data/lib/rubocop/cop/layout/else_alignment.rb +134 -0
  124. data/lib/rubocop/cop/layout/empty_comment.rb +160 -0
  125. data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +157 -0
  126. data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +64 -0
  127. data/lib/rubocop/cop/layout/empty_line_between_defs.rb +151 -0
  128. data/lib/rubocop/cop/layout/empty_lines.rb +76 -0
  129. data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +215 -0
  130. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +99 -0
  131. data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +45 -0
  132. data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +41 -0
  133. data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +88 -0
  134. data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +136 -0
  135. data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +45 -0
  136. data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +62 -0
  137. data/lib/rubocop/cop/layout/end_alignment.rb +189 -0
  138. data/lib/rubocop/cop/layout/end_of_line.rb +87 -0
  139. data/lib/rubocop/cop/layout/extra_spacing.rb +201 -0
  140. data/lib/rubocop/cop/layout/first_array_element_line_break.rb +45 -0
  141. data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +37 -0
  142. data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +55 -0
  143. data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +46 -0
  144. data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +289 -0
  145. data/lib/rubocop/cop/layout/indent_assignment.rb +55 -0
  146. data/lib/rubocop/cop/layout/indent_first_argument.rb +247 -0
  147. data/lib/rubocop/cop/layout/indent_first_array_element.rb +167 -0
  148. data/lib/rubocop/cop/layout/indent_first_hash_element.rb +184 -0
  149. data/lib/rubocop/cop/layout/indent_first_parameter.rb +100 -0
  150. data/lib/rubocop/cop/layout/indent_heredoc.rb +256 -0
  151. data/lib/rubocop/cop/layout/indentation_consistency.rb +202 -0
  152. data/lib/rubocop/cop/layout/indentation_width.rb +364 -0
  153. data/lib/rubocop/cop/layout/initial_indentation.rb +59 -0
  154. data/lib/rubocop/cop/layout/leading_blank_lines.rb +53 -0
  155. data/lib/rubocop/cop/layout/leading_comment_space.rb +88 -0
  156. data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +118 -0
  157. data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +39 -0
  158. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +95 -0
  159. data/lib/rubocop/cop/layout/multiline_block_layout.rb +146 -0
  160. data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +122 -0
  161. data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +50 -0
  162. data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +54 -0
  163. data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +134 -0
  164. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +220 -0
  165. data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +131 -0
  166. data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +114 -0
  167. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +189 -0
  168. data/lib/rubocop/cop/layout/space_after_colon.rb +47 -0
  169. data/lib/rubocop/cop/layout/space_after_comma.rb +35 -0
  170. data/lib/rubocop/cop/layout/space_after_method_name.rb +42 -0
  171. data/lib/rubocop/cop/layout/space_after_not.rb +40 -0
  172. data/lib/rubocop/cop/layout/space_after_semicolon.rb +32 -0
  173. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +169 -0
  174. data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +92 -0
  175. data/lib/rubocop/cop/layout/space_around_keyword.rb +232 -0
  176. data/lib/rubocop/cop/layout/space_around_operators.rb +182 -0
  177. data/lib/rubocop/cop/layout/space_before_block_braces.rb +119 -0
  178. data/lib/rubocop/cop/layout/space_before_comma.rb +31 -0
  179. data/lib/rubocop/cop/layout/space_before_comment.rb +35 -0
  180. data/lib/rubocop/cop/layout/space_before_first_arg.rb +67 -0
  181. data/lib/rubocop/cop/layout/space_before_semicolon.rb +27 -0
  182. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +80 -0
  183. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +228 -0
  184. data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +53 -0
  185. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +248 -0
  186. data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +207 -0
  187. data/lib/rubocop/cop/layout/space_inside_parens.rb +113 -0
  188. data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +65 -0
  189. data/lib/rubocop/cop/layout/space_inside_range_literal.rb +63 -0
  190. data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +150 -0
  191. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +65 -0
  192. data/lib/rubocop/cop/layout/tab.rb +75 -0
  193. data/lib/rubocop/cop/layout/trailing_blank_lines.rb +113 -0
  194. data/lib/rubocop/cop/layout/trailing_whitespace.rb +61 -0
  195. data/lib/rubocop/cop/lint/ambiguous_block_association.rb +62 -0
  196. data/lib/rubocop/cop/lint/ambiguous_operator.rb +55 -0
  197. data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +43 -0
  198. data/lib/rubocop/cop/lint/assignment_in_condition.rb +97 -0
  199. data/lib/rubocop/cop/lint/big_decimal_new.rb +44 -0
  200. data/lib/rubocop/cop/lint/boolean_symbol.rb +38 -0
  201. data/lib/rubocop/cop/lint/circular_argument_reference.rb +72 -0
  202. data/lib/rubocop/cop/lint/debugger.rb +77 -0
  203. data/lib/rubocop/cop/lint/deprecated_class_methods.rb +111 -0
  204. data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +81 -0
  205. data/lib/rubocop/cop/lint/duplicate_case_condition.rb +53 -0
  206. data/lib/rubocop/cop/lint/duplicate_methods.rb +239 -0
  207. data/lib/rubocop/cop/lint/duplicated_key.rb +38 -0
  208. data/lib/rubocop/cop/lint/each_with_object_argument.rb +42 -0
  209. data/lib/rubocop/cop/lint/else_layout.rb +66 -0
  210. data/lib/rubocop/cop/lint/empty_ensure.rb +60 -0
  211. data/lib/rubocop/cop/lint/empty_expression.rb +42 -0
  212. data/lib/rubocop/cop/lint/empty_interpolation.rb +36 -0
  213. data/lib/rubocop/cop/lint/empty_when.rb +38 -0
  214. data/lib/rubocop/cop/lint/end_in_method.rb +40 -0
  215. data/lib/rubocop/cop/lint/ensure_return.rb +46 -0
  216. data/lib/rubocop/cop/lint/erb_new_arguments.rb +163 -0
  217. data/lib/rubocop/cop/lint/flip_flop.rb +32 -0
  218. data/lib/rubocop/cop/lint/float_out_of_range.rb +35 -0
  219. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +159 -0
  220. data/lib/rubocop/cop/lint/handle_exceptions.rb +95 -0
  221. data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +156 -0
  222. data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +101 -0
  223. data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +127 -0
  224. data/lib/rubocop/cop/lint/inherit_exception.rb +100 -0
  225. data/lib/rubocop/cop/lint/interpolation_check.rb +40 -0
  226. data/lib/rubocop/cop/lint/literal_as_condition.rb +138 -0
  227. data/lib/rubocop/cop/lint/literal_in_interpolation.rb +98 -0
  228. data/lib/rubocop/cop/lint/loop.rb +63 -0
  229. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +84 -0
  230. data/lib/rubocop/cop/lint/multiple_compare.rb +48 -0
  231. data/lib/rubocop/cop/lint/nested_method_definition.rb +104 -0
  232. data/lib/rubocop/cop/lint/nested_percent_literal.rb +51 -0
  233. data/lib/rubocop/cop/lint/next_without_accumulator.rb +50 -0
  234. data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +83 -0
  235. data/lib/rubocop/cop/lint/number_conversion.rb +81 -0
  236. data/lib/rubocop/cop/lint/ordered_magic_comments.rb +86 -0
  237. data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +64 -0
  238. data/lib/rubocop/cop/lint/percent_string_array.rb +73 -0
  239. data/lib/rubocop/cop/lint/percent_symbol_array.rb +69 -0
  240. data/lib/rubocop/cop/lint/rand_one.rb +45 -0
  241. data/lib/rubocop/cop/lint/redundant_with_index.rb +82 -0
  242. data/lib/rubocop/cop/lint/redundant_with_object.rb +83 -0
  243. data/lib/rubocop/cop/lint/regexp_as_condition.rb +29 -0
  244. data/lib/rubocop/cop/lint/require_parentheses.rb +66 -0
  245. data/lib/rubocop/cop/lint/rescue_exception.rb +46 -0
  246. data/lib/rubocop/cop/lint/rescue_type.rb +94 -0
  247. data/lib/rubocop/cop/lint/return_in_void_context.rb +74 -0
  248. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +66 -0
  249. data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +94 -0
  250. data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +38 -0
  251. data/lib/rubocop/cop/lint/script_permission.rb +70 -0
  252. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +91 -0
  253. data/lib/rubocop/cop/lint/shadowed_argument.rb +182 -0
  254. data/lib/rubocop/cop/lint/shadowed_exception.rb +178 -0
  255. data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +53 -0
  256. data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +59 -0
  257. data/lib/rubocop/cop/lint/syntax.rb +59 -0
  258. data/lib/rubocop/cop/lint/to_json.rb +41 -0
  259. data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +82 -0
  260. data/lib/rubocop/cop/lint/unified_integer.rb +45 -0
  261. data/lib/rubocop/cop/lint/unneeded_cop_disable_directive.rb +263 -0
  262. data/lib/rubocop/cop/lint/unneeded_cop_enable_directive.rb +116 -0
  263. data/lib/rubocop/cop/lint/unneeded_require_statement.rb +50 -0
  264. data/lib/rubocop/cop/lint/unneeded_splat_expansion.rb +172 -0
  265. data/lib/rubocop/cop/lint/unreachable_code.rb +99 -0
  266. data/lib/rubocop/cop/lint/unused_block_argument.rb +165 -0
  267. data/lib/rubocop/cop/lint/unused_method_argument.rb +86 -0
  268. data/lib/rubocop/cop/lint/uri_escape_unescape.rb +76 -0
  269. data/lib/rubocop/cop/lint/uri_regexp.rb +73 -0
  270. data/lib/rubocop/cop/lint/useless_access_modifier.rb +240 -0
  271. data/lib/rubocop/cop/lint/useless_assignment.rb +129 -0
  272. data/lib/rubocop/cop/lint/useless_comparison.rb +28 -0
  273. data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +49 -0
  274. data/lib/rubocop/cop/lint/useless_setter_call.rb +164 -0
  275. data/lib/rubocop/cop/lint/void.rb +151 -0
  276. data/lib/rubocop/cop/message_annotator.rb +129 -0
  277. data/lib/rubocop/cop/metrics/abc_size.rb +24 -0
  278. data/lib/rubocop/cop/metrics/block_length.rb +50 -0
  279. data/lib/rubocop/cop/metrics/block_nesting.rb +65 -0
  280. data/lib/rubocop/cop/metrics/class_length.rb +36 -0
  281. data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +32 -0
  282. data/lib/rubocop/cop/metrics/line_length.rb +321 -0
  283. data/lib/rubocop/cop/metrics/method_length.rb +36 -0
  284. data/lib/rubocop/cop/metrics/module_length.rb +36 -0
  285. data/lib/rubocop/cop/metrics/parameter_lists.rb +54 -0
  286. data/lib/rubocop/cop/metrics/perceived_complexity.rb +61 -0
  287. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +67 -0
  288. data/lib/rubocop/cop/migration/department_name.rb +44 -0
  289. data/lib/rubocop/cop/mixin/alignment.rb +74 -0
  290. data/lib/rubocop/cop/mixin/annotation_comment.rb +37 -0
  291. data/lib/rubocop/cop/mixin/array_min_size.rb +59 -0
  292. data/lib/rubocop/cop/mixin/array_syntax.rb +17 -0
  293. data/lib/rubocop/cop/mixin/check_assignment.rb +44 -0
  294. data/lib/rubocop/cop/mixin/check_line_breakable.rb +190 -0
  295. data/lib/rubocop/cop/mixin/classish_length.rb +37 -0
  296. data/lib/rubocop/cop/mixin/code_length.rb +38 -0
  297. data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +98 -0
  298. data/lib/rubocop/cop/mixin/configurable_formatting.rb +47 -0
  299. data/lib/rubocop/cop/mixin/configurable_max.rb +23 -0
  300. data/lib/rubocop/cop/mixin/configurable_naming.rb +16 -0
  301. data/lib/rubocop/cop/mixin/configurable_numbering.rb +17 -0
  302. data/lib/rubocop/cop/mixin/def_node.rb +33 -0
  303. data/lib/rubocop/cop/mixin/documentation_comment.rb +52 -0
  304. data/lib/rubocop/cop/mixin/duplication.rb +46 -0
  305. data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +172 -0
  306. data/lib/rubocop/cop/mixin/empty_parameter.rb +24 -0
  307. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +67 -0
  308. data/lib/rubocop/cop/mixin/enforce_superclass.rb +30 -0
  309. data/lib/rubocop/cop/mixin/first_element_line_break.rb +46 -0
  310. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +53 -0
  311. data/lib/rubocop/cop/mixin/hash_alignment.rb +147 -0
  312. data/lib/rubocop/cop/mixin/heredoc.rb +32 -0
  313. data/lib/rubocop/cop/mixin/ignored_methods.rb +19 -0
  314. data/lib/rubocop/cop/mixin/ignored_pattern.rb +29 -0
  315. data/lib/rubocop/cop/mixin/integer_node.rb +14 -0
  316. data/lib/rubocop/cop/mixin/interpolation.rb +27 -0
  317. data/lib/rubocop/cop/mixin/match_range.rb +26 -0
  318. data/lib/rubocop/cop/mixin/method_complexity.rb +56 -0
  319. data/lib/rubocop/cop/mixin/method_preference.rb +31 -0
  320. data/lib/rubocop/cop/mixin/min_body_length.rb +21 -0
  321. data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +86 -0
  322. data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +33 -0
  323. data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +255 -0
  324. data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +141 -0
  325. data/lib/rubocop/cop/mixin/negative_conditional.rb +32 -0
  326. data/lib/rubocop/cop/mixin/nil_methods.rb +25 -0
  327. data/lib/rubocop/cop/mixin/on_normal_if_unless.rb +14 -0
  328. data/lib/rubocop/cop/mixin/ordered_gem_node.rb +56 -0
  329. data/lib/rubocop/cop/mixin/parentheses.rb +17 -0
  330. data/lib/rubocop/cop/mixin/parser_diagnostic.rb +37 -0
  331. data/lib/rubocop/cop/mixin/percent_array.rb +52 -0
  332. data/lib/rubocop/cop/mixin/percent_literal.rb +38 -0
  333. data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +181 -0
  334. data/lib/rubocop/cop/mixin/preferred_delimiters.rb +53 -0
  335. data/lib/rubocop/cop/mixin/range_help.rb +117 -0
  336. data/lib/rubocop/cop/mixin/rescue_node.rb +22 -0
  337. data/lib/rubocop/cop/mixin/safe_assignment.rb +23 -0
  338. data/lib/rubocop/cop/mixin/safe_mode.rb +24 -0
  339. data/lib/rubocop/cop/mixin/space_after_punctuation.rb +55 -0
  340. data/lib/rubocop/cop/mixin/space_before_punctuation.rb +49 -0
  341. data/lib/rubocop/cop/mixin/statement_modifier.rb +68 -0
  342. data/lib/rubocop/cop/mixin/string_help.rb +35 -0
  343. data/lib/rubocop/cop/mixin/string_literals_help.rb +23 -0
  344. data/lib/rubocop/cop/mixin/surrounding_space.rb +146 -0
  345. data/lib/rubocop/cop/mixin/target_ruby_version.rb +16 -0
  346. data/lib/rubocop/cop/mixin/too_many_lines.rb +35 -0
  347. data/lib/rubocop/cop/mixin/trailing_body.rb +26 -0
  348. data/lib/rubocop/cop/mixin/trailing_comma.rb +216 -0
  349. data/lib/rubocop/cop/mixin/uncommunicative_name.rb +111 -0
  350. data/lib/rubocop/cop/mixin/unused_argument.rb +33 -0
  351. data/lib/rubocop/cop/naming/accessor_method_name.rb +55 -0
  352. data/lib/rubocop/cop/naming/ascii_identifiers.rb +72 -0
  353. data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +43 -0
  354. data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +33 -0
  355. data/lib/rubocop/cop/naming/constant_name.rb +81 -0
  356. data/lib/rubocop/cop/naming/file_name.rb +205 -0
  357. data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +62 -0
  358. data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +55 -0
  359. data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +171 -0
  360. data/lib/rubocop/cop/naming/method_name.rb +53 -0
  361. data/lib/rubocop/cop/naming/predicate_name.rb +108 -0
  362. data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +112 -0
  363. data/lib/rubocop/cop/naming/uncommunicative_block_param_name.rb +49 -0
  364. data/lib/rubocop/cop/naming/uncommunicative_method_param_name.rb +58 -0
  365. data/lib/rubocop/cop/naming/variable_name.rb +52 -0
  366. data/lib/rubocop/cop/naming/variable_number.rb +61 -0
  367. data/lib/rubocop/cop/offense.rb +205 -0
  368. data/lib/rubocop/cop/registry.rb +211 -0
  369. data/lib/rubocop/cop/security/eval.rb +31 -0
  370. data/lib/rubocop/cop/security/json_load.rb +46 -0
  371. data/lib/rubocop/cop/security/marshal_load.rb +39 -0
  372. data/lib/rubocop/cop/security/open.rb +71 -0
  373. data/lib/rubocop/cop/security/yaml_load.rb +37 -0
  374. data/lib/rubocop/cop/severity.rb +77 -0
  375. data/lib/rubocop/cop/style/access_modifier_declarations.rb +112 -0
  376. data/lib/rubocop/cop/style/alias.rb +147 -0
  377. data/lib/rubocop/cop/style/and_or.rb +146 -0
  378. data/lib/rubocop/cop/style/array_join.rb +39 -0
  379. data/lib/rubocop/cop/style/ascii_comments.rb +61 -0
  380. data/lib/rubocop/cop/style/attr.rb +62 -0
  381. data/lib/rubocop/cop/style/auto_resource_cleanup.rb +51 -0
  382. data/lib/rubocop/cop/style/bare_percent_literals.rb +78 -0
  383. data/lib/rubocop/cop/style/begin_block.rb +22 -0
  384. data/lib/rubocop/cop/style/block_comments.rb +70 -0
  385. data/lib/rubocop/cop/style/block_delimiters.rb +331 -0
  386. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +209 -0
  387. data/lib/rubocop/cop/style/case_equality.rb +30 -0
  388. data/lib/rubocop/cop/style/character_literal.rb +53 -0
  389. data/lib/rubocop/cop/style/class_and_module_children.rb +151 -0
  390. data/lib/rubocop/cop/style/class_check.rb +59 -0
  391. data/lib/rubocop/cop/style/class_methods.rb +60 -0
  392. data/lib/rubocop/cop/style/class_vars.rb +48 -0
  393. data/lib/rubocop/cop/style/collection_methods.rb +77 -0
  394. data/lib/rubocop/cop/style/colon_method_call.rb +48 -0
  395. data/lib/rubocop/cop/style/colon_method_definition.rb +37 -0
  396. data/lib/rubocop/cop/style/command_literal.rb +187 -0
  397. data/lib/rubocop/cop/style/comment_annotation.rb +97 -0
  398. data/lib/rubocop/cop/style/commented_keyword.rb +73 -0
  399. data/lib/rubocop/cop/style/conditional_assignment.rb +668 -0
  400. data/lib/rubocop/cop/style/constant_visibility.rb +77 -0
  401. data/lib/rubocop/cop/style/copyright.rb +95 -0
  402. data/lib/rubocop/cop/style/date_time.rb +77 -0
  403. data/lib/rubocop/cop/style/def_with_parentheses.rb +57 -0
  404. data/lib/rubocop/cop/style/dir.rb +48 -0
  405. data/lib/rubocop/cop/style/documentation.rb +97 -0
  406. data/lib/rubocop/cop/style/documentation_method.rb +125 -0
  407. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +55 -0
  408. data/lib/rubocop/cop/style/double_negation.rb +35 -0
  409. data/lib/rubocop/cop/style/each_for_simple_loop.rb +58 -0
  410. data/lib/rubocop/cop/style/each_with_object.rb +110 -0
  411. data/lib/rubocop/cop/style/empty_block_parameter.rb +48 -0
  412. data/lib/rubocop/cop/style/empty_case_condition.rb +107 -0
  413. data/lib/rubocop/cop/style/empty_else.rb +175 -0
  414. data/lib/rubocop/cop/style/empty_lambda_parameter.rb +45 -0
  415. data/lib/rubocop/cop/style/empty_literal.rb +123 -0
  416. data/lib/rubocop/cop/style/empty_method.rb +115 -0
  417. data/lib/rubocop/cop/style/encoding.rb +56 -0
  418. data/lib/rubocop/cop/style/end_block.rb +25 -0
  419. data/lib/rubocop/cop/style/eval_with_location.rb +148 -0
  420. data/lib/rubocop/cop/style/even_odd.rb +58 -0
  421. data/lib/rubocop/cop/style/expand_path_arguments.rb +194 -0
  422. data/lib/rubocop/cop/style/float_division.rb +94 -0
  423. data/lib/rubocop/cop/style/for.rb +88 -0
  424. data/lib/rubocop/cop/style/format_string.rb +124 -0
  425. data/lib/rubocop/cop/style/format_string_token.rb +119 -0
  426. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +149 -0
  427. data/lib/rubocop/cop/style/global_vars.rb +80 -0
  428. data/lib/rubocop/cop/style/guard_clause.rb +121 -0
  429. data/lib/rubocop/cop/style/hash_syntax.rb +214 -0
  430. data/lib/rubocop/cop/style/identical_conditional_branches.rb +130 -0
  431. data/lib/rubocop/cop/style/if_inside_else.rb +87 -0
  432. data/lib/rubocop/cop/style/if_unless_modifier.rb +127 -0
  433. data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +39 -0
  434. data/lib/rubocop/cop/style/if_with_semicolon.rb +30 -0
  435. data/lib/rubocop/cop/style/implicit_runtime_error.rb +32 -0
  436. data/lib/rubocop/cop/style/infinite_loop.rb +127 -0
  437. data/lib/rubocop/cop/style/inline_comment.rb +34 -0
  438. data/lib/rubocop/cop/style/inverse_methods.rb +187 -0
  439. data/lib/rubocop/cop/style/ip_addresses.rb +76 -0
  440. data/lib/rubocop/cop/style/lambda.rb +131 -0
  441. data/lib/rubocop/cop/style/lambda_call.rb +93 -0
  442. data/lib/rubocop/cop/style/line_end_concatenation.rb +121 -0
  443. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +388 -0
  444. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +77 -0
  445. data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +46 -0
  446. data/lib/rubocop/cop/style/method_def_parentheses.rb +158 -0
  447. data/lib/rubocop/cop/style/method_missing_super.rb +34 -0
  448. data/lib/rubocop/cop/style/min_max.rb +68 -0
  449. data/lib/rubocop/cop/style/missing_else.rb +180 -0
  450. data/lib/rubocop/cop/style/missing_respond_to_missing.rb +46 -0
  451. data/lib/rubocop/cop/style/mixin_grouping.rb +148 -0
  452. data/lib/rubocop/cop/style/mixin_usage.rb +90 -0
  453. data/lib/rubocop/cop/style/module_function.rb +104 -0
  454. data/lib/rubocop/cop/style/multiline_block_chain.rb +40 -0
  455. data/lib/rubocop/cop/style/multiline_if_modifier.rb +67 -0
  456. data/lib/rubocop/cop/style/multiline_if_then.rb +50 -0
  457. data/lib/rubocop/cop/style/multiline_memoization.rb +94 -0
  458. data/lib/rubocop/cop/style/multiline_method_signature.rb +61 -0
  459. data/lib/rubocop/cop/style/multiline_ternary_operator.rb +38 -0
  460. data/lib/rubocop/cop/style/multiline_when_then.rb +55 -0
  461. data/lib/rubocop/cop/style/multiple_comparison.rb +92 -0
  462. data/lib/rubocop/cop/style/mutable_constant.rb +174 -0
  463. data/lib/rubocop/cop/style/negated_if.rb +99 -0
  464. data/lib/rubocop/cop/style/negated_unless.rb +89 -0
  465. data/lib/rubocop/cop/style/negated_while.rb +48 -0
  466. data/lib/rubocop/cop/style/nested_modifier.rb +105 -0
  467. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +67 -0
  468. data/lib/rubocop/cop/style/nested_ternary_operator.rb +32 -0
  469. data/lib/rubocop/cop/style/next.rb +244 -0
  470. data/lib/rubocop/cop/style/nil_comparison.rb +75 -0
  471. data/lib/rubocop/cop/style/non_nil_check.rb +124 -0
  472. data/lib/rubocop/cop/style/not.rb +82 -0
  473. data/lib/rubocop/cop/style/numeric_literal_prefix.rb +124 -0
  474. data/lib/rubocop/cop/style/numeric_literals.rb +110 -0
  475. data/lib/rubocop/cop/style/numeric_predicate.rb +137 -0
  476. data/lib/rubocop/cop/style/one_line_conditional.rb +101 -0
  477. data/lib/rubocop/cop/style/option_hash.rb +55 -0
  478. data/lib/rubocop/cop/style/optional_arguments.rb +58 -0
  479. data/lib/rubocop/cop/style/or_assignment.rb +95 -0
  480. data/lib/rubocop/cop/style/parallel_assignment.rb +287 -0
  481. data/lib/rubocop/cop/style/parentheses_around_condition.rb +117 -0
  482. data/lib/rubocop/cop/style/percent_literal_delimiters.rb +127 -0
  483. data/lib/rubocop/cop/style/percent_q_literals.rb +73 -0
  484. data/lib/rubocop/cop/style/perl_backrefs.rb +38 -0
  485. data/lib/rubocop/cop/style/preferred_hash_methods.rb +75 -0
  486. data/lib/rubocop/cop/style/proc.rb +34 -0
  487. data/lib/rubocop/cop/style/raise_args.rb +145 -0
  488. data/lib/rubocop/cop/style/random_with_offset.rb +158 -0
  489. data/lib/rubocop/cop/style/redundant_begin.rb +91 -0
  490. data/lib/rubocop/cop/style/redundant_conditional.rb +97 -0
  491. data/lib/rubocop/cop/style/redundant_exception.rb +60 -0
  492. data/lib/rubocop/cop/style/redundant_freeze.rb +67 -0
  493. data/lib/rubocop/cop/style/redundant_parentheses.rb +231 -0
  494. data/lib/rubocop/cop/style/redundant_return.rb +173 -0
  495. data/lib/rubocop/cop/style/redundant_self.rb +171 -0
  496. data/lib/rubocop/cop/style/redundant_sort_by.rb +50 -0
  497. data/lib/rubocop/cop/style/regexp_literal.rb +228 -0
  498. data/lib/rubocop/cop/style/rescue_modifier.rb +73 -0
  499. data/lib/rubocop/cop/style/rescue_standard_error.rb +124 -0
  500. data/lib/rubocop/cop/style/return_nil.rb +89 -0
  501. data/lib/rubocop/cop/style/safe_navigation.rb +272 -0
  502. data/lib/rubocop/cop/style/sample.rb +144 -0
  503. data/lib/rubocop/cop/style/self_assignment.rb +97 -0
  504. data/lib/rubocop/cop/style/semicolon.rb +101 -0
  505. data/lib/rubocop/cop/style/send.rb +31 -0
  506. data/lib/rubocop/cop/style/signal_exception.rb +211 -0
  507. data/lib/rubocop/cop/style/single_line_block_params.rb +95 -0
  508. data/lib/rubocop/cop/style/single_line_methods.rb +83 -0
  509. data/lib/rubocop/cop/style/special_global_vars.rb +213 -0
  510. data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +86 -0
  511. data/lib/rubocop/cop/style/stderr_puts.rb +61 -0
  512. data/lib/rubocop/cop/style/string_hash_keys.rb +50 -0
  513. data/lib/rubocop/cop/style/string_literals.rb +129 -0
  514. data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +49 -0
  515. data/lib/rubocop/cop/style/string_methods.rb +46 -0
  516. data/lib/rubocop/cop/style/strip.rb +46 -0
  517. data/lib/rubocop/cop/style/struct_inheritance.rb +39 -0
  518. data/lib/rubocop/cop/style/symbol_array.rb +119 -0
  519. data/lib/rubocop/cop/style/symbol_literal.rb +32 -0
  520. data/lib/rubocop/cop/style/symbol_proc.rb +110 -0
  521. data/lib/rubocop/cop/style/ternary_parentheses.rb +223 -0
  522. data/lib/rubocop/cop/style/trailing_body_on_class.rb +43 -0
  523. data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +54 -0
  524. data/lib/rubocop/cop/style/trailing_body_on_module.rb +43 -0
  525. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +96 -0
  526. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +58 -0
  527. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +56 -0
  528. data/lib/rubocop/cop/style/trailing_method_end_statement.rb +91 -0
  529. data/lib/rubocop/cop/style/trailing_underscore_variable.rb +161 -0
  530. data/lib/rubocop/cop/style/trivial_accessors.rb +191 -0
  531. data/lib/rubocop/cop/style/unless_else.rb +55 -0
  532. data/lib/rubocop/cop/style/unneeded_capital_w.rb +51 -0
  533. data/lib/rubocop/cop/style/unneeded_condition.rb +112 -0
  534. data/lib/rubocop/cop/style/unneeded_interpolation.rb +98 -0
  535. data/lib/rubocop/cop/style/unneeded_percent_q.rb +112 -0
  536. data/lib/rubocop/cop/style/unneeded_sort.rb +165 -0
  537. data/lib/rubocop/cop/style/unpack_first.rb +65 -0
  538. data/lib/rubocop/cop/style/variable_interpolation.rb +48 -0
  539. data/lib/rubocop/cop/style/when_then.rb +37 -0
  540. data/lib/rubocop/cop/style/while_until_do.rb +59 -0
  541. data/lib/rubocop/cop/style/while_until_modifier.rb +61 -0
  542. data/lib/rubocop/cop/style/word_array.rb +102 -0
  543. data/lib/rubocop/cop/style/yoda_condition.rb +141 -0
  544. data/lib/rubocop/cop/style/zero_length_predicate.rb +117 -0
  545. data/lib/rubocop/cop/team.rb +191 -0
  546. data/lib/rubocop/cop/util.rb +127 -0
  547. data/lib/rubocop/cop/utils/format_string.rb +128 -0
  548. data/lib/rubocop/cop/variable_force.rb +464 -0
  549. data/lib/rubocop/cop/variable_force/assignment.rb +96 -0
  550. data/lib/rubocop/cop/variable_force/branch.rb +322 -0
  551. data/lib/rubocop/cop/variable_force/branchable.rb +23 -0
  552. data/lib/rubocop/cop/variable_force/reference.rb +49 -0
  553. data/lib/rubocop/cop/variable_force/scope.rb +109 -0
  554. data/lib/rubocop/cop/variable_force/variable.rb +117 -0
  555. data/lib/rubocop/cop/variable_force/variable_table.rb +129 -0
  556. data/lib/rubocop/core_ext/string.rb +23 -0
  557. data/lib/rubocop/error.rb +34 -0
  558. data/lib/rubocop/file_finder.rb +42 -0
  559. data/lib/rubocop/formatter/auto_gen_config_formatter.rb +16 -0
  560. data/lib/rubocop/formatter/base_formatter.rb +123 -0
  561. data/lib/rubocop/formatter/clang_style_formatter.rb +59 -0
  562. data/lib/rubocop/formatter/colorizable.rb +41 -0
  563. data/lib/rubocop/formatter/disabled_config_formatter.rb +224 -0
  564. data/lib/rubocop/formatter/disabled_lines_formatter.rb +57 -0
  565. data/lib/rubocop/formatter/emacs_style_formatter.rb +37 -0
  566. data/lib/rubocop/formatter/file_list_formatter.rb +20 -0
  567. data/lib/rubocop/formatter/formatter_set.rb +106 -0
  568. data/lib/rubocop/formatter/fuubar_style_formatter.rb +80 -0
  569. data/lib/rubocop/formatter/html_formatter.rb +141 -0
  570. data/lib/rubocop/formatter/json_formatter.rb +80 -0
  571. data/lib/rubocop/formatter/offense_count_formatter.rb +74 -0
  572. data/lib/rubocop/formatter/pacman_formatter.rb +80 -0
  573. data/lib/rubocop/formatter/progress_formatter.rb +63 -0
  574. data/lib/rubocop/formatter/quiet_formatter.rb +13 -0
  575. data/lib/rubocop/formatter/simple_text_formatter.rb +138 -0
  576. data/lib/rubocop/formatter/tap_formatter.rb +84 -0
  577. data/lib/rubocop/formatter/text_util.rb +20 -0
  578. data/lib/rubocop/formatter/worst_offenders_formatter.rb +62 -0
  579. data/lib/rubocop/magic_comment.rb +214 -0
  580. data/lib/rubocop/name_similarity.rb +21 -0
  581. data/lib/rubocop/node_pattern.rb +799 -0
  582. data/lib/rubocop/options.rb +454 -0
  583. data/lib/rubocop/path_util.rb +85 -0
  584. data/lib/rubocop/platform.rb +11 -0
  585. data/lib/rubocop/processed_source.rb +216 -0
  586. data/lib/rubocop/rake_task.rb +79 -0
  587. data/lib/rubocop/remote_config.rb +106 -0
  588. data/lib/rubocop/result_cache.rb +191 -0
  589. data/lib/rubocop/rspec/cop_helper.rb +94 -0
  590. data/lib/rubocop/rspec/expect_offense.rb +240 -0
  591. data/lib/rubocop/rspec/host_environment_simulation_helper.rb +28 -0
  592. data/lib/rubocop/rspec/shared_contexts.rb +90 -0
  593. data/lib/rubocop/rspec/support.rb +13 -0
  594. data/lib/rubocop/runner.rb +358 -0
  595. data/lib/rubocop/string_interpreter.rb +57 -0
  596. data/lib/rubocop/string_util.rb +14 -0
  597. data/lib/rubocop/target_finder.rb +190 -0
  598. data/lib/rubocop/token.rb +114 -0
  599. data/lib/rubocop/version.rb +21 -0
  600. data/lib/rubocop/warning.rb +11 -0
  601. data/lib/rubocop/yaml_duplication_checker.rb +39 -0
  602. metadata +770 -0
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'pry'
6
+ require 'rubocop'
7
+
8
+ ARGV.clear
9
+
10
+ RuboCop.pry
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ IFS=$'\n\t'
5
+ set -vx
6
+
7
+ bundle install
@@ -0,0 +1,3939 @@
1
+ # Common configuration.
2
+
3
+ AllCops:
4
+ RubyInterpreters:
5
+ - ruby
6
+ - macruby
7
+ - rake
8
+ - jruby
9
+ - rbx
10
+ # Include common Ruby source files.
11
+ Include:
12
+ - '**/*.rb'
13
+ - '**/*.arb'
14
+ - '**/*.axlsx'
15
+ - '**/*.builder'
16
+ - '**/*.fcgi'
17
+ - '**/*.gemfile'
18
+ - '**/*.gemspec'
19
+ - '**/*.god'
20
+ - '**/*.jb'
21
+ - '**/*.jbuilder'
22
+ - '**/*.mspec'
23
+ - '**/*.opal'
24
+ - '**/*.pluginspec'
25
+ - '**/*.podspec'
26
+ - '**/*.rabl'
27
+ - '**/*.rake'
28
+ - '**/*.rbuild'
29
+ - '**/*.rbw'
30
+ - '**/*.rbx'
31
+ - '**/*.ru'
32
+ - '**/*.ruby'
33
+ - '**/*.spec'
34
+ - '**/*.thor'
35
+ - '**/*.watchr'
36
+ - '**/.irbrc'
37
+ - '**/.pryrc'
38
+ - '**/buildfile'
39
+ - '**/Appraisals'
40
+ - '**/Berksfile'
41
+ - '**/Brewfile'
42
+ - '**/Buildfile'
43
+ - '**/Capfile'
44
+ - '**/Cheffile'
45
+ - '**/Dangerfile'
46
+ - '**/Deliverfile'
47
+ - '**/Fastfile'
48
+ - '**/*Fastfile'
49
+ - '**/Gemfile'
50
+ - '**/Guardfile'
51
+ - '**/Jarfile'
52
+ - '**/Mavenfile'
53
+ - '**/Podfile'
54
+ - '**/Puppetfile'
55
+ - '**/Rakefile'
56
+ - '**/Snapfile'
57
+ - '**/Thorfile'
58
+ - '**/Vagabondfile'
59
+ - '**/Vagrantfile'
60
+ Exclude:
61
+ - 'node_modules/**/*'
62
+ - 'vendor/**/*'
63
+ - '.git/**/*'
64
+ # Default formatter will be used if no `-f/--format` option is given.
65
+ DefaultFormatter: progress
66
+ # Cop names are displayed in offense messages by default. Change behavior
67
+ # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
68
+ # option.
69
+ DisplayCopNames: true
70
+ # Style guide URLs are not displayed in offense messages by default. Change
71
+ # behavior by overriding `DisplayStyleGuide`, or by giving the
72
+ # `-S/--display-style-guide` option.
73
+ DisplayStyleGuide: false
74
+ # When specifying style guide URLs, any paths and/or fragments will be
75
+ # evaluated relative to the base URL.
76
+ StyleGuideBaseURL: https://rubystyle.guide
77
+ # Extra details are not displayed in offense messages by default. Change
78
+ # behavior by overriding ExtraDetails, or by giving the
79
+ # `-E/--extra-details` option.
80
+ ExtraDetails: false
81
+ # Additional cops that do not reference a style guide rule may be enabled by
82
+ # default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving
83
+ # the `--only-guide-cops` option.
84
+ StyleGuideCopsOnly: false
85
+ # All cops except the ones configured `Enabled: false` in this file are enabled by default.
86
+ # Change this behavior by overriding either `DisabledByDefault` or `EnabledByDefault`.
87
+ # When `DisabledByDefault` is `true`, all cops in the default configuration
88
+ # are disabled, and only cops in user configuration are enabled. This makes
89
+ # cops opt-in instead of opt-out. Note that when `DisabledByDefault` is `true`,
90
+ # cops in user configuration will be enabled even if they don't set the
91
+ # Enabled parameter.
92
+ # When `EnabledByDefault` is `true`, all cops, even those configured `Enabled: false`
93
+ # in this file are enabled by default. Cops can still be disabled in user configuration.
94
+ # Note that it is invalid to set both EnabledByDefault and DisabledByDefault
95
+ # to true in the same configuration.
96
+ EnabledByDefault: false
97
+ DisabledByDefault: false
98
+ # Enables the result cache if `true`. Can be overridden by the `--cache` command
99
+ # line option.
100
+ UseCache: true
101
+ # Threshold for how many files can be stored in the result cache before some
102
+ # of the files are automatically removed.
103
+ MaxFilesInCache: 20000
104
+ # The cache will be stored in "rubocop_cache" under this directory. If
105
+ # CacheRootDirectory is ~ (nil), which it is by default, the root will be
106
+ # taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
107
+ # `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
108
+ CacheRootDirectory: ~
109
+ # It is possible for a malicious user to know the location of RuboCop's cache
110
+ # directory by looking at CacheRootDirectory, and create a symlink in its
111
+ # place that could cause RuboCop to overwrite unintended files, or read
112
+ # malicious input. If you are certain that your cache location is secure from
113
+ # this kind of attack, and wish to use a symlinked cache location, set this
114
+ # value to "true".
115
+ AllowSymlinksInCacheRootDirectory: false
116
+ # What MRI version of the Ruby interpreter is the inspected code intended to
117
+ # run on? (If there is more than one, set this to the lowest version.)
118
+ # If a value is specified for TargetRubyVersion then it is used. Acceptable
119
+ # values are specificed as a float (i.e. 2.5); the teeny version of Ruby
120
+ # should not be included. If the project specifies a Ruby version in the
121
+ # .ruby-version file, Gemfile or gems.rb file, RuboCop will try to determine
122
+ # the desired version of Ruby by inspecting the .ruby-version file first,
123
+ # followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
124
+ # is specified in the Gemfile or gems.rb file, RuboCop reads the final value
125
+ # from the lock file.) If the Ruby version is still unresolved, RuboCop will
126
+ # use the oldest officially supported Ruby version (currently Ruby 2.3).
127
+ TargetRubyVersion: ~
128
+
129
+ #################### Bundler ###############################
130
+
131
+ Bundler/DuplicatedGem:
132
+ Description: 'Checks for duplicate gem entries in Gemfile.'
133
+ Enabled: true
134
+ VersionAdded: '0.46'
135
+ Include:
136
+ - '**/*.gemfile'
137
+ - '**/Gemfile'
138
+ - '**/gems.rb'
139
+
140
+ Bundler/GemComment:
141
+ Description: 'Add a comment describing each gem.'
142
+ Enabled: false
143
+ VersionAdded: '0.59'
144
+ Include:
145
+ - '**/*.gemfile'
146
+ - '**/Gemfile'
147
+ - '**/gems.rb'
148
+ Whitelist: []
149
+
150
+ Bundler/InsecureProtocolSource:
151
+ Description: >-
152
+ The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
153
+ because HTTP requests are insecure. Please change your source to
154
+ 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
155
+ Enabled: true
156
+ VersionAdded: '0.50'
157
+ Include:
158
+ - '**/*.gemfile'
159
+ - '**/Gemfile'
160
+ - '**/gems.rb'
161
+
162
+ Bundler/OrderedGems:
163
+ Description: >-
164
+ Gems within groups in the Gemfile should be alphabetically sorted.
165
+ Enabled: true
166
+ VersionAdded: '0.46'
167
+ VersionChanged: '0.47'
168
+ TreatCommentsAsGroupSeparators: true
169
+ Include:
170
+ - '**/*.gemfile'
171
+ - '**/Gemfile'
172
+ - '**/gems.rb'
173
+
174
+ #################### Gemspec ###############################
175
+
176
+ Gemspec/DuplicatedAssignment:
177
+ Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
178
+ Enabled: true
179
+ VersionAdded: '0.52'
180
+ Include:
181
+ - '**/*.gemspec'
182
+
183
+ Gemspec/OrderedDependencies:
184
+ Description: >-
185
+ Dependencies in the gemspec should be alphabetically sorted.
186
+ Enabled: true
187
+ VersionAdded: '0.51'
188
+ TreatCommentsAsGroupSeparators: true
189
+ Include:
190
+ - '**/*.gemspec'
191
+
192
+ Gemspec/RequiredRubyVersion:
193
+ Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
194
+ Enabled: true
195
+ VersionAdded: '0.52'
196
+ Include:
197
+ - '**/*.gemspec'
198
+ -
199
+ Gemspec/RubyVersionGlobalsUsage:
200
+ Description: Checks usage of RUBY_VERSION in gemspec.
201
+ Enabled: true
202
+ VersionAdded: '0.72'
203
+ Include:
204
+ - '**/*.gemspec'
205
+
206
+ #################### Layout ###########################
207
+
208
+ Layout/AccessModifierIndentation:
209
+ Description: Check indentation of private/protected visibility modifiers.
210
+ StyleGuide: '#indent-public-private-protected'
211
+ Enabled: true
212
+ VersionAdded: '0.49'
213
+ EnforcedStyle: indent
214
+ SupportedStyles:
215
+ - outdent
216
+ - indent
217
+ # By default, the indentation width from Layout/IndentationWidth is used
218
+ # But it can be overridden by setting this parameter
219
+ IndentationWidth: ~
220
+
221
+ Layout/AlignArguments:
222
+ Description: >-
223
+ Align the arguments of a method call if they span more
224
+ than one line.
225
+ StyleGuide: '#no-double-indent'
226
+ Enabled: true
227
+ VersionAdded: '0.68'
228
+ # Alignment of arguments in multi-line method calls.
229
+ #
230
+ # The `with_first_argument` style aligns the following lines along the same
231
+ # column as the first parameter.
232
+ #
233
+ # method_call(a,
234
+ # b)
235
+ #
236
+ # The `with_fixed_indentation` style aligns the following lines with one
237
+ # level of indentation relative to the start of the line with the method call.
238
+ #
239
+ # method_call(a,
240
+ # b)
241
+ EnforcedStyle: with_first_argument
242
+ SupportedStyles:
243
+ - with_first_argument
244
+ - with_fixed_indentation
245
+ # By default, the indentation width from Layout/IndentationWidth is used
246
+ # But it can be overridden by setting this parameter
247
+ IndentationWidth: ~
248
+
249
+ Layout/AlignArray:
250
+ Description: >-
251
+ Align the elements of an array literal if they span more than
252
+ one line.
253
+ StyleGuide: '#align-multiline-arrays'
254
+ Enabled: true
255
+ VersionAdded: '0.49'
256
+
257
+ Layout/AlignHash:
258
+ Description: >-
259
+ Align the elements of a hash literal if they span more than
260
+ one line.
261
+ Enabled: true
262
+ AllowMultipleStyles: true
263
+ VersionAdded: '0.49'
264
+ # Alignment of entries using hash rocket as separator. Valid values are:
265
+ #
266
+ # key - left alignment of keys
267
+ # 'a' => 2
268
+ # 'bb' => 3
269
+ # separator - alignment of hash rockets, keys are right aligned
270
+ # 'a' => 2
271
+ # 'bb' => 3
272
+ # table - left alignment of keys, hash rockets, and values
273
+ # 'a' => 2
274
+ # 'bb' => 3
275
+ EnforcedHashRocketStyle: key
276
+ SupportedHashRocketStyles:
277
+ - key
278
+ - separator
279
+ - table
280
+ # Alignment of entries using colon as separator. Valid values are:
281
+ #
282
+ # key - left alignment of keys
283
+ # a: 0
284
+ # bb: 1
285
+ # separator - alignment of colons, keys are right aligned
286
+ # a: 0
287
+ # bb: 1
288
+ # table - left alignment of keys and values
289
+ # a: 0
290
+ # bb: 1
291
+ EnforcedColonStyle: key
292
+ SupportedColonStyles:
293
+ - key
294
+ - separator
295
+ - table
296
+ # Select whether hashes that are the last argument in a method call should be
297
+ # inspected? Valid values are:
298
+ #
299
+ # always_inspect - Inspect both implicit and explicit hashes.
300
+ # Registers an offense for:
301
+ # function(a: 1,
302
+ # b: 2)
303
+ # Registers an offense for:
304
+ # function({a: 1,
305
+ # b: 2})
306
+ # always_ignore - Ignore both implicit and explicit hashes.
307
+ # Accepts:
308
+ # function(a: 1,
309
+ # b: 2)
310
+ # Accepts:
311
+ # function({a: 1,
312
+ # b: 2})
313
+ # ignore_implicit - Ignore only implicit hashes.
314
+ # Accepts:
315
+ # function(a: 1,
316
+ # b: 2)
317
+ # Registers an offense for:
318
+ # function({a: 1,
319
+ # b: 2})
320
+ # ignore_explicit - Ignore only explicit hashes.
321
+ # Accepts:
322
+ # function({a: 1,
323
+ # b: 2})
324
+ # Registers an offense for:
325
+ # function(a: 1,
326
+ # b: 2)
327
+ EnforcedLastArgumentHashStyle: always_inspect
328
+ SupportedLastArgumentHashStyles:
329
+ - always_inspect
330
+ - always_ignore
331
+ - ignore_implicit
332
+ - ignore_explicit
333
+
334
+ Layout/AlignParameters:
335
+ Description: >-
336
+ Align the parameters of a method definition if they span more
337
+ than one line.
338
+ StyleGuide: '#no-double-indent'
339
+ Enabled: true
340
+ VersionAdded: '0.49'
341
+ VersionChanged: '0.68'
342
+ # Alignment of parameters in multi-line method calls.
343
+ #
344
+ # The `with_first_parameter` style aligns the following lines along the same
345
+ # column as the first parameter.
346
+ #
347
+ # def method_foo(a,
348
+ # b)
349
+ #
350
+ # The `with_fixed_indentation` style aligns the following lines with one
351
+ # level of indentation relative to the start of the line with the method call.
352
+ #
353
+ # def method_foo(a,
354
+ # b)
355
+ EnforcedStyle: with_first_parameter
356
+ SupportedStyles:
357
+ - with_first_parameter
358
+ - with_fixed_indentation
359
+ # By default, the indentation width from Layout/IndentationWidth is used
360
+ # But it can be overridden by setting this parameter
361
+ IndentationWidth: ~
362
+
363
+ Layout/BlockAlignment:
364
+ Description: 'Align block ends correctly.'
365
+ Enabled: true
366
+ VersionAdded: '0.53'
367
+ # The value `start_of_block` means that the `end` should be aligned with line
368
+ # where the `do` keyword appears.
369
+ # The value `start_of_line` means it should be aligned with the whole
370
+ # expression's starting line.
371
+ # The value `either` means both are allowed.
372
+ EnforcedStyleAlignWith: either
373
+ SupportedStylesAlignWith:
374
+ - either
375
+ - start_of_block
376
+ - start_of_line
377
+
378
+ Layout/BlockEndNewline:
379
+ Description: 'Put end statement of multiline block on its own line.'
380
+ Enabled: true
381
+ VersionAdded: '0.49'
382
+
383
+ Layout/CaseIndentation:
384
+ Description: 'Indentation of when in a case/when/[else/]end.'
385
+ StyleGuide: '#indent-when-to-case'
386
+ Enabled: true
387
+ VersionAdded: '0.49'
388
+ EnforcedStyle: case
389
+ SupportedStyles:
390
+ - case
391
+ - end
392
+ IndentOneStep: false
393
+ # By default, the indentation width from `Layout/IndentationWidth` is used.
394
+ # But it can be overridden by setting this parameter.
395
+ # This only matters if `IndentOneStep` is `true`
396
+ IndentationWidth: ~
397
+
398
+ Layout/ClassStructure:
399
+ Description: 'Enforces a configured order of definitions within a class body.'
400
+ StyleGuide: '#consistent-classes'
401
+ Enabled: false
402
+ VersionAdded: '0.52'
403
+ Categories:
404
+ module_inclusion:
405
+ - include
406
+ - prepend
407
+ - extend
408
+ ExpectedOrder:
409
+ - module_inclusion
410
+ - constants
411
+ - public_class_methods
412
+ - initializer
413
+ - public_methods
414
+ - protected_methods
415
+ - private_methods
416
+
417
+ Layout/ClosingHeredocIndentation:
418
+ Description: 'Checks the indentation of here document closings.'
419
+ Enabled: true
420
+ VersionAdded: '0.57'
421
+
422
+ Layout/ClosingParenthesisIndentation:
423
+ Description: 'Checks the indentation of hanging closing parentheses.'
424
+ Enabled: true
425
+ VersionAdded: '0.49'
426
+
427
+ Layout/CommentIndentation:
428
+ Description: 'Indentation of comments.'
429
+ Enabled: true
430
+ VersionAdded: '0.49'
431
+
432
+ Layout/ConditionPosition:
433
+ Description: >-
434
+ Checks for condition placed in a confusing position relative to
435
+ the keyword.
436
+ StyleGuide: '#same-line-condition'
437
+ Enabled: true
438
+ VersionAdded: '0.53'
439
+
440
+ Layout/DefEndAlignment:
441
+ Description: 'Align ends corresponding to defs correctly.'
442
+ Enabled: true
443
+ VersionAdded: '0.53'
444
+ # The value `def` means that `end` should be aligned with the def keyword.
445
+ # The value `start_of_line` means that `end` should be aligned with method
446
+ # calls like `private`, `public`, etc, if present in front of the `def`
447
+ # keyword on the same line.
448
+ EnforcedStyleAlignWith: start_of_line
449
+ SupportedStylesAlignWith:
450
+ - start_of_line
451
+ - def
452
+ AutoCorrect: false
453
+ Severity: warning
454
+
455
+ Layout/DotPosition:
456
+ Description: 'Checks the position of the dot in multi-line method calls.'
457
+ StyleGuide: '#consistent-multi-line-chains'
458
+ Enabled: true
459
+ VersionAdded: '0.49'
460
+ EnforcedStyle: leading
461
+ SupportedStyles:
462
+ - leading
463
+ - trailing
464
+
465
+ Layout/ElseAlignment:
466
+ Description: 'Align elses and elsifs correctly.'
467
+ Enabled: true
468
+ VersionAdded: '0.49'
469
+
470
+ Layout/EmptyComment:
471
+ Description: 'Checks empty comment.'
472
+ Enabled: true
473
+ VersionAdded: '0.53'
474
+ AllowBorderComment: true
475
+ AllowMarginComment: true
476
+
477
+ Layout/EmptyLineAfterGuardClause:
478
+ Description: 'Add empty line after guard clause.'
479
+ Enabled: true
480
+ VersionAdded: '0.56'
481
+ VersionChanged: '0.59'
482
+
483
+ Layout/EmptyLineAfterMagicComment:
484
+ Description: 'Add an empty line after magic comments to separate them from code.'
485
+ StyleGuide: '#separate-magic-comments-from-code'
486
+ Enabled: true
487
+ VersionAdded: '0.49'
488
+
489
+ Layout/EmptyLineBetweenDefs:
490
+ Description: 'Use empty lines between defs.'
491
+ StyleGuide: '#empty-lines-between-methods'
492
+ Enabled: true
493
+ VersionAdded: '0.49'
494
+ # If `true`, this parameter means that single line method definitions don't
495
+ # need an empty line between them.
496
+ AllowAdjacentOneLineDefs: false
497
+ # Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
498
+ NumberOfEmptyLines: 1
499
+
500
+ Layout/EmptyLines:
501
+ Description: "Don't use several empty lines in a row."
502
+ StyleGuide: '#two-or-more-empty-lines'
503
+ Enabled: true
504
+ VersionAdded: '0.49'
505
+
506
+ Layout/EmptyLinesAroundAccessModifier:
507
+ Description: "Keep blank lines around access modifiers."
508
+ StyleGuide: '#empty-lines-around-access-modifier'
509
+ Enabled: true
510
+ VersionAdded: '0.49'
511
+ EnforcedStyle: around
512
+ SupportedStyles:
513
+ - around
514
+ - only_before
515
+ Reference:
516
+ # A reference to `EnforcedStyle: only_before`.
517
+ - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
518
+
519
+ Layout/EmptyLinesAroundArguments:
520
+ Description: "Keeps track of empty lines around method arguments."
521
+ Enabled: true
522
+ VersionAdded: '0.52'
523
+
524
+ Layout/EmptyLinesAroundBeginBody:
525
+ Description: "Keeps track of empty lines around begin-end bodies."
526
+ StyleGuide: '#empty-lines-around-bodies'
527
+ Enabled: true
528
+ VersionAdded: '0.49'
529
+
530
+ Layout/EmptyLinesAroundBlockBody:
531
+ Description: "Keeps track of empty lines around block bodies."
532
+ StyleGuide: '#empty-lines-around-bodies'
533
+ Enabled: true
534
+ VersionAdded: '0.49'
535
+ EnforcedStyle: no_empty_lines
536
+ SupportedStyles:
537
+ - empty_lines
538
+ - no_empty_lines
539
+
540
+ Layout/EmptyLinesAroundClassBody:
541
+ Description: "Keeps track of empty lines around class bodies."
542
+ StyleGuide: '#empty-lines-around-bodies'
543
+ Enabled: true
544
+ VersionAdded: '0.49'
545
+ VersionChanged: '0.53'
546
+ EnforcedStyle: no_empty_lines
547
+ SupportedStyles:
548
+ - empty_lines
549
+ - empty_lines_except_namespace
550
+ - empty_lines_special
551
+ - no_empty_lines
552
+ - beginning_only
553
+ - ending_only
554
+
555
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
556
+ Description: "Keeps track of empty lines around exception handling keywords."
557
+ StyleGuide: '#empty-lines-around-bodies'
558
+ Enabled: true
559
+ VersionAdded: '0.49'
560
+
561
+ Layout/EmptyLinesAroundMethodBody:
562
+ Description: "Keeps track of empty lines around method bodies."
563
+ StyleGuide: '#empty-lines-around-bodies'
564
+ Enabled: true
565
+ VersionAdded: '0.49'
566
+
567
+ Layout/EmptyLinesAroundModuleBody:
568
+ Description: "Keeps track of empty lines around module bodies."
569
+ StyleGuide: '#empty-lines-around-bodies'
570
+ Enabled: true
571
+ VersionAdded: '0.49'
572
+ EnforcedStyle: no_empty_lines
573
+ SupportedStyles:
574
+ - empty_lines
575
+ - empty_lines_except_namespace
576
+ - empty_lines_special
577
+ - no_empty_lines
578
+
579
+ Layout/EndAlignment:
580
+ Description: 'Align ends correctly.'
581
+ Enabled: true
582
+ VersionAdded: '0.53'
583
+ # The value `keyword` means that `end` should be aligned with the matching
584
+ # keyword (`if`, `while`, etc.).
585
+ # The value `variable` means that in assignments, `end` should be aligned
586
+ # with the start of the variable on the left hand side of `=`. In all other
587
+ # situations, `end` should still be aligned with the keyword.
588
+ # The value `start_of_line` means that `end` should be aligned with the start
589
+ # of the line which the matching keyword appears on.
590
+ EnforcedStyleAlignWith: keyword
591
+ SupportedStylesAlignWith:
592
+ - keyword
593
+ - variable
594
+ - start_of_line
595
+ AutoCorrect: false
596
+ Severity: warning
597
+
598
+ Layout/EndOfLine:
599
+ Description: 'Use Unix-style line endings.'
600
+ StyleGuide: '#crlf'
601
+ Enabled: true
602
+ VersionAdded: '0.49'
603
+ # The `native` style means that CR+LF (Carriage Return + Line Feed) is
604
+ # enforced on Windows, and LF is enforced on other platforms. The other styles
605
+ # mean LF and CR+LF, respectively.
606
+ EnforcedStyle: native
607
+ SupportedStyles:
608
+ - native
609
+ - lf
610
+ - crlf
611
+
612
+ Layout/ExtraSpacing:
613
+ Description: 'Do not use unnecessary spacing.'
614
+ Enabled: true
615
+ VersionAdded: '0.49'
616
+ # When true, allows most uses of extra spacing if the intent is to align
617
+ # things with the previous or next line, not counting empty lines or comment
618
+ # lines.
619
+ AllowForAlignment: true
620
+ # When true, allows things like 'obj.meth(arg) # comment',
621
+ # rather than insisting on 'obj.meth(arg) # comment'.
622
+ # If done for alignment, either this OR AllowForAlignment will allow it.
623
+ AllowBeforeTrailingComments: false
624
+ # When true, forces the alignment of `=` in assignments on consecutive lines.
625
+ ForceEqualSignAlignment: false
626
+
627
+ Layout/FirstArrayElementLineBreak:
628
+ Description: >-
629
+ Checks for a line break before the first element in a
630
+ multi-line array.
631
+ Enabled: false
632
+ VersionAdded: '0.49'
633
+
634
+ Layout/FirstHashElementLineBreak:
635
+ Description: >-
636
+ Checks for a line break before the first element in a
637
+ multi-line hash.
638
+ Enabled: false
639
+ VersionAdded: '0.49'
640
+
641
+ Layout/FirstMethodArgumentLineBreak:
642
+ Description: >-
643
+ Checks for a line break before the first argument in a
644
+ multi-line method call.
645
+ Enabled: false
646
+ VersionAdded: '0.49'
647
+
648
+ Layout/FirstMethodParameterLineBreak:
649
+ Description: >-
650
+ Checks for a line break before the first parameter in a
651
+ multi-line method parameter definition.
652
+ Enabled: false
653
+ VersionAdded: '0.49'
654
+
655
+ Layout/HeredocArgumentClosingParenthesis:
656
+ Description: >-
657
+ Checks for the placement of the closing parenthesis in a
658
+ method call that passes a HEREDOC string as an argument.
659
+ Enabled: false
660
+ StyleGuide: '#heredoc-argument-closing-parentheses'
661
+ VersionAdded: '0.68'
662
+
663
+ Layout/IndentAssignment:
664
+ Description: >-
665
+ Checks the indentation of the first line of the
666
+ right-hand-side of a multi-line assignment.
667
+ Enabled: true
668
+ VersionAdded: '0.49'
669
+ # By default, the indentation width from `Layout/IndentationWidth` is used
670
+ # But it can be overridden by setting this parameter
671
+ IndentationWidth: ~
672
+
673
+ Layout/IndentFirstArgument:
674
+ Description: 'Checks the indentation of the first argument in a method call.'
675
+ Enabled: true
676
+ VersionAdded: '0.68'
677
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
678
+ SupportedStyles:
679
+ # The first parameter should always be indented one step more than the
680
+ # preceding line.
681
+ - consistent
682
+ # The first parameter should always be indented one level relative to the
683
+ # parent that is receiving the parameter
684
+ - consistent_relative_to_receiver
685
+ # The first parameter should normally be indented one step more than the
686
+ # preceding line, but if it's a parameter for a method call that is itself
687
+ # a parameter in a method call, then the inner parameter should be indented
688
+ # relative to the inner method.
689
+ - special_for_inner_method_call
690
+ # Same as `special_for_inner_method_call` except that the special rule only
691
+ # applies if the outer method call encloses its arguments in parentheses.
692
+ - special_for_inner_method_call_in_parentheses
693
+ # By default, the indentation width from `Layout/IndentationWidth` is used
694
+ # But it can be overridden by setting this parameter
695
+ IndentationWidth: ~
696
+
697
+ Layout/IndentFirstArrayElement:
698
+ Description: >-
699
+ Checks the indentation of the first element in an array
700
+ literal.
701
+ Enabled: true
702
+ VersionAdded: '0.68'
703
+ # The value `special_inside_parentheses` means that array literals with
704
+ # brackets that have their opening bracket on the same line as a surrounding
705
+ # opening round parenthesis, shall have their first element indented relative
706
+ # to the first position inside the parenthesis.
707
+ #
708
+ # The value `consistent` means that the indentation of the first element shall
709
+ # always be relative to the first position of the line where the opening
710
+ # bracket is.
711
+ #
712
+ # The value `align_brackets` means that the indentation of the first element
713
+ # shall always be relative to the position of the opening bracket.
714
+ EnforcedStyle: special_inside_parentheses
715
+ SupportedStyles:
716
+ - special_inside_parentheses
717
+ - consistent
718
+ - align_brackets
719
+ # By default, the indentation width from `Layout/IndentationWidth` is used
720
+ # But it can be overridden by setting this parameter
721
+ IndentationWidth: ~
722
+
723
+ Layout/IndentFirstHashElement:
724
+ Description: 'Checks the indentation of the first key in a hash literal.'
725
+ Enabled: true
726
+ VersionAdded: '0.68'
727
+ # The value `special_inside_parentheses` means that hash literals with braces
728
+ # that have their opening brace on the same line as a surrounding opening
729
+ # round parenthesis, shall have their first key indented relative to the
730
+ # first position inside the parenthesis.
731
+ #
732
+ # The value `consistent` means that the indentation of the first key shall
733
+ # always be relative to the first position of the line where the opening
734
+ # brace is.
735
+ #
736
+ # The value `align_braces` means that the indentation of the first key shall
737
+ # always be relative to the position of the opening brace.
738
+ EnforcedStyle: special_inside_parentheses
739
+ SupportedStyles:
740
+ - special_inside_parentheses
741
+ - consistent
742
+ - align_braces
743
+ # By default, the indentation width from `Layout/IndentationWidth` is used
744
+ # But it can be overridden by setting this parameter
745
+ IndentationWidth: ~
746
+
747
+ Layout/IndentFirstParameter:
748
+ Description: >-
749
+ Checks the indentation of the first parameter in a
750
+ method definition.
751
+ Enabled: true
752
+ VersionAdded: '0.49'
753
+ VersionChanged: '0.68'
754
+ EnforcedStyle: consistent
755
+ SupportedStyles:
756
+ - consistent
757
+ - align_parentheses
758
+ # By default, the indentation width from `Layout/IndentationWidth` is used
759
+ # But it can be overridden by setting this parameter
760
+ IndentationWidth: ~
761
+
762
+ Layout/IndentHeredoc:
763
+ Description: 'This cop checks the indentation of the here document bodies.'
764
+ StyleGuide: '#squiggly-heredocs'
765
+ Enabled: true
766
+ VersionAdded: '0.49'
767
+ VersionChanged: '0.69'
768
+ EnforcedStyle: squiggly
769
+ SupportedStyles:
770
+ - squiggly
771
+ - active_support
772
+ - powerpack
773
+ - unindent
774
+
775
+ Layout/IndentationConsistency:
776
+ Description: 'Keep indentation straight.'
777
+ StyleGuide: '#spaces-indentation'
778
+ Enabled: true
779
+ VersionAdded: '0.49'
780
+ # The difference between `indented` and `normal` is that the `indented_internal_methods`
781
+ # style prescribes that in classes and modules the `protected` and `private`
782
+ # modifier keywords shall be indented the same as public methods and that
783
+ # protected and private members shall be indented one step more than the
784
+ # modifiers. Other than that, both styles mean that entities on the same
785
+ # logical depth shall have the same indentation.
786
+ EnforcedStyle: normal
787
+ SupportedStyles:
788
+ - normal
789
+ - indented_internal_methods
790
+ Reference:
791
+ # A reference to `EnforcedStyle: indented_internal_methods`.
792
+ - https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
793
+
794
+ Layout/IndentationWidth:
795
+ Description: 'Use 2 spaces for indentation.'
796
+ StyleGuide: '#spaces-indentation'
797
+ Enabled: true
798
+ VersionAdded: '0.49'
799
+ # Number of spaces for each indentation level.
800
+ Width: 2
801
+ IgnoredPatterns: []
802
+
803
+ Layout/InitialIndentation:
804
+ Description: >-
805
+ Checks the indentation of the first non-blank non-comment line in a file.
806
+ Enabled: true
807
+ VersionAdded: '0.49'
808
+
809
+ Layout/LeadingBlankLines:
810
+ Description: Check for unnecessary blank lines at the beginning of a file.
811
+ Enabled: true
812
+ VersionAdded: '0.57'
813
+
814
+ Layout/LeadingCommentSpace:
815
+ Description: 'Comments should start with a space.'
816
+ StyleGuide: '#hash-space'
817
+ Enabled: true
818
+ VersionAdded: '0.49'
819
+ VersionChanged: '0.73'
820
+ AllowDoxygenCommentStyle: false
821
+
822
+ Layout/MultilineArrayBraceLayout:
823
+ Description: >-
824
+ Checks that the closing brace in an array literal is
825
+ either on the same line as the last array element, or
826
+ a new line.
827
+ Enabled: true
828
+ VersionAdded: '0.49'
829
+ EnforcedStyle: symmetrical
830
+ SupportedStyles:
831
+ # symmetrical: closing brace is positioned in same way as opening brace
832
+ # new_line: closing brace is always on a new line
833
+ # same_line: closing brace is always on the same line as last element
834
+ - symmetrical
835
+ - new_line
836
+ - same_line
837
+
838
+ Layout/MultilineArrayLineBreaks:
839
+ Description: >-
840
+ Checks that each item in a multi-line array literal
841
+ starts on a separate line.
842
+ Enabled: false
843
+ VersionAdded: '0.67'
844
+
845
+ Layout/MultilineAssignmentLayout:
846
+ Description: 'Check for a newline after the assignment operator in multi-line assignments.'
847
+ StyleGuide: '#indent-conditional-assignment'
848
+ Enabled: false
849
+ VersionAdded: '0.49'
850
+ # The types of assignments which are subject to this rule.
851
+ SupportedTypes:
852
+ - block
853
+ - case
854
+ - class
855
+ - if
856
+ - kwbegin
857
+ - module
858
+ EnforcedStyle: new_line
859
+ SupportedStyles:
860
+ # Ensures that the assignment operator and the rhs are on the same line for
861
+ # the set of supported types.
862
+ - same_line
863
+ # Ensures that the assignment operator and the rhs are on separate lines
864
+ # for the set of supported types.
865
+ - new_line
866
+
867
+ Layout/MultilineBlockLayout:
868
+ Description: 'Ensures newlines after multiline block do statements.'
869
+ Enabled: true
870
+ VersionAdded: '0.49'
871
+
872
+ Layout/MultilineHashBraceLayout:
873
+ Description: >-
874
+ Checks that the closing brace in a hash literal is
875
+ either on the same line as the last hash element, or
876
+ a new line.
877
+ Enabled: true
878
+ VersionAdded: '0.49'
879
+ EnforcedStyle: symmetrical
880
+ SupportedStyles:
881
+ # symmetrical: closing brace is positioned in same way as opening brace
882
+ # new_line: closing brace is always on a new line
883
+ # same_line: closing brace is always on same line as last element
884
+ - symmetrical
885
+ - new_line
886
+ - same_line
887
+
888
+ Layout/MultilineHashKeyLineBreaks:
889
+ Description: >-
890
+ Checks that each item in a multi-line hash literal
891
+ starts on a separate line.
892
+ Enabled: false
893
+ VersionAdded: '0.67'
894
+
895
+ Layout/MultilineMethodArgumentLineBreaks:
896
+ Description: >-
897
+ Checks that each argument in a multi-line method call
898
+ starts on a separate line.
899
+ Enabled: false
900
+ VersionAdded: '0.67'
901
+
902
+ Layout/MultilineMethodCallBraceLayout:
903
+ Description: >-
904
+ Checks that the closing brace in a method call is
905
+ either on the same line as the last method argument, or
906
+ a new line.
907
+ Enabled: true
908
+ VersionAdded: '0.49'
909
+ EnforcedStyle: symmetrical
910
+ SupportedStyles:
911
+ # symmetrical: closing brace is positioned in same way as opening brace
912
+ # new_line: closing brace is always on a new line
913
+ # same_line: closing brace is always on the same line as last argument
914
+ - symmetrical
915
+ - new_line
916
+ - same_line
917
+
918
+ Layout/MultilineMethodCallIndentation:
919
+ Description: >-
920
+ Checks indentation of method calls with the dot operator
921
+ that span more than one line.
922
+ Enabled: true
923
+ VersionAdded: '0.49'
924
+ EnforcedStyle: aligned
925
+ SupportedStyles:
926
+ - aligned
927
+ - indented
928
+ - indented_relative_to_receiver
929
+ # By default, the indentation width from Layout/IndentationWidth is used
930
+ # But it can be overridden by setting this parameter
931
+ IndentationWidth: ~
932
+
933
+ Layout/MultilineMethodDefinitionBraceLayout:
934
+ Description: >-
935
+ Checks that the closing brace in a method definition is
936
+ either on the same line as the last method parameter, or
937
+ a new line.
938
+ Enabled: true
939
+ VersionAdded: '0.49'
940
+ EnforcedStyle: symmetrical
941
+ SupportedStyles:
942
+ # symmetrical: closing brace is positioned in same way as opening brace
943
+ # new_line: closing brace is always on a new line
944
+ # same_line: closing brace is always on the same line as last parameter
945
+ - symmetrical
946
+ - new_line
947
+ - same_line
948
+
949
+ Layout/MultilineOperationIndentation:
950
+ Description: >-
951
+ Checks indentation of binary operations that span more than
952
+ one line.
953
+ Enabled: true
954
+ VersionAdded: '0.49'
955
+ EnforcedStyle: aligned
956
+ SupportedStyles:
957
+ - aligned
958
+ - indented
959
+ # By default, the indentation width from `Layout/IndentationWidth` is used
960
+ # But it can be overridden by setting this parameter
961
+ IndentationWidth: ~
962
+
963
+ Layout/RescueEnsureAlignment:
964
+ Description: 'Align rescues and ensures correctly.'
965
+ Enabled: true
966
+ VersionAdded: '0.49'
967
+
968
+ Layout/SpaceAfterColon:
969
+ Description: 'Use spaces after colons.'
970
+ StyleGuide: '#spaces-operators'
971
+ Enabled: true
972
+ VersionAdded: '0.49'
973
+
974
+ Layout/SpaceAfterComma:
975
+ Description: 'Use spaces after commas.'
976
+ StyleGuide: '#spaces-operators'
977
+ Enabled: true
978
+ VersionAdded: '0.49'
979
+
980
+ Layout/SpaceAfterMethodName:
981
+ Description: >-
982
+ Do not put a space between a method name and the opening
983
+ parenthesis in a method definition.
984
+ StyleGuide: '#parens-no-spaces'
985
+ Enabled: true
986
+ VersionAdded: '0.49'
987
+
988
+ Layout/SpaceAfterNot:
989
+ Description: Tracks redundant space after the ! operator.
990
+ StyleGuide: '#no-space-bang'
991
+ Enabled: true
992
+ VersionAdded: '0.49'
993
+
994
+ Layout/SpaceAfterSemicolon:
995
+ Description: 'Use spaces after semicolons.'
996
+ StyleGuide: '#spaces-operators'
997
+ Enabled: true
998
+ VersionAdded: '0.49'
999
+
1000
+ Layout/SpaceAroundBlockParameters:
1001
+ Description: 'Checks the spacing inside and after block parameters pipes.'
1002
+ Enabled: true
1003
+ VersionAdded: '0.49'
1004
+ EnforcedStyleInsidePipes: no_space
1005
+ SupportedStylesInsidePipes:
1006
+ - space
1007
+ - no_space
1008
+
1009
+ Layout/SpaceAroundEqualsInParameterDefault:
1010
+ Description: >-
1011
+ Checks that the equals signs in parameter default assignments
1012
+ have or don't have surrounding space depending on
1013
+ configuration.
1014
+ StyleGuide: '#spaces-around-equals'
1015
+ Enabled: true
1016
+ VersionAdded: '0.49'
1017
+ EnforcedStyle: space
1018
+ SupportedStyles:
1019
+ - space
1020
+ - no_space
1021
+
1022
+ Layout/SpaceAroundKeyword:
1023
+ Description: 'Use a space around keywords if appropriate.'
1024
+ Enabled: true
1025
+ VersionAdded: '0.49'
1026
+
1027
+ Layout/SpaceAroundOperators:
1028
+ Description: 'Use a single space around operators.'
1029
+ StyleGuide: '#spaces-operators'
1030
+ Enabled: true
1031
+ VersionAdded: '0.49'
1032
+ # When `true`, allows most uses of extra spacing if the intent is to align
1033
+ # with an operator on the previous or next line, not counting empty lines
1034
+ # or comment lines.
1035
+ AllowForAlignment: true
1036
+
1037
+ Layout/SpaceBeforeBlockBraces:
1038
+ Description: >-
1039
+ Checks that the left block brace has or doesn't have space
1040
+ before it.
1041
+ Enabled: true
1042
+ VersionAdded: '0.49'
1043
+ EnforcedStyle: space
1044
+ SupportedStyles:
1045
+ - space
1046
+ - no_space
1047
+ EnforcedStyleForEmptyBraces: space
1048
+ SupportedStylesForEmptyBraces:
1049
+ - space
1050
+ - no_space
1051
+ VersionChanged: '0.52.1'
1052
+
1053
+ Layout/SpaceBeforeComma:
1054
+ Description: 'No spaces before commas.'
1055
+ Enabled: true
1056
+ VersionAdded: '0.49'
1057
+
1058
+ Layout/SpaceBeforeComment:
1059
+ Description: >-
1060
+ Checks for missing space between code and a comment on the
1061
+ same line.
1062
+ Enabled: true
1063
+ VersionAdded: '0.49'
1064
+
1065
+ Layout/SpaceBeforeFirstArg:
1066
+ Description: >-
1067
+ Checks that exactly one space is used between a method name
1068
+ and the first argument for method calls without parentheses.
1069
+ Enabled: true
1070
+ VersionAdded: '0.49'
1071
+ # When `true`, allows most uses of extra spacing if the intent is to align
1072
+ # things with the previous or next line, not counting empty lines or comment
1073
+ # lines.
1074
+ AllowForAlignment: true
1075
+
1076
+ Layout/SpaceBeforeSemicolon:
1077
+ Description: 'No spaces before semicolons.'
1078
+ Enabled: true
1079
+ VersionAdded: '0.49'
1080
+
1081
+ Layout/SpaceInLambdaLiteral:
1082
+ Description: 'Checks for spaces in lambda literals.'
1083
+ Enabled: true
1084
+ VersionAdded: '0.49'
1085
+ EnforcedStyle: require_no_space
1086
+ SupportedStyles:
1087
+ - require_no_space
1088
+ - require_space
1089
+
1090
+ Layout/SpaceInsideArrayLiteralBrackets:
1091
+ Description: 'Checks the spacing inside array literal brackets.'
1092
+ Enabled: true
1093
+ VersionAdded: '0.52'
1094
+ EnforcedStyle: no_space
1095
+ SupportedStyles:
1096
+ - space
1097
+ - no_space
1098
+ # 'compact' normally requires a space inside the brackets, with the exception
1099
+ # that successive left brackets or right brackets are collapsed together
1100
+ - compact
1101
+ EnforcedStyleForEmptyBrackets: no_space
1102
+ SupportedStylesForEmptyBrackets:
1103
+ - space
1104
+ - no_space
1105
+
1106
+ Layout/SpaceInsideArrayPercentLiteral:
1107
+ Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
1108
+ Enabled: true
1109
+ VersionAdded: '0.49'
1110
+
1111
+ Layout/SpaceInsideBlockBraces:
1112
+ Description: >-
1113
+ Checks that block braces have or don't have surrounding space.
1114
+ For blocks taking parameters, checks that the left brace has
1115
+ or doesn't have trailing space.
1116
+ Enabled: true
1117
+ VersionAdded: '0.49'
1118
+ EnforcedStyle: space
1119
+ SupportedStyles:
1120
+ - space
1121
+ - no_space
1122
+ EnforcedStyleForEmptyBraces: no_space
1123
+ SupportedStylesForEmptyBraces:
1124
+ - space
1125
+ - no_space
1126
+ # Space between `{` and `|`. Overrides `EnforcedStyle` if there is a conflict.
1127
+ SpaceBeforeBlockParameters: true
1128
+
1129
+ Layout/SpaceInsideHashLiteralBraces:
1130
+ Description: "Use spaces inside hash literal braces - or don't."
1131
+ StyleGuide: '#spaces-operators'
1132
+ Enabled: true
1133
+ VersionAdded: '0.49'
1134
+ EnforcedStyle: space
1135
+ SupportedStyles:
1136
+ - space
1137
+ - no_space
1138
+ # 'compact' normally requires a space inside hash braces, with the exception
1139
+ # that successive left braces or right braces are collapsed together
1140
+ - compact
1141
+ EnforcedStyleForEmptyBraces: no_space
1142
+ SupportedStylesForEmptyBraces:
1143
+ - space
1144
+ - no_space
1145
+
1146
+
1147
+ Layout/SpaceInsideParens:
1148
+ Description: 'No spaces after ( or before ).'
1149
+ StyleGuide: '#spaces-braces'
1150
+ Enabled: true
1151
+ VersionAdded: '0.49'
1152
+ VersionChanged: '0.55'
1153
+ EnforcedStyle: no_space
1154
+ SupportedStyles:
1155
+ - space
1156
+ - no_space
1157
+
1158
+ Layout/SpaceInsidePercentLiteralDelimiters:
1159
+ Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
1160
+ Enabled: true
1161
+ VersionAdded: '0.49'
1162
+
1163
+ Layout/SpaceInsideRangeLiteral:
1164
+ Description: 'No spaces inside range literals.'
1165
+ StyleGuide: '#no-space-inside-range-literals'
1166
+ Enabled: true
1167
+ VersionAdded: '0.49'
1168
+
1169
+ Layout/SpaceInsideReferenceBrackets:
1170
+ Description: 'Checks the spacing inside referential brackets.'
1171
+ Enabled: true
1172
+ VersionAdded: '0.52'
1173
+ VersionChanged: '0.53'
1174
+ EnforcedStyle: no_space
1175
+ SupportedStyles:
1176
+ - space
1177
+ - no_space
1178
+ EnforcedStyleForEmptyBrackets: no_space
1179
+ SupportedStylesForEmptyBrackets:
1180
+ - space
1181
+ - no_space
1182
+
1183
+ Layout/SpaceInsideStringInterpolation:
1184
+ Description: 'Checks for padding/surrounding spaces inside string interpolation.'
1185
+ StyleGuide: '#string-interpolation'
1186
+ Enabled: true
1187
+ VersionAdded: '0.49'
1188
+ EnforcedStyle: no_space
1189
+ SupportedStyles:
1190
+ - space
1191
+ - no_space
1192
+
1193
+ Layout/Tab:
1194
+ Description: 'No hard tabs.'
1195
+ StyleGuide: '#spaces-indentation'
1196
+ Enabled: true
1197
+ VersionAdded: '0.49'
1198
+ VersionChanged: '0.51'
1199
+ # By default, the indentation width from Layout/IndentationWidth is used
1200
+ # But it can be overridden by setting this parameter
1201
+ # It is used during auto-correction to determine how many spaces should
1202
+ # replace each tab.
1203
+ IndentationWidth: ~
1204
+
1205
+ Layout/TrailingBlankLines:
1206
+ Description: 'Checks trailing blank lines and final newline.'
1207
+ StyleGuide: '#newline-eof'
1208
+ Enabled: true
1209
+ VersionAdded: '0.49'
1210
+ EnforcedStyle: final_newline
1211
+ SupportedStyles:
1212
+ - final_newline
1213
+ - final_blank_line
1214
+
1215
+ Layout/TrailingWhitespace:
1216
+ Description: 'Avoid trailing whitespace.'
1217
+ StyleGuide: '#no-trailing-whitespace'
1218
+ Enabled: true
1219
+ VersionAdded: '0.49'
1220
+ VersionChanged: '0.55'
1221
+ AllowInHeredoc: false
1222
+
1223
+ #################### Lint ##################################
1224
+ ### Warnings
1225
+
1226
+ Lint/AmbiguousBlockAssociation:
1227
+ Description: >-
1228
+ Checks for ambiguous block association with method when param passed without
1229
+ parentheses.
1230
+ StyleGuide: '#syntax'
1231
+ Enabled: true
1232
+ VersionAdded: '0.48'
1233
+
1234
+ Lint/AmbiguousOperator:
1235
+ Description: >-
1236
+ Checks for ambiguous operators in the first argument of a
1237
+ method invocation without parentheses.
1238
+ StyleGuide: '#method-invocation-parens'
1239
+ Enabled: true
1240
+ VersionAdded: '0.17'
1241
+
1242
+ Lint/AmbiguousRegexpLiteral:
1243
+ Description: >-
1244
+ Checks for ambiguous regexp literals in the first argument of
1245
+ a method invocation without parentheses.
1246
+ Enabled: true
1247
+ VersionAdded: '0.17'
1248
+
1249
+ Lint/AssignmentInCondition:
1250
+ Description: "Don't use assignment in conditions."
1251
+ StyleGuide: '#safe-assignment-in-condition'
1252
+ Enabled: true
1253
+ VersionAdded: '0.9'
1254
+ AllowSafeAssignment: true
1255
+
1256
+ Lint/BigDecimalNew:
1257
+ Description: '`BigDecimal.new()` is deprecated. Use `BigDecimal()` instead.'
1258
+ Enabled: true
1259
+ VersionAdded: '0.53'
1260
+
1261
+ Lint/BooleanSymbol:
1262
+ Description: 'Check for `:true` and `:false` symbols.'
1263
+ Enabled: true
1264
+ VersionAdded: '0.50'
1265
+
1266
+ Lint/CircularArgumentReference:
1267
+ Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
1268
+ Enabled: true
1269
+ VersionAdded: '0.33'
1270
+
1271
+ Lint/Debugger:
1272
+ Description: 'Check for debugger calls.'
1273
+ Enabled: true
1274
+ VersionAdded: '0.14'
1275
+ VersionChanged: '0.49'
1276
+
1277
+ Lint/DeprecatedClassMethods:
1278
+ Description: 'Check for deprecated class method calls.'
1279
+ Enabled: true
1280
+ VersionAdded: '0.19'
1281
+
1282
+ Lint/DisjunctiveAssignmentInConstructor:
1283
+ Description: 'In constructor, plain assignment is preferred over disjunctive.'
1284
+ Enabled: true
1285
+ Safe: false
1286
+ VersionAdded: '0.62'
1287
+
1288
+ Lint/DuplicateCaseCondition:
1289
+ Description: 'Do not repeat values in case conditionals.'
1290
+ Enabled: true
1291
+ VersionAdded: '0.45'
1292
+
1293
+ Lint/DuplicateMethods:
1294
+ Description: 'Check for duplicate method definitions.'
1295
+ Enabled: true
1296
+ VersionAdded: '0.29'
1297
+
1298
+ Lint/DuplicatedKey:
1299
+ Description: 'Check for duplicate keys in hash literals.'
1300
+ Enabled: true
1301
+ VersionAdded: '0.34'
1302
+
1303
+ Lint/EachWithObjectArgument:
1304
+ Description: 'Check for immutable argument given to each_with_object.'
1305
+ Enabled: true
1306
+ VersionAdded: '0.31'
1307
+
1308
+ Lint/ElseLayout:
1309
+ Description: 'Check for odd code arrangement in an else block.'
1310
+ Enabled: true
1311
+ VersionAdded: '0.17'
1312
+
1313
+ Lint/EmptyEnsure:
1314
+ Description: 'Checks for empty ensure block.'
1315
+ Enabled: true
1316
+ VersionAdded: '0.10'
1317
+ VersionChanged: '0.48'
1318
+ AutoCorrect: false
1319
+
1320
+ Lint/EmptyExpression:
1321
+ Description: 'Checks for empty expressions.'
1322
+ Enabled: true
1323
+ VersionAdded: '0.45'
1324
+
1325
+ Lint/EmptyInterpolation:
1326
+ Description: 'Checks for empty string interpolation.'
1327
+ Enabled: true
1328
+ VersionAdded: '0.20'
1329
+ VersionChanged: '0.45'
1330
+
1331
+ Lint/EmptyWhen:
1332
+ Description: 'Checks for `when` branches with empty bodies.'
1333
+ Enabled: true
1334
+ VersionAdded: '0.45'
1335
+
1336
+ Lint/EndInMethod:
1337
+ Description: 'END blocks should not be placed inside method definitions.'
1338
+ Enabled: true
1339
+ VersionAdded: '0.9'
1340
+
1341
+ Lint/EnsureReturn:
1342
+ Description: 'Do not use return in an ensure block.'
1343
+ StyleGuide: '#no-return-ensure'
1344
+ Enabled: true
1345
+ VersionAdded: '0.9'
1346
+
1347
+ Lint/ErbNewArguments:
1348
+ Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
1349
+ Enabled: true
1350
+ VersionAdded: '0.56'
1351
+
1352
+ Lint/FlipFlop:
1353
+ Description: 'Checks for flip-flops.'
1354
+ StyleGuide: '#no-flip-flops'
1355
+ Enabled: true
1356
+ VersionAdded: '0.16'
1357
+
1358
+ Lint/FloatOutOfRange:
1359
+ Description: >-
1360
+ Catches floating-point literals too large or small for Ruby to
1361
+ represent.
1362
+ Enabled: true
1363
+ VersionAdded: '0.36'
1364
+
1365
+ Lint/FormatParameterMismatch:
1366
+ Description: 'The number of parameters to format/sprint must match the fields.'
1367
+ Enabled: true
1368
+ VersionAdded: '0.33'
1369
+
1370
+ Lint/HandleExceptions:
1371
+ Description: "Don't suppress exception."
1372
+ StyleGuide: '#dont-hide-exceptions'
1373
+ Enabled: true
1374
+ AllowComments: false
1375
+ VersionAdded: '0.9'
1376
+ VersionChanged: '0.70'
1377
+
1378
+ Lint/HeredocMethodCallPosition:
1379
+ Description: >-
1380
+ Checks for the ordering of a method call where
1381
+ the receiver of the call is a HEREDOC.
1382
+ Enabled: false
1383
+ StyleGuide: '#heredoc-method-calls'
1384
+ VersionAdded: '0.68'
1385
+
1386
+ Lint/ImplicitStringConcatenation:
1387
+ Description: >-
1388
+ Checks for adjacent string literals on the same line, which
1389
+ could better be represented as a single string literal.
1390
+ Enabled: true
1391
+ VersionAdded: '0.36'
1392
+
1393
+ Lint/IneffectiveAccessModifier:
1394
+ Description: >-
1395
+ Checks for attempts to use `private` or `protected` to set
1396
+ the visibility of a class method, which does not work.
1397
+ Enabled: true
1398
+ VersionAdded: '0.36'
1399
+
1400
+ Lint/InheritException:
1401
+ Description: 'Avoid inheriting from the `Exception` class.'
1402
+ Enabled: true
1403
+ VersionAdded: '0.41'
1404
+ # The default base class in favour of `Exception`.
1405
+ EnforcedStyle: runtime_error
1406
+ SupportedStyles:
1407
+ - runtime_error
1408
+ - standard_error
1409
+
1410
+ Lint/InterpolationCheck:
1411
+ Description: 'Raise warning for interpolation in single q strs.'
1412
+ Enabled: true
1413
+ VersionAdded: '0.50'
1414
+
1415
+ Lint/LiteralAsCondition:
1416
+ Description: 'Checks of literals used in conditions.'
1417
+ Enabled: true
1418
+ VersionAdded: '0.51'
1419
+
1420
+ Lint/LiteralInInterpolation:
1421
+ Description: 'Checks for literals used in interpolation.'
1422
+ Enabled: true
1423
+ VersionAdded: '0.19'
1424
+ VersionChanged: '0.32'
1425
+
1426
+ Lint/Loop:
1427
+ Description: >-
1428
+ Use Kernel#loop with break rather than begin/end/until or
1429
+ begin/end/while for post-loop tests.
1430
+ StyleGuide: '#loop-with-break'
1431
+ Enabled: true
1432
+ VersionAdded: '0.9'
1433
+
1434
+ Lint/MissingCopEnableDirective:
1435
+ Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
1436
+ Enabled: true
1437
+ VersionAdded: '0.52'
1438
+ # Maximum number of consecutive lines the cop can be disabled for.
1439
+ # 0 allows only single-line disables
1440
+ # 1 would mean the maximum allowed is the following:
1441
+ # # rubocop:disable SomeCop
1442
+ # a = 1
1443
+ # # rubocop:enable SomeCop
1444
+ # .inf for any size
1445
+ MaximumRangeSize: .inf
1446
+
1447
+ Lint/MultipleCompare:
1448
+ Description: "Use `&&` operator to compare multiple value."
1449
+ Enabled: true
1450
+ VersionAdded: '0.47'
1451
+
1452
+ Lint/NestedMethodDefinition:
1453
+ Description: 'Do not use nested method definitions.'
1454
+ StyleGuide: '#no-nested-methods'
1455
+ Enabled: true
1456
+ VersionAdded: '0.32'
1457
+
1458
+ Lint/NestedPercentLiteral:
1459
+ Description: 'Checks for nested percent literals.'
1460
+ Enabled: true
1461
+ VersionAdded: '0.52'
1462
+
1463
+ Lint/NextWithoutAccumulator:
1464
+ Description: >-
1465
+ Do not omit the accumulator when calling `next`
1466
+ in a `reduce`/`inject` block.
1467
+ Enabled: true
1468
+ VersionAdded: '0.36'
1469
+
1470
+ Lint/NonLocalExitFromIterator:
1471
+ Description: 'Do not use return in iterator to cause non-local exit.'
1472
+ Enabled: true
1473
+ VersionAdded: '0.30'
1474
+
1475
+ Lint/NumberConversion:
1476
+ Description: 'Checks unsafe usage of number conversion methods.'
1477
+ Enabled: false
1478
+ VersionAdded: '0.53'
1479
+ VersionChanged: '0.70'
1480
+ SafeAutoCorrect: false
1481
+
1482
+ Lint/OrderedMagicComments:
1483
+ Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
1484
+ Enabled: true
1485
+ VersionAdded: '0.53'
1486
+
1487
+ Lint/ParenthesesAsGroupedExpression:
1488
+ Description: >-
1489
+ Checks for method calls with a space before the opening
1490
+ parenthesis.
1491
+ StyleGuide: '#parens-no-spaces'
1492
+ Enabled: true
1493
+ VersionAdded: '0.12'
1494
+
1495
+ Lint/PercentStringArray:
1496
+ Description: >-
1497
+ Checks for unwanted commas and quotes in %w/%W literals.
1498
+ Enabled: true
1499
+ Safe: false
1500
+ VersionAdded: '0.41'
1501
+
1502
+ Lint/PercentSymbolArray:
1503
+ Description: >-
1504
+ Checks for unwanted commas and colons in %i/%I literals.
1505
+ Enabled: true
1506
+ VersionAdded: '0.41'
1507
+
1508
+ Lint/RandOne:
1509
+ Description: >-
1510
+ Checks for `rand(1)` calls. Such calls always return `0`
1511
+ and most likely a mistake.
1512
+ Enabled: true
1513
+ VersionAdded: '0.36'
1514
+
1515
+ Lint/RedundantWithIndex:
1516
+ Description: 'Checks for redundant `with_index`.'
1517
+ Enabled: true
1518
+ VersionAdded: '0.50'
1519
+
1520
+ Lint/RedundantWithObject:
1521
+ Description: 'Checks for redundant `with_object`.'
1522
+ Enabled: true
1523
+ VersionAdded: '0.51'
1524
+
1525
+ Lint/RegexpAsCondition:
1526
+ Description: >-
1527
+ Do not use regexp literal as a condition.
1528
+ The regexp literal matches `$_` implicitly.
1529
+ Enabled: true
1530
+ VersionAdded: '0.51'
1531
+
1532
+ Lint/RequireParentheses:
1533
+ Description: >-
1534
+ Use parentheses in the method call to avoid confusion
1535
+ about precedence.
1536
+ Enabled: true
1537
+ VersionAdded: '0.18'
1538
+
1539
+ Lint/RescueException:
1540
+ Description: 'Avoid rescuing the Exception class.'
1541
+ StyleGuide: '#no-blind-rescues'
1542
+ Enabled: true
1543
+ VersionAdded: '0.9'
1544
+ VersionChanged: '0.27.1'
1545
+
1546
+ Lint/RescueType:
1547
+ Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
1548
+ Enabled: true
1549
+ VersionAdded: '0.49'
1550
+
1551
+ Lint/ReturnInVoidContext:
1552
+ Description: 'Checks for return in void context.'
1553
+ Enabled: true
1554
+ VersionAdded: '0.50'
1555
+
1556
+ Lint/SafeNavigationChain:
1557
+ Description: 'Do not chain ordinary method call after safe navigation operator.'
1558
+ Enabled: true
1559
+ VersionAdded: '0.47'
1560
+ VersionChanged: '0.56'
1561
+ Whitelist:
1562
+ - present?
1563
+ - blank?
1564
+ - presence
1565
+ - try
1566
+ - try!
1567
+
1568
+ Lint/SafeNavigationConsistency:
1569
+ Description: >-
1570
+ Check to make sure that if safe navigation is used for a method
1571
+ call in an `&&` or `||` condition that safe navigation is used
1572
+ for all method calls on that same object.
1573
+ Enabled: true
1574
+ VersionAdded: '0.55'
1575
+ Whitelist:
1576
+ - present?
1577
+ - blank?
1578
+ - presence
1579
+ - try
1580
+ - try!
1581
+
1582
+
1583
+ Lint/SafeNavigationWithEmpty:
1584
+ Description: 'Avoid `foo&.empty?` in conditionals.'
1585
+ Enabled: true
1586
+ VersionAdded: '0.62'
1587
+
1588
+ Lint/ScriptPermission:
1589
+ Description: 'Grant script file execute permission.'
1590
+ Enabled: true
1591
+ VersionAdded: '0.49'
1592
+ VersionChanged: '0.50'
1593
+
1594
+ Lint/SendWithMixinArgument:
1595
+ Description: 'Checks for `send` method when using mixin.'
1596
+ Enabled: true
1597
+ VersionAdded: '0.75'
1598
+
1599
+ Lint/ShadowedArgument:
1600
+ Description: 'Avoid reassigning arguments before they were used.'
1601
+ Enabled: true
1602
+ VersionAdded: '0.52'
1603
+ IgnoreImplicitReferences: false
1604
+
1605
+
1606
+ Lint/ShadowedException:
1607
+ Description: >-
1608
+ Avoid rescuing a higher level exception
1609
+ before a lower level exception.
1610
+ Enabled: true
1611
+ VersionAdded: '0.41'
1612
+
1613
+ Lint/ShadowingOuterLocalVariable:
1614
+ Description: >-
1615
+ Do not use the same name as outer local variable
1616
+ for block arguments or block local variables.
1617
+ Enabled: true
1618
+ VersionAdded: '0.9'
1619
+
1620
+ Lint/StringConversionInInterpolation:
1621
+ Description: 'Checks for Object#to_s usage in string interpolation.'
1622
+ StyleGuide: '#no-to-s'
1623
+ Enabled: true
1624
+ VersionAdded: '0.19'
1625
+ VersionChanged: '0.20'
1626
+
1627
+ Lint/Syntax:
1628
+ Description: 'Checks syntax error.'
1629
+ Enabled: true
1630
+ VersionAdded: '0.9'
1631
+
1632
+
1633
+ Lint/ToJSON:
1634
+ Description: 'Ensure #to_json includes an optional argument.'
1635
+ Enabled: true
1636
+
1637
+ Lint/UnderscorePrefixedVariableName:
1638
+ Description: 'Do not use prefix `_` for a variable that is used.'
1639
+ Enabled: true
1640
+ VersionAdded: '0.21'
1641
+ AllowKeywordBlockArguments: false
1642
+
1643
+ Lint/UnifiedInteger:
1644
+ Description: 'Use Integer instead of Fixnum or Bignum.'
1645
+ Enabled: true
1646
+ VersionAdded: '0.43'
1647
+
1648
+ Lint/UnneededCopDisableDirective:
1649
+ Description: >-
1650
+ Checks for rubocop:disable comments that can be removed.
1651
+ Note: this cop is not disabled when disabling all cops.
1652
+ It must be explicitly disabled.
1653
+ Enabled: true
1654
+ VersionAdded: '0.53'
1655
+
1656
+ Lint/UnneededCopEnableDirective:
1657
+ Description: Checks for rubocop:enable comments that can be removed.
1658
+ Enabled: true
1659
+ VersionAdded: '0.53'
1660
+
1661
+ Lint/UnneededRequireStatement:
1662
+ Description: 'Checks for unnecessary `require` statement.'
1663
+ Enabled: true
1664
+ VersionAdded: '0.51'
1665
+
1666
+ Lint/UnneededSplatExpansion:
1667
+ Description: 'Checks for splat unnecessarily being called on literals.'
1668
+ Enabled: true
1669
+ VersionAdded: '0.43'
1670
+ VersionChanged: '0.74'
1671
+
1672
+ Lint/UnreachableCode:
1673
+ Description: 'Unreachable code.'
1674
+ Enabled: true
1675
+ VersionAdded: '0.9'
1676
+
1677
+ Lint/UnusedBlockArgument:
1678
+ Description: 'Checks for unused block arguments.'
1679
+ StyleGuide: '#underscore-unused-vars'
1680
+ Enabled: true
1681
+ VersionAdded: '0.21'
1682
+ VersionChanged: '0.22'
1683
+ IgnoreEmptyBlocks: true
1684
+ AllowUnusedKeywordArguments: false
1685
+
1686
+ Lint/UnusedMethodArgument:
1687
+ Description: 'Checks for unused method arguments.'
1688
+ StyleGuide: '#underscore-unused-vars'
1689
+ Enabled: true
1690
+ VersionAdded: '0.21'
1691
+ VersionChanged: '0.35'
1692
+ AllowUnusedKeywordArguments: false
1693
+ IgnoreEmptyMethods: true
1694
+
1695
+ Lint/UriEscapeUnescape:
1696
+ Description: >-
1697
+ `URI.escape` method is obsolete and should not be used. Instead, use
1698
+ `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
1699
+ depending on your specific use case.
1700
+ Also `URI.unescape` method is obsolete and should not be used. Instead, use
1701
+ `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
1702
+ depending on your specific use case.
1703
+ Enabled: true
1704
+ VersionAdded: '0.50'
1705
+
1706
+ Lint/UriRegexp:
1707
+ Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
1708
+ Enabled: true
1709
+ VersionAdded: '0.50'
1710
+
1711
+ Lint/UselessAccessModifier:
1712
+ Description: 'Checks for useless access modifiers.'
1713
+ Enabled: true
1714
+ VersionAdded: '0.20'
1715
+ VersionChanged: '0.47'
1716
+ ContextCreatingMethods: []
1717
+ MethodCreatingMethods: []
1718
+
1719
+ Lint/UselessAssignment:
1720
+ Description: 'Checks for useless assignment to a local variable.'
1721
+ StyleGuide: '#underscore-unused-vars'
1722
+ Enabled: true
1723
+ VersionAdded: '0.11'
1724
+
1725
+ Lint/UselessComparison:
1726
+ Description: 'Checks for comparison of something with itself.'
1727
+ Enabled: true
1728
+ VersionAdded: '0.11'
1729
+
1730
+ Lint/UselessElseWithoutRescue:
1731
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
1732
+ Enabled: true
1733
+ VersionAdded: '0.17'
1734
+
1735
+ Lint/UselessSetterCall:
1736
+ Description: 'Checks for useless setter call to a local variable.'
1737
+ Enabled: true
1738
+ VersionAdded: '0.13'
1739
+
1740
+ Lint/Void:
1741
+ Description: 'Possible use of operator/literal/variable in void context.'
1742
+ Enabled: true
1743
+ VersionAdded: '0.9'
1744
+ CheckForMethodsWithNoSideEffects: false
1745
+
1746
+ #################### Metrics ###############################
1747
+
1748
+ Metrics/AbcSize:
1749
+ Description: >-
1750
+ A calculated magnitude based on number of assignments,
1751
+ branches, and conditions.
1752
+ Reference:
1753
+ - http://c2.com/cgi/wiki?AbcMetric
1754
+ - https://en.wikipedia.org/wiki/ABC_Software_Metric
1755
+ Enabled: true
1756
+ VersionAdded: '0.27'
1757
+ VersionChanged: '0.66'
1758
+ # The ABC size is a calculated magnitude, so this number can be an Integer or
1759
+ # a Float.
1760
+ Max: 15
1761
+
1762
+ Metrics/BlockLength:
1763
+ Description: 'Avoid long blocks with many lines.'
1764
+ Enabled: true
1765
+ VersionAdded: '0.44'
1766
+ VersionChanged: '0.66'
1767
+ CountComments: false # count full line comments?
1768
+ Max: 25
1769
+ ExcludedMethods:
1770
+ # By default, exclude the `#refine` method, as it tends to have larger
1771
+ # associated blocks.
1772
+ - refine
1773
+ Exclude:
1774
+ - '**/*.gemspec'
1775
+
1776
+ Metrics/BlockNesting:
1777
+ Description: 'Avoid excessive block nesting.'
1778
+ StyleGuide: '#three-is-the-number-thou-shalt-count'
1779
+ Enabled: true
1780
+ VersionAdded: '0.25'
1781
+ VersionChanged: '0.47'
1782
+ CountBlocks: false
1783
+ Max: 3
1784
+
1785
+ Metrics/ClassLength:
1786
+ Description: 'Avoid classes longer than 100 lines of code.'
1787
+ Enabled: true
1788
+ VersionAdded: '0.25'
1789
+ CountComments: false # count full line comments?
1790
+ Max: 100
1791
+
1792
+ # Avoid complex methods.
1793
+ Metrics/CyclomaticComplexity:
1794
+ Description: >-
1795
+ A complexity metric that is strongly correlated to the number
1796
+ of test cases needed to validate a method.
1797
+ Enabled: true
1798
+ VersionAdded: '0.25'
1799
+ Max: 6
1800
+
1801
+ Metrics/LineLength:
1802
+ Description: 'Limit lines to 80 characters.'
1803
+ StyleGuide: '#80-character-limits'
1804
+ Enabled: true
1805
+ VersionAdded: '0.25'
1806
+ VersionChanged: '0.68'
1807
+ AutoCorrect: false
1808
+ Max: 80
1809
+ # To make it possible to copy or click on URIs in the code, we allow lines
1810
+ # containing a URI to be longer than Max.
1811
+ AllowHeredoc: true
1812
+ AllowURI: true
1813
+ URISchemes:
1814
+ - http
1815
+ - https
1816
+ # The IgnoreCopDirectives option causes the LineLength rule to ignore cop
1817
+ # directives like '# rubocop: enable ...' when calculating a line's length.
1818
+ IgnoreCopDirectives: true
1819
+ # The IgnoredPatterns option is a list of !ruby/regexp and/or string
1820
+ # elements. Strings will be converted to Regexp objects. A line that matches
1821
+ # any regular expression listed in this option will be ignored by LineLength.
1822
+ IgnoredPatterns: []
1823
+
1824
+ Metrics/MethodLength:
1825
+ Description: 'Avoid methods longer than 10 lines of code.'
1826
+ StyleGuide: '#short-methods'
1827
+ Enabled: true
1828
+ VersionAdded: '0.25'
1829
+ VersionChanged: '0.59.2'
1830
+ CountComments: false # count full line comments?
1831
+ Max: 10
1832
+ ExcludedMethods: []
1833
+
1834
+ Metrics/ModuleLength:
1835
+ Description: 'Avoid modules longer than 100 lines of code.'
1836
+ Enabled: true
1837
+ VersionAdded: '0.31'
1838
+ CountComments: false # count full line comments?
1839
+ Max: 100
1840
+
1841
+ Metrics/ParameterLists:
1842
+ Description: 'Avoid parameter lists longer than three or four parameters.'
1843
+ StyleGuide: '#too-many-params'
1844
+ Enabled: true
1845
+ VersionAdded: '0.25'
1846
+ Max: 5
1847
+ CountKeywordArgs: true
1848
+
1849
+ Metrics/PerceivedComplexity:
1850
+ Description: >-
1851
+ A complexity metric geared towards measuring complexity for a
1852
+ human reader.
1853
+ Enabled: true
1854
+ VersionAdded: '0.25'
1855
+ Max: 7
1856
+
1857
+ ################## Migration #############################
1858
+
1859
+ Migration/DepartmentName:
1860
+ Description: >-
1861
+ Check that cop names in rubocop:disable (etc) comments are
1862
+ given with department name.
1863
+ Enabled: false
1864
+
1865
+ #################### Naming ##############################
1866
+
1867
+ Naming/AccessorMethodName:
1868
+ Description: Check the naming of accessor methods for get_/set_.
1869
+ StyleGuide: '#accessor_mutator_method_names'
1870
+ Enabled: true
1871
+ VersionAdded: '0.50'
1872
+
1873
+ Naming/AsciiIdentifiers:
1874
+ Description: 'Use only ascii symbols in identifiers.'
1875
+ StyleGuide: '#english-identifiers'
1876
+ Enabled: true
1877
+ VersionAdded: '0.50'
1878
+
1879
+ Naming/BinaryOperatorParameterName:
1880
+ Description: 'When defining binary operators, name the argument other.'
1881
+ StyleGuide: '#other-arg'
1882
+ Enabled: true
1883
+ VersionAdded: '0.50'
1884
+
1885
+ Naming/ClassAndModuleCamelCase:
1886
+ Description: 'Use CamelCase for classes and modules.'
1887
+ StyleGuide: '#camelcase-classes'
1888
+ Enabled: true
1889
+ VersionAdded: '0.50'
1890
+
1891
+ Naming/ConstantName:
1892
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
1893
+ StyleGuide: '#screaming-snake-case'
1894
+ Enabled: true
1895
+ VersionAdded: '0.50'
1896
+
1897
+ Naming/FileName:
1898
+ Description: 'Use snake_case for source file names.'
1899
+ StyleGuide: '#snake-case-files'
1900
+ Enabled: true
1901
+ VersionAdded: '0.50'
1902
+ # Camel case file names listed in `AllCops:Include` and all file names listed
1903
+ # in `AllCops:Exclude` are excluded by default. Add extra excludes here.
1904
+ Exclude: []
1905
+ # When `true`, requires that each source file should define a class or module
1906
+ # with a name which matches the file name (converted to ... case).
1907
+ # It further expects it to be nested inside modules which match the names
1908
+ # of subdirectories in its path.
1909
+ ExpectMatchingDefinition: false
1910
+ # If non-`nil`, expect all source file names to match the following regex.
1911
+ # Only the file name itself is matched, not the entire file path.
1912
+ # Use anchors as necessary if you want to match the entire name rather than
1913
+ # just a part of it.
1914
+ Regex: ~
1915
+ # With `IgnoreExecutableScripts` set to `true`, this cop does not
1916
+ # report offending filenames for executable scripts (i.e. source
1917
+ # files with a shebang in the first line).
1918
+ IgnoreExecutableScripts: true
1919
+ AllowedAcronyms:
1920
+ - CLI
1921
+ - DSL
1922
+ - ACL
1923
+ - API
1924
+ - ASCII
1925
+ - CPU
1926
+ - CSS
1927
+ - DNS
1928
+ - EOF
1929
+ - GUID
1930
+ - HTML
1931
+ - HTTP
1932
+ - HTTPS
1933
+ - ID
1934
+ - IP
1935
+ - JSON
1936
+ - LHS
1937
+ - QPS
1938
+ - RAM
1939
+ - RHS
1940
+ - RPC
1941
+ - SLA
1942
+ - SMTP
1943
+ - SQL
1944
+ - SSH
1945
+ - TCP
1946
+ - TLS
1947
+ - TTL
1948
+ - UDP
1949
+ - UI
1950
+ - UID
1951
+ - UUID
1952
+ - URI
1953
+ - URL
1954
+ - UTF8
1955
+ - VM
1956
+ - XML
1957
+ - XMPP
1958
+ - XSRF
1959
+ - XSS
1960
+
1961
+ Naming/HeredocDelimiterCase:
1962
+ Description: 'Use configured case for heredoc delimiters.'
1963
+ StyleGuide: '#heredoc-delimiters'
1964
+ Enabled: true
1965
+ VersionAdded: '0.50'
1966
+ EnforcedStyle: uppercase
1967
+ SupportedStyles:
1968
+ - lowercase
1969
+ - uppercase
1970
+
1971
+ Naming/HeredocDelimiterNaming:
1972
+ Description: 'Use descriptive heredoc delimiters.'
1973
+ StyleGuide: '#heredoc-delimiters'
1974
+ Enabled: true
1975
+ VersionAdded: '0.50'
1976
+ Blacklist:
1977
+ - !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
1978
+
1979
+ Naming/MemoizedInstanceVariableName:
1980
+ Description: >-
1981
+ Memoized method name should match memo instance variable name.
1982
+ Enabled: true
1983
+ VersionAdded: '0.53'
1984
+ VersionChanged: '0.58'
1985
+ EnforcedStyleForLeadingUnderscores: disallowed
1986
+ SupportedStylesForLeadingUnderscores:
1987
+ - disallowed
1988
+ - required
1989
+ - optional
1990
+
1991
+ Naming/MethodName:
1992
+ Description: 'Use the configured style when naming methods.'
1993
+ StyleGuide: '#snake-case-symbols-methods-vars'
1994
+ Enabled: true
1995
+ VersionAdded: '0.50'
1996
+ EnforcedStyle: snake_case
1997
+ SupportedStyles:
1998
+ - snake_case
1999
+ - camelCase
2000
+ # Method names matching patterns are always allowed.
2001
+ #
2002
+ # IgnoredPatterns:
2003
+ # - '\A\s*onSelectionBulkChange\s*'
2004
+ # - '\A\s*onSelectionCleared\s*'
2005
+ #
2006
+ IgnoredPatterns: []
2007
+
2008
+ Naming/PredicateName:
2009
+ Description: 'Check the names of predicate methods.'
2010
+ StyleGuide: '#bool-methods-qmark'
2011
+ Enabled: true
2012
+ VersionAdded: '0.50'
2013
+ VersionChanged: '0.51'
2014
+ # Predicate name prefixes.
2015
+ NamePrefix:
2016
+ - is_
2017
+ - has_
2018
+ - have_
2019
+ # Predicate name prefixes that should be removed.
2020
+ NamePrefixBlacklist:
2021
+ - is_
2022
+ - has_
2023
+ - have_
2024
+ # Predicate names which, despite having a blacklisted prefix, or no `?`,
2025
+ # should still be accepted
2026
+ NameWhitelist:
2027
+ - is_a?
2028
+ # Method definition macros for dynamically generated methods.
2029
+ MethodDefinitionMacros:
2030
+ - define_method
2031
+ - define_singleton_method
2032
+ # Exclude Rspec specs because there is a strong convention to write spec
2033
+ # helpers in the form of `have_something` or `be_something`.
2034
+ Exclude:
2035
+ - 'spec/**/*'
2036
+
2037
+ Naming/RescuedExceptionsVariableName:
2038
+ Description: 'Use consistent rescued exceptions variables naming.'
2039
+ Enabled: true
2040
+ VersionAdded: '0.67'
2041
+ VersionChanged: '0.68'
2042
+ PreferredName: e
2043
+
2044
+ Naming/UncommunicativeBlockParamName:
2045
+ Description: >-
2046
+ Checks for block parameter names that contain capital letters,
2047
+ end in numbers, or do not meet a minimal length.
2048
+ Enabled: true
2049
+ VersionAdded: '0.53'
2050
+ # Parameter names may be equal to or greater than this value
2051
+ MinNameLength: 1
2052
+ AllowNamesEndingInNumbers: true
2053
+ # Whitelisted names that will not register an offense
2054
+ AllowedNames: []
2055
+ # Blacklisted names that will register an offense
2056
+ ForbiddenNames: []
2057
+
2058
+ Naming/UncommunicativeMethodParamName:
2059
+ Description: >-
2060
+ Checks for method parameter names that contain capital letters,
2061
+ end in numbers, or do not meet a minimal length.
2062
+ Enabled: true
2063
+ VersionAdded: '0.53'
2064
+ VersionChanged: '0.59'
2065
+ # Parameter names may be equal to or greater than this value
2066
+ MinNameLength: 3
2067
+ AllowNamesEndingInNumbers: true
2068
+ # Whitelisted names that will not register an offense
2069
+ AllowedNames:
2070
+ - io
2071
+ - id
2072
+ - to
2073
+ - by
2074
+ - 'on'
2075
+ - in
2076
+ - at
2077
+ - ip
2078
+ - db
2079
+ # Blacklisted names that will register an offense
2080
+ ForbiddenNames: []
2081
+
2082
+
2083
+ Naming/VariableName:
2084
+ Description: 'Use the configured style when naming variables.'
2085
+ StyleGuide: '#snake-case-symbols-methods-vars'
2086
+ Enabled: true
2087
+ VersionAdded: '0.50'
2088
+ EnforcedStyle: snake_case
2089
+ SupportedStyles:
2090
+ - snake_case
2091
+ - camelCase
2092
+
2093
+ Naming/VariableNumber:
2094
+ Description: 'Use the configured style when numbering variables.'
2095
+ Enabled: true
2096
+ VersionAdded: '0.50'
2097
+ EnforcedStyle: normalcase
2098
+ SupportedStyles:
2099
+ - snake_case
2100
+ - normalcase
2101
+ - non_integer
2102
+
2103
+ #################### Security ##############################
2104
+
2105
+ Security/Eval:
2106
+ Description: 'The use of eval represents a serious security risk.'
2107
+ Enabled: true
2108
+ VersionAdded: '0.47'
2109
+
2110
+ Security/JSONLoad:
2111
+ Description: >-
2112
+ Prefer usage of `JSON.parse` over `JSON.load` due to potential
2113
+ security issues. See reference for more information.
2114
+ Reference: 'https://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
2115
+ Enabled: true
2116
+ VersionAdded: '0.43'
2117
+ VersionChanged: '0.44'
2118
+ # Autocorrect here will change to a method that may cause crashes depending
2119
+ # on the value of the argument.
2120
+ AutoCorrect: false
2121
+ SafeAutoCorrect: false
2122
+
2123
+ Security/MarshalLoad:
2124
+ Description: >-
2125
+ Avoid using of `Marshal.load` or `Marshal.restore` due to potential
2126
+ security issues. See reference for more information.
2127
+ Reference: 'https://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
2128
+ Enabled: true
2129
+ VersionAdded: '0.47'
2130
+
2131
+ Security/Open:
2132
+ Description: 'The use of Kernel#open represents a serious security risk.'
2133
+ Enabled: true
2134
+ VersionAdded: '0.53'
2135
+ Safe: false
2136
+
2137
+ Security/YAMLLoad:
2138
+ Description: >-
2139
+ Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
2140
+ security issues. See reference for more information.
2141
+ Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
2142
+ Enabled: true
2143
+ VersionAdded: '0.47'
2144
+ SafeAutoCorrect: false
2145
+
2146
+ #################### Style ###############################
2147
+
2148
+ Style/AccessModifierDeclarations:
2149
+ Description: 'Checks style of how access modifiers are used.'
2150
+ Enabled: true
2151
+ VersionAdded: '0.57'
2152
+ EnforcedStyle: group
2153
+ SupportedStyles:
2154
+ - inline
2155
+ - group
2156
+
2157
+ Style/Alias:
2158
+ Description: 'Use alias instead of alias_method.'
2159
+ StyleGuide: '#alias-method-lexically'
2160
+ Enabled: true
2161
+ VersionAdded: '0.9'
2162
+ VersionChanged: '0.36'
2163
+ EnforcedStyle: prefer_alias
2164
+ SupportedStyles:
2165
+ - prefer_alias
2166
+ - prefer_alias_method
2167
+
2168
+ Style/AndOr:
2169
+ Description: 'Use &&/|| instead of and/or.'
2170
+ StyleGuide: '#no-and-or-or'
2171
+ Enabled: true
2172
+ VersionAdded: '0.9'
2173
+ VersionChanged: '0.25'
2174
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
2175
+ # or completely (always).
2176
+ EnforcedStyle: always
2177
+ SupportedStyles:
2178
+ - always
2179
+ - conditionals
2180
+
2181
+ Style/ArrayJoin:
2182
+ Description: 'Use Array#join instead of Array#*.'
2183
+ StyleGuide: '#array-join'
2184
+ Enabled: true
2185
+ VersionAdded: '0.20'
2186
+ VersionChanged: '0.31'
2187
+
2188
+ Style/AsciiComments:
2189
+ Description: 'Use only ascii symbols in comments.'
2190
+ StyleGuide: '#english-comments'
2191
+ Enabled: true
2192
+ VersionAdded: '0.9'
2193
+ VersionChanged: '0.52'
2194
+ AllowedChars: []
2195
+
2196
+ Style/Attr:
2197
+ Description: 'Checks for uses of Module#attr.'
2198
+ StyleGuide: '#attr'
2199
+ Enabled: true
2200
+ VersionAdded: '0.9'
2201
+ VersionChanged: '0.12'
2202
+
2203
+ Style/AutoResourceCleanup:
2204
+ Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
2205
+ Enabled: false
2206
+ VersionAdded: '0.30'
2207
+
2208
+ Style/BarePercentLiterals:
2209
+ Description: 'Checks if usage of %() or %Q() matches configuration.'
2210
+ StyleGuide: '#percent-q-shorthand'
2211
+ Enabled: true
2212
+ VersionAdded: '0.25'
2213
+ EnforcedStyle: bare_percent
2214
+ SupportedStyles:
2215
+ - percent_q
2216
+ - bare_percent
2217
+
2218
+ Style/BeginBlock:
2219
+ Description: 'Avoid the use of BEGIN blocks.'
2220
+ StyleGuide: '#no-BEGIN-blocks'
2221
+ Enabled: true
2222
+ VersionAdded: '0.9'
2223
+
2224
+ Style/BlockComments:
2225
+ Description: 'Do not use block comments.'
2226
+ StyleGuide: '#no-block-comments'
2227
+ Enabled: true
2228
+ VersionAdded: '0.9'
2229
+ VersionChanged: '0.23'
2230
+
2231
+ Style/BlockDelimiters:
2232
+ Description: >-
2233
+ Avoid using {...} for multi-line blocks (multiline chaining is
2234
+ always ugly).
2235
+ Prefer {...} over do...end for single-line blocks.
2236
+ StyleGuide: '#single-line-blocks'
2237
+ Enabled: true
2238
+ VersionAdded: '0.30'
2239
+ VersionChanged: '0.35'
2240
+ EnforcedStyle: line_count_based
2241
+ SupportedStyles:
2242
+ # The `line_count_based` style enforces braces around single line blocks and
2243
+ # do..end around multi-line blocks.
2244
+ - line_count_based
2245
+ # The `semantic` style enforces braces around functional blocks, where the
2246
+ # primary purpose of the block is to return a value and do..end for
2247
+ # multi-line procedural blocks, where the primary purpose of the block is
2248
+ # its side-effects. Single-line procedural blocks may only use do-end,
2249
+ # unless AllowBracesOnProceduralOneLiners has a truthy value (see below).
2250
+ #
2251
+ # This looks at the usage of a block's method to determine its type (e.g. is
2252
+ # the result of a `map` assigned to a variable or passed to another
2253
+ # method) but exceptions are permitted in the `ProceduralMethods`,
2254
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
2255
+ - semantic
2256
+ # The `braces_for_chaining` style enforces braces around single line blocks
2257
+ # and do..end around multi-line blocks, except for multi-line blocks whose
2258
+ # return value is being chained with another method (in which case braces
2259
+ # are enforced).
2260
+ - braces_for_chaining
2261
+ # The `always_braces` style always enforces braces.
2262
+ - always_braces
2263
+ ProceduralMethods:
2264
+ # Methods that are known to be procedural in nature but look functional from
2265
+ # their usage, e.g.
2266
+ #
2267
+ # time = Benchmark.realtime do
2268
+ # foo.bar
2269
+ # end
2270
+ #
2271
+ # Here, the return value of the block is discarded but the return value of
2272
+ # `Benchmark.realtime` is used.
2273
+ - benchmark
2274
+ - bm
2275
+ - bmbm
2276
+ - create
2277
+ - each_with_object
2278
+ - measure
2279
+ - new
2280
+ - realtime
2281
+ - tap
2282
+ - with_object
2283
+ FunctionalMethods:
2284
+ # Methods that are known to be functional in nature but look procedural from
2285
+ # their usage, e.g.
2286
+ #
2287
+ # let(:foo) { Foo.new }
2288
+ #
2289
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
2290
+ # doesn't appear to be used from the return value of `let`.
2291
+ - let
2292
+ - let!
2293
+ - subject
2294
+ - watch
2295
+ IgnoredMethods:
2296
+ # Methods that can be either procedural or functional and cannot be
2297
+ # categorised from their usage alone, e.g.
2298
+ #
2299
+ # foo = lambda do |x|
2300
+ # puts "Hello, #{x}"
2301
+ # end
2302
+ #
2303
+ # foo = lambda do |x|
2304
+ # x * 100
2305
+ # end
2306
+ #
2307
+ # Here, it is impossible to tell from the return value of `lambda` whether
2308
+ # the inner block's return value is significant.
2309
+ - lambda
2310
+ - proc
2311
+ - it
2312
+ # The AllowBracesOnProceduralOneLiners option is ignored unless the
2313
+ # EnforcedStyle is set to `semantic`. If so:
2314
+ #
2315
+ # If AllowBracesOnProceduralOneLiners is unspecified, or set to any
2316
+ # falsey value, then semantic purity is maintained, so one-line
2317
+ # procedural blocks must use do-end, not braces.
2318
+ #
2319
+ # # bad
2320
+ # collection.each { |element| puts element }
2321
+ #
2322
+ # # good
2323
+ # collection.each do |element| puts element end
2324
+ #
2325
+ # If AllowBracesOnProceduralOneLiners is set to any truthy value,
2326
+ # then one-line procedural blocks may use either style.
2327
+ #
2328
+ # # good
2329
+ # collection.each { |element| puts element }
2330
+ #
2331
+ # # also good
2332
+ # collection.each do |element| puts element end
2333
+ AllowBracesOnProceduralOneLiners: false
2334
+
2335
+ Style/BracesAroundHashParameters:
2336
+ Description: 'Enforce braces style around hash parameters.'
2337
+ Enabled: true
2338
+ VersionAdded: '0.14.1'
2339
+ VersionChanged: '0.28'
2340
+ EnforcedStyle: no_braces
2341
+ SupportedStyles:
2342
+ # The `braces` style enforces braces around all method parameters that are
2343
+ # hashes.
2344
+ - braces
2345
+ # The `no_braces` style checks that the last parameter doesn't have braces
2346
+ # around it.
2347
+ - no_braces
2348
+ # The `context_dependent` style checks that the last parameter doesn't have
2349
+ # braces around it, but requires braces if the second to last parameter is
2350
+ # also a hash literal.
2351
+ - context_dependent
2352
+
2353
+ Style/CaseEquality:
2354
+ Description: 'Avoid explicit use of the case equality operator(===).'
2355
+ StyleGuide: '#no-case-equality'
2356
+ Enabled: true
2357
+ VersionAdded: '0.9'
2358
+
2359
+ Style/CharacterLiteral:
2360
+ Description: 'Checks for uses of character literals.'
2361
+ StyleGuide: '#no-character-literals'
2362
+ Enabled: true
2363
+ VersionAdded: '0.9'
2364
+
2365
+ Style/ClassAndModuleChildren:
2366
+ Description: 'Checks style of children classes and modules.'
2367
+ StyleGuide: '#namespace-definition'
2368
+ # Moving from compact to nested children requires knowledge of whether the
2369
+ # outer parent is a module or a class. Moving from nested to compact requires
2370
+ # verification that the outer parent is defined elsewhere. Rubocop does not
2371
+ # have the knowledge to perform either operation safely and thus requires
2372
+ # manual oversight.
2373
+ SafeAutoCorrect: false
2374
+ AutoCorrect: false
2375
+ Enabled: true
2376
+ VersionAdded: '0.19'
2377
+ #
2378
+ # Basically there are two different styles:
2379
+ #
2380
+ # `nested` - have each child on a separate line
2381
+ # class Foo
2382
+ # class Bar
2383
+ # end
2384
+ # end
2385
+ #
2386
+ # `compact` - combine definitions as much as possible
2387
+ # class Foo::Bar
2388
+ # end
2389
+ #
2390
+ # The compact style is only forced, for classes or modules with one child.
2391
+ EnforcedStyle: nested
2392
+ SupportedStyles:
2393
+ - nested
2394
+ - compact
2395
+
2396
+ Style/ClassCheck:
2397
+ Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
2398
+ Enabled: true
2399
+ VersionAdded: '0.24'
2400
+ EnforcedStyle: is_a?
2401
+ SupportedStyles:
2402
+ - is_a?
2403
+ - kind_of?
2404
+
2405
+ Style/ClassMethods:
2406
+ Description: 'Use self when defining module/class methods.'
2407
+ StyleGuide: '#def-self-class-methods'
2408
+ Enabled: true
2409
+ VersionAdded: '0.9'
2410
+ VersionChanged: '0.20'
2411
+
2412
+ Style/ClassVars:
2413
+ Description: 'Avoid the use of class variables.'
2414
+ StyleGuide: '#no-class-vars'
2415
+ Enabled: true
2416
+ VersionAdded: '0.13'
2417
+
2418
+ # Align with the style guide.
2419
+ Style/CollectionMethods:
2420
+ Description: 'Preferred collection methods.'
2421
+ StyleGuide: '#map-find-select-reduce-size'
2422
+ Enabled: false
2423
+ VersionAdded: '0.9'
2424
+ VersionChanged: '0.27'
2425
+ Safe: false
2426
+ # Mapping from undesired method to desired method
2427
+ # e.g. to use `detect` over `find`:
2428
+ #
2429
+ # Style/CollectionMethods:
2430
+ # PreferredMethods:
2431
+ # find: detect
2432
+ PreferredMethods:
2433
+ collect: 'map'
2434
+ collect!: 'map!'
2435
+ inject: 'reduce'
2436
+ detect: 'find'
2437
+ find_all: 'select'
2438
+
2439
+ Style/ColonMethodCall:
2440
+ Description: 'Do not use :: for method call.'
2441
+ StyleGuide: '#double-colons'
2442
+ Enabled: true
2443
+ VersionAdded: '0.9'
2444
+
2445
+ Style/ColonMethodDefinition:
2446
+ Description: 'Do not use :: for defining class methods.'
2447
+ StyleGuide: '#colon-method-definition'
2448
+ Enabled: true
2449
+ VersionAdded: '0.52'
2450
+
2451
+ Style/CommandLiteral:
2452
+ Description: 'Use `` or %x around command literals.'
2453
+ StyleGuide: '#percent-x'
2454
+ Enabled: true
2455
+ VersionAdded: '0.30'
2456
+ EnforcedStyle: backticks
2457
+ # backticks: Always use backticks.
2458
+ # percent_x: Always use `%x`.
2459
+ # mixed: Use backticks on single-line commands, and `%x` on multi-line commands.
2460
+ SupportedStyles:
2461
+ - backticks
2462
+ - percent_x
2463
+ - mixed
2464
+ # If `false`, the cop will always recommend using `%x` if one or more backticks
2465
+ # are found in the command string.
2466
+ AllowInnerBackticks: false
2467
+
2468
+ # Checks formatting of special comments
2469
+ Style/CommentAnnotation:
2470
+ Description: >-
2471
+ Checks formatting of special comments
2472
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
2473
+ StyleGuide: '#annotate-keywords'
2474
+ Enabled: true
2475
+ VersionAdded: '0.10'
2476
+ VersionChanged: '0.31'
2477
+ Keywords:
2478
+ - TODO
2479
+ - FIXME
2480
+ - OPTIMIZE
2481
+ - HACK
2482
+ - REVIEW
2483
+
2484
+ Style/CommentedKeyword:
2485
+ Description: 'Do not place comments on the same line as certain keywords.'
2486
+ Enabled: true
2487
+ VersionAdded: '0.51'
2488
+
2489
+ Style/ConditionalAssignment:
2490
+ Description: >-
2491
+ Use the return value of `if` and `case` statements for
2492
+ assignment to a variable and variable comparison instead
2493
+ of assigning that variable inside of each branch.
2494
+ Enabled: true
2495
+ VersionAdded: '0.36'
2496
+ VersionChanged: '0.47'
2497
+ EnforcedStyle: assign_to_condition
2498
+ SupportedStyles:
2499
+ - assign_to_condition
2500
+ - assign_inside_condition
2501
+ # When configured to `assign_to_condition`, `SingleLineConditionsOnly`
2502
+ # will only register an offense when all branches of a condition are
2503
+ # a single line.
2504
+ # When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
2505
+ # will only register an offense for assignment to a condition that has
2506
+ # at least one multiline branch.
2507
+ SingleLineConditionsOnly: true
2508
+ IncludeTernaryExpressions: true
2509
+
2510
+ Style/ConstantVisibility:
2511
+ Description: >-
2512
+ Check that class- and module constants have
2513
+ visibility declarations.
2514
+ Enabled: false
2515
+ VersionAdded: '0.66'
2516
+
2517
+ # Checks that you have put a copyright in a comment before any code.
2518
+ #
2519
+ # You can override the default Notice in your .rubocop.yml file.
2520
+ #
2521
+ # In order to use autocorrect, you must supply a value for the
2522
+ # `AutocorrectNotice` key that matches the regexp Notice. A blank
2523
+ # `AutocorrectNotice` will cause an error during autocorrect.
2524
+ #
2525
+ # Autocorrect will add a copyright notice in a comment at the top
2526
+ # of the file immediately after any shebang or encoding comments.
2527
+ #
2528
+ # Example rubocop.yml:
2529
+ #
2530
+ # Style/Copyright:
2531
+ # Enabled: true
2532
+ # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
2533
+ # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
2534
+ #
2535
+ Style/Copyright:
2536
+ Description: 'Include a copyright notice in each file before any code.'
2537
+ Enabled: false
2538
+ VersionAdded: '0.30'
2539
+ Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
2540
+ AutocorrectNotice: ''
2541
+
2542
+ Style/DateTime:
2543
+ Description: 'Use Time over DateTime.'
2544
+ StyleGuide: '#date--time'
2545
+ Enabled: false
2546
+ VersionAdded: '0.51'
2547
+ VersionChanged: '0.59'
2548
+ AllowCoercion: false
2549
+
2550
+ Style/DefWithParentheses:
2551
+ Description: 'Use def with parentheses when there are arguments.'
2552
+ StyleGuide: '#method-parens'
2553
+ Enabled: true
2554
+ VersionAdded: '0.9'
2555
+ VersionChanged: '0.12'
2556
+
2557
+ Style/Dir:
2558
+ Description: >-
2559
+ Use the `__dir__` method to retrieve the canonicalized
2560
+ absolute path to the current file.
2561
+ Enabled: true
2562
+ VersionAdded: '0.50'
2563
+
2564
+ Style/Documentation:
2565
+ Description: 'Document classes and non-namespace modules.'
2566
+ Enabled: true
2567
+ VersionAdded: '0.9'
2568
+ Exclude:
2569
+ - 'spec/**/*'
2570
+ - 'test/**/*'
2571
+
2572
+ Style/DocumentationMethod:
2573
+ Description: 'Checks for missing documentation comment for public methods.'
2574
+ Enabled: false
2575
+ VersionAdded: '0.43'
2576
+ Exclude:
2577
+ - 'spec/**/*'
2578
+ - 'test/**/*'
2579
+ RequireForNonPublicMethods: false
2580
+
2581
+ Style/DoubleCopDisableDirective:
2582
+ Description: 'Checks for double rubocop:disable comments on a single line.'
2583
+ Enabled: true
2584
+ VersionAdded: '0.73'
2585
+
2586
+ Style/DoubleNegation:
2587
+ Description: 'Checks for uses of double negation (!!).'
2588
+ StyleGuide: '#no-bang-bang'
2589
+ Enabled: true
2590
+ VersionAdded: '0.19'
2591
+
2592
+ Style/EachForSimpleLoop:
2593
+ Description: >-
2594
+ Use `Integer#times` for a simple loop which iterates a fixed
2595
+ number of times.
2596
+ Enabled: true
2597
+ VersionAdded: '0.41'
2598
+
2599
+ Style/EachWithObject:
2600
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
2601
+ Enabled: true
2602
+ VersionAdded: '0.22'
2603
+ VersionChanged: '0.42'
2604
+
2605
+ Style/EmptyBlockParameter:
2606
+ Description: 'Omit pipes for empty block parameters.'
2607
+ Enabled: true
2608
+ VersionAdded: '0.52'
2609
+
2610
+ Style/EmptyCaseCondition:
2611
+ Description: 'Avoid empty condition in case statements.'
2612
+ Enabled: true
2613
+ VersionAdded: '0.40'
2614
+
2615
+ Style/EmptyElse:
2616
+ Description: 'Avoid empty else-clauses.'
2617
+ Enabled: true
2618
+ VersionAdded: '0.28'
2619
+ VersionChanged: '0.32'
2620
+ EnforcedStyle: both
2621
+ # empty - warn only on empty `else`
2622
+ # nil - warn on `else` with nil in it
2623
+ # both - warn on empty `else` and `else` with `nil` in it
2624
+ SupportedStyles:
2625
+ - empty
2626
+ - nil
2627
+ - both
2628
+
2629
+ Style/EmptyLambdaParameter:
2630
+ Description: 'Omit parens for empty lambda parameters.'
2631
+ Enabled: true
2632
+ VersionAdded: '0.52'
2633
+
2634
+ Style/EmptyLiteral:
2635
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
2636
+ StyleGuide: '#literal-array-hash'
2637
+ Enabled: true
2638
+ VersionAdded: '0.9'
2639
+ VersionChanged: '0.12'
2640
+
2641
+ Style/EmptyMethod:
2642
+ Description: 'Checks the formatting of empty method definitions.'
2643
+ StyleGuide: '#no-single-line-methods'
2644
+ Enabled: true
2645
+ VersionAdded: '0.46'
2646
+ EnforcedStyle: compact
2647
+ SupportedStyles:
2648
+ - compact
2649
+ - expanded
2650
+
2651
+ Style/Encoding:
2652
+ Description: 'Use UTF-8 as the source file encoding.'
2653
+ StyleGuide: '#utf-8'
2654
+ Enabled: true
2655
+ VersionAdded: '0.9'
2656
+ VersionChanged: '0.50'
2657
+
2658
+ Style/EndBlock:
2659
+ Description: 'Avoid the use of END blocks.'
2660
+ StyleGuide: '#no-END-blocks'
2661
+ Enabled: true
2662
+ VersionAdded: '0.9'
2663
+
2664
+ Style/EvalWithLocation:
2665
+ Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
2666
+ Enabled: true
2667
+ VersionAdded: '0.52'
2668
+
2669
+ Style/EvenOdd:
2670
+ Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
2671
+ StyleGuide: '#predicate-methods'
2672
+ Enabled: true
2673
+ VersionAdded: '0.12'
2674
+ VersionChanged: '0.29'
2675
+
2676
+ Style/ExpandPathArguments:
2677
+ Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
2678
+ Enabled: true
2679
+ VersionAdded: '0.53'
2680
+
2681
+ Style/FloatDivision:
2682
+ Description: 'For performing float division, coerce one side only.'
2683
+ StyleGuide: '#float-division'
2684
+ Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
2685
+ Enabled: true
2686
+ VersionAdded: '0.72'
2687
+ EnforcedStyle: single_coerce
2688
+ SupportedStyles:
2689
+ - left_coerce
2690
+ - right_coerce
2691
+ - single_coerce
2692
+ - fdiv
2693
+
2694
+ Style/For:
2695
+ Description: 'Checks use of for or each in multiline loops.'
2696
+ StyleGuide: '#no-for-loops'
2697
+ Enabled: true
2698
+ VersionAdded: '0.13'
2699
+ VersionChanged: '0.59'
2700
+ EnforcedStyle: each
2701
+ SupportedStyles:
2702
+ - each
2703
+ - for
2704
+
2705
+ Style/FormatString:
2706
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
2707
+ StyleGuide: '#sprintf'
2708
+ Enabled: true
2709
+ VersionAdded: '0.19'
2710
+ VersionChanged: '0.49'
2711
+ EnforcedStyle: format
2712
+ SupportedStyles:
2713
+ - format
2714
+ - sprintf
2715
+ - percent
2716
+
2717
+ Style/FormatStringToken:
2718
+ Description: 'Use a consistent style for format string tokens.'
2719
+ Enabled: true
2720
+ EnforcedStyle: annotated
2721
+ SupportedStyles:
2722
+ # Prefer tokens which contain a sprintf like type annotation like
2723
+ # `%<name>s`, `%<age>d`, `%<score>f`
2724
+ - annotated
2725
+ # Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
2726
+ - template
2727
+ - unannotated
2728
+ VersionAdded: '0.49'
2729
+ VersionChanged: '0.75'
2730
+
2731
+ Style/FrozenStringLiteralComment:
2732
+ Description: >-
2733
+ Add the frozen_string_literal comment to the top of files
2734
+ to help transition to frozen string literals by default.
2735
+ Enabled: true
2736
+ VersionAdded: '0.36'
2737
+ VersionChanged: '0.69'
2738
+ EnforcedStyle: always
2739
+ SupportedStyles:
2740
+ # `always` will always add the frozen string literal comment to a file
2741
+ # regardless of the Ruby version or if `freeze` or `<<` are called on a
2742
+ # string literal. If you run code against multiple versions of Ruby, it is
2743
+ # possible that this will create errors in Ruby 2.3.0+.
2744
+ - always
2745
+ # `never` will enforce that the frozen string literal comment does not
2746
+ # exist in a file.
2747
+ - never
2748
+
2749
+ Style/GlobalVars:
2750
+ Description: 'Do not introduce global variables.'
2751
+ StyleGuide: '#instance-vars'
2752
+ Reference: 'https://www.zenspider.com/ruby/quickref.html'
2753
+ Enabled: true
2754
+ VersionAdded: '0.13'
2755
+ # Built-in global variables are allowed by default.
2756
+ AllowedVariables: []
2757
+
2758
+ Style/GuardClause:
2759
+ Description: 'Check for conditionals that can be replaced with guard clauses.'
2760
+ StyleGuide: '#no-nested-conditionals'
2761
+ Enabled: true
2762
+ VersionAdded: '0.20'
2763
+ VersionChanged: '0.22'
2764
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
2765
+ # needs to have to trigger this cop
2766
+ MinBodyLength: 1
2767
+
2768
+ Style/HashSyntax:
2769
+ Description: >-
2770
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
2771
+ { :a => 1, :b => 2 }.
2772
+ StyleGuide: '#hash-literals'
2773
+ Enabled: true
2774
+ VersionAdded: '0.9'
2775
+ VersionChanged: '0.43'
2776
+ EnforcedStyle: ruby19
2777
+ SupportedStyles:
2778
+ # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
2779
+ - ruby19
2780
+ # checks for hash rocket syntax for all hashes
2781
+ - hash_rockets
2782
+ # forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
2783
+ - no_mixed_keys
2784
+ # enforces both ruby19 and no_mixed_keys styles
2785
+ - ruby19_no_mixed_keys
2786
+ # Force hashes that have a symbol value to use hash rockets
2787
+ UseHashRocketsWithSymbolValues: false
2788
+ # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
2789
+ PreferHashRocketsForNonAlnumEndingSymbols: false
2790
+
2791
+ Style/IdenticalConditionalBranches:
2792
+ Description: >-
2793
+ Checks that conditional statements do not have an identical
2794
+ line at the end of each branch, which can validly be moved
2795
+ out of the conditional.
2796
+ Enabled: true
2797
+ VersionAdded: '0.36'
2798
+
2799
+ Style/IfInsideElse:
2800
+ Description: 'Finds if nodes inside else, which can be converted to elsif.'
2801
+ Enabled: true
2802
+ AllowIfModifier: false
2803
+ VersionAdded: '0.36'
2804
+
2805
+ Style/IfUnlessModifier:
2806
+ Description: >-
2807
+ Favor modifier if/unless usage when you have a
2808
+ single-line body.
2809
+ StyleGuide: '#if-as-a-modifier'
2810
+ Enabled: true
2811
+ VersionAdded: '0.9'
2812
+ VersionChanged: '0.30'
2813
+
2814
+ Style/IfUnlessModifierOfIfUnless:
2815
+ Description: >-
2816
+ Avoid modifier if/unless usage on conditionals.
2817
+ Enabled: true
2818
+ VersionAdded: '0.39'
2819
+
2820
+ Style/IfWithSemicolon:
2821
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
2822
+ StyleGuide: '#no-semicolon-ifs'
2823
+ Enabled: true
2824
+ VersionAdded: '0.9'
2825
+
2826
+ Style/ImplicitRuntimeError:
2827
+ Description: >-
2828
+ Use `raise` or `fail` with an explicit exception class and
2829
+ message, rather than just a message.
2830
+ Enabled: false
2831
+ VersionAdded: '0.41'
2832
+
2833
+ Style/InfiniteLoop:
2834
+ Description: 'Use Kernel#loop for infinite loops.'
2835
+ StyleGuide: '#infinite-loop'
2836
+ Enabled: true
2837
+ VersionAdded: '0.26'
2838
+ VersionChanged: '0.61'
2839
+ SafeAutoCorrect: true
2840
+
2841
+ Style/InlineComment:
2842
+ Description: 'Avoid trailing inline comments.'
2843
+ Enabled: false
2844
+ VersionAdded: '0.23'
2845
+
2846
+ Style/InverseMethods:
2847
+ Description: >-
2848
+ Use the inverse method instead of `!.method`
2849
+ if an inverse method is defined.
2850
+ Enabled: true
2851
+ Safe: false
2852
+ VersionAdded: '0.48'
2853
+ # `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
2854
+ # The relationship of inverse methods only needs to be defined in one direction.
2855
+ # Keys and values both need to be defined as symbols.
2856
+ InverseMethods:
2857
+ :any?: :none?
2858
+ :even?: :odd?
2859
+ :==: :!=
2860
+ :=~: :!~
2861
+ :<: :>=
2862
+ :>: :<=
2863
+ # `ActiveSupport` defines some common inverse methods. They are listed below,
2864
+ # and not enabled by default.
2865
+ #:present?: :blank?,
2866
+ #:include?: :exclude?
2867
+ # `InverseBlocks` are methods that are inverted by inverting the return
2868
+ # of the block that is passed to the method
2869
+ InverseBlocks:
2870
+ :select: :reject
2871
+ :select!: :reject!
2872
+
2873
+ Style/IpAddresses:
2874
+ Description: "Don't include literal IP addresses in code."
2875
+ Enabled: false
2876
+ VersionAdded: '0.58'
2877
+ # Allow strings to be whitelisted
2878
+ Whitelist:
2879
+ - "::"
2880
+ # :: is a valid IPv6 address, but could potentially be legitimately in code
2881
+
2882
+ Style/Lambda:
2883
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
2884
+ StyleGuide: '#lambda-multi-line'
2885
+ Enabled: true
2886
+ VersionAdded: '0.9'
2887
+ VersionChanged: '0.40'
2888
+ EnforcedStyle: line_count_dependent
2889
+ SupportedStyles:
2890
+ - line_count_dependent
2891
+ - lambda
2892
+ - literal
2893
+
2894
+ Style/LambdaCall:
2895
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
2896
+ StyleGuide: '#proc-call'
2897
+ Enabled: true
2898
+ VersionAdded: '0.13.1'
2899
+ VersionChanged: '0.14'
2900
+ EnforcedStyle: call
2901
+ SupportedStyles:
2902
+ - call
2903
+ - braces
2904
+
2905
+ Style/LineEndConcatenation:
2906
+ Description: >-
2907
+ Use \ instead of + or << to concatenate two string literals at
2908
+ line end.
2909
+ Enabled: true
2910
+ SafeAutoCorrect: false
2911
+ VersionAdded: '0.18'
2912
+ VersionChanged: '0.64'
2913
+
2914
+ Style/MethodCallWithArgsParentheses:
2915
+ Description: 'Use parentheses for method calls with arguments.'
2916
+ StyleGuide: '#method-invocation-parens'
2917
+ Enabled: false
2918
+ VersionAdded: '0.47'
2919
+ VersionChanged: '0.61'
2920
+ IgnoreMacros: true
2921
+ IgnoredMethods: []
2922
+ IgnoredPatterns: []
2923
+ IncludedMacros: []
2924
+ AllowParenthesesInMultilineCall: false
2925
+ AllowParenthesesInChaining: false
2926
+ AllowParenthesesInCamelCaseMethod: false
2927
+ EnforcedStyle: require_parentheses
2928
+ SupportedStyles:
2929
+ - require_parentheses
2930
+ - omit_parentheses
2931
+
2932
+ Style/MethodCallWithoutArgsParentheses:
2933
+ Description: 'Do not use parentheses for method calls with no arguments.'
2934
+ StyleGuide: '#method-invocation-parens'
2935
+ Enabled: true
2936
+ IgnoredMethods: []
2937
+ VersionAdded: '0.47'
2938
+ VersionChanged: '0.55'
2939
+
2940
+ Style/MethodCalledOnDoEndBlock:
2941
+ Description: 'Avoid chaining a method call on a do...end block.'
2942
+ StyleGuide: '#single-line-blocks'
2943
+ Enabled: false
2944
+ VersionAdded: '0.14'
2945
+
2946
+ Style/MethodDefParentheses:
2947
+ Description: >-
2948
+ Checks if the method definitions have or don't have
2949
+ parentheses.
2950
+ StyleGuide: '#method-parens'
2951
+ Enabled: true
2952
+ VersionAdded: '0.16'
2953
+ VersionChanged: '0.35'
2954
+ EnforcedStyle: require_parentheses
2955
+ SupportedStyles:
2956
+ - require_parentheses
2957
+ - require_no_parentheses
2958
+ - require_no_parentheses_except_multiline
2959
+
2960
+ Style/MethodMissingSuper:
2961
+ Description: Checks for `method_missing` to call `super`.
2962
+ StyleGuide: '#no-method-missing'
2963
+ Enabled: true
2964
+ VersionAdded: '0.56'
2965
+
2966
+ Style/MinMax:
2967
+ Description: >-
2968
+ Use `Enumerable#minmax` instead of `Enumerable#min`
2969
+ and `Enumerable#max` in conjunction.
2970
+ Enabled: true
2971
+ VersionAdded: '0.50'
2972
+
2973
+ Style/MissingElse:
2974
+ Description: >-
2975
+ Require if/case expressions to have an else branches.
2976
+ If enabled, it is recommended that
2977
+ Style/UnlessElse and Style/EmptyElse be enabled.
2978
+ This will conflict with Style/EmptyElse if
2979
+ Style/EmptyElse is configured to style "both".
2980
+ Enabled: false
2981
+ VersionAdded: '0.30'
2982
+ VersionChanged: '0.38'
2983
+ EnforcedStyle: both
2984
+ SupportedStyles:
2985
+ # if - warn when an if expression is missing an else branch
2986
+ # case - warn when a case expression is missing an else branch
2987
+ # both - warn when an if or case expression is missing an else branch
2988
+ - if
2989
+ - case
2990
+ - both
2991
+
2992
+ Style/MissingRespondToMissing:
2993
+ Description: >-
2994
+ Checks if `method_missing` is implemented
2995
+ without implementing `respond_to_missing`.
2996
+ StyleGuide: '#no-method-missing'
2997
+ Enabled: true
2998
+ VersionAdded: '0.56'
2999
+
3000
+ Style/MixinGrouping:
3001
+ Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
3002
+ StyleGuide: '#mixin-grouping'
3003
+ Enabled: true
3004
+ VersionAdded: '0.48'
3005
+ VersionChanged: '0.49'
3006
+ EnforcedStyle: separated
3007
+ SupportedStyles:
3008
+ # separated: each mixed in module goes in a separate statement.
3009
+ # grouped: mixed in modules are grouped into a single statement.
3010
+ - separated
3011
+ - grouped
3012
+
3013
+ Style/MixinUsage:
3014
+ Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
3015
+ Enabled: true
3016
+ VersionAdded: '0.51'
3017
+
3018
+ Style/ModuleFunction:
3019
+ Description: 'Checks for usage of `extend self` in modules.'
3020
+ StyleGuide: '#module-function'
3021
+ Enabled: true
3022
+ VersionAdded: '0.11'
3023
+ VersionChanged: '0.65'
3024
+ EnforcedStyle: module_function
3025
+ SupportedStyles:
3026
+ - module_function
3027
+ - extend_self
3028
+ Autocorrect: false
3029
+ SafeAutoCorrect: false
3030
+
3031
+ Style/MultilineBlockChain:
3032
+ Description: 'Avoid multi-line chains of blocks.'
3033
+ StyleGuide: '#single-line-blocks'
3034
+ Enabled: true
3035
+ VersionAdded: '0.13'
3036
+
3037
+ Style/MultilineIfModifier:
3038
+ Description: 'Only use if/unless modifiers on single line statements.'
3039
+ StyleGuide: '#no-multiline-if-modifiers'
3040
+ Enabled: true
3041
+ VersionAdded: '0.45'
3042
+
3043
+ Style/MultilineIfThen:
3044
+ Description: 'Do not use then for multi-line if/unless.'
3045
+ StyleGuide: '#no-then'
3046
+ Enabled: true
3047
+ VersionAdded: '0.9'
3048
+ VersionChanged: '0.26'
3049
+
3050
+ Style/MultilineMemoization:
3051
+ Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
3052
+ Enabled: true
3053
+ VersionAdded: '0.44'
3054
+ VersionChanged: '0.48'
3055
+ EnforcedStyle: keyword
3056
+ SupportedStyles:
3057
+ - keyword
3058
+ - braces
3059
+
3060
+ Style/MultilineMethodSignature:
3061
+ Description: 'Avoid multi-line method signatures.'
3062
+ Enabled: false
3063
+ VersionAdded: '0.59'
3064
+
3065
+ Style/MultilineTernaryOperator:
3066
+ Description: >-
3067
+ Avoid multi-line ?: (the ternary operator);
3068
+ use if/unless instead.
3069
+ StyleGuide: '#no-multiline-ternary'
3070
+ Enabled: true
3071
+ VersionAdded: '0.9'
3072
+
3073
+ Style/MultilineWhenThen:
3074
+ Description: 'Do not use then for multi-line when statement.'
3075
+ StyleGuide: '#no-then'
3076
+ Enabled: true
3077
+ VersionAdded: '0.73'
3078
+
3079
+ Style/MultipleComparison:
3080
+ Description: >-
3081
+ Avoid comparing a variable with multiple items in a conditional,
3082
+ use Array#include? instead.
3083
+ Enabled: true
3084
+ VersionAdded: '0.49'
3085
+
3086
+ Style/MutableConstant:
3087
+ Description: 'Do not assign mutable objects to constants.'
3088
+ Enabled: true
3089
+ VersionAdded: '0.34'
3090
+ VersionChanged: '0.65'
3091
+ EnforcedStyle: literals
3092
+ SupportedStyles:
3093
+ # literals: freeze literals assigned to constants
3094
+ # strict: freeze all constants
3095
+ # Strict mode is considered an experimental feature. It has not been updated
3096
+ # with an exhaustive list of all methods that will produce frozen objects so
3097
+ # there is a decent chance of getting some false positives. Luckily, there is
3098
+ # no harm in freezing an already frozen object.
3099
+ - literals
3100
+ - strict
3101
+
3102
+ Style/NegatedIf:
3103
+ Description: >-
3104
+ Favor unless over if for negative conditions
3105
+ (or control flow or).
3106
+ StyleGuide: '#unless-for-negatives'
3107
+ Enabled: true
3108
+ VersionAdded: '0.20'
3109
+ VersionChanged: '0.48'
3110
+ EnforcedStyle: both
3111
+ SupportedStyles:
3112
+ # both: prefix and postfix negated `if` should both use `unless`
3113
+ # prefix: only use `unless` for negated `if` statements positioned before the body of the statement
3114
+ # postfix: only use `unless` for negated `if` statements positioned after the body of the statement
3115
+ - both
3116
+ - prefix
3117
+ - postfix
3118
+
3119
+ Style/NegatedUnless:
3120
+ Description: 'Favor if over unless for negative conditions.'
3121
+ StyleGuide: '#if-for-negatives'
3122
+ Enabled: true
3123
+ VersionAdded: '0.69'
3124
+ EnforcedStyle: both
3125
+ SupportedStyles:
3126
+ # both: prefix and postfix negated `unless` should both use `if`
3127
+ # prefix: only use `if` for negated `unless` statements positioned before the body of the statement
3128
+ # postfix: only use `if` for negated `unless` statements positioned after the body of the statement
3129
+ - both
3130
+ - prefix
3131
+ - postfix
3132
+
3133
+ Style/NegatedWhile:
3134
+ Description: 'Favor until over while for negative conditions.'
3135
+ StyleGuide: '#until-for-negatives'
3136
+ Enabled: true
3137
+ VersionAdded: '0.20'
3138
+
3139
+ Style/NestedModifier:
3140
+ Description: 'Avoid using nested modifiers.'
3141
+ StyleGuide: '#no-nested-modifiers'
3142
+ Enabled: true
3143
+ VersionAdded: '0.35'
3144
+
3145
+ Style/NestedParenthesizedCalls:
3146
+ Description: >-
3147
+ Parenthesize method calls which are nested inside the
3148
+ argument list of another parenthesized method call.
3149
+ Enabled: true
3150
+ VersionAdded: '0.36'
3151
+ VersionChanged: '0.50'
3152
+ Whitelist:
3153
+ - be
3154
+ - be_a
3155
+ - be_an
3156
+ - be_between
3157
+ - be_falsey
3158
+ - be_kind_of
3159
+ - be_instance_of
3160
+ - be_truthy
3161
+ - be_within
3162
+ - eq
3163
+ - eql
3164
+ - end_with
3165
+ - include
3166
+ - match
3167
+ - raise_error
3168
+ - respond_to
3169
+ - start_with
3170
+
3171
+ Style/NestedTernaryOperator:
3172
+ Description: 'Use one expression per branch in a ternary operator.'
3173
+ StyleGuide: '#no-nested-ternary'
3174
+ Enabled: true
3175
+ VersionAdded: '0.9'
3176
+
3177
+ Style/Next:
3178
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
3179
+ StyleGuide: '#no-nested-conditionals'
3180
+ Enabled: true
3181
+ VersionAdded: '0.22'
3182
+ VersionChanged: '0.35'
3183
+ # With `always` all conditions at the end of an iteration needs to be
3184
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
3185
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
3186
+ EnforcedStyle: skip_modifier_ifs
3187
+ # `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
3188
+ # needs to have to trigger this cop
3189
+ MinBodyLength: 3
3190
+ SupportedStyles:
3191
+ - skip_modifier_ifs
3192
+ - always
3193
+
3194
+ Style/NilComparison:
3195
+ Description: 'Prefer x.nil? to x == nil.'
3196
+ StyleGuide: '#predicate-methods'
3197
+ Enabled: true
3198
+ VersionAdded: '0.12'
3199
+ VersionChanged: '0.59'
3200
+ EnforcedStyle: predicate
3201
+ SupportedStyles:
3202
+ - predicate
3203
+ - comparison
3204
+
3205
+ Style/NonNilCheck:
3206
+ Description: 'Checks for redundant nil checks.'
3207
+ StyleGuide: '#no-non-nil-checks'
3208
+ Enabled: true
3209
+ VersionAdded: '0.20'
3210
+ VersionChanged: '0.22'
3211
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
3212
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
3213
+ # **usually** OK, but might change behavior.
3214
+ #
3215
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
3216
+ # offenses for `!x.nil?` and does no changes that might change behavior.
3217
+ IncludeSemanticChanges: false
3218
+
3219
+ Style/Not:
3220
+ Description: 'Use ! instead of not.'
3221
+ StyleGuide: '#bang-not-not'
3222
+ Enabled: true
3223
+ VersionAdded: '0.9'
3224
+ VersionChanged: '0.20'
3225
+
3226
+ Style/NumericLiteralPrefix:
3227
+ Description: 'Use smallcase prefixes for numeric literals.'
3228
+ StyleGuide: '#numeric-literal-prefixes'
3229
+ Enabled: true
3230
+ VersionAdded: '0.41'
3231
+ EnforcedOctalStyle: zero_with_o
3232
+ SupportedOctalStyles:
3233
+ - zero_with_o
3234
+ - zero_only
3235
+
3236
+
3237
+ Style/NumericLiterals:
3238
+ Description: >-
3239
+ Add underscores to large numeric literals to improve their
3240
+ readability.
3241
+ StyleGuide: '#underscores-in-numerics'
3242
+ Enabled: true
3243
+ VersionAdded: '0.9'
3244
+ VersionChanged: '0.48'
3245
+ MinDigits: 5
3246
+ Strict: false
3247
+
3248
+ Style/NumericPredicate:
3249
+ Description: >-
3250
+ Checks for the use of predicate- or comparison methods for
3251
+ numeric comparisons.
3252
+ StyleGuide: '#predicate-methods'
3253
+ Safe: false
3254
+ # This will change to a new method call which isn't guaranteed to be on the
3255
+ # object. Switching these methods has to be done with knowledge of the types
3256
+ # of the variables which rubocop doesn't have.
3257
+ SafeAutoCorrect: false
3258
+ AutoCorrect: false
3259
+ Enabled: true
3260
+ VersionAdded: '0.42'
3261
+ VersionChanged: '0.59'
3262
+ EnforcedStyle: predicate
3263
+ SupportedStyles:
3264
+ - predicate
3265
+ - comparison
3266
+ IgnoredMethods: []
3267
+ # Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
3268
+ # false positives.
3269
+ Exclude:
3270
+ - 'spec/**/*'
3271
+
3272
+ Style/OneLineConditional:
3273
+ Description: >-
3274
+ Favor the ternary operator(?:) over
3275
+ if/then/else/end constructs.
3276
+ StyleGuide: '#ternary-operator'
3277
+ Enabled: true
3278
+ VersionAdded: '0.9'
3279
+ VersionChanged: '0.38'
3280
+
3281
+ Style/OptionHash:
3282
+ Description: "Don't use option hashes when you can use keyword arguments."
3283
+ Enabled: false
3284
+ VersionAdded: '0.33'
3285
+ VersionChanged: '0.34'
3286
+ # A list of parameter names that will be flagged by this cop.
3287
+ SuspiciousParamNames:
3288
+ - options
3289
+ - opts
3290
+ - args
3291
+ - params
3292
+ - parameters
3293
+
3294
+ Style/OptionalArguments:
3295
+ Description: >-
3296
+ Checks for optional arguments that do not appear at the end
3297
+ of the argument list.
3298
+ StyleGuide: '#optional-arguments'
3299
+ Enabled: true
3300
+ VersionAdded: '0.33'
3301
+
3302
+ Style/OrAssignment:
3303
+ Description: 'Recommend usage of double pipe equals (||=) where applicable.'
3304
+ StyleGuide: '#double-pipe-for-uninit'
3305
+ Enabled: true
3306
+ VersionAdded: '0.50'
3307
+
3308
+ Style/ParallelAssignment:
3309
+ Description: >-
3310
+ Check for simple usages of parallel assignment.
3311
+ It will only warn when the number of variables
3312
+ matches on both sides of the assignment.
3313
+ StyleGuide: '#parallel-assignment'
3314
+ Enabled: true
3315
+ VersionAdded: '0.32'
3316
+
3317
+ Style/ParenthesesAroundCondition:
3318
+ Description: >-
3319
+ Don't use parentheses around the condition of an
3320
+ if/unless/while.
3321
+ StyleGuide: '#no-parens-around-condition'
3322
+ Enabled: true
3323
+ VersionAdded: '0.9'
3324
+ VersionChanged: '0.56'
3325
+ AllowSafeAssignment: true
3326
+ AllowInMultilineConditions: false
3327
+
3328
+ Style/PercentLiteralDelimiters:
3329
+ Description: 'Use `%`-literal delimiters consistently.'
3330
+ StyleGuide: '#percent-literal-braces'
3331
+ Enabled: true
3332
+ VersionAdded: '0.19'
3333
+ # Specify the default preferred delimiter for all types with the 'default' key
3334
+ # Override individual delimiters (even with default specified) by specifying
3335
+ # an individual key
3336
+ PreferredDelimiters:
3337
+ default: ()
3338
+ '%i': '[]'
3339
+ '%I': '[]'
3340
+ '%r': '{}'
3341
+ '%w': '[]'
3342
+ '%W': '[]'
3343
+ VersionChanged: '0.48.1'
3344
+
3345
+ Style/PercentQLiterals:
3346
+ Description: 'Checks if uses of %Q/%q match the configured preference.'
3347
+ Enabled: true
3348
+ VersionAdded: '0.25'
3349
+ EnforcedStyle: lower_case_q
3350
+ SupportedStyles:
3351
+ - lower_case_q # Use `%q` when possible, `%Q` when necessary
3352
+ - upper_case_q # Always use `%Q`
3353
+
3354
+ Style/PerlBackrefs:
3355
+ Description: 'Avoid Perl-style regex back references.'
3356
+ StyleGuide: '#no-perl-regexp-last-matchers'
3357
+ Enabled: true
3358
+ VersionAdded: '0.13'
3359
+
3360
+ Style/PreferredHashMethods:
3361
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
3362
+ StyleGuide: '#hash-key'
3363
+ Enabled: true
3364
+ Safe: false
3365
+ VersionAdded: '0.41'
3366
+ VersionChanged: '0.70'
3367
+ EnforcedStyle: short
3368
+ SupportedStyles:
3369
+ - short
3370
+ - verbose
3371
+
3372
+ Style/Proc:
3373
+ Description: 'Use proc instead of Proc.new.'
3374
+ StyleGuide: '#proc'
3375
+ Enabled: true
3376
+ VersionAdded: '0.9'
3377
+ VersionChanged: '0.18'
3378
+
3379
+ Style/RaiseArgs:
3380
+ Description: 'Checks the arguments passed to raise/fail.'
3381
+ StyleGuide: '#exception-class-messages'
3382
+ Enabled: true
3383
+ VersionAdded: '0.14'
3384
+ VersionChanged: '0.40'
3385
+ EnforcedStyle: exploded
3386
+ SupportedStyles:
3387
+ - compact # raise Exception.new(msg)
3388
+ - exploded # raise Exception, msg
3389
+
3390
+ Style/RandomWithOffset:
3391
+ Description: >-
3392
+ Prefer to use ranges when generating random numbers instead of
3393
+ integers with offsets.
3394
+ StyleGuide: '#random-numbers'
3395
+ Enabled: true
3396
+ VersionAdded: '0.52'
3397
+
3398
+ Style/RedundantBegin:
3399
+ Description: "Don't use begin blocks when they are not needed."
3400
+ StyleGuide: '#begin-implicit'
3401
+ Enabled: true
3402
+ VersionAdded: '0.10'
3403
+ VersionChanged: '0.21'
3404
+
3405
+ Style/RedundantConditional:
3406
+ Description: "Don't return true/false from a conditional."
3407
+ Enabled: true
3408
+ VersionAdded: '0.50'
3409
+
3410
+ Style/RedundantException:
3411
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
3412
+ StyleGuide: '#no-explicit-runtimeerror'
3413
+ Enabled: true
3414
+ VersionAdded: '0.14'
3415
+ VersionChanged: '0.29'
3416
+
3417
+ Style/RedundantFreeze:
3418
+ Description: "Checks usages of Object#freeze on immutable objects."
3419
+ Enabled: true
3420
+ VersionAdded: '0.34'
3421
+ VersionChanged: '0.66'
3422
+
3423
+ Style/RedundantParentheses:
3424
+ Description: "Checks for parentheses that seem not to serve any purpose."
3425
+ Enabled: true
3426
+ VersionAdded: '0.36'
3427
+
3428
+ Style/RedundantReturn:
3429
+ Description: "Don't use return where it's not required."
3430
+ StyleGuide: '#no-explicit-return'
3431
+ Enabled: true
3432
+ VersionAdded: '0.10'
3433
+ VersionChanged: '0.14'
3434
+ # When `true` allows code like `return x, y`.
3435
+ AllowMultipleReturnValues: false
3436
+
3437
+ Style/RedundantSelf:
3438
+ Description: "Don't use self where it's not needed."
3439
+ StyleGuide: '#no-self-unless-required'
3440
+ Enabled: true
3441
+ VersionAdded: '0.10'
3442
+ VersionChanged: '0.13'
3443
+
3444
+ Style/RedundantSortBy:
3445
+ Description: 'Use `sort` instead of `sort_by { |x| x }`.'
3446
+ Enabled: true
3447
+ VersionAdded: '0.36'
3448
+
3449
+ Style/RegexpLiteral:
3450
+ Description: 'Use / or %r around regular expressions.'
3451
+ StyleGuide: '#percent-r'
3452
+ Enabled: true
3453
+ VersionAdded: '0.9'
3454
+ VersionChanged: '0.30'
3455
+ EnforcedStyle: slashes
3456
+ # slashes: Always use slashes.
3457
+ # percent_r: Always use `%r`.
3458
+ # mixed: Use slashes on single-line regexes, and `%r` on multi-line regexes.
3459
+ SupportedStyles:
3460
+ - slashes
3461
+ - percent_r
3462
+ - mixed
3463
+ # If `false`, the cop will always recommend using `%r` if one or more slashes
3464
+ # are found in the regexp string.
3465
+ AllowInnerSlashes: false
3466
+
3467
+ Style/RescueModifier:
3468
+ Description: 'Avoid using rescue in its modifier form.'
3469
+ StyleGuide: '#no-rescue-modifiers'
3470
+ Enabled: true
3471
+ VersionAdded: '0.9'
3472
+ VersionChanged: '0.34'
3473
+
3474
+ Style/RescueStandardError:
3475
+ Description: 'Avoid rescuing without specifying an error class.'
3476
+ Enabled: true
3477
+ VersionAdded: '0.52'
3478
+ EnforcedStyle: explicit
3479
+ # implicit: Do not include the error class, `rescue`
3480
+ # explicit: Require an error class `rescue StandardError`
3481
+ SupportedStyles:
3482
+ - implicit
3483
+ - explicit
3484
+
3485
+ Style/ReturnNil:
3486
+ Description: 'Use return instead of return nil.'
3487
+ Enabled: false
3488
+ EnforcedStyle: return
3489
+ SupportedStyles:
3490
+ - return
3491
+ - return_nil
3492
+ VersionAdded: '0.50'
3493
+
3494
+ Style/SafeNavigation:
3495
+ Description: >-
3496
+ This cop transforms usages of a method call safeguarded by
3497
+ a check for the existence of the object to
3498
+ safe navigation (`&.`).
3499
+ Enabled: true
3500
+ VersionAdded: '0.43'
3501
+ VersionChanged: '0.56'
3502
+ # Safe navigation may cause a statement to start returning `nil` in addition
3503
+ # to whatever it used to return.
3504
+ ConvertCodeThatCanStartToReturnNil: false
3505
+ Whitelist:
3506
+ - present?
3507
+ - blank?
3508
+ - presence
3509
+ - try
3510
+ - try!
3511
+
3512
+ Style/Sample:
3513
+ Description: >-
3514
+ Use `sample` instead of `shuffle.first`,
3515
+ `shuffle.last`, and `shuffle[Integer]`.
3516
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
3517
+ Enabled: true
3518
+ VersionAdded: '0.30'
3519
+
3520
+ Style/SelfAssignment:
3521
+ Description: >-
3522
+ Checks for places where self-assignment shorthand should have
3523
+ been used.
3524
+ StyleGuide: '#self-assignment'
3525
+ Enabled: true
3526
+ VersionAdded: '0.19'
3527
+ VersionChanged: '0.29'
3528
+
3529
+ Style/Semicolon:
3530
+ Description: "Don't use semicolons to terminate expressions."
3531
+ StyleGuide: '#no-semicolon'
3532
+ Enabled: true
3533
+ VersionAdded: '0.9'
3534
+ VersionChanged: '0.19'
3535
+ # Allow `;` to separate several expressions on the same line.
3536
+ AllowAsExpressionSeparator: false
3537
+
3538
+ Style/Send:
3539
+ Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
3540
+ StyleGuide: '#prefer-public-send'
3541
+ Enabled: false
3542
+ VersionAdded: '0.33'
3543
+
3544
+ Style/SignalException:
3545
+ Description: 'Checks for proper usage of fail and raise.'
3546
+ StyleGuide: '#prefer-raise-over-fail'
3547
+ Enabled: true
3548
+ VersionAdded: '0.11'
3549
+ VersionChanged: '0.37'
3550
+ EnforcedStyle: only_raise
3551
+ SupportedStyles:
3552
+ - only_raise
3553
+ - only_fail
3554
+ - semantic
3555
+
3556
+ Style/SingleLineBlockParams:
3557
+ Description: 'Enforces the names of some block params.'
3558
+ Enabled: false
3559
+ VersionAdded: '0.16'
3560
+ VersionChanged: '0.47'
3561
+ Methods:
3562
+ - reduce:
3563
+ - acc
3564
+ - elem
3565
+ - inject:
3566
+ - acc
3567
+ - elem
3568
+
3569
+ Style/SingleLineMethods:
3570
+ Description: 'Avoid single-line methods.'
3571
+ StyleGuide: '#no-single-line-methods'
3572
+ Enabled: true
3573
+ VersionAdded: '0.9'
3574
+ VersionChanged: '0.19'
3575
+ AllowIfMethodIsEmpty: true
3576
+
3577
+ Style/SpecialGlobalVars:
3578
+ Description: 'Avoid Perl-style global variables.'
3579
+ StyleGuide: '#no-cryptic-perlisms'
3580
+ Enabled: true
3581
+ VersionAdded: '0.13'
3582
+ VersionChanged: '0.36'
3583
+ SafeAutoCorrect: false
3584
+ EnforcedStyle: use_english_names
3585
+ SupportedStyles:
3586
+ - use_perl_names
3587
+ - use_english_names
3588
+
3589
+ Style/StabbyLambdaParentheses:
3590
+ Description: 'Check for the usage of parentheses around stabby lambda arguments.'
3591
+ StyleGuide: '#stabby-lambda-with-args'
3592
+ Enabled: true
3593
+ VersionAdded: '0.35'
3594
+ EnforcedStyle: require_parentheses
3595
+ SupportedStyles:
3596
+ - require_parentheses
3597
+ - require_no_parentheses
3598
+
3599
+ Style/StderrPuts:
3600
+ Description: 'Use `warn` instead of `$stderr.puts`.'
3601
+ StyleGuide: '#warn'
3602
+ Enabled: true
3603
+ VersionAdded: '0.51'
3604
+
3605
+ Style/StringHashKeys:
3606
+ Description: 'Prefer symbols instead of strings as hash keys.'
3607
+ StyleGuide: '#symbols-as-keys'
3608
+ Enabled: false
3609
+ VersionAdded: '0.52'
3610
+ VersionChanged: '0.75'
3611
+ Safe: false
3612
+
3613
+ Style/StringLiterals:
3614
+ Description: 'Checks if uses of quotes match the configured preference.'
3615
+ StyleGuide: '#consistent-string-literals'
3616
+ Enabled: true
3617
+ VersionAdded: '0.9'
3618
+ VersionChanged: '0.36'
3619
+ EnforcedStyle: single_quotes
3620
+ SupportedStyles:
3621
+ - single_quotes
3622
+ - double_quotes
3623
+ # If `true`, strings which span multiple lines using `\` for continuation must
3624
+ # use the same type of quotes on each line.
3625
+ ConsistentQuotesInMultiline: false
3626
+
3627
+ Style/StringLiteralsInInterpolation:
3628
+ Description: >-
3629
+ Checks if uses of quotes inside expressions in interpolated
3630
+ strings match the configured preference.
3631
+ Enabled: true
3632
+ VersionAdded: '0.27'
3633
+ EnforcedStyle: single_quotes
3634
+ SupportedStyles:
3635
+ - single_quotes
3636
+ - double_quotes
3637
+
3638
+ Style/StringMethods:
3639
+ Description: 'Checks if configured preferred methods are used over non-preferred.'
3640
+ Enabled: false
3641
+ VersionAdded: '0.34'
3642
+ VersionChanged: '0.34.2'
3643
+ # Mapping from undesired method to desired_method
3644
+ # e.g. to use `to_sym` over `intern`:
3645
+ #
3646
+ # StringMethods:
3647
+ # PreferredMethods:
3648
+ # intern: to_sym
3649
+ PreferredMethods:
3650
+ intern: to_sym
3651
+
3652
+ Style/Strip:
3653
+ Description: 'Use `strip` instead of `lstrip.rstrip`.'
3654
+ Enabled: true
3655
+ VersionAdded: '0.36'
3656
+
3657
+ Style/StructInheritance:
3658
+ Description: 'Checks for inheritance from Struct.new.'
3659
+ StyleGuide: '#no-extend-struct-new'
3660
+ Enabled: true
3661
+ VersionAdded: '0.29'
3662
+
3663
+ Style/SymbolArray:
3664
+ Description: 'Use %i or %I for arrays of symbols.'
3665
+ StyleGuide: '#percent-i'
3666
+ Enabled: true
3667
+ VersionAdded: '0.9'
3668
+ VersionChanged: '0.49'
3669
+ EnforcedStyle: percent
3670
+ MinSize: 2
3671
+ SupportedStyles:
3672
+ - percent
3673
+ - brackets
3674
+
3675
+ Style/SymbolLiteral:
3676
+ Description: 'Use plain symbols instead of string symbols when possible.'
3677
+ Enabled: true
3678
+ VersionAdded: '0.30'
3679
+
3680
+ Style/SymbolProc:
3681
+ Description: 'Use symbols as procs instead of blocks when possible.'
3682
+ Enabled: true
3683
+ SafeAutoCorrect: false
3684
+ VersionAdded: '0.26'
3685
+ VersionChanged: '0.64'
3686
+ # A list of method names to be ignored by the check.
3687
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
3688
+ IgnoredMethods:
3689
+ - respond_to
3690
+ - define_method
3691
+
3692
+ Style/TernaryParentheses:
3693
+ Description: 'Checks for use of parentheses around ternary conditions.'
3694
+ Enabled: true
3695
+ VersionAdded: '0.42'
3696
+ VersionChanged: '0.46'
3697
+ EnforcedStyle: require_no_parentheses
3698
+ SupportedStyles:
3699
+ - require_parentheses
3700
+ - require_no_parentheses
3701
+ - require_parentheses_when_complex
3702
+ AllowSafeAssignment: true
3703
+
3704
+ Style/TrailingBodyOnClass:
3705
+ Description: 'Class body goes below class statement.'
3706
+ Enabled: true
3707
+ VersionAdded: '0.53'
3708
+
3709
+ Style/TrailingBodyOnMethodDefinition:
3710
+ Description: 'Method body goes below definition.'
3711
+ Enabled: true
3712
+ VersionAdded: '0.52'
3713
+
3714
+ Style/TrailingBodyOnModule:
3715
+ Description: 'Module body goes below module statement.'
3716
+ Enabled: true
3717
+ VersionAdded: '0.53'
3718
+
3719
+ Style/TrailingCommaInArguments:
3720
+ Description: 'Checks for trailing comma in argument lists.'
3721
+ StyleGuide: '#no-trailing-params-comma'
3722
+ Enabled: true
3723
+ VersionAdded: '0.36'
3724
+ # If `comma`, the cop requires a comma after the last argument, but only for
3725
+ # parenthesized method calls where each argument is on its own line.
3726
+ # If `consistent_comma`, the cop requires a comma after the last argument,
3727
+ # for all parenthesized method calls with arguments.
3728
+ EnforcedStyleForMultiline: no_comma
3729
+ SupportedStylesForMultiline:
3730
+ - comma
3731
+ - consistent_comma
3732
+ - no_comma
3733
+
3734
+ Style/TrailingCommaInArrayLiteral:
3735
+ Description: 'Checks for trailing comma in array literals.'
3736
+ StyleGuide: '#no-trailing-array-commas'
3737
+ Enabled: true
3738
+ VersionAdded: '0.53'
3739
+ # but only when each item is on its own line.
3740
+ # If `consistent_comma`, the cop requires a comma after the last item of all
3741
+ # non-empty array literals.
3742
+ EnforcedStyleForMultiline: no_comma
3743
+ SupportedStylesForMultiline:
3744
+ - comma
3745
+ - consistent_comma
3746
+ - no_comma
3747
+
3748
+ Style/TrailingCommaInHashLiteral:
3749
+ Description: 'Checks for trailing comma in hash literals.'
3750
+ Enabled: true
3751
+ # If `comma`, the cop requires a comma after the last item in a hash,
3752
+ # but only when each item is on its own line.
3753
+ # If `consistent_comma`, the cop requires a comma after the last item of all
3754
+ # non-empty hash literals.
3755
+ EnforcedStyleForMultiline: no_comma
3756
+ SupportedStylesForMultiline:
3757
+ - comma
3758
+ - consistent_comma
3759
+ - no_comma
3760
+ VersionAdded: '0.53'
3761
+
3762
+ Style/TrailingMethodEndStatement:
3763
+ Description: 'Checks for trailing end statement on line of method body.'
3764
+ Enabled: true
3765
+ VersionAdded: '0.52'
3766
+
3767
+ Style/TrailingUnderscoreVariable:
3768
+ Description: >-
3769
+ Checks for the usage of unneeded trailing underscores at the
3770
+ end of parallel variable assignment.
3771
+ AllowNamedUnderscoreVariables: true
3772
+ Enabled: true
3773
+ VersionAdded: '0.31'
3774
+ VersionChanged: '0.35'
3775
+
3776
+ # `TrivialAccessors` requires exact name matches and doesn't allow
3777
+ # predicated methods by default.
3778
+ Style/TrivialAccessors:
3779
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
3780
+ StyleGuide: '#attr_family'
3781
+ Enabled: true
3782
+ VersionAdded: '0.9'
3783
+ VersionChanged: '0.38'
3784
+ # When set to `false` the cop will suggest the use of accessor methods
3785
+ # in situations like:
3786
+ #
3787
+ # def name
3788
+ # @other_name
3789
+ # end
3790
+ #
3791
+ # This way you can uncover "hidden" attributes in your code.
3792
+ ExactNameMatch: true
3793
+ AllowPredicates: true
3794
+ # Allows trivial writers that don't end in an equal sign. e.g.
3795
+ #
3796
+ # def on_exception(action)
3797
+ # @on_exception=action
3798
+ # end
3799
+ # on_exception :restart
3800
+ #
3801
+ # Commonly used in DSLs
3802
+ AllowDSLWriters: false
3803
+ IgnoreClassMethods: false
3804
+ Whitelist:
3805
+ - to_ary
3806
+ - to_a
3807
+ - to_c
3808
+ - to_enum
3809
+ - to_h
3810
+ - to_hash
3811
+ - to_i
3812
+ - to_int
3813
+ - to_io
3814
+ - to_open
3815
+ - to_path
3816
+ - to_proc
3817
+ - to_r
3818
+ - to_regexp
3819
+ - to_str
3820
+ - to_s
3821
+ - to_sym
3822
+
3823
+ Style/UnlessElse:
3824
+ Description: >-
3825
+ Do not use unless with else. Rewrite these with the positive
3826
+ case first.
3827
+ StyleGuide: '#no-else-with-unless'
3828
+ Enabled: true
3829
+ VersionAdded: '0.9'
3830
+
3831
+ Style/UnneededCapitalW:
3832
+ Description: 'Checks for %W when interpolation is not needed.'
3833
+ Enabled: true
3834
+ VersionAdded: '0.21'
3835
+ VersionChanged: '0.24'
3836
+
3837
+ Style/UnneededCondition:
3838
+ Description: 'Checks for unnecessary conditional expressions.'
3839
+ Enabled: true
3840
+ VersionAdded: '0.57'
3841
+
3842
+ Style/UnneededInterpolation:
3843
+ Description: 'Checks for strings that are just an interpolated expression.'
3844
+ Enabled: true
3845
+ VersionAdded: '0.36'
3846
+
3847
+ Style/UnneededPercentQ:
3848
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
3849
+ StyleGuide: '#percent-q'
3850
+ Enabled: true
3851
+ VersionAdded: '0.24'
3852
+
3853
+ Style/UnneededSort:
3854
+ Description: >-
3855
+ Use `min` instead of `sort.first`,
3856
+ `max_by` instead of `sort_by...last`, etc.
3857
+ Enabled: true
3858
+ VersionAdded: '0.55'
3859
+
3860
+ Style/UnpackFirst:
3861
+ Description: >-
3862
+ Checks for accessing the first element of `String#unpack`
3863
+ instead of using `unpack1`.
3864
+ Enabled: true
3865
+ VersionAdded: '0.54'
3866
+
3867
+ Style/VariableInterpolation:
3868
+ Description: >-
3869
+ Don't interpolate global, instance and class variables
3870
+ directly in strings.
3871
+ StyleGuide: '#curlies-interpolate'
3872
+ Enabled: true
3873
+ VersionAdded: '0.9'
3874
+ VersionChanged: '0.20'
3875
+
3876
+ Style/WhenThen:
3877
+ Description: 'Use when x then ... for one-line cases.'
3878
+ StyleGuide: '#one-line-cases'
3879
+ Enabled: true
3880
+ VersionAdded: '0.9'
3881
+
3882
+ Style/WhileUntilDo:
3883
+ Description: 'Checks for redundant do after while or until.'
3884
+ StyleGuide: '#no-multiline-while-do'
3885
+ Enabled: true
3886
+ VersionAdded: '0.9'
3887
+
3888
+ Style/WhileUntilModifier:
3889
+ Description: >-
3890
+ Favor modifier while/until usage when you have a
3891
+ single-line body.
3892
+ StyleGuide: '#while-as-a-modifier'
3893
+ Enabled: true
3894
+ VersionAdded: '0.9'
3895
+ VersionChanged: '0.30'
3896
+
3897
+ Style/WordArray:
3898
+ Description: 'Use %w or %W for arrays of words.'
3899
+ StyleGuide: '#percent-w'
3900
+ Enabled: true
3901
+ VersionAdded: '0.9'
3902
+ VersionChanged: '0.36'
3903
+ EnforcedStyle: percent
3904
+ SupportedStyles:
3905
+ # percent style: %w(word1 word2)
3906
+ - percent
3907
+ # bracket style: ['word1', 'word2']
3908
+ - brackets
3909
+ # The `MinSize` option causes the `WordArray` rule to be ignored for arrays
3910
+ # smaller than a certain size. The rule is only applied to arrays
3911
+ # whose element count is greater than or equal to `MinSize`.
3912
+ MinSize: 2
3913
+ # The regular expression `WordRegex` decides what is considered a word.
3914
+ WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
3915
+
3916
+ Style/YodaCondition:
3917
+ Description: 'Forbid or enforce yoda conditions.'
3918
+ Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
3919
+ Enabled: true
3920
+ EnforcedStyle: forbid_for_all_comparison_operators
3921
+ SupportedStyles:
3922
+ # check all comparison operators
3923
+ - forbid_for_all_comparison_operators
3924
+ # check only equality operators: `!=` and `==`
3925
+ - forbid_for_equality_operators_only
3926
+ # enforce yoda for all comparison operators
3927
+ - require_for_all_comparison_operators
3928
+ # enforce yoda only for equality operators: `!=` and `==`
3929
+ - require_for_equality_operators_only
3930
+ Safe: false
3931
+ VersionAdded: '0.49'
3932
+ VersionChanged: '0.75'
3933
+
3934
+ Style/ZeroLengthPredicate:
3935
+ Description: 'Use #empty? when testing for objects of length 0.'
3936
+ Enabled: true
3937
+ Safe: false
3938
+ VersionAdded: '0.37'
3939
+ VersionChanged: '0.39'