rubocop 1.79.2 → 1.88.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 +2 -2
- data/config/default.yml +259 -90
- data/config/obsoletion.yml +30 -1
- data/exe/rubocop +1 -8
- data/lib/rubocop/cache_config.rb +29 -0
- data/lib/rubocop/cli/command/auto_generate_config.rb +36 -4
- data/lib/rubocop/cli/command/list_enabled_cops_for.rb +40 -0
- data/lib/rubocop/cli/command/lsp.rb +1 -1
- data/lib/rubocop/cli/command/mcp.rb +19 -0
- data/lib/rubocop/cli/command/show_cops.rb +2 -2
- data/lib/rubocop/cli/command/show_docs_url.rb +4 -8
- data/lib/rubocop/cli/command/suggest_extensions.rb +1 -1
- data/lib/rubocop/cli.rb +35 -9
- data/lib/rubocop/comment_config.rb +59 -17
- data/lib/rubocop/config.rb +14 -10
- data/lib/rubocop/config_finder.rb +1 -1
- data/lib/rubocop/config_loader.rb +37 -23
- data/lib/rubocop/config_loader_resolver.rb +20 -10
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -2
- data/lib/rubocop/config_store.rb +7 -2
- data/lib/rubocop/config_validator.rb +1 -1
- data/lib/rubocop/cop/autocorrect_logic.rb +10 -5
- data/lib/rubocop/cop/base.rb +25 -4
- data/lib/rubocop/cop/bundler/gem_comment.rb +2 -2
- data/lib/rubocop/cop/bundler/gem_version.rb +28 -28
- data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -2
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +26 -7
- data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +7 -2
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +1 -5
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +33 -2
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors.rb +28 -0
- data/lib/rubocop/cop/documentation.rb +2 -3
- data/lib/rubocop/cop/exclude_limit.rb +31 -5
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +2 -2
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -2
- data/lib/rubocop/cop/gemspec/require_mfa.rb +5 -5
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +12 -7
- data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +8 -8
- data/lib/rubocop/cop/internal_affairs/itblock_handler.rb +69 -0
- data/lib/rubocop/cop/internal_affairs/location_exists.rb +28 -2
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +9 -9
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +3 -1
- data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +5 -3
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +4 -4
- data/lib/rubocop/cop/internal_affairs.rb +1 -0
- data/lib/rubocop/cop/layout/argument_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +41 -4
- data/lib/rubocop/cop/layout/case_indentation.rb +3 -1
- data/lib/rubocop/cop/layout/class_structure.rb +14 -7
- data/lib/rubocop/cop/layout/dot_position.rb +2 -2
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +26 -7
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +31 -13
- data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +1 -0
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +12 -2
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +16 -2
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +16 -2
- data/lib/rubocop/cop/layout/end_alignment.rb +10 -3
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +34 -1
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +26 -0
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +7 -1
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +25 -25
- data/lib/rubocop/cop/layout/hash_alignment.rb +3 -6
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -2
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +33 -3
- data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +123 -7
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/line_length.rb +26 -9
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +57 -57
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +9 -2
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +2 -0
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +56 -56
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +229 -39
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +8 -4
- data/lib/rubocop/cop/layout/parameter_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/redundant_line_break.rb +3 -1
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +13 -3
- data/lib/rubocop/cop/layout/space_after_comma.rb +2 -10
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +4 -2
- data/lib/rubocop/cop/layout/space_before_brackets.rb +1 -1
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +9 -8
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -11
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +1 -10
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +45 -3
- data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +4 -3
- data/lib/rubocop/cop/lint/constant_reassignment.rb +93 -11
- data/lib/rubocop/cop/lint/constant_resolution.rb +6 -6
- data/lib/rubocop/cop/lint/cop_directive_syntax.rb +14 -8
- data/lib/rubocop/cop/lint/data_define_override.rb +63 -0
- data/lib/rubocop/cop/lint/debugger.rb +0 -3
- data/lib/rubocop/cop/lint/deprecated_constants.rb +2 -8
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +4 -1
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +4 -4
- data/lib/rubocop/cop/lint/duplicate_methods.rb +111 -12
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +5 -42
- data/lib/rubocop/cop/lint/else_layout.rb +19 -0
- data/lib/rubocop/cop/lint/empty_block.rb +4 -4
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +6 -1
- data/lib/rubocop/cop/lint/empty_in_pattern.rb +8 -1
- data/lib/rubocop/cop/lint/empty_interpolation.rb +11 -0
- data/lib/rubocop/cop/lint/empty_when.rb +8 -1
- data/lib/rubocop/cop/lint/ensure_return.rb +19 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +4 -2
- data/lib/rubocop/cop/lint/float_comparison.rb +2 -1
- data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -1
- data/lib/rubocop/cop/lint/interpolation_check.rb +25 -5
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
- data/lib/rubocop/cop/lint/literal_as_condition.rb +5 -1
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +11 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +9 -12
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +19 -10
- data/lib/rubocop/cop/lint/multiple_comparison.rb +2 -2
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +2 -0
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +20 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +4 -2
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +19 -10
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +3 -0
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +7 -7
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +3 -13
- data/lib/rubocop/cop/lint/raise_exception.rb +1 -1
- data/lib/rubocop/cop/lint/rand_one.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +27 -10
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +6 -12
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +15 -4
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +4 -2
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +36 -12
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +12 -2
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +10 -3
- data/lib/rubocop/cop/lint/redundant_with_index.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_with_object.rb +5 -0
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +8 -1
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +9 -1
- data/lib/rubocop/cop/lint/require_parentheses.rb +13 -4
- data/lib/rubocop/cop/lint/require_range_parentheses.rb +2 -1
- data/lib/rubocop/cop/lint/require_relative_self_path.rb +7 -5
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -4
- data/lib/rubocop/cop/lint/rescue_type.rb +1 -1
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +18 -0
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +7 -1
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
- data/lib/rubocop/cop/lint/script_permission.rb +5 -1
- data/lib/rubocop/cop/lint/self_assignment.rb +39 -7
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -1
- data/lib/rubocop/cop/lint/shadowed_argument.rb +7 -7
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +14 -0
- data/lib/rubocop/cop/lint/shared_mutable_default.rb +3 -1
- data/lib/rubocop/cop/lint/struct_new_override.rb +17 -1
- data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +12 -0
- data/lib/rubocop/cop/lint/symbol_conversion.rb +21 -4
- data/lib/rubocop/cop/lint/syntax.rb +25 -1
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +28 -1
- data/lib/rubocop/cop/lint/to_json.rb +12 -16
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +5 -1
- data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +4 -2
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +1 -0
- data/lib/rubocop/cop/lint/unreachable_code.rb +7 -5
- data/lib/rubocop/cop/lint/unreachable_pattern_branch.rb +113 -0
- data/lib/rubocop/cop/lint/unused_method_argument.rb +10 -0
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +2 -0
- data/lib/rubocop/cop/lint/useless_assignment.rb +53 -25
- data/lib/rubocop/cop/lint/useless_constant_scoping.rb +4 -4
- data/lib/rubocop/cop/lint/useless_default_value_argument.rb +2 -0
- data/lib/rubocop/cop/lint/useless_or.rb +15 -2
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +8 -4
- data/lib/rubocop/cop/lint/useless_setter_call.rb +4 -1
- data/lib/rubocop/cop/lint/useless_times.rb +22 -1
- data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +37 -11
- data/lib/rubocop/cop/lint/void.rb +39 -12
- data/lib/rubocop/cop/message_annotator.rb +1 -1
- data/lib/rubocop/cop/metrics/block_length.rb +1 -1
- data/lib/rubocop/cop/metrics/block_nesting.rb +23 -0
- data/lib/rubocop/cop/metrics/collection_literal_length.rb +1 -1
- data/lib/rubocop/cop/metrics/method_length.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +4 -3
- data/lib/rubocop/cop/metrics/utils/iterating_block.rb +1 -1
- data/lib/rubocop/cop/migration/department_name.rb +12 -1
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +2 -2
- data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +4 -6
- data/lib/rubocop/cop/mixin/code_length.rb +1 -1
- data/lib/rubocop/cop/mixin/configurable_max.rb +6 -5
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -7
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +5 -5
- data/lib/rubocop/cop/mixin/hash_transform_method/autocorrection.rb +63 -0
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +10 -60
- data/lib/rubocop/cop/mixin/line_length_help.rb +21 -2
- data/lib/rubocop/cop/mixin/method_complexity.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -1
- data/lib/rubocop/cop/mixin/project_index_help.rb +48 -0
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +5 -4
- data/lib/rubocop/cop/mixin/statement_modifier.rb +0 -6
- data/lib/rubocop/cop/mixin/trailing_comma.rb +8 -5
- data/lib/rubocop/cop/mixin.rb +86 -0
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +1 -1
- data/lib/rubocop/cop/naming/method_name.rb +5 -3
- data/lib/rubocop/cop/naming/predicate_method.rb +32 -8
- data/lib/rubocop/cop/naming/predicate_prefix.rb +12 -12
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +1 -1
- data/lib/rubocop/cop/offense.rb +17 -1
- data/lib/rubocop/cop/registry.rb +62 -38
- data/lib/rubocop/cop/security/eval.rb +15 -2
- data/lib/rubocop/cop/security/io_methods.rb +1 -1
- data/lib/rubocop/cop/security/json_load.rb +33 -11
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +15 -4
- data/lib/rubocop/cop/style/accessor_grouping.rb +4 -2
- data/lib/rubocop/cop/style/alias.rb +15 -3
- data/lib/rubocop/cop/style/and_or.rb +2 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +25 -7
- data/lib/rubocop/cop/style/array_first_last.rb +12 -1
- data/lib/rubocop/cop/style/array_intersect.rb +50 -12
- data/lib/rubocop/cop/style/array_intersect_with_single_element.rb +50 -0
- data/lib/rubocop/cop/style/array_join.rb +4 -2
- data/lib/rubocop/cop/style/ascii_comments.rb +6 -3
- data/lib/rubocop/cop/style/attr.rb +5 -2
- data/lib/rubocop/cop/style/bare_percent_literals.rb +4 -3
- data/lib/rubocop/cop/style/begin_block.rb +3 -1
- data/lib/rubocop/cop/style/bitwise_predicate.rb +8 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +39 -32
- data/lib/rubocop/cop/style/case_equality.rb +29 -15
- data/lib/rubocop/cop/style/character_literal.rb +2 -2
- data/lib/rubocop/cop/style/class_and_module_children.rb +19 -2
- data/lib/rubocop/cop/style/class_equality_comparison.rb +21 -13
- data/lib/rubocop/cop/style/class_methods_definitions.rb +11 -5
- data/lib/rubocop/cop/style/collection_compact.rb +36 -16
- data/lib/rubocop/cop/style/colon_method_call.rb +16 -7
- data/lib/rubocop/cop/style/combinable_loops.rb +5 -0
- data/lib/rubocop/cop/style/comparable_clamp.rb +12 -1
- data/lib/rubocop/cop/style/concat_array_literals.rb +7 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +14 -19
- data/lib/rubocop/cop/style/constant_visibility.rb +20 -12
- data/lib/rubocop/cop/style/copyright.rb +22 -11
- data/lib/rubocop/cop/style/date_time.rb +4 -4
- data/lib/rubocop/cop/style/dig_chain.rb +5 -0
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +1 -1
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +6 -1
- data/lib/rubocop/cop/style/documentation.rb +6 -6
- data/lib/rubocop/cop/style/documentation_method.rb +8 -8
- data/lib/rubocop/cop/style/double_negation.rb +1 -1
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -1
- data/lib/rubocop/cop/style/each_with_object.rb +2 -0
- data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
- data/lib/rubocop/cop/style/empty_class_definition.rb +119 -0
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
- data/lib/rubocop/cop/style/empty_method.rb +0 -6
- data/lib/rubocop/cop/style/encoding.rb +7 -1
- data/lib/rubocop/cop/style/end_block.rb +3 -1
- data/lib/rubocop/cop/style/endless_method.rb +23 -5
- data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -1
- data/lib/rubocop/cop/style/fetch_env_var.rb +1 -1
- data/lib/rubocop/cop/style/file_open.rb +84 -0
- data/lib/rubocop/cop/style/file_write.rb +21 -16
- data/lib/rubocop/cop/style/float_division.rb +15 -1
- data/lib/rubocop/cop/style/for.rb +3 -0
- data/lib/rubocop/cop/style/format_string.rb +4 -3
- data/lib/rubocop/cop/style/format_string_token.rb +49 -5
- data/lib/rubocop/cop/style/global_vars.rb +5 -2
- data/lib/rubocop/cop/style/guard_clause.rb +27 -22
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +27 -9
- data/lib/rubocop/cop/style/hash_conversion.rb +1 -1
- data/lib/rubocop/cop/style/hash_lookup_method.rb +106 -0
- data/lib/rubocop/cop/style/hash_slice.rb +16 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +1 -1
- data/lib/rubocop/cop/style/hash_transform_keys.rb +17 -7
- data/lib/rubocop/cop/style/hash_transform_values.rb +17 -7
- data/lib/rubocop/cop/style/if_inside_else.rb +16 -7
- data/lib/rubocop/cop/style/if_unless_modifier.rb +58 -18
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +12 -12
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +4 -1
- data/lib/rubocop/cop/style/if_with_semicolon.rb +7 -5
- data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
- data/lib/rubocop/cop/style/inline_comment.rb +4 -1
- data/lib/rubocop/cop/style/ip_addresses.rb +1 -2
- data/lib/rubocop/cop/style/lambda_call.rb +8 -8
- data/lib/rubocop/cop/style/magic_comment_format.rb +3 -3
- data/lib/rubocop/cop/style/map_join.rb +123 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +15 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +17 -4
- data/lib/rubocop/cop/style/method_def_parentheses.rb +2 -4
- data/lib/rubocop/cop/style/min_max_comparison.rb +1 -1
- data/lib/rubocop/cop/style/module_member_existence_check.rb +110 -0
- data/lib/rubocop/cop/style/multiline_if_then.rb +4 -4
- data/lib/rubocop/cop/style/multiline_method_signature.rb +2 -4
- data/lib/rubocop/cop/style/mutable_constant.rb +106 -12
- data/lib/rubocop/cop/style/negative_array_index.rb +220 -0
- data/lib/rubocop/cop/style/nil_comparison.rb +11 -10
- data/lib/rubocop/cop/style/nil_lambda.rb +1 -1
- data/lib/rubocop/cop/style/non_nil_check.rb +5 -11
- data/lib/rubocop/cop/style/not.rb +2 -0
- data/lib/rubocop/cop/style/numeric_literals.rb +3 -2
- data/lib/rubocop/cop/style/one_class_per_file.rb +115 -0
- data/lib/rubocop/cop/style/one_line_conditional.rb +21 -12
- data/lib/rubocop/cop/style/operator_method_call.rb +11 -2
- data/lib/rubocop/cop/style/parallel_assignment.rb +14 -3
- data/lib/rubocop/cop/style/partition_instead_of_double_select.rb +270 -0
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +2 -0
- data/lib/rubocop/cop/style/predicate_with_kind.rb +84 -0
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +12 -12
- data/lib/rubocop/cop/style/proc.rb +3 -2
- data/lib/rubocop/cop/style/raise_args.rb +1 -1
- data/lib/rubocop/cop/style/reduce_to_hash.rb +200 -0
- data/lib/rubocop/cop/style/redundant_argument.rb +2 -0
- data/lib/rubocop/cop/style/redundant_array_constructor.rb +2 -2
- data/lib/rubocop/cop/style/redundant_begin.rb +37 -3
- data/lib/rubocop/cop/style/redundant_condition.rb +6 -3
- data/lib/rubocop/cop/style/redundant_constant_base.rb +5 -5
- data/lib/rubocop/cop/style/redundant_each.rb +3 -3
- data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +1 -1
- data/lib/rubocop/cop/style/redundant_format.rb +27 -5
- data/lib/rubocop/cop/style/redundant_interpolation.rb +11 -2
- data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +26 -10
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +16 -0
- data/lib/rubocop/cop/style/redundant_min_max_by.rb +93 -0
- data/lib/rubocop/cop/style/redundant_parentheses.rb +36 -30
- data/lib/rubocop/cop/style/redundant_percent_q.rb +5 -3
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +9 -0
- data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +2 -2
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +8 -0
- data/lib/rubocop/cop/style/redundant_return.rb +3 -1
- data/lib/rubocop/cop/style/redundant_self.rb +2 -2
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +0 -5
- data/lib/rubocop/cop/style/redundant_sort.rb +7 -7
- data/lib/rubocop/cop/style/redundant_struct_keyword_init.rb +114 -0
- data/lib/rubocop/cop/style/regexp_literal.rb +31 -2
- data/lib/rubocop/cop/style/rescue_modifier.rb +3 -3
- data/lib/rubocop/cop/style/reverse_find.rb +51 -0
- data/lib/rubocop/cop/style/safe_navigation.rb +25 -8
- data/lib/rubocop/cop/style/select_by_kind.rb +158 -0
- data/lib/rubocop/cop/style/select_by_range.rb +197 -0
- data/lib/rubocop/cop/style/select_by_regexp.rb +51 -21
- data/lib/rubocop/cop/style/self_assignment.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +41 -8
- data/lib/rubocop/cop/style/single_line_block_params.rb +2 -2
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +1 -1
- data/lib/rubocop/cop/style/single_line_methods.rb +3 -1
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +12 -3
- data/lib/rubocop/cop/style/special_global_vars.rb +6 -1
- data/lib/rubocop/cop/style/string_concatenation.rb +17 -13
- data/lib/rubocop/cop/style/struct_inheritance.rb +13 -0
- data/lib/rubocop/cop/style/super_arguments.rb +2 -2
- data/lib/rubocop/cop/style/symbol_array.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +7 -6
- data/lib/rubocop/cop/style/tally_method.rb +181 -0
- data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -2
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +45 -0
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +1 -0
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +11 -11
- data/lib/rubocop/cop/style/unless_else.rb +10 -9
- data/lib/rubocop/cop/style/unless_logical_operators.rb +3 -3
- data/lib/rubocop/cop/style/while_until_do.rb +7 -0
- data/lib/rubocop/cop/style/while_until_modifier.rb +16 -0
- data/lib/rubocop/cop/style/word_array.rb +1 -0
- data/lib/rubocop/cop/style/yoda_condition.rb +1 -1
- data/lib/rubocop/cop/style/yoda_expression.rb +1 -1
- data/lib/rubocop/cop/style/zero_length_predicate.rb +6 -3
- data/lib/rubocop/cop/team.rb +87 -36
- data/lib/rubocop/cop/util.rb +2 -3
- data/lib/rubocop/cop/utils/format_string.rb +10 -0
- data/lib/rubocop/cop/variable_force/branch.rb +30 -6
- data/lib/rubocop/cop/variable_force/variable.rb +1 -1
- data/lib/rubocop/cop/variable_force.rb +9 -7
- data/lib/rubocop/cops_documentation_generator.rb +4 -4
- data/lib/rubocop/directive_comment.rb +48 -4
- data/lib/rubocop/file_patterns.rb +9 -1
- data/lib/rubocop/formatter/clang_style_formatter.rb +5 -2
- data/lib/rubocop/formatter/disabled_config_formatter.rb +38 -14
- data/lib/rubocop/formatter/formatter_set.rb +2 -2
- data/lib/rubocop/formatter/junit_formatter.rb +1 -1
- data/lib/rubocop/formatter/simple_text_formatter.rb +0 -2
- data/lib/rubocop/formatter/tap_formatter.rb +5 -2
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -1
- data/lib/rubocop/formatter.rb +22 -21
- data/lib/rubocop/lsp/diagnostic.rb +18 -33
- data/lib/rubocop/lsp/disable_comment_edits.rb +135 -0
- data/lib/rubocop/lsp/routes.rb +43 -7
- data/lib/rubocop/lsp/runtime.rb +13 -4
- data/lib/rubocop/lsp/stdin_runner.rb +8 -17
- data/lib/rubocop/magic_comment.rb +20 -0
- data/lib/rubocop/mcp/server.rb +200 -0
- data/lib/rubocop/options.rb +35 -4
- data/lib/rubocop/path_util.rb +14 -2
- data/lib/rubocop/plugin/loader.rb +1 -1
- data/lib/rubocop/project_index_loader.rb +66 -0
- data/lib/rubocop/rake_task.rb +1 -1
- data/lib/rubocop/remote_config.rb +10 -8
- data/lib/rubocop/result_cache.rb +61 -38
- data/lib/rubocop/rspec/cop_helper.rb +8 -0
- data/lib/rubocop/rspec/shared_contexts.rb +39 -5
- data/lib/rubocop/rspec/support.rb +2 -1
- data/lib/rubocop/runner.rb +134 -57
- data/lib/rubocop/server/cache.rb +6 -29
- data/lib/rubocop/server/core.rb +8 -0
- data/lib/rubocop/target_finder.rb +17 -10
- data/lib/rubocop/target_ruby.rb +31 -14
- data/lib/rubocop/version.rb +21 -3
- data/lib/rubocop.rb +28 -96
- data/lib/ruby_lsp/rubocop/addon.rb +23 -8
- data/lib/ruby_lsp/rubocop/runtime_adapter.rb +49 -15
- metadata +38 -9
data/config/default.yml
CHANGED
|
@@ -3,20 +3,16 @@
|
|
|
3
3
|
AllCops:
|
|
4
4
|
RubyInterpreters:
|
|
5
5
|
- ruby
|
|
6
|
-
- macruby
|
|
7
6
|
- rake
|
|
8
7
|
- jruby
|
|
9
|
-
- rbx
|
|
10
8
|
# Include common Ruby source files.
|
|
11
9
|
Include:
|
|
12
10
|
- '**/*.rb'
|
|
13
11
|
- '**/*.arb'
|
|
14
12
|
- '**/*.axlsx'
|
|
15
13
|
- '**/*.builder'
|
|
16
|
-
- '**/*.fcgi'
|
|
17
14
|
- '**/*.gemfile'
|
|
18
15
|
- '**/*.gemspec'
|
|
19
|
-
- '**/*.god'
|
|
20
16
|
- '**/*.jb'
|
|
21
17
|
- '**/*.jbuilder'
|
|
22
18
|
- '**/*.mspec'
|
|
@@ -25,15 +21,12 @@ AllCops:
|
|
|
25
21
|
- '**/*.podspec'
|
|
26
22
|
- '**/*.rabl'
|
|
27
23
|
- '**/*.rake'
|
|
28
|
-
- '**/*.rbuild'
|
|
29
24
|
- '**/*.rbw'
|
|
30
|
-
- '**/*.rbx'
|
|
31
25
|
- '**/*.ru'
|
|
32
26
|
- '**/*.ruby'
|
|
33
27
|
- '**/*.schema'
|
|
34
28
|
- '**/*.spec'
|
|
35
29
|
- '**/*.thor'
|
|
36
|
-
- '**/*.watchr'
|
|
37
30
|
- '**/.irbrc'
|
|
38
31
|
- '**/.pryrc'
|
|
39
32
|
- '**/.simplecov'
|
|
@@ -43,7 +36,6 @@ AllCops:
|
|
|
43
36
|
- '**/Brewfile'
|
|
44
37
|
- '**/Buildfile'
|
|
45
38
|
- '**/Capfile'
|
|
46
|
-
- '**/Cheffile'
|
|
47
39
|
- '**/Dangerfile'
|
|
48
40
|
- '**/Deliverfile'
|
|
49
41
|
- '**/Fastfile'
|
|
@@ -60,7 +52,6 @@ AllCops:
|
|
|
60
52
|
- '**/Snapfile'
|
|
61
53
|
- '**/Steepfile'
|
|
62
54
|
- '**/Thorfile'
|
|
63
|
-
- '**/Vagabondfile'
|
|
64
55
|
- '**/Vagrantfile'
|
|
65
56
|
Exclude:
|
|
66
57
|
- 'node_modules/**/*'
|
|
@@ -113,11 +104,17 @@ AllCops:
|
|
|
113
104
|
# When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
|
|
114
105
|
# the `--disable-pending-cops` command-line option.
|
|
115
106
|
NewCops: pending
|
|
107
|
+
# When `true`, RuboCop builds a project index (a project-wide map of declarations and references)
|
|
108
|
+
# once per run and makes it available to cops that opt in.
|
|
109
|
+
# The project index is implemented by the optional `rubydex` gem; when `rubydex` is not installed,
|
|
110
|
+
# a warning is shown and the flag has no effect.
|
|
111
|
+
# The default `false` preserves RuboCop's traditional file-local analysis.
|
|
112
|
+
UseProjectIndex: false
|
|
116
113
|
# Enables the result cache if `true`. Can be overridden by the `--cache` command
|
|
117
114
|
# line option.
|
|
118
115
|
UseCache: true
|
|
119
116
|
# Threshold for how many files can be stored in the result cache before some
|
|
120
|
-
# of the files are automatically removed.
|
|
117
|
+
# of the files are automatically removed. Set to false to disable cache pruning.
|
|
121
118
|
MaxFilesInCache: 20000
|
|
122
119
|
# The cache will be stored in "rubocop_cache" under this directory. If
|
|
123
120
|
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
|
@@ -203,12 +200,12 @@ Bundler/GemComment:
|
|
|
203
200
|
Description: 'Add a comment describing each gem.'
|
|
204
201
|
Enabled: false
|
|
205
202
|
VersionAdded: '0.59'
|
|
206
|
-
VersionChanged: '
|
|
203
|
+
VersionChanged: '1.88'
|
|
207
204
|
Include:
|
|
208
205
|
- '**/*.gemfile'
|
|
209
206
|
- '**/Gemfile'
|
|
210
207
|
- '**/gems.rb'
|
|
211
|
-
|
|
208
|
+
AllowedGems: []
|
|
212
209
|
OnlyFor: []
|
|
213
210
|
|
|
214
211
|
Bundler/GemFilename:
|
|
@@ -275,7 +272,7 @@ Gemspec/AddRuntimeDependency:
|
|
|
275
272
|
Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
|
|
276
273
|
StyleGuide: '#add_dependency_vs_add_runtime_dependency'
|
|
277
274
|
References:
|
|
278
|
-
- https://github.com/
|
|
275
|
+
- https://github.com/ruby/rubygems/issues/7799#issuecomment-2192720316
|
|
279
276
|
Enabled: pending
|
|
280
277
|
VersionAdded: '1.65'
|
|
281
278
|
Include:
|
|
@@ -375,7 +372,7 @@ Gemspec/RubyVersionGlobalsUsage:
|
|
|
375
372
|
Include:
|
|
376
373
|
- '**/*.gemspec'
|
|
377
374
|
|
|
378
|
-
#################### Layout
|
|
375
|
+
#################### Layout ################################
|
|
379
376
|
|
|
380
377
|
Layout/AccessModifierIndentation:
|
|
381
378
|
Description: Checks indentation of private/protected visibility modifiers.
|
|
@@ -493,7 +490,7 @@ Layout/BlockEndNewline:
|
|
|
493
490
|
VersionAdded: '0.49'
|
|
494
491
|
|
|
495
492
|
Layout/CaseIndentation:
|
|
496
|
-
Description: '
|
|
493
|
+
Description: 'Checks how the `when` and `in` clauses of a `case` expression are indented.'
|
|
497
494
|
StyleGuide: '#indent-when-to-case'
|
|
498
495
|
Enabled: true
|
|
499
496
|
VersionAdded: '0.49'
|
|
@@ -538,15 +535,22 @@ Layout/ClosingParenthesisIndentation:
|
|
|
538
535
|
Description: 'Checks the indentation of hanging closing parentheses.'
|
|
539
536
|
Enabled: true
|
|
540
537
|
VersionAdded: '0.49'
|
|
538
|
+
VersionChanged: '1.86'
|
|
539
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
|
540
|
+
# but it can be overridden by setting this parameter.
|
|
541
|
+
IndentationWidth: ~
|
|
541
542
|
|
|
542
543
|
Layout/CommentIndentation:
|
|
543
|
-
Description: '
|
|
544
|
+
Description: 'Checks the indentation of comments.'
|
|
544
545
|
Enabled: true
|
|
546
|
+
VersionAdded: '0.49'
|
|
547
|
+
VersionChanged: '1.86'
|
|
545
548
|
# When true, allows comments to have extra indentation if that aligns them
|
|
546
549
|
# with a comment on the preceding line.
|
|
547
550
|
AllowForAlignment: false
|
|
548
|
-
|
|
549
|
-
|
|
551
|
+
# By default the indentation width from `Layout/IndentationWidth` is used,
|
|
552
|
+
# but it can be overridden by setting this parameter.
|
|
553
|
+
IndentationWidth: ~
|
|
550
554
|
|
|
551
555
|
Layout/ConditionPosition:
|
|
552
556
|
Description: >-
|
|
@@ -835,6 +839,7 @@ Layout/FirstArrayElementLineBreak:
|
|
|
835
839
|
multi-line array.
|
|
836
840
|
Enabled: false
|
|
837
841
|
VersionAdded: '0.49'
|
|
842
|
+
AllowImplicitArrayLiterals: false
|
|
838
843
|
AllowMultilineFinalElement: false
|
|
839
844
|
|
|
840
845
|
Layout/FirstHashElementIndentation:
|
|
@@ -907,9 +912,9 @@ Layout/HashAlignment:
|
|
|
907
912
|
Align the elements of a hash literal if they span more than
|
|
908
913
|
one line.
|
|
909
914
|
Enabled: true
|
|
910
|
-
AllowMultipleStyles: true
|
|
911
915
|
VersionAdded: '0.49'
|
|
912
916
|
VersionChanged: '1.16'
|
|
917
|
+
AllowMultipleStyles: true
|
|
913
918
|
# Alignment of entries using hash rocket as separator. Valid values are:
|
|
914
919
|
#
|
|
915
920
|
# key - left alignment of keys
|
|
@@ -984,8 +989,8 @@ Layout/HeredocArgumentClosingParenthesis:
|
|
|
984
989
|
Description: >-
|
|
985
990
|
Checks for the placement of the closing parenthesis in a
|
|
986
991
|
method call that passes a HEREDOC string as an argument.
|
|
987
|
-
Enabled: false
|
|
988
992
|
StyleGuide: '#heredoc-argument-closing-parentheses'
|
|
993
|
+
Enabled: false
|
|
989
994
|
VersionAdded: '0.68'
|
|
990
995
|
|
|
991
996
|
Layout/HeredocIndentation:
|
|
@@ -1037,6 +1042,15 @@ Layout/IndentationWidth:
|
|
|
1037
1042
|
VersionAdded: '0.49'
|
|
1038
1043
|
# Number of spaces for each indentation level.
|
|
1039
1044
|
Width: 2
|
|
1045
|
+
# Block body indentation for method chain blocks.
|
|
1046
|
+
# The value `start_of_line` means that block bodies are indented
|
|
1047
|
+
# relative to the start of the line where the block starts.
|
|
1048
|
+
# The value `relative_to_receiver` means that block bodies are indented
|
|
1049
|
+
# relative to the method call position in the chain.
|
|
1050
|
+
EnforcedStyleAlignWith: start_of_line
|
|
1051
|
+
SupportedStylesAlignWith:
|
|
1052
|
+
- start_of_line
|
|
1053
|
+
- relative_to_receiver
|
|
1040
1054
|
AllowedPatterns: []
|
|
1041
1055
|
|
|
1042
1056
|
Layout/InitialIndentation:
|
|
@@ -1102,7 +1116,7 @@ Layout/LineLength:
|
|
|
1102
1116
|
StyleGuide: '#max-line-length'
|
|
1103
1117
|
Enabled: true
|
|
1104
1118
|
VersionAdded: '0.25'
|
|
1105
|
-
VersionChanged: '1.
|
|
1119
|
+
VersionChanged: '1.82'
|
|
1106
1120
|
Max: 120
|
|
1107
1121
|
AllowHeredoc: true
|
|
1108
1122
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
|
@@ -1112,9 +1126,12 @@ Layout/LineLength:
|
|
|
1112
1126
|
URISchemes:
|
|
1113
1127
|
- http
|
|
1114
1128
|
- https
|
|
1115
|
-
# The
|
|
1129
|
+
# The AllowRBSInlineAnnotation option makes LineLength allow RBS::Inline annotations
|
|
1130
|
+
# such as `#: (?date: Date) -> Foo` when calculating line length.
|
|
1131
|
+
AllowRBSInlineAnnotation: false
|
|
1132
|
+
# The AllowCopDirectives option causes the LineLength rule to ignore cop
|
|
1116
1133
|
# directives like '# rubocop: enable ...' when calculating a line's length.
|
|
1117
|
-
|
|
1134
|
+
AllowCopDirectives: true
|
|
1118
1135
|
# The AllowedPatterns option is a list of !ruby/regexp and/or string
|
|
1119
1136
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
|
1120
1137
|
# any regular expression listed in this option will be ignored by LineLength.
|
|
@@ -1409,6 +1426,7 @@ Layout/SpaceBeforeBlockBraces:
|
|
|
1409
1426
|
before it.
|
|
1410
1427
|
Enabled: true
|
|
1411
1428
|
VersionAdded: '0.49'
|
|
1429
|
+
VersionChanged: '0.52'
|
|
1412
1430
|
EnforcedStyle: space
|
|
1413
1431
|
SupportedStyles:
|
|
1414
1432
|
- space
|
|
@@ -1417,7 +1435,6 @@ Layout/SpaceBeforeBlockBraces:
|
|
|
1417
1435
|
SupportedStylesForEmptyBraces:
|
|
1418
1436
|
- space
|
|
1419
1437
|
- no_space
|
|
1420
|
-
VersionChanged: '0.52'
|
|
1421
1438
|
|
|
1422
1439
|
Layout/SpaceBeforeBrackets:
|
|
1423
1440
|
Description: 'Checks for receiver with a space before the opening brackets.'
|
|
@@ -1692,6 +1709,7 @@ Lint/ConstantReassignment:
|
|
|
1692
1709
|
Description: 'Checks for constant reassignments.'
|
|
1693
1710
|
Enabled: pending
|
|
1694
1711
|
VersionAdded: '1.70'
|
|
1712
|
+
VersionChanged: '1.87'
|
|
1695
1713
|
|
|
1696
1714
|
Lint/ConstantResolution:
|
|
1697
1715
|
Description: 'Checks that constants are fully qualified with `::`.'
|
|
@@ -1707,6 +1725,11 @@ Lint/CopDirectiveSyntax:
|
|
|
1707
1725
|
Enabled: pending
|
|
1708
1726
|
VersionAdded: '1.72'
|
|
1709
1727
|
|
|
1728
|
+
Lint/DataDefineOverride:
|
|
1729
|
+
Description: 'Disallow overriding the `Data` built-in methods via `Data.define`.'
|
|
1730
|
+
Enabled: pending
|
|
1731
|
+
VersionAdded: '1.85'
|
|
1732
|
+
|
|
1710
1733
|
Lint/Debugger:
|
|
1711
1734
|
Description: 'Checks for debugger calls.'
|
|
1712
1735
|
Enabled: true
|
|
@@ -1904,9 +1927,9 @@ Lint/EmptyConditionalBody:
|
|
|
1904
1927
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
|
1905
1928
|
Enabled: true
|
|
1906
1929
|
AutoCorrect: contextual
|
|
1907
|
-
AllowComments: true
|
|
1908
1930
|
VersionAdded: '0.89'
|
|
1909
1931
|
VersionChanged: '1.73'
|
|
1932
|
+
AllowComments: true
|
|
1910
1933
|
|
|
1911
1934
|
Lint/EmptyEnsure:
|
|
1912
1935
|
Description: 'Checks for empty ensure block.'
|
|
@@ -1942,9 +1965,9 @@ Lint/EmptyInterpolation:
|
|
|
1942
1965
|
Lint/EmptyWhen:
|
|
1943
1966
|
Description: 'Checks for `when` branches with empty bodies.'
|
|
1944
1967
|
Enabled: true
|
|
1945
|
-
AllowComments: true
|
|
1946
1968
|
VersionAdded: '0.45'
|
|
1947
1969
|
VersionChanged: '0.83'
|
|
1970
|
+
AllowComments: true
|
|
1948
1971
|
|
|
1949
1972
|
Lint/EnsureReturn:
|
|
1950
1973
|
Description: 'Do not use return in an ensure block.'
|
|
@@ -1978,7 +2001,7 @@ Lint/FloatOutOfRange:
|
|
|
1978
2001
|
VersionAdded: '0.36'
|
|
1979
2002
|
|
|
1980
2003
|
Lint/FormatParameterMismatch:
|
|
1981
|
-
Description: '
|
|
2004
|
+
Description: 'Checks for a mismatch between the format fields and the arguments to `format`/`sprintf`/`%`.'
|
|
1982
2005
|
Enabled: true
|
|
1983
2006
|
VersionAdded: '0.33'
|
|
1984
2007
|
|
|
@@ -1998,14 +2021,14 @@ Lint/HeredocMethodCallPosition:
|
|
|
1998
2021
|
Description: >-
|
|
1999
2022
|
Checks for the ordering of a method call where
|
|
2000
2023
|
the receiver of the call is a HEREDOC.
|
|
2001
|
-
Enabled: false
|
|
2002
2024
|
StyleGuide: '#heredoc-method-calls'
|
|
2025
|
+
Enabled: false
|
|
2003
2026
|
VersionAdded: '0.68'
|
|
2004
2027
|
|
|
2005
2028
|
Lint/IdentityComparison:
|
|
2006
2029
|
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
|
2007
|
-
Enabled: true
|
|
2008
2030
|
StyleGuide: '#identity-comparison'
|
|
2031
|
+
Enabled: true
|
|
2009
2032
|
VersionAdded: '0.91'
|
|
2010
2033
|
|
|
2011
2034
|
Lint/ImplicitStringConcatenation:
|
|
@@ -2091,6 +2114,7 @@ Lint/MissingCopEnableDirective:
|
|
|
2091
2114
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
|
2092
2115
|
Enabled: true
|
|
2093
2116
|
VersionAdded: '0.52'
|
|
2117
|
+
VersionChanged: '1.88'
|
|
2094
2118
|
# Maximum number of consecutive lines the cop can be disabled for.
|
|
2095
2119
|
# 0 allows only single-line disables
|
|
2096
2120
|
# 1 would mean the maximum allowed is the following:
|
|
@@ -2098,16 +2122,16 @@ Lint/MissingCopEnableDirective:
|
|
|
2098
2122
|
# a = 1
|
|
2099
2123
|
# # rubocop:enable SomeCop
|
|
2100
2124
|
# .inf for any size
|
|
2101
|
-
|
|
2125
|
+
MaxRangeSize: .inf
|
|
2102
2126
|
|
|
2103
2127
|
Lint/MissingSuper:
|
|
2104
2128
|
Description: >-
|
|
2105
2129
|
Checks for the presence of constructors and lifecycle callbacks
|
|
2106
2130
|
without calls to `super`.
|
|
2107
2131
|
Enabled: true
|
|
2108
|
-
AllowedParentClasses: []
|
|
2109
2132
|
VersionAdded: '0.89'
|
|
2110
2133
|
VersionChanged: '1.4'
|
|
2134
|
+
AllowedParentClasses: []
|
|
2111
2135
|
|
|
2112
2136
|
Lint/MixedCaseRange:
|
|
2113
2137
|
Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
|
|
@@ -2173,11 +2197,11 @@ Lint/NumberConversion:
|
|
|
2173
2197
|
Description: 'Checks unsafe usage of number conversion methods.'
|
|
2174
2198
|
Enabled: false
|
|
2175
2199
|
VersionAdded: '0.53'
|
|
2176
|
-
VersionChanged: '1.
|
|
2200
|
+
VersionChanged: '1.88'
|
|
2177
2201
|
SafeAutoCorrect: false
|
|
2178
2202
|
AllowedMethods: []
|
|
2179
2203
|
AllowedPatterns: []
|
|
2180
|
-
|
|
2204
|
+
AllowedClasses:
|
|
2181
2205
|
- Time
|
|
2182
2206
|
- DateTime
|
|
2183
2207
|
|
|
@@ -2327,13 +2351,16 @@ Lint/RedundantWithIndex:
|
|
|
2327
2351
|
Lint/RedundantWithObject:
|
|
2328
2352
|
Description: 'Checks for redundant `with_object`.'
|
|
2329
2353
|
Enabled: true
|
|
2354
|
+
SafeAutoCorrect: false
|
|
2330
2355
|
VersionAdded: '0.51'
|
|
2356
|
+
VersionChanged: '1.88'
|
|
2331
2357
|
|
|
2332
2358
|
Lint/RefinementImportMethods:
|
|
2333
2359
|
Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
|
|
2334
2360
|
Enabled: pending
|
|
2335
2361
|
SafeAutoCorrect: false
|
|
2336
2362
|
VersionAdded: '1.27'
|
|
2363
|
+
VersionChanged: '1.88'
|
|
2337
2364
|
|
|
2338
2365
|
Lint/RegexpAsCondition:
|
|
2339
2366
|
Description: >-
|
|
@@ -2396,8 +2423,9 @@ Lint/SafeNavigationConsistency:
|
|
|
2396
2423
|
consistent and appropriate safe navigation, without excess or deficiency,
|
|
2397
2424
|
is used for all method calls on the same object.
|
|
2398
2425
|
Enabled: true
|
|
2426
|
+
SafeAutoCorrect: false
|
|
2399
2427
|
VersionAdded: '0.55'
|
|
2400
|
-
VersionChanged: '
|
|
2428
|
+
VersionChanged: '1.85'
|
|
2401
2429
|
AllowedMethods:
|
|
2402
2430
|
- present?
|
|
2403
2431
|
- blank?
|
|
@@ -2464,10 +2492,10 @@ Lint/SuppressedException:
|
|
|
2464
2492
|
Description: "Don't suppress exceptions."
|
|
2465
2493
|
StyleGuide: '#dont-hide-exceptions'
|
|
2466
2494
|
Enabled: true
|
|
2467
|
-
AllowComments: true
|
|
2468
|
-
AllowNil: true
|
|
2469
2495
|
VersionAdded: '0.9'
|
|
2470
2496
|
VersionChanged: '1.12'
|
|
2497
|
+
AllowComments: true
|
|
2498
|
+
AllowNil: true
|
|
2471
2499
|
|
|
2472
2500
|
Lint/SuppressedExceptionInNumberConversion:
|
|
2473
2501
|
Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
|
|
@@ -2560,7 +2588,7 @@ Lint/UnmodifiedReduceAccumulator:
|
|
|
2560
2588
|
VersionChanged: '1.5'
|
|
2561
2589
|
|
|
2562
2590
|
Lint/UnreachableCode:
|
|
2563
|
-
Description: '
|
|
2591
|
+
Description: 'Checks for unreachable code.'
|
|
2564
2592
|
Enabled: true
|
|
2565
2593
|
VersionAdded: '0.9'
|
|
2566
2594
|
|
|
@@ -2574,6 +2602,11 @@ Lint/UnreachableLoop:
|
|
|
2574
2602
|
# eg. `exactly(2).times`
|
|
2575
2603
|
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
|
2576
2604
|
|
|
2605
|
+
Lint/UnreachablePatternBranch:
|
|
2606
|
+
Description: 'Checks for unreachable `in` pattern branches after an unconditional catch-all pattern.'
|
|
2607
|
+
Enabled: pending
|
|
2608
|
+
VersionAdded: '1.85'
|
|
2609
|
+
|
|
2577
2610
|
Lint/UnusedBlockArgument:
|
|
2578
2611
|
Description: 'Checks for unused block arguments.'
|
|
2579
2612
|
StyleGuide: '#underscore-unused-vars'
|
|
@@ -2669,7 +2702,10 @@ Lint/UselessNumericOperation:
|
|
|
2669
2702
|
Lint/UselessOr:
|
|
2670
2703
|
Description: 'Checks for useless OR expressions.'
|
|
2671
2704
|
Enabled: pending
|
|
2705
|
+
SafeAutoCorrect: false
|
|
2706
|
+
AutoCorrect: contextual
|
|
2672
2707
|
VersionAdded: '1.76'
|
|
2708
|
+
VersionChanged: '1.82'
|
|
2673
2709
|
|
|
2674
2710
|
Lint/UselessRescue:
|
|
2675
2711
|
Description: 'Checks for useless `rescue`s.'
|
|
@@ -2697,7 +2733,7 @@ Lint/UselessTimes:
|
|
|
2697
2733
|
VersionChanged: '1.61'
|
|
2698
2734
|
|
|
2699
2735
|
Lint/Void:
|
|
2700
|
-
Description: '
|
|
2736
|
+
Description: 'Checks for operators, literals, lambdas, and procs used in void context.'
|
|
2701
2737
|
Enabled: true
|
|
2702
2738
|
AutoCorrect: contextual
|
|
2703
2739
|
VersionAdded: '0.9'
|
|
@@ -2707,9 +2743,7 @@ Lint/Void:
|
|
|
2707
2743
|
#################### Metrics ###############################
|
|
2708
2744
|
|
|
2709
2745
|
Metrics/AbcSize:
|
|
2710
|
-
Description:
|
|
2711
|
-
A calculated magnitude based on number of assignments,
|
|
2712
|
-
branches, and conditions.
|
|
2746
|
+
Description: 'Checks that the ABC size of methods is not higher than the configured maximum.'
|
|
2713
2747
|
References:
|
|
2714
2748
|
- https://wiki.c2.com/?AbcMetric
|
|
2715
2749
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
|
@@ -2762,13 +2796,12 @@ Metrics/CollectionLiteralLength:
|
|
|
2762
2796
|
Description: 'Checks for `Array` or `Hash` literals with many entries.'
|
|
2763
2797
|
Enabled: pending
|
|
2764
2798
|
VersionAdded: '1.47'
|
|
2765
|
-
|
|
2799
|
+
VersionChanged: '1.88'
|
|
2800
|
+
Max: 250
|
|
2766
2801
|
|
|
2767
2802
|
# Avoid complex methods.
|
|
2768
2803
|
Metrics/CyclomaticComplexity:
|
|
2769
|
-
Description:
|
|
2770
|
-
A complexity metric that is strongly correlated to the number
|
|
2771
|
-
of test cases needed to validate a method.
|
|
2804
|
+
Description: 'Checks that the cyclomatic complexity of methods is not higher than the configured maximum.'
|
|
2772
2805
|
Enabled: true
|
|
2773
2806
|
VersionAdded: '0.25'
|
|
2774
2807
|
VersionChanged: '0.81'
|
|
@@ -2808,9 +2841,7 @@ Metrics/ParameterLists:
|
|
|
2808
2841
|
MaxOptionalParameters: 3
|
|
2809
2842
|
|
|
2810
2843
|
Metrics/PerceivedComplexity:
|
|
2811
|
-
Description:
|
|
2812
|
-
A complexity metric geared towards measuring complexity for a
|
|
2813
|
-
human reader.
|
|
2844
|
+
Description: 'Checks that the perceived complexity of methods is not higher than the configured maximum.'
|
|
2814
2845
|
Enabled: true
|
|
2815
2846
|
VersionAdded: '0.25'
|
|
2816
2847
|
VersionChanged: '0.81'
|
|
@@ -2818,16 +2849,14 @@ Metrics/PerceivedComplexity:
|
|
|
2818
2849
|
AllowedPatterns: []
|
|
2819
2850
|
Max: 8
|
|
2820
2851
|
|
|
2821
|
-
|
|
2852
|
+
#################### Migration #############################
|
|
2822
2853
|
|
|
2823
2854
|
Migration/DepartmentName:
|
|
2824
|
-
Description:
|
|
2825
|
-
Check that cop names in rubocop:disable (etc) comments are
|
|
2826
|
-
given with department name.
|
|
2855
|
+
Description: 'Checks that cop names in `rubocop:disable` (etc.) comments are given with a department name.'
|
|
2827
2856
|
Enabled: true
|
|
2828
2857
|
VersionAdded: '0.75'
|
|
2829
2858
|
|
|
2830
|
-
#################### Naming
|
|
2859
|
+
#################### Naming ################################
|
|
2831
2860
|
|
|
2832
2861
|
Naming/AccessorMethodName:
|
|
2833
2862
|
Description: Checks the naming of accessor methods for get_/set_.
|
|
@@ -2844,7 +2873,7 @@ Naming/AsciiIdentifiers:
|
|
|
2844
2873
|
AsciiConstants: true
|
|
2845
2874
|
|
|
2846
2875
|
Naming/BinaryOperatorParameterName:
|
|
2847
|
-
Description: '
|
|
2876
|
+
Description: 'Checks that the sole parameter of binary operator methods is named `other`.'
|
|
2848
2877
|
StyleGuide: '#other-arg'
|
|
2849
2878
|
Enabled: true
|
|
2850
2879
|
VersionAdded: '0.50'
|
|
@@ -3014,7 +3043,10 @@ Naming/InclusiveLanguage:
|
|
|
3014
3043
|
- block
|
|
3015
3044
|
slave:
|
|
3016
3045
|
WholeWord: true
|
|
3017
|
-
Suggestions:
|
|
3046
|
+
Suggestions:
|
|
3047
|
+
- replica
|
|
3048
|
+
- secondary
|
|
3049
|
+
- follower
|
|
3018
3050
|
|
|
3019
3051
|
Naming/MemoizedInstanceVariableName:
|
|
3020
3052
|
Description: >-
|
|
@@ -3097,10 +3129,11 @@ Naming/PredicateMethod:
|
|
|
3097
3129
|
AllowBangMethods: false
|
|
3098
3130
|
# Methods that are known to not return a boolean value, despite ending in `?`.
|
|
3099
3131
|
WaywardPredicates:
|
|
3132
|
+
- infinite?
|
|
3100
3133
|
- nonzero?
|
|
3101
3134
|
|
|
3102
3135
|
Naming/PredicatePrefix:
|
|
3103
|
-
Description: '
|
|
3136
|
+
Description: 'Checks that predicate method names end with a question mark and do not start with a forbidden prefix.'
|
|
3104
3137
|
StyleGuide: '#bool-methods-qmark'
|
|
3105
3138
|
Enabled: true
|
|
3106
3139
|
VersionAdded: '0.50'
|
|
@@ -3182,14 +3215,14 @@ Naming/VariableNumber:
|
|
|
3182
3215
|
#################### Security ##############################
|
|
3183
3216
|
|
|
3184
3217
|
Security/CompoundHash:
|
|
3185
|
-
Description: '
|
|
3218
|
+
Description: 'Checks for `hash` implementations that combine values manually instead of delegating to `Array#hash`.'
|
|
3186
3219
|
Enabled: pending
|
|
3187
3220
|
Safe: false
|
|
3188
3221
|
VersionAdded: '1.28'
|
|
3189
3222
|
VersionChanged: '1.51'
|
|
3190
3223
|
|
|
3191
3224
|
Security/Eval:
|
|
3192
|
-
Description: '
|
|
3225
|
+
Description: 'Checks for the use of `Kernel#eval` and `Binding#eval` with dynamic arguments.'
|
|
3193
3226
|
Enabled: true
|
|
3194
3227
|
VersionAdded: '0.47'
|
|
3195
3228
|
|
|
@@ -3207,6 +3240,7 @@ Security/JSONLoad:
|
|
|
3207
3240
|
security issues. See reference for more information.
|
|
3208
3241
|
References:
|
|
3209
3242
|
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
|
3243
|
+
- 'https://bugs.ruby-lang.org/issues/19528'
|
|
3210
3244
|
Enabled: true
|
|
3211
3245
|
VersionAdded: '0.43'
|
|
3212
3246
|
VersionChanged: '1.22'
|
|
@@ -3224,7 +3258,7 @@ Security/MarshalLoad:
|
|
|
3224
3258
|
VersionAdded: '0.47'
|
|
3225
3259
|
|
|
3226
3260
|
Security/Open:
|
|
3227
|
-
Description: '
|
|
3261
|
+
Description: 'Checks for the use of `Kernel#open` and `URI.open` with dynamic data.'
|
|
3228
3262
|
Enabled: true
|
|
3229
3263
|
VersionAdded: '0.53'
|
|
3230
3264
|
VersionChanged: '1.0'
|
|
@@ -3240,7 +3274,7 @@ Security/YAMLLoad:
|
|
|
3240
3274
|
VersionAdded: '0.47'
|
|
3241
3275
|
SafeAutoCorrect: false
|
|
3242
3276
|
|
|
3243
|
-
#################### Style
|
|
3277
|
+
#################### Style #################################
|
|
3244
3278
|
|
|
3245
3279
|
Style/AccessModifierDeclarations:
|
|
3246
3280
|
Description: 'Checks style of how access modifiers are used.'
|
|
@@ -3280,7 +3314,7 @@ Style/Alias:
|
|
|
3280
3314
|
|
|
3281
3315
|
Style/AmbiguousEndlessMethodDefinition:
|
|
3282
3316
|
Description: 'Checks for endless methods inside operators of lower precedence.'
|
|
3283
|
-
StyleGuide: '#ambiguous-endless-method-
|
|
3317
|
+
StyleGuide: '#ambiguous-endless-method-definitions'
|
|
3284
3318
|
Enabled: pending
|
|
3285
3319
|
VersionAdded: '1.68'
|
|
3286
3320
|
|
|
@@ -3302,6 +3336,8 @@ Style/ArgumentsForwarding:
|
|
|
3302
3336
|
Description: 'Use arguments forwarding.'
|
|
3303
3337
|
StyleGuide: '#arguments-forwarding'
|
|
3304
3338
|
Enabled: pending
|
|
3339
|
+
VersionAdded: '1.1'
|
|
3340
|
+
VersionChanged: '1.58'
|
|
3305
3341
|
AllowOnlyRestArgument: true
|
|
3306
3342
|
UseAnonymousForwarding: true
|
|
3307
3343
|
RedundantRestArgumentNames:
|
|
@@ -3315,8 +3351,6 @@ Style/ArgumentsForwarding:
|
|
|
3315
3351
|
- blk
|
|
3316
3352
|
- block
|
|
3317
3353
|
- proc
|
|
3318
|
-
VersionAdded: '1.1'
|
|
3319
|
-
VersionChanged: '1.58'
|
|
3320
3354
|
|
|
3321
3355
|
Style/ArrayCoercion:
|
|
3322
3356
|
Description: >-
|
|
@@ -3341,6 +3375,12 @@ Style/ArrayIntersect:
|
|
|
3341
3375
|
Safe: false
|
|
3342
3376
|
VersionAdded: '1.40'
|
|
3343
3377
|
|
|
3378
|
+
Style/ArrayIntersectWithSingleElement:
|
|
3379
|
+
Description: 'Use `include?(element)` instead of `intersect?([element])`.'
|
|
3380
|
+
Enabled: 'pending'
|
|
3381
|
+
Safe: false
|
|
3382
|
+
VersionAdded: '1.81'
|
|
3383
|
+
|
|
3344
3384
|
Style/ArrayJoin:
|
|
3345
3385
|
Description: 'Use Array#join instead of Array#*.'
|
|
3346
3386
|
StyleGuide: '#array-join'
|
|
@@ -3518,9 +3558,11 @@ Style/BlockDelimiters:
|
|
|
3518
3558
|
BracesRequiredMethods: []
|
|
3519
3559
|
|
|
3520
3560
|
Style/CaseEquality:
|
|
3521
|
-
Description: 'Avoid explicit use of the case equality operator(
|
|
3561
|
+
Description: 'Avoid explicit use of the case equality operator (`===`).'
|
|
3522
3562
|
StyleGuide: '#no-case-equality'
|
|
3523
3563
|
Enabled: true
|
|
3564
|
+
References:
|
|
3565
|
+
- 'https://docs.rubocop.org/rubocop-performance/cops_performance.html#performanceregexpmatch'
|
|
3524
3566
|
VersionAdded: '0.9'
|
|
3525
3567
|
VersionChanged: '0.89'
|
|
3526
3568
|
# If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
|
|
@@ -3659,7 +3701,7 @@ Style/CollectionCompact:
|
|
|
3659
3701
|
|
|
3660
3702
|
# Align with the style guide.
|
|
3661
3703
|
Style/CollectionMethods:
|
|
3662
|
-
Description: '
|
|
3704
|
+
Description: 'Enforces the use of consistent method names from the `Enumerable` module.'
|
|
3663
3705
|
StyleGuide: '#map-find-select-reduce-include-size'
|
|
3664
3706
|
Enabled: false
|
|
3665
3707
|
VersionAdded: '0.9'
|
|
@@ -3761,11 +3803,11 @@ Style/CommentedKeyword:
|
|
|
3761
3803
|
|
|
3762
3804
|
Style/ComparableBetween:
|
|
3763
3805
|
Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
|
|
3806
|
+
StyleGuide: '#ranges-or-between'
|
|
3764
3807
|
Enabled: pending
|
|
3765
3808
|
Safe: false
|
|
3766
3809
|
VersionAdded: '1.74'
|
|
3767
3810
|
VersionChanged: '1.75'
|
|
3768
|
-
StyleGuide: '#ranges-or-between'
|
|
3769
3811
|
|
|
3770
3812
|
Style/ComparableClamp:
|
|
3771
3813
|
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
|
@@ -3952,6 +3994,18 @@ Style/EmptyCaseCondition:
|
|
|
3952
3994
|
Enabled: true
|
|
3953
3995
|
VersionAdded: '0.40'
|
|
3954
3996
|
|
|
3997
|
+
Style/EmptyClassDefinition:
|
|
3998
|
+
Description: 'Enforces consistent style for empty class definitions.'
|
|
3999
|
+
Enabled: pending
|
|
4000
|
+
VersionAdded: '1.84'
|
|
4001
|
+
VersionChanged: '1.86'
|
|
4002
|
+
EnforcedStyle: class_keyword
|
|
4003
|
+
SupportedStyles:
|
|
4004
|
+
- class_keyword
|
|
4005
|
+
- class_new
|
|
4006
|
+
- class_definition # Deprecated.
|
|
4007
|
+
AllowedParentClasses: []
|
|
4008
|
+
|
|
3955
4009
|
Style/EmptyElse:
|
|
3956
4010
|
Description: 'Avoid empty else-clauses.'
|
|
3957
4011
|
Enabled: true
|
|
@@ -4074,7 +4128,7 @@ Style/ExplicitBlockArgument:
|
|
|
4074
4128
|
VersionChanged: '1.8'
|
|
4075
4129
|
|
|
4076
4130
|
Style/ExponentialNotation:
|
|
4077
|
-
Description: '
|
|
4131
|
+
Description: 'Enforces consistency in the use of exponential (scientific) notation.'
|
|
4078
4132
|
StyleGuide: '#exponential-notation'
|
|
4079
4133
|
Enabled: true
|
|
4080
4134
|
VersionAdded: '0.82'
|
|
@@ -4091,8 +4145,9 @@ Style/FetchEnvVar:
|
|
|
4091
4145
|
- https://rubystyle.guide/#hash-fetch-defaults
|
|
4092
4146
|
Enabled: pending
|
|
4093
4147
|
VersionAdded: '1.28'
|
|
4148
|
+
VersionChanged: '1.88'
|
|
4094
4149
|
# Environment variables to be excluded from the inspection.
|
|
4095
|
-
|
|
4150
|
+
AllowedVariables: []
|
|
4096
4151
|
# When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
|
|
4097
4152
|
# When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
|
|
4098
4153
|
DefaultToNil: true
|
|
@@ -4110,6 +4165,12 @@ Style/FileNull:
|
|
|
4110
4165
|
SafeAutoCorrect: false
|
|
4111
4166
|
VersionAdded: '1.69'
|
|
4112
4167
|
|
|
4168
|
+
Style/FileOpen:
|
|
4169
|
+
Description: 'Checks for `File.open` without a block, which can leak file descriptors.'
|
|
4170
|
+
Enabled: pending
|
|
4171
|
+
Safe: false
|
|
4172
|
+
VersionAdded: '1.85'
|
|
4173
|
+
|
|
4113
4174
|
Style/FileRead:
|
|
4114
4175
|
Description: 'Favor `File.(bin)read` convenience methods.'
|
|
4115
4176
|
StyleGuide: '#file-read'
|
|
@@ -4171,6 +4232,8 @@ Style/FormatString:
|
|
|
4171
4232
|
Style/FormatStringToken:
|
|
4172
4233
|
Description: 'Use a consistent style for format string tokens.'
|
|
4173
4234
|
Enabled: true
|
|
4235
|
+
VersionAdded: '0.49'
|
|
4236
|
+
VersionChanged: '1.74'
|
|
4174
4237
|
EnforcedStyle: annotated
|
|
4175
4238
|
SupportedStyles:
|
|
4176
4239
|
# Prefer tokens which contain a sprintf like type annotation like
|
|
@@ -4189,8 +4252,6 @@ Style/FormatStringToken:
|
|
|
4189
4252
|
# only register offenses for strings given to `printf`, `sprintf`,
|
|
4190
4253
|
# format` and `%` methods. Other strings are not considered.
|
|
4191
4254
|
Mode: aggressive
|
|
4192
|
-
VersionAdded: '0.49'
|
|
4193
|
-
VersionChanged: '1.74'
|
|
4194
4255
|
AllowedMethods: []
|
|
4195
4256
|
AllowedPatterns: []
|
|
4196
4257
|
|
|
@@ -4303,6 +4364,16 @@ Style/HashLikeCase:
|
|
|
4303
4364
|
# to trigger this cop
|
|
4304
4365
|
MinBranchesCount: 3
|
|
4305
4366
|
|
|
4367
|
+
Style/HashLookupMethod:
|
|
4368
|
+
Description: 'Enforces the use of either `Hash#[]` or `Hash#fetch` for hash lookup.'
|
|
4369
|
+
Enabled: false
|
|
4370
|
+
Safe: false
|
|
4371
|
+
VersionAdded: '1.84'
|
|
4372
|
+
EnforcedStyle: brackets
|
|
4373
|
+
SupportedStyles:
|
|
4374
|
+
- brackets
|
|
4375
|
+
- fetch
|
|
4376
|
+
|
|
4306
4377
|
Style/HashSlice:
|
|
4307
4378
|
Description: >-
|
|
4308
4379
|
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
|
@@ -4374,9 +4445,9 @@ Style/IdenticalConditionalBranches:
|
|
|
4374
4445
|
Style/IfInsideElse:
|
|
4375
4446
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
|
4376
4447
|
Enabled: true
|
|
4377
|
-
AllowIfModifier: false
|
|
4378
4448
|
VersionAdded: '0.36'
|
|
4379
4449
|
VersionChanged: '1.3'
|
|
4450
|
+
AllowIfModifier: false
|
|
4380
4451
|
|
|
4381
4452
|
Style/IfUnlessModifier:
|
|
4382
4453
|
Description: >-
|
|
@@ -4400,6 +4471,7 @@ Style/IfWithBooleanLiteralBranches:
|
|
|
4400
4471
|
VersionAdded: '1.9'
|
|
4401
4472
|
SafeAutoCorrect: false
|
|
4402
4473
|
AllowedMethods:
|
|
4474
|
+
- infinite?
|
|
4403
4475
|
- nonzero?
|
|
4404
4476
|
|
|
4405
4477
|
Style/IfWithSemicolon:
|
|
@@ -4506,14 +4578,14 @@ Style/ItAssignment:
|
|
|
4506
4578
|
Style/ItBlockParameter:
|
|
4507
4579
|
Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
|
|
4508
4580
|
Enabled: pending
|
|
4581
|
+
VersionAdded: '1.75'
|
|
4582
|
+
VersionChanged: '1.76'
|
|
4509
4583
|
EnforcedStyle: allow_single_line
|
|
4510
4584
|
SupportedStyles:
|
|
4511
4585
|
- allow_single_line
|
|
4512
4586
|
- only_numbered_parameters
|
|
4513
4587
|
- always
|
|
4514
4588
|
- disallow
|
|
4515
|
-
VersionAdded: '1.75'
|
|
4516
|
-
VersionChanged: '1.76'
|
|
4517
4589
|
|
|
4518
4590
|
Style/KeywordArgumentsMerging:
|
|
4519
4591
|
Description: >-
|
|
@@ -4546,8 +4618,9 @@ Style/LambdaCall:
|
|
|
4546
4618
|
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
|
4547
4619
|
StyleGuide: '#proc-call'
|
|
4548
4620
|
Enabled: true
|
|
4621
|
+
AutoCorrect: contextual
|
|
4549
4622
|
VersionAdded: '0.13'
|
|
4550
|
-
VersionChanged: '
|
|
4623
|
+
VersionChanged: '1.81'
|
|
4551
4624
|
EnforcedStyle: call
|
|
4552
4625
|
SupportedStyles:
|
|
4553
4626
|
- call
|
|
@@ -4595,6 +4668,12 @@ Style/MapIntoArray:
|
|
|
4595
4668
|
VersionChanged: '1.67'
|
|
4596
4669
|
Safe: false
|
|
4597
4670
|
|
|
4671
|
+
Style/MapJoin:
|
|
4672
|
+
Description: 'Checks for redundant `map(&:to_s)` before `join`.'
|
|
4673
|
+
Enabled: pending
|
|
4674
|
+
Safe: false
|
|
4675
|
+
VersionAdded: '1.85'
|
|
4676
|
+
|
|
4598
4677
|
Style/MapToHash:
|
|
4599
4678
|
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
|
4600
4679
|
Enabled: pending
|
|
@@ -4617,6 +4696,7 @@ Style/MethodCallWithArgsParentheses:
|
|
|
4617
4696
|
AllowedMethods: []
|
|
4618
4697
|
AllowedPatterns: []
|
|
4619
4698
|
IncludedMacros: []
|
|
4699
|
+
IncludedMacroPatterns: []
|
|
4620
4700
|
AllowParenthesesInMultilineCall: false
|
|
4621
4701
|
AllowParenthesesInChaining: false
|
|
4622
4702
|
AllowParenthesesInCamelCaseMethod: false
|
|
@@ -4630,10 +4710,10 @@ Style/MethodCallWithoutArgsParentheses:
|
|
|
4630
4710
|
Description: 'Do not use parentheses for method calls with no arguments.'
|
|
4631
4711
|
StyleGuide: '#method-invocation-parens'
|
|
4632
4712
|
Enabled: true
|
|
4633
|
-
AllowedMethods: []
|
|
4634
|
-
AllowedPatterns: []
|
|
4635
4713
|
VersionAdded: '0.47'
|
|
4636
4714
|
VersionChanged: '0.55'
|
|
4715
|
+
AllowedMethods: []
|
|
4716
|
+
AllowedPatterns: []
|
|
4637
4717
|
|
|
4638
4718
|
Style/MethodCalledOnDoEndBlock:
|
|
4639
4719
|
Description: 'Avoid chaining a method call on a do...end block.'
|
|
@@ -4727,6 +4807,11 @@ Style/ModuleFunction:
|
|
|
4727
4807
|
Autocorrect: false
|
|
4728
4808
|
SafeAutoCorrect: false
|
|
4729
4809
|
|
|
4810
|
+
Style/ModuleMemberExistenceCheck:
|
|
4811
|
+
Description: 'Checks for usage of `Module` methods returning arrays that can be replaced with equivalent predicates.'
|
|
4812
|
+
Enabled: pending
|
|
4813
|
+
VersionAdded: '1.82'
|
|
4814
|
+
|
|
4730
4815
|
Style/MultilineBlockChain:
|
|
4731
4816
|
Description: 'Avoid multi-line chains of blocks.'
|
|
4732
4817
|
StyleGuide: '#single-line-blocks'
|
|
@@ -4734,7 +4819,7 @@ Style/MultilineBlockChain:
|
|
|
4734
4819
|
VersionAdded: '0.13'
|
|
4735
4820
|
|
|
4736
4821
|
Style/MultilineIfModifier:
|
|
4737
|
-
Description: '
|
|
4822
|
+
Description: 'Checks for uses of `if`/`unless` modifiers with multiline bodies.'
|
|
4738
4823
|
StyleGuide: '#no-multiline-if-modifiers'
|
|
4739
4824
|
Enabled: true
|
|
4740
4825
|
VersionAdded: '0.45'
|
|
@@ -4797,7 +4882,7 @@ Style/MutableConstant:
|
|
|
4797
4882
|
Description: 'Do not assign mutable objects to constants.'
|
|
4798
4883
|
Enabled: true
|
|
4799
4884
|
VersionAdded: '0.34'
|
|
4800
|
-
VersionChanged: '1.
|
|
4885
|
+
VersionChanged: '1.88'
|
|
4801
4886
|
SafeAutoCorrect: false
|
|
4802
4887
|
EnforcedStyle: literals
|
|
4803
4888
|
SupportedStyles:
|
|
@@ -4809,6 +4894,9 @@ Style/MutableConstant:
|
|
|
4809
4894
|
# no harm in freezing an already frozen object.
|
|
4810
4895
|
- literals
|
|
4811
4896
|
- strict
|
|
4897
|
+
# When `true`, recursively check and freeze mutable literals nested inside
|
|
4898
|
+
# arrays and hashes (e.g. `[{a: []}]` becomes `[{a: [].freeze}.freeze].freeze`).
|
|
4899
|
+
Recursive: false
|
|
4812
4900
|
|
|
4813
4901
|
Style/NegatedIf:
|
|
4814
4902
|
Description: >-
|
|
@@ -4854,6 +4942,14 @@ Style/NegatedWhile:
|
|
|
4854
4942
|
Enabled: true
|
|
4855
4943
|
VersionAdded: '0.20'
|
|
4856
4944
|
|
|
4945
|
+
Style/NegativeArrayIndex:
|
|
4946
|
+
Description: >-
|
|
4947
|
+
Use negative array indices instead of calculating array length minus a value.
|
|
4948
|
+
Also handles range patterns with length calculations. Recognizes preserving methods
|
|
4949
|
+
and their combinations, allowing safe replacement when the receiver matches.
|
|
4950
|
+
Enabled: pending
|
|
4951
|
+
VersionAdded: '1.84'
|
|
4952
|
+
|
|
4857
4953
|
Style/NestedFileDirname:
|
|
4858
4954
|
Description: 'Checks for nested `File.dirname`.'
|
|
4859
4955
|
Enabled: pending
|
|
@@ -5029,15 +5125,25 @@ Style/ObjectThen:
|
|
|
5029
5125
|
- then
|
|
5030
5126
|
- yield_self
|
|
5031
5127
|
|
|
5128
|
+
Style/OneClassPerFile:
|
|
5129
|
+
Description: 'Checks that each source file defines at most one top-level class or module.'
|
|
5130
|
+
Enabled: pending
|
|
5131
|
+
VersionAdded: '1.85'
|
|
5132
|
+
VersionChanged: '1.86'
|
|
5133
|
+
AllowedClasses: []
|
|
5134
|
+
Exclude:
|
|
5135
|
+
- 'spec/**/*'
|
|
5136
|
+
- 'test/**/*'
|
|
5137
|
+
|
|
5032
5138
|
Style/OneLineConditional:
|
|
5033
5139
|
Description: >-
|
|
5034
5140
|
Favor the ternary operator (?:) or multi-line constructs over
|
|
5035
5141
|
single-line if/then/else/end constructs.
|
|
5036
5142
|
StyleGuide: '#ternary-operator'
|
|
5037
5143
|
Enabled: true
|
|
5038
|
-
AlwaysCorrectToMultiline: false
|
|
5039
5144
|
VersionAdded: '0.9'
|
|
5040
5145
|
VersionChanged: '0.90'
|
|
5146
|
+
AlwaysCorrectToMultiline: false
|
|
5041
5147
|
|
|
5042
5148
|
Style/OpenStructUse:
|
|
5043
5149
|
Description: >-
|
|
@@ -5117,11 +5223,20 @@ Style/ParenthesesAroundCondition:
|
|
|
5117
5223
|
AllowSafeAssignment: true
|
|
5118
5224
|
AllowInMultilineConditions: false
|
|
5119
5225
|
|
|
5226
|
+
Style/PartitionInsteadOfDoubleSelect:
|
|
5227
|
+
Description: >-
|
|
5228
|
+
Checks for consecutive `select`/`filter`/`find_all` and `reject` calls
|
|
5229
|
+
on the same receiver with the same block body.
|
|
5230
|
+
Enabled: pending
|
|
5231
|
+
Safe: false
|
|
5232
|
+
VersionAdded: '1.85'
|
|
5233
|
+
|
|
5120
5234
|
Style/PercentLiteralDelimiters:
|
|
5121
5235
|
Description: 'Use `%`-literal delimiters consistently.'
|
|
5122
5236
|
StyleGuide: '#percent-literal-braces'
|
|
5123
5237
|
Enabled: true
|
|
5124
5238
|
VersionAdded: '0.19'
|
|
5239
|
+
VersionChanged: '0.48'
|
|
5125
5240
|
# Specify the default preferred delimiter for all types with the 'default' key
|
|
5126
5241
|
# Override individual delimiters (even with default specified) by specifying
|
|
5127
5242
|
# an individual key
|
|
@@ -5132,7 +5247,6 @@ Style/PercentLiteralDelimiters:
|
|
|
5132
5247
|
'%r': '{}'
|
|
5133
5248
|
'%w': '[]'
|
|
5134
5249
|
'%W': '[]'
|
|
5135
|
-
VersionChanged: '0.48'
|
|
5136
5250
|
|
|
5137
5251
|
Style/PercentQLiterals:
|
|
5138
5252
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
|
@@ -5149,6 +5263,12 @@ Style/PerlBackrefs:
|
|
|
5149
5263
|
Enabled: true
|
|
5150
5264
|
VersionAdded: '0.13'
|
|
5151
5265
|
|
|
5266
|
+
Style/PredicateWithKind:
|
|
5267
|
+
Description: 'Prefer `any?(Klass)` to `any? { |x| x.is_a?(Klass) }`.'
|
|
5268
|
+
Enabled: pending
|
|
5269
|
+
SafeAutoCorrect: false
|
|
5270
|
+
VersionAdded: '1.85'
|
|
5271
|
+
|
|
5152
5272
|
Style/PreferredHashMethods:
|
|
5153
5273
|
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
|
5154
5274
|
StyleGuide: '#hash-key'
|
|
@@ -5199,6 +5319,12 @@ Style/RandomWithOffset:
|
|
|
5199
5319
|
Enabled: true
|
|
5200
5320
|
VersionAdded: '0.52'
|
|
5201
5321
|
|
|
5322
|
+
Style/ReduceToHash:
|
|
5323
|
+
Description: 'Use `to_h { ... }` instead of `each_with_object`, `inject`, or `reduce` to build a hash.'
|
|
5324
|
+
Enabled: pending
|
|
5325
|
+
Safe: false
|
|
5326
|
+
VersionAdded: '1.85'
|
|
5327
|
+
|
|
5202
5328
|
Style/RedundantArgument:
|
|
5203
5329
|
Description: 'Checks for a redundant argument passed to certain methods.'
|
|
5204
5330
|
Enabled: pending
|
|
@@ -5214,6 +5340,8 @@ Style/RedundantArgument:
|
|
|
5214
5340
|
exit: true
|
|
5215
5341
|
# Kernel.#exit!
|
|
5216
5342
|
exit!: false
|
|
5343
|
+
# String#to_i
|
|
5344
|
+
to_i: 10
|
|
5217
5345
|
# String#split
|
|
5218
5346
|
split: ' '
|
|
5219
5347
|
# String#chomp
|
|
@@ -5255,6 +5383,7 @@ Style/RedundantCondition:
|
|
|
5255
5383
|
VersionAdded: '0.76'
|
|
5256
5384
|
VersionChanged: '1.73'
|
|
5257
5385
|
AllowedMethods:
|
|
5386
|
+
- infinite?
|
|
5258
5387
|
- nonzero?
|
|
5259
5388
|
|
|
5260
5389
|
Style/RedundantConditional:
|
|
@@ -5344,9 +5473,9 @@ Style/RedundantInitialize:
|
|
|
5344
5473
|
Enabled: pending
|
|
5345
5474
|
AutoCorrect: contextual
|
|
5346
5475
|
Safe: false
|
|
5347
|
-
AllowComments: true
|
|
5348
5476
|
VersionAdded: '1.27'
|
|
5349
5477
|
VersionChanged: '1.61'
|
|
5478
|
+
AllowComments: true
|
|
5350
5479
|
|
|
5351
5480
|
Style/RedundantInterpolation:
|
|
5352
5481
|
Description: 'Checks for strings that are just an interpolated expression.'
|
|
@@ -5365,6 +5494,11 @@ Style/RedundantLineContinuation:
|
|
|
5365
5494
|
Enabled: pending
|
|
5366
5495
|
VersionAdded: '1.49'
|
|
5367
5496
|
|
|
5497
|
+
Style/RedundantMinMaxBy:
|
|
5498
|
+
Description: 'Identifies places where `max_by`/`min_by` can be replaced by `max`/`min`.'
|
|
5499
|
+
Enabled: pending
|
|
5500
|
+
VersionAdded: '1.85'
|
|
5501
|
+
|
|
5368
5502
|
Style/RedundantParentheses:
|
|
5369
5503
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
|
5370
5504
|
Enabled: true
|
|
@@ -5442,6 +5576,13 @@ Style/RedundantStringEscape:
|
|
|
5442
5576
|
Enabled: pending
|
|
5443
5577
|
VersionAdded: '1.37'
|
|
5444
5578
|
|
|
5579
|
+
Style/RedundantStructKeywordInit:
|
|
5580
|
+
Description: 'Checks for redundant `keyword_init` option for `Struct.new`.'
|
|
5581
|
+
Enabled: false
|
|
5582
|
+
SafeAutoCorrect: false
|
|
5583
|
+
VersionAdded: '1.85'
|
|
5584
|
+
VersionChanged: '1.86'
|
|
5585
|
+
|
|
5445
5586
|
Style/RegexpLiteral:
|
|
5446
5587
|
Description: 'Use / or %r around regular expressions.'
|
|
5447
5588
|
StyleGuide: '#percent-r'
|
|
@@ -5498,10 +5639,16 @@ Style/ReturnNilInPredicateMethodDefinition:
|
|
|
5498
5639
|
StyleGuide: '#bool-methods-qmark'
|
|
5499
5640
|
Enabled: pending
|
|
5500
5641
|
SafeAutoCorrect: false
|
|
5501
|
-
AllowedMethods: []
|
|
5502
|
-
AllowedPatterns: []
|
|
5503
5642
|
VersionAdded: '1.53'
|
|
5504
5643
|
VersionChanged: '1.67'
|
|
5644
|
+
AllowedMethods: []
|
|
5645
|
+
AllowedPatterns: []
|
|
5646
|
+
|
|
5647
|
+
Style/ReverseFind:
|
|
5648
|
+
Description: 'Use `array.rfind` instead of `array.reverse.find`.'
|
|
5649
|
+
Enabled: pending
|
|
5650
|
+
Safe: false
|
|
5651
|
+
VersionAdded: '1.84'
|
|
5505
5652
|
|
|
5506
5653
|
Style/SafeNavigation:
|
|
5507
5654
|
Description: >-
|
|
@@ -5542,8 +5689,20 @@ Style/Sample:
|
|
|
5542
5689
|
Enabled: true
|
|
5543
5690
|
VersionAdded: '0.30'
|
|
5544
5691
|
|
|
5692
|
+
Style/SelectByKind:
|
|
5693
|
+
Description: 'Prefer grep/grep_v to select/reject/find/detect with a kind check.'
|
|
5694
|
+
Enabled: pending
|
|
5695
|
+
SafeAutoCorrect: false
|
|
5696
|
+
VersionAdded: '1.85'
|
|
5697
|
+
|
|
5698
|
+
Style/SelectByRange:
|
|
5699
|
+
Description: 'Prefer grep/grep_v to select/reject/find/detect with a range check.'
|
|
5700
|
+
Enabled: pending
|
|
5701
|
+
SafeAutoCorrect: false
|
|
5702
|
+
VersionAdded: '1.85'
|
|
5703
|
+
|
|
5545
5704
|
Style/SelectByRegexp:
|
|
5546
|
-
Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
|
|
5705
|
+
Description: 'Prefer grep/grep_v to select/reject/find/detect with a regexp match.'
|
|
5547
5706
|
Enabled: pending
|
|
5548
5707
|
SafeAutoCorrect: false
|
|
5549
5708
|
VersionAdded: '1.22'
|
|
@@ -5802,6 +5961,12 @@ Style/SymbolProc:
|
|
|
5802
5961
|
AllowedPatterns: []
|
|
5803
5962
|
AllowComments: false
|
|
5804
5963
|
|
|
5964
|
+
Style/TallyMethod:
|
|
5965
|
+
Description: 'Prefer `Enumerable#tally` over manual counting patterns.'
|
|
5966
|
+
Enabled: pending
|
|
5967
|
+
Safe: false
|
|
5968
|
+
VersionAdded: '1.85'
|
|
5969
|
+
|
|
5805
5970
|
Style/TernaryParentheses:
|
|
5806
5971
|
Description: 'Checks for use of parentheses around ternary conditions.'
|
|
5807
5972
|
Enabled: true
|
|
@@ -5826,12 +5991,12 @@ Style/TrailingBodyOnClass:
|
|
|
5826
5991
|
VersionAdded: '0.53'
|
|
5827
5992
|
|
|
5828
5993
|
Style/TrailingBodyOnMethodDefinition:
|
|
5829
|
-
Description: '
|
|
5994
|
+
Description: 'Checks for trailing code after the method definition.'
|
|
5830
5995
|
Enabled: true
|
|
5831
5996
|
VersionAdded: '0.52'
|
|
5832
5997
|
|
|
5833
5998
|
Style/TrailingBodyOnModule:
|
|
5834
|
-
Description: '
|
|
5999
|
+
Description: 'Checks for trailing code after the module definition.'
|
|
5835
6000
|
Enabled: true
|
|
5836
6001
|
VersionAdded: '0.53'
|
|
5837
6002
|
|
|
@@ -5844,10 +6009,14 @@ Style/TrailingCommaInArguments:
|
|
|
5844
6009
|
# parenthesized method calls where each argument is on its own line.
|
|
5845
6010
|
# If `consistent_comma`, the cop requires a comma after the last argument,
|
|
5846
6011
|
# for all parenthesized method calls with arguments.
|
|
6012
|
+
# If `diff_comma`, the cop requires a comma after the last argument, but only
|
|
6013
|
+
# when that argument is followed by an immediate newline, even if
|
|
6014
|
+
# there is an inline comment.
|
|
5847
6015
|
EnforcedStyleForMultiline: no_comma
|
|
5848
6016
|
SupportedStylesForMultiline:
|
|
5849
6017
|
- comma
|
|
5850
6018
|
- consistent_comma
|
|
6019
|
+
- diff_comma
|
|
5851
6020
|
- no_comma
|
|
5852
6021
|
|
|
5853
6022
|
Style/TrailingCommaInArrayLiteral:
|
|
@@ -5900,10 +6069,10 @@ Style/TrailingUnderscoreVariable:
|
|
|
5900
6069
|
Description: >-
|
|
5901
6070
|
Checks for the usage of unneeded trailing underscores at the
|
|
5902
6071
|
end of parallel variable assignment.
|
|
5903
|
-
AllowNamedUnderscoreVariables: true
|
|
5904
6072
|
Enabled: true
|
|
5905
6073
|
VersionAdded: '0.31'
|
|
5906
6074
|
VersionChanged: '0.35'
|
|
6075
|
+
AllowNamedUnderscoreVariables: true
|
|
5907
6076
|
|
|
5908
6077
|
# `TrivialAccessors` requires exact name matches and doesn't allow
|
|
5909
6078
|
# predicated methods by default.
|
|
@@ -6036,6 +6205,9 @@ Style/YodaCondition:
|
|
|
6036
6205
|
References:
|
|
6037
6206
|
- 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
|
6038
6207
|
Enabled: true
|
|
6208
|
+
Safe: false
|
|
6209
|
+
VersionAdded: '0.49'
|
|
6210
|
+
VersionChanged: '0.75'
|
|
6039
6211
|
EnforcedStyle: forbid_for_all_comparison_operators
|
|
6040
6212
|
SupportedStyles:
|
|
6041
6213
|
# check all comparison operators
|
|
@@ -6046,9 +6218,6 @@ Style/YodaCondition:
|
|
|
6046
6218
|
- require_for_all_comparison_operators
|
|
6047
6219
|
# enforce yoda only for equality operators: `!=` and `==`
|
|
6048
6220
|
- require_for_equality_operators_only
|
|
6049
|
-
Safe: false
|
|
6050
|
-
VersionAdded: '0.49'
|
|
6051
|
-
VersionChanged: '0.75'
|
|
6052
6221
|
|
|
6053
6222
|
Style/YodaExpression:
|
|
6054
6223
|
Description: 'Forbid the use of yoda expressions.'
|