rubocop 0.70.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +64 -40
- data/config/default.yml +1316 -986
- data/config/obsoletion.yml +196 -0
- data/exe/rubocop +1 -1
- data/lib/rubocop/ast_aliases.rb +8 -0
- data/lib/rubocop/cached_data.rb +4 -2
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +141 -0
- data/lib/rubocop/cli/command/base.rb +35 -0
- data/lib/rubocop/cli/command/execute_runner.rb +100 -0
- data/lib/rubocop/cli/command/init_dotfile.rb +46 -0
- data/lib/rubocop/cli/command/show_cops.rb +77 -0
- data/lib/rubocop/cli/command/suggest_extensions.rb +80 -0
- data/lib/rubocop/cli/command/version.rb +18 -0
- data/lib/rubocop/cli/command.rb +22 -0
- data/lib/rubocop/cli/environment.rb +22 -0
- data/lib/rubocop/cli.rb +22 -230
- data/lib/rubocop/comment_config.rb +29 -16
- data/lib/rubocop/config.rb +80 -509
- data/lib/rubocop/config_loader.rb +122 -91
- data/lib/rubocop/config_loader_resolver.rb +65 -24
- data/lib/rubocop/config_obsoletion/changed_enforced_styles.rb +33 -0
- data/lib/rubocop/config_obsoletion/changed_parameter.rb +21 -0
- data/lib/rubocop/config_obsoletion/cop_rule.rb +34 -0
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +44 -0
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +44 -0
- data/lib/rubocop/config_obsoletion/removed_cop.rb +41 -0
- data/lib/rubocop/config_obsoletion/renamed_cop.rb +34 -0
- data/lib/rubocop/config_obsoletion/rule.rb +41 -0
- data/lib/rubocop/config_obsoletion/split_cop.rb +27 -0
- data/lib/rubocop/config_obsoletion.rb +101 -0
- data/lib/rubocop/config_regeneration.rb +33 -0
- data/lib/rubocop/config_store.rb +19 -5
- data/lib/rubocop/config_validator.rb +239 -0
- data/lib/rubocop/cop/autocorrect_logic.rb +83 -6
- data/lib/rubocop/cop/badge.rb +15 -30
- data/lib/rubocop/cop/base.rb +447 -0
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +28 -4
- data/lib/rubocop/cop/bundler/gem_comment.rb +83 -9
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +15 -23
- data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
- data/lib/rubocop/cop/commissioner.rb +102 -70
- data/lib/rubocop/cop/cop.rb +102 -186
- data/lib/rubocop/cop/corrector.rb +71 -122
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +45 -23
- data/lib/rubocop/cop/correctors/condition_corrector.rb +3 -6
- data/lib/rubocop/cop/correctors/empty_line_corrector.rb +9 -10
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +4 -4
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +10 -10
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +36 -5
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -8
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +9 -14
- data/lib/rubocop/cop/correctors/punctuation_corrector.rb +8 -10
- data/lib/rubocop/cop/correctors/space_corrector.rb +2 -5
- data/lib/rubocop/cop/correctors/string_literal_corrector.rb +6 -8
- data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +15 -18
- data/lib/rubocop/cop/documentation.rb +22 -0
- data/lib/rubocop/cop/force.rb +2 -1
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +5 -5
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +3 -5
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +45 -20
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +55 -0
- data/lib/rubocop/cop/generator/configuration_injector.rb +12 -7
- data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
- data/lib/rubocop/cop/generator.rb +15 -21
- data/lib/rubocop/cop/ignored_node.rb +1 -3
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +52 -0
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +3 -3
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +13 -15
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +11 -10
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +12 -8
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +10 -10
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +5 -5
- data/lib/rubocop/cop/internal_affairs.rb +1 -0
- data/lib/rubocop/cop/layout/{align_arguments.rb → argument_alignment.rb} +1 -1
- data/lib/rubocop/cop/layout/array_alignment.rb +83 -0
- data/lib/rubocop/cop/layout/{indent_assignment.rb → assignment_indentation.rb} +11 -2
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +77 -0
- data/lib/rubocop/cop/layout/block_alignment.rb +30 -27
- data/lib/rubocop/cop/layout/block_end_newline.rb +5 -3
- data/lib/rubocop/cop/layout/case_indentation.rb +21 -25
- data/lib/rubocop/cop/layout/class_structure.rb +53 -69
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +4 -6
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/comment_indentation.rb +14 -17
- data/lib/rubocop/cop/layout/condition_position.rb +16 -8
- data/lib/rubocop/cop/layout/def_end_alignment.rb +7 -4
- data/lib/rubocop/cop/layout/dot_position.rb +21 -20
- data/lib/rubocop/cop/layout/else_alignment.rb +23 -2
- data/lib/rubocop/cop/layout/empty_comment.rb +38 -40
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +43 -25
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +15 -15
- data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +136 -0
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +100 -31
- data/lib/rubocop/cop/layout/empty_lines.rb +6 -9
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +21 -20
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +13 -9
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +118 -0
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +4 -5
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +4 -7
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +3 -7
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +2 -5
- data/lib/rubocop/cop/layout/end_alignment.rb +17 -22
- data/lib/rubocop/cop/layout/end_of_line.rb +16 -11
- data/lib/rubocop/cop/layout/extra_spacing.rb +34 -94
- data/lib/rubocop/cop/layout/{indent_first_argument.rb → first_argument_indentation.rb} +28 -15
- data/lib/rubocop/cop/layout/{indent_first_array_element.rb → first_array_element_indentation.rb} +18 -14
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +3 -6
- data/lib/rubocop/cop/layout/{indent_first_hash_element.rb → first_hash_element_indentation.rb} +5 -5
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +2 -5
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +5 -11
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +2 -5
- data/lib/rubocop/cop/layout/{indent_first_parameter.rb → first_parameter_indentation.rb} +8 -4
- data/lib/rubocop/cop/layout/{align_hash.rb → hash_alignment.rb} +41 -37
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +30 -17
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +176 -0
- data/lib/rubocop/cop/layout/indentation_consistency.rb +13 -12
- data/lib/rubocop/cop/layout/indentation_style.rb +115 -0
- data/lib/rubocop/cop/layout/indentation_width.rb +29 -13
- data/lib/rubocop/cop/layout/initial_indentation.rb +6 -7
- data/lib/rubocop/cop/layout/leading_comment_space.rb +72 -11
- data/lib/rubocop/cop/layout/{leading_blank_lines.rb → leading_empty_lines.rb} +6 -11
- data/lib/rubocop/cop/{metrics → layout}/line_length.rb +92 -130
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +11 -15
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +70 -27
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +2 -9
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +7 -11
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +8 -4
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +13 -4
- data/lib/rubocop/cop/layout/{align_parameters.rb → parameter_alignment.rb} +1 -1
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +59 -26
- data/lib/rubocop/cop/layout/space_after_colon.rb +12 -8
- data/lib/rubocop/cop/layout/space_after_comma.rb +2 -5
- data/lib/rubocop/cop/layout/space_after_method_name.rb +5 -6
- data/lib/rubocop/cop/layout/space_after_not.rb +9 -11
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +2 -5
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +47 -42
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +17 -21
- data/lib/rubocop/cop/layout/space_around_keyword.rb +31 -20
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +98 -0
- data/lib/rubocop/cop/layout/space_around_operators.rb +127 -44
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +54 -22
- data/lib/rubocop/cop/layout/space_before_comma.rb +3 -5
- data/lib/rubocop/cop/layout/space_before_comment.rb +9 -8
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +15 -7
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +2 -5
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +17 -23
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +32 -33
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -8
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +37 -21
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +21 -46
- data/lib/rubocop/cop/layout/space_inside_parens.rb +43 -26
- data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +5 -10
- data/lib/rubocop/cop/layout/space_inside_range_literal.rb +9 -18
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +17 -27
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +24 -41
- data/lib/rubocop/cop/layout/{trailing_blank_lines.rb → trailing_empty_lines.rb} +10 -15
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +56 -16
- 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 +9 -4
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +53 -5
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +36 -6
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +19 -6
- data/lib/rubocop/cop/lint/big_decimal_new.rb +10 -11
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +50 -0
- data/lib/rubocop/cop/lint/boolean_symbol.rb +22 -2
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +98 -0
- data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
- data/lib/rubocop/cop/lint/debugger.rb +18 -26
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +7 -10
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +141 -0
- data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +9 -3
- data/lib/rubocop/cop/lint/duplicate_branch.rb +93 -0
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +3 -13
- data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +39 -0
- data/lib/rubocop/cop/lint/{duplicated_key.rb → duplicate_hash_key.rb} +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +10 -13
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +77 -0
- data/lib/rubocop/cop/lint/duplicate_require.rb +46 -0
- data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +47 -0
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +4 -3
- data/lib/rubocop/cop/lint/else_layout.rb +30 -4
- data/lib/rubocop/cop/lint/empty_block.rb +82 -0
- data/lib/rubocop/cop/lint/empty_class.rb +93 -0
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +67 -0
- data/lib/rubocop/cop/lint/empty_ensure.rb +5 -5
- data/lib/rubocop/cop/lint/empty_expression.rb +2 -2
- data/lib/rubocop/cop/lint/empty_file.rb +50 -0
- data/lib/rubocop/cop/lint/empty_interpolation.rb +8 -9
- data/lib/rubocop/cop/lint/empty_when.rb +31 -8
- data/lib/rubocop/cop/lint/ensure_return.rb +29 -14
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +66 -8
- data/lib/rubocop/cop/lint/flip_flop.rb +9 -3
- data/lib/rubocop/cop/lint/float_comparison.rb +93 -0
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -2
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +52 -41
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +37 -0
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +13 -14
- data/lib/rubocop/cop/lint/identity_comparison.rb +51 -0
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +6 -5
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +12 -15
- data/lib/rubocop/cop/lint/inherit_exception.rb +13 -8
- data/lib/rubocop/cop/lint/interpolation_check.rb +26 -5
- data/lib/rubocop/cop/lint/literal_as_condition.rb +24 -15
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +46 -15
- data/lib/rubocop/cop/lint/loop.rb +30 -7
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +8 -7
- data/lib/rubocop/cop/lint/missing_super.rb +102 -0
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +37 -0
- data/lib/rubocop/cop/lint/{multiple_compare.rb → multiple_comparison.rb} +11 -12
- data/lib/rubocop/cop/lint/nested_method_definition.rb +20 -26
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +16 -2
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +2 -2
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +58 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +160 -0
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +10 -10
- data/lib/rubocop/cop/lint/number_conversion.rb +54 -23
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +11 -13
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +98 -0
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +33 -12
- data/lib/rubocop/cop/lint/percent_string_array.rb +6 -11
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +14 -13
- data/lib/rubocop/cop/lint/raise_exception.rb +86 -0
- data/lib/rubocop/cop/lint/rand_one.rb +4 -3
- data/lib/rubocop/cop/lint/{unneeded_cop_disable_directive.rb → redundant_cop_disable_directive.rb} +84 -76
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +128 -0
- data/lib/rubocop/cop/lint/{unneeded_require_statement.rb → redundant_require_statement.rb} +9 -11
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +78 -0
- data/lib/rubocop/cop/lint/{unneeded_splat_expansion.rb → redundant_splat_expansion.rb} +25 -16
- data/lib/rubocop/cop/lint/{string_conversion_in_interpolation.rb → redundant_string_coercion.rb} +11 -18
- data/lib/rubocop/cop/lint/redundant_with_index.rb +13 -16
- data/lib/rubocop/cop/lint/redundant_with_object.rb +13 -16
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -2
- data/lib/rubocop/cop/lint/require_parentheses.rb +2 -2
- data/lib/rubocop/cop/lint/rescue_exception.rb +2 -2
- data/lib/rubocop/cop/lint/rescue_type.rb +8 -9
- data/lib/rubocop/cop/lint/return_in_void_context.rb +2 -4
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +11 -15
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +14 -10
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +11 -3
- data/lib/rubocop/cop/lint/script_permission.rb +10 -7
- data/lib/rubocop/cop/lint/self_assignment.rb +78 -0
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +87 -0
- data/lib/rubocop/cop/lint/shadowed_argument.rb +3 -3
- data/lib/rubocop/cop/lint/shadowed_exception.rb +12 -13
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +20 -7
- data/lib/rubocop/cop/lint/struct_new_override.rb +59 -0
- data/lib/rubocop/cop/lint/{handle_exceptions.rb → suppressed_exception.rb} +21 -27
- data/lib/rubocop/cop/lint/syntax.rb +11 -28
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +86 -0
- data/lib/rubocop/cop/lint/to_json.rb +21 -12
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +34 -0
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +57 -0
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +4 -4
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +85 -0
- data/lib/rubocop/cop/lint/unified_integer.rb +5 -9
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +199 -0
- data/lib/rubocop/cop/lint/unreachable_code.rb +3 -3
- data/lib/rubocop/cop/lint/unreachable_loop.rb +171 -0
- data/lib/rubocop/cop/lint/unused_block_argument.rb +30 -9
- data/lib/rubocop/cop/lint/unused_method_argument.rb +63 -14
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +5 -3
- data/lib/rubocop/cop/lint/uri_regexp.rb +12 -47
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +95 -47
- data/lib/rubocop/cop/lint/useless_assignment.rb +7 -6
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +7 -11
- data/lib/rubocop/cop/lint/useless_method_definition.rb +68 -0
- data/lib/rubocop/cop/lint/useless_setter_call.rb +15 -8
- data/lib/rubocop/cop/lint/useless_times.rb +106 -0
- data/lib/rubocop/cop/lint/void.rb +10 -33
- data/lib/rubocop/cop/message_annotator.rb +16 -7
- data/lib/rubocop/cop/metrics/abc_size.rb +27 -3
- data/lib/rubocop/cop/metrics/block_length.rb +40 -10
- data/lib/rubocop/cop/metrics/block_nesting.rb +2 -2
- data/lib/rubocop/cop/metrics/class_length.rb +39 -8
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +37 -4
- data/lib/rubocop/cop/metrics/method_length.rb +33 -5
- data/lib/rubocop/cop/metrics/module_length.rb +27 -4
- data/lib/rubocop/cop/metrics/parameter_lists.rb +71 -9
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +7 -8
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +95 -14
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +158 -0
- data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +146 -0
- data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +42 -0
- data/lib/rubocop/cop/migration/department_name.rb +83 -0
- data/lib/rubocop/cop/mixin/alignment.rb +8 -6
- data/lib/rubocop/cop/mixin/allowed_methods.rb +21 -0
- data/lib/rubocop/cop/mixin/annotation_comment.rb +5 -0
- data/lib/rubocop/cop/mixin/array_min_size.rb +2 -4
- data/lib/rubocop/cop/mixin/auto_corrector.rb +12 -0
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +20 -17
- data/lib/rubocop/cop/mixin/code_length.rb +26 -5
- data/lib/rubocop/cop/mixin/comments_help.rb +48 -0
- data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +5 -3
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +3 -5
- data/lib/rubocop/cop/mixin/configurable_naming.rb +2 -2
- data/lib/rubocop/cop/mixin/configurable_numbering.rb +4 -3
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -4
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +8 -7
- data/lib/rubocop/cop/mixin/empty_parameter.rb +4 -2
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +18 -2
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +15 -5
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +4 -2
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +15 -6
- data/lib/rubocop/cop/mixin/{hash_alignment.rb → hash_alignment_styles.rb} +5 -1
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +197 -0
- data/lib/rubocop/cop/mixin/ignored_methods.rb +36 -3
- data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
- data/lib/rubocop/cop/mixin/interpolation.rb +27 -0
- data/lib/rubocop/cop/mixin/line_length_help.rb +87 -0
- data/lib/rubocop/cop/mixin/method_complexity.rb +24 -4
- data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +3 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +5 -5
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +13 -12
- data/lib/rubocop/cop/mixin/negative_conditional.rb +2 -2
- data/lib/rubocop/cop/mixin/nil_methods.rb +4 -6
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +6 -1
- data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
- data/lib/rubocop/cop/mixin/percent_array.rb +16 -9
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +88 -1
- data/lib/rubocop/cop/mixin/range_help.rb +19 -5
- data/lib/rubocop/cop/mixin/rational_literal.rb +18 -0
- data/lib/rubocop/cop/mixin/rescue_node.rb +11 -1
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +4 -3
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +4 -3
- data/lib/rubocop/cop/mixin/statement_modifier.rb +51 -23
- data/lib/rubocop/cop/mixin/string_help.rb +4 -1
- data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
- data/lib/rubocop/cop/mixin/surrounding_space.rb +19 -33
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +5 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +27 -33
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +13 -18
- data/lib/rubocop/cop/mixin/unused_argument.rb +4 -6
- data/lib/rubocop/cop/mixin/visibility_help.rb +36 -0
- data/lib/rubocop/cop/naming/accessor_method_name.rb +19 -3
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +29 -6
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +16 -6
- data/lib/rubocop/cop/naming/{uncommunicative_block_param_name.rb → block_parameter_name.rb} +3 -3
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +13 -3
- data/lib/rubocop/cop/naming/constant_name.rb +5 -4
- data/lib/rubocop/cop/naming/file_name.rb +40 -22
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +12 -6
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +8 -8
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +69 -20
- data/lib/rubocop/cop/naming/method_name.rb +39 -2
- data/lib/rubocop/cop/naming/{uncommunicative_method_param_name.rb → method_parameter_name.rb} +3 -3
- data/lib/rubocop/cop/naming/predicate_name.rb +12 -15
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +27 -28
- data/lib/rubocop/cop/naming/variable_name.rb +2 -1
- data/lib/rubocop/cop/naming/variable_number.rb +101 -9
- data/lib/rubocop/cop/offense.rb +62 -12
- data/lib/rubocop/cop/registry.rb +97 -11
- data/lib/rubocop/cop/security/eval.rb +4 -3
- data/lib/rubocop/cop/security/json_load.rb +8 -9
- data/lib/rubocop/cop/security/marshal_load.rb +4 -5
- data/lib/rubocop/cop/security/open.rb +15 -12
- data/lib/rubocop/cop/security/yaml_load.rb +8 -7
- data/lib/rubocop/cop/severity.rb +1 -11
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +36 -12
- data/lib/rubocop/cop/style/accessor_grouping.rb +152 -0
- data/lib/rubocop/cop/style/alias.rb +45 -38
- data/lib/rubocop/cop/style/and_or.rb +27 -22
- data/lib/rubocop/cop/style/arguments_forwarding.rb +142 -0
- data/lib/rubocop/cop/style/array_coercion.rb +67 -0
- data/lib/rubocop/cop/style/array_join.rb +8 -9
- data/lib/rubocop/cop/style/ascii_comments.rb +4 -4
- data/lib/rubocop/cop/style/attr.rb +22 -13
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +7 -7
- data/lib/rubocop/cop/style/bare_percent_literals.rb +12 -14
- data/lib/rubocop/cop/style/begin_block.rb +2 -2
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +137 -0
- data/lib/rubocop/cop/style/block_comments.rb +14 -18
- data/lib/rubocop/cop/style/block_delimiters.rb +79 -27
- data/lib/rubocop/cop/style/case_equality.rb +54 -4
- data/lib/rubocop/cop/style/case_like_if.rb +248 -0
- data/lib/rubocop/cop/style/character_literal.rb +10 -11
- data/lib/rubocop/cop/style/class_and_module_children.rb +26 -16
- data/lib/rubocop/cop/style/class_check.rb +6 -11
- data/lib/rubocop/cop/style/class_equality_comparison.rb +64 -0
- data/lib/rubocop/cop/style/class_methods.rb +7 -11
- data/lib/rubocop/cop/style/class_methods_definitions.rb +157 -0
- data/lib/rubocop/cop/style/class_vars.rb +23 -7
- data/lib/rubocop/cop/style/collection_compact.rb +91 -0
- data/lib/rubocop/cop/style/collection_methods.rb +13 -17
- data/lib/rubocop/cop/style/colon_method_call.rb +9 -10
- data/lib/rubocop/cop/style/colon_method_definition.rb +6 -6
- data/lib/rubocop/cop/style/combinable_loops.rb +91 -0
- data/lib/rubocop/cop/style/command_literal.rb +24 -25
- data/lib/rubocop/cop/style/comment_annotation.rb +23 -17
- data/lib/rubocop/cop/style/commented_keyword.rb +23 -35
- data/lib/rubocop/cop/style/conditional_assignment.rb +77 -82
- data/lib/rubocop/cop/style/constant_visibility.rb +17 -5
- data/lib/rubocop/cop/style/copyright.rb +27 -23
- data/lib/rubocop/cop/style/date_time.rb +17 -6
- data/lib/rubocop/cop/style/def_with_parentheses.rb +8 -10
- data/lib/rubocop/cop/style/dir.rb +11 -13
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +47 -0
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +169 -0
- data/lib/rubocop/cop/style/documentation.rb +62 -15
- data/lib/rubocop/cop/style/documentation_method.rb +46 -2
- data/lib/rubocop/cop/style/double_cop_disable_directive.rb +52 -0
- data/lib/rubocop/cop/style/double_negation.rb +49 -6
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +6 -9
- data/lib/rubocop/cop/style/each_with_object.rb +17 -20
- data/lib/rubocop/cop/style/empty_block_parameter.rb +9 -10
- data/lib/rubocop/cop/style/empty_case_condition.rb +29 -28
- data/lib/rubocop/cop/style/empty_else.rb +17 -19
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +9 -10
- data/lib/rubocop/cop/style/empty_literal.rb +26 -27
- data/lib/rubocop/cop/style/empty_method.rb +13 -20
- data/lib/rubocop/cop/style/encoding.rb +6 -10
- data/lib/rubocop/cop/style/end_block.rb +6 -2
- data/lib/rubocop/cop/style/eval_with_location.rb +10 -10
- data/lib/rubocop/cop/style/even_odd.rb +10 -13
- data/lib/rubocop/cop/style/expand_path_arguments.rb +30 -29
- data/lib/rubocop/cop/style/explicit_block_argument.rb +106 -0
- data/lib/rubocop/cop/style/exponential_notation.rb +117 -0
- data/lib/rubocop/cop/style/float_division.rb +136 -0
- data/lib/rubocop/cop/style/for.rb +7 -15
- data/lib/rubocop/cop/style/format_string.rb +48 -37
- data/lib/rubocop/cop/style/format_string_token.rb +70 -77
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +113 -65
- data/lib/rubocop/cop/style/global_std_stream.rb +65 -0
- data/lib/rubocop/cop/style/global_vars.rb +2 -2
- data/lib/rubocop/cop/style/guard_clause.rb +69 -16
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +88 -0
- data/lib/rubocop/cop/style/hash_each_methods.rb +86 -0
- data/lib/rubocop/cop/style/hash_like_case.rb +76 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +32 -23
- data/lib/rubocop/cop/style/hash_transform_keys.rb +91 -0
- data/lib/rubocop/cop/style/hash_transform_values.rb +88 -0
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +9 -4
- data/lib/rubocop/cop/style/if_inside_else.rb +80 -2
- data/lib/rubocop/cop/style/if_unless_modifier.rb +124 -44
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +11 -3
- data/lib/rubocop/cop/style/if_with_semicolon.rb +51 -3
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +2 -1
- data/lib/rubocop/cop/style/infinite_loop.rb +33 -28
- data/lib/rubocop/cop/style/inline_comment.rb +4 -4
- data/lib/rubocop/cop/style/inverse_methods.rb +39 -39
- data/lib/rubocop/cop/style/ip_addresses.rb +6 -6
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +65 -0
- data/lib/rubocop/cop/style/lambda.rb +9 -15
- data/lib/rubocop/cop/style/lambda_call.rb +17 -34
- data/lib/rubocop/cop/style/line_end_concatenation.rb +33 -26
- 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 +44 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +32 -226
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +18 -10
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +12 -3
- data/lib/rubocop/cop/style/method_def_parentheses.rb +21 -22
- data/lib/rubocop/cop/style/min_max.rb +9 -13
- data/lib/rubocop/cop/style/missing_else.rb +11 -21
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +10 -3
- data/lib/rubocop/cop/style/mixin_grouping.rb +26 -33
- data/lib/rubocop/cop/style/mixin_usage.rb +12 -21
- data/lib/rubocop/cop/style/module_function.rb +64 -21
- data/lib/rubocop/cop/style/multiline_block_chain.rb +12 -3
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +4 -11
- data/lib/rubocop/cop/style/multiline_if_then.rb +5 -11
- data/lib/rubocop/cop/style/multiline_memoization.rb +16 -14
- data/lib/rubocop/cop/style/multiline_method_signature.rb +2 -2
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +31 -9
- data/lib/rubocop/cop/style/multiline_when_then.rb +73 -0
- data/lib/rubocop/cop/style/multiple_comparison.rb +56 -8
- data/lib/rubocop/cop/style/mutable_constant.rb +30 -29
- data/lib/rubocop/cop/style/negated_if.rb +9 -9
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +106 -0
- data/lib/rubocop/cop/style/negated_unless.rb +9 -9
- data/lib/rubocop/cop/style/negated_while.rb +7 -15
- data/lib/rubocop/cop/style/nested_modifier.rb +31 -16
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +21 -22
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +29 -2
- data/lib/rubocop/cop/style/next.rb +19 -23
- data/lib/rubocop/cop/style/nil_comparison.rb +13 -11
- data/lib/rubocop/cop/style/nil_lambda.rb +52 -0
- data/lib/rubocop/cop/style/non_nil_check.rb +55 -35
- data/lib/rubocop/cop/style/not.rb +20 -26
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +6 -11
- data/lib/rubocop/cop/style/numeric_literals.rb +21 -14
- data/lib/rubocop/cop/style/numeric_predicate.rb +14 -19
- data/lib/rubocop/cop/style/one_line_conditional.rb +76 -29
- data/lib/rubocop/cop/style/option_hash.rb +5 -5
- data/lib/rubocop/cop/style/optional_arguments.rb +2 -2
- data/lib/rubocop/cop/style/optional_boolean_parameter.rb +53 -0
- data/lib/rubocop/cop/style/or_assignment.rb +24 -15
- data/lib/rubocop/cop/style/parallel_assignment.rb +18 -18
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +21 -7
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +21 -27
- data/lib/rubocop/cop/style/percent_q_literals.rb +8 -10
- data/lib/rubocop/cop/style/perl_backrefs.rb +91 -16
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +11 -14
- data/lib/rubocop/cop/style/proc.rb +7 -7
- data/lib/rubocop/cop/style/raise_args.rb +33 -30
- data/lib/rubocop/cop/style/random_with_offset.rb +29 -34
- data/lib/rubocop/cop/style/redundant_argument.rb +88 -0
- data/lib/rubocop/cop/style/redundant_assignment.rb +107 -0
- data/lib/rubocop/cop/style/redundant_begin.rb +35 -9
- data/lib/rubocop/cop/style/{unneeded_capital_w.rb → redundant_capital_w.rb} +6 -9
- data/lib/rubocop/cop/style/{unneeded_condition.rb → redundant_condition.rb} +43 -15
- data/lib/rubocop/cop/style/redundant_conditional.rb +11 -11
- data/lib/rubocop/cop/style/redundant_exception.rb +21 -15
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +113 -0
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +51 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +7 -9
- data/lib/rubocop/cop/style/{unneeded_interpolation.rb → redundant_interpolation.rb} +31 -25
- data/lib/rubocop/cop/style/redundant_parentheses.rb +53 -32
- data/lib/rubocop/cop/style/{unneeded_percent_q.rb → redundant_percent_q.rb} +13 -15
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +104 -0
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +121 -0
- data/lib/rubocop/cop/style/redundant_return.rb +52 -44
- data/lib/rubocop/cop/style/redundant_self.rb +36 -21
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +116 -0
- data/lib/rubocop/cop/style/{unneeded_sort.rb → redundant_sort.rb} +31 -34
- data/lib/rubocop/cop/style/redundant_sort_by.rb +6 -10
- data/lib/rubocop/cop/style/regexp_literal.rb +10 -21
- data/lib/rubocop/cop/style/rescue_modifier.rb +53 -9
- data/lib/rubocop/cop/style/rescue_standard_error.rb +23 -19
- data/lib/rubocop/cop/style/return_nil.rb +7 -7
- data/lib/rubocop/cop/style/safe_navigation.rb +54 -20
- data/lib/rubocop/cop/style/sample.rb +14 -16
- data/lib/rubocop/cop/style/self_assignment.rb +26 -22
- data/lib/rubocop/cop/style/semicolon.rb +23 -12
- data/lib/rubocop/cop/style/send.rb +4 -5
- data/lib/rubocop/cop/style/signal_exception.rb +26 -20
- data/lib/rubocop/cop/style/single_argument_dig.rb +55 -0
- data/lib/rubocop/cop/style/single_line_block_params.rb +32 -7
- data/lib/rubocop/cop/style/single_line_methods.rb +26 -18
- data/lib/rubocop/cop/style/slicing_with_range.rb +37 -0
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +128 -0
- data/lib/rubocop/cop/style/special_global_vars.rb +18 -41
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +17 -23
- data/lib/rubocop/cop/style/static_class.rb +97 -0
- data/lib/rubocop/cop/style/stderr_puts.rb +7 -8
- data/lib/rubocop/cop/style/string_concatenation.rb +143 -0
- data/lib/rubocop/cop/style/string_hash_keys.rb +8 -9
- data/lib/rubocop/cop/style/string_literals.rb +14 -8
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +4 -3
- data/lib/rubocop/cop/style/string_methods.rb +7 -17
- data/lib/rubocop/cop/style/strip.rb +10 -15
- data/lib/rubocop/cop/style/struct_inheritance.rb +23 -5
- data/lib/rubocop/cop/style/swap_values.rb +108 -0
- data/lib/rubocop/cop/style/symbol_array.rb +13 -24
- data/lib/rubocop/cop/style/symbol_literal.rb +6 -8
- data/lib/rubocop/cop/style/symbol_proc.rb +22 -24
- data/lib/rubocop/cop/style/ternary_parentheses.rb +57 -31
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +3 -6
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +4 -7
- data/lib/rubocop/cop/style/trailing_body_on_module.rb +3 -6
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +39 -25
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +43 -5
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +90 -0
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +46 -5
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +9 -34
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +19 -22
- data/lib/rubocop/cop/style/trivial_accessors.rb +36 -39
- data/lib/rubocop/cop/style/unless_else.rb +6 -9
- data/lib/rubocop/cop/style/unpack_first.rb +5 -12
- data/lib/rubocop/cop/style/variable_interpolation.rb +11 -24
- data/lib/rubocop/cop/style/when_then.rb +5 -7
- data/lib/rubocop/cop/style/while_until_do.rb +6 -16
- data/lib/rubocop/cop/style/while_until_modifier.rb +17 -22
- data/lib/rubocop/cop/style/word_array.rb +8 -26
- data/lib/rubocop/cop/style/yoda_condition.rb +29 -8
- data/lib/rubocop/cop/style/zero_length_predicate.rb +25 -27
- data/lib/rubocop/cop/team.rb +159 -87
- data/lib/rubocop/cop/util.rb +36 -19
- data/lib/rubocop/cop/utils/format_string.rb +135 -0
- data/lib/rubocop/cop/variable_force/assignment.rb +1 -0
- data/lib/rubocop/cop/variable_force/branch.rb +2 -7
- data/lib/rubocop/cop/variable_force/scope.rb +2 -1
- data/lib/rubocop/cop/variable_force/variable.rb +20 -8
- data/lib/rubocop/cop/variable_force.rb +16 -17
- data/lib/rubocop/cops_documentation_generator.rb +284 -0
- data/lib/rubocop/core_ext/hash.rb +20 -0
- data/lib/rubocop/core_ext/string.rb +2 -26
- data/lib/rubocop/directive_comment.rb +32 -0
- data/lib/rubocop/error.rb +24 -0
- data/lib/rubocop/ext/processed_source.rb +18 -0
- data/lib/rubocop/ext/regexp_node.rb +87 -0
- data/lib/rubocop/ext/regexp_parser.rb +95 -0
- data/lib/rubocop/file_finder.rb +13 -12
- data/lib/rubocop/formatter/auto_gen_config_formatter.rb +2 -1
- data/lib/rubocop/formatter/base_formatter.rb +0 -4
- data/lib/rubocop/formatter/clang_style_formatter.rb +8 -5
- data/lib/rubocop/formatter/disabled_config_formatter.rb +36 -22
- data/lib/rubocop/formatter/emacs_style_formatter.rb +24 -9
- data/lib/rubocop/formatter/file_list_formatter.rb +1 -1
- data/lib/rubocop/formatter/formatter_set.rb +20 -19
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +47 -0
- data/lib/rubocop/formatter/html_formatter.rb +2 -0
- data/lib/rubocop/formatter/json_formatter.rb +6 -5
- data/lib/rubocop/formatter/junit_formatter.rb +84 -0
- data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
- data/lib/rubocop/formatter/pacman_formatter.rb +80 -0
- data/lib/rubocop/formatter/progress_formatter.rb +2 -1
- data/lib/rubocop/formatter/quiet_formatter.rb +1 -1
- data/lib/rubocop/formatter/simple_text_formatter.rb +54 -10
- data/lib/rubocop/formatter/tap_formatter.rb +19 -6
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -1
- data/lib/rubocop/lockfile.rb +40 -0
- data/lib/rubocop/magic_comment.rb +7 -3
- data/lib/rubocop/name_similarity.rb +18 -10
- data/lib/rubocop/options.rb +131 -60
- data/lib/rubocop/path_util.rb +19 -19
- data/lib/rubocop/platform.rb +1 -1
- data/lib/rubocop/rake_task.rb +10 -11
- data/lib/rubocop/remote_config.rb +2 -3
- data/lib/rubocop/result_cache.rb +69 -27
- data/lib/rubocop/rspec/cop_helper.rb +11 -32
- data/lib/rubocop/rspec/expect_offense.rb +107 -25
- data/lib/rubocop/rspec/shared_contexts.rb +89 -40
- data/lib/rubocop/rspec/support.rb +0 -1
- data/lib/rubocop/runner.rb +127 -73
- data/lib/rubocop/string_interpreter.rb +3 -0
- data/lib/rubocop/target_finder.rb +61 -48
- data/lib/rubocop/target_ruby.rb +224 -0
- data/lib/rubocop/version.rb +65 -7
- data/lib/rubocop/yaml_duplication_checker.rb +9 -2
- data/lib/rubocop.rb +172 -145
- metadata +230 -184
- data/bin/console +0 -9
- data/bin/setup +0 -7
- data/lib/rubocop/ast/builder.rb +0 -79
- data/lib/rubocop/ast/node/alias_node.rb +0 -24
- data/lib/rubocop/ast/node/and_node.rb +0 -29
- data/lib/rubocop/ast/node/args_node.rb +0 -29
- data/lib/rubocop/ast/node/array_node.rb +0 -57
- data/lib/rubocop/ast/node/block_node.rb +0 -115
- data/lib/rubocop/ast/node/break_node.rb +0 -17
- data/lib/rubocop/ast/node/case_node.rb +0 -56
- data/lib/rubocop/ast/node/class_node.rb +0 -31
- data/lib/rubocop/ast/node/def_node.rb +0 -71
- data/lib/rubocop/ast/node/defined_node.rb +0 -17
- data/lib/rubocop/ast/node/ensure_node.rb +0 -17
- data/lib/rubocop/ast/node/for_node.rb +0 -53
- data/lib/rubocop/ast/node/hash_node.rb +0 -109
- data/lib/rubocop/ast/node/if_node.rb +0 -175
- data/lib/rubocop/ast/node/keyword_splat_node.rb +0 -45
- data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +0 -16
- data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +0 -43
- 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 -261
- data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +0 -114
- 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/module_node.rb +0 -24
- data/lib/rubocop/ast/node/or_node.rb +0 -29
- data/lib/rubocop/ast/node/pair_node.rb +0 -63
- data/lib/rubocop/ast/node/range_node.rb +0 -18
- data/lib/rubocop/ast/node/regexp_node.rb +0 -35
- data/lib/rubocop/ast/node/resbody_node.rb +0 -29
- data/lib/rubocop/ast/node/retry_node.rb +0 -17
- data/lib/rubocop/ast/node/self_class_node.rb +0 -24
- data/lib/rubocop/ast/node/send_node.rb +0 -13
- data/lib/rubocop/ast/node/str_node.rb +0 -16
- data/lib/rubocop/ast/node/super_node.rb +0 -21
- data/lib/rubocop/ast/node/symbol_node.rb +0 -12
- data/lib/rubocop/ast/node/until_node.rb +0 -35
- data/lib/rubocop/ast/node/when_node.rb +0 -53
- data/lib/rubocop/ast/node/while_node.rb +0 -35
- data/lib/rubocop/ast/node/yield_node.rb +0 -21
- data/lib/rubocop/ast/node.rb +0 -646
- data/lib/rubocop/ast/sexp.rb +0 -16
- data/lib/rubocop/ast/traversal.rb +0 -183
- data/lib/rubocop/cop/layout/align_array.rb +0 -39
- data/lib/rubocop/cop/layout/indent_heredoc.rb +0 -256
- data/lib/rubocop/cop/layout/tab.rb +0 -87
- data/lib/rubocop/cop/lint/end_in_method.rb +0 -40
- data/lib/rubocop/cop/lint/unneeded_cop_enable_directive.rb +0 -116
- data/lib/rubocop/cop/lint/useless_comparison.rb +0 -28
- data/lib/rubocop/cop/mixin/classish_length.rb +0 -37
- data/lib/rubocop/cop/mixin/ignored_method_patterns.rb +0 -19
- data/lib/rubocop/cop/mixin/parser_diagnostic.rb +0 -37
- data/lib/rubocop/cop/mixin/safe_mode.rb +0 -22
- data/lib/rubocop/cop/mixin/target_rails_version.rb +0 -16
- data/lib/rubocop/cop/mixin/too_many_lines.rb +0 -35
- data/lib/rubocop/cop/rails/action_filter.rb +0 -117
- data/lib/rubocop/cop/rails/active_record_aliases.rb +0 -48
- data/lib/rubocop/cop/rails/active_record_override.rb +0 -82
- data/lib/rubocop/cop/rails/active_support_aliases.rb +0 -69
- data/lib/rubocop/cop/rails/application_job.rb +0 -40
- data/lib/rubocop/cop/rails/application_record.rb +0 -40
- data/lib/rubocop/cop/rails/assert_not.rb +0 -44
- data/lib/rubocop/cop/rails/belongs_to.rb +0 -102
- data/lib/rubocop/cop/rails/blank.rb +0 -164
- data/lib/rubocop/cop/rails/bulk_change_table.rb +0 -289
- data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +0 -91
- data/lib/rubocop/cop/rails/date.rb +0 -161
- data/lib/rubocop/cop/rails/delegate.rb +0 -132
- data/lib/rubocop/cop/rails/delegate_allow_blank.rb +0 -37
- data/lib/rubocop/cop/rails/dynamic_find_by.rb +0 -91
- data/lib/rubocop/cop/rails/enum_uniqueness.rb +0 -45
- data/lib/rubocop/cop/rails/environment_comparison.rb +0 -68
- data/lib/rubocop/cop/rails/exit.rb +0 -67
- data/lib/rubocop/cop/rails/file_path.rb +0 -108
- data/lib/rubocop/cop/rails/find_by.rb +0 -55
- data/lib/rubocop/cop/rails/find_each.rb +0 -51
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +0 -25
- data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +0 -106
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +0 -117
- data/lib/rubocop/cop/rails/http_status.rb +0 -179
- data/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +0 -94
- data/lib/rubocop/cop/rails/inverse_of.rb +0 -246
- data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +0 -175
- data/lib/rubocop/cop/rails/link_to_blank.rb +0 -98
- data/lib/rubocop/cop/rails/not_null_column.rb +0 -67
- data/lib/rubocop/cop/rails/output.rb +0 -49
- data/lib/rubocop/cop/rails/output_safety.rb +0 -99
- data/lib/rubocop/cop/rails/pluralization_grammar.rb +0 -107
- data/lib/rubocop/cop/rails/presence.rb +0 -124
- data/lib/rubocop/cop/rails/present.rb +0 -153
- data/lib/rubocop/cop/rails/read_write_attribute.rb +0 -74
- data/lib/rubocop/cop/rails/redundant_allow_nil.rb +0 -111
- data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +0 -136
- data/lib/rubocop/cop/rails/reflection_class_name.rb +0 -37
- data/lib/rubocop/cop/rails/refute_methods.rb +0 -76
- data/lib/rubocop/cop/rails/relative_date_constant.rb +0 -93
- data/lib/rubocop/cop/rails/request_referer.rb +0 -56
- data/lib/rubocop/cop/rails/reversible_migration.rb +0 -286
- data/lib/rubocop/cop/rails/safe_navigation.rb +0 -87
- data/lib/rubocop/cop/rails/save_bang.rb +0 -316
- data/lib/rubocop/cop/rails/scope_args.rb +0 -29
- data/lib/rubocop/cop/rails/skips_model_validations.rb +0 -87
- data/lib/rubocop/cop/rails/time_zone.rb +0 -238
- data/lib/rubocop/cop/rails/uniq_before_pluck.rb +0 -105
- data/lib/rubocop/cop/rails/unknown_env.rb +0 -63
- data/lib/rubocop/cop/rails/validation.rb +0 -109
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +0 -190
- data/lib/rubocop/cop/style/method_missing_super.rb +0 -34
- data/lib/rubocop/formatter/disabled_lines_formatter.rb +0 -57
- data/lib/rubocop/node_pattern.rb +0 -720
- data/lib/rubocop/processed_source.rb +0 -208
- data/lib/rubocop/rspec/shared_examples.rb +0 -59
- data/lib/rubocop/string_util.rb +0 -14
- data/lib/rubocop/token.rb +0 -114
data/config/default.yml
CHANGED
@@ -35,6 +35,7 @@ AllCops:
|
|
35
35
|
- '**/*.watchr'
|
36
36
|
- '**/.irbrc'
|
37
37
|
- '**/.pryrc'
|
38
|
+
- '**/.simplecov'
|
38
39
|
- '**/buildfile'
|
39
40
|
- '**/Appraisals'
|
40
41
|
- '**/Berksfile'
|
@@ -53,12 +54,15 @@ AllCops:
|
|
53
54
|
- '**/Podfile'
|
54
55
|
- '**/Puppetfile'
|
55
56
|
- '**/Rakefile'
|
57
|
+
- '**/rakefile'
|
56
58
|
- '**/Snapfile'
|
59
|
+
- '**/Steepfile'
|
57
60
|
- '**/Thorfile'
|
58
61
|
- '**/Vagabondfile'
|
59
62
|
- '**/Vagrantfile'
|
60
63
|
Exclude:
|
61
64
|
- 'node_modules/**/*'
|
65
|
+
- 'tmp/**/*'
|
62
66
|
- 'vendor/**/*'
|
63
67
|
- '.git/**/*'
|
64
68
|
# Default formatter will be used if no `-f/--format` option is given.
|
@@ -73,7 +77,7 @@ AllCops:
|
|
73
77
|
DisplayStyleGuide: false
|
74
78
|
# When specifying style guide URLs, any paths and/or fragments will be
|
75
79
|
# evaluated relative to the base URL.
|
76
|
-
StyleGuideBaseURL: https://
|
80
|
+
StyleGuideBaseURL: https://rubystyle.guide
|
77
81
|
# Extra details are not displayed in offense messages by default. Change
|
78
82
|
# behavior by overriding ExtraDetails, or by giving the
|
79
83
|
# `-E/--extra-details` option.
|
@@ -95,6 +99,14 @@ AllCops:
|
|
95
99
|
# to true in the same configuration.
|
96
100
|
EnabledByDefault: false
|
97
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
|
98
110
|
# Enables the result cache if `true`. Can be overridden by the `--cache` command
|
99
111
|
# line option.
|
100
112
|
UseCache: true
|
@@ -105,6 +117,8 @@ AllCops:
|
|
105
117
|
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
106
118
|
# taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
|
107
119
|
# `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
|
120
|
+
# The CacheRootDirectory can be overwritten by passing the `--cache-root` command
|
121
|
+
# line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
|
108
122
|
CacheRootDirectory: ~
|
109
123
|
# It is possible for a malicious user to know the location of RuboCop's cache
|
110
124
|
# directory by looking at CacheRootDirectory, and create a symlink in its
|
@@ -123,16 +137,18 @@ AllCops:
|
|
123
137
|
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
|
124
138
|
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
|
125
139
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
126
|
-
# use the oldest officially supported Ruby version (currently Ruby 2.
|
140
|
+
# use the oldest officially supported Ruby version (currently Ruby 2.4).
|
127
141
|
TargetRubyVersion: ~
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
142
|
+
# Determines if a notification for extension libraries should be shown when
|
143
|
+
# rubocop is run. Keys are the name of the extension, and values are an array
|
144
|
+
# of gems in the Gemfile that the extension is suggested for, if not already
|
145
|
+
# included.
|
146
|
+
SuggestExtensions:
|
147
|
+
rubocop-rails: [rails]
|
148
|
+
rubocop-rspec: [rspec, rspec-rails]
|
149
|
+
rubocop-minitest: [minitest]
|
150
|
+
rubocop-sequel: [sequel]
|
151
|
+
rubocop-rake: [rake]
|
136
152
|
|
137
153
|
#################### Bundler ###############################
|
138
154
|
|
@@ -149,11 +165,13 @@ Bundler/GemComment:
|
|
149
165
|
Description: 'Add a comment describing each gem.'
|
150
166
|
Enabled: false
|
151
167
|
VersionAdded: '0.59'
|
168
|
+
VersionChanged: '0.85'
|
152
169
|
Include:
|
153
170
|
- '**/*.gemfile'
|
154
171
|
- '**/Gemfile'
|
155
172
|
- '**/gems.rb'
|
156
|
-
|
173
|
+
IgnoredGems: []
|
174
|
+
OnlyFor: []
|
157
175
|
|
158
176
|
Bundler/InsecureProtocolSource:
|
159
177
|
Description: >-
|
@@ -174,6 +192,9 @@ Bundler/OrderedGems:
|
|
174
192
|
VersionAdded: '0.46'
|
175
193
|
VersionChanged: '0.47'
|
176
194
|
TreatCommentsAsGroupSeparators: true
|
195
|
+
# By default, "-" and "_" are ignored for order purposes.
|
196
|
+
# This can be overridden by setting this parameter to true.
|
197
|
+
ConsiderPunctuation: false
|
177
198
|
Include:
|
178
199
|
- '**/*.gemfile'
|
179
200
|
- '**/Gemfile'
|
@@ -194,13 +215,25 @@ Gemspec/OrderedDependencies:
|
|
194
215
|
Enabled: true
|
195
216
|
VersionAdded: '0.51'
|
196
217
|
TreatCommentsAsGroupSeparators: true
|
218
|
+
# By default, "-" and "_" are ignored for order purposes.
|
219
|
+
# This can be overridden by setting this parameter to true.
|
220
|
+
ConsiderPunctuation: false
|
197
221
|
Include:
|
198
222
|
- '**/*.gemspec'
|
199
223
|
|
200
224
|
Gemspec/RequiredRubyVersion:
|
201
|
-
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml
|
225
|
+
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
202
226
|
Enabled: true
|
203
227
|
VersionAdded: '0.52'
|
228
|
+
VersionChanged: '0.89'
|
229
|
+
Include:
|
230
|
+
- '**/*.gemspec'
|
231
|
+
|
232
|
+
Gemspec/RubyVersionGlobalsUsage:
|
233
|
+
Description: Checks usage of RUBY_VERSION in gemspec.
|
234
|
+
StyleGuide: '#no-ruby-version-in-the-gemspec'
|
235
|
+
Enabled: true
|
236
|
+
VersionAdded: '0.72'
|
204
237
|
Include:
|
205
238
|
- '**/*.gemspec'
|
206
239
|
|
@@ -219,13 +252,14 @@ Layout/AccessModifierIndentation:
|
|
219
252
|
# But it can be overridden by setting this parameter
|
220
253
|
IndentationWidth: ~
|
221
254
|
|
222
|
-
Layout/
|
255
|
+
Layout/ArgumentAlignment:
|
223
256
|
Description: >-
|
224
257
|
Align the arguments of a method call if they span more
|
225
258
|
than one line.
|
226
259
|
StyleGuide: '#no-double-indent'
|
227
260
|
Enabled: true
|
228
261
|
VersionAdded: '0.68'
|
262
|
+
VersionChanged: '0.77'
|
229
263
|
# Alignment of arguments in multi-line method calls.
|
230
264
|
#
|
231
265
|
# The `with_first_argument` style aligns the following lines along the same
|
@@ -247,120 +281,59 @@ Layout/AlignArguments:
|
|
247
281
|
# But it can be overridden by setting this parameter
|
248
282
|
IndentationWidth: ~
|
249
283
|
|
250
|
-
Layout/
|
284
|
+
Layout/ArrayAlignment:
|
251
285
|
Description: >-
|
252
286
|
Align the elements of an array literal if they span more than
|
253
287
|
one line.
|
254
|
-
StyleGuide: '#align-multiline-arrays'
|
255
|
-
Enabled: true
|
256
|
-
VersionAdded: '0.49'
|
257
|
-
|
258
|
-
Layout/AlignHash:
|
259
|
-
Description: >-
|
260
|
-
Align the elements of a hash literal if they span more than
|
261
|
-
one line.
|
262
|
-
Enabled: true
|
263
|
-
AllowMultipleStyles: true
|
264
|
-
VersionAdded: '0.49'
|
265
|
-
# Alignment of entries using hash rocket as separator. Valid values are:
|
266
|
-
#
|
267
|
-
# key - left alignment of keys
|
268
|
-
# 'a' => 2
|
269
|
-
# 'bb' => 3
|
270
|
-
# separator - alignment of hash rockets, keys are right aligned
|
271
|
-
# 'a' => 2
|
272
|
-
# 'bb' => 3
|
273
|
-
# table - left alignment of keys, hash rockets, and values
|
274
|
-
# 'a' => 2
|
275
|
-
# 'bb' => 3
|
276
|
-
EnforcedHashRocketStyle: key
|
277
|
-
SupportedHashRocketStyles:
|
278
|
-
- key
|
279
|
-
- separator
|
280
|
-
- table
|
281
|
-
# Alignment of entries using colon as separator. Valid values are:
|
282
|
-
#
|
283
|
-
# key - left alignment of keys
|
284
|
-
# a: 0
|
285
|
-
# bb: 1
|
286
|
-
# separator - alignment of colons, keys are right aligned
|
287
|
-
# a: 0
|
288
|
-
# bb: 1
|
289
|
-
# table - left alignment of keys and values
|
290
|
-
# a: 0
|
291
|
-
# bb: 1
|
292
|
-
EnforcedColonStyle: key
|
293
|
-
SupportedColonStyles:
|
294
|
-
- key
|
295
|
-
- separator
|
296
|
-
- table
|
297
|
-
# Select whether hashes that are the last argument in a method call should be
|
298
|
-
# inspected? Valid values are:
|
299
|
-
#
|
300
|
-
# always_inspect - Inspect both implicit and explicit hashes.
|
301
|
-
# Registers an offense for:
|
302
|
-
# function(a: 1,
|
303
|
-
# b: 2)
|
304
|
-
# Registers an offense for:
|
305
|
-
# function({a: 1,
|
306
|
-
# b: 2})
|
307
|
-
# always_ignore - Ignore both implicit and explicit hashes.
|
308
|
-
# Accepts:
|
309
|
-
# function(a: 1,
|
310
|
-
# b: 2)
|
311
|
-
# Accepts:
|
312
|
-
# function({a: 1,
|
313
|
-
# b: 2})
|
314
|
-
# ignore_implicit - Ignore only implicit hashes.
|
315
|
-
# Accepts:
|
316
|
-
# function(a: 1,
|
317
|
-
# b: 2)
|
318
|
-
# Registers an offense for:
|
319
|
-
# function({a: 1,
|
320
|
-
# b: 2})
|
321
|
-
# ignore_explicit - Ignore only explicit hashes.
|
322
|
-
# Accepts:
|
323
|
-
# function({a: 1,
|
324
|
-
# b: 2})
|
325
|
-
# Registers an offense for:
|
326
|
-
# function(a: 1,
|
327
|
-
# b: 2)
|
328
|
-
EnforcedLastArgumentHashStyle: always_inspect
|
329
|
-
SupportedLastArgumentHashStyles:
|
330
|
-
- always_inspect
|
331
|
-
- always_ignore
|
332
|
-
- ignore_implicit
|
333
|
-
- ignore_explicit
|
334
|
-
|
335
|
-
Layout/AlignParameters:
|
336
|
-
Description: >-
|
337
|
-
Align the parameters of a method definition if they span more
|
338
|
-
than one line.
|
339
288
|
StyleGuide: '#no-double-indent'
|
340
289
|
Enabled: true
|
341
290
|
VersionAdded: '0.49'
|
342
|
-
VersionChanged: '0.
|
343
|
-
# Alignment of
|
291
|
+
VersionChanged: '0.77'
|
292
|
+
# Alignment of elements of a multi-line array.
|
344
293
|
#
|
345
294
|
# The `with_first_parameter` style aligns the following lines along the same
|
346
|
-
# column as the first
|
295
|
+
# column as the first element.
|
347
296
|
#
|
348
|
-
#
|
349
|
-
#
|
297
|
+
# array = [1, 2, 3,
|
298
|
+
# 4, 5, 6]
|
350
299
|
#
|
351
300
|
# The `with_fixed_indentation` style aligns the following lines with one
|
352
|
-
# level of indentation relative to the start of the line with
|
301
|
+
# level of indentation relative to the start of the line with start of array.
|
353
302
|
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
EnforcedStyle:
|
303
|
+
# array = [1, 2, 3,
|
304
|
+
# 4, 5, 6]
|
305
|
+
EnforcedStyle: with_first_element
|
357
306
|
SupportedStyles:
|
358
|
-
-
|
307
|
+
- with_first_element
|
359
308
|
- with_fixed_indentation
|
360
309
|
# By default, the indentation width from Layout/IndentationWidth is used
|
361
310
|
# But it can be overridden by setting this parameter
|
362
311
|
IndentationWidth: ~
|
363
312
|
|
313
|
+
Layout/AssignmentIndentation:
|
314
|
+
Description: >-
|
315
|
+
Checks the indentation of the first line of the
|
316
|
+
right-hand-side of a multi-line assignment.
|
317
|
+
Enabled: true
|
318
|
+
VersionAdded: '0.49'
|
319
|
+
VersionChanged: '0.77'
|
320
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
321
|
+
# But it can be overridden by setting this parameter
|
322
|
+
IndentationWidth: ~
|
323
|
+
|
324
|
+
Layout/BeginEndAlignment:
|
325
|
+
Description: 'Align ends corresponding to begins correctly.'
|
326
|
+
Enabled: true
|
327
|
+
VersionAdded: '0.91'
|
328
|
+
# The value `start_of_line` means that `end` should be aligned the start of the line
|
329
|
+
# where the `begin` keyword is.
|
330
|
+
# The value `begin` means that `end` should be aligned with the `begin` keyword.
|
331
|
+
EnforcedStyleAlignWith: start_of_line
|
332
|
+
SupportedStylesAlignWith:
|
333
|
+
- start_of_line
|
334
|
+
- begin
|
335
|
+
Severity: warning
|
336
|
+
|
364
337
|
Layout/BlockAlignment:
|
365
338
|
Description: 'Align block ends correctly.'
|
366
339
|
Enabled: true
|
@@ -437,6 +410,7 @@ Layout/ConditionPosition:
|
|
437
410
|
StyleGuide: '#same-line-condition'
|
438
411
|
Enabled: true
|
439
412
|
VersionAdded: '0.53'
|
413
|
+
VersionChanged: '0.83'
|
440
414
|
|
441
415
|
Layout/DefEndAlignment:
|
442
416
|
Description: 'Align ends corresponding to defs correctly.'
|
@@ -450,7 +424,6 @@ Layout/DefEndAlignment:
|
|
450
424
|
SupportedStylesAlignWith:
|
451
425
|
- start_of_line
|
452
426
|
- def
|
453
|
-
AutoCorrect: false
|
454
427
|
Severity: warning
|
455
428
|
|
456
429
|
Layout/DotPosition:
|
@@ -487,11 +460,23 @@ Layout/EmptyLineAfterMagicComment:
|
|
487
460
|
Enabled: true
|
488
461
|
VersionAdded: '0.49'
|
489
462
|
|
463
|
+
Layout/EmptyLineAfterMultilineCondition:
|
464
|
+
Description: 'Enforces empty line after multiline condition.'
|
465
|
+
# This is disabled, because this style is not very common in practice.
|
466
|
+
Enabled: false
|
467
|
+
VersionAdded: '0.90'
|
468
|
+
Reference:
|
469
|
+
- https://github.com/airbnb/ruby#multiline-if-newline
|
470
|
+
|
490
471
|
Layout/EmptyLineBetweenDefs:
|
491
|
-
Description: 'Use empty lines between defs.'
|
472
|
+
Description: 'Use empty lines between class/module/method defs.'
|
492
473
|
StyleGuide: '#empty-lines-between-methods'
|
493
474
|
Enabled: true
|
494
475
|
VersionAdded: '0.49'
|
476
|
+
VersionChanged: '1.4'
|
477
|
+
EmptyLineBetweenMethodDefs: true
|
478
|
+
EmptyLineBetweenClassDefs: true
|
479
|
+
EmptyLineBetweenModuleDefs: true
|
495
480
|
# If `true`, this parameter means that single line method definitions don't
|
496
481
|
# need an empty line between them.
|
497
482
|
AllowAdjacentOneLineDefs: false
|
@@ -522,6 +507,19 @@ Layout/EmptyLinesAroundArguments:
|
|
522
507
|
Enabled: true
|
523
508
|
VersionAdded: '0.52'
|
524
509
|
|
510
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
511
|
+
Description: "Keep blank lines around attribute accessors."
|
512
|
+
StyleGuide: '#empty-lines-around-attribute-accessor'
|
513
|
+
Enabled: true
|
514
|
+
VersionAdded: '0.83'
|
515
|
+
VersionChanged: '0.84'
|
516
|
+
AllowAliasSyntax: true
|
517
|
+
AllowedMethods:
|
518
|
+
- alias_method
|
519
|
+
- public
|
520
|
+
- protected
|
521
|
+
- private
|
522
|
+
|
525
523
|
Layout/EmptyLinesAroundBeginBody:
|
526
524
|
Description: "Keeps track of empty lines around begin-end bodies."
|
527
525
|
StyleGuide: '#empty-lines-around-bodies'
|
@@ -593,7 +591,6 @@ Layout/EndAlignment:
|
|
593
591
|
- keyword
|
594
592
|
- variable
|
595
593
|
- start_of_line
|
596
|
-
AutoCorrect: false
|
597
594
|
Severity: warning
|
598
595
|
|
599
596
|
Layout/EndOfLine:
|
@@ -625,56 +622,11 @@ Layout/ExtraSpacing:
|
|
625
622
|
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
626
623
|
ForceEqualSignAlignment: false
|
627
624
|
|
628
|
-
Layout/
|
629
|
-
Description: >-
|
630
|
-
Checks for a line break before the first element in a
|
631
|
-
multi-line array.
|
632
|
-
Enabled: false
|
633
|
-
VersionAdded: '0.49'
|
634
|
-
|
635
|
-
Layout/FirstHashElementLineBreak:
|
636
|
-
Description: >-
|
637
|
-
Checks for a line break before the first element in a
|
638
|
-
multi-line hash.
|
639
|
-
Enabled: false
|
640
|
-
VersionAdded: '0.49'
|
641
|
-
|
642
|
-
Layout/FirstMethodArgumentLineBreak:
|
643
|
-
Description: >-
|
644
|
-
Checks for a line break before the first argument in a
|
645
|
-
multi-line method call.
|
646
|
-
Enabled: false
|
647
|
-
VersionAdded: '0.49'
|
648
|
-
|
649
|
-
Layout/FirstMethodParameterLineBreak:
|
650
|
-
Description: >-
|
651
|
-
Checks for a line break before the first parameter in a
|
652
|
-
multi-line method parameter definition.
|
653
|
-
Enabled: false
|
654
|
-
VersionAdded: '0.49'
|
655
|
-
|
656
|
-
Layout/HeredocArgumentClosingParenthesis:
|
657
|
-
Description: >-
|
658
|
-
Checks for the placement of the closing parenthesis in a
|
659
|
-
method call that passes a HEREDOC string as an argument.
|
660
|
-
Enabled: false
|
661
|
-
StyleGuide: '#heredoc-argument-closing-parentheses'
|
662
|
-
VersionAdded: '0.68'
|
663
|
-
|
664
|
-
Layout/IndentAssignment:
|
665
|
-
Description: >-
|
666
|
-
Checks the indentation of the first line of the
|
667
|
-
right-hand-side of a multi-line assignment.
|
668
|
-
Enabled: true
|
669
|
-
VersionAdded: '0.49'
|
670
|
-
# By default, the indentation width from `Layout/IndentationWidth` is used
|
671
|
-
# But it can be overridden by setting this parameter
|
672
|
-
IndentationWidth: ~
|
673
|
-
|
674
|
-
Layout/IndentFirstArgument:
|
625
|
+
Layout/FirstArgumentIndentation:
|
675
626
|
Description: 'Checks the indentation of the first argument in a method call.'
|
676
627
|
Enabled: true
|
677
628
|
VersionAdded: '0.68'
|
629
|
+
VersionChanged: '0.77'
|
678
630
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
679
631
|
SupportedStyles:
|
680
632
|
# The first parameter should always be indented one step more than the
|
@@ -695,12 +647,13 @@ Layout/IndentFirstArgument:
|
|
695
647
|
# But it can be overridden by setting this parameter
|
696
648
|
IndentationWidth: ~
|
697
649
|
|
698
|
-
Layout/
|
650
|
+
Layout/FirstArrayElementIndentation:
|
699
651
|
Description: >-
|
700
652
|
Checks the indentation of the first element in an array
|
701
653
|
literal.
|
702
654
|
Enabled: true
|
703
655
|
VersionAdded: '0.68'
|
656
|
+
VersionChanged: '0.77'
|
704
657
|
# The value `special_inside_parentheses` means that array literals with
|
705
658
|
# brackets that have their opening bracket on the same line as a surrounding
|
706
659
|
# opening round parenthesis, shall have their first element indented relative
|
@@ -721,10 +674,18 @@ Layout/IndentFirstArrayElement:
|
|
721
674
|
# But it can be overridden by setting this parameter
|
722
675
|
IndentationWidth: ~
|
723
676
|
|
724
|
-
Layout/
|
677
|
+
Layout/FirstArrayElementLineBreak:
|
678
|
+
Description: >-
|
679
|
+
Checks for a line break before the first element in a
|
680
|
+
multi-line array.
|
681
|
+
Enabled: false
|
682
|
+
VersionAdded: '0.49'
|
683
|
+
|
684
|
+
Layout/FirstHashElementIndentation:
|
725
685
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
726
686
|
Enabled: true
|
727
687
|
VersionAdded: '0.68'
|
688
|
+
VersionChanged: '0.77'
|
728
689
|
# The value `special_inside_parentheses` means that hash literals with braces
|
729
690
|
# that have their opening brace on the same line as a surrounding opening
|
730
691
|
# round parenthesis, shall have their first key indented relative to the
|
@@ -745,13 +706,34 @@ Layout/IndentFirstHashElement:
|
|
745
706
|
# But it can be overridden by setting this parameter
|
746
707
|
IndentationWidth: ~
|
747
708
|
|
748
|
-
Layout/
|
709
|
+
Layout/FirstHashElementLineBreak:
|
710
|
+
Description: >-
|
711
|
+
Checks for a line break before the first element in a
|
712
|
+
multi-line hash.
|
713
|
+
Enabled: false
|
714
|
+
VersionAdded: '0.49'
|
715
|
+
|
716
|
+
Layout/FirstMethodArgumentLineBreak:
|
717
|
+
Description: >-
|
718
|
+
Checks for a line break before the first argument in a
|
719
|
+
multi-line method call.
|
720
|
+
Enabled: false
|
721
|
+
VersionAdded: '0.49'
|
722
|
+
|
723
|
+
Layout/FirstMethodParameterLineBreak:
|
724
|
+
Description: >-
|
725
|
+
Checks for a line break before the first parameter in a
|
726
|
+
multi-line method parameter definition.
|
727
|
+
Enabled: false
|
728
|
+
VersionAdded: '0.49'
|
729
|
+
|
730
|
+
Layout/FirstParameterIndentation:
|
749
731
|
Description: >-
|
750
732
|
Checks the indentation of the first parameter in a
|
751
733
|
method definition.
|
752
734
|
Enabled: true
|
753
735
|
VersionAdded: '0.49'
|
754
|
-
VersionChanged: '0.
|
736
|
+
VersionChanged: '0.77'
|
755
737
|
EnforcedStyle: consistent
|
756
738
|
SupportedStyles:
|
757
739
|
- consistent
|
@@ -760,89 +742,212 @@ Layout/IndentFirstParameter:
|
|
760
742
|
# But it can be overridden by setting this parameter
|
761
743
|
IndentationWidth: ~
|
762
744
|
|
763
|
-
Layout/
|
764
|
-
Description: 'This cop checks the indentation of the here document bodies.'
|
765
|
-
StyleGuide: '#squiggly-heredocs'
|
766
|
-
Enabled: true
|
767
|
-
VersionAdded: '0.49'
|
768
|
-
VersionChanged: '0.69'
|
769
|
-
EnforcedStyle: squiggly
|
770
|
-
SupportedStyles:
|
771
|
-
- squiggly
|
772
|
-
- active_support
|
773
|
-
- powerpack
|
774
|
-
- unindent
|
775
|
-
|
776
|
-
Layout/IndentationConsistency:
|
777
|
-
Description: 'Keep indentation straight.'
|
778
|
-
StyleGuide: '#spaces-indentation'
|
779
|
-
Enabled: true
|
780
|
-
VersionAdded: '0.49'
|
781
|
-
# The difference between `rails` and `normal` is that the `rails` style
|
782
|
-
# prescribes that in classes and modules the `protected` and `private`
|
783
|
-
# modifier keywords shall be indented the same as public methods and that
|
784
|
-
# protected and private members shall be indented one step more than the
|
785
|
-
# modifiers. Other than that, both styles mean that entities on the same
|
786
|
-
# logical depth shall have the same indentation.
|
787
|
-
EnforcedStyle: normal
|
788
|
-
SupportedStyles:
|
789
|
-
- normal
|
790
|
-
- rails
|
791
|
-
Reference:
|
792
|
-
# A reference to `EnforcedStyle: rails`.
|
793
|
-
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
794
|
-
|
795
|
-
Layout/IndentationWidth:
|
796
|
-
Description: 'Use 2 spaces for indentation.'
|
797
|
-
StyleGuide: '#spaces-indentation'
|
798
|
-
Enabled: true
|
799
|
-
VersionAdded: '0.49'
|
800
|
-
# Number of spaces for each indentation level.
|
801
|
-
Width: 2
|
802
|
-
IgnoredPatterns: []
|
803
|
-
|
804
|
-
Layout/InitialIndentation:
|
805
|
-
Description: >-
|
806
|
-
Checks the indentation of the first non-blank non-comment line in a file.
|
807
|
-
Enabled: true
|
808
|
-
VersionAdded: '0.49'
|
809
|
-
|
810
|
-
Layout/LeadingBlankLines:
|
811
|
-
Description: Check for unnecessary blank lines at the beginning of a file.
|
812
|
-
Enabled: true
|
813
|
-
VersionAdded: '0.57'
|
814
|
-
|
815
|
-
Layout/LeadingCommentSpace:
|
816
|
-
Description: 'Comments should start with a space.'
|
817
|
-
StyleGuide: '#hash-space'
|
818
|
-
Enabled: true
|
819
|
-
VersionAdded: '0.49'
|
820
|
-
|
821
|
-
Layout/MultilineArrayBraceLayout:
|
745
|
+
Layout/HashAlignment:
|
822
746
|
Description: >-
|
823
|
-
|
824
|
-
|
825
|
-
a new line.
|
747
|
+
Align the elements of a hash literal if they span more than
|
748
|
+
one line.
|
826
749
|
Enabled: true
|
750
|
+
AllowMultipleStyles: true
|
827
751
|
VersionAdded: '0.49'
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
752
|
+
VersionChanged: '0.77'
|
753
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
754
|
+
#
|
755
|
+
# key - left alignment of keys
|
756
|
+
# 'a' => 2
|
757
|
+
# 'bb' => 3
|
758
|
+
# separator - alignment of hash rockets, keys are right aligned
|
759
|
+
# 'a' => 2
|
760
|
+
# 'bb' => 3
|
761
|
+
# table - left alignment of keys, hash rockets, and values
|
762
|
+
# 'a' => 2
|
763
|
+
# 'bb' => 3
|
764
|
+
EnforcedHashRocketStyle: key
|
765
|
+
SupportedHashRocketStyles:
|
766
|
+
- key
|
767
|
+
- separator
|
768
|
+
- table
|
769
|
+
# Alignment of entries using colon as separator. Valid values are:
|
770
|
+
#
|
771
|
+
# key - left alignment of keys
|
772
|
+
# a: 0
|
773
|
+
# bb: 1
|
774
|
+
# separator - alignment of colons, keys are right aligned
|
775
|
+
# a: 0
|
776
|
+
# bb: 1
|
777
|
+
# table - left alignment of keys and values
|
778
|
+
# a: 0
|
779
|
+
# bb: 1
|
780
|
+
EnforcedColonStyle: key
|
781
|
+
SupportedColonStyles:
|
782
|
+
- key
|
783
|
+
- separator
|
784
|
+
- table
|
785
|
+
# Select whether hashes that are the last argument in a method call should be
|
786
|
+
# inspected? Valid values are:
|
787
|
+
#
|
788
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
789
|
+
# Registers an offense for:
|
790
|
+
# function(a: 1,
|
791
|
+
# b: 2)
|
792
|
+
# Registers an offense for:
|
793
|
+
# function({a: 1,
|
794
|
+
# b: 2})
|
795
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
796
|
+
# Accepts:
|
797
|
+
# function(a: 1,
|
798
|
+
# b: 2)
|
799
|
+
# Accepts:
|
800
|
+
# function({a: 1,
|
801
|
+
# b: 2})
|
802
|
+
# ignore_implicit - Ignore only implicit hashes.
|
803
|
+
# Accepts:
|
804
|
+
# function(a: 1,
|
805
|
+
# b: 2)
|
806
|
+
# Registers an offense for:
|
807
|
+
# function({a: 1,
|
808
|
+
# b: 2})
|
809
|
+
# ignore_explicit - Ignore only explicit hashes.
|
810
|
+
# Accepts:
|
811
|
+
# function({a: 1,
|
812
|
+
# b: 2})
|
813
|
+
# Registers an offense for:
|
814
|
+
# function(a: 1,
|
815
|
+
# b: 2)
|
816
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
817
|
+
SupportedLastArgumentHashStyles:
|
818
|
+
- always_inspect
|
819
|
+
- always_ignore
|
820
|
+
- ignore_implicit
|
821
|
+
- ignore_explicit
|
822
|
+
|
823
|
+
Layout/HeredocArgumentClosingParenthesis:
|
824
|
+
Description: >-
|
825
|
+
Checks for the placement of the closing parenthesis in a
|
826
|
+
method call that passes a HEREDOC string as an argument.
|
827
|
+
Enabled: false
|
828
|
+
StyleGuide: '#heredoc-argument-closing-parentheses'
|
829
|
+
VersionAdded: '0.68'
|
830
|
+
|
831
|
+
Layout/HeredocIndentation:
|
832
|
+
Description: 'This cop checks the indentation of the here document bodies.'
|
833
|
+
StyleGuide: '#squiggly-heredocs'
|
834
|
+
Enabled: true
|
835
|
+
VersionAdded: '0.49'
|
836
|
+
VersionChanged: '0.85'
|
837
|
+
|
838
|
+
Layout/IndentationConsistency:
|
839
|
+
Description: 'Keep indentation straight.'
|
840
|
+
StyleGuide: '#spaces-indentation'
|
841
|
+
Enabled: true
|
842
|
+
VersionAdded: '0.49'
|
843
|
+
# The difference between `indented` and `normal` is that the `indented_internal_methods`
|
844
|
+
# style prescribes that in classes and modules the `protected` and `private`
|
845
|
+
# modifier keywords shall be indented the same as public methods and that
|
846
|
+
# protected and private members shall be indented one step more than the
|
847
|
+
# modifiers. Other than that, both styles mean that entities on the same
|
848
|
+
# logical depth shall have the same indentation.
|
849
|
+
EnforcedStyle: normal
|
850
|
+
SupportedStyles:
|
851
|
+
- normal
|
852
|
+
- indented_internal_methods
|
853
|
+
Reference:
|
854
|
+
# A reference to `EnforcedStyle: indented_internal_methods`.
|
855
|
+
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
856
|
+
|
857
|
+
Layout/IndentationStyle:
|
858
|
+
Description: 'Consistent indentation either with tabs only or spaces only.'
|
859
|
+
StyleGuide: '#spaces-indentation'
|
860
|
+
Enabled: true
|
861
|
+
VersionAdded: '0.49'
|
862
|
+
VersionChanged: '0.82'
|
863
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
864
|
+
# But it can be overridden by setting this parameter
|
865
|
+
# It is used during auto-correction to determine how many spaces should
|
866
|
+
# replace each tab.
|
867
|
+
IndentationWidth: ~
|
868
|
+
EnforcedStyle: spaces
|
869
|
+
SupportedStyles:
|
870
|
+
- spaces
|
871
|
+
- tabs
|
872
|
+
|
873
|
+
Layout/IndentationWidth:
|
874
|
+
Description: 'Use 2 spaces for indentation.'
|
875
|
+
StyleGuide: '#spaces-indentation'
|
876
|
+
Enabled: true
|
877
|
+
VersionAdded: '0.49'
|
878
|
+
# Number of spaces for each indentation level.
|
879
|
+
Width: 2
|
880
|
+
IgnoredPatterns: []
|
881
|
+
|
882
|
+
Layout/InitialIndentation:
|
883
|
+
Description: >-
|
884
|
+
Checks the indentation of the first non-blank non-comment line in a file.
|
885
|
+
Enabled: true
|
886
|
+
VersionAdded: '0.49'
|
887
|
+
|
888
|
+
Layout/LeadingCommentSpace:
|
889
|
+
Description: 'Comments should start with a space.'
|
890
|
+
StyleGuide: '#hash-space'
|
891
|
+
Enabled: true
|
892
|
+
VersionAdded: '0.49'
|
893
|
+
VersionChanged: '0.73'
|
894
|
+
AllowDoxygenCommentStyle: false
|
895
|
+
AllowGemfileRubyComment: false
|
896
|
+
|
897
|
+
Layout/LeadingEmptyLines:
|
898
|
+
Description: Check for unnecessary blank lines at the beginning of a file.
|
899
|
+
Enabled: true
|
900
|
+
VersionAdded: '0.57'
|
901
|
+
VersionChanged: '0.77'
|
902
|
+
|
903
|
+
Layout/LineLength:
|
904
|
+
Description: 'Checks that line length does not exceed the configured limit.'
|
905
|
+
StyleGuide: '#max-line-length'
|
906
|
+
Enabled: true
|
907
|
+
VersionAdded: '0.25'
|
908
|
+
VersionChanged: '1.4'
|
909
|
+
AutoCorrect: true
|
910
|
+
Max: 120
|
911
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
912
|
+
# containing a URI to be longer than Max.
|
913
|
+
AllowHeredoc: true
|
914
|
+
AllowURI: true
|
915
|
+
URISchemes:
|
916
|
+
- http
|
917
|
+
- https
|
918
|
+
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
919
|
+
# directives like '# rubocop: enable ...' when calculating a line's length.
|
920
|
+
IgnoreCopDirectives: true
|
921
|
+
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
|
922
|
+
# elements. Strings will be converted to Regexp objects. A line that matches
|
923
|
+
# any regular expression listed in this option will be ignored by LineLength.
|
924
|
+
IgnoredPatterns: []
|
925
|
+
|
926
|
+
Layout/MultilineArrayBraceLayout:
|
927
|
+
Description: >-
|
928
|
+
Checks that the closing brace in an array literal is
|
929
|
+
either on the same line as the last array element, or
|
930
|
+
a new line.
|
931
|
+
Enabled: true
|
932
|
+
VersionAdded: '0.49'
|
933
|
+
EnforcedStyle: symmetrical
|
934
|
+
SupportedStyles:
|
935
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
936
|
+
# new_line: closing brace is always on a new line
|
937
|
+
# same_line: closing brace is always on the same line as last element
|
938
|
+
- symmetrical
|
939
|
+
- new_line
|
940
|
+
- same_line
|
941
|
+
|
942
|
+
Layout/MultilineArrayLineBreaks:
|
943
|
+
Description: >-
|
944
|
+
Checks that each item in a multi-line array literal
|
945
|
+
starts on a separate line.
|
946
|
+
Enabled: false
|
947
|
+
VersionAdded: '0.67'
|
948
|
+
|
949
|
+
Layout/MultilineAssignmentLayout:
|
950
|
+
Description: 'Check for a newline after the assignment operator in multi-line assignments.'
|
846
951
|
StyleGuide: '#indent-conditional-assignment'
|
847
952
|
Enabled: false
|
848
953
|
VersionAdded: '0.49'
|
@@ -959,6 +1064,35 @@ Layout/MultilineOperationIndentation:
|
|
959
1064
|
# But it can be overridden by setting this parameter
|
960
1065
|
IndentationWidth: ~
|
961
1066
|
|
1067
|
+
Layout/ParameterAlignment:
|
1068
|
+
Description: >-
|
1069
|
+
Align the parameters of a method definition if they span more
|
1070
|
+
than one line.
|
1071
|
+
StyleGuide: '#no-double-indent'
|
1072
|
+
Enabled: true
|
1073
|
+
VersionAdded: '0.49'
|
1074
|
+
VersionChanged: '0.77'
|
1075
|
+
# Alignment of parameters in multi-line method calls.
|
1076
|
+
#
|
1077
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
1078
|
+
# column as the first parameter.
|
1079
|
+
#
|
1080
|
+
# def method_foo(a,
|
1081
|
+
# b)
|
1082
|
+
#
|
1083
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
1084
|
+
# level of indentation relative to the start of the line with the method call.
|
1085
|
+
#
|
1086
|
+
# def method_foo(a,
|
1087
|
+
# b)
|
1088
|
+
EnforcedStyle: with_first_parameter
|
1089
|
+
SupportedStyles:
|
1090
|
+
- with_first_parameter
|
1091
|
+
- with_fixed_indentation
|
1092
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
1093
|
+
# But it can be overridden by setting this parameter
|
1094
|
+
IndentationWidth: ~
|
1095
|
+
|
962
1096
|
Layout/RescueEnsureAlignment:
|
963
1097
|
Description: 'Align rescues and ensures correctly.'
|
964
1098
|
Enabled: true
|
@@ -1023,6 +1157,11 @@ Layout/SpaceAroundKeyword:
|
|
1023
1157
|
Enabled: true
|
1024
1158
|
VersionAdded: '0.49'
|
1025
1159
|
|
1160
|
+
Layout/SpaceAroundMethodCallOperator:
|
1161
|
+
Description: 'Checks method call operators to not have spaces around them.'
|
1162
|
+
Enabled: true
|
1163
|
+
VersionAdded: '0.82'
|
1164
|
+
|
1026
1165
|
Layout/SpaceAroundOperators:
|
1027
1166
|
Description: 'Use a single space around operators.'
|
1028
1167
|
StyleGuide: '#spaces-operators'
|
@@ -1032,6 +1171,10 @@ Layout/SpaceAroundOperators:
|
|
1032
1171
|
# with an operator on the previous or next line, not counting empty lines
|
1033
1172
|
# or comment lines.
|
1034
1173
|
AllowForAlignment: true
|
1174
|
+
EnforcedStyleForExponentOperator: no_space
|
1175
|
+
SupportedStylesForExponentOperator:
|
1176
|
+
- space
|
1177
|
+
- no_space
|
1035
1178
|
|
1036
1179
|
Layout/SpaceBeforeBlockBraces:
|
1037
1180
|
Description: >-
|
@@ -1047,7 +1190,7 @@ Layout/SpaceBeforeBlockBraces:
|
|
1047
1190
|
SupportedStylesForEmptyBraces:
|
1048
1191
|
- space
|
1049
1192
|
- no_space
|
1050
|
-
VersionChanged: '0.52
|
1193
|
+
VersionChanged: '0.52'
|
1051
1194
|
|
1052
1195
|
Layout/SpaceBeforeComma:
|
1053
1196
|
Description: 'No spaces before commas.'
|
@@ -1127,7 +1270,7 @@ Layout/SpaceInsideBlockBraces:
|
|
1127
1270
|
|
1128
1271
|
Layout/SpaceInsideHashLiteralBraces:
|
1129
1272
|
Description: "Use spaces inside hash literal braces - or don't."
|
1130
|
-
StyleGuide: '#spaces-
|
1273
|
+
StyleGuide: '#spaces-braces'
|
1131
1274
|
Enabled: true
|
1132
1275
|
VersionAdded: '0.49'
|
1133
1276
|
EnforcedStyle: space
|
@@ -1189,23 +1332,12 @@ Layout/SpaceInsideStringInterpolation:
|
|
1189
1332
|
- space
|
1190
1333
|
- no_space
|
1191
1334
|
|
1192
|
-
Layout/
|
1193
|
-
Description: 'No hard tabs.'
|
1194
|
-
StyleGuide: '#spaces-indentation'
|
1195
|
-
Enabled: true
|
1196
|
-
VersionAdded: '0.49'
|
1197
|
-
VersionChanged: '0.51'
|
1198
|
-
# By default, the indentation width from Layout/IndentationWidth is used
|
1199
|
-
# But it can be overridden by setting this parameter
|
1200
|
-
# It is used during auto-correction to determine how many spaces should
|
1201
|
-
# replace each tab.
|
1202
|
-
IndentationWidth: ~
|
1203
|
-
|
1204
|
-
Layout/TrailingBlankLines:
|
1335
|
+
Layout/TrailingEmptyLines:
|
1205
1336
|
Description: 'Checks trailing blank lines and final newline.'
|
1206
1337
|
StyleGuide: '#newline-eof'
|
1207
1338
|
Enabled: true
|
1208
1339
|
VersionAdded: '0.49'
|
1340
|
+
VersionChanged: '0.77'
|
1209
1341
|
EnforcedStyle: final_newline
|
1210
1342
|
SupportedStyles:
|
1211
1343
|
- final_newline
|
@@ -1216,7 +1348,7 @@ Layout/TrailingWhitespace:
|
|
1216
1348
|
StyleGuide: '#no-trailing-whitespace'
|
1217
1349
|
Enabled: true
|
1218
1350
|
VersionAdded: '0.49'
|
1219
|
-
VersionChanged: '0
|
1351
|
+
VersionChanged: '1.0'
|
1220
1352
|
AllowInHeredoc: false
|
1221
1353
|
|
1222
1354
|
#################### Lint ##################################
|
@@ -1237,6 +1369,7 @@ Lint/AmbiguousOperator:
|
|
1237
1369
|
StyleGuide: '#method-invocation-parens'
|
1238
1370
|
Enabled: true
|
1239
1371
|
VersionAdded: '0.17'
|
1372
|
+
VersionChanged: '0.83'
|
1240
1373
|
|
1241
1374
|
Lint/AmbiguousRegexpLiteral:
|
1242
1375
|
Description: >-
|
@@ -1244,6 +1377,7 @@ Lint/AmbiguousRegexpLiteral:
|
|
1244
1377
|
a method invocation without parentheses.
|
1245
1378
|
Enabled: true
|
1246
1379
|
VersionAdded: '0.17'
|
1380
|
+
VersionChanged: '0.83'
|
1247
1381
|
|
1248
1382
|
Lint/AssignmentInCondition:
|
1249
1383
|
Description: "Don't use assignment in conditions."
|
@@ -1257,47 +1391,123 @@ Lint/BigDecimalNew:
|
|
1257
1391
|
Enabled: true
|
1258
1392
|
VersionAdded: '0.53'
|
1259
1393
|
|
1394
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
1395
|
+
Description: 'This cop checks for places where binary operator has identical operands.'
|
1396
|
+
Enabled: true
|
1397
|
+
Safe: false
|
1398
|
+
VersionAdded: '0.89'
|
1399
|
+
|
1260
1400
|
Lint/BooleanSymbol:
|
1261
1401
|
Description: 'Check for `:true` and `:false` symbols.'
|
1262
1402
|
Enabled: true
|
1403
|
+
Safe: false
|
1263
1404
|
VersionAdded: '0.50'
|
1405
|
+
VersionChanged: '0.83'
|
1264
1406
|
|
1265
1407
|
Lint/CircularArgumentReference:
|
1266
1408
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
1267
1409
|
Enabled: true
|
1268
1410
|
VersionAdded: '0.33'
|
1269
1411
|
|
1412
|
+
Lint/ConstantDefinitionInBlock:
|
1413
|
+
Description: 'Do not define constants within a block.'
|
1414
|
+
StyleGuide: '#no-constant-definition-in-block'
|
1415
|
+
Enabled: true
|
1416
|
+
VersionAdded: '0.91'
|
1417
|
+
VersionChanged: '1.3'
|
1418
|
+
# `enums` for Typed Enums via T::Enum in Sorbet.
|
1419
|
+
# https://sorbet.org/docs/tenum
|
1420
|
+
AllowedMethods:
|
1421
|
+
- enums
|
1422
|
+
|
1423
|
+
Lint/ConstantResolution:
|
1424
|
+
Description: 'Check that constants are fully qualified with `::`.'
|
1425
|
+
Enabled: false
|
1426
|
+
VersionAdded: '0.86'
|
1427
|
+
# Restrict this cop to only looking at certain names
|
1428
|
+
Only: []
|
1429
|
+
# Restrict this cop from only looking at certain names
|
1430
|
+
Ignore: []
|
1431
|
+
|
1270
1432
|
Lint/Debugger:
|
1271
1433
|
Description: 'Check for debugger calls.'
|
1272
1434
|
Enabled: true
|
1273
1435
|
VersionAdded: '0.14'
|
1274
1436
|
VersionChanged: '0.49'
|
1437
|
+
DebuggerReceivers:
|
1438
|
+
- binding
|
1439
|
+
- Kernel
|
1440
|
+
- Pry
|
1441
|
+
DebuggerMethods:
|
1442
|
+
- debugger
|
1443
|
+
- byebug
|
1444
|
+
- remote_byebug
|
1445
|
+
- pry
|
1446
|
+
- remote_pry
|
1447
|
+
- pry_remote
|
1448
|
+
- console
|
1449
|
+
- rescue
|
1450
|
+
- save_and_open_page
|
1451
|
+
- save_and_open_screenshot
|
1452
|
+
- irb
|
1275
1453
|
|
1276
1454
|
Lint/DeprecatedClassMethods:
|
1277
1455
|
Description: 'Check for deprecated class method calls.'
|
1278
1456
|
Enabled: true
|
1279
1457
|
VersionAdded: '0.19'
|
1280
1458
|
|
1459
|
+
Lint/DeprecatedOpenSSLConstant:
|
1460
|
+
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1461
|
+
Enabled: true
|
1462
|
+
VersionAdded: '0.84'
|
1463
|
+
|
1281
1464
|
Lint/DisjunctiveAssignmentInConstructor:
|
1282
1465
|
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1283
1466
|
Enabled: true
|
1284
1467
|
Safe: false
|
1285
1468
|
VersionAdded: '0.62'
|
1469
|
+
VersionChanged: '0.88'
|
1470
|
+
|
1471
|
+
Lint/DuplicateBranch:
|
1472
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1473
|
+
Enabled: pending
|
1474
|
+
VersionAdded: '1.3'
|
1286
1475
|
|
1287
1476
|
Lint/DuplicateCaseCondition:
|
1288
1477
|
Description: 'Do not repeat values in case conditionals.'
|
1289
1478
|
Enabled: true
|
1290
1479
|
VersionAdded: '0.45'
|
1291
1480
|
|
1481
|
+
Lint/DuplicateElsifCondition:
|
1482
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1483
|
+
Enabled: true
|
1484
|
+
VersionAdded: '0.88'
|
1485
|
+
|
1486
|
+
Lint/DuplicateHashKey:
|
1487
|
+
Description: 'Check for duplicate keys in hash literals.'
|
1488
|
+
Enabled: true
|
1489
|
+
VersionAdded: '0.34'
|
1490
|
+
VersionChanged: '0.77'
|
1491
|
+
|
1292
1492
|
Lint/DuplicateMethods:
|
1293
1493
|
Description: 'Check for duplicate method definitions.'
|
1294
1494
|
Enabled: true
|
1295
1495
|
VersionAdded: '0.29'
|
1296
1496
|
|
1297
|
-
Lint/
|
1298
|
-
Description: '
|
1497
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
1498
|
+
Description: 'Checks for duplicate elements in Regexp character classes.'
|
1499
|
+
Enabled: pending
|
1500
|
+
VersionAdded: '1.1'
|
1501
|
+
|
1502
|
+
Lint/DuplicateRequire:
|
1503
|
+
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1299
1504
|
Enabled: true
|
1300
|
-
VersionAdded: '0.
|
1505
|
+
VersionAdded: '0.90'
|
1506
|
+
|
1507
|
+
Lint/DuplicateRescueException:
|
1508
|
+
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1509
|
+
Enabled: true
|
1510
|
+
VersionAdded: '0.89'
|
1301
1511
|
|
1302
1512
|
Lint/EachWithObjectArgument:
|
1303
1513
|
Description: 'Check for immutable argument given to each_with_object.'
|
@@ -1308,19 +1518,45 @@ Lint/ElseLayout:
|
|
1308
1518
|
Description: 'Check for odd code arrangement in an else block.'
|
1309
1519
|
Enabled: true
|
1310
1520
|
VersionAdded: '0.17'
|
1521
|
+
VersionChanged: '1.2'
|
1522
|
+
|
1523
|
+
Lint/EmptyBlock:
|
1524
|
+
Description: 'This cop checks for blocks without a body.'
|
1525
|
+
Enabled: pending
|
1526
|
+
VersionAdded: '1.1'
|
1527
|
+
VersionChanged: '1.3'
|
1528
|
+
AllowComments: true
|
1529
|
+
AllowEmptyLambdas: true
|
1530
|
+
|
1531
|
+
Lint/EmptyClass:
|
1532
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
1533
|
+
Enabled: pending
|
1534
|
+
VersionAdded: '1.3'
|
1535
|
+
AllowComments: false
|
1536
|
+
|
1537
|
+
Lint/EmptyConditionalBody:
|
1538
|
+
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1539
|
+
Enabled: true
|
1540
|
+
AllowComments: true
|
1541
|
+
VersionAdded: '0.89'
|
1311
1542
|
|
1312
1543
|
Lint/EmptyEnsure:
|
1313
1544
|
Description: 'Checks for empty ensure block.'
|
1314
1545
|
Enabled: true
|
1315
1546
|
VersionAdded: '0.10'
|
1316
1547
|
VersionChanged: '0.48'
|
1317
|
-
AutoCorrect: false
|
1318
1548
|
|
1319
1549
|
Lint/EmptyExpression:
|
1320
1550
|
Description: 'Checks for empty expressions.'
|
1321
1551
|
Enabled: true
|
1322
1552
|
VersionAdded: '0.45'
|
1323
1553
|
|
1554
|
+
Lint/EmptyFile:
|
1555
|
+
Description: 'Enforces that Ruby source files are not empty.'
|
1556
|
+
Enabled: true
|
1557
|
+
AllowComments: true
|
1558
|
+
VersionAdded: '0.90'
|
1559
|
+
|
1324
1560
|
Lint/EmptyInterpolation:
|
1325
1561
|
Description: 'Checks for empty string interpolation.'
|
1326
1562
|
Enabled: true
|
@@ -1330,18 +1566,16 @@ Lint/EmptyInterpolation:
|
|
1330
1566
|
Lint/EmptyWhen:
|
1331
1567
|
Description: 'Checks for `when` branches with empty bodies.'
|
1332
1568
|
Enabled: true
|
1569
|
+
AllowComments: true
|
1333
1570
|
VersionAdded: '0.45'
|
1334
|
-
|
1335
|
-
Lint/EndInMethod:
|
1336
|
-
Description: 'END blocks should not be placed inside method definitions.'
|
1337
|
-
Enabled: true
|
1338
|
-
VersionAdded: '0.9'
|
1571
|
+
VersionChanged: '0.83'
|
1339
1572
|
|
1340
1573
|
Lint/EnsureReturn:
|
1341
1574
|
Description: 'Do not use return in an ensure block.'
|
1342
1575
|
StyleGuide: '#no-return-ensure'
|
1343
1576
|
Enabled: true
|
1344
1577
|
VersionAdded: '0.9'
|
1578
|
+
VersionChanged: '0.83'
|
1345
1579
|
|
1346
1580
|
Lint/ErbNewArguments:
|
1347
1581
|
Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
|
@@ -1349,11 +1583,17 @@ Lint/ErbNewArguments:
|
|
1349
1583
|
VersionAdded: '0.56'
|
1350
1584
|
|
1351
1585
|
Lint/FlipFlop:
|
1352
|
-
Description: 'Checks for flip-flops'
|
1586
|
+
Description: 'Checks for flip-flops.'
|
1353
1587
|
StyleGuide: '#no-flip-flops'
|
1354
1588
|
Enabled: true
|
1355
1589
|
VersionAdded: '0.16'
|
1356
1590
|
|
1591
|
+
Lint/FloatComparison:
|
1592
|
+
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1593
|
+
StyleGuide: '#float-comparison'
|
1594
|
+
Enabled: true
|
1595
|
+
VersionAdded: '0.89'
|
1596
|
+
|
1357
1597
|
Lint/FloatOutOfRange:
|
1358
1598
|
Description: >-
|
1359
1599
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1366,13 +1606,12 @@ Lint/FormatParameterMismatch:
|
|
1366
1606
|
Enabled: true
|
1367
1607
|
VersionAdded: '0.33'
|
1368
1608
|
|
1369
|
-
Lint/
|
1370
|
-
Description:
|
1371
|
-
StyleGuide: '#
|
1609
|
+
Lint/HashCompareByIdentity:
|
1610
|
+
Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
|
1611
|
+
StyleGuide: '#identity-comparison'
|
1372
1612
|
Enabled: true
|
1373
|
-
|
1374
|
-
VersionAdded: '0.
|
1375
|
-
VersionChanged: '0.70'
|
1613
|
+
Safe: false
|
1614
|
+
VersionAdded: '0.93'
|
1376
1615
|
|
1377
1616
|
Lint/HeredocMethodCallPosition:
|
1378
1617
|
Description: >-
|
@@ -1382,6 +1621,12 @@ Lint/HeredocMethodCallPosition:
|
|
1382
1621
|
StyleGuide: '#heredoc-method-calls'
|
1383
1622
|
VersionAdded: '0.68'
|
1384
1623
|
|
1624
|
+
Lint/IdentityComparison:
|
1625
|
+
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1626
|
+
Enabled: true
|
1627
|
+
StyleGuide: '#identity-comparison'
|
1628
|
+
VersionAdded: '0.91'
|
1629
|
+
|
1385
1630
|
Lint/ImplicitStringConcatenation:
|
1386
1631
|
Description: >-
|
1387
1632
|
Checks for adjacent string literals on the same line, which
|
@@ -1407,9 +1652,11 @@ Lint/InheritException:
|
|
1407
1652
|
- standard_error
|
1408
1653
|
|
1409
1654
|
Lint/InterpolationCheck:
|
1410
|
-
Description: 'Raise warning for interpolation in single q strs'
|
1655
|
+
Description: 'Raise warning for interpolation in single q strs.'
|
1411
1656
|
Enabled: true
|
1657
|
+
Safe: false
|
1412
1658
|
VersionAdded: '0.50'
|
1659
|
+
VersionChanged: '0.87'
|
1413
1660
|
|
1414
1661
|
Lint/LiteralAsCondition:
|
1415
1662
|
Description: 'Checks of literals used in conditions.'
|
@@ -1429,9 +1676,11 @@ Lint/Loop:
|
|
1429
1676
|
StyleGuide: '#loop-with-break'
|
1430
1677
|
Enabled: true
|
1431
1678
|
VersionAdded: '0.9'
|
1679
|
+
VersionChanged: '1.3'
|
1680
|
+
Safe: false
|
1432
1681
|
|
1433
1682
|
Lint/MissingCopEnableDirective:
|
1434
|
-
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable
|
1683
|
+
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
1435
1684
|
Enabled: true
|
1436
1685
|
VersionAdded: '0.52'
|
1437
1686
|
# Maximum number of consecutive lines the cop can be disabled for.
|
@@ -1443,10 +1692,25 @@ Lint/MissingCopEnableDirective:
|
|
1443
1692
|
# .inf for any size
|
1444
1693
|
MaximumRangeSize: .inf
|
1445
1694
|
|
1446
|
-
Lint/
|
1447
|
-
Description:
|
1695
|
+
Lint/MissingSuper:
|
1696
|
+
Description: >-
|
1697
|
+
This cop checks for the presence of constructors and lifecycle callbacks
|
1698
|
+
without calls to `super`'.
|
1699
|
+
Enabled: true
|
1700
|
+
VersionAdded: '0.89'
|
1701
|
+
VersionChanged: '1.4'
|
1702
|
+
|
1703
|
+
Lint/MixedRegexpCaptureTypes:
|
1704
|
+
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1705
|
+
Enabled: true
|
1706
|
+
VersionAdded: '0.85'
|
1707
|
+
|
1708
|
+
Lint/MultipleComparison:
|
1709
|
+
Description: "Use `&&` operator to compare multiple values."
|
1448
1710
|
Enabled: true
|
1449
1711
|
VersionAdded: '0.47'
|
1712
|
+
VersionChanged: '1.1'
|
1713
|
+
AllowMethodComparison: true
|
1450
1714
|
|
1451
1715
|
Lint/NestedMethodDefinition:
|
1452
1716
|
Description: 'Do not use nested method definitions.'
|
@@ -1466,6 +1730,17 @@ Lint/NextWithoutAccumulator:
|
|
1466
1730
|
Enabled: true
|
1467
1731
|
VersionAdded: '0.36'
|
1468
1732
|
|
1733
|
+
Lint/NoReturnInBeginEndBlocks:
|
1734
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1735
|
+
Enabled: pending
|
1736
|
+
VersionAdded: '1.2'
|
1737
|
+
|
1738
|
+
Lint/NonDeterministicRequireOrder:
|
1739
|
+
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1740
|
+
Enabled: true
|
1741
|
+
VersionAdded: '0.78'
|
1742
|
+
Safe: false
|
1743
|
+
|
1469
1744
|
Lint/NonLocalExitFromIterator:
|
1470
1745
|
Description: 'Do not use return in iterator to cause non-local exit.'
|
1471
1746
|
Enabled: true
|
@@ -1475,14 +1750,24 @@ Lint/NumberConversion:
|
|
1475
1750
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1476
1751
|
Enabled: false
|
1477
1752
|
VersionAdded: '0.53'
|
1478
|
-
VersionChanged: '
|
1753
|
+
VersionChanged: '1.1'
|
1479
1754
|
SafeAutoCorrect: false
|
1755
|
+
IgnoredMethods: []
|
1756
|
+
IgnoredClasses:
|
1757
|
+
- Time
|
1758
|
+
- DateTime
|
1480
1759
|
|
1481
1760
|
Lint/OrderedMagicComments:
|
1482
1761
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
1483
1762
|
Enabled: true
|
1484
1763
|
VersionAdded: '0.53'
|
1485
1764
|
|
1765
|
+
Lint/OutOfRangeRegexpRef:
|
1766
|
+
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1767
|
+
Enabled: true
|
1768
|
+
Safe: false
|
1769
|
+
VersionAdded: '0.89'
|
1770
|
+
|
1486
1771
|
Lint/ParenthesesAsGroupedExpression:
|
1487
1772
|
Description: >-
|
1488
1773
|
Checks for method calls with a space before the opening
|
@@ -1490,11 +1775,13 @@ Lint/ParenthesesAsGroupedExpression:
|
|
1490
1775
|
StyleGuide: '#parens-no-spaces'
|
1491
1776
|
Enabled: true
|
1492
1777
|
VersionAdded: '0.12'
|
1778
|
+
VersionChanged: '0.83'
|
1493
1779
|
|
1494
1780
|
Lint/PercentStringArray:
|
1495
1781
|
Description: >-
|
1496
1782
|
Checks for unwanted commas and quotes in %w/%W literals.
|
1497
1783
|
Enabled: true
|
1784
|
+
Safe: false
|
1498
1785
|
VersionAdded: '0.41'
|
1499
1786
|
|
1500
1787
|
Lint/PercentSymbolArray:
|
@@ -1503,6 +1790,16 @@ Lint/PercentSymbolArray:
|
|
1503
1790
|
Enabled: true
|
1504
1791
|
VersionAdded: '0.41'
|
1505
1792
|
|
1793
|
+
Lint/RaiseException:
|
1794
|
+
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1795
|
+
StyleGuide: '#raise-exception'
|
1796
|
+
Enabled: true
|
1797
|
+
Safe: false
|
1798
|
+
VersionAdded: '0.81'
|
1799
|
+
VersionChanged: '0.86'
|
1800
|
+
AllowedImplicitNamespaces:
|
1801
|
+
- 'Gem'
|
1802
|
+
|
1506
1803
|
Lint/RandOne:
|
1507
1804
|
Description: >-
|
1508
1805
|
Checks for `rand(1)` calls. Such calls always return `0`
|
@@ -1510,6 +1807,49 @@ Lint/RandOne:
|
|
1510
1807
|
Enabled: true
|
1511
1808
|
VersionAdded: '0.36'
|
1512
1809
|
|
1810
|
+
Lint/RedundantCopDisableDirective:
|
1811
|
+
Description: >-
|
1812
|
+
Checks for rubocop:disable comments that can be removed.
|
1813
|
+
Note: this cop is not disabled when disabling all cops.
|
1814
|
+
It must be explicitly disabled.
|
1815
|
+
Enabled: true
|
1816
|
+
VersionAdded: '0.76'
|
1817
|
+
|
1818
|
+
Lint/RedundantCopEnableDirective:
|
1819
|
+
Description: Checks for rubocop:enable comments that can be removed.
|
1820
|
+
Enabled: true
|
1821
|
+
VersionAdded: '0.76'
|
1822
|
+
|
1823
|
+
Lint/RedundantRequireStatement:
|
1824
|
+
Description: 'Checks for unnecessary `require` statement.'
|
1825
|
+
Enabled: true
|
1826
|
+
VersionAdded: '0.76'
|
1827
|
+
|
1828
|
+
Lint/RedundantSafeNavigation:
|
1829
|
+
Description: 'Checks for redundant safe navigation calls.'
|
1830
|
+
Enabled: true
|
1831
|
+
VersionAdded: '0.93'
|
1832
|
+
AllowedMethods:
|
1833
|
+
- instance_of?
|
1834
|
+
- kind_of?
|
1835
|
+
- is_a?
|
1836
|
+
- eql?
|
1837
|
+
- respond_to?
|
1838
|
+
- equal?
|
1839
|
+
Safe: false
|
1840
|
+
|
1841
|
+
Lint/RedundantSplatExpansion:
|
1842
|
+
Description: 'Checks for splat unnecessarily being called on literals.'
|
1843
|
+
Enabled: true
|
1844
|
+
VersionAdded: '0.76'
|
1845
|
+
|
1846
|
+
Lint/RedundantStringCoercion:
|
1847
|
+
Description: 'Checks for Object#to_s usage in string interpolation.'
|
1848
|
+
StyleGuide: '#no-to-s'
|
1849
|
+
Enabled: true
|
1850
|
+
VersionAdded: '0.19'
|
1851
|
+
VersionChanged: '0.77'
|
1852
|
+
|
1513
1853
|
Lint/RedundantWithIndex:
|
1514
1854
|
Description: 'Checks for redundant `with_index`.'
|
1515
1855
|
Enabled: true
|
@@ -1526,6 +1866,7 @@ Lint/RegexpAsCondition:
|
|
1526
1866
|
The regexp literal matches `$_` implicitly.
|
1527
1867
|
Enabled: true
|
1528
1868
|
VersionAdded: '0.51'
|
1869
|
+
VersionChanged: '0.86'
|
1529
1870
|
|
1530
1871
|
Lint/RequireParentheses:
|
1531
1872
|
Description: >-
|
@@ -1539,7 +1880,7 @@ Lint/RescueException:
|
|
1539
1880
|
StyleGuide: '#no-blind-rescues'
|
1540
1881
|
Enabled: true
|
1541
1882
|
VersionAdded: '0.9'
|
1542
|
-
VersionChanged: '0.27
|
1883
|
+
VersionChanged: '0.27'
|
1543
1884
|
|
1544
1885
|
Lint/RescueType:
|
1545
1886
|
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
@@ -1555,13 +1896,14 @@ Lint/SafeNavigationChain:
|
|
1555
1896
|
Description: 'Do not chain ordinary method call after safe navigation operator.'
|
1556
1897
|
Enabled: true
|
1557
1898
|
VersionAdded: '0.47'
|
1558
|
-
VersionChanged: '0.
|
1559
|
-
|
1899
|
+
VersionChanged: '0.77'
|
1900
|
+
AllowedMethods:
|
1560
1901
|
- present?
|
1561
1902
|
- blank?
|
1562
1903
|
- presence
|
1563
1904
|
- try
|
1564
1905
|
- try!
|
1906
|
+
- in?
|
1565
1907
|
|
1566
1908
|
Lint/SafeNavigationConsistency:
|
1567
1909
|
Description: >-
|
@@ -1570,18 +1912,19 @@ Lint/SafeNavigationConsistency:
|
|
1570
1912
|
for all method calls on that same object.
|
1571
1913
|
Enabled: true
|
1572
1914
|
VersionAdded: '0.55'
|
1573
|
-
|
1915
|
+
VersionChanged: '0.77'
|
1916
|
+
AllowedMethods:
|
1574
1917
|
- present?
|
1575
1918
|
- blank?
|
1576
1919
|
- presence
|
1577
1920
|
- try
|
1578
1921
|
- try!
|
1579
1922
|
|
1580
|
-
|
1581
1923
|
Lint/SafeNavigationWithEmpty:
|
1582
1924
|
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1583
1925
|
Enabled: true
|
1584
1926
|
VersionAdded: '0.62'
|
1927
|
+
VersionChanged: '0.87'
|
1585
1928
|
|
1586
1929
|
Lint/ScriptPermission:
|
1587
1930
|
Description: 'Grant script file execute permission.'
|
@@ -1589,6 +1932,16 @@ Lint/ScriptPermission:
|
|
1589
1932
|
VersionAdded: '0.49'
|
1590
1933
|
VersionChanged: '0.50'
|
1591
1934
|
|
1935
|
+
Lint/SelfAssignment:
|
1936
|
+
Description: 'Checks for self-assignments.'
|
1937
|
+
Enabled: true
|
1938
|
+
VersionAdded: '0.89'
|
1939
|
+
|
1940
|
+
Lint/SendWithMixinArgument:
|
1941
|
+
Description: 'Checks for `send` method when using mixin.'
|
1942
|
+
Enabled: true
|
1943
|
+
VersionAdded: '0.75'
|
1944
|
+
|
1592
1945
|
Lint/ShadowedArgument:
|
1593
1946
|
Description: 'Avoid reassigning arguments before they were used.'
|
1594
1947
|
Enabled: true
|
@@ -1610,22 +1963,44 @@ Lint/ShadowingOuterLocalVariable:
|
|
1610
1963
|
Enabled: true
|
1611
1964
|
VersionAdded: '0.9'
|
1612
1965
|
|
1613
|
-
Lint/
|
1614
|
-
Description: '
|
1615
|
-
StyleGuide: '#no-to-s'
|
1966
|
+
Lint/StructNewOverride:
|
1967
|
+
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
1616
1968
|
Enabled: true
|
1617
|
-
VersionAdded: '0.
|
1618
|
-
|
1969
|
+
VersionAdded: '0.81'
|
1970
|
+
|
1971
|
+
Lint/SuppressedException:
|
1972
|
+
Description: "Don't suppress exceptions."
|
1973
|
+
StyleGuide: '#dont-hide-exceptions'
|
1974
|
+
Enabled: true
|
1975
|
+
AllowComments: true
|
1976
|
+
VersionAdded: '0.9'
|
1977
|
+
VersionChanged: '0.81'
|
1619
1978
|
|
1620
1979
|
Lint/Syntax:
|
1621
|
-
Description: 'Checks syntax error'
|
1980
|
+
Description: 'Checks syntax error.'
|
1622
1981
|
Enabled: true
|
1623
1982
|
VersionAdded: '0.9'
|
1624
1983
|
|
1625
1984
|
|
1985
|
+
Lint/ToEnumArguments:
|
1986
|
+
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
1987
|
+
Enabled: pending
|
1988
|
+
VersionAdded: '1.1'
|
1989
|
+
|
1626
1990
|
Lint/ToJSON:
|
1627
1991
|
Description: 'Ensure #to_json includes an optional argument.'
|
1628
1992
|
Enabled: true
|
1993
|
+
VersionAdded: '0.66'
|
1994
|
+
|
1995
|
+
Lint/TopLevelReturnWithArgument:
|
1996
|
+
Description: 'This cop detects top level return statements with argument.'
|
1997
|
+
Enabled: true
|
1998
|
+
VersionAdded: '0.89'
|
1999
|
+
|
2000
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
2001
|
+
Description: 'This cop checks for trailing commas in attribute declarations.'
|
2002
|
+
Enabled: true
|
2003
|
+
VersionAdded: '0.90'
|
1629
2004
|
|
1630
2005
|
Lint/UnderscorePrefixedVariableName:
|
1631
2006
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
@@ -1633,39 +2008,44 @@ Lint/UnderscorePrefixedVariableName:
|
|
1633
2008
|
VersionAdded: '0.21'
|
1634
2009
|
AllowKeywordBlockArguments: false
|
1635
2010
|
|
2011
|
+
Lint/UnexpectedBlockArity:
|
2012
|
+
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2013
|
+
Enabled: pending
|
2014
|
+
Safe: false
|
2015
|
+
VersionAdded: '1.5'
|
2016
|
+
Methods:
|
2017
|
+
chunk_while: 2
|
2018
|
+
each_with_index: 2
|
2019
|
+
each_with_object: 2
|
2020
|
+
inject: 2
|
2021
|
+
max: 2
|
2022
|
+
min: 2
|
2023
|
+
minmax: 2
|
2024
|
+
reduce: 2
|
2025
|
+
slice_when: 2
|
2026
|
+
sort: 2
|
2027
|
+
|
1636
2028
|
Lint/UnifiedInteger:
|
1637
|
-
Description: 'Use Integer instead of Fixnum or Bignum'
|
2029
|
+
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1638
2030
|
Enabled: true
|
1639
2031
|
VersionAdded: '0.43'
|
1640
2032
|
|
1641
|
-
Lint/
|
1642
|
-
Description:
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
Enabled: true
|
1647
|
-
VersionAdded: '0.53'
|
1648
|
-
|
1649
|
-
Lint/UnneededCopEnableDirective:
|
1650
|
-
Description: Checks for rubocop:enable comments that can be removed.
|
1651
|
-
Enabled: true
|
1652
|
-
VersionAdded: '0.53'
|
1653
|
-
|
1654
|
-
Lint/UnneededRequireStatement:
|
1655
|
-
Description: 'Checks for unnecessary `require` statement.'
|
1656
|
-
Enabled: true
|
1657
|
-
VersionAdded: '0.51'
|
1658
|
-
|
1659
|
-
Lint/UnneededSplatExpansion:
|
1660
|
-
Description: 'Checks for splat unnecessarily being called on literals'
|
1661
|
-
Enabled: true
|
1662
|
-
VersionAdded: '0.43'
|
2033
|
+
Lint/UnmodifiedReduceAccumulator:
|
2034
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2035
|
+
Enabled: pending
|
2036
|
+
VersionAdded: '1.1'
|
2037
|
+
VersionChanged: '1.5'
|
1663
2038
|
|
1664
2039
|
Lint/UnreachableCode:
|
1665
2040
|
Description: 'Unreachable code.'
|
1666
2041
|
Enabled: true
|
1667
2042
|
VersionAdded: '0.9'
|
1668
2043
|
|
2044
|
+
Lint/UnreachableLoop:
|
2045
|
+
Description: 'This cop checks for loops that will have at most one iteration.'
|
2046
|
+
Enabled: true
|
2047
|
+
VersionAdded: '0.89'
|
2048
|
+
|
1669
2049
|
Lint/UnusedBlockArgument:
|
1670
2050
|
Description: 'Checks for unused block arguments.'
|
1671
2051
|
StyleGuide: '#underscore-unused-vars'
|
@@ -1680,9 +2060,10 @@ Lint/UnusedMethodArgument:
|
|
1680
2060
|
StyleGuide: '#underscore-unused-vars'
|
1681
2061
|
Enabled: true
|
1682
2062
|
VersionAdded: '0.21'
|
1683
|
-
VersionChanged: '0.
|
2063
|
+
VersionChanged: '0.81'
|
1684
2064
|
AllowUnusedKeywordArguments: false
|
1685
2065
|
IgnoreEmptyMethods: true
|
2066
|
+
IgnoreNotImplementedMethods: true
|
1686
2067
|
|
1687
2068
|
Lint/UriEscapeUnescape:
|
1688
2069
|
Description: >-
|
@@ -1704,7 +2085,7 @@ Lint/UselessAccessModifier:
|
|
1704
2085
|
Description: 'Checks for useless access modifiers.'
|
1705
2086
|
Enabled: true
|
1706
2087
|
VersionAdded: '0.20'
|
1707
|
-
VersionChanged: '0.
|
2088
|
+
VersionChanged: '0.83'
|
1708
2089
|
ContextCreatingMethods: []
|
1709
2090
|
MethodCreatingMethods: []
|
1710
2091
|
|
@@ -1714,20 +2095,31 @@ Lint/UselessAssignment:
|
|
1714
2095
|
Enabled: true
|
1715
2096
|
VersionAdded: '0.11'
|
1716
2097
|
|
1717
|
-
Lint/UselessComparison:
|
1718
|
-
Description: 'Checks for comparison of something with itself.'
|
1719
|
-
Enabled: true
|
1720
|
-
VersionAdded: '0.11'
|
1721
|
-
|
1722
2098
|
Lint/UselessElseWithoutRescue:
|
1723
2099
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
1724
2100
|
Enabled: true
|
1725
2101
|
VersionAdded: '0.17'
|
1726
2102
|
|
2103
|
+
Lint/UselessMethodDefinition:
|
2104
|
+
Description: 'Checks for useless method definitions.'
|
2105
|
+
Enabled: true
|
2106
|
+
VersionAdded: '0.90'
|
2107
|
+
Safe: false
|
2108
|
+
AllowComments: true
|
2109
|
+
|
1727
2110
|
Lint/UselessSetterCall:
|
1728
2111
|
Description: 'Checks for useless setter call to a local variable.'
|
1729
2112
|
Enabled: true
|
2113
|
+
SafeAutoCorrect: false
|
1730
2114
|
VersionAdded: '0.13'
|
2115
|
+
VersionChanged: '1.2'
|
2116
|
+
Safe: false
|
2117
|
+
|
2118
|
+
Lint/UselessTimes:
|
2119
|
+
Description: 'Checks for useless `Integer#times` calls.'
|
2120
|
+
Enabled: true
|
2121
|
+
VersionAdded: '0.91'
|
2122
|
+
Safe: false
|
1731
2123
|
|
1732
2124
|
Lint/Void:
|
1733
2125
|
Description: 'Possible use of operator/literal/variable in void context.'
|
@@ -1743,22 +2135,26 @@ Metrics/AbcSize:
|
|
1743
2135
|
branches, and conditions.
|
1744
2136
|
Reference:
|
1745
2137
|
- http://c2.com/cgi/wiki?AbcMetric
|
1746
|
-
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
2138
|
+
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
1747
2139
|
Enabled: true
|
1748
2140
|
VersionAdded: '0.27'
|
1749
|
-
VersionChanged: '
|
2141
|
+
VersionChanged: '1.5'
|
1750
2142
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1751
2143
|
# a Float.
|
1752
|
-
|
2144
|
+
IgnoredMethods: []
|
2145
|
+
CountRepeatedAttributes: true
|
2146
|
+
Max: 17
|
1753
2147
|
|
1754
2148
|
Metrics/BlockLength:
|
1755
2149
|
Description: 'Avoid long blocks with many lines.'
|
1756
2150
|
Enabled: true
|
1757
2151
|
VersionAdded: '0.44'
|
1758
|
-
VersionChanged: '
|
2152
|
+
VersionChanged: '1.5'
|
1759
2153
|
CountComments: false # count full line comments?
|
1760
2154
|
Max: 25
|
1761
|
-
|
2155
|
+
CountAsOne: []
|
2156
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2157
|
+
IgnoredMethods:
|
1762
2158
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1763
2159
|
# associated blocks.
|
1764
2160
|
- refine
|
@@ -1766,7 +2162,7 @@ Metrics/BlockLength:
|
|
1766
2162
|
- '**/*.gemspec'
|
1767
2163
|
|
1768
2164
|
Metrics/BlockNesting:
|
1769
|
-
Description: 'Avoid excessive block nesting'
|
2165
|
+
Description: 'Avoid excessive block nesting.'
|
1770
2166
|
StyleGuide: '#three-is-the-number-thou-shalt-count'
|
1771
2167
|
Enabled: true
|
1772
2168
|
VersionAdded: '0.25'
|
@@ -1778,8 +2174,10 @@ Metrics/ClassLength:
|
|
1778
2174
|
Description: 'Avoid classes longer than 100 lines of code.'
|
1779
2175
|
Enabled: true
|
1780
2176
|
VersionAdded: '0.25'
|
2177
|
+
VersionChanged: '0.87'
|
1781
2178
|
CountComments: false # count full line comments?
|
1782
2179
|
Max: 100
|
2180
|
+
CountAsOne: []
|
1783
2181
|
|
1784
2182
|
# Avoid complex methods.
|
1785
2183
|
Metrics/CyclomaticComplexity:
|
@@ -1788,55 +2186,40 @@ Metrics/CyclomaticComplexity:
|
|
1788
2186
|
of test cases needed to validate a method.
|
1789
2187
|
Enabled: true
|
1790
2188
|
VersionAdded: '0.25'
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
Description: 'Limit lines to 80 characters.'
|
1795
|
-
StyleGuide: '#80-character-limits'
|
1796
|
-
Enabled: true
|
1797
|
-
VersionAdded: '0.25'
|
1798
|
-
VersionChanged: '0.68'
|
1799
|
-
AutoCorrect: false
|
1800
|
-
Max: 80
|
1801
|
-
# To make it possible to copy or click on URIs in the code, we allow lines
|
1802
|
-
# containing a URI to be longer than Max.
|
1803
|
-
AllowHeredoc: true
|
1804
|
-
AllowURI: true
|
1805
|
-
URISchemes:
|
1806
|
-
- http
|
1807
|
-
- https
|
1808
|
-
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
1809
|
-
# directives like '# rubocop: enable ...' when calculating a line's length.
|
1810
|
-
IgnoreCopDirectives: false
|
1811
|
-
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
|
1812
|
-
# elements. Strings will be converted to Regexp objects. A line that matches
|
1813
|
-
# any regular expression listed in this option will be ignored by LineLength.
|
1814
|
-
IgnoredPatterns: []
|
2189
|
+
VersionChanged: '0.81'
|
2190
|
+
IgnoredMethods: []
|
2191
|
+
Max: 7
|
1815
2192
|
|
1816
2193
|
Metrics/MethodLength:
|
1817
2194
|
Description: 'Avoid methods longer than 10 lines of code.'
|
1818
2195
|
StyleGuide: '#short-methods'
|
1819
2196
|
Enabled: true
|
1820
2197
|
VersionAdded: '0.25'
|
1821
|
-
VersionChanged: '
|
2198
|
+
VersionChanged: '1.5'
|
1822
2199
|
CountComments: false # count full line comments?
|
1823
2200
|
Max: 10
|
1824
|
-
|
2201
|
+
CountAsOne: []
|
2202
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2203
|
+
IgnoredMethods: []
|
1825
2204
|
|
1826
2205
|
Metrics/ModuleLength:
|
1827
2206
|
Description: 'Avoid modules longer than 100 lines of code.'
|
1828
2207
|
Enabled: true
|
1829
2208
|
VersionAdded: '0.31'
|
2209
|
+
VersionChanged: '0.87'
|
1830
2210
|
CountComments: false # count full line comments?
|
1831
2211
|
Max: 100
|
2212
|
+
CountAsOne: []
|
1832
2213
|
|
1833
2214
|
Metrics/ParameterLists:
|
1834
2215
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
1835
2216
|
StyleGuide: '#too-many-params'
|
1836
2217
|
Enabled: true
|
1837
2218
|
VersionAdded: '0.25'
|
2219
|
+
VersionChanged: '1.5'
|
1838
2220
|
Max: 5
|
1839
2221
|
CountKeywordArgs: true
|
2222
|
+
MaxOptionalParameters: 3
|
1840
2223
|
|
1841
2224
|
Metrics/PerceivedComplexity:
|
1842
2225
|
Description: >-
|
@@ -1844,7 +2227,18 @@ Metrics/PerceivedComplexity:
|
|
1844
2227
|
human reader.
|
1845
2228
|
Enabled: true
|
1846
2229
|
VersionAdded: '0.25'
|
1847
|
-
|
2230
|
+
VersionChanged: '0.81'
|
2231
|
+
IgnoredMethods: []
|
2232
|
+
Max: 8
|
2233
|
+
|
2234
|
+
################## Migration #############################
|
2235
|
+
|
2236
|
+
Migration/DepartmentName:
|
2237
|
+
Description: >-
|
2238
|
+
Check that cop names in rubocop:disable (etc) comments are
|
2239
|
+
given with department name.
|
2240
|
+
Enabled: true
|
2241
|
+
VersionAdded: '0.75'
|
1848
2242
|
|
1849
2243
|
#################### Naming ##############################
|
1850
2244
|
|
@@ -1855,22 +2249,45 @@ Naming/AccessorMethodName:
|
|
1855
2249
|
VersionAdded: '0.50'
|
1856
2250
|
|
1857
2251
|
Naming/AsciiIdentifiers:
|
1858
|
-
Description: 'Use only ascii symbols in identifiers.'
|
2252
|
+
Description: 'Use only ascii symbols in identifiers and constants.'
|
1859
2253
|
StyleGuide: '#english-identifiers'
|
1860
2254
|
Enabled: true
|
1861
2255
|
VersionAdded: '0.50'
|
2256
|
+
VersionChanged: '0.87'
|
2257
|
+
AsciiConstants: true
|
1862
2258
|
|
1863
2259
|
Naming/BinaryOperatorParameterName:
|
1864
2260
|
Description: 'When defining binary operators, name the argument other.'
|
1865
2261
|
StyleGuide: '#other-arg'
|
1866
2262
|
Enabled: true
|
1867
2263
|
VersionAdded: '0.50'
|
2264
|
+
VersionChanged: '1.2'
|
2265
|
+
|
2266
|
+
Naming/BlockParameterName:
|
2267
|
+
Description: >-
|
2268
|
+
Checks for block parameter names that contain capital letters,
|
2269
|
+
end in numbers, or do not meet a minimal length.
|
2270
|
+
Enabled: true
|
2271
|
+
VersionAdded: '0.53'
|
2272
|
+
VersionChanged: '0.77'
|
2273
|
+
# Parameter names may be equal to or greater than this value
|
2274
|
+
MinNameLength: 1
|
2275
|
+
AllowNamesEndingInNumbers: true
|
2276
|
+
# Allowed names that will not register an offense
|
2277
|
+
AllowedNames: []
|
2278
|
+
# Forbidden names that will register an offense
|
2279
|
+
ForbiddenNames: []
|
1868
2280
|
|
1869
2281
|
Naming/ClassAndModuleCamelCase:
|
1870
2282
|
Description: 'Use CamelCase for classes and modules.'
|
1871
2283
|
StyleGuide: '#camelcase-classes'
|
1872
2284
|
Enabled: true
|
1873
2285
|
VersionAdded: '0.50'
|
2286
|
+
VersionChanged: '0.85'
|
2287
|
+
# Allowed class/module names can be specified here.
|
2288
|
+
# These can be full or part of the name.
|
2289
|
+
AllowedNames:
|
2290
|
+
- module_parent
|
1874
2291
|
|
1875
2292
|
Naming/ConstantName:
|
1876
2293
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
@@ -1891,6 +2308,10 @@ Naming/FileName:
|
|
1891
2308
|
# It further expects it to be nested inside modules which match the names
|
1892
2309
|
# of subdirectories in its path.
|
1893
2310
|
ExpectMatchingDefinition: false
|
2311
|
+
# When `false`, changes the behavior of ExpectMatchingDefinition to match only
|
2312
|
+
# whether each source file's class or module name matches the file name --
|
2313
|
+
# not whether the nested module hierarchy matches the subdirectory path.
|
2314
|
+
CheckDefinitionPathHierarchy: true
|
1894
2315
|
# If non-`nil`, expect all source file names to match the following regex.
|
1895
2316
|
# Only the file name itself is matched, not the entire file path.
|
1896
2317
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -1947,6 +2368,7 @@ Naming/HeredocDelimiterCase:
|
|
1947
2368
|
StyleGuide: '#heredoc-delimiters'
|
1948
2369
|
Enabled: true
|
1949
2370
|
VersionAdded: '0.50'
|
2371
|
+
VersionChanged: '1.2'
|
1950
2372
|
EnforcedStyle: uppercase
|
1951
2373
|
SupportedStyles:
|
1952
2374
|
- lowercase
|
@@ -1957,7 +2379,7 @@ Naming/HeredocDelimiterNaming:
|
|
1957
2379
|
StyleGuide: '#heredoc-delimiters'
|
1958
2380
|
Enabled: true
|
1959
2381
|
VersionAdded: '0.50'
|
1960
|
-
|
2382
|
+
ForbiddenDelimiters:
|
1961
2383
|
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
|
1962
2384
|
|
1963
2385
|
Naming/MemoizedInstanceVariableName:
|
@@ -1965,7 +2387,7 @@ Naming/MemoizedInstanceVariableName:
|
|
1965
2387
|
Memoized method name should match memo instance variable name.
|
1966
2388
|
Enabled: true
|
1967
2389
|
VersionAdded: '0.53'
|
1968
|
-
VersionChanged: '
|
2390
|
+
VersionChanged: '1.2'
|
1969
2391
|
EnforcedStyleForLeadingUnderscores: disallowed
|
1970
2392
|
SupportedStylesForLeadingUnderscores:
|
1971
2393
|
- disallowed
|
@@ -1981,556 +2403,107 @@ Naming/MethodName:
|
|
1981
2403
|
SupportedStyles:
|
1982
2404
|
- snake_case
|
1983
2405
|
- camelCase
|
2406
|
+
# Method names matching patterns are always allowed.
|
2407
|
+
#
|
2408
|
+
# IgnoredPatterns:
|
2409
|
+
# - '\A\s*onSelectionBulkChange\s*'
|
2410
|
+
# - '\A\s*onSelectionCleared\s*'
|
2411
|
+
#
|
2412
|
+
IgnoredPatterns: []
|
2413
|
+
|
2414
|
+
Naming/MethodParameterName:
|
2415
|
+
Description: >-
|
2416
|
+
Checks for method parameter names that contain capital letters,
|
2417
|
+
end in numbers, or do not meet a minimal length.
|
2418
|
+
Enabled: true
|
2419
|
+
VersionAdded: '0.53'
|
2420
|
+
VersionChanged: '0.77'
|
2421
|
+
# Parameter names may be equal to or greater than this value
|
2422
|
+
MinNameLength: 3
|
2423
|
+
AllowNamesEndingInNumbers: true
|
2424
|
+
# Allowed names that will not register an offense
|
2425
|
+
AllowedNames:
|
2426
|
+
- at
|
2427
|
+
- by
|
2428
|
+
- db
|
2429
|
+
- id
|
2430
|
+
- in
|
2431
|
+
- io
|
2432
|
+
- ip
|
2433
|
+
- of
|
2434
|
+
- 'on'
|
2435
|
+
- os
|
2436
|
+
- pp
|
2437
|
+
- to
|
2438
|
+
# Forbidden names that will register an offense
|
2439
|
+
ForbiddenNames: []
|
1984
2440
|
|
1985
2441
|
Naming/PredicateName:
|
1986
2442
|
Description: 'Check the names of predicate methods.'
|
1987
2443
|
StyleGuide: '#bool-methods-qmark'
|
1988
2444
|
Enabled: true
|
1989
2445
|
VersionAdded: '0.50'
|
1990
|
-
VersionChanged: '0.
|
2446
|
+
VersionChanged: '0.77'
|
1991
2447
|
# Predicate name prefixes.
|
1992
2448
|
NamePrefix:
|
1993
2449
|
- is_
|
1994
2450
|
- has_
|
1995
2451
|
- have_
|
1996
2452
|
# Predicate name prefixes that should be removed.
|
1997
|
-
|
2453
|
+
ForbiddenPrefixes:
|
1998
2454
|
- is_
|
1999
2455
|
- has_
|
2000
2456
|
- have_
|
2001
|
-
# Predicate names which, despite having a
|
2457
|
+
# Predicate names which, despite having a forbidden prefix, or no `?`,
|
2002
2458
|
# should still be accepted
|
2003
|
-
|
2459
|
+
AllowedMethods:
|
2004
2460
|
- is_a?
|
2005
2461
|
# Method definition macros for dynamically generated methods.
|
2006
2462
|
MethodDefinitionMacros:
|
2007
2463
|
- define_method
|
2008
|
-
- define_singleton_method
|
2009
|
-
# Exclude Rspec specs because there is a strong convention to write spec
|
2010
|
-
# helpers in the form of `have_something` or `be_something`.
|
2011
|
-
Exclude:
|
2012
|
-
- 'spec/**/*'
|
2013
|
-
|
2014
|
-
Naming/RescuedExceptionsVariableName:
|
2015
|
-
Description: 'Use consistent rescued exceptions variables naming.'
|
2016
|
-
Enabled: true
|
2017
|
-
VersionAdded: '0.67'
|
2018
|
-
VersionChanged: '0.68'
|
2019
|
-
PreferredName: e
|
2020
|
-
|
2021
|
-
Naming/UncommunicativeBlockParamName:
|
2022
|
-
Description: >-
|
2023
|
-
Checks for block parameter names that contain capital letters,
|
2024
|
-
end in numbers, or do not meet a minimal length.
|
2025
|
-
Enabled: true
|
2026
|
-
VersionAdded: '0.53'
|
2027
|
-
# Parameter names may be equal to or greater than this value
|
2028
|
-
MinNameLength: 1
|
2029
|
-
AllowNamesEndingInNumbers: true
|
2030
|
-
# Whitelisted names that will not register an offense
|
2031
|
-
AllowedNames: []
|
2032
|
-
# Blacklisted names that will register an offense
|
2033
|
-
ForbiddenNames: []
|
2034
|
-
|
2035
|
-
Naming/UncommunicativeMethodParamName:
|
2036
|
-
Description: >-
|
2037
|
-
Checks for method parameter names that contain capital letters,
|
2038
|
-
end in numbers, or do not meet a minimal length.
|
2039
|
-
Enabled: true
|
2040
|
-
VersionAdded: '0.53'
|
2041
|
-
VersionChanged: '0.59'
|
2042
|
-
# Parameter names may be equal to or greater than this value
|
2043
|
-
MinNameLength: 3
|
2044
|
-
AllowNamesEndingInNumbers: true
|
2045
|
-
# Whitelisted names that will not register an offense
|
2046
|
-
AllowedNames:
|
2047
|
-
- io
|
2048
|
-
- id
|
2049
|
-
- to
|
2050
|
-
- by
|
2051
|
-
- 'on'
|
2052
|
-
- in
|
2053
|
-
- at
|
2054
|
-
- ip
|
2055
|
-
- db
|
2056
|
-
# Blacklisted names that will register an offense
|
2057
|
-
ForbiddenNames: []
|
2058
|
-
|
2059
|
-
|
2060
|
-
Naming/VariableName:
|
2061
|
-
Description: 'Use the configured style when naming variables.'
|
2062
|
-
StyleGuide: '#snake-case-symbols-methods-vars'
|
2063
|
-
Enabled: true
|
2064
|
-
VersionAdded: '0.50'
|
2065
|
-
EnforcedStyle: snake_case
|
2066
|
-
SupportedStyles:
|
2067
|
-
- snake_case
|
2068
|
-
- camelCase
|
2069
|
-
|
2070
|
-
Naming/VariableNumber:
|
2071
|
-
Description: 'Use the configured style when numbering variables.'
|
2072
|
-
Enabled: true
|
2073
|
-
VersionAdded: '0.50'
|
2074
|
-
EnforcedStyle: normalcase
|
2075
|
-
SupportedStyles:
|
2076
|
-
- snake_case
|
2077
|
-
- normalcase
|
2078
|
-
- non_integer
|
2079
|
-
|
2080
|
-
#################### Rails #################################
|
2081
|
-
|
2082
|
-
# By default, the rails cops are not run. Override in project or home
|
2083
|
-
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
2084
|
-
Rails:
|
2085
|
-
Enabled: false
|
2086
|
-
|
2087
|
-
Rails/ActionFilter:
|
2088
|
-
Description: 'Enforces consistent use of action filter methods.'
|
2089
|
-
Enabled: true
|
2090
|
-
VersionAdded: '0.19'
|
2091
|
-
EnforcedStyle: action
|
2092
|
-
SupportedStyles:
|
2093
|
-
- action
|
2094
|
-
- filter
|
2095
|
-
Include:
|
2096
|
-
- app/controllers/**/*.rb
|
2097
|
-
|
2098
|
-
Rails/ActiveRecordAliases:
|
2099
|
-
Description: >-
|
2100
|
-
Avoid Active Record aliases:
|
2101
|
-
Use `update` instead of `update_attributes`.
|
2102
|
-
Use `update!` instead of `update_attributes!`.
|
2103
|
-
Enabled: true
|
2104
|
-
VersionAdded: '0.53'
|
2105
|
-
|
2106
|
-
Rails/ActiveRecordOverride:
|
2107
|
-
Description: >-
|
2108
|
-
Check for overriding Active Record methods instead of using
|
2109
|
-
callbacks.
|
2110
|
-
Enabled: true
|
2111
|
-
VersionAdded: '0.67'
|
2112
|
-
Include:
|
2113
|
-
- app/models/**/*.rb
|
2114
|
-
|
2115
|
-
Rails/ActiveSupportAliases:
|
2116
|
-
Description: >-
|
2117
|
-
Avoid ActiveSupport aliases of standard ruby methods:
|
2118
|
-
`String#starts_with?`, `String#ends_with?`,
|
2119
|
-
`Array#append`, `Array#prepend`.
|
2120
|
-
Enabled: true
|
2121
|
-
VersionAdded: '0.48'
|
2122
|
-
|
2123
|
-
Rails/ApplicationJob:
|
2124
|
-
Description: 'Check that jobs subclass ApplicationJob.'
|
2125
|
-
Enabled: true
|
2126
|
-
VersionAdded: '0.49'
|
2127
|
-
|
2128
|
-
Rails/ApplicationRecord:
|
2129
|
-
Description: 'Check that models subclass ApplicationRecord.'
|
2130
|
-
Enabled: true
|
2131
|
-
VersionAdded: '0.49'
|
2132
|
-
|
2133
|
-
Rails/AssertNot:
|
2134
|
-
Description: 'Use `assert_not` instead of `assert !`.'
|
2135
|
-
Enabled: true
|
2136
|
-
VersionAdded: '0.56'
|
2137
|
-
Include:
|
2138
|
-
- '**/test/**/*'
|
2139
|
-
|
2140
|
-
Rails/BelongsTo:
|
2141
|
-
Description: >-
|
2142
|
-
Use `optional: true` instead of `required: false` for
|
2143
|
-
`belongs_to` relations'
|
2144
|
-
Enabled: true
|
2145
|
-
VersionAdded: '0.62'
|
2146
|
-
|
2147
|
-
Rails/Blank:
|
2148
|
-
Description: 'Enforces use of `blank?`.'
|
2149
|
-
Enabled: true
|
2150
|
-
VersionAdded: '0.48'
|
2151
|
-
VersionChanged: '0.67'
|
2152
|
-
# Convert usages of `nil? || empty?` to `blank?`
|
2153
|
-
NilOrEmpty: true
|
2154
|
-
# Convert usages of `!present?` to `blank?`
|
2155
|
-
NotPresent: true
|
2156
|
-
# Convert usages of `unless present?` to `if blank?`
|
2157
|
-
UnlessPresent: true
|
2158
|
-
|
2159
|
-
Rails/BulkChangeTable:
|
2160
|
-
Description: 'Check whether alter queries are combinable.'
|
2161
|
-
Enabled: true
|
2162
|
-
VersionAdded: '0.57'
|
2163
|
-
Database: null
|
2164
|
-
SupportedDatabases:
|
2165
|
-
- mysql
|
2166
|
-
- postgresql
|
2167
|
-
Include:
|
2168
|
-
- db/migrate/*.rb
|
2169
|
-
|
2170
|
-
Rails/CreateTableWithTimestamps:
|
2171
|
-
Description: >-
|
2172
|
-
Checks the migration for which timestamps are not included
|
2173
|
-
when creating a new table.
|
2174
|
-
Enabled: true
|
2175
|
-
VersionAdded: '0.52'
|
2176
|
-
Include:
|
2177
|
-
- db/migrate/*.rb
|
2178
|
-
|
2179
|
-
Rails/Date:
|
2180
|
-
Description: >-
|
2181
|
-
Checks the correct usage of date aware methods,
|
2182
|
-
such as Date.today, Date.current etc.
|
2183
|
-
Enabled: true
|
2184
|
-
VersionAdded: '0.30'
|
2185
|
-
VersionChanged: '0.33'
|
2186
|
-
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
2187
|
-
# `Date#to_time` etc.
|
2188
|
-
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
|
2189
|
-
# (but not `Date.today`) which are overridden by ActiveSupport to handle current
|
2190
|
-
# time zone.
|
2191
|
-
EnforcedStyle: flexible
|
2192
|
-
SupportedStyles:
|
2193
|
-
- strict
|
2194
|
-
- flexible
|
2195
|
-
|
2196
|
-
Rails/Delegate:
|
2197
|
-
Description: 'Prefer delegate method for delegations.'
|
2198
|
-
Enabled: true
|
2199
|
-
VersionAdded: '0.21'
|
2200
|
-
VersionChanged: '0.50'
|
2201
|
-
# When set to true, using the target object as a prefix of the
|
2202
|
-
# method name without using the `delegate` method will be a
|
2203
|
-
# violation. When set to false, this case is legal.
|
2204
|
-
EnforceForPrefixed: true
|
2205
|
-
|
2206
|
-
Rails/DelegateAllowBlank:
|
2207
|
-
Description: 'Do not use allow_blank as an option to delegate.'
|
2208
|
-
Enabled: true
|
2209
|
-
VersionAdded: '0.44'
|
2210
|
-
|
2211
|
-
Rails/DynamicFindBy:
|
2212
|
-
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
|
2213
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2214
|
-
Enabled: true
|
2215
|
-
VersionAdded: '0.44'
|
2216
|
-
Whitelist:
|
2217
|
-
- find_by_sql
|
2218
|
-
|
2219
|
-
Rails/EnumUniqueness:
|
2220
|
-
Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
|
2221
|
-
Enabled: true
|
2222
|
-
VersionAdded: '0.46'
|
2223
|
-
Include:
|
2224
|
-
- app/models/**/*.rb
|
2225
|
-
|
2226
|
-
Rails/EnvironmentComparison:
|
2227
|
-
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
|
2228
|
-
Enabled: true
|
2229
|
-
VersionAdded: '0.52'
|
2230
|
-
|
2231
|
-
Rails/Exit:
|
2232
|
-
Description: >-
|
2233
|
-
Favor `fail`, `break`, `return`, etc. over `exit` in
|
2234
|
-
application or library code outside of Rake files to avoid
|
2235
|
-
exits during unit testing or running in production.
|
2236
|
-
Enabled: true
|
2237
|
-
VersionAdded: '0.41'
|
2238
|
-
Include:
|
2239
|
-
- app/**/*.rb
|
2240
|
-
- config/**/*.rb
|
2241
|
-
- lib/**/*.rb
|
2242
|
-
Exclude:
|
2243
|
-
- lib/**/*.rake
|
2244
|
-
|
2245
|
-
Rails/FilePath:
|
2246
|
-
Description: 'Use `Rails.root.join` for file path joining.'
|
2247
|
-
Enabled: true
|
2248
|
-
VersionAdded: '0.47'
|
2249
|
-
VersionChanged: '0.57'
|
2250
|
-
EnforcedStyle: arguments
|
2251
|
-
SupportedStyles:
|
2252
|
-
- slashes
|
2253
|
-
- arguments
|
2254
|
-
|
2255
|
-
Rails/FindBy:
|
2256
|
-
Description: 'Prefer find_by over where.first.'
|
2257
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2258
|
-
Enabled: true
|
2259
|
-
VersionAdded: '0.30'
|
2260
|
-
Include:
|
2261
|
-
- app/models/**/*.rb
|
2262
|
-
|
2263
|
-
Rails/FindEach:
|
2264
|
-
Description: 'Prefer all.find_each over all.find.'
|
2265
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
|
2266
|
-
Enabled: true
|
2267
|
-
VersionAdded: '0.30'
|
2268
|
-
Include:
|
2269
|
-
- app/models/**/*.rb
|
2270
|
-
|
2271
|
-
Rails/HasAndBelongsToMany:
|
2272
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
2273
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
|
2274
|
-
Enabled: true
|
2275
|
-
VersionAdded: '0.12'
|
2276
|
-
Include:
|
2277
|
-
- app/models/**/*.rb
|
2278
|
-
|
2279
|
-
Rails/HasManyOrHasOneDependent:
|
2280
|
-
Description: 'Define the dependent option to the has_many and has_one associations.'
|
2281
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
|
2282
|
-
Enabled: true
|
2283
|
-
VersionAdded: '0.50'
|
2284
|
-
Include:
|
2285
|
-
- app/models/**/*.rb
|
2286
|
-
|
2287
|
-
Rails/HttpPositionalArguments:
|
2288
|
-
Description: 'Use keyword arguments instead of positional arguments in http method calls.'
|
2289
|
-
Enabled: true
|
2290
|
-
VersionAdded: '0.44'
|
2291
|
-
Include:
|
2292
|
-
- 'spec/**/*'
|
2293
|
-
- 'test/**/*'
|
2294
|
-
|
2295
|
-
Rails/HttpStatus:
|
2296
|
-
Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
|
2297
|
-
Enabled: true
|
2298
|
-
VersionAdded: '0.54'
|
2299
|
-
EnforcedStyle: symbolic
|
2300
|
-
SupportedStyles:
|
2301
|
-
- numeric
|
2302
|
-
- symbolic
|
2303
|
-
|
2304
|
-
Rails/IgnoredSkipActionFilterOption:
|
2305
|
-
Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
|
2306
|
-
Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
|
2307
|
-
Enabled: true
|
2308
|
-
VersionAdded: '0.63'
|
2309
|
-
Include:
|
2310
|
-
- app/controllers/**/*.rb
|
2311
|
-
|
2312
|
-
Rails/InverseOf:
|
2313
|
-
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
2314
|
-
Enabled: true
|
2315
|
-
VersionAdded: '0.52'
|
2316
|
-
Include:
|
2317
|
-
- app/models/**/*.rb
|
2318
|
-
|
2319
|
-
Rails/LexicallyScopedActionFilter:
|
2320
|
-
Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
|
2321
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
|
2322
|
-
Enabled: true
|
2323
|
-
Safe: false
|
2324
|
-
VersionAdded: '0.52'
|
2325
|
-
Include:
|
2326
|
-
- app/controllers/**/*.rb
|
2327
|
-
|
2328
|
-
Rails/LinkToBlank:
|
2329
|
-
Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
|
2330
|
-
Reference:
|
2331
|
-
- https://mathiasbynens.github.io/rel-noopener/
|
2332
|
-
- https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
|
2333
|
-
- https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
|
2334
|
-
Enabled: true
|
2335
|
-
VersionAdded: '0.62'
|
2336
|
-
|
2337
|
-
Rails/NotNullColumn:
|
2338
|
-
Description: 'Do not add a NOT NULL column without a default value'
|
2339
|
-
Enabled: true
|
2340
|
-
VersionAdded: '0.43'
|
2341
|
-
Include:
|
2342
|
-
- db/migrate/*.rb
|
2343
|
-
|
2344
|
-
Rails/Output:
|
2345
|
-
Description: 'Checks for calls to puts, print, etc.'
|
2346
|
-
Enabled: true
|
2347
|
-
VersionAdded: '0.15'
|
2348
|
-
VersionChanged: '0.19'
|
2349
|
-
Include:
|
2350
|
-
- app/**/*.rb
|
2351
|
-
- config/**/*.rb
|
2352
|
-
- db/**/*.rb
|
2353
|
-
- lib/**/*.rb
|
2354
|
-
|
2355
|
-
Rails/OutputSafety:
|
2356
|
-
Description: 'The use of `html_safe` or `raw` may be a security risk.'
|
2357
|
-
Enabled: true
|
2358
|
-
VersionAdded: '0.41'
|
2359
|
-
|
2360
|
-
Rails/PluralizationGrammar:
|
2361
|
-
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
|
2362
|
-
Enabled: true
|
2363
|
-
VersionAdded: '0.35'
|
2364
|
-
|
2365
|
-
Rails/Presence:
|
2366
|
-
Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
|
2367
|
-
Enabled: true
|
2368
|
-
VersionAdded: '0.52'
|
2369
|
-
|
2370
|
-
Rails/Present:
|
2371
|
-
Description: 'Enforces use of `present?`.'
|
2372
|
-
Enabled: true
|
2373
|
-
VersionAdded: '0.48'
|
2374
|
-
VersionChanged: '0.67'
|
2375
|
-
# Convert usages of `!nil? && !empty?` to `present?`
|
2376
|
-
NotNilAndNotEmpty: true
|
2377
|
-
# Convert usages of `!blank?` to `present?`
|
2378
|
-
NotBlank: true
|
2379
|
-
# Convert usages of `unless blank?` to `if present?`
|
2380
|
-
UnlessBlank: true
|
2381
|
-
|
2382
|
-
Rails/ReadWriteAttribute:
|
2383
|
-
Description: >-
|
2384
|
-
Checks for read_attribute(:attr) and
|
2385
|
-
write_attribute(:attr, val).
|
2386
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
|
2387
|
-
Enabled: true
|
2388
|
-
VersionAdded: '0.20'
|
2389
|
-
VersionChanged: '0.29'
|
2390
|
-
Include:
|
2391
|
-
- app/models/**/*.rb
|
2392
|
-
|
2393
|
-
Rails/RedundantAllowNil:
|
2394
|
-
Description: >-
|
2395
|
-
Finds redundant use of `allow_nil` when `allow_blank` is set to
|
2396
|
-
certain values in model validations.
|
2397
|
-
Enabled: true
|
2398
|
-
VersionAdded: '0.67'
|
2399
|
-
Include:
|
2400
|
-
- app/models/**/*.rb
|
2401
|
-
|
2402
|
-
Rails/RedundantReceiverInWithOptions:
|
2403
|
-
Description: 'Checks for redundant receiver in `with_options`.'
|
2404
|
-
Enabled: true
|
2405
|
-
VersionAdded: '0.52'
|
2406
|
-
|
2407
|
-
Rails/ReflectionClassName:
|
2408
|
-
Description: 'Use a string for `class_name` option value in the definition of a reflection.'
|
2409
|
-
Enabled: true
|
2410
|
-
VersionAdded: '0.64'
|
2411
|
-
|
2412
|
-
Rails/RefuteMethods:
|
2413
|
-
Description: 'Use `assert_not` methods instead of `refute` methods.'
|
2414
|
-
Enabled: true
|
2415
|
-
VersionAdded: '0.56'
|
2416
|
-
Include:
|
2417
|
-
- '**/test/**/*'
|
2418
|
-
|
2419
|
-
Rails/RelativeDateConstant:
|
2420
|
-
Description: 'Do not assign relative date to constants.'
|
2421
|
-
Enabled: true
|
2422
|
-
VersionAdded: '0.48'
|
2423
|
-
VersionChanged: '0.59'
|
2424
|
-
AutoCorrect: false
|
2425
|
-
|
2426
|
-
Rails/RequestReferer:
|
2427
|
-
Description: 'Use consistent syntax for request.referer.'
|
2428
|
-
Enabled: true
|
2429
|
-
VersionAdded: '0.41'
|
2430
|
-
EnforcedStyle: referer
|
2431
|
-
SupportedStyles:
|
2432
|
-
- referer
|
2433
|
-
- referrer
|
2434
|
-
|
2435
|
-
Rails/ReversibleMigration:
|
2436
|
-
Description: 'Checks whether the change method of the migration file is reversible.'
|
2437
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
|
2438
|
-
Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
|
2439
|
-
Enabled: true
|
2440
|
-
VersionAdded: '0.47'
|
2441
|
-
Include:
|
2442
|
-
- db/migrate/*.rb
|
2443
|
-
|
2444
|
-
Rails/SafeNavigation:
|
2445
|
-
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
|
2446
|
-
Enabled: true
|
2447
|
-
VersionAdded: '0.43'
|
2448
|
-
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
2449
|
-
# `try` and `try!` work slightly differently. `try!` and safe navigation will
|
2450
|
-
# both raise a `NoMethodError` if the receiver of the method call does not
|
2451
|
-
# implement the intended method. `try` will not raise an exception for this.
|
2452
|
-
ConvertTry: false
|
2453
|
-
|
2454
|
-
Rails/SaveBang:
|
2455
|
-
Description: 'Identifies possible cases where Active Record save! or related should be used.'
|
2456
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
|
2457
|
-
Enabled: false
|
2458
|
-
VersionAdded: '0.42'
|
2459
|
-
VersionChanged: '0.59'
|
2460
|
-
AllowImplicitReturn: true
|
2461
|
-
AllowedReceivers: []
|
2462
|
-
|
2463
|
-
Rails/ScopeArgs:
|
2464
|
-
Description: 'Checks the arguments of ActiveRecord scopes.'
|
2465
|
-
Enabled: true
|
2466
|
-
VersionAdded: '0.19'
|
2467
|
-
Include:
|
2468
|
-
- app/models/**/*.rb
|
2464
|
+
- define_singleton_method
|
2465
|
+
# Exclude Rspec specs because there is a strong convention to write spec
|
2466
|
+
# helpers in the form of `have_something` or `be_something`.
|
2467
|
+
Exclude:
|
2468
|
+
- 'spec/**/*'
|
2469
2469
|
|
2470
|
-
|
2471
|
-
Description:
|
2472
|
-
Use methods that skips model validations with caution.
|
2473
|
-
See reference for more information.
|
2474
|
-
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
2475
|
-
Enabled: true
|
2476
|
-
VersionAdded: '0.47'
|
2477
|
-
VersionChanged: '0.60'
|
2478
|
-
Blacklist:
|
2479
|
-
- decrement!
|
2480
|
-
- decrement_counter
|
2481
|
-
- increment!
|
2482
|
-
- increment_counter
|
2483
|
-
- toggle!
|
2484
|
-
- touch
|
2485
|
-
- update_all
|
2486
|
-
- update_attribute
|
2487
|
-
- update_column
|
2488
|
-
- update_columns
|
2489
|
-
- update_counters
|
2490
|
-
Whitelist: []
|
2491
|
-
|
2492
|
-
Rails/TimeZone:
|
2493
|
-
Description: 'Checks the correct usage of time zone aware methods.'
|
2494
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
|
2495
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
2470
|
+
Naming/RescuedExceptionsVariableName:
|
2471
|
+
Description: 'Use consistent rescued exceptions variables naming.'
|
2496
2472
|
Enabled: true
|
2497
|
-
|
2498
|
-
VersionAdded: '0.30'
|
2473
|
+
VersionAdded: '0.67'
|
2499
2474
|
VersionChanged: '0.68'
|
2500
|
-
|
2501
|
-
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
2502
|
-
EnforcedStyle: flexible
|
2503
|
-
SupportedStyles:
|
2504
|
-
- strict
|
2505
|
-
- flexible
|
2475
|
+
PreferredName: e
|
2506
2476
|
|
2507
|
-
|
2508
|
-
Description: '
|
2477
|
+
Naming/VariableName:
|
2478
|
+
Description: 'Use the configured style when naming variables.'
|
2479
|
+
StyleGuide: '#snake-case-symbols-methods-vars'
|
2509
2480
|
Enabled: true
|
2510
|
-
VersionAdded: '0.
|
2511
|
-
|
2512
|
-
EnforcedStyle: conservative
|
2481
|
+
VersionAdded: '0.50'
|
2482
|
+
EnforcedStyle: snake_case
|
2513
2483
|
SupportedStyles:
|
2514
|
-
-
|
2515
|
-
-
|
2516
|
-
AutoCorrect: false
|
2517
|
-
|
2518
|
-
Rails/UnknownEnv:
|
2519
|
-
Description: 'Use correct environment name.'
|
2520
|
-
Enabled: true
|
2521
|
-
VersionAdded: '0.51'
|
2522
|
-
Environments:
|
2523
|
-
- development
|
2524
|
-
- test
|
2525
|
-
- production
|
2484
|
+
- snake_case
|
2485
|
+
- camelCase
|
2526
2486
|
|
2527
|
-
|
2528
|
-
Description: 'Use
|
2487
|
+
Naming/VariableNumber:
|
2488
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
2489
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2529
2490
|
Enabled: true
|
2530
|
-
VersionAdded: '0.
|
2531
|
-
VersionChanged: '
|
2532
|
-
|
2533
|
-
|
2491
|
+
VersionAdded: '0.50'
|
2492
|
+
VersionChanged: '1.4'
|
2493
|
+
EnforcedStyle: normalcase
|
2494
|
+
SupportedStyles:
|
2495
|
+
- snake_case
|
2496
|
+
- normalcase
|
2497
|
+
- non_integer
|
2498
|
+
CheckMethodNames: true
|
2499
|
+
CheckSymbols: true
|
2500
|
+
AllowedIdentifiers:
|
2501
|
+
- capture3 # Open3.capture3
|
2502
|
+
- iso8601 # Time#iso8601
|
2503
|
+
- rfc1123_date # CGI.rfc1123_date
|
2504
|
+
- rfc822 # Time#rfc822
|
2505
|
+
- rfc2822 # Time#rfc2822
|
2506
|
+
- rfc3339 # DateTime.rfc3339
|
2534
2507
|
|
2535
2508
|
#################### Security ##############################
|
2536
2509
|
|
@@ -2543,7 +2516,7 @@ Security/JSONLoad:
|
|
2543
2516
|
Description: >-
|
2544
2517
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2545
2518
|
security issues. See reference for more information.
|
2546
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2519
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2547
2520
|
Enabled: true
|
2548
2521
|
VersionAdded: '0.43'
|
2549
2522
|
VersionChanged: '0.44'
|
@@ -2556,21 +2529,22 @@ Security/MarshalLoad:
|
|
2556
2529
|
Description: >-
|
2557
2530
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2558
2531
|
security issues. See reference for more information.
|
2559
|
-
Reference: 'https://ruby-doc.org/core-2.
|
2532
|
+
Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2560
2533
|
Enabled: true
|
2561
2534
|
VersionAdded: '0.47'
|
2562
2535
|
|
2563
2536
|
Security/Open:
|
2564
|
-
Description: 'The use of Kernel#open
|
2537
|
+
Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
|
2565
2538
|
Enabled: true
|
2566
2539
|
VersionAdded: '0.53'
|
2540
|
+
VersionChanged: '1.0'
|
2567
2541
|
Safe: false
|
2568
2542
|
|
2569
2543
|
Security/YAMLLoad:
|
2570
2544
|
Description: >-
|
2571
2545
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2572
2546
|
security issues. See reference for more information.
|
2573
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2547
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2574
2548
|
Enabled: true
|
2575
2549
|
VersionAdded: '0.47'
|
2576
2550
|
SafeAutoCorrect: false
|
@@ -2581,14 +2555,27 @@ Style/AccessModifierDeclarations:
|
|
2581
2555
|
Description: 'Checks style of how access modifiers are used.'
|
2582
2556
|
Enabled: true
|
2583
2557
|
VersionAdded: '0.57'
|
2558
|
+
VersionChanged: '0.81'
|
2584
2559
|
EnforcedStyle: group
|
2585
2560
|
SupportedStyles:
|
2586
2561
|
- inline
|
2587
2562
|
- group
|
2563
|
+
AllowModifiersOnSymbols: true
|
2564
|
+
|
2565
|
+
Style/AccessorGrouping:
|
2566
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2567
|
+
Enabled: true
|
2568
|
+
VersionAdded: '0.87'
|
2569
|
+
EnforcedStyle: grouped
|
2570
|
+
SupportedStyles:
|
2571
|
+
# separated: each accessor goes in a separate statement.
|
2572
|
+
# grouped: accessors are grouped into a single statement.
|
2573
|
+
- separated
|
2574
|
+
- grouped
|
2588
2575
|
|
2589
2576
|
Style/Alias:
|
2590
2577
|
Description: 'Use alias instead of alias_method.'
|
2591
|
-
StyleGuide: '#alias-method'
|
2578
|
+
StyleGuide: '#alias-method-lexically'
|
2592
2579
|
Enabled: true
|
2593
2580
|
VersionAdded: '0.9'
|
2594
2581
|
VersionChanged: '0.36'
|
@@ -2605,11 +2592,27 @@ Style/AndOr:
|
|
2605
2592
|
VersionChanged: '0.25'
|
2606
2593
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2607
2594
|
# or completely (always).
|
2608
|
-
EnforcedStyle:
|
2595
|
+
EnforcedStyle: conditionals
|
2609
2596
|
SupportedStyles:
|
2610
2597
|
- always
|
2611
2598
|
- conditionals
|
2612
2599
|
|
2600
|
+
Style/ArgumentsForwarding:
|
2601
|
+
Description: 'Use arguments forwarding.'
|
2602
|
+
StyleGuide: '#arguments-forwarding'
|
2603
|
+
Enabled: pending
|
2604
|
+
AllowOnlyRestArgument: true
|
2605
|
+
VersionAdded: '1.1'
|
2606
|
+
|
2607
|
+
Style/ArrayCoercion:
|
2608
|
+
Description: >-
|
2609
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
2610
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2611
|
+
StyleGuide: '#array-coercion'
|
2612
|
+
Safe: false
|
2613
|
+
Enabled: false
|
2614
|
+
VersionAdded: '0.88'
|
2615
|
+
|
2613
2616
|
Style/ArrayJoin:
|
2614
2617
|
Description: 'Use Array#join instead of Array#*.'
|
2615
2618
|
StyleGuide: '#array-join'
|
@@ -2653,6 +2656,13 @@ Style/BeginBlock:
|
|
2653
2656
|
Enabled: true
|
2654
2657
|
VersionAdded: '0.9'
|
2655
2658
|
|
2659
|
+
Style/BisectedAttrAccessor:
|
2660
|
+
Description: >-
|
2661
|
+
Checks for places where `attr_reader` and `attr_writer`
|
2662
|
+
for the same method can be combined into single `attr_accessor`.
|
2663
|
+
Enabled: true
|
2664
|
+
VersionAdded: '0.87'
|
2665
|
+
|
2656
2666
|
Style/BlockComments:
|
2657
2667
|
Description: 'Do not use block comments.'
|
2658
2668
|
StyleGuide: '#no-block-comments'
|
@@ -2763,30 +2773,35 @@ Style/BlockDelimiters:
|
|
2763
2773
|
# # also good
|
2764
2774
|
# collection.each do |element| puts element end
|
2765
2775
|
AllowBracesOnProceduralOneLiners: false
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
EnforcedStyle: no_braces
|
2773
|
-
SupportedStyles:
|
2774
|
-
# The `braces` style enforces braces around all method parameters that are
|
2775
|
-
# hashes.
|
2776
|
-
- braces
|
2777
|
-
# The `no_braces` style checks that the last parameter doesn't have braces
|
2778
|
-
# around it.
|
2779
|
-
- no_braces
|
2780
|
-
# The `context_dependent` style checks that the last parameter doesn't have
|
2781
|
-
# braces around it, but requires braces if the second to last parameter is
|
2782
|
-
# also a hash literal.
|
2783
|
-
- context_dependent
|
2776
|
+
# The BracesRequiredMethods overrides all other configurations except
|
2777
|
+
# IgnoredMethods. It can be used to enforce that all blocks for specific
|
2778
|
+
# methods use braces. For example, you can use this to enforce Sorbet
|
2779
|
+
# signatures use braces even when the rest of your codebase enforces
|
2780
|
+
# the `line_count_based` style.
|
2781
|
+
BracesRequiredMethods: []
|
2784
2782
|
|
2785
2783
|
Style/CaseEquality:
|
2786
2784
|
Description: 'Avoid explicit use of the case equality operator(===).'
|
2787
2785
|
StyleGuide: '#no-case-equality'
|
2788
2786
|
Enabled: true
|
2789
2787
|
VersionAdded: '0.9'
|
2788
|
+
VersionChanged: '0.89'
|
2789
|
+
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
2790
|
+
# the case equality operator is a constant.
|
2791
|
+
#
|
2792
|
+
# # bad
|
2793
|
+
# /string/ === "string"
|
2794
|
+
#
|
2795
|
+
# # good
|
2796
|
+
# String === "string"
|
2797
|
+
AllowOnConstant: false
|
2798
|
+
|
2799
|
+
Style/CaseLikeIf:
|
2800
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2801
|
+
StyleGuide: '#case-vs-if-else'
|
2802
|
+
Enabled: true
|
2803
|
+
Safe: false
|
2804
|
+
VersionAdded: '0.88'
|
2790
2805
|
|
2791
2806
|
Style/CharacterLiteral:
|
2792
2807
|
Description: 'Checks for uses of character literals.'
|
@@ -2803,7 +2818,6 @@ Style/ClassAndModuleChildren:
|
|
2803
2818
|
# have the knowledge to perform either operation safely and thus requires
|
2804
2819
|
# manual oversight.
|
2805
2820
|
SafeAutoCorrect: false
|
2806
|
-
AutoCorrect: false
|
2807
2821
|
Enabled: true
|
2808
2822
|
VersionAdded: '0.19'
|
2809
2823
|
#
|
@@ -2827,6 +2841,7 @@ Style/ClassAndModuleChildren:
|
|
2827
2841
|
|
2828
2842
|
Style/ClassCheck:
|
2829
2843
|
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
2844
|
+
StyleGuide: '#is-a-vs-kind-of'
|
2830
2845
|
Enabled: true
|
2831
2846
|
VersionAdded: '0.24'
|
2832
2847
|
EnforcedStyle: is_a?
|
@@ -2834,6 +2849,16 @@ Style/ClassCheck:
|
|
2834
2849
|
- is_a?
|
2835
2850
|
- kind_of?
|
2836
2851
|
|
2852
|
+
Style/ClassEqualityComparison:
|
2853
|
+
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
2854
|
+
StyleGuide: '#instance-of-vs-class-comparison'
|
2855
|
+
Enabled: true
|
2856
|
+
VersionAdded: '0.93'
|
2857
|
+
IgnoredMethods:
|
2858
|
+
- ==
|
2859
|
+
- equal?
|
2860
|
+
- eql?
|
2861
|
+
|
2837
2862
|
Style/ClassMethods:
|
2838
2863
|
Description: 'Use self when defining module/class methods.'
|
2839
2864
|
StyleGuide: '#def-self-class-methods'
|
@@ -2841,16 +2866,33 @@ Style/ClassMethods:
|
|
2841
2866
|
VersionAdded: '0.9'
|
2842
2867
|
VersionChanged: '0.20'
|
2843
2868
|
|
2869
|
+
Style/ClassMethodsDefinitions:
|
2870
|
+
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
2871
|
+
StyleGuide: '#def-self-class-methods'
|
2872
|
+
Enabled: false
|
2873
|
+
VersionAdded: '0.89'
|
2874
|
+
EnforcedStyle: def_self
|
2875
|
+
SupportedStyles:
|
2876
|
+
- def_self
|
2877
|
+
- self_class
|
2878
|
+
|
2844
2879
|
Style/ClassVars:
|
2845
2880
|
Description: 'Avoid the use of class variables.'
|
2846
2881
|
StyleGuide: '#no-class-vars'
|
2847
2882
|
Enabled: true
|
2848
2883
|
VersionAdded: '0.13'
|
2849
2884
|
|
2885
|
+
Style/CollectionCompact:
|
2886
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
2887
|
+
Enabled: pending
|
2888
|
+
Safe: false
|
2889
|
+
VersionAdded: '1.2'
|
2890
|
+
VersionChanged: '1.3'
|
2891
|
+
|
2850
2892
|
# Align with the style guide.
|
2851
2893
|
Style/CollectionMethods:
|
2852
2894
|
Description: 'Preferred collection methods.'
|
2853
|
-
StyleGuide: '#map-find-select-reduce-size'
|
2895
|
+
StyleGuide: '#map-find-select-reduce-include-size'
|
2854
2896
|
Enabled: false
|
2855
2897
|
VersionAdded: '0.9'
|
2856
2898
|
VersionChanged: '0.27'
|
@@ -2867,6 +2909,7 @@ Style/CollectionMethods:
|
|
2867
2909
|
inject: 'reduce'
|
2868
2910
|
detect: 'find'
|
2869
2911
|
find_all: 'select'
|
2912
|
+
member?: 'include?'
|
2870
2913
|
|
2871
2914
|
Style/ColonMethodCall:
|
2872
2915
|
Description: 'Do not use :: for method call.'
|
@@ -2880,6 +2923,14 @@ Style/ColonMethodDefinition:
|
|
2880
2923
|
Enabled: true
|
2881
2924
|
VersionAdded: '0.52'
|
2882
2925
|
|
2926
|
+
Style/CombinableLoops:
|
2927
|
+
Description: >-
|
2928
|
+
Checks for places where multiple consecutive loops over the same data
|
2929
|
+
can be combined into a single loop.
|
2930
|
+
Enabled: true
|
2931
|
+
Safe: false
|
2932
|
+
VersionAdded: '0.90'
|
2933
|
+
|
2883
2934
|
Style/CommandLiteral:
|
2884
2935
|
Description: 'Use `` or %x around command literals.'
|
2885
2936
|
StyleGuide: '#percent-x'
|
@@ -2901,17 +2952,18 @@ Style/CommandLiteral:
|
|
2901
2952
|
Style/CommentAnnotation:
|
2902
2953
|
Description: >-
|
2903
2954
|
Checks formatting of special comments
|
2904
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
2955
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2905
2956
|
StyleGuide: '#annotate-keywords'
|
2906
2957
|
Enabled: true
|
2907
2958
|
VersionAdded: '0.10'
|
2908
|
-
VersionChanged: '
|
2959
|
+
VersionChanged: '1.3'
|
2909
2960
|
Keywords:
|
2910
2961
|
- TODO
|
2911
2962
|
- FIXME
|
2912
2963
|
- OPTIMIZE
|
2913
2964
|
- HACK
|
2914
2965
|
- REVIEW
|
2966
|
+
- NOTE
|
2915
2967
|
|
2916
2968
|
Style/CommentedKeyword:
|
2917
2969
|
Description: 'Do not place comments on the same line as certain keywords.'
|
@@ -2939,6 +2991,13 @@ Style/ConditionalAssignment:
|
|
2939
2991
|
SingleLineConditionsOnly: true
|
2940
2992
|
IncludeTernaryExpressions: true
|
2941
2993
|
|
2994
|
+
Style/ConstantVisibility:
|
2995
|
+
Description: >-
|
2996
|
+
Check that class- and module constants have
|
2997
|
+
visibility declarations.
|
2998
|
+
Enabled: false
|
2999
|
+
VersionAdded: '0.66'
|
3000
|
+
|
2942
3001
|
# Checks that you have put a copyright in a comment before any code.
|
2943
3002
|
#
|
2944
3003
|
# You can override the default Notice in your .rubocop.yml file.
|
@@ -2957,13 +3016,6 @@ Style/ConditionalAssignment:
|
|
2957
3016
|
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
|
2958
3017
|
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
|
2959
3018
|
#
|
2960
|
-
Style/ConstantVisibility:
|
2961
|
-
Description: >-
|
2962
|
-
Check that class- and module constants have
|
2963
|
-
visibility declarations.
|
2964
|
-
Enabled: false
|
2965
|
-
VersionAdded: '0.66'
|
2966
|
-
|
2967
3019
|
Style/Copyright:
|
2968
3020
|
Description: 'Include a copyright notice in each file before any code.'
|
2969
3021
|
Enabled: false
|
@@ -2976,7 +3028,8 @@ Style/DateTime:
|
|
2976
3028
|
StyleGuide: '#date--time'
|
2977
3029
|
Enabled: false
|
2978
3030
|
VersionAdded: '0.51'
|
2979
|
-
VersionChanged: '0.
|
3031
|
+
VersionChanged: '0.92'
|
3032
|
+
SafeAutoCorrect: false
|
2980
3033
|
AllowCoercion: false
|
2981
3034
|
|
2982
3035
|
Style/DefWithParentheses:
|
@@ -2993,6 +3046,21 @@ Style/Dir:
|
|
2993
3046
|
Enabled: true
|
2994
3047
|
VersionAdded: '0.50'
|
2995
3048
|
|
3049
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
3050
|
+
Description: >-
|
3051
|
+
Forbids disabling/enabling cops within source code.
|
3052
|
+
Enabled: false
|
3053
|
+
VersionAdded: '0.82'
|
3054
|
+
|
3055
|
+
Style/DocumentDynamicEvalDefinition:
|
3056
|
+
Description: >-
|
3057
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
3058
|
+
add a comment block showing its appearance if interpolated.
|
3059
|
+
StyleGuide: '#eval-comment-docs'
|
3060
|
+
Enabled: pending
|
3061
|
+
VersionAdded: '1.1'
|
3062
|
+
VersionChanged: '1.3'
|
3063
|
+
|
2996
3064
|
Style/Documentation:
|
2997
3065
|
Description: 'Document classes and non-namespace modules.'
|
2998
3066
|
Enabled: true
|
@@ -3010,11 +3078,22 @@ Style/DocumentationMethod:
|
|
3010
3078
|
- 'test/**/*'
|
3011
3079
|
RequireForNonPublicMethods: false
|
3012
3080
|
|
3081
|
+
Style/DoubleCopDisableDirective:
|
3082
|
+
Description: 'Checks for double rubocop:disable comments on a single line.'
|
3083
|
+
Enabled: true
|
3084
|
+
VersionAdded: '0.73'
|
3085
|
+
|
3013
3086
|
Style/DoubleNegation:
|
3014
3087
|
Description: 'Checks for uses of double negation (!!).'
|
3015
3088
|
StyleGuide: '#no-bang-bang'
|
3016
3089
|
Enabled: true
|
3017
3090
|
VersionAdded: '0.19'
|
3091
|
+
VersionChanged: '1.2'
|
3092
|
+
EnforcedStyle: allowed_in_returns
|
3093
|
+
SafeAutoCorrect: false
|
3094
|
+
SupportedStyles:
|
3095
|
+
- allowed_in_returns
|
3096
|
+
- forbidden
|
3018
3097
|
|
3019
3098
|
Style/EachForSimpleLoop:
|
3020
3099
|
Description: >-
|
@@ -3087,6 +3166,7 @@ Style/EndBlock:
|
|
3087
3166
|
StyleGuide: '#no-END-blocks'
|
3088
3167
|
Enabled: true
|
3089
3168
|
VersionAdded: '0.9'
|
3169
|
+
VersionChanged: '0.81'
|
3090
3170
|
|
3091
3171
|
Style/EvalWithLocation:
|
3092
3172
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
@@ -3094,7 +3174,7 @@ Style/EvalWithLocation:
|
|
3094
3174
|
VersionAdded: '0.52'
|
3095
3175
|
|
3096
3176
|
Style/EvenOdd:
|
3097
|
-
Description: 'Favor the use of Integer#even
|
3177
|
+
Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
|
3098
3178
|
StyleGuide: '#predicate-methods'
|
3099
3179
|
Enabled: true
|
3100
3180
|
VersionAdded: '0.12'
|
@@ -3105,6 +3185,41 @@ Style/ExpandPathArguments:
|
|
3105
3185
|
Enabled: true
|
3106
3186
|
VersionAdded: '0.53'
|
3107
3187
|
|
3188
|
+
Style/ExplicitBlockArgument:
|
3189
|
+
Description: >-
|
3190
|
+
Consider using explicit block argument to avoid writing block literal
|
3191
|
+
that just passes its arguments to another block.
|
3192
|
+
StyleGuide: '#block-argument'
|
3193
|
+
Enabled: true
|
3194
|
+
# May change the yielding arity.
|
3195
|
+
Safe: false
|
3196
|
+
VersionAdded: '0.89'
|
3197
|
+
|
3198
|
+
Style/ExponentialNotation:
|
3199
|
+
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
3200
|
+
StyleGuide: '#exponential-notation'
|
3201
|
+
Enabled: true
|
3202
|
+
VersionAdded: '0.82'
|
3203
|
+
EnforcedStyle: scientific
|
3204
|
+
SupportedStyles:
|
3205
|
+
- scientific
|
3206
|
+
- engineering
|
3207
|
+
- integral
|
3208
|
+
|
3209
|
+
Style/FloatDivision:
|
3210
|
+
Description: 'For performing float division, coerce one side only.'
|
3211
|
+
StyleGuide: '#float-division'
|
3212
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3213
|
+
Enabled: true
|
3214
|
+
VersionAdded: '0.72'
|
3215
|
+
VersionChanged: '1.6'
|
3216
|
+
EnforcedStyle: single_coerce
|
3217
|
+
SupportedStyles:
|
3218
|
+
- left_coerce
|
3219
|
+
- right_coerce
|
3220
|
+
- single_coerce
|
3221
|
+
- fdiv
|
3222
|
+
|
3108
3223
|
Style/For:
|
3109
3224
|
Description: 'Checks use of for or each in multiline loops.'
|
3110
3225
|
StyleGuide: '#no-for-loops'
|
@@ -3139,8 +3254,12 @@ Style/FormatStringToken:
|
|
3139
3254
|
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
3140
3255
|
- template
|
3141
3256
|
- unannotated
|
3257
|
+
# `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
|
3258
|
+
# style token in a format string to be allowed when enforced style is not
|
3259
|
+
# `unannotated`.
|
3260
|
+
MaxUnannotatedPlaceholdersAllowed: 1
|
3142
3261
|
VersionAdded: '0.49'
|
3143
|
-
VersionChanged: '0
|
3262
|
+
VersionChanged: '1.0'
|
3144
3263
|
|
3145
3264
|
Style/FrozenStringLiteralComment:
|
3146
3265
|
Description: >-
|
@@ -3148,17 +3267,28 @@ Style/FrozenStringLiteralComment:
|
|
3148
3267
|
to help transition to frozen string literals by default.
|
3149
3268
|
Enabled: true
|
3150
3269
|
VersionAdded: '0.36'
|
3151
|
-
VersionChanged: '0.
|
3270
|
+
VersionChanged: '0.79'
|
3152
3271
|
EnforcedStyle: always
|
3153
3272
|
SupportedStyles:
|
3154
3273
|
# `always` will always add the frozen string literal comment to a file
|
3155
3274
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
3156
|
-
# string literal.
|
3157
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
3275
|
+
# string literal. It is possible that this will create errors.
|
3158
3276
|
- always
|
3277
|
+
# `always_true` will add the frozen string literal comment to a file,
|
3278
|
+
# similarly to the `always` style, but will also change any disabled
|
3279
|
+
# comments (e.g. `# frozen_string_literal: false`) to be enabled.
|
3280
|
+
- always_true
|
3159
3281
|
# `never` will enforce that the frozen string literal comment does not
|
3160
3282
|
# exist in a file.
|
3161
3283
|
- never
|
3284
|
+
SafeAutoCorrect: false
|
3285
|
+
|
3286
|
+
Style/GlobalStdStream:
|
3287
|
+
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3288
|
+
StyleGuide: '#global-stdout'
|
3289
|
+
Enabled: true
|
3290
|
+
VersionAdded: '0.89'
|
3291
|
+
SafeAutoCorrect: false
|
3162
3292
|
|
3163
3293
|
Style/GlobalVars:
|
3164
3294
|
Description: 'Do not introduce global variables.'
|
@@ -3170,7 +3300,7 @@ Style/GlobalVars:
|
|
3170
3300
|
AllowedVariables: []
|
3171
3301
|
|
3172
3302
|
Style/GuardClause:
|
3173
|
-
Description: 'Check for conditionals that can be replaced with guard clauses'
|
3303
|
+
Description: 'Check for conditionals that can be replaced with guard clauses.'
|
3174
3304
|
StyleGuide: '#no-nested-conditionals'
|
3175
3305
|
Enabled: true
|
3176
3306
|
VersionAdded: '0.20'
|
@@ -3179,6 +3309,35 @@ Style/GuardClause:
|
|
3179
3309
|
# needs to have to trigger this cop
|
3180
3310
|
MinBodyLength: 1
|
3181
3311
|
|
3312
|
+
Style/HashAsLastArrayItem:
|
3313
|
+
Description: >-
|
3314
|
+
Checks for presence or absence of braces around hash literal as a last
|
3315
|
+
array item depending on configuration.
|
3316
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
3317
|
+
Enabled: true
|
3318
|
+
VersionAdded: '0.88'
|
3319
|
+
EnforcedStyle: braces
|
3320
|
+
SupportedStyles:
|
3321
|
+
- braces
|
3322
|
+
- no_braces
|
3323
|
+
|
3324
|
+
Style/HashEachMethods:
|
3325
|
+
Description: 'Use Hash#each_key and Hash#each_value.'
|
3326
|
+
StyleGuide: '#hash-each'
|
3327
|
+
Enabled: true
|
3328
|
+
VersionAdded: '0.80'
|
3329
|
+
Safe: false
|
3330
|
+
|
3331
|
+
Style/HashLikeCase:
|
3332
|
+
Description: >-
|
3333
|
+
Checks for places where `case-when` represents a simple 1:1
|
3334
|
+
mapping and can be replaced with a hash lookup.
|
3335
|
+
Enabled: true
|
3336
|
+
VersionAdded: '0.88'
|
3337
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3338
|
+
# to trigger this cop
|
3339
|
+
MinBranchesCount: 3
|
3340
|
+
|
3182
3341
|
Style/HashSyntax:
|
3183
3342
|
Description: >-
|
3184
3343
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -3202,6 +3361,20 @@ Style/HashSyntax:
|
|
3202
3361
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
3203
3362
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
3204
3363
|
|
3364
|
+
Style/HashTransformKeys:
|
3365
|
+
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3366
|
+
Enabled: true
|
3367
|
+
VersionAdded: '0.80'
|
3368
|
+
VersionChanged: '0.90'
|
3369
|
+
Safe: false
|
3370
|
+
|
3371
|
+
Style/HashTransformValues:
|
3372
|
+
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3373
|
+
Enabled: true
|
3374
|
+
VersionAdded: '0.80'
|
3375
|
+
VersionChanged: '0.90'
|
3376
|
+
Safe: false
|
3377
|
+
|
3205
3378
|
Style/IdenticalConditionalBranches:
|
3206
3379
|
Description: >-
|
3207
3380
|
Checks that conditional statements do not have an identical
|
@@ -3213,7 +3386,9 @@ Style/IdenticalConditionalBranches:
|
|
3213
3386
|
Style/IfInsideElse:
|
3214
3387
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
3215
3388
|
Enabled: true
|
3389
|
+
AllowIfModifier: false
|
3216
3390
|
VersionAdded: '0.36'
|
3391
|
+
VersionChanged: '1.3'
|
3217
3392
|
|
3218
3393
|
Style/IfUnlessModifier:
|
3219
3394
|
Description: >-
|
@@ -3229,12 +3404,14 @@ Style/IfUnlessModifierOfIfUnless:
|
|
3229
3404
|
Avoid modifier if/unless usage on conditionals.
|
3230
3405
|
Enabled: true
|
3231
3406
|
VersionAdded: '0.39'
|
3407
|
+
VersionChanged: '0.87'
|
3232
3408
|
|
3233
3409
|
Style/IfWithSemicolon:
|
3234
3410
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
3235
3411
|
StyleGuide: '#no-semicolon-ifs'
|
3236
3412
|
Enabled: true
|
3237
3413
|
VersionAdded: '0.9'
|
3414
|
+
VersionChanged: '0.83'
|
3238
3415
|
|
3239
3416
|
Style/ImplicitRuntimeError:
|
3240
3417
|
Description: >-
|
@@ -3244,12 +3421,14 @@ Style/ImplicitRuntimeError:
|
|
3244
3421
|
VersionAdded: '0.41'
|
3245
3422
|
|
3246
3423
|
Style/InfiniteLoop:
|
3247
|
-
Description:
|
3424
|
+
Description: >-
|
3425
|
+
Use Kernel#loop for infinite loops.
|
3426
|
+
This cop is unsafe in the body may raise a `StopIteration` exception.
|
3427
|
+
Safe: false
|
3248
3428
|
StyleGuide: '#infinite-loop'
|
3249
3429
|
Enabled: true
|
3250
3430
|
VersionAdded: '0.26'
|
3251
3431
|
VersionChanged: '0.61'
|
3252
|
-
SafeAutoCorrect: true
|
3253
3432
|
|
3254
3433
|
Style/InlineComment:
|
3255
3434
|
Description: 'Avoid trailing inline comments.'
|
@@ -3287,10 +3466,22 @@ Style/IpAddresses:
|
|
3287
3466
|
Description: "Don't include literal IP addresses in code."
|
3288
3467
|
Enabled: false
|
3289
3468
|
VersionAdded: '0.58'
|
3290
|
-
|
3291
|
-
|
3469
|
+
VersionChanged: '0.91'
|
3470
|
+
# Allow addresses to be permitted
|
3471
|
+
AllowedAddresses:
|
3292
3472
|
- "::"
|
3293
3473
|
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
3474
|
+
Exclude:
|
3475
|
+
- '**/*.gemfile'
|
3476
|
+
- '**/Gemfile'
|
3477
|
+
- '**/gems.rb'
|
3478
|
+
- '**/*.gemspec'
|
3479
|
+
|
3480
|
+
Style/KeywordParametersOrder:
|
3481
|
+
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3482
|
+
StyleGuide: '#keyword-parameters-order'
|
3483
|
+
Enabled: true
|
3484
|
+
VersionAdded: '0.90'
|
3294
3485
|
|
3295
3486
|
Style/Lambda:
|
3296
3487
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -3308,7 +3499,7 @@ Style/LambdaCall:
|
|
3308
3499
|
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
3309
3500
|
StyleGuide: '#proc-call'
|
3310
3501
|
Enabled: true
|
3311
|
-
VersionAdded: '0.13
|
3502
|
+
VersionAdded: '0.13'
|
3312
3503
|
VersionChanged: '0.14'
|
3313
3504
|
EnforcedStyle: call
|
3314
3505
|
SupportedStyles:
|
@@ -3332,6 +3523,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3332
3523
|
VersionChanged: '0.61'
|
3333
3524
|
IgnoreMacros: true
|
3334
3525
|
IgnoredMethods: []
|
3526
|
+
IgnoredPatterns: []
|
3335
3527
|
IncludedMacros: []
|
3336
3528
|
AllowParenthesesInMultilineCall: false
|
3337
3529
|
AllowParenthesesInChaining: false
|
@@ -3369,16 +3561,10 @@ Style/MethodDefParentheses:
|
|
3369
3561
|
- require_no_parentheses
|
3370
3562
|
- require_no_parentheses_except_multiline
|
3371
3563
|
|
3372
|
-
Style/MethodMissingSuper:
|
3373
|
-
Description: Checks for `method_missing` to call `super`.
|
3374
|
-
StyleGuide: '#no-method-missing'
|
3375
|
-
Enabled: true
|
3376
|
-
VersionAdded: '0.56'
|
3377
|
-
|
3378
3564
|
Style/MinMax:
|
3379
3565
|
Description: >-
|
3380
3566
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
3381
|
-
and `Enumerable#max` in conjunction.
|
3567
|
+
and `Enumerable#max` in conjunction.
|
3382
3568
|
Enabled: true
|
3383
3569
|
VersionAdded: '0.50'
|
3384
3570
|
|
@@ -3388,7 +3574,7 @@ Style/MissingElse:
|
|
3388
3574
|
If enabled, it is recommended that
|
3389
3575
|
Style/UnlessElse and Style/EmptyElse be enabled.
|
3390
3576
|
This will conflict with Style/EmptyElse if
|
3391
|
-
Style/EmptyElse is configured to style "both"
|
3577
|
+
Style/EmptyElse is configured to style "both".
|
3392
3578
|
Enabled: false
|
3393
3579
|
VersionAdded: '0.30'
|
3394
3580
|
VersionChanged: '0.38'
|
@@ -3437,6 +3623,7 @@ Style/ModuleFunction:
|
|
3437
3623
|
SupportedStyles:
|
3438
3624
|
- module_function
|
3439
3625
|
- extend_self
|
3626
|
+
- forbidden
|
3440
3627
|
Autocorrect: false
|
3441
3628
|
SafeAutoCorrect: false
|
3442
3629
|
|
@@ -3481,6 +3668,13 @@ Style/MultilineTernaryOperator:
|
|
3481
3668
|
StyleGuide: '#no-multiline-ternary'
|
3482
3669
|
Enabled: true
|
3483
3670
|
VersionAdded: '0.9'
|
3671
|
+
VersionChanged: '0.86'
|
3672
|
+
|
3673
|
+
Style/MultilineWhenThen:
|
3674
|
+
Description: 'Do not use then for multi-line when statement.'
|
3675
|
+
StyleGuide: '#no-then'
|
3676
|
+
Enabled: true
|
3677
|
+
VersionAdded: '0.73'
|
3484
3678
|
|
3485
3679
|
Style/MultipleComparison:
|
3486
3680
|
Description: >-
|
@@ -3488,6 +3682,7 @@ Style/MultipleComparison:
|
|
3488
3682
|
use Array#include? instead.
|
3489
3683
|
Enabled: true
|
3490
3684
|
VersionAdded: '0.49'
|
3685
|
+
VersionChanged: '1.1'
|
3491
3686
|
|
3492
3687
|
Style/MutableConstant:
|
3493
3688
|
Description: 'Do not assign mutable objects to constants.'
|
@@ -3522,6 +3717,13 @@ Style/NegatedIf:
|
|
3522
3717
|
- prefix
|
3523
3718
|
- postfix
|
3524
3719
|
|
3720
|
+
Style/NegatedIfElseCondition:
|
3721
|
+
Description: >-
|
3722
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
3723
|
+
which can be simplified by inverting condition and swapping branches.
|
3724
|
+
Enabled: pending
|
3725
|
+
VersionAdded: '1.2'
|
3726
|
+
|
3525
3727
|
Style/NegatedUnless:
|
3526
3728
|
Description: 'Favor if over unless for negative conditions.'
|
3527
3729
|
StyleGuide: '#if-for-negatives'
|
@@ -3554,8 +3756,8 @@ Style/NestedParenthesizedCalls:
|
|
3554
3756
|
argument list of another parenthesized method call.
|
3555
3757
|
Enabled: true
|
3556
3758
|
VersionAdded: '0.36'
|
3557
|
-
VersionChanged: '0.
|
3558
|
-
|
3759
|
+
VersionChanged: '0.77'
|
3760
|
+
AllowedMethods:
|
3559
3761
|
- be
|
3560
3762
|
- be_a
|
3561
3763
|
- be_an
|
@@ -3579,6 +3781,7 @@ Style/NestedTernaryOperator:
|
|
3579
3781
|
StyleGuide: '#no-nested-ternary'
|
3580
3782
|
Enabled: true
|
3581
3783
|
VersionAdded: '0.9'
|
3784
|
+
VersionChanged: '0.86'
|
3582
3785
|
|
3583
3786
|
Style/Next:
|
3584
3787
|
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
@@ -3608,6 +3811,11 @@ Style/NilComparison:
|
|
3608
3811
|
- predicate
|
3609
3812
|
- comparison
|
3610
3813
|
|
3814
|
+
Style/NilLambda:
|
3815
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3816
|
+
Enabled: pending
|
3817
|
+
VersionAdded: '1.3'
|
3818
|
+
|
3611
3819
|
Style/NonNilCheck:
|
3612
3820
|
Description: 'Checks for redundant nil checks.'
|
3613
3821
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3661,7 +3869,6 @@ Style/NumericPredicate:
|
|
3661
3869
|
# object. Switching these methods has to be done with knowledge of the types
|
3662
3870
|
# of the variables which rubocop doesn't have.
|
3663
3871
|
SafeAutoCorrect: false
|
3664
|
-
AutoCorrect: false
|
3665
3872
|
Enabled: true
|
3666
3873
|
VersionAdded: '0.42'
|
3667
3874
|
VersionChanged: '0.59'
|
@@ -3677,12 +3884,13 @@ Style/NumericPredicate:
|
|
3677
3884
|
|
3678
3885
|
Style/OneLineConditional:
|
3679
3886
|
Description: >-
|
3680
|
-
Favor the ternary operator(?:) over
|
3681
|
-
if/then/else/end constructs.
|
3887
|
+
Favor the ternary operator (?:) or multi-line constructs over
|
3888
|
+
single-line if/then/else/end constructs.
|
3682
3889
|
StyleGuide: '#ternary-operator'
|
3683
3890
|
Enabled: true
|
3891
|
+
AlwaysCorrectToMultiline: false
|
3684
3892
|
VersionAdded: '0.9'
|
3685
|
-
VersionChanged: '0.
|
3893
|
+
VersionChanged: '0.90'
|
3686
3894
|
|
3687
3895
|
Style/OptionHash:
|
3688
3896
|
Description: "Don't use option hashes when you can use keyword arguments."
|
@@ -3700,10 +3908,21 @@ Style/OptionHash:
|
|
3700
3908
|
Style/OptionalArguments:
|
3701
3909
|
Description: >-
|
3702
3910
|
Checks for optional arguments that do not appear at the end
|
3703
|
-
of the argument list
|
3911
|
+
of the argument list.
|
3704
3912
|
StyleGuide: '#optional-arguments'
|
3705
3913
|
Enabled: true
|
3914
|
+
Safe: false
|
3706
3915
|
VersionAdded: '0.33'
|
3916
|
+
VersionChanged: '0.83'
|
3917
|
+
|
3918
|
+
Style/OptionalBooleanParameter:
|
3919
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
3920
|
+
StyleGuide: '#boolean-keyword-arguments'
|
3921
|
+
Enabled: true
|
3922
|
+
Safe: false
|
3923
|
+
VersionAdded: '0.89'
|
3924
|
+
AllowedMethods:
|
3925
|
+
- respond_to_missing?
|
3707
3926
|
|
3708
3927
|
Style/OrAssignment:
|
3709
3928
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
@@ -3732,7 +3951,7 @@ Style/ParenthesesAroundCondition:
|
|
3732
3951
|
AllowInMultilineConditions: false
|
3733
3952
|
|
3734
3953
|
Style/PercentLiteralDelimiters:
|
3735
|
-
Description: 'Use `%`-literal delimiters consistently'
|
3954
|
+
Description: 'Use `%`-literal delimiters consistently.'
|
3736
3955
|
StyleGuide: '#percent-literal-braces'
|
3737
3956
|
Enabled: true
|
3738
3957
|
VersionAdded: '0.19'
|
@@ -3746,7 +3965,7 @@ Style/PercentLiteralDelimiters:
|
|
3746
3965
|
'%r': '{}'
|
3747
3966
|
'%w': '[]'
|
3748
3967
|
'%W': '[]'
|
3749
|
-
VersionChanged: '0.48
|
3968
|
+
VersionChanged: '0.48'
|
3750
3969
|
|
3751
3970
|
Style/PercentQLiterals:
|
3752
3971
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
@@ -3787,11 +4006,12 @@ Style/RaiseArgs:
|
|
3787
4006
|
StyleGuide: '#exception-class-messages'
|
3788
4007
|
Enabled: true
|
3789
4008
|
VersionAdded: '0.14'
|
3790
|
-
VersionChanged: '
|
4009
|
+
VersionChanged: '1.2'
|
3791
4010
|
EnforcedStyle: exploded
|
3792
4011
|
SupportedStyles:
|
3793
4012
|
- compact # raise Exception.new(msg)
|
3794
4013
|
- exploded # raise Exception, msg
|
4014
|
+
AllowedCompactTypes: []
|
3795
4015
|
|
3796
4016
|
Style/RandomWithOffset:
|
3797
4017
|
Description: >-
|
@@ -3801,6 +4021,23 @@ Style/RandomWithOffset:
|
|
3801
4021
|
Enabled: true
|
3802
4022
|
VersionAdded: '0.52'
|
3803
4023
|
|
4024
|
+
Style/RedundantArgument:
|
4025
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
4026
|
+
Enabled: pending
|
4027
|
+
Safe: false
|
4028
|
+
VersionAdded: '1.4'
|
4029
|
+
VersionChanged: '1.6'
|
4030
|
+
Methods:
|
4031
|
+
# Array#join
|
4032
|
+
join: ''
|
4033
|
+
# String#split
|
4034
|
+
split: ' '
|
4035
|
+
|
4036
|
+
Style/RedundantAssignment:
|
4037
|
+
Description: 'Checks for redundant assignment before returning.'
|
4038
|
+
Enabled: true
|
4039
|
+
VersionAdded: '0.87'
|
4040
|
+
|
3804
4041
|
Style/RedundantBegin:
|
3805
4042
|
Description: "Don't use begin blocks when they are not needed."
|
3806
4043
|
StyleGuide: '#begin-implicit'
|
@@ -3808,6 +4045,16 @@ Style/RedundantBegin:
|
|
3808
4045
|
VersionAdded: '0.10'
|
3809
4046
|
VersionChanged: '0.21'
|
3810
4047
|
|
4048
|
+
Style/RedundantCapitalW:
|
4049
|
+
Description: 'Checks for %W when interpolation is not needed.'
|
4050
|
+
Enabled: true
|
4051
|
+
VersionAdded: '0.76'
|
4052
|
+
|
4053
|
+
Style/RedundantCondition:
|
4054
|
+
Description: 'Checks for unnecessary conditional expressions.'
|
4055
|
+
Enabled: true
|
4056
|
+
VersionAdded: '0.76'
|
4057
|
+
|
3811
4058
|
Style/RedundantConditional:
|
3812
4059
|
Description: "Don't return true/false from a conditional."
|
3813
4060
|
Enabled: true
|
@@ -3820,17 +4067,59 @@ Style/RedundantException:
|
|
3820
4067
|
VersionAdded: '0.14'
|
3821
4068
|
VersionChanged: '0.29'
|
3822
4069
|
|
4070
|
+
Style/RedundantFetchBlock:
|
4071
|
+
Description: >-
|
4072
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
4073
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
4074
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
4075
|
+
Enabled: true
|
4076
|
+
Safe: false
|
4077
|
+
# If enabled, this cop will autocorrect usages of
|
4078
|
+
# `fetch` being called with block returning a constant.
|
4079
|
+
# This can be dangerous since constants will not be defined at that moment.
|
4080
|
+
SafeForConstants: false
|
4081
|
+
VersionAdded: '0.86'
|
4082
|
+
|
4083
|
+
Style/RedundantFileExtensionInRequire:
|
4084
|
+
Description: >-
|
4085
|
+
Checks for the presence of superfluous `.rb` extension in
|
4086
|
+
the filename provided to `require` and `require_relative`.
|
4087
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
4088
|
+
Enabled: true
|
4089
|
+
VersionAdded: '0.88'
|
4090
|
+
|
3823
4091
|
Style/RedundantFreeze:
|
3824
4092
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3825
4093
|
Enabled: true
|
3826
4094
|
VersionAdded: '0.34'
|
3827
4095
|
VersionChanged: '0.66'
|
3828
4096
|
|
4097
|
+
Style/RedundantInterpolation:
|
4098
|
+
Description: 'Checks for strings that are just an interpolated expression.'
|
4099
|
+
Enabled: true
|
4100
|
+
VersionAdded: '0.76'
|
4101
|
+
|
3829
4102
|
Style/RedundantParentheses:
|
3830
4103
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
3831
4104
|
Enabled: true
|
3832
4105
|
VersionAdded: '0.36'
|
3833
4106
|
|
4107
|
+
Style/RedundantPercentQ:
|
4108
|
+
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
4109
|
+
StyleGuide: '#percent-q'
|
4110
|
+
Enabled: true
|
4111
|
+
VersionAdded: '0.76'
|
4112
|
+
|
4113
|
+
Style/RedundantRegexpCharacterClass:
|
4114
|
+
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
4115
|
+
Enabled: true
|
4116
|
+
VersionAdded: '0.85'
|
4117
|
+
|
4118
|
+
Style/RedundantRegexpEscape:
|
4119
|
+
Description: 'Checks for redundant escapes in Regexps.'
|
4120
|
+
Enabled: true
|
4121
|
+
VersionAdded: '0.85'
|
4122
|
+
|
3834
4123
|
Style/RedundantReturn:
|
3835
4124
|
Description: "Don't use return where it's not required."
|
3836
4125
|
StyleGuide: '#no-explicit-return'
|
@@ -3847,6 +4136,19 @@ Style/RedundantSelf:
|
|
3847
4136
|
VersionAdded: '0.10'
|
3848
4137
|
VersionChanged: '0.13'
|
3849
4138
|
|
4139
|
+
Style/RedundantSelfAssignment:
|
4140
|
+
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
4141
|
+
Enabled: true
|
4142
|
+
Safe: false
|
4143
|
+
VersionAdded: '0.90'
|
4144
|
+
|
4145
|
+
Style/RedundantSort:
|
4146
|
+
Description: >-
|
4147
|
+
Use `min` instead of `sort.first`,
|
4148
|
+
`max_by` instead of `sort_by...last`, etc.
|
4149
|
+
Enabled: true
|
4150
|
+
VersionAdded: '0.76'
|
4151
|
+
|
3850
4152
|
Style/RedundantSortBy:
|
3851
4153
|
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
3852
4154
|
Enabled: true
|
@@ -3902,18 +4204,21 @@ Style/SafeNavigation:
|
|
3902
4204
|
This cop transforms usages of a method call safeguarded by
|
3903
4205
|
a check for the existence of the object to
|
3904
4206
|
safe navigation (`&.`).
|
4207
|
+
Auto-correction is unsafe as it assumes the object will
|
4208
|
+
be `nil` or truthy, but never `false`.
|
3905
4209
|
Enabled: true
|
3906
4210
|
VersionAdded: '0.43'
|
3907
|
-
VersionChanged: '0.
|
4211
|
+
VersionChanged: '0.77'
|
3908
4212
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
3909
4213
|
# to whatever it used to return.
|
3910
4214
|
ConvertCodeThatCanStartToReturnNil: false
|
3911
|
-
|
4215
|
+
AllowedMethods:
|
3912
4216
|
- present?
|
3913
4217
|
- blank?
|
3914
4218
|
- presence
|
3915
4219
|
- try
|
3916
4220
|
- try!
|
4221
|
+
SafeAutoCorrect: false
|
3917
4222
|
|
3918
4223
|
Style/Sample:
|
3919
4224
|
Description: >-
|
@@ -3959,11 +4264,17 @@ Style/SignalException:
|
|
3959
4264
|
- only_fail
|
3960
4265
|
- semantic
|
3961
4266
|
|
4267
|
+
Style/SingleArgumentDig:
|
4268
|
+
Description: 'Avoid using single argument dig method.'
|
4269
|
+
Enabled: true
|
4270
|
+
VersionAdded: '0.89'
|
4271
|
+
Safe: false
|
4272
|
+
|
3962
4273
|
Style/SingleLineBlockParams:
|
3963
4274
|
Description: 'Enforces the names of some block params.'
|
3964
4275
|
Enabled: false
|
3965
4276
|
VersionAdded: '0.16'
|
3966
|
-
VersionChanged: '
|
4277
|
+
VersionChanged: '1.6'
|
3967
4278
|
Methods:
|
3968
4279
|
- reduce:
|
3969
4280
|
- acc
|
@@ -3980,6 +4291,21 @@ Style/SingleLineMethods:
|
|
3980
4291
|
VersionChanged: '0.19'
|
3981
4292
|
AllowIfMethodIsEmpty: true
|
3982
4293
|
|
4294
|
+
Style/SlicingWithRange:
|
4295
|
+
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
4296
|
+
Enabled: true
|
4297
|
+
VersionAdded: '0.83'
|
4298
|
+
Safe: false
|
4299
|
+
|
4300
|
+
Style/SoleNestedConditional:
|
4301
|
+
Description: >-
|
4302
|
+
Finds sole nested conditional nodes
|
4303
|
+
which can be merged into outer conditional node.
|
4304
|
+
Enabled: true
|
4305
|
+
VersionAdded: '0.89'
|
4306
|
+
VersionChanged: '1.5'
|
4307
|
+
AllowModifier: false
|
4308
|
+
|
3983
4309
|
Style/SpecialGlobalVars:
|
3984
4310
|
Description: 'Avoid Perl-style global variables.'
|
3985
4311
|
StyleGuide: '#no-cryptic-perlisms'
|
@@ -4002,17 +4328,34 @@ Style/StabbyLambdaParentheses:
|
|
4002
4328
|
- require_parentheses
|
4003
4329
|
- require_no_parentheses
|
4004
4330
|
|
4331
|
+
Style/StaticClass:
|
4332
|
+
Description: 'Prefer modules to classes with only class methods.'
|
4333
|
+
StyleGuide: '#modules-vs-classes'
|
4334
|
+
Enabled: false
|
4335
|
+
Safe: false
|
4336
|
+
VersionAdded: '1.3'
|
4337
|
+
|
4005
4338
|
Style/StderrPuts:
|
4006
4339
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
4007
4340
|
StyleGuide: '#warn'
|
4008
4341
|
Enabled: true
|
4009
4342
|
VersionAdded: '0.51'
|
4010
4343
|
|
4344
|
+
Style/StringConcatenation:
|
4345
|
+
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4346
|
+
StyleGuide: '#string-interpolation'
|
4347
|
+
Enabled: true
|
4348
|
+
Safe: false
|
4349
|
+
VersionAdded: '0.89'
|
4350
|
+
VersionChanged: '1.6'
|
4351
|
+
|
4011
4352
|
Style/StringHashKeys:
|
4012
4353
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
4013
4354
|
StyleGuide: '#symbols-as-keys'
|
4014
4355
|
Enabled: false
|
4015
4356
|
VersionAdded: '0.52'
|
4357
|
+
VersionChanged: '0.75'
|
4358
|
+
Safe: false
|
4016
4359
|
|
4017
4360
|
Style/StringLiterals:
|
4018
4361
|
Description: 'Checks if uses of quotes match the configured preference.'
|
@@ -4043,7 +4386,7 @@ Style/StringMethods:
|
|
4043
4386
|
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
4044
4387
|
Enabled: false
|
4045
4388
|
VersionAdded: '0.34'
|
4046
|
-
VersionChanged: '0.34
|
4389
|
+
VersionChanged: '0.34'
|
4047
4390
|
# Mapping from undesired method to desired_method
|
4048
4391
|
# e.g. to use `to_sym` over `intern`:
|
4049
4392
|
#
|
@@ -4063,6 +4406,14 @@ Style/StructInheritance:
|
|
4063
4406
|
StyleGuide: '#no-extend-struct-new'
|
4064
4407
|
Enabled: true
|
4065
4408
|
VersionAdded: '0.29'
|
4409
|
+
VersionChanged: '0.86'
|
4410
|
+
|
4411
|
+
Style/SwapValues:
|
4412
|
+
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
4413
|
+
StyleGuide: '#values-swapping'
|
4414
|
+
Enabled: pending
|
4415
|
+
VersionAdded: '1.1'
|
4416
|
+
SafeAutoCorrect: false
|
4066
4417
|
|
4067
4418
|
Style/SymbolArray:
|
4068
4419
|
Description: 'Use %i or %I for arrays of symbols.'
|
@@ -4084,9 +4435,9 @@ Style/SymbolLiteral:
|
|
4084
4435
|
Style/SymbolProc:
|
4085
4436
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
4086
4437
|
Enabled: true
|
4087
|
-
|
4438
|
+
Safe: false
|
4088
4439
|
VersionAdded: '0.26'
|
4089
|
-
VersionChanged: '
|
4440
|
+
VersionChanged: '1.5'
|
4090
4441
|
# A list of method names to be ignored by the check.
|
4091
4442
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4092
4443
|
IgnoredMethods:
|
@@ -4140,22 +4491,29 @@ Style/TrailingCommaInArrayLiteral:
|
|
4140
4491
|
StyleGuide: '#no-trailing-array-commas'
|
4141
4492
|
Enabled: true
|
4142
4493
|
VersionAdded: '0.53'
|
4494
|
+
# If `comma`, the cop requires a comma after the last item in an array,
|
4143
4495
|
# but only when each item is on its own line.
|
4144
4496
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
4145
|
-
# non-empty array literals.
|
4497
|
+
# non-empty, multiline array literals.
|
4146
4498
|
EnforcedStyleForMultiline: no_comma
|
4147
4499
|
SupportedStylesForMultiline:
|
4148
4500
|
- comma
|
4149
4501
|
- consistent_comma
|
4150
4502
|
- no_comma
|
4151
4503
|
|
4504
|
+
Style/TrailingCommaInBlockArgs:
|
4505
|
+
Description: 'Checks for useless trailing commas in block arguments.'
|
4506
|
+
Enabled: false
|
4507
|
+
Safe: false
|
4508
|
+
VersionAdded: '0.81'
|
4509
|
+
|
4152
4510
|
Style/TrailingCommaInHashLiteral:
|
4153
4511
|
Description: 'Checks for trailing comma in hash literals.'
|
4154
4512
|
Enabled: true
|
4155
4513
|
# If `comma`, the cop requires a comma after the last item in a hash,
|
4156
4514
|
# but only when each item is on its own line.
|
4157
4515
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
4158
|
-
# non-empty hash literals.
|
4516
|
+
# non-empty, multiline hash literals.
|
4159
4517
|
EnforcedStyleForMultiline: no_comma
|
4160
4518
|
SupportedStylesForMultiline:
|
4161
4519
|
- comma
|
@@ -4184,7 +4542,7 @@ Style/TrivialAccessors:
|
|
4184
4542
|
StyleGuide: '#attr_family'
|
4185
4543
|
Enabled: true
|
4186
4544
|
VersionAdded: '0.9'
|
4187
|
-
VersionChanged: '0.
|
4545
|
+
VersionChanged: '0.77'
|
4188
4546
|
# When set to `false` the cop will suggest the use of accessor methods
|
4189
4547
|
# in situations like:
|
4190
4548
|
#
|
@@ -4205,7 +4563,7 @@ Style/TrivialAccessors:
|
|
4205
4563
|
# Commonly used in DSLs
|
4206
4564
|
AllowDSLWriters: false
|
4207
4565
|
IgnoreClassMethods: false
|
4208
|
-
|
4566
|
+
AllowedMethods:
|
4209
4567
|
- to_ary
|
4210
4568
|
- to_a
|
4211
4569
|
- to_c
|
@@ -4232,39 +4590,10 @@ Style/UnlessElse:
|
|
4232
4590
|
Enabled: true
|
4233
4591
|
VersionAdded: '0.9'
|
4234
4592
|
|
4235
|
-
Style/UnneededCapitalW:
|
4236
|
-
Description: 'Checks for %W when interpolation is not needed.'
|
4237
|
-
Enabled: true
|
4238
|
-
VersionAdded: '0.21'
|
4239
|
-
VersionChanged: '0.24'
|
4240
|
-
|
4241
|
-
Style/UnneededCondition:
|
4242
|
-
Description: 'Checks for unnecessary conditional expressions.'
|
4243
|
-
Enabled: true
|
4244
|
-
VersionAdded: '0.57'
|
4245
|
-
|
4246
|
-
Style/UnneededInterpolation:
|
4247
|
-
Description: 'Checks for strings that are just an interpolated expression.'
|
4248
|
-
Enabled: true
|
4249
|
-
VersionAdded: '0.36'
|
4250
|
-
|
4251
|
-
Style/UnneededPercentQ:
|
4252
|
-
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
4253
|
-
StyleGuide: '#percent-q'
|
4254
|
-
Enabled: true
|
4255
|
-
VersionAdded: '0.24'
|
4256
|
-
|
4257
|
-
Style/UnneededSort:
|
4258
|
-
Description: >-
|
4259
|
-
Use `min` instead of `sort.first`,
|
4260
|
-
`max_by` instead of `sort_by...last`, etc.
|
4261
|
-
Enabled: true
|
4262
|
-
VersionAdded: '0.55'
|
4263
|
-
|
4264
4593
|
Style/UnpackFirst:
|
4265
4594
|
Description: >-
|
4266
4595
|
Checks for accessing the first element of `String#unpack`
|
4267
|
-
instead of using `unpack1
|
4596
|
+
instead of using `unpack1`.
|
4268
4597
|
Enabled: true
|
4269
4598
|
VersionAdded: '0.54'
|
4270
4599
|
|
@@ -4315,7 +4644,7 @@ Style/WordArray:
|
|
4315
4644
|
# whose element count is greater than or equal to `MinSize`.
|
4316
4645
|
MinSize: 2
|
4317
4646
|
# The regular expression `WordRegex` decides what is considered a word.
|
4318
|
-
WordRegex: !ruby/regexp '/\A
|
4647
|
+
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
4319
4648
|
|
4320
4649
|
Style/YodaCondition:
|
4321
4650
|
Description: 'Forbid or enforce yoda conditions.'
|
@@ -4331,8 +4660,9 @@ Style/YodaCondition:
|
|
4331
4660
|
- require_for_all_comparison_operators
|
4332
4661
|
# enforce yoda only for equality operators: `!=` and `==`
|
4333
4662
|
- require_for_equality_operators_only
|
4663
|
+
Safe: false
|
4334
4664
|
VersionAdded: '0.49'
|
4335
|
-
VersionChanged: '0.
|
4665
|
+
VersionChanged: '0.75'
|
4336
4666
|
|
4337
4667
|
Style/ZeroLengthPredicate:
|
4338
4668
|
Description: 'Use #empty? when testing for objects of length 0.'
|