rubocop 0.87.1

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