rbhint 0.8.5.rc1

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