rubocop 1.44.1 → 1.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +95 -88
- data/assets/output.css.erb +159 -0
- data/assets/output.html.erb +1 -160
- data/config/default.yml +660 -117
- data/config/internal_affairs.yml +31 -0
- data/config/obsoletion.yml +13 -3
- data/exe/rubocop +4 -3
- data/lib/rubocop/cached_data.rb +21 -5
- data/lib/rubocop/cli/command/auto_generate_config.rb +33 -13
- data/lib/rubocop/cli/command/execute_runner.rb +11 -6
- data/lib/rubocop/cli/command/lsp.rb +19 -0
- data/lib/rubocop/cli/command/show_cops.rb +24 -2
- data/lib/rubocop/cli/command/show_docs_url.rb +2 -2
- data/lib/rubocop/cli/command/suggest_extensions.rb +7 -1
- data/lib/rubocop/cli/command/version.rb +2 -2
- data/lib/rubocop/cli.rb +80 -11
- data/lib/rubocop/comment_config.rb +21 -2
- data/lib/rubocop/config.rb +99 -25
- data/lib/rubocop/config_finder.rb +14 -4
- data/lib/rubocop/config_loader.rb +68 -57
- data/lib/rubocop/config_loader_resolver.rb +48 -17
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -3
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +9 -1
- data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
- data/lib/rubocop/config_obsoletion.rb +58 -11
- data/lib/rubocop/config_validator.rb +39 -20
- data/lib/rubocop/cop/autocorrect_logic.rb +69 -21
- data/lib/rubocop/cop/base.rb +112 -29
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +3 -2
- data/lib/rubocop/cop/bundler/duplicated_group.rb +127 -0
- data/lib/rubocop/cop/bundler/gem_comment.rb +4 -4
- data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
- data/lib/rubocop/cop/bundler/gem_version.rb +6 -7
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
- data/lib/rubocop/cop/bundler/ordered_gems.rb +10 -2
- data/lib/rubocop/cop/commissioner.rb +8 -2
- data/lib/rubocop/cop/cop.rb +55 -9
- data/lib/rubocop/cop/corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +4 -15
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +4 -8
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +7 -15
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +7 -4
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +3 -1
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +7 -4
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +12 -2
- data/lib/rubocop/cop/documentation.rb +32 -5
- data/lib/rubocop/cop/exclude_limit.rb +1 -1
- data/lib/rubocop/cop/force.rb +12 -0
- data/lib/rubocop/cop/gemspec/add_runtime_dependency.rb +38 -0
- data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
- data/lib/rubocop/cop/gemspec/dependency_version.rb +6 -8
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +4 -5
- data/lib/rubocop/cop/gemspec/development_dependencies.rb +1 -1
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +39 -17
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +10 -2
- data/lib/rubocop/cop/gemspec/require_mfa.rb +15 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -3
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +3 -3
- data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
- data/lib/rubocop/cop/generator.rb +6 -0
- data/lib/rubocop/cop/internal_affairs/cop_description.rb +37 -17
- data/lib/rubocop/cop/internal_affairs/cop_enabled.rb +85 -0
- data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +2 -1
- data/lib/rubocop/cop/internal_affairs/example_description.rb +51 -25
- data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +3 -3
- data/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/location_exists.rb +116 -0
- data/lib/rubocop/cop/internal_affairs/location_expression.rb +38 -0
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +6 -5
- data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +8 -6
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
- data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +54 -0
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +129 -35
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +63 -0
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +131 -0
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +231 -0
- data/lib/rubocop/cop/internal_affairs/node_type_group.rb +91 -0
- data/lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb +126 -0
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +4 -3
- data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +90 -0
- data/lib/rubocop/cop/internal_affairs/operator_keyword.rb +48 -0
- data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
- data/lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb +42 -0
- data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +6 -5
- data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +7 -22
- data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +11 -2
- data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +75 -0
- data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +5 -4
- data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +0 -2
- data/lib/rubocop/cop/internal_affairs/undefined_config.rb +23 -2
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -5
- data/lib/rubocop/cop/internal_affairs.rb +12 -0
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +6 -2
- data/lib/rubocop/cop/layout/argument_alignment.rb +3 -10
- data/lib/rubocop/cop/layout/array_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/assignment_indentation.rb +3 -2
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +0 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +32 -13
- data/lib/rubocop/cop/layout/block_end_newline.rb +8 -21
- data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/class_structure.rb +59 -28
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +2 -3
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +5 -5
- data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/condition_position.rb +0 -4
- data/lib/rubocop/cop/layout/def_end_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/dot_position.rb +2 -6
- data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_comment.rb +6 -4
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +46 -13
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
- data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +34 -14
- data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +39 -7
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +5 -6
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -0
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +14 -8
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +23 -1
- data/lib/rubocop/cop/layout/end_alignment.rb +23 -3
- data/lib/rubocop/cop/layout/extra_spacing.rb +4 -5
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +14 -14
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +19 -10
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +25 -34
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -7
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +8 -20
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +50 -52
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +38 -55
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/hash_alignment.rb +8 -6
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +13 -6
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +7 -4
- data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +16 -16
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/leading_comment_space.rb +85 -3
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +29 -14
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +19 -9
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +4 -2
- data/lib/rubocop/cop/layout/line_length.rb +168 -28
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +8 -27
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -0
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +8 -27
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +20 -12
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +21 -6
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +7 -30
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +3 -4
- data/lib/rubocop/cop/layout/parameter_alignment.rb +3 -4
- data/lib/rubocop/cop/layout/redundant_line_break.rb +43 -48
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +9 -10
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +6 -1
- data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
- data/lib/rubocop/cop/layout/space_after_comma.rb +10 -2
- data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +11 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +3 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +3 -3
- data/lib/rubocop/cop/layout/space_around_operators.rb +75 -38
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +20 -10
- data/lib/rubocop/cop/layout/space_before_brackets.rb +7 -40
- data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +28 -13
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +8 -1
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +8 -1
- data/lib/rubocop/cop/layout/space_inside_parens.rb +3 -3
- data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +4 -4
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +6 -7
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +5 -0
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +6 -4
- data/lib/rubocop/cop/legacy/corrector.rb +12 -2
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +14 -4
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +0 -2
- data/lib/rubocop/cop/lint/ambiguous_range.rb +9 -1
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +0 -2
- data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +118 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +7 -9
- data/lib/rubocop/cop/lint/big_decimal_new.rb +4 -7
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +11 -13
- data/lib/rubocop/cop/lint/boolean_symbol.rb +2 -4
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +4 -14
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
- data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +1 -1
- data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
- data/lib/rubocop/cop/lint/constant_resolution.rb +1 -1
- data/lib/rubocop/cop/lint/cop_directive_syntax.rb +84 -0
- data/lib/rubocop/cop/lint/debugger.rb +49 -30
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +6 -6
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +4 -13
- data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -5
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -5
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +122 -0
- data/lib/rubocop/cop/lint/duplicate_methods.rb +112 -34
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +48 -23
- data/lib/rubocop/cop/lint/duplicate_set_element.rb +87 -0
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +0 -4
- data/lib/rubocop/cop/lint/else_layout.rb +1 -3
- data/lib/rubocop/cop/lint/empty_block.rb +2 -2
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +31 -58
- data/lib/rubocop/cop/lint/empty_ensure.rb +2 -12
- data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
- data/lib/rubocop/cop/lint/empty_file.rb +0 -2
- data/lib/rubocop/cop/lint/empty_interpolation.rb +4 -6
- data/lib/rubocop/cop/lint/empty_when.rb +1 -3
- data/lib/rubocop/cop/lint/ensure_return.rb +2 -10
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +27 -27
- data/lib/rubocop/cop/lint/float_comparison.rb +58 -15
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -8
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +5 -12
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
- data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
- data/lib/rubocop/cop/lint/identity_comparison.rb +19 -16
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +24 -13
- data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -3
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -8
- data/lib/rubocop/cop/lint/inherit_exception.rb +9 -0
- data/lib/rubocop/cop/lint/interpolation_check.rb +9 -4
- data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +50 -0
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
- data/lib/rubocop/cop/lint/literal_as_condition.rb +114 -11
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +85 -0
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +96 -17
- data/lib/rubocop/cop/lint/loop.rb +6 -12
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/missing_super.rb +63 -5
- data/lib/rubocop/cop/lint/mixed_case_range.rb +113 -0
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +11 -18
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +6 -25
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +2 -7
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +22 -10
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +6 -8
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -3
- data/lib/rubocop/cop/lint/number_conversion.rb +13 -4
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +3 -4
- data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +93 -0
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +3 -2
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +0 -1
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +11 -14
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +6 -11
- data/lib/rubocop/cop/lint/percent_string_array.rb +1 -5
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -5
- data/lib/rubocop/cop/lint/raise_exception.rb +29 -10
- data/lib/rubocop/cop/lint/rand_one.rb +0 -4
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +11 -5
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +9 -7
- data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +1 -13
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +79 -10
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +10 -9
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +36 -20
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +261 -0
- data/lib/rubocop/cop/lint/redundant_with_index.rb +10 -3
- data/lib/rubocop/cop/lint/redundant_with_object.rb +6 -3
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +3 -2
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +0 -1
- data/lib/rubocop/cop/lint/require_parentheses.rb +0 -4
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -5
- data/lib/rubocop/cop/lint/rescue_type.rb +4 -10
- data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -13
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +31 -13
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +109 -41
- data/lib/rubocop/cop/lint/script_permission.rb +3 -3
- data/lib/rubocop/cop/lint/self_assignment.rb +71 -10
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -2
- data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -0
- data/lib/rubocop/cop/lint/shadowed_exception.rb +7 -13
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +26 -12
- data/lib/rubocop/cop/lint/shared_mutable_default.rb +76 -0
- data/lib/rubocop/cop/lint/struct_new_override.rb +12 -12
- data/lib/rubocop/cop/lint/suppressed_exception.rb +3 -3
- data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
- data/lib/rubocop/cop/lint/symbol_conversion.rb +9 -4
- data/lib/rubocop/cop/lint/syntax.rb +14 -4
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +17 -7
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +23 -9
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
- data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +88 -0
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +3 -1
- data/lib/rubocop/cop/lint/unified_integer.rb +0 -4
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +4 -3
- data/lib/rubocop/cop/lint/unreachable_code.rb +56 -9
- data/lib/rubocop/cop/lint/unreachable_loop.rb +17 -11
- data/lib/rubocop/cop/lint/unused_method_argument.rb +18 -2
- data/lib/rubocop/cop/lint/uri_regexp.rb +25 -7
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +46 -17
- data/lib/rubocop/cop/lint/useless_assignment.rb +104 -15
- data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
- data/lib/rubocop/cop/lint/useless_default_value_argument.rb +90 -0
- data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -4
- data/lib/rubocop/cop/lint/useless_method_definition.rb +11 -3
- data/lib/rubocop/cop/lint/useless_numeric_operation.rb +78 -0
- data/lib/rubocop/cop/lint/useless_or.rb +98 -0
- data/lib/rubocop/cop/lint/useless_rescue.rb +7 -3
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +5 -5
- data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -29
- data/lib/rubocop/cop/lint/useless_times.rb +3 -3
- data/lib/rubocop/cop/lint/void.rb +140 -19
- data/lib/rubocop/cop/message_annotator.rb +7 -3
- data/lib/rubocop/cop/metrics/abc_size.rb +4 -4
- data/lib/rubocop/cop/metrics/block_length.rb +9 -7
- data/lib/rubocop/cop/metrics/block_nesting.rb +20 -8
- data/lib/rubocop/cop/metrics/class_length.rb +23 -16
- data/lib/rubocop/cop/metrics/collection_literal_length.rb +83 -0
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +5 -2
- data/lib/rubocop/cop/metrics/method_length.rb +16 -7
- data/lib/rubocop/cop/metrics/module_length.rb +7 -6
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +2 -3
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +40 -13
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
- data/lib/rubocop/cop/migration/department_name.rb +3 -3
- data/lib/rubocop/cop/mixin/alignment.rb +8 -4
- data/lib/rubocop/cop/mixin/allowed_methods.rb +10 -2
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +15 -3
- data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
- data/lib/rubocop/cop/mixin/annotation_comment.rb +1 -3
- data/lib/rubocop/cop/mixin/check_assignment.rb +4 -12
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +22 -12
- data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +49 -0
- data/lib/rubocop/cop/mixin/code_length.rb +12 -1
- data/lib/rubocop/cop/mixin/comments_help.rb +26 -11
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
- data/lib/rubocop/cop/mixin/configurable_max.rb +5 -1
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/mixin/dig_help.rb +27 -0
- data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/endless_method_rewriter.rb +24 -0
- data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
- data/lib/rubocop/cop/mixin/forbidden_pattern.rb +16 -0
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +23 -12
- data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +16 -15
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +62 -43
- data/lib/rubocop/cop/mixin/hash_subset.rb +203 -0
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +74 -74
- data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
- data/lib/rubocop/cop/mixin/line_length_help.rb +34 -12
- data/lib/rubocop/cop/mixin/method_complexity.rb +17 -7
- data/lib/rubocop/cop/mixin/min_branches_count.rb +40 -0
- data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +0 -3
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +10 -11
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +2 -2
- data/lib/rubocop/cop/mixin/percent_array.rb +1 -1
- data/lib/rubocop/cop/mixin/percent_literal.rb +2 -2
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +71 -35
- data/lib/rubocop/cop/mixin/range_help.rb +16 -10
- data/lib/rubocop/cop/mixin/rescue_node.rb +4 -0
- data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +13 -7
- data/lib/rubocop/cop/mixin/string_help.rb +5 -3
- data/lib/rubocop/cop/mixin/string_literals_help.rb +12 -0
- data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -3
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +24 -8
- data/lib/rubocop/cop/naming/accessor_method_name.rb +11 -6
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +1 -1
- data/lib/rubocop/cop/naming/block_forwarding.rb +40 -9
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +1 -1
- data/lib/rubocop/cop/naming/constant_name.rb +8 -10
- data/lib/rubocop/cop/naming/file_name.rb +5 -7
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -1
- data/lib/rubocop/cop/naming/inclusive_language.rb +33 -6
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +38 -24
- data/lib/rubocop/cop/naming/method_name.rb +146 -15
- data/lib/rubocop/cop/naming/predicate_method.rb +303 -0
- data/lib/rubocop/cop/naming/predicate_prefix.rb +204 -0
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +26 -17
- data/lib/rubocop/cop/naming/variable_name.rb +56 -7
- data/lib/rubocop/cop/naming/variable_number.rb +2 -3
- data/lib/rubocop/cop/offense.rb +4 -5
- data/lib/rubocop/cop/registry.rb +12 -7
- data/lib/rubocop/cop/security/compound_hash.rb +4 -2
- data/lib/rubocop/cop/security/eval.rb +2 -1
- data/lib/rubocop/cop/security/open.rb +3 -2
- data/lib/rubocop/cop/security/yaml_load.rb +3 -2
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +177 -30
- data/lib/rubocop/cop/style/accessor_grouping.rb +69 -21
- data/lib/rubocop/cop/style/alias.rb +11 -9
- data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +79 -0
- data/lib/rubocop/cop/style/and_or.rb +1 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +478 -62
- data/lib/rubocop/cop/style/array_first_last.rb +80 -0
- data/lib/rubocop/cop/style/array_intersect.rb +54 -34
- data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
- data/lib/rubocop/cop/style/attr.rb +11 -1
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
- data/lib/rubocop/cop/style/begin_block.rb +1 -2
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +3 -3
- data/lib/rubocop/cop/style/bitwise_predicate.rb +100 -0
- data/lib/rubocop/cop/style/block_comments.rb +2 -2
- data/lib/rubocop/cop/style/block_delimiters.rb +60 -19
- data/lib/rubocop/cop/style/case_like_if.rb +34 -20
- data/lib/rubocop/cop/style/class_and_module_children.rb +55 -14
- data/lib/rubocop/cop/style/class_check.rb +1 -0
- data/lib/rubocop/cop/style/class_equality_comparison.rb +59 -41
- data/lib/rubocop/cop/style/class_vars.rb +3 -3
- data/lib/rubocop/cop/style/collection_compact.rb +35 -12
- data/lib/rubocop/cop/style/collection_methods.rb +4 -1
- data/lib/rubocop/cop/style/collection_querying.rb +167 -0
- data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
- data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
- data/lib/rubocop/cop/style/combinable_loops.rb +44 -8
- data/lib/rubocop/cop/style/command_literal.rb +2 -2
- data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +32 -6
- data/lib/rubocop/cop/style/comparable_between.rb +78 -0
- data/lib/rubocop/cop/style/concat_array_literals.rb +13 -4
- data/lib/rubocop/cop/style/conditional_assignment.rb +57 -42
- data/lib/rubocop/cop/style/constant_visibility.rb +3 -12
- data/lib/rubocop/cop/style/copyright.rb +37 -24
- data/lib/rubocop/cop/style/data_inheritance.rb +82 -0
- data/lib/rubocop/cop/style/date_time.rb +5 -4
- data/lib/rubocop/cop/style/def_with_parentheses.rb +18 -7
- data/lib/rubocop/cop/style/dig_chain.rb +89 -0
- data/lib/rubocop/cop/style/dir.rb +1 -1
- data/lib/rubocop/cop/style/dir_empty.rb +54 -0
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +2 -2
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +3 -3
- data/lib/rubocop/cop/style/documentation.rb +36 -30
- data/lib/rubocop/cop/style/documentation_method.rb +30 -4
- data/lib/rubocop/cop/style/double_negation.rb +6 -6
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +11 -15
- data/lib/rubocop/cop/style/each_with_object.rb +4 -5
- data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
- data/lib/rubocop/cop/style/empty_case_condition.rb +6 -1
- data/lib/rubocop/cop/style/empty_else.rb +10 -7
- data/lib/rubocop/cop/style/empty_heredoc.rb +1 -14
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
- data/lib/rubocop/cop/style/empty_literal.rb +36 -23
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
- data/lib/rubocop/cop/style/endless_method.rb +150 -18
- data/lib/rubocop/cop/style/eval_with_location.rb +27 -35
- data/lib/rubocop/cop/style/exact_regexp_match.rb +69 -0
- data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
- data/lib/rubocop/cop/style/explicit_block_argument.rb +19 -6
- data/lib/rubocop/cop/style/exponential_notation.rb +5 -5
- data/lib/rubocop/cop/style/fetch_env_var.rb +34 -7
- data/lib/rubocop/cop/style/file_empty.rb +71 -0
- data/lib/rubocop/cop/style/file_null.rb +89 -0
- data/lib/rubocop/cop/style/file_read.rb +5 -8
- data/lib/rubocop/cop/style/file_touch.rb +75 -0
- data/lib/rubocop/cop/style/file_write.rb +3 -6
- data/lib/rubocop/cop/style/float_division.rb +8 -4
- data/lib/rubocop/cop/style/for.rb +4 -2
- data/lib/rubocop/cop/style/format_string.rb +33 -12
- data/lib/rubocop/cop/style/format_string_token.rb +38 -11
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +7 -4
- data/lib/rubocop/cop/style/global_std_stream.rb +10 -1
- data/lib/rubocop/cop/style/global_vars.rb +1 -3
- data/lib/rubocop/cop/style/guard_clause.rb +48 -4
- data/lib/rubocop/cop/style/hash_conversion.rb +26 -9
- data/lib/rubocop/cop/style/hash_each_methods.rb +111 -34
- data/lib/rubocop/cop/style/hash_except.rb +38 -135
- data/lib/rubocop/cop/style/hash_fetch_chain.rb +104 -0
- data/lib/rubocop/cop/style/hash_like_case.rb +3 -9
- data/lib/rubocop/cop/style/hash_slice.rb +80 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +38 -7
- data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
- data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +57 -9
- data/lib/rubocop/cop/style/if_inside_else.rb +16 -14
- data/lib/rubocop/cop/style/if_unless_modifier.rb +140 -17
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +4 -7
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +10 -8
- data/lib/rubocop/cop/style/if_with_semicolon.rb +62 -8
- data/lib/rubocop/cop/style/in_pattern_then.rb +6 -2
- data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +21 -17
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +58 -12
- data/lib/rubocop/cop/style/ip_addresses.rb +2 -2
- data/lib/rubocop/cop/style/it_assignment.rb +36 -0
- data/lib/rubocop/cop/style/it_block_parameter.rb +119 -0
- data/lib/rubocop/cop/style/keyword_arguments_merging.rb +67 -0
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +14 -8
- data/lib/rubocop/cop/style/lambda.rb +5 -4
- data/lib/rubocop/cop/style/lambda_call.rb +14 -3
- data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
- data/lib/rubocop/cop/style/magic_comment_format.rb +1 -1
- data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +82 -50
- data/lib/rubocop/cop/style/map_into_array.rb +236 -0
- data/lib/rubocop/cop/style/map_to_hash.rb +31 -7
- data/lib/rubocop/cop/style/map_to_set.rb +6 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +62 -31
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +65 -42
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +30 -13
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -4
- data/lib/rubocop/cop/style/method_def_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/min_max.rb +3 -3
- data/lib/rubocop/cop/style/min_max_comparison.rb +13 -5
- data/lib/rubocop/cop/style/missing_else.rb +2 -4
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +35 -5
- data/lib/rubocop/cop/style/mixin_grouping.rb +5 -5
- data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -2
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -0
- data/lib/rubocop/cop/style/multiline_memoization.rb +2 -2
- data/lib/rubocop/cop/style/multiline_method_signature.rb +17 -13
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +21 -4
- data/lib/rubocop/cop/style/multiline_when_then.rb +0 -4
- data/lib/rubocop/cop/style/multiple_comparison.rb +66 -59
- data/lib/rubocop/cop/style/mutable_constant.rb +7 -8
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +18 -11
- data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +2 -2
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +8 -15
- data/lib/rubocop/cop/style/next.rb +45 -1
- data/lib/rubocop/cop/style/nil_comparison.rb +2 -0
- data/lib/rubocop/cop/style/nil_lambda.rb +2 -2
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/numbered_parameters_limit.rb +11 -3
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +12 -4
- data/lib/rubocop/cop/style/object_then.rb +16 -14
- data/lib/rubocop/cop/style/one_line_conditional.rb +31 -6
- data/lib/rubocop/cop/style/open_struct_use.rb +6 -6
- data/lib/rubocop/cop/style/operator_method_call.rb +33 -9
- data/lib/rubocop/cop/style/or_assignment.rb +3 -6
- data/lib/rubocop/cop/style/parallel_assignment.rb +38 -40
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -0
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +3 -4
- data/lib/rubocop/cop/style/percent_q_literals.rb +2 -2
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
- data/lib/rubocop/cop/style/proc.rb +2 -2
- data/lib/rubocop/cop/style/quoted_symbols.rb +2 -4
- data/lib/rubocop/cop/style/raise_args.rb +19 -14
- data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
- data/lib/rubocop/cop/style/redundant_argument.rb +35 -4
- data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
- data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
- data/lib/rubocop/cop/style/redundant_assignment.rb +11 -3
- data/lib/rubocop/cop/style/redundant_begin.rb +17 -4
- data/lib/rubocop/cop/style/redundant_condition.rb +114 -27
- data/lib/rubocop/cop/style/redundant_conditional.rb +2 -10
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +50 -0
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +91 -7
- data/lib/rubocop/cop/style/redundant_each.rb +7 -4
- data/lib/rubocop/cop/style/redundant_exception.rb +33 -13
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +10 -16
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
- data/lib/rubocop/cop/style/redundant_filter_chain.rb +118 -0
- data/lib/rubocop/cop/style/redundant_format.rb +262 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +3 -3
- data/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb +58 -0
- data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
- data/lib/rubocop/cop/style/redundant_interpolation.rb +3 -3
- data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +46 -0
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +236 -0
- data/lib/rubocop/cop/style/redundant_parentheses.rb +140 -40
- data/lib/rubocop/cop/style/redundant_percent_q.rb +2 -2
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +107 -0
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +8 -9
- data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +20 -28
- data/lib/rubocop/cop/style/redundant_return.rb +16 -5
- data/lib/rubocop/cop/style/redundant_self.rb +32 -20
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +20 -32
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +12 -5
- data/lib/rubocop/cop/style/redundant_sort.rb +14 -13
- data/lib/rubocop/cop/style/redundant_sort_by.rb +19 -3
- data/lib/rubocop/cop/style/redundant_string_escape.rb +8 -7
- data/lib/rubocop/cop/style/regexp_literal.rb +12 -3
- data/lib/rubocop/cop/style/require_order.rb +13 -9
- data/lib/rubocop/cop/style/rescue_modifier.rb +19 -7
- data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
- data/lib/rubocop/cop/style/return_nil.rb +8 -4
- data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +137 -0
- data/lib/rubocop/cop/style/safe_navigation.rb +145 -63
- data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
- data/lib/rubocop/cop/style/sample.rb +3 -4
- data/lib/rubocop/cop/style/select_by_regexp.rb +33 -16
- data/lib/rubocop/cop/style/self_assignment.rb +12 -18
- data/lib/rubocop/cop/style/semicolon.rb +22 -6
- data/lib/rubocop/cop/style/send.rb +4 -4
- data/lib/rubocop/cop/style/send_with_literal_method_name.rb +105 -0
- data/lib/rubocop/cop/style/signal_exception.rb +3 -4
- data/lib/rubocop/cop/style/single_argument_dig.rb +16 -8
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +78 -0
- data/lib/rubocop/cop/style/single_line_methods.rb +10 -8
- data/lib/rubocop/cop/style/slicing_with_range.rb +106 -11
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +50 -90
- data/lib/rubocop/cop/style/special_global_vars.rb +5 -7
- data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
- data/lib/rubocop/cop/style/string_chars.rb +1 -0
- data/lib/rubocop/cop/style/string_concatenation.rb +15 -15
- data/lib/rubocop/cop/style/string_literals.rb +1 -1
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
- data/lib/rubocop/cop/style/string_methods.rb +1 -1
- data/lib/rubocop/cop/style/strip.rb +7 -4
- data/lib/rubocop/cop/style/struct_inheritance.rb +10 -3
- data/lib/rubocop/cop/style/super_arguments.rb +221 -0
- data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
- data/lib/rubocop/cop/style/swap_values.rb +4 -15
- data/lib/rubocop/cop/style/symbol_array.rb +35 -15
- data/lib/rubocop/cop/style/symbol_proc.rb +78 -6
- data/lib/rubocop/cop/style/ternary_parentheses.rb +26 -5
- data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -1
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +1 -0
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +11 -2
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +5 -5
- data/lib/rubocop/cop/style/trivial_accessors.rb +3 -3
- data/lib/rubocop/cop/style/unless_logical_operators.rb +1 -0
- data/lib/rubocop/cop/style/unpack_first.rb +11 -14
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
- data/lib/rubocop/cop/style/while_until_do.rb +0 -2
- data/lib/rubocop/cop/style/while_until_modifier.rb +0 -2
- data/lib/rubocop/cop/style/word_array.rb +18 -6
- data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
- data/lib/rubocop/cop/style/yoda_condition.rb +25 -12
- data/lib/rubocop/cop/style/yoda_expression.rb +20 -9
- data/lib/rubocop/cop/style/zero_length_predicate.rb +41 -29
- data/lib/rubocop/cop/team.rb +58 -26
- data/lib/rubocop/cop/util.rb +33 -11
- data/lib/rubocop/cop/utils/format_string.rb +10 -5
- data/lib/rubocop/cop/variable_force/assignment.rb +66 -6
- data/lib/rubocop/cop/variable_force/branch.rb +1 -1
- data/lib/rubocop/cop/variable_force/scope.rb +3 -3
- data/lib/rubocop/cop/variable_force/variable.rb +18 -5
- data/lib/rubocop/cop/variable_force/variable_table.rb +5 -5
- data/lib/rubocop/cop/variable_force.rb +19 -12
- data/lib/rubocop/cops_documentation_generator.rb +138 -55
- data/lib/rubocop/core_ext/string.rb +2 -6
- data/lib/rubocop/directive_comment.rb +57 -21
- data/lib/rubocop/ext/comment.rb +18 -0
- data/lib/rubocop/ext/regexp_node.rb +17 -35
- data/lib/rubocop/ext/regexp_parser.rb +7 -21
- data/lib/rubocop/file_finder.rb +11 -9
- data/lib/rubocop/formatter/clang_style_formatter.rb +3 -7
- data/lib/rubocop/formatter/disabled_config_formatter.rb +26 -10
- data/lib/rubocop/formatter/formatter_set.rb +8 -2
- data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +38 -15
- data/lib/rubocop/formatter/json_formatter.rb +0 -1
- data/lib/rubocop/formatter/junit_formatter.rb +74 -24
- data/lib/rubocop/formatter/offense_count_formatter.rb +13 -3
- data/lib/rubocop/formatter/pacman_formatter.rb +1 -1
- data/lib/rubocop/formatter/simple_text_formatter.rb +1 -1
- data/lib/rubocop/formatter/tap_formatter.rb +3 -7
- data/lib/rubocop/formatter.rb +1 -1
- data/lib/rubocop/lockfile.rb +58 -7
- data/lib/rubocop/lsp/diagnostic.rb +189 -0
- data/lib/rubocop/lsp/logger.rb +22 -0
- data/lib/rubocop/lsp/routes.rb +227 -0
- data/lib/rubocop/lsp/runtime.rb +69 -0
- data/lib/rubocop/lsp/server.rb +70 -0
- data/lib/rubocop/lsp/severity.rb +27 -0
- data/lib/rubocop/lsp/stdin_runner.rb +85 -0
- data/lib/rubocop/lsp.rb +36 -0
- data/lib/rubocop/magic_comment.rb +24 -14
- data/lib/rubocop/options.rb +78 -23
- data/lib/rubocop/path_util.rb +21 -10
- data/lib/rubocop/pending_cops_reporter.rb +56 -0
- data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
- data/lib/rubocop/plugin/load_error.rb +26 -0
- data/lib/rubocop/plugin/loader.rb +100 -0
- data/lib/rubocop/plugin/not_supported_error.rb +29 -0
- data/lib/rubocop/plugin.rb +46 -0
- data/lib/rubocop/rake_task.rb +5 -2
- data/lib/rubocop/remote_config.rb +5 -1
- data/lib/rubocop/result_cache.rb +20 -23
- data/lib/rubocop/rspec/cop_helper.rb +21 -3
- data/lib/rubocop/rspec/expect_offense.rb +31 -12
- data/lib/rubocop/rspec/shared_contexts.rb +118 -21
- data/lib/rubocop/rspec/support.rb +8 -2
- data/lib/rubocop/runner.rb +80 -17
- data/lib/rubocop/server/cache.rb +66 -8
- data/lib/rubocop/server/cli.rb +39 -20
- data/lib/rubocop/server/client_command/base.rb +10 -0
- data/lib/rubocop/server/client_command/exec.rb +6 -5
- data/lib/rubocop/server/client_command/start.rb +17 -2
- data/lib/rubocop/server/core.rb +29 -9
- data/lib/rubocop/server/helper.rb +1 -1
- data/lib/rubocop/server/server_command/exec.rb +1 -2
- data/lib/rubocop/string_interpreter.rb +3 -3
- data/lib/rubocop/target_finder.rb +97 -82
- data/lib/rubocop/target_ruby.rb +105 -79
- data/lib/rubocop/version.rb +74 -12
- data/lib/rubocop/yaml_duplication_checker.rb +20 -26
- data/lib/rubocop.rb +81 -2
- data/lib/ruby_lsp/rubocop/addon.rb +75 -0
- data/lib/ruby_lsp/rubocop/runtime_adapter.rb +65 -0
- metadata +152 -63
- data/lib/rubocop/cop/naming/predicate_name.rb +0 -134
- data/lib/rubocop/rspec/host_environment_simulation_helper.rb +0 -28
- /data/lib/rubocop/formatter/{git_hub_actions_formatter.rb → github_actions_formatter.rb} +0 -0
data/config/default.yml
CHANGED
@@ -30,6 +30,7 @@ AllCops:
|
|
30
30
|
- '**/*.rbx'
|
31
31
|
- '**/*.ru'
|
32
32
|
- '**/*.ruby'
|
33
|
+
- '**/*.schema'
|
33
34
|
- '**/*.spec'
|
34
35
|
- '**/*.thor'
|
35
36
|
- '**/*.watchr'
|
@@ -55,6 +56,7 @@ AllCops:
|
|
55
56
|
- '**/Puppetfile'
|
56
57
|
- '**/Rakefile'
|
57
58
|
- '**/rakefile'
|
59
|
+
- '**/Schemafile'
|
58
60
|
- '**/Snapfile'
|
59
61
|
- '**/Steepfile'
|
60
62
|
- '**/Thorfile'
|
@@ -80,6 +82,8 @@ AllCops:
|
|
80
82
|
StyleGuideBaseURL: https://rubystyle.guide
|
81
83
|
# Documentation URLs will be constructed using the base URL.
|
82
84
|
DocumentationBaseURL: https://docs.rubocop.org/rubocop
|
85
|
+
# Documentation URLs will end with this extension.
|
86
|
+
DocumentationExtension: .html
|
83
87
|
# Extra details are not displayed in offense messages by default. Change
|
84
88
|
# behavior by overriding ExtraDetails, or by giving the
|
85
89
|
# `-E/--extra-details` option.
|
@@ -140,8 +144,16 @@ AllCops:
|
|
140
144
|
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
141
145
|
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
142
146
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
143
|
-
# supported Ruby version (currently Ruby 2.
|
147
|
+
# supported Ruby version (currently Ruby 2.7).
|
144
148
|
TargetRubyVersion: ~
|
149
|
+
# RuboCop choses the parser engine automatically but you can also specify it yourself.
|
150
|
+
# These options are available:
|
151
|
+
# - `default`
|
152
|
+
# - `parser_whitequark` ... https://github.com/whitequark/parser
|
153
|
+
# - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
|
154
|
+
# Not every parser engine can handle every `TargetRubyVersion`. `parser_whitequark`
|
155
|
+
# only works with versions 3.4 and below, `parser_prism` with versions 3.3 and above.
|
156
|
+
ParserEngine: default
|
145
157
|
# Determines if a notification for extension libraries should be shown when
|
146
158
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
147
159
|
# of gems in the Gemfile that the extension is suggested for, if not already
|
@@ -153,8 +165,16 @@ AllCops:
|
|
153
165
|
rubocop-sequel: [sequel]
|
154
166
|
rubocop-rake: [rake]
|
155
167
|
rubocop-graphql: [graphql]
|
168
|
+
rubocop-capybara: [capybara]
|
169
|
+
rubocop-factory_bot: [factory_bot, factory_bot_rails]
|
170
|
+
rubocop-rspec_rails: [rspec-rails]
|
156
171
|
# Enable/Disable checking the methods extended by Active Support.
|
157
172
|
ActiveSupportExtensionsEnabled: false
|
173
|
+
# Future version of Ruby will freeze string literals by default.
|
174
|
+
# This allows to opt in early, for example when enabled through RUBYOPT.
|
175
|
+
# For now this will behave as if set to false but in future ruby versions
|
176
|
+
# (likely 4.0) it will be true by default.
|
177
|
+
StringLiteralsFrozenByDefault: ~
|
158
178
|
|
159
179
|
#################### Bundler ###############################
|
160
180
|
|
@@ -169,6 +189,16 @@ Bundler/DuplicatedGem:
|
|
169
189
|
- '**/Gemfile'
|
170
190
|
- '**/gems.rb'
|
171
191
|
|
192
|
+
Bundler/DuplicatedGroup:
|
193
|
+
Description: 'Checks for duplicate group entries in Gemfile.'
|
194
|
+
Enabled: true
|
195
|
+
Severity: warning
|
196
|
+
VersionAdded: '1.56'
|
197
|
+
Include:
|
198
|
+
- '**/*.gemfile'
|
199
|
+
- '**/Gemfile'
|
200
|
+
- '**/gems.rb'
|
201
|
+
|
172
202
|
Bundler/GemComment:
|
173
203
|
Description: 'Add a comment describing each gem.'
|
174
204
|
Enabled: false
|
@@ -241,6 +271,23 @@ Bundler/OrderedGems:
|
|
241
271
|
|
242
272
|
#################### Gemspec ###############################
|
243
273
|
|
274
|
+
Gemspec/AddRuntimeDependency:
|
275
|
+
Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
|
276
|
+
StyleGuide: '#add_dependency_vs_add_runtime_dependency'
|
277
|
+
References:
|
278
|
+
- https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
|
279
|
+
Enabled: pending
|
280
|
+
VersionAdded: '1.65'
|
281
|
+
Include:
|
282
|
+
- '**/*.gemspec'
|
283
|
+
|
284
|
+
Gemspec/AttributeAssignment:
|
285
|
+
Description: 'Use consistent style for Gemspec attributes assignment.'
|
286
|
+
Enabled: pending
|
287
|
+
VersionAdded: '1.77'
|
288
|
+
Include:
|
289
|
+
- '**/*.gemspec'
|
290
|
+
|
244
291
|
Gemspec/DependencyVersion:
|
245
292
|
Description: 'Requires or forbids specifying gem dependency versions.'
|
246
293
|
Enabled: false
|
@@ -271,8 +318,7 @@ Gemspec/DevelopmentDependencies:
|
|
271
318
|
- Gemfile
|
272
319
|
- gems.rb
|
273
320
|
- gemspec
|
274
|
-
AllowedGems:
|
275
|
-
- bundler
|
321
|
+
AllowedGems: []
|
276
322
|
Include:
|
277
323
|
- '**/*.gemspec'
|
278
324
|
- '**/Gemfile'
|
@@ -305,7 +351,7 @@ Gemspec/RequireMFA:
|
|
305
351
|
Severity: warning
|
306
352
|
VersionAdded: '1.23'
|
307
353
|
VersionChanged: '1.40'
|
308
|
-
|
354
|
+
References:
|
309
355
|
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
310
356
|
Include:
|
311
357
|
- '**/*.gemspec'
|
@@ -407,9 +453,8 @@ Layout/AssignmentIndentation:
|
|
407
453
|
Checks the indentation of the first line of the
|
408
454
|
right-hand-side of a multi-line assignment.
|
409
455
|
Enabled: true
|
410
|
-
SafeAutoCorrect: false
|
411
456
|
VersionAdded: '0.49'
|
412
|
-
VersionChanged: '1.
|
457
|
+
VersionChanged: '1.45'
|
413
458
|
# By default the indentation width from `Layout/IndentationWidth` is used,
|
414
459
|
# but it can be overridden by setting this parameter.
|
415
460
|
IndentationWidth: ~
|
@@ -467,7 +512,9 @@ Layout/ClassStructure:
|
|
467
512
|
Description: 'Enforces a configured order of definitions within a class body.'
|
468
513
|
StyleGuide: '#consistent-classes'
|
469
514
|
Enabled: false
|
515
|
+
SafeAutoCorrect: false
|
470
516
|
VersionAdded: '0.52'
|
517
|
+
VersionChanged: '1.53'
|
471
518
|
Categories:
|
472
519
|
module_inclusion:
|
473
520
|
- include
|
@@ -542,7 +589,9 @@ Layout/ElseAlignment:
|
|
542
589
|
Layout/EmptyComment:
|
543
590
|
Description: 'Checks empty comment.'
|
544
591
|
Enabled: true
|
592
|
+
AutoCorrect: contextual
|
545
593
|
VersionAdded: '0.53'
|
594
|
+
VersionChanged: '1.61'
|
546
595
|
AllowBorderComment: true
|
547
596
|
AllowMarginComment: true
|
548
597
|
|
@@ -563,7 +612,7 @@ Layout/EmptyLineAfterMultilineCondition:
|
|
563
612
|
# This is disabled, because this style is not very common in practice.
|
564
613
|
Enabled: false
|
565
614
|
VersionAdded: '0.90'
|
566
|
-
|
615
|
+
References:
|
567
616
|
- https://github.com/airbnb/ruby#multiline-if-newline
|
568
617
|
|
569
618
|
Layout/EmptyLineBetweenDefs:
|
@@ -575,6 +624,8 @@ Layout/EmptyLineBetweenDefs:
|
|
575
624
|
EmptyLineBetweenMethodDefs: true
|
576
625
|
EmptyLineBetweenClassDefs: true
|
577
626
|
EmptyLineBetweenModuleDefs: true
|
627
|
+
# `DefLikeMacros` takes the name of any macro that you want to treat like a def.
|
628
|
+
DefLikeMacros: []
|
578
629
|
# `AllowAdjacentOneLineDefs` means that single line method definitions don't
|
579
630
|
# need an empty line between them. `true` by default.
|
580
631
|
AllowAdjacentOneLineDefs: true
|
@@ -596,7 +647,7 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
596
647
|
SupportedStyles:
|
597
648
|
- around
|
598
649
|
- only_before
|
599
|
-
|
650
|
+
References:
|
600
651
|
# A reference to `EnforcedStyle: only_before`.
|
601
652
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
602
653
|
|
@@ -820,6 +871,7 @@ Layout/FirstMethodArgumentLineBreak:
|
|
820
871
|
Enabled: false
|
821
872
|
VersionAdded: '0.49'
|
822
873
|
AllowMultilineFinalElement: false
|
874
|
+
AllowedMethods: []
|
823
875
|
|
824
876
|
Layout/FirstMethodParameterLineBreak:
|
825
877
|
Description: >-
|
@@ -952,7 +1004,7 @@ Layout/IndentationConsistency:
|
|
952
1004
|
SupportedStyles:
|
953
1005
|
- normal
|
954
1006
|
- indented_internal_methods
|
955
|
-
|
1007
|
+
References:
|
956
1008
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
957
1009
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
958
1010
|
|
@@ -980,7 +1032,6 @@ Layout/IndentationWidth:
|
|
980
1032
|
# Number of spaces for each indentation level.
|
981
1033
|
Width: 2
|
982
1034
|
AllowedPatterns: []
|
983
|
-
IgnoredPatterns: [] # deprecated
|
984
1035
|
|
985
1036
|
Layout/InitialIndentation:
|
986
1037
|
Description: >-
|
@@ -996,6 +1047,8 @@ Layout/LeadingCommentSpace:
|
|
996
1047
|
VersionChanged: '0.73'
|
997
1048
|
AllowDoxygenCommentStyle: false
|
998
1049
|
AllowGemfileRubyComment: false
|
1050
|
+
AllowRBSInlineAnnotation: false
|
1051
|
+
AllowSteepAnnotation: false
|
999
1052
|
|
1000
1053
|
Layout/LeadingEmptyLines:
|
1001
1054
|
Description: Check for unnecessary blank lines at the beginning of a file.
|
@@ -1008,10 +1061,8 @@ Layout/LineContinuationLeadingSpace:
|
|
1008
1061
|
Use trailing spaces instead of leading spaces in strings
|
1009
1062
|
broken over multiple lines (by a backslash).
|
1010
1063
|
Enabled: pending
|
1011
|
-
AutoCorrect: false
|
1012
|
-
SafeAutoCorrect: false
|
1013
1064
|
VersionAdded: '1.31'
|
1014
|
-
VersionChanged: '1.
|
1065
|
+
VersionChanged: '1.45'
|
1015
1066
|
EnforcedStyle: trailing
|
1016
1067
|
SupportedStyles:
|
1017
1068
|
- leading
|
@@ -1020,8 +1071,6 @@ Layout/LineContinuationLeadingSpace:
|
|
1020
1071
|
Layout/LineContinuationSpacing:
|
1021
1072
|
Description: 'Checks the spacing in front of backslash in line continuations.'
|
1022
1073
|
Enabled: pending
|
1023
|
-
AutoCorrect: true
|
1024
|
-
SafeAutoCorrect: true
|
1025
1074
|
VersionAdded: '1.31'
|
1026
1075
|
EnforcedStyle: space
|
1027
1076
|
SupportedStyles:
|
@@ -1047,12 +1096,13 @@ Layout/LineLength:
|
|
1047
1096
|
StyleGuide: '#max-line-length'
|
1048
1097
|
Enabled: true
|
1049
1098
|
VersionAdded: '0.25'
|
1050
|
-
VersionChanged: '1.
|
1099
|
+
VersionChanged: '1.69'
|
1051
1100
|
Max: 120
|
1101
|
+
AllowHeredoc: true
|
1052
1102
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
1053
1103
|
# containing a URI to be longer than Max.
|
1054
|
-
AllowHeredoc: true
|
1055
1104
|
AllowURI: true
|
1105
|
+
AllowQualifiedName: true
|
1056
1106
|
URISchemes:
|
1057
1107
|
- http
|
1058
1108
|
- https
|
@@ -1063,7 +1113,8 @@ Layout/LineLength:
|
|
1063
1113
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
1064
1114
|
# any regular expression listed in this option will be ignored by LineLength.
|
1065
1115
|
AllowedPatterns: []
|
1066
|
-
|
1116
|
+
# If SplitStrings is true, long strings will be split using continuations
|
1117
|
+
SplitStrings: false
|
1067
1118
|
|
1068
1119
|
Layout/MultilineArrayBraceLayout:
|
1069
1120
|
Description: >-
|
@@ -1341,6 +1392,10 @@ Layout/SpaceAroundOperators:
|
|
1341
1392
|
SupportedStylesForExponentOperator:
|
1342
1393
|
- space
|
1343
1394
|
- no_space
|
1395
|
+
EnforcedStyleForRationalLiterals: no_space
|
1396
|
+
SupportedStylesForRationalLiterals:
|
1397
|
+
- space
|
1398
|
+
- no_space
|
1344
1399
|
|
1345
1400
|
Layout/SpaceBeforeBlockBraces:
|
1346
1401
|
Description: >-
|
@@ -1457,7 +1512,6 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
1457
1512
|
- space
|
1458
1513
|
- no_space
|
1459
1514
|
|
1460
|
-
|
1461
1515
|
Layout/SpaceInsideParens:
|
1462
1516
|
Description: 'No spaces after ( or before ).'
|
1463
1517
|
StyleGuide: '#spaces-braces'
|
@@ -1536,13 +1590,11 @@ Lint/AmbiguousBlockAssociation:
|
|
1536
1590
|
Description: >-
|
1537
1591
|
Checks for ambiguous block association with method when param passed without
|
1538
1592
|
parentheses.
|
1539
|
-
StyleGuide: '#syntax'
|
1540
1593
|
Enabled: true
|
1541
1594
|
VersionAdded: '0.48'
|
1542
1595
|
VersionChanged: '1.13'
|
1543
1596
|
AllowedMethods: []
|
1544
1597
|
AllowedPatterns: []
|
1545
|
-
IgnoredMethods: [] # deprecated
|
1546
1598
|
|
1547
1599
|
Lint/AmbiguousOperator:
|
1548
1600
|
Description: >-
|
@@ -1575,11 +1627,19 @@ Lint/AmbiguousRegexpLiteral:
|
|
1575
1627
|
VersionAdded: '0.17'
|
1576
1628
|
VersionChanged: '0.83'
|
1577
1629
|
|
1630
|
+
Lint/ArrayLiteralInRegexp:
|
1631
|
+
Description: 'Checks for an array literal interpolated inside a regexp.'
|
1632
|
+
Enabled: pending
|
1633
|
+
VersionAdded: '1.71'
|
1634
|
+
SafeAutoCorrect: false
|
1635
|
+
|
1578
1636
|
Lint/AssignmentInCondition:
|
1579
1637
|
Description: "Don't use assignment in conditions."
|
1580
1638
|
StyleGuide: '#safe-assignment-in-condition'
|
1581
1639
|
Enabled: true
|
1640
|
+
SafeAutoCorrect: false
|
1582
1641
|
VersionAdded: '0.9'
|
1642
|
+
VersionChanged: '1.45'
|
1583
1643
|
AllowSafeAssignment: true
|
1584
1644
|
|
1585
1645
|
Lint/BigDecimalNew:
|
@@ -1592,7 +1652,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1592
1652
|
Enabled: true
|
1593
1653
|
Safe: false
|
1594
1654
|
VersionAdded: '0.89'
|
1595
|
-
VersionChanged: '1.
|
1655
|
+
VersionChanged: '1.69'
|
1596
1656
|
|
1597
1657
|
Lint/BooleanSymbol:
|
1598
1658
|
Description: 'Check for `:true` and `:false` symbols.'
|
@@ -1622,6 +1682,11 @@ Lint/ConstantOverwrittenInRescue:
|
|
1622
1682
|
Enabled: pending
|
1623
1683
|
VersionAdded: '1.31'
|
1624
1684
|
|
1685
|
+
Lint/ConstantReassignment:
|
1686
|
+
Description: 'Checks for constant reassignments.'
|
1687
|
+
Enabled: pending
|
1688
|
+
VersionAdded: '1.70'
|
1689
|
+
|
1625
1690
|
Lint/ConstantResolution:
|
1626
1691
|
Description: 'Check that constants are fully qualified with `::`.'
|
1627
1692
|
Enabled: false
|
@@ -1631,12 +1696,16 @@ Lint/ConstantResolution:
|
|
1631
1696
|
# Restrict this cop from only looking at certain names
|
1632
1697
|
Ignore: []
|
1633
1698
|
|
1699
|
+
Lint/CopDirectiveSyntax:
|
1700
|
+
Description: 'Checks that `# rubocop:` directives are strictly formatted.'
|
1701
|
+
Enabled: pending
|
1702
|
+
VersionAdded: '1.72'
|
1703
|
+
|
1634
1704
|
Lint/Debugger:
|
1635
1705
|
Description: 'Check for debugger calls.'
|
1636
1706
|
Enabled: true
|
1637
1707
|
VersionAdded: '0.14'
|
1638
|
-
VersionChanged: '1.
|
1639
|
-
DebuggerReceivers: [] # deprecated
|
1708
|
+
VersionChanged: '1.63'
|
1640
1709
|
DebuggerMethods:
|
1641
1710
|
# Groups are available so that a specific group can be disabled in
|
1642
1711
|
# a user's configuration, but are otherwise not significant.
|
@@ -1649,8 +1718,14 @@ Lint/Debugger:
|
|
1649
1718
|
- Kernel.byebug
|
1650
1719
|
- Kernel.remote_byebug
|
1651
1720
|
Capybara:
|
1721
|
+
- page.save_and_open_page
|
1722
|
+
- page.save_and_open_screenshot
|
1723
|
+
- page.save_page
|
1724
|
+
- page.save_screenshot
|
1652
1725
|
- save_and_open_page
|
1653
1726
|
- save_and_open_screenshot
|
1727
|
+
- save_page
|
1728
|
+
- save_screenshot
|
1654
1729
|
debug.rb:
|
1655
1730
|
- binding.b
|
1656
1731
|
- binding.break
|
@@ -1664,6 +1739,7 @@ Lint/Debugger:
|
|
1664
1739
|
- Kernel.binding.remote_pry
|
1665
1740
|
- Kernel.binding.pry_remote
|
1666
1741
|
- Pry.rescue
|
1742
|
+
- pry
|
1667
1743
|
Rails:
|
1668
1744
|
- debugger
|
1669
1745
|
- Kernel.debugger
|
@@ -1671,6 +1747,10 @@ Lint/Debugger:
|
|
1671
1747
|
- jard
|
1672
1748
|
WebConsole:
|
1673
1749
|
- binding.console
|
1750
|
+
DebuggerRequires:
|
1751
|
+
debug.rb:
|
1752
|
+
- debug/open
|
1753
|
+
- debug/start
|
1674
1754
|
|
1675
1755
|
Lint/DeprecatedClassMethods:
|
1676
1756
|
Description: 'Check for deprecated class method calls.'
|
@@ -1734,6 +1814,7 @@ Lint/DuplicateBranch:
|
|
1734
1814
|
VersionChanged: '1.7'
|
1735
1815
|
IgnoreLiteralBranches: false
|
1736
1816
|
IgnoreConstantBranches: false
|
1817
|
+
IgnoreDuplicateElseBranch: false
|
1737
1818
|
|
1738
1819
|
Lint/DuplicateCaseCondition:
|
1739
1820
|
Description: 'Do not repeat values in case conditionals.'
|
@@ -1756,6 +1837,11 @@ Lint/DuplicateMagicComment:
|
|
1756
1837
|
Enabled: pending
|
1757
1838
|
VersionAdded: '1.37'
|
1758
1839
|
|
1840
|
+
Lint/DuplicateMatchPattern:
|
1841
|
+
Description: 'Do not repeat patterns in `in` keywords.'
|
1842
|
+
Enabled: pending
|
1843
|
+
VersionAdded: '1.50'
|
1844
|
+
|
1759
1845
|
Lint/DuplicateMethods:
|
1760
1846
|
Description: 'Check for duplicate method definitions.'
|
1761
1847
|
Enabled: true
|
@@ -1778,6 +1864,11 @@ Lint/DuplicateRescueException:
|
|
1778
1864
|
Enabled: true
|
1779
1865
|
VersionAdded: '0.89'
|
1780
1866
|
|
1867
|
+
Lint/DuplicateSetElement:
|
1868
|
+
Description: 'Checks for duplicate elements in Set.'
|
1869
|
+
Enabled: pending
|
1870
|
+
VersionAdded: '1.67'
|
1871
|
+
|
1781
1872
|
Lint/EachWithObjectArgument:
|
1782
1873
|
Description: 'Check for immutable argument given to each_with_object.'
|
1783
1874
|
Enabled: true
|
@@ -1806,16 +1897,17 @@ Lint/EmptyClass:
|
|
1806
1897
|
Lint/EmptyConditionalBody:
|
1807
1898
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1808
1899
|
Enabled: true
|
1809
|
-
|
1900
|
+
AutoCorrect: contextual
|
1810
1901
|
AllowComments: true
|
1811
1902
|
VersionAdded: '0.89'
|
1812
|
-
VersionChanged: '1.
|
1903
|
+
VersionChanged: '1.73'
|
1813
1904
|
|
1814
1905
|
Lint/EmptyEnsure:
|
1815
1906
|
Description: 'Checks for empty ensure block.'
|
1816
1907
|
Enabled: true
|
1908
|
+
AutoCorrect: contextual
|
1817
1909
|
VersionAdded: '0.10'
|
1818
|
-
VersionChanged: '
|
1910
|
+
VersionChanged: '1.61'
|
1819
1911
|
|
1820
1912
|
Lint/EmptyExpression:
|
1821
1913
|
Description: 'Checks for empty expressions.'
|
@@ -1837,8 +1929,9 @@ Lint/EmptyInPattern:
|
|
1837
1929
|
Lint/EmptyInterpolation:
|
1838
1930
|
Description: 'Checks for empty string interpolation.'
|
1839
1931
|
Enabled: true
|
1932
|
+
AutoCorrect: contextual
|
1840
1933
|
VersionAdded: '0.20'
|
1841
|
-
VersionChanged: '
|
1934
|
+
VersionChanged: '1.76'
|
1842
1935
|
|
1843
1936
|
Lint/EmptyWhen:
|
1844
1937
|
Description: 'Checks for `when` branches with empty bodies.'
|
@@ -1890,6 +1983,11 @@ Lint/HashCompareByIdentity:
|
|
1890
1983
|
Safe: false
|
1891
1984
|
VersionAdded: '0.93'
|
1892
1985
|
|
1986
|
+
Lint/HashNewWithKeywordArgumentsAsDefault:
|
1987
|
+
Description: 'Checks for the deprecated use of keyword arguments for hash default in `Hash.new`.'
|
1988
|
+
Enabled: pending
|
1989
|
+
VersionAdded: '1.69'
|
1990
|
+
|
1893
1991
|
Lint/HeredocMethodCallPosition:
|
1894
1992
|
Description: >-
|
1895
1993
|
Checks for the ordering of a method call where
|
@@ -1944,6 +2042,13 @@ Lint/InterpolationCheck:
|
|
1944
2042
|
VersionAdded: '0.50'
|
1945
2043
|
VersionChanged: '1.40'
|
1946
2044
|
|
2045
|
+
Lint/ItWithoutArgumentsInBlock:
|
2046
|
+
Description: 'Checks uses of `it` calls without arguments in block.'
|
2047
|
+
References:
|
2048
|
+
- 'https://bugs.ruby-lang.org/issues/18980'
|
2049
|
+
Enabled: pending
|
2050
|
+
VersionAdded: '1.59'
|
2051
|
+
|
1947
2052
|
Lint/LambdaWithoutLiteralBlock:
|
1948
2053
|
Description: 'Checks uses of lambda without a literal block.'
|
1949
2054
|
Enabled: pending
|
@@ -1952,8 +2057,14 @@ Lint/LambdaWithoutLiteralBlock:
|
|
1952
2057
|
Lint/LiteralAsCondition:
|
1953
2058
|
Description: 'Checks of literals used in conditions.'
|
1954
2059
|
Enabled: true
|
2060
|
+
AutoCorrect: contextual
|
1955
2061
|
VersionAdded: '0.51'
|
1956
2062
|
|
2063
|
+
Lint/LiteralAssignmentInCondition:
|
2064
|
+
Description: 'Checks for literal assignments in the conditions.'
|
2065
|
+
Enabled: pending
|
2066
|
+
VersionAdded: '1.58'
|
2067
|
+
|
1957
2068
|
Lint/LiteralInInterpolation:
|
1958
2069
|
Description: 'Checks for literals used in interpolation.'
|
1959
2070
|
Enabled: true
|
@@ -1988,9 +2099,16 @@ Lint/MissingSuper:
|
|
1988
2099
|
Checks for the presence of constructors and lifecycle callbacks
|
1989
2100
|
without calls to `super`.
|
1990
2101
|
Enabled: true
|
2102
|
+
AllowedParentClasses: []
|
1991
2103
|
VersionAdded: '0.89'
|
1992
2104
|
VersionChanged: '1.4'
|
1993
2105
|
|
2106
|
+
Lint/MixedCaseRange:
|
2107
|
+
Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
|
2108
|
+
Enabled: pending
|
2109
|
+
SafeAutoCorrect: false
|
2110
|
+
VersionAdded: '1.53'
|
2111
|
+
|
1994
2112
|
Lint/MixedRegexpCaptureTypes:
|
1995
2113
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1996
2114
|
Enabled: true
|
@@ -2053,7 +2171,6 @@ Lint/NumberConversion:
|
|
2053
2171
|
SafeAutoCorrect: false
|
2054
2172
|
AllowedMethods: []
|
2055
2173
|
AllowedPatterns: []
|
2056
|
-
IgnoredMethods: [] # deprecated
|
2057
2174
|
IgnoredClasses:
|
2058
2175
|
- Time
|
2059
2176
|
- DateTime
|
@@ -2063,6 +2180,11 @@ Lint/NumberedParameterAssignment:
|
|
2063
2180
|
Enabled: pending
|
2064
2181
|
VersionAdded: '1.9'
|
2065
2182
|
|
2183
|
+
Lint/NumericOperationWithConstantResult:
|
2184
|
+
Description: 'Checks for numeric operations with constant results.'
|
2185
|
+
Enabled: pending
|
2186
|
+
VersionAdded: '1.69'
|
2187
|
+
|
2066
2188
|
Lint/OrAssignmentToConstant:
|
2067
2189
|
Description: 'Checks unintended or-assignment to constant.'
|
2068
2190
|
Enabled: pending
|
@@ -2141,10 +2263,16 @@ Lint/RedundantDirGlobSort:
|
|
2141
2263
|
VersionChanged: '1.26'
|
2142
2264
|
SafeAutoCorrect: false
|
2143
2265
|
|
2266
|
+
Lint/RedundantRegexpQuantifiers:
|
2267
|
+
Description: 'Checks for redundant quantifiers in Regexps.'
|
2268
|
+
Enabled: pending
|
2269
|
+
VersionAdded: '1.53'
|
2270
|
+
|
2144
2271
|
Lint/RedundantRequireStatement:
|
2145
2272
|
Description: 'Checks for unnecessary `require` statement.'
|
2146
2273
|
Enabled: true
|
2147
2274
|
VersionAdded: '0.76'
|
2275
|
+
VersionChanged: '1.73'
|
2148
2276
|
|
2149
2277
|
Lint/RedundantSafeNavigation:
|
2150
2278
|
Description: 'Checks for redundant safe navigation calls.'
|
@@ -2173,6 +2301,11 @@ Lint/RedundantStringCoercion:
|
|
2173
2301
|
VersionAdded: '0.19'
|
2174
2302
|
VersionChanged: '0.77'
|
2175
2303
|
|
2304
|
+
Lint/RedundantTypeConversion:
|
2305
|
+
Description: 'Checks for redundantly converting a literal to the same type.'
|
2306
|
+
Enabled: pending
|
2307
|
+
VersionAdded: '1.72'
|
2308
|
+
|
2176
2309
|
Lint/RedundantWithIndex:
|
2177
2310
|
Description: 'Checks for redundant `with_index`.'
|
2178
2311
|
Enabled: true
|
@@ -2246,9 +2379,9 @@ Lint/SafeNavigationChain:
|
|
2246
2379
|
|
2247
2380
|
Lint/SafeNavigationConsistency:
|
2248
2381
|
Description: >-
|
2249
|
-
Check to make sure that if safe navigation is used
|
2250
|
-
|
2251
|
-
for all method calls on
|
2382
|
+
Check to make sure that if safe navigation is used in an `&&` or `||` condition,
|
2383
|
+
consistent and appropriate safe navigation, without excess or deficiency,
|
2384
|
+
is used for all method calls on the same object.
|
2252
2385
|
Enabled: true
|
2253
2386
|
VersionAdded: '0.55'
|
2254
2387
|
VersionChanged: '0.77'
|
@@ -2275,6 +2408,7 @@ Lint/SelfAssignment:
|
|
2275
2408
|
Description: 'Checks for self-assignments.'
|
2276
2409
|
Enabled: true
|
2277
2410
|
VersionAdded: '0.89'
|
2411
|
+
AllowRBSInlineAnnotation: false
|
2278
2412
|
|
2279
2413
|
Lint/SendWithMixinArgument:
|
2280
2414
|
Description: 'Checks for `send` method when using mixin.'
|
@@ -2287,7 +2421,6 @@ Lint/ShadowedArgument:
|
|
2287
2421
|
VersionAdded: '0.52'
|
2288
2422
|
IgnoreImplicitReferences: false
|
2289
2423
|
|
2290
|
-
|
2291
2424
|
Lint/ShadowedException:
|
2292
2425
|
Description: >-
|
2293
2426
|
Avoid rescuing a higher level exception
|
@@ -2299,8 +2432,15 @@ Lint/ShadowingOuterLocalVariable:
|
|
2299
2432
|
Description: >-
|
2300
2433
|
Do not use the same name as outer local variable
|
2301
2434
|
for block arguments or block local variables.
|
2302
|
-
Enabled:
|
2435
|
+
Enabled: false
|
2303
2436
|
VersionAdded: '0.9'
|
2437
|
+
VersionChanged: '1.76'
|
2438
|
+
|
2439
|
+
Lint/SharedMutableDefault:
|
2440
|
+
Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
|
2441
|
+
StyleGuide: '#no-mutable-defaults'
|
2442
|
+
Enabled: pending
|
2443
|
+
VersionAdded: '1.70'
|
2304
2444
|
|
2305
2445
|
Lint/StructNewOverride:
|
2306
2446
|
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
@@ -2316,6 +2456,12 @@ Lint/SuppressedException:
|
|
2316
2456
|
VersionAdded: '0.9'
|
2317
2457
|
VersionChanged: '1.12'
|
2318
2458
|
|
2459
|
+
Lint/SuppressedExceptionInNumberConversion:
|
2460
|
+
Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
|
2461
|
+
Enabled: pending
|
2462
|
+
SafeAutoCorrect: false
|
2463
|
+
VersionAdded: '1.72'
|
2464
|
+
|
2319
2465
|
Lint/SymbolConversion:
|
2320
2466
|
Description: 'Checks for unnecessary symbol conversions.'
|
2321
2467
|
Enabled: pending
|
@@ -2345,11 +2491,16 @@ Lint/TopLevelReturnWithArgument:
|
|
2345
2491
|
Description: 'Detects top level return statements with argument.'
|
2346
2492
|
Enabled: true
|
2347
2493
|
VersionAdded: '0.89'
|
2494
|
+
# These codes are `eval`-ed in method and their return values may be used.
|
2495
|
+
Exclude:
|
2496
|
+
- '**/*.jb'
|
2348
2497
|
|
2349
2498
|
Lint/TrailingCommaInAttributeDeclaration:
|
2350
2499
|
Description: 'Checks for trailing commas in attribute declarations.'
|
2351
2500
|
Enabled: true
|
2501
|
+
AutoCorrect: contextual
|
2352
2502
|
VersionAdded: '0.90'
|
2503
|
+
VersionChanged: '1.61'
|
2353
2504
|
|
2354
2505
|
Lint/TripleQuotes:
|
2355
2506
|
Description: 'Checks for useless triple quote constructs.'
|
@@ -2362,6 +2513,11 @@ Lint/UnderscorePrefixedVariableName:
|
|
2362
2513
|
VersionAdded: '0.21'
|
2363
2514
|
AllowKeywordBlockArguments: false
|
2364
2515
|
|
2516
|
+
Lint/UnescapedBracketInRegexp:
|
2517
|
+
Description: 'Checks for unescaped literal `]` in Regexp.'
|
2518
|
+
Enabled: pending
|
2519
|
+
VersionAdded: '1.68'
|
2520
|
+
|
2365
2521
|
Lint/UnexpectedBlockArity:
|
2366
2522
|
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2367
2523
|
Enabled: pending
|
@@ -2404,14 +2560,14 @@ Lint/UnreachableLoop:
|
|
2404
2560
|
# RSpec uses `times` in its message expectations
|
2405
2561
|
# eg. `exactly(2).times`
|
2406
2562
|
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2407
|
-
IgnoredPatterns: [] # deprecated
|
2408
2563
|
|
2409
2564
|
Lint/UnusedBlockArgument:
|
2410
2565
|
Description: 'Checks for unused block arguments.'
|
2411
2566
|
StyleGuide: '#underscore-unused-vars'
|
2412
2567
|
Enabled: true
|
2568
|
+
AutoCorrect: contextual
|
2413
2569
|
VersionAdded: '0.21'
|
2414
|
-
VersionChanged: '
|
2570
|
+
VersionChanged: '1.61'
|
2415
2571
|
IgnoreEmptyBlocks: true
|
2416
2572
|
AllowUnusedKeywordArguments: false
|
2417
2573
|
|
@@ -2419,11 +2575,14 @@ Lint/UnusedMethodArgument:
|
|
2419
2575
|
Description: 'Checks for unused method arguments.'
|
2420
2576
|
StyleGuide: '#underscore-unused-vars'
|
2421
2577
|
Enabled: true
|
2578
|
+
AutoCorrect: contextual
|
2422
2579
|
VersionAdded: '0.21'
|
2423
|
-
VersionChanged: '
|
2580
|
+
VersionChanged: '1.69'
|
2424
2581
|
AllowUnusedKeywordArguments: false
|
2425
2582
|
IgnoreEmptyMethods: true
|
2426
2583
|
IgnoreNotImplementedMethods: true
|
2584
|
+
NotImplementedExceptions:
|
2585
|
+
- NotImplementedError
|
2427
2586
|
|
2428
2587
|
Lint/UriEscapeUnescape:
|
2429
2588
|
Description: >-
|
@@ -2444,8 +2603,9 @@ Lint/UriRegexp:
|
|
2444
2603
|
Lint/UselessAccessModifier:
|
2445
2604
|
Description: 'Checks for useless access modifiers.'
|
2446
2605
|
Enabled: true
|
2606
|
+
AutoCorrect: contextual
|
2447
2607
|
VersionAdded: '0.20'
|
2448
|
-
VersionChanged: '
|
2608
|
+
VersionChanged: '1.61'
|
2449
2609
|
ContextCreatingMethods: []
|
2450
2610
|
MethodCreatingMethods: []
|
2451
2611
|
|
@@ -2453,7 +2613,26 @@ Lint/UselessAssignment:
|
|
2453
2613
|
Description: 'Checks for useless assignment to a local variable.'
|
2454
2614
|
StyleGuide: '#underscore-unused-vars'
|
2455
2615
|
Enabled: true
|
2616
|
+
AutoCorrect: contextual
|
2456
2617
|
VersionAdded: '0.11'
|
2618
|
+
VersionChanged: '1.66'
|
2619
|
+
|
2620
|
+
Lint/UselessConstantScoping:
|
2621
|
+
Description: 'Checks for useless constant scoping.'
|
2622
|
+
Enabled: pending
|
2623
|
+
VersionAdded: '1.72'
|
2624
|
+
|
2625
|
+
Lint/UselessDefaultValueArgument:
|
2626
|
+
Description: 'Checks for usage of `fetch` or `Array.new` with default value argument and block.'
|
2627
|
+
Enabled: pending
|
2628
|
+
VersionAdded: '1.76'
|
2629
|
+
Safe: false
|
2630
|
+
AllowedReceivers: []
|
2631
|
+
|
2632
|
+
Lint/UselessDefined:
|
2633
|
+
Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
|
2634
|
+
Enabled: pending
|
2635
|
+
VersionAdded: '1.69'
|
2457
2636
|
|
2458
2637
|
Lint/UselessElseWithoutRescue:
|
2459
2638
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
@@ -2464,10 +2643,21 @@ Lint/UselessElseWithoutRescue:
|
|
2464
2643
|
Lint/UselessMethodDefinition:
|
2465
2644
|
Description: 'Checks for useless method definitions.'
|
2466
2645
|
Enabled: true
|
2646
|
+
AutoCorrect: contextual
|
2467
2647
|
VersionAdded: '0.90'
|
2468
|
-
VersionChanged: '
|
2648
|
+
VersionChanged: '1.61'
|
2469
2649
|
Safe: false
|
2470
2650
|
|
2651
|
+
Lint/UselessNumericOperation:
|
2652
|
+
Description: 'Checks for useless numeric operations.'
|
2653
|
+
Enabled: pending
|
2654
|
+
VersionAdded: '1.66'
|
2655
|
+
|
2656
|
+
Lint/UselessOr:
|
2657
|
+
Description: 'Checks for useless OR expressions.'
|
2658
|
+
Enabled: pending
|
2659
|
+
VersionAdded: '1.76'
|
2660
|
+
|
2471
2661
|
Lint/UselessRescue:
|
2472
2662
|
Description: 'Checks for useless `rescue`s.'
|
2473
2663
|
Enabled: pending
|
@@ -2481,21 +2671,24 @@ Lint/UselessRuby2Keywords:
|
|
2481
2671
|
Lint/UselessSetterCall:
|
2482
2672
|
Description: 'Checks for useless setter call to a local variable.'
|
2483
2673
|
Enabled: true
|
2484
|
-
|
2674
|
+
Safe: false
|
2485
2675
|
VersionAdded: '0.13'
|
2486
2676
|
VersionChanged: '1.2'
|
2487
|
-
Safe: false
|
2488
2677
|
|
2489
2678
|
Lint/UselessTimes:
|
2490
2679
|
Description: 'Checks for useless `Integer#times` calls.'
|
2491
2680
|
Enabled: true
|
2492
|
-
VersionAdded: '0.91'
|
2493
2681
|
Safe: false
|
2682
|
+
AutoCorrect: contextual
|
2683
|
+
VersionAdded: '0.91'
|
2684
|
+
VersionChanged: '1.61'
|
2494
2685
|
|
2495
2686
|
Lint/Void:
|
2496
2687
|
Description: 'Possible use of operator/literal/variable in void context.'
|
2497
2688
|
Enabled: true
|
2689
|
+
AutoCorrect: contextual
|
2498
2690
|
VersionAdded: '0.9'
|
2691
|
+
VersionChanged: '1.61'
|
2499
2692
|
CheckForMethodsWithNoSideEffects: false
|
2500
2693
|
|
2501
2694
|
#################### Metrics ###############################
|
@@ -2504,8 +2697,8 @@ Metrics/AbcSize:
|
|
2504
2697
|
Description: >-
|
2505
2698
|
A calculated magnitude based on number of assignments,
|
2506
2699
|
branches, and conditions.
|
2507
|
-
|
2508
|
-
-
|
2700
|
+
References:
|
2701
|
+
- https://wiki.c2.com/?AbcMetric
|
2509
2702
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
2510
2703
|
Enabled: true
|
2511
2704
|
VersionAdded: '0.27'
|
@@ -2514,7 +2707,6 @@ Metrics/AbcSize:
|
|
2514
2707
|
# a Float.
|
2515
2708
|
AllowedMethods: []
|
2516
2709
|
AllowedPatterns: []
|
2517
|
-
IgnoredMethods: [] # deprecated
|
2518
2710
|
CountRepeatedAttributes: true
|
2519
2711
|
Max: 17
|
2520
2712
|
|
@@ -2526,13 +2718,11 @@ Metrics/BlockLength:
|
|
2526
2718
|
CountComments: false # count full line comments?
|
2527
2719
|
Max: 25
|
2528
2720
|
CountAsOne: []
|
2529
|
-
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2530
2721
|
AllowedMethods:
|
2531
2722
|
# By default, exclude the `#refine` method, as it tends to have larger
|
2532
2723
|
# associated blocks.
|
2533
2724
|
- refine
|
2534
2725
|
AllowedPatterns: []
|
2535
|
-
IgnoredMethods: [] # deprecated
|
2536
2726
|
Exclude:
|
2537
2727
|
- '**/*.gemspec'
|
2538
2728
|
|
@@ -2541,8 +2731,9 @@ Metrics/BlockNesting:
|
|
2541
2731
|
StyleGuide: '#three-is-the-number-thou-shalt-count'
|
2542
2732
|
Enabled: true
|
2543
2733
|
VersionAdded: '0.25'
|
2544
|
-
VersionChanged: '
|
2734
|
+
VersionChanged: '1.65'
|
2545
2735
|
CountBlocks: false
|
2736
|
+
CountModifierForms: false
|
2546
2737
|
Max: 3
|
2547
2738
|
|
2548
2739
|
Metrics/ClassLength:
|
@@ -2554,6 +2745,12 @@ Metrics/ClassLength:
|
|
2554
2745
|
Max: 100
|
2555
2746
|
CountAsOne: []
|
2556
2747
|
|
2748
|
+
Metrics/CollectionLiteralLength:
|
2749
|
+
Description: 'Checks for `Array` or `Hash` literals with many entries.'
|
2750
|
+
Enabled: pending
|
2751
|
+
VersionAdded: '1.47'
|
2752
|
+
LengthThreshold: 250
|
2753
|
+
|
2557
2754
|
# Avoid complex methods.
|
2558
2755
|
Metrics/CyclomaticComplexity:
|
2559
2756
|
Description: >-
|
@@ -2564,7 +2761,6 @@ Metrics/CyclomaticComplexity:
|
|
2564
2761
|
VersionChanged: '0.81'
|
2565
2762
|
AllowedMethods: []
|
2566
2763
|
AllowedPatterns: []
|
2567
|
-
IgnoredMethods: [] # deprecated
|
2568
2764
|
Max: 7
|
2569
2765
|
|
2570
2766
|
Metrics/MethodLength:
|
@@ -2576,10 +2772,8 @@ Metrics/MethodLength:
|
|
2576
2772
|
CountComments: false # count full line comments?
|
2577
2773
|
Max: 10
|
2578
2774
|
CountAsOne: []
|
2579
|
-
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2580
2775
|
AllowedMethods: []
|
2581
2776
|
AllowedPatterns: []
|
2582
|
-
IgnoredMethods: [] # deprecated
|
2583
2777
|
|
2584
2778
|
Metrics/ModuleLength:
|
2585
2779
|
Description: 'Avoid modules longer than 100 lines of code.'
|
@@ -2609,7 +2803,6 @@ Metrics/PerceivedComplexity:
|
|
2609
2803
|
VersionChanged: '0.81'
|
2610
2804
|
AllowedMethods: []
|
2611
2805
|
AllowedPatterns: []
|
2612
|
-
IgnoredMethods: [] # deprecated
|
2613
2806
|
Max: 8
|
2614
2807
|
|
2615
2808
|
################## Migration #############################
|
@@ -2695,7 +2888,8 @@ Naming/FileName:
|
|
2695
2888
|
VersionChanged: '1.23'
|
2696
2889
|
# Camel case file names listed in `AllCops:Include` and all file names listed
|
2697
2890
|
# in `AllCops:Exclude` are excluded by default. Add extra excludes here.
|
2698
|
-
Exclude:
|
2891
|
+
Exclude:
|
2892
|
+
- Rakefile.rb
|
2699
2893
|
# When `true`, requires that each source file should define a class or module
|
2700
2894
|
# with a name which matches the file name (converted to ... case).
|
2701
2895
|
# It further expects it to be nested inside modules which match the names
|
@@ -2780,13 +2974,13 @@ Naming/HeredocDelimiterNaming:
|
|
2780
2974
|
Enabled: true
|
2781
2975
|
VersionAdded: '0.50'
|
2782
2976
|
ForbiddenDelimiters:
|
2783
|
-
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
|
2977
|
+
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/i'
|
2784
2978
|
|
2785
2979
|
Naming/InclusiveLanguage:
|
2786
2980
|
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
2787
2981
|
Enabled: false
|
2788
2982
|
VersionAdded: '1.18'
|
2789
|
-
VersionChanged: '1.
|
2983
|
+
VersionChanged: '1.49'
|
2790
2984
|
CheckIdentifiers: true
|
2791
2985
|
CheckConstants: true
|
2792
2986
|
CheckVariables: true
|
@@ -2827,6 +3021,7 @@ Naming/MethodName:
|
|
2827
3021
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2828
3022
|
Enabled: true
|
2829
3023
|
VersionAdded: '0.50'
|
3024
|
+
VersionChanged: '1.75'
|
2830
3025
|
EnforcedStyle: snake_case
|
2831
3026
|
SupportedStyles:
|
2832
3027
|
- snake_case
|
@@ -2838,7 +3033,10 @@ Naming/MethodName:
|
|
2838
3033
|
# - '\A\s*onSelectionCleared\s*'
|
2839
3034
|
#
|
2840
3035
|
AllowedPatterns: []
|
2841
|
-
|
3036
|
+
ForbiddenIdentifiers:
|
3037
|
+
- __id__
|
3038
|
+
- __send__
|
3039
|
+
ForbiddenPatterns: []
|
2842
3040
|
|
2843
3041
|
Naming/MethodParameterName:
|
2844
3042
|
Description: >-
|
@@ -2870,22 +3068,42 @@ Naming/MethodParameterName:
|
|
2870
3068
|
# Forbidden names that will register an offense
|
2871
3069
|
ForbiddenNames: []
|
2872
3070
|
|
2873
|
-
Naming/
|
2874
|
-
Description: '
|
3071
|
+
Naming/PredicateMethod:
|
3072
|
+
Description: 'Checks that predicate methods end with `?` and non-predicate methods do not.'
|
3073
|
+
Enabled: pending
|
3074
|
+
VersionAdded: '1.76'
|
3075
|
+
VersionChanged: '1.78'
|
3076
|
+
# In `aggressive` mode, the cop will register an offense for predicate methods that
|
3077
|
+
# may return a non-boolean value.
|
3078
|
+
# In `conservative` mode, the cop will *not* register an offense for predicate methods
|
3079
|
+
# that may return a non-boolean value.
|
3080
|
+
Mode: conservative
|
3081
|
+
AllowedMethods:
|
3082
|
+
- call
|
3083
|
+
AllowedPatterns: []
|
3084
|
+
AllowBangMethods: false
|
3085
|
+
# Methods that are known to not return a boolean value, despite ending in `?`.
|
3086
|
+
WaywardPredicates:
|
3087
|
+
- nonzero?
|
3088
|
+
|
3089
|
+
Naming/PredicatePrefix:
|
3090
|
+
Description: 'Predicate method names should not be prefixed and end with a `?`.'
|
2875
3091
|
StyleGuide: '#bool-methods-qmark'
|
2876
3092
|
Enabled: true
|
2877
3093
|
VersionAdded: '0.50'
|
2878
|
-
VersionChanged: '
|
3094
|
+
VersionChanged: '1.75'
|
2879
3095
|
# Predicate name prefixes.
|
2880
3096
|
NamePrefix:
|
2881
3097
|
- is_
|
2882
3098
|
- has_
|
2883
3099
|
- have_
|
3100
|
+
- does_
|
2884
3101
|
# Predicate name prefixes that should be removed.
|
2885
3102
|
ForbiddenPrefixes:
|
2886
3103
|
- is_
|
2887
3104
|
- has_
|
2888
3105
|
- have_
|
3106
|
+
- does_
|
2889
3107
|
# Predicate names which, despite having a forbidden prefix, or no `?`,
|
2890
3108
|
# should still be accepted
|
2891
3109
|
AllowedMethods:
|
@@ -2894,6 +3112,8 @@ Naming/PredicateName:
|
|
2894
3112
|
MethodDefinitionMacros:
|
2895
3113
|
- define_method
|
2896
3114
|
- define_singleton_method
|
3115
|
+
# Use Sorbet's T::Boolean return type to detect predicate methods.
|
3116
|
+
UseSorbetSigs: false
|
2897
3117
|
# Exclude Rspec specs because there is a strong convention to write spec
|
2898
3118
|
# helpers in the form of `have_something` or `be_something`.
|
2899
3119
|
Exclude:
|
@@ -2911,13 +3131,15 @@ Naming/VariableName:
|
|
2911
3131
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2912
3132
|
Enabled: true
|
2913
3133
|
VersionAdded: '0.50'
|
2914
|
-
VersionChanged: '1.
|
3134
|
+
VersionChanged: '1.73'
|
2915
3135
|
EnforcedStyle: snake_case
|
2916
3136
|
SupportedStyles:
|
2917
3137
|
- snake_case
|
2918
3138
|
- camelCase
|
2919
3139
|
AllowedIdentifiers: []
|
2920
3140
|
AllowedPatterns: []
|
3141
|
+
ForbiddenIdentifiers: []
|
3142
|
+
ForbiddenPatterns: []
|
2921
3143
|
|
2922
3144
|
Naming/VariableNumber:
|
2923
3145
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -2933,12 +3155,15 @@ Naming/VariableNumber:
|
|
2933
3155
|
CheckMethodNames: true
|
2934
3156
|
CheckSymbols: true
|
2935
3157
|
AllowedIdentifiers:
|
3158
|
+
- TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
|
3159
|
+
- TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
|
2936
3160
|
- capture3 # Open3.capture3
|
2937
3161
|
- iso8601 # Time#iso8601
|
2938
3162
|
- rfc1123_date # CGI.rfc1123_date
|
2939
3163
|
- rfc822 # Time#rfc822
|
2940
3164
|
- rfc2822 # Time#rfc2822
|
2941
3165
|
- rfc3339 # DateTime.rfc3339
|
3166
|
+
- x86_64 # Allowed by default as an underscore separated CPU architecture name
|
2942
3167
|
AllowedPatterns: []
|
2943
3168
|
|
2944
3169
|
#################### Security ##############################
|
@@ -2946,7 +3171,9 @@ Naming/VariableNumber:
|
|
2946
3171
|
Security/CompoundHash:
|
2947
3172
|
Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
|
2948
3173
|
Enabled: pending
|
3174
|
+
Safe: false
|
2949
3175
|
VersionAdded: '1.28'
|
3176
|
+
VersionChanged: '1.51'
|
2950
3177
|
|
2951
3178
|
Security/Eval:
|
2952
3179
|
Description: 'The use of eval represents a serious security risk.'
|
@@ -2965,7 +3192,8 @@ Security/JSONLoad:
|
|
2965
3192
|
Description: >-
|
2966
3193
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2967
3194
|
security issues. See reference for more information.
|
2968
|
-
|
3195
|
+
References:
|
3196
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2969
3197
|
Enabled: true
|
2970
3198
|
VersionAdded: '0.43'
|
2971
3199
|
VersionChanged: '1.22'
|
@@ -2977,7 +3205,8 @@ Security/MarshalLoad:
|
|
2977
3205
|
Description: >-
|
2978
3206
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2979
3207
|
security issues. See reference for more information.
|
2980
|
-
|
3208
|
+
References:
|
3209
|
+
- 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2981
3210
|
Enabled: true
|
2982
3211
|
VersionAdded: '0.47'
|
2983
3212
|
|
@@ -2992,7 +3221,8 @@ Security/YAMLLoad:
|
|
2992
3221
|
Description: >-
|
2993
3222
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2994
3223
|
security issues. See reference for more information.
|
2995
|
-
|
3224
|
+
References:
|
3225
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2996
3226
|
Enabled: true
|
2997
3227
|
VersionAdded: '0.47'
|
2998
3228
|
SafeAutoCorrect: false
|
@@ -3003,12 +3233,14 @@ Style/AccessModifierDeclarations:
|
|
3003
3233
|
Description: 'Checks style of how access modifiers are used.'
|
3004
3234
|
Enabled: true
|
3005
3235
|
VersionAdded: '0.57'
|
3006
|
-
VersionChanged: '
|
3236
|
+
VersionChanged: '1.70'
|
3007
3237
|
EnforcedStyle: group
|
3008
3238
|
SupportedStyles:
|
3009
3239
|
- inline
|
3010
3240
|
- group
|
3011
3241
|
AllowModifiersOnSymbols: true
|
3242
|
+
AllowModifiersOnAttrs: true
|
3243
|
+
AllowModifiersOnAliasMethod: true
|
3012
3244
|
SafeAutoCorrect: false
|
3013
3245
|
|
3014
3246
|
Style/AccessorGrouping:
|
@@ -3033,6 +3265,12 @@ Style/Alias:
|
|
3033
3265
|
- prefer_alias
|
3034
3266
|
- prefer_alias_method
|
3035
3267
|
|
3268
|
+
Style/AmbiguousEndlessMethodDefinition:
|
3269
|
+
Description: 'Checks for endless methods inside operators of lower precedence.'
|
3270
|
+
StyleGuide: '#ambiguous-endless-method-defintions'
|
3271
|
+
Enabled: pending
|
3272
|
+
VersionAdded: '1.68'
|
3273
|
+
|
3036
3274
|
Style/AndOr:
|
3037
3275
|
Description: 'Use &&/|| instead of and/or.'
|
3038
3276
|
StyleGuide: '#no-and-or-or'
|
@@ -3052,7 +3290,20 @@ Style/ArgumentsForwarding:
|
|
3052
3290
|
StyleGuide: '#arguments-forwarding'
|
3053
3291
|
Enabled: pending
|
3054
3292
|
AllowOnlyRestArgument: true
|
3293
|
+
UseAnonymousForwarding: true
|
3294
|
+
RedundantRestArgumentNames:
|
3295
|
+
- args
|
3296
|
+
- arguments
|
3297
|
+
RedundantKeywordRestArgumentNames:
|
3298
|
+
- kwargs
|
3299
|
+
- options
|
3300
|
+
- opts
|
3301
|
+
RedundantBlockArgumentNames:
|
3302
|
+
- blk
|
3303
|
+
- block
|
3304
|
+
- proc
|
3055
3305
|
VersionAdded: '1.1'
|
3306
|
+
VersionChanged: '1.58'
|
3056
3307
|
|
3057
3308
|
Style/ArrayCoercion:
|
3058
3309
|
Description: >-
|
@@ -3063,9 +3314,18 @@ Style/ArrayCoercion:
|
|
3063
3314
|
Enabled: false
|
3064
3315
|
VersionAdded: '0.88'
|
3065
3316
|
|
3317
|
+
Style/ArrayFirstLast:
|
3318
|
+
Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
|
3319
|
+
References:
|
3320
|
+
- '#first-and-last'
|
3321
|
+
Enabled: false
|
3322
|
+
VersionAdded: '1.58'
|
3323
|
+
Safe: false
|
3324
|
+
|
3066
3325
|
Style/ArrayIntersect:
|
3067
3326
|
Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
|
3068
3327
|
Enabled: 'pending'
|
3328
|
+
Safe: false
|
3069
3329
|
VersionAdded: '1.40'
|
3070
3330
|
|
3071
3331
|
Style/ArrayJoin:
|
@@ -3119,6 +3379,13 @@ Style/BisectedAttrAccessor:
|
|
3119
3379
|
Enabled: true
|
3120
3380
|
VersionAdded: '0.87'
|
3121
3381
|
|
3382
|
+
Style/BitwisePredicate:
|
3383
|
+
Description: 'Prefer bitwise predicate methods over direct comparison operations.'
|
3384
|
+
StyleGuide: '#bitwise-predicate-methods'
|
3385
|
+
Enabled: pending
|
3386
|
+
Safe: false
|
3387
|
+
VersionAdded: '1.68'
|
3388
|
+
|
3122
3389
|
Style/BlockComments:
|
3123
3390
|
Description: 'Do not use block comments.'
|
3124
3391
|
StyleGuide: '#no-block-comments'
|
@@ -3208,7 +3475,6 @@ Style/BlockDelimiters:
|
|
3208
3475
|
- proc
|
3209
3476
|
- it
|
3210
3477
|
AllowedPatterns: []
|
3211
|
-
IgnoredMethods: [] # deprecated
|
3212
3478
|
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
3213
3479
|
# EnforcedStyle is set to `semantic`. If so:
|
3214
3480
|
#
|
@@ -3232,7 +3498,7 @@ Style/BlockDelimiters:
|
|
3232
3498
|
# collection.each do |element| puts element end
|
3233
3499
|
AllowBracesOnProceduralOneLiners: false
|
3234
3500
|
# The BracesRequiredMethods overrides all other configurations except
|
3235
|
-
#
|
3501
|
+
# AllowedMethods. It can be used to enforce that all blocks for specific
|
3236
3502
|
# methods use braces. For example, you can use this to enforce Sorbet
|
3237
3503
|
# signatures use braces even when the rest of your codebase enforces
|
3238
3504
|
# the `line_count_based` style.
|
@@ -3269,6 +3535,9 @@ Style/CaseLikeIf:
|
|
3269
3535
|
Enabled: true
|
3270
3536
|
Safe: false
|
3271
3537
|
VersionAdded: '0.88'
|
3538
|
+
VersionChanged: '1.48'
|
3539
|
+
# `MinBranchesCount` defines the number of branches `if` needs to have to trigger this cop.
|
3540
|
+
MinBranchesCount: 3
|
3272
3541
|
|
3273
3542
|
Style/CharacterLiteral:
|
3274
3543
|
Description: 'Checks for uses of character literals.'
|
@@ -3281,12 +3550,13 @@ Style/ClassAndModuleChildren:
|
|
3281
3550
|
StyleGuide: '#namespace-definition'
|
3282
3551
|
# Moving from compact to nested children requires knowledge of whether the
|
3283
3552
|
# outer parent is a module or a class. Moving from nested to compact requires
|
3284
|
-
# verification that the outer parent is defined elsewhere.
|
3553
|
+
# verification that the outer parent is defined elsewhere. RuboCop does not
|
3285
3554
|
# have the knowledge to perform either operation safely and thus requires
|
3286
3555
|
# manual oversight.
|
3287
3556
|
SafeAutoCorrect: false
|
3288
3557
|
Enabled: true
|
3289
3558
|
VersionAdded: '0.19'
|
3559
|
+
VersionChanged: '1.74'
|
3290
3560
|
#
|
3291
3561
|
# Basically there are two different styles:
|
3292
3562
|
#
|
@@ -3302,7 +3572,21 @@ Style/ClassAndModuleChildren:
|
|
3302
3572
|
#
|
3303
3573
|
# The compact style is only forced, for classes or modules with one child.
|
3304
3574
|
EnforcedStyle: nested
|
3305
|
-
SupportedStyles:
|
3575
|
+
SupportedStyles: &supported_styles
|
3576
|
+
- nested
|
3577
|
+
- compact
|
3578
|
+
# Configure classes separately, if desired. If not set, or set to `nil`,
|
3579
|
+
# the `EnforcedStyle` value will be used.
|
3580
|
+
EnforcedStyleForClasses: ~
|
3581
|
+
SupportedStylesForClasses:
|
3582
|
+
- ~
|
3583
|
+
- nested
|
3584
|
+
- compact
|
3585
|
+
# Configure modules separately, if desired. If not set, or set to `nil`,
|
3586
|
+
# the `EnforcedStyle` value will be used.
|
3587
|
+
EnforcedStyleForModules: ~
|
3588
|
+
SupportedStylesForModules:
|
3589
|
+
- ~
|
3306
3590
|
- nested
|
3307
3591
|
- compact
|
3308
3592
|
|
@@ -3320,13 +3604,14 @@ Style/ClassEqualityComparison:
|
|
3320
3604
|
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
3321
3605
|
StyleGuide: '#instance-of-vs-class-comparison'
|
3322
3606
|
Enabled: true
|
3607
|
+
SafeAutoCorrect: false
|
3323
3608
|
VersionAdded: '0.93'
|
3609
|
+
VersionChanged: '1.57'
|
3324
3610
|
AllowedMethods:
|
3325
3611
|
- ==
|
3326
3612
|
- equal?
|
3327
3613
|
- eql?
|
3328
3614
|
AllowedPatterns: []
|
3329
|
-
IgnoredMethods: [] # deprecated
|
3330
3615
|
|
3331
3616
|
Style/ClassMethods:
|
3332
3617
|
Description: 'Use self when defining module/class methods.'
|
@@ -3357,6 +3642,7 @@ Style/CollectionCompact:
|
|
3357
3642
|
Safe: false
|
3358
3643
|
VersionAdded: '1.2'
|
3359
3644
|
VersionChanged: '1.3'
|
3645
|
+
AllowedReceivers: []
|
3360
3646
|
|
3361
3647
|
# Align with the style guide.
|
3362
3648
|
Style/CollectionMethods:
|
@@ -3375,6 +3661,7 @@ Style/CollectionMethods:
|
|
3375
3661
|
PreferredMethods:
|
3376
3662
|
collect: 'map'
|
3377
3663
|
collect!: 'map!'
|
3664
|
+
collect_concat: 'flat_map'
|
3378
3665
|
inject: 'reduce'
|
3379
3666
|
detect: 'find'
|
3380
3667
|
find_all: 'select'
|
@@ -3385,6 +3672,13 @@ Style/CollectionMethods:
|
|
3385
3672
|
- inject
|
3386
3673
|
- reduce
|
3387
3674
|
|
3675
|
+
Style/CollectionQuerying:
|
3676
|
+
Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
|
3677
|
+
StyleGuide: '#collection-querying'
|
3678
|
+
Enabled: pending
|
3679
|
+
VersionAdded: '1.77'
|
3680
|
+
Safe: false
|
3681
|
+
|
3388
3682
|
Style/ColonMethodCall:
|
3389
3683
|
Description: 'Do not use :: for method call.'
|
3390
3684
|
StyleGuide: '#double-colons'
|
@@ -3397,6 +3691,11 @@ Style/ColonMethodDefinition:
|
|
3397
3691
|
Enabled: true
|
3398
3692
|
VersionAdded: '0.52'
|
3399
3693
|
|
3694
|
+
Style/CombinableDefined:
|
3695
|
+
Description: 'Checks successive `defined?` calls that can be combined into a single call.'
|
3696
|
+
Enabled: pending
|
3697
|
+
VersionAdded: '1.68'
|
3698
|
+
|
3400
3699
|
Style/CombinableLoops:
|
3401
3700
|
Description: >-
|
3402
3701
|
Checks for places where multiple consecutive loops over the same data
|
@@ -3447,6 +3746,14 @@ Style/CommentedKeyword:
|
|
3447
3746
|
VersionAdded: '0.51'
|
3448
3747
|
VersionChanged: '1.19'
|
3449
3748
|
|
3749
|
+
Style/ComparableBetween:
|
3750
|
+
Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
|
3751
|
+
Enabled: pending
|
3752
|
+
Safe: false
|
3753
|
+
VersionAdded: '1.74'
|
3754
|
+
VersionChanged: '1.75'
|
3755
|
+
StyleGuide: '#ranges-or-between'
|
3756
|
+
|
3450
3757
|
Style/ComparableClamp:
|
3451
3758
|
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
3452
3759
|
Enabled: pending
|
@@ -3513,6 +3820,14 @@ Style/Copyright:
|
|
3513
3820
|
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
3514
3821
|
AutocorrectNotice: ''
|
3515
3822
|
|
3823
|
+
Style/DataInheritance:
|
3824
|
+
Description: 'Checks for inheritance from Data.define.'
|
3825
|
+
StyleGuide: '#no-extend-data-define'
|
3826
|
+
Enabled: pending
|
3827
|
+
SafeAutoCorrect: false
|
3828
|
+
VersionAdded: '1.49'
|
3829
|
+
VersionChanged: '1.51'
|
3830
|
+
|
3516
3831
|
Style/DateTime:
|
3517
3832
|
Description: 'Use Time over DateTime.'
|
3518
3833
|
StyleGuide: '#date-time'
|
@@ -3529,6 +3844,12 @@ Style/DefWithParentheses:
|
|
3529
3844
|
VersionAdded: '0.9'
|
3530
3845
|
VersionChanged: '0.12'
|
3531
3846
|
|
3847
|
+
Style/DigChain:
|
3848
|
+
Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
|
3849
|
+
Enabled: pending
|
3850
|
+
Safe: false
|
3851
|
+
VersionAdded: '1.69'
|
3852
|
+
|
3532
3853
|
Style/Dir:
|
3533
3854
|
Description: >-
|
3534
3855
|
Use the `__dir__` method to retrieve the canonicalized
|
@@ -3536,6 +3857,12 @@ Style/Dir:
|
|
3536
3857
|
Enabled: true
|
3537
3858
|
VersionAdded: '0.50'
|
3538
3859
|
|
3860
|
+
Style/DirEmpty:
|
3861
|
+
Description: >-
|
3862
|
+
Prefer to use `Dir.empty?('path/to/dir')` when checking if a directory is empty.
|
3863
|
+
Enabled: pending
|
3864
|
+
VersionAdded: '1.48'
|
3865
|
+
|
3539
3866
|
Style/DisableCopsWithinSourceCodeDirective:
|
3540
3867
|
Description: >-
|
3541
3868
|
Forbids disabling/enabling cops within source code.
|
@@ -3566,6 +3893,7 @@ Style/DocumentationMethod:
|
|
3566
3893
|
Description: 'Checks for missing documentation comment for public methods.'
|
3567
3894
|
Enabled: false
|
3568
3895
|
VersionAdded: '0.43'
|
3896
|
+
AllowedMethods: []
|
3569
3897
|
Exclude:
|
3570
3898
|
- 'spec/**/*'
|
3571
3899
|
- 'test/**/*'
|
@@ -3614,8 +3942,9 @@ Style/EmptyCaseCondition:
|
|
3614
3942
|
Style/EmptyElse:
|
3615
3943
|
Description: 'Avoid empty else-clauses.'
|
3616
3944
|
Enabled: true
|
3945
|
+
AutoCorrect: contextual
|
3617
3946
|
VersionAdded: '0.28'
|
3618
|
-
VersionChanged: '
|
3947
|
+
VersionChanged: '1.61'
|
3619
3948
|
EnforcedStyle: both
|
3620
3949
|
# empty - warn only on empty `else`
|
3621
3950
|
# nil - warn on `else` with nil in it
|
@@ -3629,7 +3958,9 @@ Style/EmptyElse:
|
|
3629
3958
|
Style/EmptyHeredoc:
|
3630
3959
|
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
3631
3960
|
Enabled: pending
|
3961
|
+
AutoCorrect: contextual
|
3632
3962
|
VersionAdded: '1.32'
|
3963
|
+
VersionChanged: '1.61'
|
3633
3964
|
|
3634
3965
|
Style/EmptyLambdaParameter:
|
3635
3966
|
Description: 'Omit parens for empty lambda parameters.'
|
@@ -3647,12 +3978,24 @@ Style/EmptyMethod:
|
|
3647
3978
|
Description: 'Checks the formatting of empty method definitions.'
|
3648
3979
|
StyleGuide: '#no-single-line-methods'
|
3649
3980
|
Enabled: true
|
3981
|
+
AutoCorrect: contextual
|
3650
3982
|
VersionAdded: '0.46'
|
3983
|
+
VersionChanged: '1.61'
|
3651
3984
|
EnforcedStyle: compact
|
3652
3985
|
SupportedStyles:
|
3653
3986
|
- compact
|
3654
3987
|
- expanded
|
3655
3988
|
|
3989
|
+
Style/EmptyStringInsideInterpolation:
|
3990
|
+
Description: 'Checks for empty strings being assigned inside string interpolation.'
|
3991
|
+
StyleGuide: '#empty-strings-in-interpolation'
|
3992
|
+
Enabled: pending
|
3993
|
+
EnforcedStyle: trailing_conditional
|
3994
|
+
SupportedStyles:
|
3995
|
+
- trailing_conditional
|
3996
|
+
- ternary
|
3997
|
+
VersionAdded: '1.76'
|
3998
|
+
|
3656
3999
|
Style/Encoding:
|
3657
4000
|
Description: 'Use UTF-8 as the source file encoding.'
|
3658
4001
|
StyleGuide: '#utf-8'
|
@@ -3677,6 +4020,8 @@ Style/EndlessMethod:
|
|
3677
4020
|
- allow_single_line
|
3678
4021
|
- allow_always
|
3679
4022
|
- disallow
|
4023
|
+
- require_single_line
|
4024
|
+
- require_always
|
3680
4025
|
|
3681
4026
|
Style/EnvHome:
|
3682
4027
|
Description: "Checks for consistent usage of `ENV['HOME']`."
|
@@ -3696,6 +4041,11 @@ Style/EvenOdd:
|
|
3696
4041
|
VersionAdded: '0.12'
|
3697
4042
|
VersionChanged: '0.29'
|
3698
4043
|
|
4044
|
+
Style/ExactRegexpMatch:
|
4045
|
+
Description: 'Checks for exact regexp match inside Regexp literals.'
|
4046
|
+
Enabled: pending
|
4047
|
+
VersionAdded: '1.51'
|
4048
|
+
|
3699
4049
|
Style/ExpandPathArguments:
|
3700
4050
|
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
|
3701
4051
|
Enabled: true
|
@@ -3724,12 +4074,28 @@ Style/ExponentialNotation:
|
|
3724
4074
|
Style/FetchEnvVar:
|
3725
4075
|
Description: >-
|
3726
4076
|
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
3727
|
-
|
4077
|
+
References:
|
3728
4078
|
- https://rubystyle.guide/#hash-fetch-defaults
|
3729
4079
|
Enabled: pending
|
3730
4080
|
VersionAdded: '1.28'
|
3731
4081
|
# Environment variables to be excluded from the inspection.
|
3732
4082
|
AllowedVars: []
|
4083
|
+
# When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
|
4084
|
+
# When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
|
4085
|
+
DefaultToNil: true
|
4086
|
+
|
4087
|
+
Style/FileEmpty:
|
4088
|
+
Description: >-
|
4089
|
+
Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
|
4090
|
+
Enabled: pending
|
4091
|
+
Safe: false
|
4092
|
+
VersionAdded: '1.48'
|
4093
|
+
|
4094
|
+
Style/FileNull:
|
4095
|
+
Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
|
4096
|
+
Enabled: pending
|
4097
|
+
SafeAutoCorrect: false
|
4098
|
+
VersionAdded: '1.69'
|
3733
4099
|
|
3734
4100
|
Style/FileRead:
|
3735
4101
|
Description: 'Favor `File.(bin)read` convenience methods.'
|
@@ -3737,6 +4103,12 @@ Style/FileRead:
|
|
3737
4103
|
Enabled: pending
|
3738
4104
|
VersionAdded: '1.24'
|
3739
4105
|
|
4106
|
+
Style/FileTouch:
|
4107
|
+
Description: 'Favor `FileUtils.touch` for touching files.'
|
4108
|
+
Enabled: pending
|
4109
|
+
VersionAdded: '1.69'
|
4110
|
+
SafeAutoCorrect: false
|
4111
|
+
|
3740
4112
|
Style/FileWrite:
|
3741
4113
|
Description: 'Favor `File.(bin)write` convenience methods.'
|
3742
4114
|
StyleGuide: '#file-write'
|
@@ -3746,7 +4118,8 @@ Style/FileWrite:
|
|
3746
4118
|
Style/FloatDivision:
|
3747
4119
|
Description: 'For performing float division, coerce one side only.'
|
3748
4120
|
StyleGuide: '#float-division'
|
3749
|
-
|
4121
|
+
References:
|
4122
|
+
- 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3750
4123
|
Enabled: true
|
3751
4124
|
VersionAdded: '0.72'
|
3752
4125
|
VersionChanged: '1.9'
|
@@ -3797,11 +4170,16 @@ Style/FormatStringToken:
|
|
3797
4170
|
# style token in a format string to be allowed when enforced style is not
|
3798
4171
|
# `unannotated`.
|
3799
4172
|
MaxUnannotatedPlaceholdersAllowed: 1
|
4173
|
+
# The mode the cop operates in. Two values are allowed:
|
4174
|
+
# * aggressive (default): all strings are considered
|
4175
|
+
# * conservative:
|
4176
|
+
# only register offenses for strings given to `printf`, `sprintf`,
|
4177
|
+
# format` and `%` methods. Other strings are not considered.
|
4178
|
+
Mode: aggressive
|
3800
4179
|
VersionAdded: '0.49'
|
3801
|
-
VersionChanged: '1.
|
4180
|
+
VersionChanged: '1.74'
|
3802
4181
|
AllowedMethods: []
|
3803
4182
|
AllowedPatterns: []
|
3804
|
-
IgnoredMethods: [] # deprecated
|
3805
4183
|
|
3806
4184
|
Style/FrozenStringLiteralComment:
|
3807
4185
|
Description: >-
|
@@ -3824,6 +4202,9 @@ Style/FrozenStringLiteralComment:
|
|
3824
4202
|
# exist in a file.
|
3825
4203
|
- never
|
3826
4204
|
SafeAutoCorrect: false
|
4205
|
+
Exclude:
|
4206
|
+
# Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
|
4207
|
+
- '**/*.arb'
|
3827
4208
|
|
3828
4209
|
Style/GlobalStdStream:
|
3829
4210
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
@@ -3835,7 +4216,8 @@ Style/GlobalStdStream:
|
|
3835
4216
|
Style/GlobalVars:
|
3836
4217
|
Description: 'Do not introduce global variables.'
|
3837
4218
|
StyleGuide: '#instance-vars'
|
3838
|
-
|
4219
|
+
References:
|
4220
|
+
- 'https://www.zenspider.com/ruby/quickref.html'
|
3839
4221
|
Enabled: true
|
3840
4222
|
VersionAdded: '0.13'
|
3841
4223
|
# Built-in global variables are allowed by default.
|
@@ -3868,8 +4250,9 @@ Style/HashConversion:
|
|
3868
4250
|
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3869
4251
|
StyleGuide: '#avoid-hash-constructor'
|
3870
4252
|
Enabled: pending
|
4253
|
+
SafeAutoCorrect: false
|
3871
4254
|
VersionAdded: '1.10'
|
3872
|
-
VersionChanged: '1.
|
4255
|
+
VersionChanged: '1.55'
|
3873
4256
|
AllowSplatArgument: true
|
3874
4257
|
|
3875
4258
|
Style/HashEachMethods:
|
@@ -3891,6 +4274,12 @@ Style/HashExcept:
|
|
3891
4274
|
VersionAdded: '1.7'
|
3892
4275
|
VersionChanged: '1.39'
|
3893
4276
|
|
4277
|
+
Style/HashFetchChain:
|
4278
|
+
Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
|
4279
|
+
Enabled: pending
|
4280
|
+
Safe: false
|
4281
|
+
VersionAdded: '1.75'
|
4282
|
+
|
3894
4283
|
Style/HashLikeCase:
|
3895
4284
|
Description: >-
|
3896
4285
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -3901,6 +4290,14 @@ Style/HashLikeCase:
|
|
3901
4290
|
# to trigger this cop
|
3902
4291
|
MinBranchesCount: 3
|
3903
4292
|
|
4293
|
+
Style/HashSlice:
|
4294
|
+
Description: >-
|
4295
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
4296
|
+
that can be replaced with `Hash#slice` method.
|
4297
|
+
Enabled: pending
|
4298
|
+
Safe: false
|
4299
|
+
VersionAdded: '1.71'
|
4300
|
+
|
3904
4301
|
Style/HashSyntax:
|
3905
4302
|
Description: >-
|
3906
4303
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -3908,7 +4305,7 @@ Style/HashSyntax:
|
|
3908
4305
|
StyleGuide: '#hash-literals'
|
3909
4306
|
Enabled: true
|
3910
4307
|
VersionAdded: '0.9'
|
3911
|
-
VersionChanged: '1.
|
4308
|
+
VersionChanged: '1.67'
|
3912
4309
|
EnforcedStyle: ruby19
|
3913
4310
|
SupportedStyles:
|
3914
4311
|
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
@@ -3920,7 +4317,7 @@ Style/HashSyntax:
|
|
3920
4317
|
# enforces both ruby19 and no_mixed_keys styles
|
3921
4318
|
- ruby19_no_mixed_keys
|
3922
4319
|
# Force hashes that have a hash value omission
|
3923
|
-
EnforcedShorthandSyntax:
|
4320
|
+
EnforcedShorthandSyntax: either
|
3924
4321
|
SupportedShorthandSyntax:
|
3925
4322
|
# forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
|
3926
4323
|
- always
|
@@ -3930,6 +4327,8 @@ Style/HashSyntax:
|
|
3930
4327
|
- either
|
3931
4328
|
# forces use of the 3.1 syntax only if all values can be omitted in the hash.
|
3932
4329
|
- consistent
|
4330
|
+
# allow either (implicit or explicit) syntax but enforce consistency within a single hash
|
4331
|
+
- either_consistent
|
3933
4332
|
# Force hashes that have a symbol value to use hash rockets
|
3934
4333
|
UseHashRocketsWithSymbolValues: false
|
3935
4334
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
@@ -4042,10 +4441,6 @@ Style/InverseMethods:
|
|
4042
4441
|
:=~: :!~
|
4043
4442
|
:<: :>=
|
4044
4443
|
:>: :<=
|
4045
|
-
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
4046
|
-
# and not enabled by default.
|
4047
|
-
# :present?: :blank?,
|
4048
|
-
# :include?: :exclude?
|
4049
4444
|
# `InverseBlocks` are methods that are inverted by inverting the return
|
4050
4445
|
# of the block that is passed to the method
|
4051
4446
|
InverseBlocks:
|
@@ -4055,7 +4450,9 @@ Style/InverseMethods:
|
|
4055
4450
|
Style/InvertibleUnlessCondition:
|
4056
4451
|
Description: 'Favor `if` with inverted condition over `unless`.'
|
4057
4452
|
Enabled: false
|
4453
|
+
Safe: false
|
4058
4454
|
VersionAdded: '1.44'
|
4455
|
+
VersionChanged: '1.50'
|
4059
4456
|
# `InverseMethods` are methods that can be inverted in a `unless` condition.
|
4060
4457
|
# The relationship of inverse methods needs to be defined in both directions.
|
4061
4458
|
# Keys and values both need to be defined as symbols.
|
@@ -4072,14 +4469,6 @@ Style/InvertibleUnlessCondition:
|
|
4072
4469
|
:none?: :any?
|
4073
4470
|
:even?: :odd?
|
4074
4471
|
:odd?: :even?
|
4075
|
-
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
4076
|
-
# and not enabled by default.
|
4077
|
-
# :present?: :blank?
|
4078
|
-
# :blank?: :present?
|
4079
|
-
# :include?: :exclude?
|
4080
|
-
# :exclude?: :include?
|
4081
|
-
# :one?: :many?
|
4082
|
-
# :many?: :one?
|
4083
4472
|
|
4084
4473
|
Style/IpAddresses:
|
4085
4474
|
Description: "Don't include literal IP addresses in code."
|
@@ -4096,6 +4485,31 @@ Style/IpAddresses:
|
|
4096
4485
|
- '**/gems.rb'
|
4097
4486
|
- '**/*.gemspec'
|
4098
4487
|
|
4488
|
+
Style/ItAssignment:
|
4489
|
+
Description: 'Checks for assignment to `it` inside a block.'
|
4490
|
+
Enabled: pending
|
4491
|
+
VersionAdded: '1.70'
|
4492
|
+
|
4493
|
+
Style/ItBlockParameter:
|
4494
|
+
Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
|
4495
|
+
Enabled: pending
|
4496
|
+
EnforcedStyle: allow_single_line
|
4497
|
+
SupportedStyles:
|
4498
|
+
- allow_single_line
|
4499
|
+
- only_numbered_parameters
|
4500
|
+
- always
|
4501
|
+
- disallow
|
4502
|
+
VersionAdded: '1.75'
|
4503
|
+
VersionChanged: '1.76'
|
4504
|
+
|
4505
|
+
Style/KeywordArgumentsMerging:
|
4506
|
+
Description: >-
|
4507
|
+
When passing an existing hash as keyword arguments, provide additional arguments
|
4508
|
+
directly rather than using `merge`.
|
4509
|
+
StyleGuide: '#merging-keyword-arguments'
|
4510
|
+
Enabled: pending
|
4511
|
+
VersionAdded: '1.68'
|
4512
|
+
|
4099
4513
|
Style/KeywordParametersOrder:
|
4100
4514
|
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
4101
4515
|
StyleGuide: '#keyword-parameters-order'
|
@@ -4160,6 +4574,14 @@ Style/MapCompactWithConditionalBlock:
|
|
4160
4574
|
Enabled: pending
|
4161
4575
|
VersionAdded: '1.30'
|
4162
4576
|
|
4577
|
+
Style/MapIntoArray:
|
4578
|
+
Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
|
4579
|
+
StyleGuide: '#functional-code'
|
4580
|
+
Enabled: pending
|
4581
|
+
VersionAdded: '1.63'
|
4582
|
+
VersionChanged: '1.67'
|
4583
|
+
Safe: false
|
4584
|
+
|
4163
4585
|
Style/MapToHash:
|
4164
4586
|
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
4165
4587
|
Enabled: pending
|
@@ -4180,9 +4602,7 @@ Style/MethodCallWithArgsParentheses:
|
|
4180
4602
|
VersionChanged: '1.7'
|
4181
4603
|
IgnoreMacros: true
|
4182
4604
|
AllowedMethods: []
|
4183
|
-
IgnoredMethods: [] # deprecated
|
4184
4605
|
AllowedPatterns: []
|
4185
|
-
IgnoredPatterns: [] # deprecated
|
4186
4606
|
IncludedMacros: []
|
4187
4607
|
AllowParenthesesInMultilineCall: false
|
4188
4608
|
AllowParenthesesInChaining: false
|
@@ -4199,7 +4619,6 @@ Style/MethodCallWithoutArgsParentheses:
|
|
4199
4619
|
Enabled: true
|
4200
4620
|
AllowedMethods: []
|
4201
4621
|
AllowedPatterns: []
|
4202
|
-
IgnoredMethods: [] # deprecated
|
4203
4622
|
VersionAdded: '0.47'
|
4204
4623
|
VersionChanged: '0.55'
|
4205
4624
|
|
@@ -4359,6 +4778,7 @@ Style/MultipleComparison:
|
|
4359
4778
|
VersionAdded: '0.49'
|
4360
4779
|
VersionChanged: '1.1'
|
4361
4780
|
AllowMethodComparison: true
|
4781
|
+
ComparisonsThreshold: 2
|
4362
4782
|
|
4363
4783
|
Style/MutableConstant:
|
4364
4784
|
Description: 'Do not assign mutable objects to constants.'
|
@@ -4470,7 +4890,7 @@ Style/Next:
|
|
4470
4890
|
StyleGuide: '#no-nested-conditionals'
|
4471
4891
|
Enabled: true
|
4472
4892
|
VersionAdded: '0.22'
|
4473
|
-
VersionChanged: '
|
4893
|
+
VersionChanged: '1.75'
|
4474
4894
|
# With `always` all conditions at the end of an iteration needs to be
|
4475
4895
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
4476
4896
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
@@ -4478,6 +4898,7 @@ Style/Next:
|
|
4478
4898
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
4479
4899
|
# needs to have to trigger this cop
|
4480
4900
|
MinBodyLength: 3
|
4901
|
+
AllowConsecutiveConditionals: false
|
4481
4902
|
SupportedStyles:
|
4482
4903
|
- skip_modifier_ifs
|
4483
4904
|
- always
|
@@ -4564,11 +4985,10 @@ Style/NumericPredicate:
|
|
4564
4985
|
Checks for the use of predicate- or comparison methods for
|
4565
4986
|
numeric comparisons.
|
4566
4987
|
StyleGuide: '#predicate-methods'
|
4567
|
-
Safe: false
|
4568
4988
|
# This will change to a new method call which isn't guaranteed to be on the
|
4569
4989
|
# object. Switching these methods has to be done with knowledge of the types
|
4570
4990
|
# of the variables which rubocop doesn't have.
|
4571
|
-
|
4991
|
+
Safe: false
|
4572
4992
|
Enabled: true
|
4573
4993
|
VersionAdded: '0.42'
|
4574
4994
|
VersionChanged: '0.59'
|
@@ -4578,7 +4998,6 @@ Style/NumericPredicate:
|
|
4578
4998
|
- comparison
|
4579
4999
|
AllowedMethods: []
|
4580
5000
|
AllowedPatterns: []
|
4581
|
-
IgnoredMethods: [] # deprecated
|
4582
5001
|
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
4583
5002
|
# false positives.
|
4584
5003
|
Exclude:
|
@@ -4611,11 +5030,13 @@ Style/OpenStructUse:
|
|
4611
5030
|
Description: >-
|
4612
5031
|
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
4613
5032
|
version compatibility, and potential security issues.
|
4614
|
-
|
4615
|
-
- https://docs.ruby-lang.org/en/3.0
|
5033
|
+
References:
|
5034
|
+
- https://docs.ruby-lang.org/en/3.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4616
5035
|
|
4617
5036
|
Enabled: pending
|
5037
|
+
Safe: false
|
4618
5038
|
VersionAdded: '1.23'
|
5039
|
+
VersionChanged: '1.51'
|
4619
5040
|
|
4620
5041
|
Style/OperatorMethodCall:
|
4621
5042
|
Description: 'Checks for redundant dot before operator method call.'
|
@@ -4625,6 +5046,7 @@ Style/OperatorMethodCall:
|
|
4625
5046
|
|
4626
5047
|
Style/OptionHash:
|
4627
5048
|
Description: "Don't use option hashes when you can use keyword arguments."
|
5049
|
+
StyleGuide: '#keyword-arguments-vs-option-hashes'
|
4628
5050
|
Enabled: false
|
4629
5051
|
VersionAdded: '0.33'
|
4630
5052
|
VersionChanged: '0.34'
|
@@ -4747,8 +5169,9 @@ Style/RaiseArgs:
|
|
4747
5169
|
Description: 'Checks the arguments passed to raise/fail.'
|
4748
5170
|
StyleGuide: '#exception-class-messages'
|
4749
5171
|
Enabled: true
|
5172
|
+
Safe: false
|
4750
5173
|
VersionAdded: '0.14'
|
4751
|
-
VersionChanged: '1.
|
5174
|
+
VersionChanged: '1.61'
|
4752
5175
|
EnforcedStyle: exploded
|
4753
5176
|
SupportedStyles:
|
4754
5177
|
- compact # raise Exception.new(msg)
|
@@ -4768,12 +5191,16 @@ Style/RedundantArgument:
|
|
4768
5191
|
Enabled: pending
|
4769
5192
|
Safe: false
|
4770
5193
|
VersionAdded: '1.4'
|
4771
|
-
VersionChanged: '1.
|
5194
|
+
VersionChanged: '1.55'
|
4772
5195
|
Methods:
|
4773
5196
|
# Array#join
|
4774
5197
|
join: ''
|
4775
5198
|
# Array#sum
|
4776
5199
|
sum: 0
|
5200
|
+
# Kernel.#exit
|
5201
|
+
exit: true
|
5202
|
+
# Kernel.#exit!
|
5203
|
+
exit!: false
|
4777
5204
|
# String#split
|
4778
5205
|
split: ' '
|
4779
5206
|
# String#chomp
|
@@ -4781,6 +5208,17 @@ Style/RedundantArgument:
|
|
4781
5208
|
# String#chomp!
|
4782
5209
|
chomp!: "\n"
|
4783
5210
|
|
5211
|
+
Style/RedundantArrayConstructor:
|
5212
|
+
Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
|
5213
|
+
Enabled: pending
|
5214
|
+
VersionAdded: '1.52'
|
5215
|
+
|
5216
|
+
Style/RedundantArrayFlatten:
|
5217
|
+
Description: 'Checks for redundant calls of `Array#flatten`.'
|
5218
|
+
Enabled: pending
|
5219
|
+
Safe: false
|
5220
|
+
VersionAdded: '1.76'
|
5221
|
+
|
4784
5222
|
Style/RedundantAssignment:
|
4785
5223
|
Description: 'Checks for redundant assignment before returning.'
|
4786
5224
|
Enabled: true
|
@@ -4802,6 +5240,9 @@ Style/RedundantCondition:
|
|
4802
5240
|
Description: 'Checks for unnecessary conditional expressions.'
|
4803
5241
|
Enabled: true
|
4804
5242
|
VersionAdded: '0.76'
|
5243
|
+
VersionChanged: '1.73'
|
5244
|
+
AllowedMethods:
|
5245
|
+
- nonzero?
|
4805
5246
|
|
4806
5247
|
Style/RedundantConditional:
|
4807
5248
|
Description: "Don't return true/false from a conditional."
|
@@ -4813,6 +5254,11 @@ Style/RedundantConstantBase:
|
|
4813
5254
|
Enabled: pending
|
4814
5255
|
VersionAdded: '1.40'
|
4815
5256
|
|
5257
|
+
Style/RedundantCurrentDirectoryInPath:
|
5258
|
+
Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
|
5259
|
+
Enabled: pending
|
5260
|
+
VersionAdded: '1.53'
|
5261
|
+
|
4816
5262
|
Style/RedundantDoubleSplatHashBraces:
|
4817
5263
|
Description: 'Checks for redundant uses of double splat hash braces.'
|
4818
5264
|
Enabled: pending
|
@@ -4835,7 +5281,8 @@ Style/RedundantFetchBlock:
|
|
4835
5281
|
Description: >-
|
4836
5282
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
4837
5283
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
4838
|
-
|
5284
|
+
References:
|
5285
|
+
- 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
4839
5286
|
Enabled: true
|
4840
5287
|
Safe: false
|
4841
5288
|
# If enabled, this cop will autocorrect usages of
|
@@ -4852,19 +5299,41 @@ Style/RedundantFileExtensionInRequire:
|
|
4852
5299
|
Enabled: true
|
4853
5300
|
VersionAdded: '0.88'
|
4854
5301
|
|
5302
|
+
Style/RedundantFilterChain:
|
5303
|
+
Description: >-
|
5304
|
+
Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
|
5305
|
+
`select`/`filter`/`find_all` and change them to use predicate method instead.
|
5306
|
+
Enabled: pending
|
5307
|
+
SafeAutoCorrect: false
|
5308
|
+
VersionAdded: '1.52'
|
5309
|
+
VersionChanged: '1.57'
|
5310
|
+
|
5311
|
+
Style/RedundantFormat:
|
5312
|
+
Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
|
5313
|
+
Enabled: pending
|
5314
|
+
SafeAutoCorrect: false
|
5315
|
+
VersionAdded: '1.72'
|
5316
|
+
VersionChanged: '1.72'
|
5317
|
+
|
4855
5318
|
Style/RedundantFreeze:
|
4856
5319
|
Description: "Checks usages of Object#freeze on immutable objects."
|
4857
5320
|
Enabled: true
|
4858
5321
|
VersionAdded: '0.34'
|
4859
5322
|
VersionChanged: '0.66'
|
4860
5323
|
|
5324
|
+
Style/RedundantHeredocDelimiterQuotes:
|
5325
|
+
Description: 'Checks for redundant heredoc delimiter quotes.'
|
5326
|
+
Enabled: pending
|
5327
|
+
VersionAdded: '1.45'
|
5328
|
+
|
4861
5329
|
Style/RedundantInitialize:
|
4862
5330
|
Description: 'Checks for redundant `initialize` methods.'
|
4863
5331
|
Enabled: pending
|
5332
|
+
AutoCorrect: contextual
|
4864
5333
|
Safe: false
|
4865
5334
|
AllowComments: true
|
4866
5335
|
VersionAdded: '1.27'
|
4867
|
-
VersionChanged: '1.
|
5336
|
+
VersionChanged: '1.61'
|
4868
5337
|
|
4869
5338
|
Style/RedundantInterpolation:
|
4870
5339
|
Description: 'Checks for strings that are just an interpolated expression.'
|
@@ -4873,6 +5342,16 @@ Style/RedundantInterpolation:
|
|
4873
5342
|
VersionAdded: '0.76'
|
4874
5343
|
VersionChanged: '1.30'
|
4875
5344
|
|
5345
|
+
Style/RedundantInterpolationUnfreeze:
|
5346
|
+
Description: 'Checks for redundant unfreezing of interpolated strings.'
|
5347
|
+
Enabled: pending
|
5348
|
+
VersionAdded: '1.66'
|
5349
|
+
|
5350
|
+
Style/RedundantLineContinuation:
|
5351
|
+
Description: 'Check for redundant line continuation.'
|
5352
|
+
Enabled: pending
|
5353
|
+
VersionAdded: '1.49'
|
5354
|
+
|
4876
5355
|
Style/RedundantParentheses:
|
4877
5356
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
4878
5357
|
Enabled: true
|
@@ -4884,11 +5363,21 @@ Style/RedundantPercentQ:
|
|
4884
5363
|
Enabled: true
|
4885
5364
|
VersionAdded: '0.76'
|
4886
5365
|
|
5366
|
+
Style/RedundantRegexpArgument:
|
5367
|
+
Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
|
5368
|
+
Enabled: pending
|
5369
|
+
VersionAdded: '1.53'
|
5370
|
+
|
4887
5371
|
Style/RedundantRegexpCharacterClass:
|
4888
5372
|
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
4889
5373
|
Enabled: true
|
4890
5374
|
VersionAdded: '0.85'
|
4891
5375
|
|
5376
|
+
Style/RedundantRegexpConstructor:
|
5377
|
+
Description: 'Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.'
|
5378
|
+
Enabled: pending
|
5379
|
+
VersionAdded: '1.52'
|
5380
|
+
|
4892
5381
|
Style/RedundantRegexpEscape:
|
4893
5382
|
Description: 'Checks for redundant escapes in Regexps.'
|
4894
5383
|
Enabled: true
|
@@ -4991,6 +5480,16 @@ Style/ReturnNil:
|
|
4991
5480
|
- return_nil
|
4992
5481
|
VersionAdded: '0.50'
|
4993
5482
|
|
5483
|
+
Style/ReturnNilInPredicateMethodDefinition:
|
5484
|
+
Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
|
5485
|
+
StyleGuide: '#bool-methods-qmark'
|
5486
|
+
Enabled: pending
|
5487
|
+
SafeAutoCorrect: false
|
5488
|
+
AllowedMethods: []
|
5489
|
+
AllowedPatterns: []
|
5490
|
+
VersionAdded: '1.53'
|
5491
|
+
VersionChanged: '1.67'
|
5492
|
+
|
4994
5493
|
Style/SafeNavigation:
|
4995
5494
|
Description: >-
|
4996
5495
|
Transforms usages of a method call safeguarded by
|
@@ -5000,7 +5499,7 @@ Style/SafeNavigation:
|
|
5000
5499
|
be `nil` or truthy, but never `false`.
|
5001
5500
|
Enabled: true
|
5002
5501
|
VersionAdded: '0.43'
|
5003
|
-
VersionChanged: '1.
|
5502
|
+
VersionChanged: '1.67'
|
5004
5503
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
5005
5504
|
# to whatever it used to return.
|
5006
5505
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -5014,11 +5513,19 @@ Style/SafeNavigation:
|
|
5014
5513
|
# Maximum length of method chains for register an offense.
|
5015
5514
|
MaxChainLength: 2
|
5016
5515
|
|
5516
|
+
Style/SafeNavigationChainLength:
|
5517
|
+
Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
|
5518
|
+
StyleGuide: '#safe-navigation'
|
5519
|
+
Enabled: pending
|
5520
|
+
VersionAdded: '1.68'
|
5521
|
+
Max: 2
|
5522
|
+
|
5017
5523
|
Style/Sample:
|
5018
5524
|
Description: >-
|
5019
5525
|
Use `sample` instead of `shuffle.first`,
|
5020
5526
|
`shuffle.last`, and `shuffle[Integer]`.
|
5021
|
-
|
5527
|
+
References:
|
5528
|
+
- 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
5022
5529
|
Enabled: true
|
5023
5530
|
VersionAdded: '0.30'
|
5024
5531
|
|
@@ -5052,6 +5559,13 @@ Style/Send:
|
|
5052
5559
|
Enabled: false
|
5053
5560
|
VersionAdded: '0.33'
|
5054
5561
|
|
5562
|
+
Style/SendWithLiteralMethodName:
|
5563
|
+
Description: 'Detects the use of the `public_send` method with a static method name argument.'
|
5564
|
+
Enabled: pending
|
5565
|
+
Safe: false
|
5566
|
+
AllowSend: true
|
5567
|
+
VersionAdded: '1.64'
|
5568
|
+
|
5055
5569
|
Style/SignalException:
|
5056
5570
|
Description: 'Checks for proper usage of fail and raise.'
|
5057
5571
|
StyleGuide: '#prefer-raise-over-fail'
|
@@ -5083,6 +5597,12 @@ Style/SingleLineBlockParams:
|
|
5083
5597
|
- acc
|
5084
5598
|
- elem
|
5085
5599
|
|
5600
|
+
Style/SingleLineDoEndBlock:
|
5601
|
+
Description: 'Checks for single-line `do`...`end` blocks.'
|
5602
|
+
StyleGuide: '#single-line-do-end-block'
|
5603
|
+
Enabled: pending
|
5604
|
+
VersionAdded: '1.57'
|
5605
|
+
|
5086
5606
|
Style/SingleLineMethods:
|
5087
5607
|
Description: 'Avoid single-line methods.'
|
5088
5608
|
StyleGuide: '#no-single-line-methods'
|
@@ -5092,7 +5612,8 @@ Style/SingleLineMethods:
|
|
5092
5612
|
AllowIfMethodIsEmpty: true
|
5093
5613
|
|
5094
5614
|
Style/SlicingWithRange:
|
5095
|
-
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
5615
|
+
Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
|
5616
|
+
StyleGuide: '#slicing-with-ranges'
|
5096
5617
|
Enabled: true
|
5097
5618
|
VersionAdded: '0.83'
|
5098
5619
|
Safe: false
|
@@ -5219,6 +5740,17 @@ Style/StructInheritance:
|
|
5219
5740
|
VersionAdded: '0.29'
|
5220
5741
|
VersionChanged: '1.20'
|
5221
5742
|
|
5743
|
+
Style/SuperArguments:
|
5744
|
+
Description: 'Call `super` without arguments and parentheses when the signature is identical.'
|
5745
|
+
Enabled: pending
|
5746
|
+
VersionAdded: '1.64'
|
5747
|
+
|
5748
|
+
Style/SuperWithArgsParentheses:
|
5749
|
+
Description: 'Use parentheses for `super` with arguments.'
|
5750
|
+
StyleGuide: '#super-with-args'
|
5751
|
+
Enabled: pending
|
5752
|
+
VersionAdded: '1.58'
|
5753
|
+
|
5222
5754
|
Style/SwapValues:
|
5223
5755
|
Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
|
5224
5756
|
StyleGuide: '#values-swapping'
|
@@ -5248,14 +5780,13 @@ Style/SymbolProc:
|
|
5248
5780
|
Enabled: true
|
5249
5781
|
Safe: false
|
5250
5782
|
VersionAdded: '0.26'
|
5251
|
-
VersionChanged: '1.
|
5783
|
+
VersionChanged: '1.64'
|
5252
5784
|
AllowMethodsWithArguments: false
|
5253
5785
|
# A list of method names to be always allowed by the check.
|
5254
5786
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
5255
5787
|
AllowedMethods:
|
5256
5788
|
- define_method
|
5257
5789
|
AllowedPatterns: []
|
5258
|
-
IgnoredMethods: [] # deprecated
|
5259
5790
|
AllowComments: false
|
5260
5791
|
|
5261
5792
|
Style/TernaryParentheses:
|
@@ -5311,14 +5842,17 @@ Style/TrailingCommaInArrayLiteral:
|
|
5311
5842
|
StyleGuide: '#no-trailing-array-commas'
|
5312
5843
|
Enabled: true
|
5313
5844
|
VersionAdded: '0.53'
|
5314
|
-
# If `comma`, the cop requires a comma after the last item in an array,
|
5315
|
-
#
|
5316
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5317
|
-
#
|
5845
|
+
# If `comma`, the cop requires a comma after the last item in an array, but only when each item is
|
5846
|
+
# on its own line.
|
5847
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5848
|
+
# array literals.
|
5849
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
|
5850
|
+
# literals, but only when that last item immediately precedes a newline.
|
5318
5851
|
EnforcedStyleForMultiline: no_comma
|
5319
5852
|
SupportedStylesForMultiline:
|
5320
5853
|
- comma
|
5321
5854
|
- consistent_comma
|
5855
|
+
- diff_comma
|
5322
5856
|
- no_comma
|
5323
5857
|
|
5324
5858
|
Style/TrailingCommaInBlockArgs:
|
@@ -5330,14 +5864,17 @@ Style/TrailingCommaInBlockArgs:
|
|
5330
5864
|
Style/TrailingCommaInHashLiteral:
|
5331
5865
|
Description: 'Checks for trailing comma in hash literals.'
|
5332
5866
|
Enabled: true
|
5333
|
-
# If `comma`, the cop requires a comma after the last item in a hash,
|
5334
|
-
#
|
5335
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5336
|
-
#
|
5867
|
+
# If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
|
5868
|
+
# on its own line.
|
5869
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5870
|
+
# hash literals.
|
5871
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
|
5872
|
+
# literals, but only when that last item immediately precedes a newline.
|
5337
5873
|
EnforcedStyleForMultiline: no_comma
|
5338
5874
|
SupportedStylesForMultiline:
|
5339
5875
|
- comma
|
5340
5876
|
- consistent_comma
|
5877
|
+
- diff_comma
|
5341
5878
|
- no_comma
|
5342
5879
|
VersionAdded: '0.53'
|
5343
5880
|
|
@@ -5476,9 +6013,15 @@ Style/WordArray:
|
|
5476
6013
|
# The regular expression `WordRegex` decides what is considered a word.
|
5477
6014
|
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
5478
6015
|
|
6016
|
+
Style/YAMLFileRead:
|
6017
|
+
Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
|
6018
|
+
Enabled: pending
|
6019
|
+
VersionAdded: '1.53'
|
6020
|
+
|
5479
6021
|
Style/YodaCondition:
|
5480
6022
|
Description: 'Forbid or enforce yoda conditions.'
|
5481
|
-
|
6023
|
+
References:
|
6024
|
+
- 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
5482
6025
|
Enabled: true
|
5483
6026
|
EnforcedStyle: forbid_for_all_comparison_operators
|
5484
6027
|
SupportedStyles:
|