rubocop 1.67.0 → 1.81.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 +23 -19
- data/config/default.yml +384 -72
- data/config/internal_affairs.yml +20 -0
- data/config/obsoletion.yml +8 -3
- data/exe/rubocop +1 -8
- data/lib/rubocop/cached_data.rb +12 -4
- data/lib/rubocop/cli/command/auto_generate_config.rb +2 -2
- data/lib/rubocop/cli/command/execute_runner.rb +4 -4
- 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 +19 -4
- data/lib/rubocop/comment_config.rb +2 -2
- data/lib/rubocop/config.rb +52 -10
- data/lib/rubocop/config_loader.rb +56 -48
- data/lib/rubocop/config_loader_resolver.rb +36 -10
- 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_store.rb +5 -0
- data/lib/rubocop/config_validator.rb +25 -14
- data/lib/rubocop/cop/autocorrect_logic.rb +53 -28
- data/lib/rubocop/cop/base.rb +7 -1
- 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/insecure_protocol_source.rb +0 -1
- data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +8 -16
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +8 -3
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -2
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
- data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +1 -2
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +37 -15
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
- data/lib/rubocop/cop/gemspec/require_mfa.rb +15 -1
- 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_enabled.rb +85 -0
- data/lib/rubocop/cop/internal_affairs/example_description.rb +9 -5
- 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 +5 -5
- 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 +233 -0
- data/lib/rubocop/cop/internal_affairs/node_type_group.rb +92 -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_source_range.rb +3 -1
- 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 +13 -2
- data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
- data/lib/rubocop/cop/internal_affairs.rb +7 -16
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +1 -1
- 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 +3 -2
- data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
- data/lib/rubocop/cop/layout/class_structure.rb +45 -10
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +5 -5
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- 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 +3 -3
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +34 -20
- data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +101 -0
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +37 -7
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +8 -29
- 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_class_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +4 -5
- 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 +4 -9
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -7
- 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_parameter_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +8 -11
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +8 -7
- data/lib/rubocop/cop/layout/leading_comment_space.rb +57 -2
- 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 +158 -10
- 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 +11 -8
- 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 +14 -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 +8 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_operators.rb +31 -21
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -0
- data/lib/rubocop/cop/layout/space_before_brackets.rb +7 -40
- data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +18 -3
- 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 +6 -4
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_range.rb +5 -0
- 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/binary_operator_with_identical_operands.rb +10 -12
- data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
- 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_overwritten_in_rescue.rb +3 -2
- data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
- data/lib/rubocop/cop/lint/cop_directive_syntax.rb +90 -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 +7 -3
- 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 +111 -23
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +6 -43
- data/lib/rubocop/cop/lint/duplicate_set_element.rb +20 -7
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +14 -64
- 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/empty_interpolation.rb +14 -1
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +0 -6
- data/lib/rubocop/cop/lint/float_comparison.rb +51 -18
- 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/identity_comparison.rb +19 -15
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
- data/lib/rubocop/cop/lint/interpolation_check.rb +9 -0
- data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +3 -0
- data/lib/rubocop/cop/lint/literal_as_condition.rb +125 -10
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +24 -6
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -2
- 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 +94 -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 +1 -5
- 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 +2 -2
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +0 -21
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +113 -9
- 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/require_range_parentheses.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_exception.rb +2 -5
- data/lib/rubocop/cop/lint/rescue_type.rb +4 -8
- 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 +5 -1
- data/lib/rubocop/cop/lint/self_assignment.rb +39 -15
- 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 +13 -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 +1 -1
- 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_escape_unescape.rb +2 -0
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +34 -8
- data/lib/rubocop/cop/lint/useless_assignment.rb +3 -1
- data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
- data/lib/rubocop/cop/lint/useless_default_value_argument.rb +90 -0
- data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -0
- data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/useless_numeric_operation.rb +3 -1
- data/lib/rubocop/cop/lint/useless_or.rb +98 -0
- data/lib/rubocop/cop/lint/useless_rescue.rb +2 -2
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +5 -5
- data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -25
- data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +121 -0
- data/lib/rubocop/cop/lint/void.rb +23 -12
- data/lib/rubocop/cop/message_annotator.rb +7 -3
- data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
- data/lib/rubocop/cop/metrics/block_length.rb +1 -0
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/class_length.rb +9 -9
- 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 +9 -1
- data/lib/rubocop/cop/metrics/module_length.rb +1 -1
- 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 +3 -3
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +4 -4
- 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/end_keyword_alignment.rb +1 -7
- 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 +4 -3
- data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
- 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 +27 -10
- 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/ordered_gem_node.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 +8 -3
- data/lib/rubocop/cop/mixin/string_help.rb +2 -2
- data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
- 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 +6 -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 +2 -4
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +12 -13
- data/lib/rubocop/cop/naming/method_name.rb +185 -15
- data/lib/rubocop/cop/naming/predicate_method.rb +319 -0
- data/lib/rubocop/cop/naming/{predicate_name.rb → predicate_prefix.rb} +48 -4
- 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 +2 -3
- data/lib/rubocop/cop/registry.rb +9 -6
- data/lib/rubocop/cop/security/compound_hash.rb +2 -0
- data/lib/rubocop/cop/security/eval.rb +2 -1
- data/lib/rubocop/cop/security/json_load.rb +33 -11
- data/lib/rubocop/cop/security/open.rb +1 -0
- data/lib/rubocop/cop/security/yaml_load.rb +3 -2
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +114 -34
- data/lib/rubocop/cop/style/accessor_grouping.rb +32 -6
- 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 +57 -44
- data/lib/rubocop/cop/style/array_first_last.rb +18 -2
- data/lib/rubocop/cop/style/array_intersect.rb +115 -39
- data/lib/rubocop/cop/style/array_intersect_with_single_element.rb +47 -0
- data/lib/rubocop/cop/style/bitwise_predicate.rb +107 -0
- data/lib/rubocop/cop/style/block_delimiters.rb +44 -26
- data/lib/rubocop/cop/style/case_like_if.rb +9 -12
- 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_methods.rb +2 -1
- data/lib/rubocop/cop/style/collection_querying.rb +167 -0
- data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
- data/lib/rubocop/cop/style/combinable_loops.rb +3 -2
- data/lib/rubocop/cop/style/command_literal.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +20 -3
- 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 +49 -31
- data/lib/rubocop/cop/style/constant_visibility.rb +3 -12
- data/lib/rubocop/cop/style/data_inheritance.rb +7 -0
- data/lib/rubocop/cop/style/def_with_parentheses.rb +18 -5
- 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 +5 -5
- 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 +4 -2
- data/lib/rubocop/cop/style/empty_literal.rb +5 -1
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
- data/lib/rubocop/cop/style/endless_method.rb +163 -18
- data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
- 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 +17 -4
- data/lib/rubocop/cop/style/exponential_notation.rb +6 -5
- data/lib/rubocop/cop/style/fetch_env_var.rb +34 -7
- 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 +17 -3
- data/lib/rubocop/cop/style/hash_conversion.rb +16 -9
- data/lib/rubocop/cop/style/hash_each_methods.rb +6 -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 +9 -3
- 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 +25 -6
- data/lib/rubocop/cop/style/if_inside_else.rb +10 -14
- data/lib/rubocop/cop/style/if_unless_modifier.rb +36 -9
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +4 -7
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +3 -4
- data/lib/rubocop/cop/style/if_with_semicolon.rb +20 -9
- data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +16 -13
- 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 +93 -0
- data/lib/rubocop/cop/style/it_block_parameter.rb +121 -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 +1 -0
- 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/map_into_array.rb +11 -3
- data/lib/rubocop/cop/style/map_to_hash.rb +13 -4
- data/lib/rubocop/cop/style/map_to_set.rb +4 -5
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +28 -20
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +18 -0
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +8 -11
- 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/min_max_comparison.rb +13 -5
- 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 +1 -1
- data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -9
- data/lib/rubocop/cop/style/multiple_comparison.rb +52 -51
- 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_parenthesized_calls.rb +1 -1
- 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/nil_comparison.rb +9 -7
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/object_then.rb +15 -15
- data/lib/rubocop/cop/style/one_line_conditional.rb +42 -13
- data/lib/rubocop/cop/style/open_struct_use.rb +5 -5
- data/lib/rubocop/cop/style/operator_method_call.rb +5 -6
- data/lib/rubocop/cop/style/or_assignment.rb +3 -6
- data/lib/rubocop/cop/style/parallel_assignment.rb +41 -38
- 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 -1
- 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_array_flatten.rb +50 -0
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +36 -1
- data/lib/rubocop/cop/style/redundant_condition.rb +95 -23
- 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_fetch_block.rb +1 -9
- data/lib/rubocop/cop/style/redundant_format.rb +283 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +4 -4
- data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
- data/lib/rubocop/cop/style/redundant_interpolation.rb +12 -3
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +55 -19
- data/lib/rubocop/cop/style/redundant_parentheses.rb +105 -36
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +8 -0
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +9 -1
- data/lib/rubocop/cop/style/redundant_return.rb +2 -2
- data/lib/rubocop/cop/style/redundant_self.rb +15 -18
- 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/regexp_literal.rb +1 -1
- data/lib/rubocop/cop/style/rescue_modifier.rb +5 -3
- data/lib/rubocop/cop/style/return_nil.rb +2 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +75 -16
- data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
- data/lib/rubocop/cop/style/select_by_regexp.rb +5 -2
- data/lib/rubocop/cop/style/self_assignment.rb +11 -17
- data/lib/rubocop/cop/style/semicolon.rb +21 -6
- 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 +13 -11
- data/lib/rubocop/cop/style/slicing_with_range.rb +40 -11
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +68 -102
- data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/string_concatenation.rb +21 -17
- 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 +8 -1
- 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_array.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +3 -1
- data/lib/rubocop/cop/style/ternary_parentheses.rb +25 -4
- data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -1
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +56 -2
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -4
- data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
- data/lib/rubocop/cop/style/unless_else.rb +10 -9
- 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 +1 -1
- data/lib/rubocop/cop/util.rb +12 -5
- data/lib/rubocop/cop/utils/format_string.rb +20 -5
- data/lib/rubocop/cop/variable_force/assignment.rb +24 -5
- 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 +30 -19
- data/lib/rubocop/cops_documentation_generator.rb +54 -28
- data/lib/rubocop/directive_comment.rb +45 -11
- data/lib/rubocop/ext/regexp_node.rb +0 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +20 -6
- data/lib/rubocop/formatter/formatter_set.rb +1 -1
- data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +1 -1
- data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
- data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
- data/lib/rubocop/formatter/pacman_formatter.rb +2 -1
- data/lib/rubocop/lsp/diagnostic.rb +190 -0
- data/lib/rubocop/lsp/logger.rb +2 -2
- data/lib/rubocop/lsp/routes.rb +66 -26
- data/lib/rubocop/lsp/runtime.rb +18 -50
- data/lib/rubocop/lsp/server.rb +2 -4
- data/lib/rubocop/lsp/stdin_runner.rb +69 -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/pending_cops_reporter.rb +56 -0
- data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
- data/lib/rubocop/plugin/load_error.rb +26 -0
- data/lib/rubocop/plugin/loader.rb +100 -0
- data/lib/rubocop/plugin/not_supported_error.rb +29 -0
- data/lib/rubocop/plugin.rb +46 -0
- data/lib/rubocop/rake_task.rb +4 -1
- data/lib/rubocop/result_cache.rb +27 -25
- data/lib/rubocop/rspec/cop_helper.rb +13 -1
- data/lib/rubocop/rspec/expect_offense.rb +15 -5
- data/lib/rubocop/rspec/shared_contexts.rb +38 -1
- data/lib/rubocop/rspec/support.rb +4 -2
- data/lib/rubocop/runner.rb +31 -18
- data/lib/rubocop/server/cache.rb +51 -13
- data/lib/rubocop/server/cli.rb +2 -2
- data/lib/rubocop/server/client_command/base.rb +10 -0
- data/lib/rubocop/server/client_command/exec.rb +2 -1
- data/lib/rubocop/server/client_command/start.rb +11 -1
- data/lib/rubocop/target_finder.rb +14 -9
- data/lib/rubocop/target_ruby.rb +27 -3
- data/lib/rubocop/version.rb +53 -12
- data/lib/rubocop.rb +44 -2
- data/lib/ruby_lsp/rubocop/addon.rb +90 -0
- data/lib/ruby_lsp/rubocop/runtime_adapter.rb +99 -0
- metadata +91 -21
- 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
|
@@ -146,12 +146,14 @@ AllCops:
|
|
|
146
146
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
|
147
147
|
# supported Ruby version (currently Ruby 2.7).
|
|
148
148
|
TargetRubyVersion: ~
|
|
149
|
-
#
|
|
149
|
+
# RuboCop choses the parser engine automatically but you can also specify it yourself.
|
|
150
|
+
# These options are available:
|
|
151
|
+
# - `default`
|
|
150
152
|
# - `parser_whitequark` ... https://github.com/whitequark/parser
|
|
151
153
|
# - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
|
|
152
|
-
#
|
|
153
|
-
#
|
|
154
|
-
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
|
|
155
157
|
# Determines if a notification for extension libraries should be shown when
|
|
156
158
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
|
157
159
|
# of gems in the Gemfile that the extension is suggested for, if not already
|
|
@@ -272,12 +274,20 @@ Bundler/OrderedGems:
|
|
|
272
274
|
Gemspec/AddRuntimeDependency:
|
|
273
275
|
Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
|
|
274
276
|
StyleGuide: '#add_dependency_vs_add_runtime_dependency'
|
|
275
|
-
|
|
277
|
+
References:
|
|
278
|
+
- https://github.com/ruby/rubygems/issues/7799#issuecomment-2192720316
|
|
276
279
|
Enabled: pending
|
|
277
280
|
VersionAdded: '1.65'
|
|
278
281
|
Include:
|
|
279
282
|
- '**/*.gemspec'
|
|
280
283
|
|
|
284
|
+
Gemspec/AttributeAssignment:
|
|
285
|
+
Description: 'Use consistent style for Gemspec attributes assignment.'
|
|
286
|
+
Enabled: pending
|
|
287
|
+
VersionAdded: '1.77'
|
|
288
|
+
Include:
|
|
289
|
+
- '**/*.gemspec'
|
|
290
|
+
|
|
281
291
|
Gemspec/DependencyVersion:
|
|
282
292
|
Description: 'Requires or forbids specifying gem dependency versions.'
|
|
283
293
|
Enabled: false
|
|
@@ -341,7 +351,7 @@ Gemspec/RequireMFA:
|
|
|
341
351
|
Severity: warning
|
|
342
352
|
VersionAdded: '1.23'
|
|
343
353
|
VersionChanged: '1.40'
|
|
344
|
-
|
|
354
|
+
References:
|
|
345
355
|
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
|
346
356
|
Include:
|
|
347
357
|
- '**/*.gemspec'
|
|
@@ -368,7 +378,7 @@ Gemspec/RubyVersionGlobalsUsage:
|
|
|
368
378
|
#################### Layout ###########################
|
|
369
379
|
|
|
370
380
|
Layout/AccessModifierIndentation:
|
|
371
|
-
Description:
|
|
381
|
+
Description: Checks indentation of private/protected visibility modifiers.
|
|
372
382
|
StyleGuide: '#indent-public-private-protected'
|
|
373
383
|
Enabled: true
|
|
374
384
|
VersionAdded: '0.49'
|
|
@@ -602,7 +612,7 @@ Layout/EmptyLineAfterMultilineCondition:
|
|
|
602
612
|
# This is disabled, because this style is not very common in practice.
|
|
603
613
|
Enabled: false
|
|
604
614
|
VersionAdded: '0.90'
|
|
605
|
-
|
|
615
|
+
References:
|
|
606
616
|
- https://github.com/airbnb/ruby#multiline-if-newline
|
|
607
617
|
|
|
608
618
|
Layout/EmptyLineBetweenDefs:
|
|
@@ -628,6 +638,12 @@ Layout/EmptyLines:
|
|
|
628
638
|
Enabled: true
|
|
629
639
|
VersionAdded: '0.49'
|
|
630
640
|
|
|
641
|
+
Layout/EmptyLinesAfterModuleInclusion:
|
|
642
|
+
Description: 'Keeps track of empty lines after module inclusion methods.'
|
|
643
|
+
StyleGuide: '#empty-lines-after-module-inclusion'
|
|
644
|
+
Enabled: pending
|
|
645
|
+
VersionAdded: '1.79'
|
|
646
|
+
|
|
631
647
|
Layout/EmptyLinesAroundAccessModifier:
|
|
632
648
|
Description: "Keep blank lines around access modifiers."
|
|
633
649
|
StyleGuide: '#empty-lines-around-access-modifier'
|
|
@@ -637,7 +653,7 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
|
637
653
|
SupportedStyles:
|
|
638
654
|
- around
|
|
639
655
|
- only_before
|
|
640
|
-
|
|
656
|
+
References:
|
|
641
657
|
# A reference to `EnforcedStyle: only_before`.
|
|
642
658
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
|
643
659
|
|
|
@@ -994,7 +1010,7 @@ Layout/IndentationConsistency:
|
|
|
994
1010
|
SupportedStyles:
|
|
995
1011
|
- normal
|
|
996
1012
|
- indented_internal_methods
|
|
997
|
-
|
|
1013
|
+
References:
|
|
998
1014
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
|
999
1015
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
|
1000
1016
|
|
|
@@ -1038,9 +1054,10 @@ Layout/LeadingCommentSpace:
|
|
|
1038
1054
|
AllowDoxygenCommentStyle: false
|
|
1039
1055
|
AllowGemfileRubyComment: false
|
|
1040
1056
|
AllowRBSInlineAnnotation: false
|
|
1057
|
+
AllowSteepAnnotation: false
|
|
1041
1058
|
|
|
1042
1059
|
Layout/LeadingEmptyLines:
|
|
1043
|
-
Description:
|
|
1060
|
+
Description: Checks for unnecessary blank lines at the beginning of a file.
|
|
1044
1061
|
Enabled: true
|
|
1045
1062
|
VersionAdded: '0.57'
|
|
1046
1063
|
VersionChanged: '0.77'
|
|
@@ -1085,12 +1102,13 @@ Layout/LineLength:
|
|
|
1085
1102
|
StyleGuide: '#max-line-length'
|
|
1086
1103
|
Enabled: true
|
|
1087
1104
|
VersionAdded: '0.25'
|
|
1088
|
-
VersionChanged: '1.
|
|
1105
|
+
VersionChanged: '1.69'
|
|
1089
1106
|
Max: 120
|
|
1107
|
+
AllowHeredoc: true
|
|
1090
1108
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
|
1091
1109
|
# containing a URI to be longer than Max.
|
|
1092
|
-
AllowHeredoc: true
|
|
1093
1110
|
AllowURI: true
|
|
1111
|
+
AllowQualifiedName: true
|
|
1094
1112
|
URISchemes:
|
|
1095
1113
|
- http
|
|
1096
1114
|
- https
|
|
@@ -1101,6 +1119,8 @@ Layout/LineLength:
|
|
|
1101
1119
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
|
1102
1120
|
# any regular expression listed in this option will be ignored by LineLength.
|
|
1103
1121
|
AllowedPatterns: []
|
|
1122
|
+
# If SplitStrings is true, long strings will be split using continuations
|
|
1123
|
+
SplitStrings: false
|
|
1104
1124
|
|
|
1105
1125
|
Layout/MultilineArrayBraceLayout:
|
|
1106
1126
|
Description: >-
|
|
@@ -1127,7 +1147,7 @@ Layout/MultilineArrayLineBreaks:
|
|
|
1127
1147
|
AllowMultilineFinalElement: false
|
|
1128
1148
|
|
|
1129
1149
|
Layout/MultilineAssignmentLayout:
|
|
1130
|
-
Description: '
|
|
1150
|
+
Description: 'Checks for a newline after the assignment operator in multi-line assignments.'
|
|
1131
1151
|
StyleGuide: '#indent-conditional-assignment'
|
|
1132
1152
|
Enabled: false
|
|
1133
1153
|
VersionAdded: '0.49'
|
|
@@ -1498,7 +1518,6 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
|
1498
1518
|
- space
|
|
1499
1519
|
- no_space
|
|
1500
1520
|
|
|
1501
|
-
|
|
1502
1521
|
Layout/SpaceInsideParens:
|
|
1503
1522
|
Description: 'No spaces after ( or before ).'
|
|
1504
1523
|
StyleGuide: '#spaces-braces'
|
|
@@ -1614,6 +1633,12 @@ Lint/AmbiguousRegexpLiteral:
|
|
|
1614
1633
|
VersionAdded: '0.17'
|
|
1615
1634
|
VersionChanged: '0.83'
|
|
1616
1635
|
|
|
1636
|
+
Lint/ArrayLiteralInRegexp:
|
|
1637
|
+
Description: 'Checks for an array literal interpolated inside a regexp.'
|
|
1638
|
+
Enabled: pending
|
|
1639
|
+
VersionAdded: '1.71'
|
|
1640
|
+
SafeAutoCorrect: false
|
|
1641
|
+
|
|
1617
1642
|
Lint/AssignmentInCondition:
|
|
1618
1643
|
Description: "Don't use assignment in conditions."
|
|
1619
1644
|
StyleGuide: '#safe-assignment-in-condition'
|
|
@@ -1633,10 +1658,10 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
|
1633
1658
|
Enabled: true
|
|
1634
1659
|
Safe: false
|
|
1635
1660
|
VersionAdded: '0.89'
|
|
1636
|
-
VersionChanged: '1.
|
|
1661
|
+
VersionChanged: '1.69'
|
|
1637
1662
|
|
|
1638
1663
|
Lint/BooleanSymbol:
|
|
1639
|
-
Description: '
|
|
1664
|
+
Description: 'Checks for `:true` and `:false` symbols.'
|
|
1640
1665
|
Enabled: true
|
|
1641
1666
|
SafeAutoCorrect: false
|
|
1642
1667
|
VersionAdded: '0.50'
|
|
@@ -1663,8 +1688,13 @@ Lint/ConstantOverwrittenInRescue:
|
|
|
1663
1688
|
Enabled: pending
|
|
1664
1689
|
VersionAdded: '1.31'
|
|
1665
1690
|
|
|
1691
|
+
Lint/ConstantReassignment:
|
|
1692
|
+
Description: 'Checks for constant reassignments.'
|
|
1693
|
+
Enabled: pending
|
|
1694
|
+
VersionAdded: '1.70'
|
|
1695
|
+
|
|
1666
1696
|
Lint/ConstantResolution:
|
|
1667
|
-
Description: '
|
|
1697
|
+
Description: 'Checks that constants are fully qualified with `::`.'
|
|
1668
1698
|
Enabled: false
|
|
1669
1699
|
VersionAdded: '0.86'
|
|
1670
1700
|
# Restrict this cop to only looking at certain names
|
|
@@ -1672,8 +1702,13 @@ Lint/ConstantResolution:
|
|
|
1672
1702
|
# Restrict this cop from only looking at certain names
|
|
1673
1703
|
Ignore: []
|
|
1674
1704
|
|
|
1705
|
+
Lint/CopDirectiveSyntax:
|
|
1706
|
+
Description: 'Checks that `# rubocop:` directives are strictly formatted.'
|
|
1707
|
+
Enabled: pending
|
|
1708
|
+
VersionAdded: '1.72'
|
|
1709
|
+
|
|
1675
1710
|
Lint/Debugger:
|
|
1676
|
-
Description: '
|
|
1711
|
+
Description: 'Checks for debugger calls.'
|
|
1677
1712
|
Enabled: true
|
|
1678
1713
|
VersionAdded: '0.14'
|
|
1679
1714
|
VersionChanged: '1.63'
|
|
@@ -1724,7 +1759,7 @@ Lint/Debugger:
|
|
|
1724
1759
|
- debug/start
|
|
1725
1760
|
|
|
1726
1761
|
Lint/DeprecatedClassMethods:
|
|
1727
|
-
Description: '
|
|
1762
|
+
Description: 'Checks for deprecated class method calls.'
|
|
1728
1763
|
Enabled: true
|
|
1729
1764
|
VersionAdded: '0.19'
|
|
1730
1765
|
|
|
@@ -1785,6 +1820,7 @@ Lint/DuplicateBranch:
|
|
|
1785
1820
|
VersionChanged: '1.7'
|
|
1786
1821
|
IgnoreLiteralBranches: false
|
|
1787
1822
|
IgnoreConstantBranches: false
|
|
1823
|
+
IgnoreDuplicateElseBranch: false
|
|
1788
1824
|
|
|
1789
1825
|
Lint/DuplicateCaseCondition:
|
|
1790
1826
|
Description: 'Do not repeat values in case conditionals.'
|
|
@@ -1797,13 +1833,13 @@ Lint/DuplicateElsifCondition:
|
|
|
1797
1833
|
VersionAdded: '0.88'
|
|
1798
1834
|
|
|
1799
1835
|
Lint/DuplicateHashKey:
|
|
1800
|
-
Description: '
|
|
1836
|
+
Description: 'Checks for duplicate keys in hash literals.'
|
|
1801
1837
|
Enabled: true
|
|
1802
1838
|
VersionAdded: '0.34'
|
|
1803
1839
|
VersionChanged: '0.77'
|
|
1804
1840
|
|
|
1805
1841
|
Lint/DuplicateMagicComment:
|
|
1806
|
-
Description: '
|
|
1842
|
+
Description: 'Checks for duplicated magic comments.'
|
|
1807
1843
|
Enabled: pending
|
|
1808
1844
|
VersionAdded: '1.37'
|
|
1809
1845
|
|
|
@@ -1813,7 +1849,7 @@ Lint/DuplicateMatchPattern:
|
|
|
1813
1849
|
VersionAdded: '1.50'
|
|
1814
1850
|
|
|
1815
1851
|
Lint/DuplicateMethods:
|
|
1816
|
-
Description: '
|
|
1852
|
+
Description: 'Checks for duplicate method definitions.'
|
|
1817
1853
|
Enabled: true
|
|
1818
1854
|
VersionAdded: '0.29'
|
|
1819
1855
|
|
|
@@ -1823,7 +1859,7 @@ Lint/DuplicateRegexpCharacterClassElement:
|
|
|
1823
1859
|
VersionAdded: '1.1'
|
|
1824
1860
|
|
|
1825
1861
|
Lint/DuplicateRequire:
|
|
1826
|
-
Description: '
|
|
1862
|
+
Description: 'Checks for duplicate `require`s and `require_relative`s.'
|
|
1827
1863
|
Enabled: true
|
|
1828
1864
|
SafeAutoCorrect: false
|
|
1829
1865
|
VersionAdded: '0.90'
|
|
@@ -1840,12 +1876,12 @@ Lint/DuplicateSetElement:
|
|
|
1840
1876
|
VersionAdded: '1.67'
|
|
1841
1877
|
|
|
1842
1878
|
Lint/EachWithObjectArgument:
|
|
1843
|
-
Description: '
|
|
1879
|
+
Description: 'Checks for immutable argument given to each_with_object.'
|
|
1844
1880
|
Enabled: true
|
|
1845
1881
|
VersionAdded: '0.31'
|
|
1846
1882
|
|
|
1847
1883
|
Lint/ElseLayout:
|
|
1848
|
-
Description: '
|
|
1884
|
+
Description: 'Checks for odd code arrangement in an else block.'
|
|
1849
1885
|
Enabled: true
|
|
1850
1886
|
VersionAdded: '0.17'
|
|
1851
1887
|
VersionChanged: '1.2'
|
|
@@ -1868,10 +1904,9 @@ Lint/EmptyConditionalBody:
|
|
|
1868
1904
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
|
1869
1905
|
Enabled: true
|
|
1870
1906
|
AutoCorrect: contextual
|
|
1871
|
-
SafeAutoCorrect: false
|
|
1872
1907
|
AllowComments: true
|
|
1873
1908
|
VersionAdded: '0.89'
|
|
1874
|
-
VersionChanged: '1.
|
|
1909
|
+
VersionChanged: '1.73'
|
|
1875
1910
|
|
|
1876
1911
|
Lint/EmptyEnsure:
|
|
1877
1912
|
Description: 'Checks for empty ensure block.'
|
|
@@ -1902,7 +1937,7 @@ Lint/EmptyInterpolation:
|
|
|
1902
1937
|
Enabled: true
|
|
1903
1938
|
AutoCorrect: contextual
|
|
1904
1939
|
VersionAdded: '0.20'
|
|
1905
|
-
VersionChanged: '1.
|
|
1940
|
+
VersionChanged: '1.76'
|
|
1906
1941
|
|
|
1907
1942
|
Lint/EmptyWhen:
|
|
1908
1943
|
Description: 'Checks for `when` branches with empty bodies.'
|
|
@@ -1954,6 +1989,11 @@ Lint/HashCompareByIdentity:
|
|
|
1954
1989
|
Safe: false
|
|
1955
1990
|
VersionAdded: '0.93'
|
|
1956
1991
|
|
|
1992
|
+
Lint/HashNewWithKeywordArgumentsAsDefault:
|
|
1993
|
+
Description: 'Checks for the deprecated use of keyword arguments for hash default in `Hash.new`.'
|
|
1994
|
+
Enabled: pending
|
|
1995
|
+
VersionAdded: '1.69'
|
|
1996
|
+
|
|
1957
1997
|
Lint/HeredocMethodCallPosition:
|
|
1958
1998
|
Description: >-
|
|
1959
1999
|
Checks for the ordering of a method call where
|
|
@@ -2010,7 +2050,8 @@ Lint/InterpolationCheck:
|
|
|
2010
2050
|
|
|
2011
2051
|
Lint/ItWithoutArgumentsInBlock:
|
|
2012
2052
|
Description: 'Checks uses of `it` calls without arguments in block.'
|
|
2013
|
-
|
|
2053
|
+
References:
|
|
2054
|
+
- 'https://bugs.ruby-lang.org/issues/18980'
|
|
2014
2055
|
Enabled: pending
|
|
2015
2056
|
VersionAdded: '1.59'
|
|
2016
2057
|
|
|
@@ -2022,6 +2063,7 @@ Lint/LambdaWithoutLiteralBlock:
|
|
|
2022
2063
|
Lint/LiteralAsCondition:
|
|
2023
2064
|
Description: 'Checks of literals used in conditions.'
|
|
2024
2065
|
Enabled: true
|
|
2066
|
+
AutoCorrect: contextual
|
|
2025
2067
|
VersionAdded: '0.51'
|
|
2026
2068
|
|
|
2027
2069
|
Lint/LiteralAssignmentInCondition:
|
|
@@ -2144,6 +2186,11 @@ Lint/NumberedParameterAssignment:
|
|
|
2144
2186
|
Enabled: pending
|
|
2145
2187
|
VersionAdded: '1.9'
|
|
2146
2188
|
|
|
2189
|
+
Lint/NumericOperationWithConstantResult:
|
|
2190
|
+
Description: 'Checks for numeric operations with constant results.'
|
|
2191
|
+
Enabled: pending
|
|
2192
|
+
VersionAdded: '1.69'
|
|
2193
|
+
|
|
2147
2194
|
Lint/OrAssignmentToConstant:
|
|
2148
2195
|
Description: 'Checks unintended or-assignment to constant.'
|
|
2149
2196
|
Enabled: pending
|
|
@@ -2230,14 +2277,14 @@ Lint/RedundantRegexpQuantifiers:
|
|
|
2230
2277
|
Lint/RedundantRequireStatement:
|
|
2231
2278
|
Description: 'Checks for unnecessary `require` statement.'
|
|
2232
2279
|
Enabled: true
|
|
2233
|
-
SafeAutoCorrect: false
|
|
2234
2280
|
VersionAdded: '0.76'
|
|
2235
|
-
VersionChanged: '1.
|
|
2281
|
+
VersionChanged: '1.73'
|
|
2236
2282
|
|
|
2237
2283
|
Lint/RedundantSafeNavigation:
|
|
2238
2284
|
Description: 'Checks for redundant safe navigation calls.'
|
|
2239
2285
|
Enabled: true
|
|
2240
2286
|
VersionAdded: '0.93'
|
|
2287
|
+
VersionChanged: '1.79'
|
|
2241
2288
|
AllowedMethods:
|
|
2242
2289
|
- instance_of?
|
|
2243
2290
|
- kind_of?
|
|
@@ -2245,6 +2292,12 @@ Lint/RedundantSafeNavigation:
|
|
|
2245
2292
|
- eql?
|
|
2246
2293
|
- respond_to?
|
|
2247
2294
|
- equal?
|
|
2295
|
+
InferNonNilReceiver: false
|
|
2296
|
+
AdditionalNilMethods:
|
|
2297
|
+
- present?
|
|
2298
|
+
- blank?
|
|
2299
|
+
- try
|
|
2300
|
+
- try!
|
|
2248
2301
|
Safe: false
|
|
2249
2302
|
|
|
2250
2303
|
Lint/RedundantSplatExpansion:
|
|
@@ -2261,6 +2314,11 @@ Lint/RedundantStringCoercion:
|
|
|
2261
2314
|
VersionAdded: '0.19'
|
|
2262
2315
|
VersionChanged: '0.77'
|
|
2263
2316
|
|
|
2317
|
+
Lint/RedundantTypeConversion:
|
|
2318
|
+
Description: 'Checks for redundantly converting a literal to the same type.'
|
|
2319
|
+
Enabled: pending
|
|
2320
|
+
VersionAdded: '1.72'
|
|
2321
|
+
|
|
2264
2322
|
Lint/RedundantWithIndex:
|
|
2265
2323
|
Description: 'Checks for redundant `with_index`.'
|
|
2266
2324
|
Enabled: true
|
|
@@ -2363,6 +2421,7 @@ Lint/SelfAssignment:
|
|
|
2363
2421
|
Description: 'Checks for self-assignments.'
|
|
2364
2422
|
Enabled: true
|
|
2365
2423
|
VersionAdded: '0.89'
|
|
2424
|
+
AllowRBSInlineAnnotation: false
|
|
2366
2425
|
|
|
2367
2426
|
Lint/SendWithMixinArgument:
|
|
2368
2427
|
Description: 'Checks for `send` method when using mixin.'
|
|
@@ -2375,7 +2434,6 @@ Lint/ShadowedArgument:
|
|
|
2375
2434
|
VersionAdded: '0.52'
|
|
2376
2435
|
IgnoreImplicitReferences: false
|
|
2377
2436
|
|
|
2378
|
-
|
|
2379
2437
|
Lint/ShadowedException:
|
|
2380
2438
|
Description: >-
|
|
2381
2439
|
Avoid rescuing a higher level exception
|
|
@@ -2387,8 +2445,15 @@ Lint/ShadowingOuterLocalVariable:
|
|
|
2387
2445
|
Description: >-
|
|
2388
2446
|
Do not use the same name as outer local variable
|
|
2389
2447
|
for block arguments or block local variables.
|
|
2390
|
-
Enabled:
|
|
2448
|
+
Enabled: false
|
|
2391
2449
|
VersionAdded: '0.9'
|
|
2450
|
+
VersionChanged: '1.76'
|
|
2451
|
+
|
|
2452
|
+
Lint/SharedMutableDefault:
|
|
2453
|
+
Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
|
|
2454
|
+
StyleGuide: '#no-mutable-defaults'
|
|
2455
|
+
Enabled: pending
|
|
2456
|
+
VersionAdded: '1.70'
|
|
2392
2457
|
|
|
2393
2458
|
Lint/StructNewOverride:
|
|
2394
2459
|
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
|
@@ -2404,6 +2469,12 @@ Lint/SuppressedException:
|
|
|
2404
2469
|
VersionAdded: '0.9'
|
|
2405
2470
|
VersionChanged: '1.12'
|
|
2406
2471
|
|
|
2472
|
+
Lint/SuppressedExceptionInNumberConversion:
|
|
2473
|
+
Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
|
|
2474
|
+
Enabled: pending
|
|
2475
|
+
SafeAutoCorrect: false
|
|
2476
|
+
VersionAdded: '1.72'
|
|
2477
|
+
|
|
2407
2478
|
Lint/SymbolConversion:
|
|
2408
2479
|
Description: 'Checks for unnecessary symbol conversions.'
|
|
2409
2480
|
Enabled: pending
|
|
@@ -2455,6 +2526,11 @@ Lint/UnderscorePrefixedVariableName:
|
|
|
2455
2526
|
VersionAdded: '0.21'
|
|
2456
2527
|
AllowKeywordBlockArguments: false
|
|
2457
2528
|
|
|
2529
|
+
Lint/UnescapedBracketInRegexp:
|
|
2530
|
+
Description: 'Checks for unescaped literal `]` in Regexp.'
|
|
2531
|
+
Enabled: pending
|
|
2532
|
+
VersionAdded: '1.68'
|
|
2533
|
+
|
|
2458
2534
|
Lint/UnexpectedBlockArity:
|
|
2459
2535
|
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
|
2460
2536
|
Enabled: pending
|
|
@@ -2514,10 +2590,12 @@ Lint/UnusedMethodArgument:
|
|
|
2514
2590
|
Enabled: true
|
|
2515
2591
|
AutoCorrect: contextual
|
|
2516
2592
|
VersionAdded: '0.21'
|
|
2517
|
-
VersionChanged: '1.
|
|
2593
|
+
VersionChanged: '1.69'
|
|
2518
2594
|
AllowUnusedKeywordArguments: false
|
|
2519
2595
|
IgnoreEmptyMethods: true
|
|
2520
2596
|
IgnoreNotImplementedMethods: true
|
|
2597
|
+
NotImplementedExceptions:
|
|
2598
|
+
- NotImplementedError
|
|
2521
2599
|
|
|
2522
2600
|
Lint/UriEscapeUnescape:
|
|
2523
2601
|
Description: >-
|
|
@@ -2552,6 +2630,23 @@ Lint/UselessAssignment:
|
|
|
2552
2630
|
VersionAdded: '0.11'
|
|
2553
2631
|
VersionChanged: '1.66'
|
|
2554
2632
|
|
|
2633
|
+
Lint/UselessConstantScoping:
|
|
2634
|
+
Description: 'Checks for useless constant scoping.'
|
|
2635
|
+
Enabled: pending
|
|
2636
|
+
VersionAdded: '1.72'
|
|
2637
|
+
|
|
2638
|
+
Lint/UselessDefaultValueArgument:
|
|
2639
|
+
Description: 'Checks for usage of `fetch` or `Array.new` with default value argument and block.'
|
|
2640
|
+
Enabled: pending
|
|
2641
|
+
VersionAdded: '1.76'
|
|
2642
|
+
Safe: false
|
|
2643
|
+
AllowedReceivers: []
|
|
2644
|
+
|
|
2645
|
+
Lint/UselessDefined:
|
|
2646
|
+
Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
|
|
2647
|
+
Enabled: pending
|
|
2648
|
+
VersionAdded: '1.69'
|
|
2649
|
+
|
|
2555
2650
|
Lint/UselessElseWithoutRescue:
|
|
2556
2651
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
|
2557
2652
|
Enabled: true
|
|
@@ -2571,6 +2666,11 @@ Lint/UselessNumericOperation:
|
|
|
2571
2666
|
Enabled: pending
|
|
2572
2667
|
VersionAdded: '1.66'
|
|
2573
2668
|
|
|
2669
|
+
Lint/UselessOr:
|
|
2670
|
+
Description: 'Checks for useless OR expressions.'
|
|
2671
|
+
Enabled: pending
|
|
2672
|
+
VersionAdded: '1.76'
|
|
2673
|
+
|
|
2574
2674
|
Lint/UselessRescue:
|
|
2575
2675
|
Description: 'Checks for useless `rescue`s.'
|
|
2576
2676
|
Enabled: pending
|
|
@@ -2610,8 +2710,8 @@ Metrics/AbcSize:
|
|
|
2610
2710
|
Description: >-
|
|
2611
2711
|
A calculated magnitude based on number of assignments,
|
|
2612
2712
|
branches, and conditions.
|
|
2613
|
-
|
|
2614
|
-
-
|
|
2713
|
+
References:
|
|
2714
|
+
- https://wiki.c2.com/?AbcMetric
|
|
2615
2715
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
|
2616
2716
|
Enabled: true
|
|
2617
2717
|
VersionAdded: '0.27'
|
|
@@ -2730,7 +2830,7 @@ Migration/DepartmentName:
|
|
|
2730
2830
|
#################### Naming ##############################
|
|
2731
2831
|
|
|
2732
2832
|
Naming/AccessorMethodName:
|
|
2733
|
-
Description:
|
|
2833
|
+
Description: Checks the naming of accessor methods for get_/set_.
|
|
2734
2834
|
StyleGuide: '#accessor_mutator_method_names'
|
|
2735
2835
|
Enabled: true
|
|
2736
2836
|
VersionAdded: '0.50'
|
|
@@ -2934,6 +3034,7 @@ Naming/MethodName:
|
|
|
2934
3034
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
|
2935
3035
|
Enabled: true
|
|
2936
3036
|
VersionAdded: '0.50'
|
|
3037
|
+
VersionChanged: '1.75'
|
|
2937
3038
|
EnforcedStyle: snake_case
|
|
2938
3039
|
SupportedStyles:
|
|
2939
3040
|
- snake_case
|
|
@@ -2945,6 +3046,10 @@ Naming/MethodName:
|
|
|
2945
3046
|
# - '\A\s*onSelectionCleared\s*'
|
|
2946
3047
|
#
|
|
2947
3048
|
AllowedPatterns: []
|
|
3049
|
+
ForbiddenIdentifiers:
|
|
3050
|
+
- __id__
|
|
3051
|
+
- __send__
|
|
3052
|
+
ForbiddenPatterns: []
|
|
2948
3053
|
|
|
2949
3054
|
Naming/MethodParameterName:
|
|
2950
3055
|
Description: >-
|
|
@@ -2976,22 +3081,42 @@ Naming/MethodParameterName:
|
|
|
2976
3081
|
# Forbidden names that will register an offense
|
|
2977
3082
|
ForbiddenNames: []
|
|
2978
3083
|
|
|
2979
|
-
Naming/
|
|
2980
|
-
Description: '
|
|
3084
|
+
Naming/PredicateMethod:
|
|
3085
|
+
Description: 'Checks that predicate methods end with `?` and non-predicate methods do not.'
|
|
3086
|
+
Enabled: pending
|
|
3087
|
+
VersionAdded: '1.76'
|
|
3088
|
+
VersionChanged: '1.78'
|
|
3089
|
+
# In `aggressive` mode, the cop will register an offense for predicate methods that
|
|
3090
|
+
# may return a non-boolean value.
|
|
3091
|
+
# In `conservative` mode, the cop will *not* register an offense for predicate methods
|
|
3092
|
+
# that may return a non-boolean value.
|
|
3093
|
+
Mode: conservative
|
|
3094
|
+
AllowedMethods:
|
|
3095
|
+
- call
|
|
3096
|
+
AllowedPatterns: []
|
|
3097
|
+
AllowBangMethods: false
|
|
3098
|
+
# Methods that are known to not return a boolean value, despite ending in `?`.
|
|
3099
|
+
WaywardPredicates:
|
|
3100
|
+
- nonzero?
|
|
3101
|
+
|
|
3102
|
+
Naming/PredicatePrefix:
|
|
3103
|
+
Description: 'Predicate method names should not be prefixed and end with a `?`.'
|
|
2981
3104
|
StyleGuide: '#bool-methods-qmark'
|
|
2982
3105
|
Enabled: true
|
|
2983
3106
|
VersionAdded: '0.50'
|
|
2984
|
-
VersionChanged: '
|
|
3107
|
+
VersionChanged: '1.75'
|
|
2985
3108
|
# Predicate name prefixes.
|
|
2986
3109
|
NamePrefix:
|
|
2987
3110
|
- is_
|
|
2988
3111
|
- has_
|
|
2989
3112
|
- have_
|
|
3113
|
+
- does_
|
|
2990
3114
|
# Predicate name prefixes that should be removed.
|
|
2991
3115
|
ForbiddenPrefixes:
|
|
2992
3116
|
- is_
|
|
2993
3117
|
- has_
|
|
2994
3118
|
- have_
|
|
3119
|
+
- does_
|
|
2995
3120
|
# Predicate names which, despite having a forbidden prefix, or no `?`,
|
|
2996
3121
|
# should still be accepted
|
|
2997
3122
|
AllowedMethods:
|
|
@@ -3000,6 +3125,8 @@ Naming/PredicateName:
|
|
|
3000
3125
|
MethodDefinitionMacros:
|
|
3001
3126
|
- define_method
|
|
3002
3127
|
- define_singleton_method
|
|
3128
|
+
# Use Sorbet's T::Boolean return type to detect predicate methods.
|
|
3129
|
+
UseSorbetSigs: false
|
|
3003
3130
|
# Exclude Rspec specs because there is a strong convention to write spec
|
|
3004
3131
|
# helpers in the form of `have_something` or `be_something`.
|
|
3005
3132
|
Exclude:
|
|
@@ -3017,13 +3144,15 @@ Naming/VariableName:
|
|
|
3017
3144
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
|
3018
3145
|
Enabled: true
|
|
3019
3146
|
VersionAdded: '0.50'
|
|
3020
|
-
VersionChanged: '1.
|
|
3147
|
+
VersionChanged: '1.73'
|
|
3021
3148
|
EnforcedStyle: snake_case
|
|
3022
3149
|
SupportedStyles:
|
|
3023
3150
|
- snake_case
|
|
3024
3151
|
- camelCase
|
|
3025
3152
|
AllowedIdentifiers: []
|
|
3026
3153
|
AllowedPatterns: []
|
|
3154
|
+
ForbiddenIdentifiers: []
|
|
3155
|
+
ForbiddenPatterns: []
|
|
3027
3156
|
|
|
3028
3157
|
Naming/VariableNumber:
|
|
3029
3158
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
|
@@ -3039,6 +3168,8 @@ Naming/VariableNumber:
|
|
|
3039
3168
|
CheckMethodNames: true
|
|
3040
3169
|
CheckSymbols: true
|
|
3041
3170
|
AllowedIdentifiers:
|
|
3171
|
+
- TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
|
|
3172
|
+
- TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
|
|
3042
3173
|
- capture3 # Open3.capture3
|
|
3043
3174
|
- iso8601 # Time#iso8601
|
|
3044
3175
|
- rfc1123_date # CGI.rfc1123_date
|
|
@@ -3074,7 +3205,9 @@ Security/JSONLoad:
|
|
|
3074
3205
|
Description: >-
|
|
3075
3206
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
|
3076
3207
|
security issues. See reference for more information.
|
|
3077
|
-
|
|
3208
|
+
References:
|
|
3209
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
|
3210
|
+
- 'https://bugs.ruby-lang.org/issues/19528'
|
|
3078
3211
|
Enabled: true
|
|
3079
3212
|
VersionAdded: '0.43'
|
|
3080
3213
|
VersionChanged: '1.22'
|
|
@@ -3086,7 +3219,8 @@ Security/MarshalLoad:
|
|
|
3086
3219
|
Description: >-
|
|
3087
3220
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
|
3088
3221
|
security issues. See reference for more information.
|
|
3089
|
-
|
|
3222
|
+
References:
|
|
3223
|
+
- 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
|
3090
3224
|
Enabled: true
|
|
3091
3225
|
VersionAdded: '0.47'
|
|
3092
3226
|
|
|
@@ -3101,7 +3235,8 @@ Security/YAMLLoad:
|
|
|
3101
3235
|
Description: >-
|
|
3102
3236
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
|
3103
3237
|
security issues. See reference for more information.
|
|
3104
|
-
|
|
3238
|
+
References:
|
|
3239
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
|
3105
3240
|
Enabled: true
|
|
3106
3241
|
VersionAdded: '0.47'
|
|
3107
3242
|
SafeAutoCorrect: false
|
|
@@ -3112,13 +3247,14 @@ Style/AccessModifierDeclarations:
|
|
|
3112
3247
|
Description: 'Checks style of how access modifiers are used.'
|
|
3113
3248
|
Enabled: true
|
|
3114
3249
|
VersionAdded: '0.57'
|
|
3115
|
-
VersionChanged: '
|
|
3250
|
+
VersionChanged: '1.70'
|
|
3116
3251
|
EnforcedStyle: group
|
|
3117
3252
|
SupportedStyles:
|
|
3118
3253
|
- inline
|
|
3119
3254
|
- group
|
|
3120
3255
|
AllowModifiersOnSymbols: true
|
|
3121
3256
|
AllowModifiersOnAttrs: true
|
|
3257
|
+
AllowModifiersOnAliasMethod: true
|
|
3122
3258
|
SafeAutoCorrect: false
|
|
3123
3259
|
|
|
3124
3260
|
Style/AccessorGrouping:
|
|
@@ -3143,6 +3279,12 @@ Style/Alias:
|
|
|
3143
3279
|
- prefer_alias
|
|
3144
3280
|
- prefer_alias_method
|
|
3145
3281
|
|
|
3282
|
+
Style/AmbiguousEndlessMethodDefinition:
|
|
3283
|
+
Description: 'Checks for endless methods inside operators of lower precedence.'
|
|
3284
|
+
StyleGuide: '#ambiguous-endless-method-defintions'
|
|
3285
|
+
Enabled: pending
|
|
3286
|
+
VersionAdded: '1.68'
|
|
3287
|
+
|
|
3146
3288
|
Style/AndOr:
|
|
3147
3289
|
Description: 'Use &&/|| instead of and/or.'
|
|
3148
3290
|
StyleGuide: '#no-and-or-or'
|
|
@@ -3188,7 +3330,8 @@ Style/ArrayCoercion:
|
|
|
3188
3330
|
|
|
3189
3331
|
Style/ArrayFirstLast:
|
|
3190
3332
|
Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
|
|
3191
|
-
|
|
3333
|
+
References:
|
|
3334
|
+
- '#first-and-last'
|
|
3192
3335
|
Enabled: false
|
|
3193
3336
|
VersionAdded: '1.58'
|
|
3194
3337
|
Safe: false
|
|
@@ -3199,6 +3342,12 @@ Style/ArrayIntersect:
|
|
|
3199
3342
|
Safe: false
|
|
3200
3343
|
VersionAdded: '1.40'
|
|
3201
3344
|
|
|
3345
|
+
Style/ArrayIntersectWithSingleElement:
|
|
3346
|
+
Description: 'Use `include?(element)` instead of `intersect?([element])`.'
|
|
3347
|
+
Enabled: 'pending'
|
|
3348
|
+
Safe: false
|
|
3349
|
+
VersionAdded: '1.81'
|
|
3350
|
+
|
|
3202
3351
|
Style/ArrayJoin:
|
|
3203
3352
|
Description: 'Use Array#join instead of Array#*.'
|
|
3204
3353
|
StyleGuide: '#array-join'
|
|
@@ -3250,6 +3399,13 @@ Style/BisectedAttrAccessor:
|
|
|
3250
3399
|
Enabled: true
|
|
3251
3400
|
VersionAdded: '0.87'
|
|
3252
3401
|
|
|
3402
|
+
Style/BitwisePredicate:
|
|
3403
|
+
Description: 'Prefer bitwise predicate methods over direct comparison operations.'
|
|
3404
|
+
StyleGuide: '#bitwise-predicate-methods'
|
|
3405
|
+
Enabled: pending
|
|
3406
|
+
Safe: false
|
|
3407
|
+
VersionAdded: '1.68'
|
|
3408
|
+
|
|
3253
3409
|
Style/BlockComments:
|
|
3254
3410
|
Description: 'Do not use block comments.'
|
|
3255
3411
|
StyleGuide: '#no-block-comments'
|
|
@@ -3420,6 +3576,7 @@ Style/ClassAndModuleChildren:
|
|
|
3420
3576
|
SafeAutoCorrect: false
|
|
3421
3577
|
Enabled: true
|
|
3422
3578
|
VersionAdded: '0.19'
|
|
3579
|
+
VersionChanged: '1.74'
|
|
3423
3580
|
#
|
|
3424
3581
|
# Basically there are two different styles:
|
|
3425
3582
|
#
|
|
@@ -3435,7 +3592,21 @@ Style/ClassAndModuleChildren:
|
|
|
3435
3592
|
#
|
|
3436
3593
|
# The compact style is only forced, for classes or modules with one child.
|
|
3437
3594
|
EnforcedStyle: nested
|
|
3438
|
-
SupportedStyles:
|
|
3595
|
+
SupportedStyles: &supported_styles
|
|
3596
|
+
- nested
|
|
3597
|
+
- compact
|
|
3598
|
+
# Configure classes separately, if desired. If not set, or set to `nil`,
|
|
3599
|
+
# the `EnforcedStyle` value will be used.
|
|
3600
|
+
EnforcedStyleForClasses: ~
|
|
3601
|
+
SupportedStylesForClasses:
|
|
3602
|
+
- ~
|
|
3603
|
+
- nested
|
|
3604
|
+
- compact
|
|
3605
|
+
# Configure modules separately, if desired. If not set, or set to `nil`,
|
|
3606
|
+
# the `EnforcedStyle` value will be used.
|
|
3607
|
+
EnforcedStyleForModules: ~
|
|
3608
|
+
SupportedStylesForModules:
|
|
3609
|
+
- ~
|
|
3439
3610
|
- nested
|
|
3440
3611
|
- compact
|
|
3441
3612
|
|
|
@@ -3521,6 +3692,13 @@ Style/CollectionMethods:
|
|
|
3521
3692
|
- inject
|
|
3522
3693
|
- reduce
|
|
3523
3694
|
|
|
3695
|
+
Style/CollectionQuerying:
|
|
3696
|
+
Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
|
|
3697
|
+
StyleGuide: '#collection-querying'
|
|
3698
|
+
Enabled: pending
|
|
3699
|
+
VersionAdded: '1.77'
|
|
3700
|
+
Safe: false
|
|
3701
|
+
|
|
3524
3702
|
Style/ColonMethodCall:
|
|
3525
3703
|
Description: 'Do not use :: for method call.'
|
|
3526
3704
|
StyleGuide: '#double-colons'
|
|
@@ -3533,6 +3711,11 @@ Style/ColonMethodDefinition:
|
|
|
3533
3711
|
Enabled: true
|
|
3534
3712
|
VersionAdded: '0.52'
|
|
3535
3713
|
|
|
3714
|
+
Style/CombinableDefined:
|
|
3715
|
+
Description: 'Checks successive `defined?` calls that can be combined into a single call.'
|
|
3716
|
+
Enabled: pending
|
|
3717
|
+
VersionAdded: '1.68'
|
|
3718
|
+
|
|
3536
3719
|
Style/CombinableLoops:
|
|
3537
3720
|
Description: >-
|
|
3538
3721
|
Checks for places where multiple consecutive loops over the same data
|
|
@@ -3583,6 +3766,14 @@ Style/CommentedKeyword:
|
|
|
3583
3766
|
VersionAdded: '0.51'
|
|
3584
3767
|
VersionChanged: '1.19'
|
|
3585
3768
|
|
|
3769
|
+
Style/ComparableBetween:
|
|
3770
|
+
Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
|
|
3771
|
+
Enabled: pending
|
|
3772
|
+
Safe: false
|
|
3773
|
+
VersionAdded: '1.74'
|
|
3774
|
+
VersionChanged: '1.75'
|
|
3775
|
+
StyleGuide: '#ranges-or-between'
|
|
3776
|
+
|
|
3586
3777
|
Style/ComparableClamp:
|
|
3587
3778
|
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
|
3588
3779
|
Enabled: pending
|
|
@@ -3673,6 +3864,12 @@ Style/DefWithParentheses:
|
|
|
3673
3864
|
VersionAdded: '0.9'
|
|
3674
3865
|
VersionChanged: '0.12'
|
|
3675
3866
|
|
|
3867
|
+
Style/DigChain:
|
|
3868
|
+
Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
|
|
3869
|
+
Enabled: pending
|
|
3870
|
+
Safe: false
|
|
3871
|
+
VersionAdded: '1.69'
|
|
3872
|
+
|
|
3676
3873
|
Style/Dir:
|
|
3677
3874
|
Description: >-
|
|
3678
3875
|
Use the `__dir__` method to retrieve the canonicalized
|
|
@@ -3809,6 +4006,16 @@ Style/EmptyMethod:
|
|
|
3809
4006
|
- compact
|
|
3810
4007
|
- expanded
|
|
3811
4008
|
|
|
4009
|
+
Style/EmptyStringInsideInterpolation:
|
|
4010
|
+
Description: 'Checks for empty strings being assigned inside string interpolation.'
|
|
4011
|
+
StyleGuide: '#empty-strings-in-interpolation'
|
|
4012
|
+
Enabled: pending
|
|
4013
|
+
EnforcedStyle: trailing_conditional
|
|
4014
|
+
SupportedStyles:
|
|
4015
|
+
- trailing_conditional
|
|
4016
|
+
- ternary
|
|
4017
|
+
VersionAdded: '1.76'
|
|
4018
|
+
|
|
3812
4019
|
Style/Encoding:
|
|
3813
4020
|
Description: 'Use UTF-8 as the source file encoding.'
|
|
3814
4021
|
StyleGuide: '#utf-8'
|
|
@@ -3833,6 +4040,8 @@ Style/EndlessMethod:
|
|
|
3833
4040
|
- allow_single_line
|
|
3834
4041
|
- allow_always
|
|
3835
4042
|
- disallow
|
|
4043
|
+
- require_single_line
|
|
4044
|
+
- require_always
|
|
3836
4045
|
|
|
3837
4046
|
Style/EnvHome:
|
|
3838
4047
|
Description: "Checks for consistent usage of `ENV['HOME']`."
|
|
@@ -3885,12 +4094,15 @@ Style/ExponentialNotation:
|
|
|
3885
4094
|
Style/FetchEnvVar:
|
|
3886
4095
|
Description: >-
|
|
3887
4096
|
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
|
3888
|
-
|
|
4097
|
+
References:
|
|
3889
4098
|
- https://rubystyle.guide/#hash-fetch-defaults
|
|
3890
4099
|
Enabled: pending
|
|
3891
4100
|
VersionAdded: '1.28'
|
|
3892
4101
|
# Environment variables to be excluded from the inspection.
|
|
3893
4102
|
AllowedVars: []
|
|
4103
|
+
# When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
|
|
4104
|
+
# When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
|
|
4105
|
+
DefaultToNil: true
|
|
3894
4106
|
|
|
3895
4107
|
Style/FileEmpty:
|
|
3896
4108
|
Description: >-
|
|
@@ -3899,12 +4111,24 @@ Style/FileEmpty:
|
|
|
3899
4111
|
Safe: false
|
|
3900
4112
|
VersionAdded: '1.48'
|
|
3901
4113
|
|
|
4114
|
+
Style/FileNull:
|
|
4115
|
+
Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
|
|
4116
|
+
Enabled: pending
|
|
4117
|
+
SafeAutoCorrect: false
|
|
4118
|
+
VersionAdded: '1.69'
|
|
4119
|
+
|
|
3902
4120
|
Style/FileRead:
|
|
3903
4121
|
Description: 'Favor `File.(bin)read` convenience methods.'
|
|
3904
4122
|
StyleGuide: '#file-read'
|
|
3905
4123
|
Enabled: pending
|
|
3906
4124
|
VersionAdded: '1.24'
|
|
3907
4125
|
|
|
4126
|
+
Style/FileTouch:
|
|
4127
|
+
Description: 'Favor `FileUtils.touch` for touching files.'
|
|
4128
|
+
Enabled: pending
|
|
4129
|
+
VersionAdded: '1.69'
|
|
4130
|
+
SafeAutoCorrect: false
|
|
4131
|
+
|
|
3908
4132
|
Style/FileWrite:
|
|
3909
4133
|
Description: 'Favor `File.(bin)write` convenience methods.'
|
|
3910
4134
|
StyleGuide: '#file-write'
|
|
@@ -3914,7 +4138,8 @@ Style/FileWrite:
|
|
|
3914
4138
|
Style/FloatDivision:
|
|
3915
4139
|
Description: 'For performing float division, coerce one side only.'
|
|
3916
4140
|
StyleGuide: '#float-division'
|
|
3917
|
-
|
|
4141
|
+
References:
|
|
4142
|
+
- 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
|
3918
4143
|
Enabled: true
|
|
3919
4144
|
VersionAdded: '0.72'
|
|
3920
4145
|
VersionChanged: '1.9'
|
|
@@ -3965,8 +4190,14 @@ Style/FormatStringToken:
|
|
|
3965
4190
|
# style token in a format string to be allowed when enforced style is not
|
|
3966
4191
|
# `unannotated`.
|
|
3967
4192
|
MaxUnannotatedPlaceholdersAllowed: 1
|
|
4193
|
+
# The mode the cop operates in. Two values are allowed:
|
|
4194
|
+
# * aggressive (default): all strings are considered
|
|
4195
|
+
# * conservative:
|
|
4196
|
+
# only register offenses for strings given to `printf`, `sprintf`,
|
|
4197
|
+
# format` and `%` methods. Other strings are not considered.
|
|
4198
|
+
Mode: aggressive
|
|
3968
4199
|
VersionAdded: '0.49'
|
|
3969
|
-
VersionChanged: '1.
|
|
4200
|
+
VersionChanged: '1.74'
|
|
3970
4201
|
AllowedMethods: []
|
|
3971
4202
|
AllowedPatterns: []
|
|
3972
4203
|
|
|
@@ -3991,6 +4222,9 @@ Style/FrozenStringLiteralComment:
|
|
|
3991
4222
|
# exist in a file.
|
|
3992
4223
|
- never
|
|
3993
4224
|
SafeAutoCorrect: false
|
|
4225
|
+
Exclude:
|
|
4226
|
+
# Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
|
|
4227
|
+
- '**/*.arb'
|
|
3994
4228
|
|
|
3995
4229
|
Style/GlobalStdStream:
|
|
3996
4230
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
|
@@ -4002,14 +4236,15 @@ Style/GlobalStdStream:
|
|
|
4002
4236
|
Style/GlobalVars:
|
|
4003
4237
|
Description: 'Do not introduce global variables.'
|
|
4004
4238
|
StyleGuide: '#instance-vars'
|
|
4005
|
-
|
|
4239
|
+
References:
|
|
4240
|
+
- 'https://www.zenspider.com/ruby/quickref.html'
|
|
4006
4241
|
Enabled: true
|
|
4007
4242
|
VersionAdded: '0.13'
|
|
4008
4243
|
# Built-in global variables are allowed by default.
|
|
4009
4244
|
AllowedVariables: []
|
|
4010
4245
|
|
|
4011
4246
|
Style/GuardClause:
|
|
4012
|
-
Description: '
|
|
4247
|
+
Description: 'Checks for conditionals that can be replaced with guard clauses.'
|
|
4013
4248
|
StyleGuide: '#no-nested-conditionals'
|
|
4014
4249
|
Enabled: true
|
|
4015
4250
|
VersionAdded: '0.20'
|
|
@@ -4059,6 +4294,12 @@ Style/HashExcept:
|
|
|
4059
4294
|
VersionAdded: '1.7'
|
|
4060
4295
|
VersionChanged: '1.39'
|
|
4061
4296
|
|
|
4297
|
+
Style/HashFetchChain:
|
|
4298
|
+
Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
|
|
4299
|
+
Enabled: pending
|
|
4300
|
+
Safe: false
|
|
4301
|
+
VersionAdded: '1.75'
|
|
4302
|
+
|
|
4062
4303
|
Style/HashLikeCase:
|
|
4063
4304
|
Description: >-
|
|
4064
4305
|
Checks for places where `case-when` represents a simple 1:1
|
|
@@ -4069,6 +4310,14 @@ Style/HashLikeCase:
|
|
|
4069
4310
|
# to trigger this cop
|
|
4070
4311
|
MinBranchesCount: 3
|
|
4071
4312
|
|
|
4313
|
+
Style/HashSlice:
|
|
4314
|
+
Description: >-
|
|
4315
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
|
4316
|
+
that can be replaced with `Hash#slice` method.
|
|
4317
|
+
Enabled: pending
|
|
4318
|
+
Safe: false
|
|
4319
|
+
VersionAdded: '1.71'
|
|
4320
|
+
|
|
4072
4321
|
Style/HashSyntax:
|
|
4073
4322
|
Description: >-
|
|
4074
4323
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
|
@@ -4256,6 +4505,31 @@ Style/IpAddresses:
|
|
|
4256
4505
|
- '**/gems.rb'
|
|
4257
4506
|
- '**/*.gemspec'
|
|
4258
4507
|
|
|
4508
|
+
Style/ItAssignment:
|
|
4509
|
+
Description: 'Checks for local variables and method parameters named `it`.'
|
|
4510
|
+
Enabled: pending
|
|
4511
|
+
VersionAdded: '1.70'
|
|
4512
|
+
|
|
4513
|
+
Style/ItBlockParameter:
|
|
4514
|
+
Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
|
|
4515
|
+
Enabled: pending
|
|
4516
|
+
EnforcedStyle: allow_single_line
|
|
4517
|
+
SupportedStyles:
|
|
4518
|
+
- allow_single_line
|
|
4519
|
+
- only_numbered_parameters
|
|
4520
|
+
- always
|
|
4521
|
+
- disallow
|
|
4522
|
+
VersionAdded: '1.75'
|
|
4523
|
+
VersionChanged: '1.76'
|
|
4524
|
+
|
|
4525
|
+
Style/KeywordArgumentsMerging:
|
|
4526
|
+
Description: >-
|
|
4527
|
+
When passing an existing hash as keyword arguments, provide additional arguments
|
|
4528
|
+
directly rather than using `merge`.
|
|
4529
|
+
StyleGuide: '#merging-keyword-arguments'
|
|
4530
|
+
Enabled: pending
|
|
4531
|
+
VersionAdded: '1.68'
|
|
4532
|
+
|
|
4259
4533
|
Style/KeywordParametersOrder:
|
|
4260
4534
|
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
|
4261
4535
|
StyleGuide: '#keyword-parameters-order'
|
|
@@ -4279,8 +4553,9 @@ Style/LambdaCall:
|
|
|
4279
4553
|
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
|
4280
4554
|
StyleGuide: '#proc-call'
|
|
4281
4555
|
Enabled: true
|
|
4556
|
+
AutoCorrect: contextual
|
|
4282
4557
|
VersionAdded: '0.13'
|
|
4283
|
-
VersionChanged: '
|
|
4558
|
+
VersionChanged: '<<next>>'
|
|
4284
4559
|
EnforcedStyle: call
|
|
4285
4560
|
SupportedStyles:
|
|
4286
4561
|
- call
|
|
@@ -4636,7 +4911,7 @@ Style/Next:
|
|
|
4636
4911
|
StyleGuide: '#no-nested-conditionals'
|
|
4637
4912
|
Enabled: true
|
|
4638
4913
|
VersionAdded: '0.22'
|
|
4639
|
-
VersionChanged: '
|
|
4914
|
+
VersionChanged: '1.75'
|
|
4640
4915
|
# With `always` all conditions at the end of an iteration needs to be
|
|
4641
4916
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
|
4642
4917
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
|
@@ -4644,6 +4919,7 @@ Style/Next:
|
|
|
4644
4919
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
|
4645
4920
|
# needs to have to trigger this cop
|
|
4646
4921
|
MinBodyLength: 3
|
|
4922
|
+
AllowConsecutiveConditionals: false
|
|
4647
4923
|
SupportedStyles:
|
|
4648
4924
|
- skip_modifier_ifs
|
|
4649
4925
|
- always
|
|
@@ -4775,8 +5051,8 @@ Style/OpenStructUse:
|
|
|
4775
5051
|
Description: >-
|
|
4776
5052
|
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
|
4777
5053
|
version compatibility, and potential security issues.
|
|
4778
|
-
|
|
4779
|
-
- https://docs.ruby-lang.org/en/3.0
|
|
5054
|
+
References:
|
|
5055
|
+
- https://docs.ruby-lang.org/en/3.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
|
4780
5056
|
|
|
4781
5057
|
Enabled: pending
|
|
4782
5058
|
Safe: false
|
|
@@ -4932,7 +5208,7 @@ Style/RandomWithOffset:
|
|
|
4932
5208
|
VersionAdded: '0.52'
|
|
4933
5209
|
|
|
4934
5210
|
Style/RedundantArgument:
|
|
4935
|
-
Description: '
|
|
5211
|
+
Description: 'Checks for a redundant argument passed to certain methods.'
|
|
4936
5212
|
Enabled: pending
|
|
4937
5213
|
Safe: false
|
|
4938
5214
|
VersionAdded: '1.4'
|
|
@@ -4958,6 +5234,12 @@ Style/RedundantArrayConstructor:
|
|
|
4958
5234
|
Enabled: pending
|
|
4959
5235
|
VersionAdded: '1.52'
|
|
4960
5236
|
|
|
5237
|
+
Style/RedundantArrayFlatten:
|
|
5238
|
+
Description: 'Checks for redundant calls of `Array#flatten`.'
|
|
5239
|
+
Enabled: pending
|
|
5240
|
+
Safe: false
|
|
5241
|
+
VersionAdded: '1.76'
|
|
5242
|
+
|
|
4961
5243
|
Style/RedundantAssignment:
|
|
4962
5244
|
Description: 'Checks for redundant assignment before returning.'
|
|
4963
5245
|
Enabled: true
|
|
@@ -4979,6 +5261,9 @@ Style/RedundantCondition:
|
|
|
4979
5261
|
Description: 'Checks for unnecessary conditional expressions.'
|
|
4980
5262
|
Enabled: true
|
|
4981
5263
|
VersionAdded: '0.76'
|
|
5264
|
+
VersionChanged: '1.73'
|
|
5265
|
+
AllowedMethods:
|
|
5266
|
+
- nonzero?
|
|
4982
5267
|
|
|
4983
5268
|
Style/RedundantConditional:
|
|
4984
5269
|
Description: "Don't return true/false from a conditional."
|
|
@@ -4991,7 +5276,7 @@ Style/RedundantConstantBase:
|
|
|
4991
5276
|
VersionAdded: '1.40'
|
|
4992
5277
|
|
|
4993
5278
|
Style/RedundantCurrentDirectoryInPath:
|
|
4994
|
-
Description: 'Checks for
|
|
5279
|
+
Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
|
|
4995
5280
|
Enabled: pending
|
|
4996
5281
|
VersionAdded: '1.53'
|
|
4997
5282
|
|
|
@@ -5017,7 +5302,8 @@ Style/RedundantFetchBlock:
|
|
|
5017
5302
|
Description: >-
|
|
5018
5303
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
|
5019
5304
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
|
5020
|
-
|
|
5305
|
+
References:
|
|
5306
|
+
- 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
|
5021
5307
|
Enabled: true
|
|
5022
5308
|
Safe: false
|
|
5023
5309
|
# If enabled, this cop will autocorrect usages of
|
|
@@ -5043,6 +5329,13 @@ Style/RedundantFilterChain:
|
|
|
5043
5329
|
VersionAdded: '1.52'
|
|
5044
5330
|
VersionChanged: '1.57'
|
|
5045
5331
|
|
|
5332
|
+
Style/RedundantFormat:
|
|
5333
|
+
Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
|
|
5334
|
+
Enabled: pending
|
|
5335
|
+
SafeAutoCorrect: false
|
|
5336
|
+
VersionAdded: '1.72'
|
|
5337
|
+
VersionChanged: '1.72'
|
|
5338
|
+
|
|
5046
5339
|
Style/RedundantFreeze:
|
|
5047
5340
|
Description: "Checks usages of Object#freeze on immutable objects."
|
|
5048
5341
|
Enabled: true
|
|
@@ -5076,7 +5369,7 @@ Style/RedundantInterpolationUnfreeze:
|
|
|
5076
5369
|
VersionAdded: '1.66'
|
|
5077
5370
|
|
|
5078
5371
|
Style/RedundantLineContinuation:
|
|
5079
|
-
Description: '
|
|
5372
|
+
Description: 'Checks for redundant line continuation.'
|
|
5080
5373
|
Enabled: pending
|
|
5081
5374
|
VersionAdded: '1.49'
|
|
5082
5375
|
|
|
@@ -5241,11 +5534,19 @@ Style/SafeNavigation:
|
|
|
5241
5534
|
# Maximum length of method chains for register an offense.
|
|
5242
5535
|
MaxChainLength: 2
|
|
5243
5536
|
|
|
5537
|
+
Style/SafeNavigationChainLength:
|
|
5538
|
+
Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
|
|
5539
|
+
StyleGuide: '#safe-navigation'
|
|
5540
|
+
Enabled: pending
|
|
5541
|
+
VersionAdded: '1.68'
|
|
5542
|
+
Max: 2
|
|
5543
|
+
|
|
5244
5544
|
Style/Sample:
|
|
5245
5545
|
Description: >-
|
|
5246
5546
|
Use `sample` instead of `shuffle.first`,
|
|
5247
5547
|
`shuffle.last`, and `shuffle[Integer]`.
|
|
5248
|
-
|
|
5548
|
+
References:
|
|
5549
|
+
- 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
|
5249
5550
|
Enabled: true
|
|
5250
5551
|
VersionAdded: '0.30'
|
|
5251
5552
|
|
|
@@ -5362,7 +5663,7 @@ Style/SpecialGlobalVars:
|
|
|
5362
5663
|
- use_builtin_english_names
|
|
5363
5664
|
|
|
5364
5665
|
Style/StabbyLambdaParentheses:
|
|
5365
|
-
Description: '
|
|
5666
|
+
Description: 'Checks for the usage of parentheses around stabby lambda arguments.'
|
|
5366
5667
|
StyleGuide: '#stabby-lambda-with-args'
|
|
5367
5668
|
Enabled: true
|
|
5368
5669
|
VersionAdded: '0.35'
|
|
@@ -5551,10 +5852,14 @@ Style/TrailingCommaInArguments:
|
|
|
5551
5852
|
# parenthesized method calls where each argument is on its own line.
|
|
5552
5853
|
# If `consistent_comma`, the cop requires a comma after the last argument,
|
|
5553
5854
|
# for all parenthesized method calls with arguments.
|
|
5855
|
+
# If `diff_comma`, the cop requires a comma after the last argument, but only
|
|
5856
|
+
# when that argument is followed by an immediate newline, even if
|
|
5857
|
+
# there is an inline comment.
|
|
5554
5858
|
EnforcedStyleForMultiline: no_comma
|
|
5555
5859
|
SupportedStylesForMultiline:
|
|
5556
5860
|
- comma
|
|
5557
5861
|
- consistent_comma
|
|
5862
|
+
- diff_comma
|
|
5558
5863
|
- no_comma
|
|
5559
5864
|
|
|
5560
5865
|
Style/TrailingCommaInArrayLiteral:
|
|
@@ -5562,14 +5867,17 @@ Style/TrailingCommaInArrayLiteral:
|
|
|
5562
5867
|
StyleGuide: '#no-trailing-array-commas'
|
|
5563
5868
|
Enabled: true
|
|
5564
5869
|
VersionAdded: '0.53'
|
|
5565
|
-
# If `comma`, the cop requires a comma after the last item in an array,
|
|
5566
|
-
#
|
|
5567
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
|
5568
|
-
#
|
|
5870
|
+
# If `comma`, the cop requires a comma after the last item in an array, but only when each item is
|
|
5871
|
+
# on its own line.
|
|
5872
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
|
5873
|
+
# array literals.
|
|
5874
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
|
|
5875
|
+
# literals, but only when that last item immediately precedes a newline.
|
|
5569
5876
|
EnforcedStyleForMultiline: no_comma
|
|
5570
5877
|
SupportedStylesForMultiline:
|
|
5571
5878
|
- comma
|
|
5572
5879
|
- consistent_comma
|
|
5880
|
+
- diff_comma
|
|
5573
5881
|
- no_comma
|
|
5574
5882
|
|
|
5575
5883
|
Style/TrailingCommaInBlockArgs:
|
|
@@ -5581,14 +5889,17 @@ Style/TrailingCommaInBlockArgs:
|
|
|
5581
5889
|
Style/TrailingCommaInHashLiteral:
|
|
5582
5890
|
Description: 'Checks for trailing comma in hash literals.'
|
|
5583
5891
|
Enabled: true
|
|
5584
|
-
# If `comma`, the cop requires a comma after the last item in a hash,
|
|
5585
|
-
#
|
|
5586
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
|
5587
|
-
#
|
|
5892
|
+
# If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
|
|
5893
|
+
# on its own line.
|
|
5894
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
|
5895
|
+
# hash literals.
|
|
5896
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
|
|
5897
|
+
# literals, but only when that last item immediately precedes a newline.
|
|
5588
5898
|
EnforcedStyleForMultiline: no_comma
|
|
5589
5899
|
SupportedStylesForMultiline:
|
|
5590
5900
|
- comma
|
|
5591
5901
|
- consistent_comma
|
|
5902
|
+
- diff_comma
|
|
5592
5903
|
- no_comma
|
|
5593
5904
|
VersionAdded: '0.53'
|
|
5594
5905
|
|
|
@@ -5734,7 +6045,8 @@ Style/YAMLFileRead:
|
|
|
5734
6045
|
|
|
5735
6046
|
Style/YodaCondition:
|
|
5736
6047
|
Description: 'Forbid or enforce yoda conditions.'
|
|
5737
|
-
|
|
6048
|
+
References:
|
|
6049
|
+
- 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
|
5738
6050
|
Enabled: true
|
|
5739
6051
|
EnforcedStyle: forbid_for_all_comparison_operators
|
|
5740
6052
|
SupportedStyles:
|