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