rubocop 1.65.1 → 1.75.6
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 +72 -72
- data/config/default.yml +299 -55
- data/config/internal_affairs.yml +31 -0
- data/config/obsoletion.yml +3 -1
- data/exe/rubocop +4 -3
- data/lib/rubocop/cached_data.rb +12 -4
- data/lib/rubocop/cli/command/auto_generate_config.rb +6 -7
- data/lib/rubocop/cli/command/execute_runner.rb +4 -4
- data/lib/rubocop/cli/command/lsp.rb +2 -2
- data/lib/rubocop/cli/command/show_cops.rb +24 -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 +1 -1
- data/lib/rubocop/comment_config.rb +3 -3
- data/lib/rubocop/config.rb +57 -11
- data/lib/rubocop/config_loader.rb +66 -17
- data/lib/rubocop/config_loader_resolver.rb +39 -14
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -3
- data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
- data/lib/rubocop/config_obsoletion.rb +46 -2
- data/lib/rubocop/config_validator.rb +27 -15
- data/lib/rubocop/cop/autocorrect_logic.rb +36 -19
- data/lib/rubocop/cop/base.rb +17 -3
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +2 -2
- data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
- data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
- data/lib/rubocop/cop/bundler/gem_version.rb +1 -0
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
- data/lib/rubocop/cop/cop.rb +8 -0
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -12
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -0
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
- data/lib/rubocop/cop/documentation.rb +18 -1
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +1 -2
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +0 -2
- data/lib/rubocop/cop/generator.rb +6 -0
- data/lib/rubocop/cop/internal_affairs/cop_description.rb +0 -4
- 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 +8 -4
- data/lib/rubocop/cop/internal_affairs/location_exists.rb +116 -0
- data/lib/rubocop/cop/internal_affairs/location_expression.rb +2 -1
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -4
- data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +3 -2
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +2 -2
- 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 +230 -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/redundant_described_class_as_subject.rb +6 -5
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +6 -21
- data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +11 -2
- 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 +0 -5
- data/lib/rubocop/cop/internal_affairs.rb +7 -0
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +6 -2
- data/lib/rubocop/cop/layout/argument_alignment.rb +2 -9
- data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
- 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 +1 -0
- data/lib/rubocop/cop/layout/class_structure.rb +9 -9
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +4 -4
- data/lib/rubocop/cop/layout/def_end_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/dot_position.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +4 -4
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +9 -12
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +30 -4
- 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 +12 -8
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +23 -1
- data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +3 -8
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -10
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -7
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +8 -0
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +8 -6
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +12 -12
- data/lib/rubocop/cop/layout/leading_comment_space.rb +83 -1
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +11 -2
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +7 -1
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/line_length.rb +135 -16
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -0
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +25 -0
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +4 -4
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +1 -0
- 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 +19 -46
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +6 -7
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
- data/lib/rubocop/cop/layout/space_after_comma.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +11 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -1
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_operators.rb +23 -21
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -0
- data/lib/rubocop/cop/layout/space_before_brackets.rb +5 -5
- data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +11 -1
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -0
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +7 -0
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +0 -1
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +5 -3
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_range.rb +4 -1
- data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +118 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -3
- data/lib/rubocop/cop/lint/big_decimal_new.rb +4 -7
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +10 -12
- data/lib/rubocop/cop/lint/boolean_symbol.rb +2 -2
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +4 -1
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
- data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
- data/lib/rubocop/cop/lint/cop_directive_syntax.rb +84 -0
- data/lib/rubocop/cop/lint/debugger.rb +3 -3
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +3 -2
- data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +46 -19
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_set_element.rb +87 -0
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +29 -58
- data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
- 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/ensure_return.rb +1 -4
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +1 -7
- data/lib/rubocop/cop/lint/float_comparison.rb +21 -17
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -4
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +2 -2
- data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +13 -5
- data/lib/rubocop/cop/lint/interpolation_check.rb +9 -0
- data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +8 -14
- data/lib/rubocop/cop/lint/literal_as_condition.rb +118 -9
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +49 -8
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/missing_super.rb +2 -2
- data/lib/rubocop/cop/lint/mixed_case_range.rb +5 -8
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +10 -6
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +2 -2
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +12 -3
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -3
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -3
- data/lib/rubocop/cop/lint/number_conversion.rb +0 -1
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -2
- data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +93 -0
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -3
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +3 -2
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +6 -11
- data/lib/rubocop/cop/lint/raise_exception.rb +29 -10
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +0 -21
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +13 -8
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +8 -7
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +261 -0
- data/lib/rubocop/cop/lint/redundant_with_index.rb +3 -0
- data/lib/rubocop/cop/lint/redundant_with_object.rb +3 -0
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +1 -1
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +0 -1
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_type.rb +3 -7
- data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -11
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +17 -1
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +109 -41
- data/lib/rubocop/cop/lint/self_assignment.rb +8 -10
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +8 -1
- data/lib/rubocop/cop/lint/shared_mutable_default.rb +76 -0
- data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
- data/lib/rubocop/cop/lint/symbol_conversion.rb +2 -2
- data/lib/rubocop/cop/lint/syntax.rb +4 -1
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
- data/lib/rubocop/cop/lint/top_level_return_with_argument.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/unmodified_reduce_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_code.rb +52 -2
- data/lib/rubocop/cop/lint/unreachable_loop.rb +6 -6
- 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 +5 -4
- data/lib/rubocop/cop/lint/useless_assignment.rb +20 -11
- data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
- data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -0
- data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/useless_numeric_operation.rb +78 -0
- data/lib/rubocop/cop/lint/useless_rescue.rb +2 -2
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +2 -2
- data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -25
- data/lib/rubocop/cop/lint/void.rb +40 -14
- data/lib/rubocop/cop/message_annotator.rb +7 -3
- data/lib/rubocop/cop/metrics/block_length.rb +7 -5
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/class_length.rb +15 -14
- data/lib/rubocop/cop/metrics/collection_literal_length.rb +7 -0
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +5 -2
- data/lib/rubocop/cop/metrics/method_length.rb +15 -6
- 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 +1 -1
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +3 -4
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
- data/lib/rubocop/cop/mixin/alignment.rb +2 -2
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +4 -4
- data/lib/rubocop/cop/mixin/annotation_comment.rb +0 -2
- 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/comments_help.rb +8 -3
- 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/empty_lines_around_body.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 +22 -11
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +15 -14
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +22 -22
- 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/line_length_help.rb +12 -6
- data/lib/rubocop/cop/mixin/method_complexity.rb +2 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +7 -9
- data/lib/rubocop/cop/mixin/percent_array.rb +1 -1
- data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +68 -30
- data/lib/rubocop/cop/mixin/range_help.rb +15 -4
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +11 -5
- data/lib/rubocop/cop/mixin/string_help.rb +2 -2
- data/lib/rubocop/cop/mixin/string_literals_help.rb +12 -0
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +21 -5
- data/lib/rubocop/cop/naming/accessor_method_name.rb +11 -6
- data/lib/rubocop/cop/naming/block_forwarding.rb +20 -16
- data/lib/rubocop/cop/naming/constant_name.rb +6 -7
- data/lib/rubocop/cop/naming/file_name.rb +0 -2
- data/lib/rubocop/cop/naming/inclusive_language.rb +12 -3
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +12 -13
- data/lib/rubocop/cop/naming/method_name.rb +64 -8
- data/lib/rubocop/cop/naming/predicate_name.rb +46 -2
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +6 -14
- data/lib/rubocop/cop/naming/variable_name.rb +50 -6
- data/lib/rubocop/cop/naming/variable_number.rb +2 -3
- data/lib/rubocop/cop/offense.rb +4 -5
- data/lib/rubocop/cop/registry.rb +9 -6
- data/lib/rubocop/cop/security/compound_hash.rb +2 -0
- data/lib/rubocop/cop/security/yaml_load.rb +3 -2
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +96 -28
- data/lib/rubocop/cop/style/accessor_grouping.rb +29 -7
- data/lib/rubocop/cop/style/alias.rb +1 -1
- 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 +94 -30
- data/lib/rubocop/cop/style/array_first_last.rb +18 -2
- data/lib/rubocop/cop/style/array_intersect.rb +42 -30
- data/lib/rubocop/cop/style/bitwise_predicate.rb +100 -0
- data/lib/rubocop/cop/style/block_delimiters.rb +51 -20
- data/lib/rubocop/cop/style/case_like_if.rb +8 -11
- data/lib/rubocop/cop/style/class_and_module_children.rb +52 -11
- data/lib/rubocop/cop/style/class_equality_comparison.rb +1 -1
- data/lib/rubocop/cop/style/collection_compact.rb +10 -10
- data/lib/rubocop/cop/style/collection_methods.rb +2 -1
- data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
- data/lib/rubocop/cop/style/combinable_loops.rb +10 -2
- data/lib/rubocop/cop/style/commented_keyword.rb +25 -2
- data/lib/rubocop/cop/style/comparable_between.rb +78 -0
- data/lib/rubocop/cop/style/concat_array_literals.rb +1 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +40 -28
- data/lib/rubocop/cop/style/constant_visibility.rb +3 -12
- data/lib/rubocop/cop/style/data_inheritance.rb +8 -1
- data/lib/rubocop/cop/style/dig_chain.rb +89 -0
- data/lib/rubocop/cop/style/documentation.rb +1 -1
- data/lib/rubocop/cop/style/double_negation.rb +4 -4
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +4 -7
- data/lib/rubocop/cop/style/each_with_object.rb +2 -3
- 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_literal.rb +35 -22
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/endless_method.rb +150 -18
- data/lib/rubocop/cop/style/eval_with_location.rb +5 -5
- data/lib/rubocop/cop/style/exact_regexp_match.rb +2 -3
- data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
- data/lib/rubocop/cop/style/explicit_block_argument.rb +16 -3
- data/lib/rubocop/cop/style/exponential_notation.rb +3 -3
- data/lib/rubocop/cop/style/fetch_env_var.rb +2 -1
- data/lib/rubocop/cop/style/file_null.rb +89 -0
- data/lib/rubocop/cop/style/file_touch.rb +75 -0
- data/lib/rubocop/cop/style/float_division.rb +8 -4
- data/lib/rubocop/cop/style/for.rb +1 -1
- data/lib/rubocop/cop/style/format_string_token.rb +38 -11
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -2
- data/lib/rubocop/cop/style/global_std_stream.rb +3 -0
- data/lib/rubocop/cop/style/global_vars.rb +1 -3
- data/lib/rubocop/cop/style/guard_clause.rb +20 -4
- data/lib/rubocop/cop/style/hash_conversion.rb +1 -2
- data/lib/rubocop/cop/style/hash_each_methods.rb +12 -8
- data/lib/rubocop/cop/style/hash_except.rb +35 -147
- data/lib/rubocop/cop/style/hash_fetch_chain.rb +104 -0
- data/lib/rubocop/cop/style/hash_slice.rb +80 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +11 -5
- 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 +26 -7
- data/lib/rubocop/cop/style/if_inside_else.rb +11 -15
- data/lib/rubocop/cop/style/if_unless_modifier.rb +25 -5
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +3 -4
- data/lib/rubocop/cop/style/if_with_semicolon.rb +60 -6
- 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 +15 -12
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +2 -2
- 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 +100 -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 +2 -1
- data/lib/rubocop/cop/style/lambda_call.rb +10 -4
- 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_into_array.rb +75 -14
- data/lib/rubocop/cop/style/map_to_hash.rb +1 -1
- data/lib/rubocop/cop/style/map_to_set.rb +3 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +38 -23
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +2 -0
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +10 -13
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -4
- data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/missing_else.rb +2 -0
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +33 -3
- 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 +1 -9
- data/lib/rubocop/cop/style/multiple_comparison.rb +53 -60
- data/lib/rubocop/cop/style/mutable_constant.rb +7 -8
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -5
- 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 +5 -4
- data/lib/rubocop/cop/style/next.rb +44 -0
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +2 -2
- data/lib/rubocop/cop/style/object_then.rb +15 -15
- data/lib/rubocop/cop/style/one_line_conditional.rb +30 -5
- data/lib/rubocop/cop/style/open_struct_use.rb +5 -5
- data/lib/rubocop/cop/style/operator_method_call.rb +25 -7
- data/lib/rubocop/cop/style/or_assignment.rb +3 -6
- data/lib/rubocop/cop/style/parallel_assignment.rb +14 -22
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +2 -2
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
- data/lib/rubocop/cop/style/proc.rb +2 -2
- data/lib/rubocop/cop/style/quoted_symbols.rb +1 -3
- data/lib/rubocop/cop/style/raise_args.rb +15 -13
- data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
- data/lib/rubocop/cop/style/redundant_argument.rb +3 -1
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +6 -1
- data/lib/rubocop/cop/style/redundant_condition.rb +97 -24
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +16 -5
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +6 -10
- data/lib/rubocop/cop/style/redundant_each.rb +1 -1
- data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
- data/lib/rubocop/cop/style/redundant_format.rb +257 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +3 -3
- data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
- data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +46 -0
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +56 -20
- data/lib/rubocop/cop/style/redundant_parentheses.rb +57 -27
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +8 -1
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +2 -2
- data/lib/rubocop/cop/style/redundant_self.rb +9 -15
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +20 -32
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +4 -4
- data/lib/rubocop/cop/style/redundant_sort.rb +3 -3
- data/lib/rubocop/cop/style/redundant_sort_by.rb +17 -1
- data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -2
- data/lib/rubocop/cop/style/require_order.rb +1 -1
- data/lib/rubocop/cop/style/rescue_modifier.rb +18 -4
- data/lib/rubocop/cop/style/return_nil.rb +2 -2
- data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +54 -12
- data/lib/rubocop/cop/style/safe_navigation.rb +123 -54
- data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
- data/lib/rubocop/cop/style/select_by_regexp.rb +14 -8
- data/lib/rubocop/cop/style/self_assignment.rb +11 -17
- data/lib/rubocop/cop/style/semicolon.rb +2 -2
- data/lib/rubocop/cop/style/send_with_literal_method_name.rb +2 -1
- data/lib/rubocop/cop/style/signal_exception.rb +2 -3
- data/lib/rubocop/cop/style/single_argument_dig.rb +9 -5
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +15 -4
- data/lib/rubocop/cop/style/single_line_methods.rb +6 -7
- data/lib/rubocop/cop/style/slicing_with_range.rb +40 -11
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +42 -106
- data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
- 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_methods.rb +1 -1
- data/lib/rubocop/cop/style/struct_inheritance.rb +9 -2
- data/lib/rubocop/cop/style/super_arguments.rb +66 -19
- data/lib/rubocop/cop/style/swap_values.rb +4 -15
- data/lib/rubocop/cop/style/symbol_proc.rb +2 -0
- 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_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_hash_literal.rb +48 -6
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -4
- data/lib/rubocop/cop/style/trivial_accessors.rb +2 -2
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
- data/lib/rubocop/cop/style/while_until_modifier.rb +0 -1
- data/lib/rubocop/cop/style/yoda_condition.rb +8 -4
- data/lib/rubocop/cop/style/yoda_expression.rb +2 -1
- data/lib/rubocop/cop/team.rb +14 -3
- data/lib/rubocop/cop/util.rb +12 -5
- data/lib/rubocop/cop/utils/format_string.rb +10 -5
- data/lib/rubocop/cop/variable_force/assignment.rb +18 -3
- data/lib/rubocop/cop/variable_force/branch.rb +1 -1
- data/lib/rubocop/cop/variable_force/scope.rb +1 -1
- data/lib/rubocop/cop/variable_force/variable.rb +14 -3
- data/lib/rubocop/cop/variable_force/variable_table.rb +5 -5
- data/lib/rubocop/cop/variable_force.rb +5 -11
- data/lib/rubocop/cops_documentation_generator.rb +117 -53
- data/lib/rubocop/directive_comment.rb +45 -11
- data/lib/rubocop/ext/regexp_node.rb +0 -1
- data/lib/rubocop/file_finder.rb +9 -4
- data/lib/rubocop/formatter/disabled_config_formatter.rb +3 -2
- data/lib/rubocop/formatter/formatter_set.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +1 -1
- data/lib/rubocop/formatter/junit_formatter.rb +70 -23
- data/lib/rubocop/formatter/pacman_formatter.rb +1 -1
- data/lib/rubocop/lockfile.rb +6 -4
- data/lib/rubocop/lsp/diagnostic.rb +189 -0
- data/lib/rubocop/lsp/logger.rb +2 -2
- data/lib/rubocop/lsp/routes.rb +7 -23
- data/lib/rubocop/lsp/runtime.rb +19 -49
- data/lib/rubocop/lsp/server.rb +0 -3
- data/lib/rubocop/lsp/stdin_runner.rb +85 -0
- data/lib/rubocop/magic_comment.rb +11 -3
- data/lib/rubocop/options.rb +28 -12
- data/lib/rubocop/path_util.rb +15 -8
- 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 +4 -1
- data/lib/rubocop/remote_config.rb +5 -1
- data/lib/rubocop/result_cache.rb +15 -21
- data/lib/rubocop/rspec/cop_helper.rb +13 -1
- data/lib/rubocop/rspec/expect_offense.rb +7 -2
- data/lib/rubocop/rspec/shared_contexts.rb +40 -3
- data/lib/rubocop/rspec/support.rb +4 -2
- data/lib/rubocop/runner.rb +27 -13
- data/lib/rubocop/server/cache.rb +52 -11
- data/lib/rubocop/server/cli.rb +2 -2
- data/lib/rubocop/server/core.rb +1 -0
- data/lib/rubocop/target_finder.rb +7 -2
- data/lib/rubocop/target_ruby.rb +36 -17
- data/lib/rubocop/version.rb +54 -11
- data/lib/rubocop/yaml_duplication_checker.rb +20 -26
- data/lib/rubocop.rb +36 -2
- data/lib/ruby_lsp/rubocop/addon.rb +75 -0
- data/lib/ruby_lsp/rubocop/runtime_adapter.rb +65 -0
- metadata +83 -40
- data/lib/rubocop/cop/utils/regexp_ranges.rb +0 -113
- data/lib/rubocop/rspec/host_environment_simulation_helper.rb +0 -28
data/config/default.yml
CHANGED
@@ -82,6 +82,8 @@ AllCops:
|
|
82
82
|
StyleGuideBaseURL: https://rubystyle.guide
|
83
83
|
# Documentation URLs will be constructed using the base URL.
|
84
84
|
DocumentationBaseURL: https://docs.rubocop.org/rubocop
|
85
|
+
# Documentation URLs will end with this extension.
|
86
|
+
DocumentationExtension: .html
|
85
87
|
# Extra details are not displayed in offense messages by default. Change
|
86
88
|
# behavior by overriding ExtraDetails, or by giving the
|
87
89
|
# `-E/--extra-details` option.
|
@@ -144,12 +146,14 @@ AllCops:
|
|
144
146
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
145
147
|
# supported Ruby version (currently Ruby 2.7).
|
146
148
|
TargetRubyVersion: ~
|
147
|
-
#
|
149
|
+
# RuboCop choses the parser engine automatically but you can also specify it yourself.
|
150
|
+
# These options are available:
|
151
|
+
# - `default`
|
148
152
|
# - `parser_whitequark` ... https://github.com/whitequark/parser
|
149
153
|
# - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
|
150
|
-
#
|
151
|
-
#
|
152
|
-
ParserEngine:
|
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
|
153
157
|
# Determines if a notification for extension libraries should be shown when
|
154
158
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
155
159
|
# of gems in the Gemfile that the extension is suggested for, if not already
|
@@ -166,6 +170,11 @@ AllCops:
|
|
166
170
|
rubocop-rspec_rails: [rspec-rails]
|
167
171
|
# Enable/Disable checking the methods extended by Active Support.
|
168
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: ~
|
169
178
|
|
170
179
|
#################### Bundler ###############################
|
171
180
|
|
@@ -265,7 +274,8 @@ Bundler/OrderedGems:
|
|
265
274
|
Gemspec/AddRuntimeDependency:
|
266
275
|
Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
|
267
276
|
StyleGuide: '#add_dependency_vs_add_runtime_dependency'
|
268
|
-
|
277
|
+
References:
|
278
|
+
- https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
|
269
279
|
Enabled: pending
|
270
280
|
VersionAdded: '1.65'
|
271
281
|
Include:
|
@@ -334,7 +344,7 @@ Gemspec/RequireMFA:
|
|
334
344
|
Severity: warning
|
335
345
|
VersionAdded: '1.23'
|
336
346
|
VersionChanged: '1.40'
|
337
|
-
|
347
|
+
References:
|
338
348
|
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
339
349
|
Include:
|
340
350
|
- '**/*.gemspec'
|
@@ -595,7 +605,7 @@ Layout/EmptyLineAfterMultilineCondition:
|
|
595
605
|
# This is disabled, because this style is not very common in practice.
|
596
606
|
Enabled: false
|
597
607
|
VersionAdded: '0.90'
|
598
|
-
|
608
|
+
References:
|
599
609
|
- https://github.com/airbnb/ruby#multiline-if-newline
|
600
610
|
|
601
611
|
Layout/EmptyLineBetweenDefs:
|
@@ -630,7 +640,7 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
630
640
|
SupportedStyles:
|
631
641
|
- around
|
632
642
|
- only_before
|
633
|
-
|
643
|
+
References:
|
634
644
|
# A reference to `EnforcedStyle: only_before`.
|
635
645
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
636
646
|
|
@@ -854,6 +864,7 @@ Layout/FirstMethodArgumentLineBreak:
|
|
854
864
|
Enabled: false
|
855
865
|
VersionAdded: '0.49'
|
856
866
|
AllowMultilineFinalElement: false
|
867
|
+
AllowedMethods: []
|
857
868
|
|
858
869
|
Layout/FirstMethodParameterLineBreak:
|
859
870
|
Description: >-
|
@@ -986,7 +997,7 @@ Layout/IndentationConsistency:
|
|
986
997
|
SupportedStyles:
|
987
998
|
- normal
|
988
999
|
- indented_internal_methods
|
989
|
-
|
1000
|
+
References:
|
990
1001
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
991
1002
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
992
1003
|
|
@@ -1029,6 +1040,8 @@ Layout/LeadingCommentSpace:
|
|
1029
1040
|
VersionChanged: '0.73'
|
1030
1041
|
AllowDoxygenCommentStyle: false
|
1031
1042
|
AllowGemfileRubyComment: false
|
1043
|
+
AllowRBSInlineAnnotation: false
|
1044
|
+
AllowSteepAnnotation: false
|
1032
1045
|
|
1033
1046
|
Layout/LeadingEmptyLines:
|
1034
1047
|
Description: Check for unnecessary blank lines at the beginning of a file.
|
@@ -1076,11 +1089,11 @@ Layout/LineLength:
|
|
1076
1089
|
StyleGuide: '#max-line-length'
|
1077
1090
|
Enabled: true
|
1078
1091
|
VersionAdded: '0.25'
|
1079
|
-
VersionChanged: '1.
|
1092
|
+
VersionChanged: '1.69'
|
1080
1093
|
Max: 120
|
1094
|
+
AllowHeredoc: true
|
1081
1095
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
1082
1096
|
# containing a URI to be longer than Max.
|
1083
|
-
AllowHeredoc: true
|
1084
1097
|
AllowURI: true
|
1085
1098
|
URISchemes:
|
1086
1099
|
- http
|
@@ -1092,6 +1105,8 @@ Layout/LineLength:
|
|
1092
1105
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
1093
1106
|
# any regular expression listed in this option will be ignored by LineLength.
|
1094
1107
|
AllowedPatterns: []
|
1108
|
+
# If SplitStrings is true, long strings will be split using continuations
|
1109
|
+
SplitStrings: false
|
1095
1110
|
|
1096
1111
|
Layout/MultilineArrayBraceLayout:
|
1097
1112
|
Description: >-
|
@@ -1489,7 +1504,6 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
1489
1504
|
- space
|
1490
1505
|
- no_space
|
1491
1506
|
|
1492
|
-
|
1493
1507
|
Layout/SpaceInsideParens:
|
1494
1508
|
Description: 'No spaces after ( or before ).'
|
1495
1509
|
StyleGuide: '#spaces-braces'
|
@@ -1605,6 +1619,12 @@ Lint/AmbiguousRegexpLiteral:
|
|
1605
1619
|
VersionAdded: '0.17'
|
1606
1620
|
VersionChanged: '0.83'
|
1607
1621
|
|
1622
|
+
Lint/ArrayLiteralInRegexp:
|
1623
|
+
Description: 'Checks for an array literal interpolated inside a regexp.'
|
1624
|
+
Enabled: pending
|
1625
|
+
VersionAdded: '1.71'
|
1626
|
+
SafeAutoCorrect: false
|
1627
|
+
|
1608
1628
|
Lint/AssignmentInCondition:
|
1609
1629
|
Description: "Don't use assignment in conditions."
|
1610
1630
|
StyleGuide: '#safe-assignment-in-condition'
|
@@ -1624,7 +1644,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1624
1644
|
Enabled: true
|
1625
1645
|
Safe: false
|
1626
1646
|
VersionAdded: '0.89'
|
1627
|
-
VersionChanged: '1.
|
1647
|
+
VersionChanged: '1.69'
|
1628
1648
|
|
1629
1649
|
Lint/BooleanSymbol:
|
1630
1650
|
Description: 'Check for `:true` and `:false` symbols.'
|
@@ -1654,6 +1674,11 @@ Lint/ConstantOverwrittenInRescue:
|
|
1654
1674
|
Enabled: pending
|
1655
1675
|
VersionAdded: '1.31'
|
1656
1676
|
|
1677
|
+
Lint/ConstantReassignment:
|
1678
|
+
Description: 'Checks for constant reassignments.'
|
1679
|
+
Enabled: pending
|
1680
|
+
VersionAdded: '1.70'
|
1681
|
+
|
1657
1682
|
Lint/ConstantResolution:
|
1658
1683
|
Description: 'Check that constants are fully qualified with `::`.'
|
1659
1684
|
Enabled: false
|
@@ -1663,6 +1688,11 @@ Lint/ConstantResolution:
|
|
1663
1688
|
# Restrict this cop from only looking at certain names
|
1664
1689
|
Ignore: []
|
1665
1690
|
|
1691
|
+
Lint/CopDirectiveSyntax:
|
1692
|
+
Description: 'Checks that `# rubocop:` directives are strictly formatted.'
|
1693
|
+
Enabled: pending
|
1694
|
+
VersionAdded: '1.72'
|
1695
|
+
|
1666
1696
|
Lint/Debugger:
|
1667
1697
|
Description: 'Check for debugger calls.'
|
1668
1698
|
Enabled: true
|
@@ -1776,6 +1806,7 @@ Lint/DuplicateBranch:
|
|
1776
1806
|
VersionChanged: '1.7'
|
1777
1807
|
IgnoreLiteralBranches: false
|
1778
1808
|
IgnoreConstantBranches: false
|
1809
|
+
IgnoreDuplicateElseBranch: false
|
1779
1810
|
|
1780
1811
|
Lint/DuplicateCaseCondition:
|
1781
1812
|
Description: 'Do not repeat values in case conditionals.'
|
@@ -1825,6 +1856,11 @@ Lint/DuplicateRescueException:
|
|
1825
1856
|
Enabled: true
|
1826
1857
|
VersionAdded: '0.89'
|
1827
1858
|
|
1859
|
+
Lint/DuplicateSetElement:
|
1860
|
+
Description: 'Checks for duplicate elements in Set.'
|
1861
|
+
Enabled: pending
|
1862
|
+
VersionAdded: '1.67'
|
1863
|
+
|
1828
1864
|
Lint/EachWithObjectArgument:
|
1829
1865
|
Description: 'Check for immutable argument given to each_with_object.'
|
1830
1866
|
Enabled: true
|
@@ -1854,10 +1890,9 @@ Lint/EmptyConditionalBody:
|
|
1854
1890
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1855
1891
|
Enabled: true
|
1856
1892
|
AutoCorrect: contextual
|
1857
|
-
SafeAutoCorrect: false
|
1858
1893
|
AllowComments: true
|
1859
1894
|
VersionAdded: '0.89'
|
1860
|
-
VersionChanged: '1.
|
1895
|
+
VersionChanged: '1.73'
|
1861
1896
|
|
1862
1897
|
Lint/EmptyEnsure:
|
1863
1898
|
Description: 'Checks for empty ensure block.'
|
@@ -1940,6 +1975,11 @@ Lint/HashCompareByIdentity:
|
|
1940
1975
|
Safe: false
|
1941
1976
|
VersionAdded: '0.93'
|
1942
1977
|
|
1978
|
+
Lint/HashNewWithKeywordArgumentsAsDefault:
|
1979
|
+
Description: 'Checks for the deprecated use of keyword arguments for hash default in `Hash.new`.'
|
1980
|
+
Enabled: pending
|
1981
|
+
VersionAdded: '1.69'
|
1982
|
+
|
1943
1983
|
Lint/HeredocMethodCallPosition:
|
1944
1984
|
Description: >-
|
1945
1985
|
Checks for the ordering of a method call where
|
@@ -1996,7 +2036,8 @@ Lint/InterpolationCheck:
|
|
1996
2036
|
|
1997
2037
|
Lint/ItWithoutArgumentsInBlock:
|
1998
2038
|
Description: 'Checks uses of `it` calls without arguments in block.'
|
1999
|
-
|
2039
|
+
References:
|
2040
|
+
- 'https://bugs.ruby-lang.org/issues/18980'
|
2000
2041
|
Enabled: pending
|
2001
2042
|
VersionAdded: '1.59'
|
2002
2043
|
|
@@ -2008,6 +2049,7 @@ Lint/LambdaWithoutLiteralBlock:
|
|
2008
2049
|
Lint/LiteralAsCondition:
|
2009
2050
|
Description: 'Checks of literals used in conditions.'
|
2010
2051
|
Enabled: true
|
2052
|
+
AutoCorrect: contextual
|
2011
2053
|
VersionAdded: '0.51'
|
2012
2054
|
|
2013
2055
|
Lint/LiteralAssignmentInCondition:
|
@@ -2130,6 +2172,11 @@ Lint/NumberedParameterAssignment:
|
|
2130
2172
|
Enabled: pending
|
2131
2173
|
VersionAdded: '1.9'
|
2132
2174
|
|
2175
|
+
Lint/NumericOperationWithConstantResult:
|
2176
|
+
Description: 'Checks for numeric operations with constant results.'
|
2177
|
+
Enabled: pending
|
2178
|
+
VersionAdded: '1.69'
|
2179
|
+
|
2133
2180
|
Lint/OrAssignmentToConstant:
|
2134
2181
|
Description: 'Checks unintended or-assignment to constant.'
|
2135
2182
|
Enabled: pending
|
@@ -2216,9 +2263,8 @@ Lint/RedundantRegexpQuantifiers:
|
|
2216
2263
|
Lint/RedundantRequireStatement:
|
2217
2264
|
Description: 'Checks for unnecessary `require` statement.'
|
2218
2265
|
Enabled: true
|
2219
|
-
SafeAutoCorrect: false
|
2220
2266
|
VersionAdded: '0.76'
|
2221
|
-
VersionChanged: '1.
|
2267
|
+
VersionChanged: '1.73'
|
2222
2268
|
|
2223
2269
|
Lint/RedundantSafeNavigation:
|
2224
2270
|
Description: 'Checks for redundant safe navigation calls.'
|
@@ -2247,6 +2293,11 @@ Lint/RedundantStringCoercion:
|
|
2247
2293
|
VersionAdded: '0.19'
|
2248
2294
|
VersionChanged: '0.77'
|
2249
2295
|
|
2296
|
+
Lint/RedundantTypeConversion:
|
2297
|
+
Description: 'Checks for redundantly converting a literal to the same type.'
|
2298
|
+
Enabled: pending
|
2299
|
+
VersionAdded: '1.72'
|
2300
|
+
|
2250
2301
|
Lint/RedundantWithIndex:
|
2251
2302
|
Description: 'Checks for redundant `with_index`.'
|
2252
2303
|
Enabled: true
|
@@ -2320,9 +2371,9 @@ Lint/SafeNavigationChain:
|
|
2320
2371
|
|
2321
2372
|
Lint/SafeNavigationConsistency:
|
2322
2373
|
Description: >-
|
2323
|
-
Check to make sure that if safe navigation is used
|
2324
|
-
|
2325
|
-
for all method calls on
|
2374
|
+
Check to make sure that if safe navigation is used in an `&&` or `||` condition,
|
2375
|
+
consistent and appropriate safe navigation, without excess or deficiency,
|
2376
|
+
is used for all method calls on the same object.
|
2326
2377
|
Enabled: true
|
2327
2378
|
VersionAdded: '0.55'
|
2328
2379
|
VersionChanged: '0.77'
|
@@ -2361,7 +2412,6 @@ Lint/ShadowedArgument:
|
|
2361
2412
|
VersionAdded: '0.52'
|
2362
2413
|
IgnoreImplicitReferences: false
|
2363
2414
|
|
2364
|
-
|
2365
2415
|
Lint/ShadowedException:
|
2366
2416
|
Description: >-
|
2367
2417
|
Avoid rescuing a higher level exception
|
@@ -2376,6 +2426,12 @@ Lint/ShadowingOuterLocalVariable:
|
|
2376
2426
|
Enabled: true
|
2377
2427
|
VersionAdded: '0.9'
|
2378
2428
|
|
2429
|
+
Lint/SharedMutableDefault:
|
2430
|
+
Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
|
2431
|
+
StyleGuide: '#no-mutable-defaults'
|
2432
|
+
Enabled: pending
|
2433
|
+
VersionAdded: '1.70'
|
2434
|
+
|
2379
2435
|
Lint/StructNewOverride:
|
2380
2436
|
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
2381
2437
|
Enabled: true
|
@@ -2390,6 +2446,12 @@ Lint/SuppressedException:
|
|
2390
2446
|
VersionAdded: '0.9'
|
2391
2447
|
VersionChanged: '1.12'
|
2392
2448
|
|
2449
|
+
Lint/SuppressedExceptionInNumberConversion:
|
2450
|
+
Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
|
2451
|
+
Enabled: pending
|
2452
|
+
SafeAutoCorrect: false
|
2453
|
+
VersionAdded: '1.72'
|
2454
|
+
|
2393
2455
|
Lint/SymbolConversion:
|
2394
2456
|
Description: 'Checks for unnecessary symbol conversions.'
|
2395
2457
|
Enabled: pending
|
@@ -2441,6 +2503,11 @@ Lint/UnderscorePrefixedVariableName:
|
|
2441
2503
|
VersionAdded: '0.21'
|
2442
2504
|
AllowKeywordBlockArguments: false
|
2443
2505
|
|
2506
|
+
Lint/UnescapedBracketInRegexp:
|
2507
|
+
Description: 'Checks for unescaped literal `]` in Regexp.'
|
2508
|
+
Enabled: pending
|
2509
|
+
VersionAdded: '1.68'
|
2510
|
+
|
2444
2511
|
Lint/UnexpectedBlockArity:
|
2445
2512
|
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2446
2513
|
Enabled: pending
|
@@ -2500,10 +2567,12 @@ Lint/UnusedMethodArgument:
|
|
2500
2567
|
Enabled: true
|
2501
2568
|
AutoCorrect: contextual
|
2502
2569
|
VersionAdded: '0.21'
|
2503
|
-
VersionChanged: '1.
|
2570
|
+
VersionChanged: '1.69'
|
2504
2571
|
AllowUnusedKeywordArguments: false
|
2505
2572
|
IgnoreEmptyMethods: true
|
2506
2573
|
IgnoreNotImplementedMethods: true
|
2574
|
+
NotImplementedExceptions:
|
2575
|
+
- NotImplementedError
|
2507
2576
|
|
2508
2577
|
Lint/UriEscapeUnescape:
|
2509
2578
|
Description: >-
|
@@ -2536,8 +2605,17 @@ Lint/UselessAssignment:
|
|
2536
2605
|
Enabled: true
|
2537
2606
|
AutoCorrect: contextual
|
2538
2607
|
VersionAdded: '0.11'
|
2539
|
-
VersionChanged: '1.
|
2540
|
-
|
2608
|
+
VersionChanged: '1.66'
|
2609
|
+
|
2610
|
+
Lint/UselessConstantScoping:
|
2611
|
+
Description: 'Checks for useless constant scoping.'
|
2612
|
+
Enabled: pending
|
2613
|
+
VersionAdded: '1.72'
|
2614
|
+
|
2615
|
+
Lint/UselessDefined:
|
2616
|
+
Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
|
2617
|
+
Enabled: pending
|
2618
|
+
VersionAdded: '1.69'
|
2541
2619
|
|
2542
2620
|
Lint/UselessElseWithoutRescue:
|
2543
2621
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
@@ -2553,6 +2631,11 @@ Lint/UselessMethodDefinition:
|
|
2553
2631
|
VersionChanged: '1.61'
|
2554
2632
|
Safe: false
|
2555
2633
|
|
2634
|
+
Lint/UselessNumericOperation:
|
2635
|
+
Description: 'Checks for useless numeric operations.'
|
2636
|
+
Enabled: pending
|
2637
|
+
VersionAdded: '1.66'
|
2638
|
+
|
2556
2639
|
Lint/UselessRescue:
|
2557
2640
|
Description: 'Checks for useless `rescue`s.'
|
2558
2641
|
Enabled: pending
|
@@ -2592,7 +2675,7 @@ Metrics/AbcSize:
|
|
2592
2675
|
Description: >-
|
2593
2676
|
A calculated magnitude based on number of assignments,
|
2594
2677
|
branches, and conditions.
|
2595
|
-
|
2678
|
+
References:
|
2596
2679
|
- http://c2.com/cgi/wiki?AbcMetric
|
2597
2680
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
2598
2681
|
Enabled: true
|
@@ -2916,6 +2999,7 @@ Naming/MethodName:
|
|
2916
2999
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2917
3000
|
Enabled: true
|
2918
3001
|
VersionAdded: '0.50'
|
3002
|
+
VersionChanged: '1.75'
|
2919
3003
|
EnforcedStyle: snake_case
|
2920
3004
|
SupportedStyles:
|
2921
3005
|
- snake_case
|
@@ -2927,6 +3011,10 @@ Naming/MethodName:
|
|
2927
3011
|
# - '\A\s*onSelectionCleared\s*'
|
2928
3012
|
#
|
2929
3013
|
AllowedPatterns: []
|
3014
|
+
ForbiddenIdentifiers:
|
3015
|
+
- __id__
|
3016
|
+
- __send__
|
3017
|
+
ForbiddenPatterns: []
|
2930
3018
|
|
2931
3019
|
Naming/MethodParameterName:
|
2932
3020
|
Description: >-
|
@@ -2963,17 +3051,19 @@ Naming/PredicateName:
|
|
2963
3051
|
StyleGuide: '#bool-methods-qmark'
|
2964
3052
|
Enabled: true
|
2965
3053
|
VersionAdded: '0.50'
|
2966
|
-
VersionChanged: '
|
3054
|
+
VersionChanged: '1.75'
|
2967
3055
|
# Predicate name prefixes.
|
2968
3056
|
NamePrefix:
|
2969
3057
|
- is_
|
2970
3058
|
- has_
|
2971
3059
|
- have_
|
3060
|
+
- does_
|
2972
3061
|
# Predicate name prefixes that should be removed.
|
2973
3062
|
ForbiddenPrefixes:
|
2974
3063
|
- is_
|
2975
3064
|
- has_
|
2976
3065
|
- have_
|
3066
|
+
- does_
|
2977
3067
|
# Predicate names which, despite having a forbidden prefix, or no `?`,
|
2978
3068
|
# should still be accepted
|
2979
3069
|
AllowedMethods:
|
@@ -2982,6 +3072,8 @@ Naming/PredicateName:
|
|
2982
3072
|
MethodDefinitionMacros:
|
2983
3073
|
- define_method
|
2984
3074
|
- define_singleton_method
|
3075
|
+
# Use Sorbet's T::Boolean return type to detect predicate methods.
|
3076
|
+
UseSorbetSigs: false
|
2985
3077
|
# Exclude Rspec specs because there is a strong convention to write spec
|
2986
3078
|
# helpers in the form of `have_something` or `be_something`.
|
2987
3079
|
Exclude:
|
@@ -2999,13 +3091,15 @@ Naming/VariableName:
|
|
2999
3091
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
3000
3092
|
Enabled: true
|
3001
3093
|
VersionAdded: '0.50'
|
3002
|
-
VersionChanged: '1.
|
3094
|
+
VersionChanged: '1.73'
|
3003
3095
|
EnforcedStyle: snake_case
|
3004
3096
|
SupportedStyles:
|
3005
3097
|
- snake_case
|
3006
3098
|
- camelCase
|
3007
3099
|
AllowedIdentifiers: []
|
3008
3100
|
AllowedPatterns: []
|
3101
|
+
ForbiddenIdentifiers: []
|
3102
|
+
ForbiddenPatterns: []
|
3009
3103
|
|
3010
3104
|
Naming/VariableNumber:
|
3011
3105
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -3021,6 +3115,8 @@ Naming/VariableNumber:
|
|
3021
3115
|
CheckMethodNames: true
|
3022
3116
|
CheckSymbols: true
|
3023
3117
|
AllowedIdentifiers:
|
3118
|
+
- TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
|
3119
|
+
- TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
|
3024
3120
|
- capture3 # Open3.capture3
|
3025
3121
|
- iso8601 # Time#iso8601
|
3026
3122
|
- rfc1123_date # CGI.rfc1123_date
|
@@ -3056,7 +3152,8 @@ Security/JSONLoad:
|
|
3056
3152
|
Description: >-
|
3057
3153
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
3058
3154
|
security issues. See reference for more information.
|
3059
|
-
|
3155
|
+
References:
|
3156
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
3060
3157
|
Enabled: true
|
3061
3158
|
VersionAdded: '0.43'
|
3062
3159
|
VersionChanged: '1.22'
|
@@ -3068,7 +3165,8 @@ Security/MarshalLoad:
|
|
3068
3165
|
Description: >-
|
3069
3166
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
3070
3167
|
security issues. See reference for more information.
|
3071
|
-
|
3168
|
+
References:
|
3169
|
+
- 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
3072
3170
|
Enabled: true
|
3073
3171
|
VersionAdded: '0.47'
|
3074
3172
|
|
@@ -3083,7 +3181,8 @@ Security/YAMLLoad:
|
|
3083
3181
|
Description: >-
|
3084
3182
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
3085
3183
|
security issues. See reference for more information.
|
3086
|
-
|
3184
|
+
References:
|
3185
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
3087
3186
|
Enabled: true
|
3088
3187
|
VersionAdded: '0.47'
|
3089
3188
|
SafeAutoCorrect: false
|
@@ -3094,13 +3193,14 @@ Style/AccessModifierDeclarations:
|
|
3094
3193
|
Description: 'Checks style of how access modifiers are used.'
|
3095
3194
|
Enabled: true
|
3096
3195
|
VersionAdded: '0.57'
|
3097
|
-
VersionChanged: '
|
3196
|
+
VersionChanged: '1.70'
|
3098
3197
|
EnforcedStyle: group
|
3099
3198
|
SupportedStyles:
|
3100
3199
|
- inline
|
3101
3200
|
- group
|
3102
3201
|
AllowModifiersOnSymbols: true
|
3103
3202
|
AllowModifiersOnAttrs: true
|
3203
|
+
AllowModifiersOnAliasMethod: true
|
3104
3204
|
SafeAutoCorrect: false
|
3105
3205
|
|
3106
3206
|
Style/AccessorGrouping:
|
@@ -3125,6 +3225,12 @@ Style/Alias:
|
|
3125
3225
|
- prefer_alias
|
3126
3226
|
- prefer_alias_method
|
3127
3227
|
|
3228
|
+
Style/AmbiguousEndlessMethodDefinition:
|
3229
|
+
Description: 'Checks for endless methods inside operators of lower precedence.'
|
3230
|
+
StyleGuide: '#ambiguous-endless-method-defintions'
|
3231
|
+
Enabled: pending
|
3232
|
+
VersionAdded: '1.68'
|
3233
|
+
|
3128
3234
|
Style/AndOr:
|
3129
3235
|
Description: 'Use &&/|| instead of and/or.'
|
3130
3236
|
StyleGuide: '#no-and-or-or'
|
@@ -3170,7 +3276,8 @@ Style/ArrayCoercion:
|
|
3170
3276
|
|
3171
3277
|
Style/ArrayFirstLast:
|
3172
3278
|
Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
|
3173
|
-
|
3279
|
+
References:
|
3280
|
+
- '#first-and-last'
|
3174
3281
|
Enabled: false
|
3175
3282
|
VersionAdded: '1.58'
|
3176
3283
|
Safe: false
|
@@ -3232,6 +3339,13 @@ Style/BisectedAttrAccessor:
|
|
3232
3339
|
Enabled: true
|
3233
3340
|
VersionAdded: '0.87'
|
3234
3341
|
|
3342
|
+
Style/BitwisePredicate:
|
3343
|
+
Description: 'Prefer bitwise predicate methods over direct comparison operations.'
|
3344
|
+
StyleGuide: '#bitwise-predicate-methods'
|
3345
|
+
Enabled: pending
|
3346
|
+
Safe: false
|
3347
|
+
VersionAdded: '1.68'
|
3348
|
+
|
3235
3349
|
Style/BlockComments:
|
3236
3350
|
Description: 'Do not use block comments.'
|
3237
3351
|
StyleGuide: '#no-block-comments'
|
@@ -3402,6 +3516,7 @@ Style/ClassAndModuleChildren:
|
|
3402
3516
|
SafeAutoCorrect: false
|
3403
3517
|
Enabled: true
|
3404
3518
|
VersionAdded: '0.19'
|
3519
|
+
VersionChanged: '1.74'
|
3405
3520
|
#
|
3406
3521
|
# Basically there are two different styles:
|
3407
3522
|
#
|
@@ -3417,7 +3532,21 @@ Style/ClassAndModuleChildren:
|
|
3417
3532
|
#
|
3418
3533
|
# The compact style is only forced, for classes or modules with one child.
|
3419
3534
|
EnforcedStyle: nested
|
3420
|
-
SupportedStyles:
|
3535
|
+
SupportedStyles: &supported_styles
|
3536
|
+
- nested
|
3537
|
+
- compact
|
3538
|
+
# Configure classes separately, if desired. If not set, or set to `nil`,
|
3539
|
+
# the `EnforcedStyle` value will be used.
|
3540
|
+
EnforcedStyleForClasses: ~
|
3541
|
+
SupportedStylesForClasses:
|
3542
|
+
- ~
|
3543
|
+
- nested
|
3544
|
+
- compact
|
3545
|
+
# Configure modules separately, if desired. If not set, or set to `nil`,
|
3546
|
+
# the `EnforcedStyle` value will be used.
|
3547
|
+
EnforcedStyleForModules: ~
|
3548
|
+
SupportedStylesForModules:
|
3549
|
+
- ~
|
3421
3550
|
- nested
|
3422
3551
|
- compact
|
3423
3552
|
|
@@ -3515,6 +3644,11 @@ Style/ColonMethodDefinition:
|
|
3515
3644
|
Enabled: true
|
3516
3645
|
VersionAdded: '0.52'
|
3517
3646
|
|
3647
|
+
Style/CombinableDefined:
|
3648
|
+
Description: 'Checks successive `defined?` calls that can be combined into a single call.'
|
3649
|
+
Enabled: pending
|
3650
|
+
VersionAdded: '1.68'
|
3651
|
+
|
3518
3652
|
Style/CombinableLoops:
|
3519
3653
|
Description: >-
|
3520
3654
|
Checks for places where multiple consecutive loops over the same data
|
@@ -3565,6 +3699,14 @@ Style/CommentedKeyword:
|
|
3565
3699
|
VersionAdded: '0.51'
|
3566
3700
|
VersionChanged: '1.19'
|
3567
3701
|
|
3702
|
+
Style/ComparableBetween:
|
3703
|
+
Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
|
3704
|
+
Enabled: pending
|
3705
|
+
Safe: false
|
3706
|
+
VersionAdded: '1.74'
|
3707
|
+
VersionChanged: '1.75'
|
3708
|
+
StyleGuide: '#ranges-or-between'
|
3709
|
+
|
3568
3710
|
Style/ComparableClamp:
|
3569
3711
|
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
3570
3712
|
Enabled: pending
|
@@ -3655,6 +3797,12 @@ Style/DefWithParentheses:
|
|
3655
3797
|
VersionAdded: '0.9'
|
3656
3798
|
VersionChanged: '0.12'
|
3657
3799
|
|
3800
|
+
Style/DigChain:
|
3801
|
+
Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
|
3802
|
+
Enabled: pending
|
3803
|
+
Safe: false
|
3804
|
+
VersionAdded: '1.69'
|
3805
|
+
|
3658
3806
|
Style/Dir:
|
3659
3807
|
Description: >-
|
3660
3808
|
Use the `__dir__` method to retrieve the canonicalized
|
@@ -3815,6 +3963,8 @@ Style/EndlessMethod:
|
|
3815
3963
|
- allow_single_line
|
3816
3964
|
- allow_always
|
3817
3965
|
- disallow
|
3966
|
+
- require_single_line
|
3967
|
+
- require_always
|
3818
3968
|
|
3819
3969
|
Style/EnvHome:
|
3820
3970
|
Description: "Checks for consistent usage of `ENV['HOME']`."
|
@@ -3867,7 +4017,7 @@ Style/ExponentialNotation:
|
|
3867
4017
|
Style/FetchEnvVar:
|
3868
4018
|
Description: >-
|
3869
4019
|
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
3870
|
-
|
4020
|
+
References:
|
3871
4021
|
- https://rubystyle.guide/#hash-fetch-defaults
|
3872
4022
|
Enabled: pending
|
3873
4023
|
VersionAdded: '1.28'
|
@@ -3881,12 +4031,24 @@ Style/FileEmpty:
|
|
3881
4031
|
Safe: false
|
3882
4032
|
VersionAdded: '1.48'
|
3883
4033
|
|
4034
|
+
Style/FileNull:
|
4035
|
+
Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
|
4036
|
+
Enabled: pending
|
4037
|
+
SafeAutoCorrect: false
|
4038
|
+
VersionAdded: '1.69'
|
4039
|
+
|
3884
4040
|
Style/FileRead:
|
3885
4041
|
Description: 'Favor `File.(bin)read` convenience methods.'
|
3886
4042
|
StyleGuide: '#file-read'
|
3887
4043
|
Enabled: pending
|
3888
4044
|
VersionAdded: '1.24'
|
3889
4045
|
|
4046
|
+
Style/FileTouch:
|
4047
|
+
Description: 'Favor `FileUtils.touch` for touching files.'
|
4048
|
+
Enabled: pending
|
4049
|
+
VersionAdded: '1.69'
|
4050
|
+
SafeAutoCorrect: false
|
4051
|
+
|
3890
4052
|
Style/FileWrite:
|
3891
4053
|
Description: 'Favor `File.(bin)write` convenience methods.'
|
3892
4054
|
StyleGuide: '#file-write'
|
@@ -3896,7 +4058,8 @@ Style/FileWrite:
|
|
3896
4058
|
Style/FloatDivision:
|
3897
4059
|
Description: 'For performing float division, coerce one side only.'
|
3898
4060
|
StyleGuide: '#float-division'
|
3899
|
-
|
4061
|
+
References:
|
4062
|
+
- 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3900
4063
|
Enabled: true
|
3901
4064
|
VersionAdded: '0.72'
|
3902
4065
|
VersionChanged: '1.9'
|
@@ -3947,8 +4110,14 @@ Style/FormatStringToken:
|
|
3947
4110
|
# style token in a format string to be allowed when enforced style is not
|
3948
4111
|
# `unannotated`.
|
3949
4112
|
MaxUnannotatedPlaceholdersAllowed: 1
|
4113
|
+
# The mode the cop operates in. Two values are allowed:
|
4114
|
+
# * aggressive (default): all strings are considered
|
4115
|
+
# * conservative:
|
4116
|
+
# only register offenses for strings given to `printf`, `sprintf`,
|
4117
|
+
# format` and `%` methods. Other strings are not considered.
|
4118
|
+
Mode: aggressive
|
3950
4119
|
VersionAdded: '0.49'
|
3951
|
-
VersionChanged: '1.
|
4120
|
+
VersionChanged: '1.74'
|
3952
4121
|
AllowedMethods: []
|
3953
4122
|
AllowedPatterns: []
|
3954
4123
|
|
@@ -3973,6 +4142,9 @@ Style/FrozenStringLiteralComment:
|
|
3973
4142
|
# exist in a file.
|
3974
4143
|
- never
|
3975
4144
|
SafeAutoCorrect: false
|
4145
|
+
Exclude:
|
4146
|
+
# Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
|
4147
|
+
- '**/*.arb'
|
3976
4148
|
|
3977
4149
|
Style/GlobalStdStream:
|
3978
4150
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
@@ -3984,7 +4156,8 @@ Style/GlobalStdStream:
|
|
3984
4156
|
Style/GlobalVars:
|
3985
4157
|
Description: 'Do not introduce global variables.'
|
3986
4158
|
StyleGuide: '#instance-vars'
|
3987
|
-
|
4159
|
+
References:
|
4160
|
+
- 'https://www.zenspider.com/ruby/quickref.html'
|
3988
4161
|
Enabled: true
|
3989
4162
|
VersionAdded: '0.13'
|
3990
4163
|
# Built-in global variables are allowed by default.
|
@@ -4041,6 +4214,12 @@ Style/HashExcept:
|
|
4041
4214
|
VersionAdded: '1.7'
|
4042
4215
|
VersionChanged: '1.39'
|
4043
4216
|
|
4217
|
+
Style/HashFetchChain:
|
4218
|
+
Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
|
4219
|
+
Enabled: pending
|
4220
|
+
Safe: false
|
4221
|
+
VersionAdded: '1.75'
|
4222
|
+
|
4044
4223
|
Style/HashLikeCase:
|
4045
4224
|
Description: >-
|
4046
4225
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -4051,6 +4230,14 @@ Style/HashLikeCase:
|
|
4051
4230
|
# to trigger this cop
|
4052
4231
|
MinBranchesCount: 3
|
4053
4232
|
|
4233
|
+
Style/HashSlice:
|
4234
|
+
Description: >-
|
4235
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
4236
|
+
that can be replaced with `Hash#slice` method.
|
4237
|
+
Enabled: pending
|
4238
|
+
Safe: false
|
4239
|
+
VersionAdded: '1.71'
|
4240
|
+
|
4054
4241
|
Style/HashSyntax:
|
4055
4242
|
Description: >-
|
4056
4243
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -4058,7 +4245,7 @@ Style/HashSyntax:
|
|
4058
4245
|
StyleGuide: '#hash-literals'
|
4059
4246
|
Enabled: true
|
4060
4247
|
VersionAdded: '0.9'
|
4061
|
-
VersionChanged: '1.
|
4248
|
+
VersionChanged: '1.67'
|
4062
4249
|
EnforcedStyle: ruby19
|
4063
4250
|
SupportedStyles:
|
4064
4251
|
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
@@ -4070,7 +4257,7 @@ Style/HashSyntax:
|
|
4070
4257
|
# enforces both ruby19 and no_mixed_keys styles
|
4071
4258
|
- ruby19_no_mixed_keys
|
4072
4259
|
# Force hashes that have a hash value omission
|
4073
|
-
EnforcedShorthandSyntax:
|
4260
|
+
EnforcedShorthandSyntax: either
|
4074
4261
|
SupportedShorthandSyntax:
|
4075
4262
|
# forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
|
4076
4263
|
- always
|
@@ -4238,6 +4425,29 @@ Style/IpAddresses:
|
|
4238
4425
|
- '**/gems.rb'
|
4239
4426
|
- '**/*.gemspec'
|
4240
4427
|
|
4428
|
+
Style/ItAssignment:
|
4429
|
+
Description: 'Checks for assignment to `it` inside a block.'
|
4430
|
+
Enabled: pending
|
4431
|
+
VersionAdded: '1.70'
|
4432
|
+
|
4433
|
+
Style/ItBlockParameter:
|
4434
|
+
Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
|
4435
|
+
Enabled: pending
|
4436
|
+
EnforcedStyle: only_numbered_parameters
|
4437
|
+
SupportedStyles:
|
4438
|
+
- only_numbered_parameters
|
4439
|
+
- always
|
4440
|
+
- disallow
|
4441
|
+
VersionAdded: '1.75'
|
4442
|
+
|
4443
|
+
Style/KeywordArgumentsMerging:
|
4444
|
+
Description: >-
|
4445
|
+
When passing an existing hash as keyword arguments, provide additional arguments
|
4446
|
+
directly rather than using `merge`.
|
4447
|
+
StyleGuide: '#merging-keyword-arguments'
|
4448
|
+
Enabled: pending
|
4449
|
+
VersionAdded: '1.68'
|
4450
|
+
|
4241
4451
|
Style/KeywordParametersOrder:
|
4242
4452
|
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
4243
4453
|
StyleGuide: '#keyword-parameters-order'
|
@@ -4307,6 +4517,7 @@ Style/MapIntoArray:
|
|
4307
4517
|
StyleGuide: '#functional-code'
|
4308
4518
|
Enabled: pending
|
4309
4519
|
VersionAdded: '1.63'
|
4520
|
+
VersionChanged: '1.67'
|
4310
4521
|
Safe: false
|
4311
4522
|
|
4312
4523
|
Style/MapToHash:
|
@@ -4617,7 +4828,7 @@ Style/Next:
|
|
4617
4828
|
StyleGuide: '#no-nested-conditionals'
|
4618
4829
|
Enabled: true
|
4619
4830
|
VersionAdded: '0.22'
|
4620
|
-
VersionChanged: '
|
4831
|
+
VersionChanged: '1.75'
|
4621
4832
|
# With `always` all conditions at the end of an iteration needs to be
|
4622
4833
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
4623
4834
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
@@ -4625,6 +4836,7 @@ Style/Next:
|
|
4625
4836
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
4626
4837
|
# needs to have to trigger this cop
|
4627
4838
|
MinBodyLength: 3
|
4839
|
+
AllowConsecutiveConditionals: false
|
4628
4840
|
SupportedStyles:
|
4629
4841
|
- skip_modifier_ifs
|
4630
4842
|
- always
|
@@ -4756,7 +4968,7 @@ Style/OpenStructUse:
|
|
4756
4968
|
Description: >-
|
4757
4969
|
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
4758
4970
|
version compatibility, and potential security issues.
|
4759
|
-
|
4971
|
+
References:
|
4760
4972
|
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4761
4973
|
|
4762
4974
|
Enabled: pending
|
@@ -4960,6 +5172,9 @@ Style/RedundantCondition:
|
|
4960
5172
|
Description: 'Checks for unnecessary conditional expressions.'
|
4961
5173
|
Enabled: true
|
4962
5174
|
VersionAdded: '0.76'
|
5175
|
+
VersionChanged: '1.73'
|
5176
|
+
AllowedMethods:
|
5177
|
+
- nonzero?
|
4963
5178
|
|
4964
5179
|
Style/RedundantConditional:
|
4965
5180
|
Description: "Don't return true/false from a conditional."
|
@@ -4972,7 +5187,7 @@ Style/RedundantConstantBase:
|
|
4972
5187
|
VersionAdded: '1.40'
|
4973
5188
|
|
4974
5189
|
Style/RedundantCurrentDirectoryInPath:
|
4975
|
-
Description: 'Checks for
|
5190
|
+
Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
|
4976
5191
|
Enabled: pending
|
4977
5192
|
VersionAdded: '1.53'
|
4978
5193
|
|
@@ -4998,7 +5213,8 @@ Style/RedundantFetchBlock:
|
|
4998
5213
|
Description: >-
|
4999
5214
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
5000
5215
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
5001
|
-
|
5216
|
+
References:
|
5217
|
+
- 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
5002
5218
|
Enabled: true
|
5003
5219
|
Safe: false
|
5004
5220
|
# If enabled, this cop will autocorrect usages of
|
@@ -5024,6 +5240,13 @@ Style/RedundantFilterChain:
|
|
5024
5240
|
VersionAdded: '1.52'
|
5025
5241
|
VersionChanged: '1.57'
|
5026
5242
|
|
5243
|
+
Style/RedundantFormat:
|
5244
|
+
Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
|
5245
|
+
Enabled: pending
|
5246
|
+
SafeAutoCorrect: false
|
5247
|
+
VersionAdded: '1.72'
|
5248
|
+
VersionChanged: '1.72'
|
5249
|
+
|
5027
5250
|
Style/RedundantFreeze:
|
5028
5251
|
Description: "Checks usages of Object#freeze on immutable objects."
|
5029
5252
|
Enabled: true
|
@@ -5051,6 +5274,11 @@ Style/RedundantInterpolation:
|
|
5051
5274
|
VersionAdded: '0.76'
|
5052
5275
|
VersionChanged: '1.30'
|
5053
5276
|
|
5277
|
+
Style/RedundantInterpolationUnfreeze:
|
5278
|
+
Description: 'Checks for redundant unfreezing of interpolated strings.'
|
5279
|
+
Enabled: pending
|
5280
|
+
VersionAdded: '1.66'
|
5281
|
+
|
5054
5282
|
Style/RedundantLineContinuation:
|
5055
5283
|
Description: 'Check for redundant line continuation.'
|
5056
5284
|
Enabled: pending
|
@@ -5192,6 +5420,7 @@ Style/ReturnNilInPredicateMethodDefinition:
|
|
5192
5420
|
AllowedMethods: []
|
5193
5421
|
AllowedPatterns: []
|
5194
5422
|
VersionAdded: '1.53'
|
5423
|
+
VersionChanged: '1.67'
|
5195
5424
|
|
5196
5425
|
Style/SafeNavigation:
|
5197
5426
|
Description: >-
|
@@ -5202,7 +5431,7 @@ Style/SafeNavigation:
|
|
5202
5431
|
be `nil` or truthy, but never `false`.
|
5203
5432
|
Enabled: true
|
5204
5433
|
VersionAdded: '0.43'
|
5205
|
-
VersionChanged: '1.
|
5434
|
+
VersionChanged: '1.67'
|
5206
5435
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
5207
5436
|
# to whatever it used to return.
|
5208
5437
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -5216,11 +5445,19 @@ Style/SafeNavigation:
|
|
5216
5445
|
# Maximum length of method chains for register an offense.
|
5217
5446
|
MaxChainLength: 2
|
5218
5447
|
|
5448
|
+
Style/SafeNavigationChainLength:
|
5449
|
+
Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
|
5450
|
+
StyleGuide: '#safe-navigation'
|
5451
|
+
Enabled: pending
|
5452
|
+
VersionAdded: '1.68'
|
5453
|
+
Max: 2
|
5454
|
+
|
5219
5455
|
Style/Sample:
|
5220
5456
|
Description: >-
|
5221
5457
|
Use `sample` instead of `shuffle.first`,
|
5222
5458
|
`shuffle.last`, and `shuffle[Integer]`.
|
5223
|
-
|
5459
|
+
References:
|
5460
|
+
- 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
5224
5461
|
Enabled: true
|
5225
5462
|
VersionAdded: '0.30'
|
5226
5463
|
|
@@ -5537,14 +5774,17 @@ Style/TrailingCommaInArrayLiteral:
|
|
5537
5774
|
StyleGuide: '#no-trailing-array-commas'
|
5538
5775
|
Enabled: true
|
5539
5776
|
VersionAdded: '0.53'
|
5540
|
-
# If `comma`, the cop requires a comma after the last item in an array,
|
5541
|
-
#
|
5542
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5543
|
-
#
|
5777
|
+
# If `comma`, the cop requires a comma after the last item in an array, but only when each item is
|
5778
|
+
# on its own line.
|
5779
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5780
|
+
# array literals.
|
5781
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
|
5782
|
+
# literals, but only when that last item immediately precedes a newline.
|
5544
5783
|
EnforcedStyleForMultiline: no_comma
|
5545
5784
|
SupportedStylesForMultiline:
|
5546
5785
|
- comma
|
5547
5786
|
- consistent_comma
|
5787
|
+
- diff_comma
|
5548
5788
|
- no_comma
|
5549
5789
|
|
5550
5790
|
Style/TrailingCommaInBlockArgs:
|
@@ -5556,14 +5796,17 @@ Style/TrailingCommaInBlockArgs:
|
|
5556
5796
|
Style/TrailingCommaInHashLiteral:
|
5557
5797
|
Description: 'Checks for trailing comma in hash literals.'
|
5558
5798
|
Enabled: true
|
5559
|
-
# If `comma`, the cop requires a comma after the last item in a hash,
|
5560
|
-
#
|
5561
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5562
|
-
#
|
5799
|
+
# If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
|
5800
|
+
# on its own line.
|
5801
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5802
|
+
# hash literals.
|
5803
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
|
5804
|
+
# literals, but only when that last item immediately precedes a newline.
|
5563
5805
|
EnforcedStyleForMultiline: no_comma
|
5564
5806
|
SupportedStylesForMultiline:
|
5565
5807
|
- comma
|
5566
5808
|
- consistent_comma
|
5809
|
+
- diff_comma
|
5567
5810
|
- no_comma
|
5568
5811
|
VersionAdded: '0.53'
|
5569
5812
|
|
@@ -5709,7 +5952,8 @@ Style/YAMLFileRead:
|
|
5709
5952
|
|
5710
5953
|
Style/YodaCondition:
|
5711
5954
|
Description: 'Forbid or enforce yoda conditions.'
|
5712
|
-
|
5955
|
+
References:
|
5956
|
+
- 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
5713
5957
|
Enabled: true
|
5714
5958
|
EnforcedStyle: forbid_for_all_comparison_operators
|
5715
5959
|
SupportedStyles:
|