rubocop 1.52.1 → 1.79.2
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 +93 -88
- data/assets/output.css.erb +159 -0
- data/assets/output.html.erb +1 -160
- data/config/default.yml +596 -91
- data/config/internal_affairs.yml +31 -0
- data/config/obsoletion.yml +13 -3
- data/exe/rubocop +4 -3
- data/lib/rubocop/cached_data.rb +21 -5
- data/lib/rubocop/cli/command/auto_generate_config.rb +28 -15
- data/lib/rubocop/cli/command/execute_runner.rb +4 -4
- data/lib/rubocop/cli/command/lsp.rb +19 -0
- data/lib/rubocop/cli/command/show_cops.rb +24 -2
- data/lib/rubocop/cli/command/show_docs_url.rb +2 -2
- data/lib/rubocop/cli/command/suggest_extensions.rb +7 -1
- data/lib/rubocop/cli/command/version.rb +2 -2
- data/lib/rubocop/cli.rb +26 -3
- data/lib/rubocop/comment_config.rb +3 -3
- data/lib/rubocop/config.rb +92 -22
- data/lib/rubocop/config_finder.rb +14 -4
- data/lib/rubocop/config_loader.rb +68 -57
- data/lib/rubocop/config_loader_resolver.rb +52 -20
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -3
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +9 -1
- data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
- data/lib/rubocop/config_obsoletion.rb +56 -9
- data/lib/rubocop/config_validator.rb +39 -20
- data/lib/rubocop/cop/autocorrect_logic.rb +57 -25
- data/lib/rubocop/cop/base.rb +80 -19
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +3 -2
- data/lib/rubocop/cop/bundler/duplicated_group.rb +127 -0
- data/lib/rubocop/cop/bundler/gem_comment.rb +3 -3
- data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
- data/lib/rubocop/cop/bundler/gem_version.rb +6 -7
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
- data/lib/rubocop/cop/bundler/ordered_gems.rb +10 -2
- data/lib/rubocop/cop/cop.rb +30 -4
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -12
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +4 -8
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +6 -14
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +7 -4
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +2 -0
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +6 -3
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
- data/lib/rubocop/cop/documentation.rb +32 -5
- data/lib/rubocop/cop/exclude_limit.rb +1 -1
- data/lib/rubocop/cop/force.rb +12 -0
- data/lib/rubocop/cop/gemspec/add_runtime_dependency.rb +38 -0
- data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
- data/lib/rubocop/cop/gemspec/dependency_version.rb +5 -7
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +3 -4
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +39 -17
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +10 -2
- data/lib/rubocop/cop/gemspec/require_mfa.rb +15 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -3
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +3 -3
- data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
- data/lib/rubocop/cop/generator.rb +6 -0
- data/lib/rubocop/cop/internal_affairs/cop_description.rb +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 +51 -25
- 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 +6 -5
- data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +8 -6
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +19 -20
- data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +54 -0
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +127 -33
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +63 -0
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +131 -0
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +231 -0
- data/lib/rubocop/cop/internal_affairs/node_type_group.rb +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_expect_offense_arguments.rb +34 -0
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +6 -21
- data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +11 -2
- 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 +2 -5
- data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
- data/lib/rubocop/cop/internal_affairs.rb +9 -0
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +6 -2
- data/lib/rubocop/cop/layout/argument_alignment.rb +3 -10
- data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/assignment_indentation.rb +3 -2
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +0 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +32 -13
- data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
- data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/class_structure.rb +51 -9
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +5 -5
- data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/condition_position.rb +0 -4
- data/lib/rubocop/cop/layout/def_end_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/dot_position.rb +2 -6
- data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_comment.rb +3 -1
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +46 -13
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
- data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +33 -13
- 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 +14 -8
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +23 -1
- data/lib/rubocop/cop/layout/end_alignment.rb +16 -4
- data/lib/rubocop/cop/layout/extra_spacing.rb +5 -11
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +6 -11
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +19 -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 +3 -3
- data/lib/rubocop/cop/layout/hash_alignment.rb +8 -6
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +4 -3
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +5 -2
- data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +16 -16
- data/lib/rubocop/cop/layout/leading_comment_space.rb +84 -2
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +28 -11
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +8 -2
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +4 -2
- data/lib/rubocop/cop/layout/line_length.rb +168 -28
- data/lib/rubocop/cop/layout/multiline_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 +21 -6
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +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 +40 -44
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +8 -9
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +6 -1
- data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
- data/lib/rubocop/cop/layout/space_after_comma.rb +10 -2
- data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +11 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +8 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +3 -3
- data/lib/rubocop/cop/layout/space_around_operators.rb +83 -38
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +20 -10
- data/lib/rubocop/cop/layout/space_before_brackets.rb +7 -40
- data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_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 +8 -1
- data/lib/rubocop/cop/layout/space_inside_parens.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +3 -5
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +5 -0
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +5 -3
- data/lib/rubocop/cop/legacy/corrector.rb +12 -2
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -3
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +0 -2
- data/lib/rubocop/cop/lint/ambiguous_range.rb +9 -1
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +0 -2
- data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +118 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +7 -9
- data/lib/rubocop/cop/lint/big_decimal_new.rb +4 -7
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +11 -13
- data/lib/rubocop/cop/lint/boolean_symbol.rb +2 -4
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +4 -14
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
- data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +1 -1
- data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
- data/lib/rubocop/cop/lint/cop_directive_syntax.rb +84 -0
- data/lib/rubocop/cop/lint/debugger.rb +45 -10
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +2 -2
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +3 -12
- data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -5
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -5
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +110 -32
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +47 -20
- data/lib/rubocop/cop/lint/duplicate_set_element.rb +87 -0
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +0 -4
- data/lib/rubocop/cop/lint/else_layout.rb +0 -2
- data/lib/rubocop/cop/lint/empty_block.rb +1 -1
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +29 -58
- data/lib/rubocop/cop/lint/empty_ensure.rb +2 -12
- data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
- data/lib/rubocop/cop/lint/empty_file.rb +0 -2
- data/lib/rubocop/cop/lint/empty_interpolation.rb +3 -5
- data/lib/rubocop/cop/lint/empty_when.rb +1 -3
- data/lib/rubocop/cop/lint/ensure_return.rb +2 -10
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +24 -23
- data/lib/rubocop/cop/lint/float_comparison.rb +58 -15
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -8
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +2 -12
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
- data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
- data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +23 -12
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +0 -7
- data/lib/rubocop/cop/lint/interpolation_check.rb +9 -4
- data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +50 -0
- data/lib/rubocop/cop/lint/literal_as_condition.rb +126 -11
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +85 -0
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +50 -13
- data/lib/rubocop/cop/lint/loop.rb +6 -12
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/missing_super.rb +33 -7
- data/lib/rubocop/cop/lint/mixed_case_range.rb +113 -0
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +10 -12
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +6 -25
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +2 -7
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +22 -10
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +6 -8
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -3
- data/lib/rubocop/cop/lint/number_conversion.rb +13 -4
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +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 +6 -11
- data/lib/rubocop/cop/lint/percent_string_array.rb +0 -4
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +0 -4
- data/lib/rubocop/cop/lint/raise_exception.rb +29 -10
- data/lib/rubocop/cop/lint/rand_one.rb +0 -4
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +4 -2
- data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +0 -12
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +178 -10
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +9 -8
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -6
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +261 -0
- data/lib/rubocop/cop/lint/redundant_with_index.rb +9 -2
- data/lib/rubocop/cop/lint/redundant_with_object.rb +5 -2
- 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_parentheses.rb +0 -4
- data/lib/rubocop/cop/lint/require_range_parentheses.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -5
- data/lib/rubocop/cop/lint/rescue_type.rb +5 -11
- data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -13
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +31 -13
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +109 -41
- data/lib/rubocop/cop/lint/script_permission.rb +3 -3
- data/lib/rubocop/cop/lint/self_assignment.rb +71 -10
- data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -0
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +26 -12
- data/lib/rubocop/cop/lint/shared_mutable_default.rb +76 -0
- data/lib/rubocop/cop/lint/struct_new_override.rb +12 -12
- data/lib/rubocop/cop/lint/suppressed_exception.rb +3 -3
- data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
- data/lib/rubocop/cop/lint/symbol_conversion.rb +9 -4
- data/lib/rubocop/cop/lint/syntax.rb +10 -4
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +7 -7
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
- data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +88 -0
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +3 -1
- data/lib/rubocop/cop/lint/unified_integer.rb +0 -4
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +4 -3
- data/lib/rubocop/cop/lint/unreachable_code.rb +56 -9
- data/lib/rubocop/cop/lint/unreachable_loop.rb +14 -8
- 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 +36 -10
- data/lib/rubocop/cop/lint/useless_assignment.rb +51 -20
- data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
- data/lib/rubocop/cop/lint/useless_default_value_argument.rb +90 -0
- data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -4
- data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/useless_numeric_operation.rb +79 -0
- 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 -29
- data/lib/rubocop/cop/lint/useless_times.rb +2 -2
- data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +121 -0
- data/lib/rubocop/cop/lint/void.rb +88 -27
- data/lib/rubocop/cop/message_annotator.rb +7 -3
- data/lib/rubocop/cop/metrics/abc_size.rb +4 -4
- data/lib/rubocop/cop/metrics/block_length.rb +8 -6
- data/lib/rubocop/cop/metrics/block_nesting.rb +20 -8
- data/lib/rubocop/cop/metrics/class_length.rb +23 -17
- 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 +16 -7
- data/lib/rubocop/cop/metrics/module_length.rb +7 -6
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +39 -12
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
- data/lib/rubocop/cop/migration/department_name.rb +2 -2
- data/lib/rubocop/cop/mixin/alignment.rb +8 -4
- data/lib/rubocop/cop/mixin/allowed_methods.rb +7 -1
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +15 -3
- 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/code_length.rb +12 -1
- data/lib/rubocop/cop/mixin/comments_help.rb +24 -15
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
- data/lib/rubocop/cop/mixin/configurable_max.rb +5 -1
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/mixin/dig_help.rb +27 -0
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/endless_method_rewriter.rb +24 -0
- data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
- data/lib/rubocop/cop/mixin/forbidden_pattern.rb +16 -0
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +23 -12
- data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +15 -14
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +45 -35
- data/lib/rubocop/cop/mixin/hash_subset.rb +203 -0
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +74 -74
- data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
- data/lib/rubocop/cop/mixin/line_length_help.rb +34 -12
- data/lib/rubocop/cop/mixin/method_complexity.rb +17 -7
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +10 -11
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
- data/lib/rubocop/cop/mixin/percent_array.rb +1 -1
- data/lib/rubocop/cop/mixin/percent_literal.rb +2 -2
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +71 -35
- data/lib/rubocop/cop/mixin/range_help.rb +15 -4
- data/lib/rubocop/cop/mixin/rescue_node.rb +4 -0
- data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +11 -5
- data/lib/rubocop/cop/mixin/string_help.rb +5 -3
- data/lib/rubocop/cop/mixin/string_literals_help.rb +12 -0
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +22 -6
- data/lib/rubocop/cop/naming/accessor_method_name.rb +11 -6
- data/lib/rubocop/cop/naming/block_forwarding.rb +40 -9
- data/lib/rubocop/cop/naming/constant_name.rb +7 -9
- data/lib/rubocop/cop/naming/file_name.rb +5 -7
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -1
- data/lib/rubocop/cop/naming/inclusive_language.rb +13 -5
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +16 -17
- data/lib/rubocop/cop/naming/method_name.rb +185 -15
- data/lib/rubocop/cop/naming/predicate_method.rb +306 -0
- data/lib/rubocop/cop/naming/predicate_prefix.rb +204 -0
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +14 -13
- 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 +4 -2
- data/lib/rubocop/cop/security/eval.rb +2 -1
- data/lib/rubocop/cop/security/open.rb +3 -2
- data/lib/rubocop/cop/security/yaml_load.rb +3 -2
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +172 -32
- data/lib/rubocop/cop/style/accessor_grouping.rb +43 -9
- data/lib/rubocop/cop/style/alias.rb +11 -9
- data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +79 -0
- data/lib/rubocop/cop/style/and_or.rb +1 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +472 -63
- data/lib/rubocop/cop/style/array_first_last.rb +80 -0
- data/lib/rubocop/cop/style/array_intersect.rb +94 -44
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +2 -2
- data/lib/rubocop/cop/style/bitwise_predicate.rb +100 -0
- data/lib/rubocop/cop/style/block_comments.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +56 -24
- data/lib/rubocop/cop/style/case_like_if.rb +14 -17
- data/lib/rubocop/cop/style/class_and_module_children.rb +52 -11
- data/lib/rubocop/cop/style/class_check.rb +1 -0
- data/lib/rubocop/cop/style/class_equality_comparison.rb +8 -1
- data/lib/rubocop/cop/style/class_vars.rb +3 -3
- data/lib/rubocop/cop/style/collection_compact.rb +25 -15
- data/lib/rubocop/cop/style/collection_methods.rb +4 -1
- data/lib/rubocop/cop/style/collection_querying.rb +167 -0
- data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
- data/lib/rubocop/cop/style/combinable_loops.rb +25 -9
- data/lib/rubocop/cop/style/command_literal.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +30 -4
- data/lib/rubocop/cop/style/comparable_between.rb +78 -0
- data/lib/rubocop/cop/style/concat_array_literals.rb +3 -2
- data/lib/rubocop/cop/style/conditional_assignment.rb +53 -38
- data/lib/rubocop/cop/style/constant_visibility.rb +3 -12
- data/lib/rubocop/cop/style/copyright.rb +31 -21
- data/lib/rubocop/cop/style/data_inheritance.rb +8 -1
- data/lib/rubocop/cop/style/date_time.rb +5 -4
- data/lib/rubocop/cop/style/def_with_parentheses.rb +18 -7
- data/lib/rubocop/cop/style/dig_chain.rb +89 -0
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
- data/lib/rubocop/cop/style/documentation.rb +25 -25
- data/lib/rubocop/cop/style/documentation_method.rb +20 -0
- data/lib/rubocop/cop/style/double_negation.rb +4 -4
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +11 -15
- data/lib/rubocop/cop/style/each_with_object.rb +3 -4
- data/lib/rubocop/cop/style/empty_case_condition.rb +6 -1
- data/lib/rubocop/cop/style/empty_else.rb +10 -7
- data/lib/rubocop/cop/style/empty_heredoc.rb +1 -14
- data/lib/rubocop/cop/style/empty_literal.rb +36 -23
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
- data/lib/rubocop/cop/style/endless_method.rb +150 -18
- data/lib/rubocop/cop/style/eval_with_location.rb +23 -31
- data/lib/rubocop/cop/style/exact_regexp_match.rb +6 -5
- data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
- data/lib/rubocop/cop/style/explicit_block_argument.rb +18 -5
- 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_read.rb +2 -5
- data/lib/rubocop/cop/style/file_touch.rb +75 -0
- data/lib/rubocop/cop/style/file_write.rb +2 -5
- data/lib/rubocop/cop/style/float_division.rb +8 -4
- data/lib/rubocop/cop/style/for.rb +4 -2
- data/lib/rubocop/cop/style/format_string.rb +33 -12
- data/lib/rubocop/cop/style/format_string_token.rb +38 -11
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +6 -3
- data/lib/rubocop/cop/style/global_std_stream.rb +10 -1
- data/lib/rubocop/cop/style/global_vars.rb +1 -3
- data/lib/rubocop/cop/style/guard_clause.rb +46 -4
- data/lib/rubocop/cop/style/hash_conversion.rb +26 -9
- data/lib/rubocop/cop/style/hash_each_methods.rb +110 -12
- data/lib/rubocop/cop/style/hash_except.rb +38 -146
- 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 +35 -7
- data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
- data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +57 -9
- data/lib/rubocop/cop/style/if_inside_else.rb +11 -15
- 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 +8 -8
- data/lib/rubocop/cop/style/if_with_semicolon.rb +62 -8
- data/lib/rubocop/cop/style/in_pattern_then.rb +6 -2
- data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +22 -18
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +49 -7
- 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 +5 -4
- data/lib/rubocop/cop/style/lambda_call.rb +14 -3
- data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
- data/lib/rubocop/cop/style/magic_comment_format.rb +1 -1
- data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +82 -50
- data/lib/rubocop/cop/style/map_into_array.rb +236 -0
- data/lib/rubocop/cop/style/map_to_hash.rb +29 -10
- data/lib/rubocop/cop/style/map_to_set.rb +4 -5
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +59 -25
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +21 -5
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +30 -13
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -4
- data/lib/rubocop/cop/style/method_def_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/min_max_comparison.rb +13 -5
- data/lib/rubocop/cop/style/missing_else.rb +2 -4
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +35 -5
- data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
- 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 +10 -9
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +6 -4
- data/lib/rubocop/cop/style/multiline_when_then.rb +0 -4
- 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 +8 -15
- data/lib/rubocop/cop/style/next.rb +45 -1
- data/lib/rubocop/cop/style/nil_comparison.rb +2 -0
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +12 -4
- data/lib/rubocop/cop/style/object_then.rb +16 -14
- data/lib/rubocop/cop/style/one_line_conditional.rb +31 -6
- data/lib/rubocop/cop/style/open_struct_use.rb +6 -6
- data/lib/rubocop/cop/style/operator_method_call.rb +32 -8
- data/lib/rubocop/cop/style/or_assignment.rb +3 -6
- data/lib/rubocop/cop/style/parallel_assignment.rb +47 -45
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -0
- 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/preferred_hash_methods.rb +1 -1
- data/lib/rubocop/cop/style/proc.rb +2 -2
- data/lib/rubocop/cop/style/quoted_symbols.rb +2 -4
- data/lib/rubocop/cop/style/raise_args.rb +19 -14
- data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
- data/lib/rubocop/cop/style/redundant_argument.rb +35 -4
- data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
- data/lib/rubocop/cop/style/redundant_assignment.rb +11 -3
- data/lib/rubocop/cop/style/redundant_begin.rb +17 -4
- data/lib/rubocop/cop/style/redundant_condition.rb +97 -25
- data/lib/rubocop/cop/style/redundant_conditional.rb +2 -10
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +50 -0
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +89 -5
- data/lib/rubocop/cop/style/redundant_each.rb +7 -4
- data/lib/rubocop/cop/style/redundant_exception.rb +33 -13
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +4 -12
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
- data/lib/rubocop/cop/style/redundant_filter_chain.rb +23 -6
- data/lib/rubocop/cop/style/redundant_format.rb +262 -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 +1 -1
- data/lib/rubocop/cop/style/redundant_interpolation_unfreeze.rb +46 -0
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +73 -20
- data/lib/rubocop/cop/style/redundant_parentheses.rb +155 -40
- data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +107 -0
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +10 -25
- data/lib/rubocop/cop/style/redundant_return.rb +16 -5
- data/lib/rubocop/cop/style/redundant_self.rb +32 -20
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +20 -32
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +12 -5
- data/lib/rubocop/cop/style/redundant_sort.rb +11 -10
- data/lib/rubocop/cop/style/redundant_sort_by.rb +19 -3
- data/lib/rubocop/cop/style/redundant_string_escape.rb +5 -3
- data/lib/rubocop/cop/style/regexp_literal.rb +1 -1
- data/lib/rubocop/cop/style/require_order.rb +2 -2
- data/lib/rubocop/cop/style/rescue_modifier.rb +18 -4
- data/lib/rubocop/cop/style/return_nil.rb +8 -4
- data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +137 -0
- data/lib/rubocop/cop/style/safe_navigation.rb +145 -61
- data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
- data/lib/rubocop/cop/style/sample.rb +3 -4
- data/lib/rubocop/cop/style/select_by_regexp.rb +20 -13
- data/lib/rubocop/cop/style/self_assignment.rb +12 -18
- data/lib/rubocop/cop/style/semicolon.rb +10 -5
- data/lib/rubocop/cop/style/send.rb +4 -4
- data/lib/rubocop/cop/style/send_with_literal_method_name.rb +105 -0
- data/lib/rubocop/cop/style/signal_exception.rb +3 -4
- data/lib/rubocop/cop/style/single_argument_dig.rb +16 -8
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +78 -0
- data/lib/rubocop/cop/style/single_line_methods.rb +13 -11
- data/lib/rubocop/cop/style/slicing_with_range.rb +105 -10
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +75 -88
- data/lib/rubocop/cop/style/special_global_vars.rb +2 -3
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/string_chars.rb +1 -0
- data/lib/rubocop/cop/style/string_concatenation.rb +15 -15
- data/lib/rubocop/cop/style/string_literals.rb +1 -1
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
- data/lib/rubocop/cop/style/string_methods.rb +1 -1
- data/lib/rubocop/cop/style/strip.rb +7 -4
- data/lib/rubocop/cop/style/struct_inheritance.rb +9 -2
- data/lib/rubocop/cop/style/super_arguments.rb +221 -0
- data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
- data/lib/rubocop/cop/style/swap_values.rb +4 -15
- data/lib/rubocop/cop/style/symbol_array.rb +35 -15
- data/lib/rubocop/cop/style/symbol_proc.rb +78 -6
- data/lib/rubocop/cop/style/ternary_parentheses.rb +26 -5
- data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -1
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +11 -2
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -4
- data/lib/rubocop/cop/style/trivial_accessors.rb +2 -2
- data/lib/rubocop/cop/style/unpack_first.rb +11 -14
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
- data/lib/rubocop/cop/style/while_until_do.rb +0 -2
- data/lib/rubocop/cop/style/while_until_modifier.rb +0 -2
- data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
- data/lib/rubocop/cop/style/yoda_condition.rb +12 -6
- data/lib/rubocop/cop/style/yoda_expression.rb +10 -8
- data/lib/rubocop/cop/style/zero_length_predicate.rb +32 -24
- data/lib/rubocop/cop/team.rb +28 -4
- data/lib/rubocop/cop/util.rb +20 -7
- data/lib/rubocop/cop/utils/format_string.rb +10 -5
- data/lib/rubocop/cop/variable_force/assignment.rb +35 -7
- 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 +40 -19
- data/lib/rubocop/cops_documentation_generator.rb +133 -56
- data/lib/rubocop/core_ext/string.rb +2 -6
- data/lib/rubocop/directive_comment.rb +54 -18
- data/lib/rubocop/ext/regexp_node.rb +17 -35
- data/lib/rubocop/ext/regexp_parser.rb +7 -21
- data/lib/rubocop/file_finder.rb +11 -9
- data/lib/rubocop/formatter/clang_style_formatter.rb +3 -7
- data/lib/rubocop/formatter/disabled_config_formatter.rb +26 -10
- data/lib/rubocop/formatter/formatter_set.rb +8 -2
- data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +38 -15
- data/lib/rubocop/formatter/json_formatter.rb +0 -1
- data/lib/rubocop/formatter/junit_formatter.rb +71 -24
- data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
- data/lib/rubocop/formatter/offense_count_formatter.rb +13 -3
- data/lib/rubocop/formatter/pacman_formatter.rb +2 -1
- data/lib/rubocop/formatter/tap_formatter.rb +3 -7
- data/lib/rubocop/formatter.rb +1 -1
- data/lib/rubocop/lockfile.rb +58 -7
- data/lib/rubocop/lsp/diagnostic.rb +189 -0
- data/lib/rubocop/lsp/logger.rb +22 -0
- data/lib/rubocop/lsp/routes.rb +227 -0
- data/lib/rubocop/lsp/runtime.rb +69 -0
- data/lib/rubocop/lsp/server.rb +70 -0
- data/lib/rubocop/lsp/severity.rb +27 -0
- data/lib/rubocop/lsp/stdin_runner.rb +85 -0
- data/lib/rubocop/lsp.rb +36 -0
- data/lib/rubocop/magic_comment.rb +24 -14
- data/lib/rubocop/options.rb +54 -23
- data/lib/rubocop/path_util.rb +21 -10
- data/lib/rubocop/pending_cops_reporter.rb +56 -0
- data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
- data/lib/rubocop/plugin/load_error.rb +26 -0
- data/lib/rubocop/plugin/loader.rb +100 -0
- data/lib/rubocop/plugin/not_supported_error.rb +29 -0
- data/lib/rubocop/plugin.rb +46 -0
- data/lib/rubocop/rake_task.rb +5 -2
- data/lib/rubocop/remote_config.rb +5 -1
- data/lib/rubocop/result_cache.rb +29 -30
- data/lib/rubocop/rspec/cop_helper.rb +20 -2
- data/lib/rubocop/rspec/expect_offense.rb +31 -12
- data/lib/rubocop/rspec/shared_contexts.rb +114 -21
- data/lib/rubocop/rspec/support.rb +7 -2
- data/lib/rubocop/runner.rb +40 -13
- data/lib/rubocop/server/cache.rb +63 -10
- 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 +4 -4
- data/lib/rubocop/server/client_command/start.rb +11 -1
- data/lib/rubocop/server/core.rb +5 -0
- data/lib/rubocop/server/server_command/exec.rb +0 -1
- data/lib/rubocop/string_interpreter.rb +3 -3
- data/lib/rubocop/target_finder.rb +97 -82
- data/lib/rubocop/target_ruby.rb +102 -77
- data/lib/rubocop/version.rb +67 -9
- data/lib/rubocop/yaml_duplication_checker.rb +20 -26
- data/lib/rubocop.rb +69 -2
- data/lib/ruby_lsp/rubocop/addon.rb +75 -0
- data/lib/ruby_lsp/rubocop/runtime_adapter.rb +65 -0
- metadata +136 -42
- data/lib/rubocop/cop/naming/predicate_name.rb +0 -134
- data/lib/rubocop/rspec/host_environment_simulation_helper.rb +0 -28
- /data/lib/rubocop/formatter/{git_hub_actions_formatter.rb → github_actions_formatter.rb} +0 -0
data/config/default.yml
CHANGED
@@ -30,6 +30,7 @@ AllCops:
|
|
30
30
|
- '**/*.rbx'
|
31
31
|
- '**/*.ru'
|
32
32
|
- '**/*.ruby'
|
33
|
+
- '**/*.schema'
|
33
34
|
- '**/*.spec'
|
34
35
|
- '**/*.thor'
|
35
36
|
- '**/*.watchr'
|
@@ -55,6 +56,7 @@ AllCops:
|
|
55
56
|
- '**/Puppetfile'
|
56
57
|
- '**/Rakefile'
|
57
58
|
- '**/rakefile'
|
59
|
+
- '**/Schemafile'
|
58
60
|
- '**/Snapfile'
|
59
61
|
- '**/Steepfile'
|
60
62
|
- '**/Thorfile'
|
@@ -80,6 +82,8 @@ AllCops:
|
|
80
82
|
StyleGuideBaseURL: https://rubystyle.guide
|
81
83
|
# Documentation URLs will be constructed using the base URL.
|
82
84
|
DocumentationBaseURL: https://docs.rubocop.org/rubocop
|
85
|
+
# Documentation URLs will end with this extension.
|
86
|
+
DocumentationExtension: .html
|
83
87
|
# Extra details are not displayed in offense messages by default. Change
|
84
88
|
# behavior by overriding ExtraDetails, or by giving the
|
85
89
|
# `-E/--extra-details` option.
|
@@ -142,6 +146,14 @@ AllCops:
|
|
142
146
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
143
147
|
# supported Ruby version (currently Ruby 2.7).
|
144
148
|
TargetRubyVersion: ~
|
149
|
+
# RuboCop choses the parser engine automatically but you can also specify it yourself.
|
150
|
+
# These options are available:
|
151
|
+
# - `default`
|
152
|
+
# - `parser_whitequark` ... https://github.com/whitequark/parser
|
153
|
+
# - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
|
154
|
+
# Not every parser engine can handle every `TargetRubyVersion`. `parser_whitequark`
|
155
|
+
# only works with versions 3.4 and below, `parser_prism` with versions 3.3 and above.
|
156
|
+
ParserEngine: default
|
145
157
|
# Determines if a notification for extension libraries should be shown when
|
146
158
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
147
159
|
# of gems in the Gemfile that the extension is suggested for, if not already
|
@@ -155,8 +167,14 @@ AllCops:
|
|
155
167
|
rubocop-graphql: [graphql]
|
156
168
|
rubocop-capybara: [capybara]
|
157
169
|
rubocop-factory_bot: [factory_bot, factory_bot_rails]
|
170
|
+
rubocop-rspec_rails: [rspec-rails]
|
158
171
|
# Enable/Disable checking the methods extended by Active Support.
|
159
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: ~
|
160
178
|
|
161
179
|
#################### Bundler ###############################
|
162
180
|
|
@@ -171,6 +189,16 @@ Bundler/DuplicatedGem:
|
|
171
189
|
- '**/Gemfile'
|
172
190
|
- '**/gems.rb'
|
173
191
|
|
192
|
+
Bundler/DuplicatedGroup:
|
193
|
+
Description: 'Checks for duplicate group entries in Gemfile.'
|
194
|
+
Enabled: true
|
195
|
+
Severity: warning
|
196
|
+
VersionAdded: '1.56'
|
197
|
+
Include:
|
198
|
+
- '**/*.gemfile'
|
199
|
+
- '**/Gemfile'
|
200
|
+
- '**/gems.rb'
|
201
|
+
|
174
202
|
Bundler/GemComment:
|
175
203
|
Description: 'Add a comment describing each gem.'
|
176
204
|
Enabled: false
|
@@ -243,6 +271,23 @@ Bundler/OrderedGems:
|
|
243
271
|
|
244
272
|
#################### Gemspec ###############################
|
245
273
|
|
274
|
+
Gemspec/AddRuntimeDependency:
|
275
|
+
Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
|
276
|
+
StyleGuide: '#add_dependency_vs_add_runtime_dependency'
|
277
|
+
References:
|
278
|
+
- https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
|
279
|
+
Enabled: pending
|
280
|
+
VersionAdded: '1.65'
|
281
|
+
Include:
|
282
|
+
- '**/*.gemspec'
|
283
|
+
|
284
|
+
Gemspec/AttributeAssignment:
|
285
|
+
Description: 'Use consistent style for Gemspec attributes assignment.'
|
286
|
+
Enabled: pending
|
287
|
+
VersionAdded: '1.77'
|
288
|
+
Include:
|
289
|
+
- '**/*.gemspec'
|
290
|
+
|
246
291
|
Gemspec/DependencyVersion:
|
247
292
|
Description: 'Requires or forbids specifying gem dependency versions.'
|
248
293
|
Enabled: false
|
@@ -306,7 +351,7 @@ Gemspec/RequireMFA:
|
|
306
351
|
Severity: warning
|
307
352
|
VersionAdded: '1.23'
|
308
353
|
VersionChanged: '1.40'
|
309
|
-
|
354
|
+
References:
|
310
355
|
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
311
356
|
Include:
|
312
357
|
- '**/*.gemspec'
|
@@ -333,7 +378,7 @@ Gemspec/RubyVersionGlobalsUsage:
|
|
333
378
|
#################### Layout ###########################
|
334
379
|
|
335
380
|
Layout/AccessModifierIndentation:
|
336
|
-
Description:
|
381
|
+
Description: Checks indentation of private/protected visibility modifiers.
|
337
382
|
StyleGuide: '#indent-public-private-protected'
|
338
383
|
Enabled: true
|
339
384
|
VersionAdded: '0.49'
|
@@ -467,7 +512,9 @@ Layout/ClassStructure:
|
|
467
512
|
Description: 'Enforces a configured order of definitions within a class body.'
|
468
513
|
StyleGuide: '#consistent-classes'
|
469
514
|
Enabled: false
|
515
|
+
SafeAutoCorrect: false
|
470
516
|
VersionAdded: '0.52'
|
517
|
+
VersionChanged: '1.53'
|
471
518
|
Categories:
|
472
519
|
module_inclusion:
|
473
520
|
- include
|
@@ -542,7 +589,9 @@ Layout/ElseAlignment:
|
|
542
589
|
Layout/EmptyComment:
|
543
590
|
Description: 'Checks empty comment.'
|
544
591
|
Enabled: true
|
592
|
+
AutoCorrect: contextual
|
545
593
|
VersionAdded: '0.53'
|
594
|
+
VersionChanged: '1.61'
|
546
595
|
AllowBorderComment: true
|
547
596
|
AllowMarginComment: true
|
548
597
|
|
@@ -563,7 +612,7 @@ Layout/EmptyLineAfterMultilineCondition:
|
|
563
612
|
# This is disabled, because this style is not very common in practice.
|
564
613
|
Enabled: false
|
565
614
|
VersionAdded: '0.90'
|
566
|
-
|
615
|
+
References:
|
567
616
|
- https://github.com/airbnb/ruby#multiline-if-newline
|
568
617
|
|
569
618
|
Layout/EmptyLineBetweenDefs:
|
@@ -575,6 +624,8 @@ Layout/EmptyLineBetweenDefs:
|
|
575
624
|
EmptyLineBetweenMethodDefs: true
|
576
625
|
EmptyLineBetweenClassDefs: true
|
577
626
|
EmptyLineBetweenModuleDefs: true
|
627
|
+
# `DefLikeMacros` takes the name of any macro that you want to treat like a def.
|
628
|
+
DefLikeMacros: []
|
578
629
|
# `AllowAdjacentOneLineDefs` means that single line method definitions don't
|
579
630
|
# need an empty line between them. `true` by default.
|
580
631
|
AllowAdjacentOneLineDefs: true
|
@@ -587,6 +638,12 @@ Layout/EmptyLines:
|
|
587
638
|
Enabled: true
|
588
639
|
VersionAdded: '0.49'
|
589
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
|
+
|
590
647
|
Layout/EmptyLinesAroundAccessModifier:
|
591
648
|
Description: "Keep blank lines around access modifiers."
|
592
649
|
StyleGuide: '#empty-lines-around-access-modifier'
|
@@ -596,7 +653,7 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
596
653
|
SupportedStyles:
|
597
654
|
- around
|
598
655
|
- only_before
|
599
|
-
|
656
|
+
References:
|
600
657
|
# A reference to `EnforcedStyle: only_before`.
|
601
658
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
602
659
|
|
@@ -820,6 +877,7 @@ Layout/FirstMethodArgumentLineBreak:
|
|
820
877
|
Enabled: false
|
821
878
|
VersionAdded: '0.49'
|
822
879
|
AllowMultilineFinalElement: false
|
880
|
+
AllowedMethods: []
|
823
881
|
|
824
882
|
Layout/FirstMethodParameterLineBreak:
|
825
883
|
Description: >-
|
@@ -952,7 +1010,7 @@ Layout/IndentationConsistency:
|
|
952
1010
|
SupportedStyles:
|
953
1011
|
- normal
|
954
1012
|
- indented_internal_methods
|
955
|
-
|
1013
|
+
References:
|
956
1014
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
957
1015
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
958
1016
|
|
@@ -995,9 +1053,11 @@ Layout/LeadingCommentSpace:
|
|
995
1053
|
VersionChanged: '0.73'
|
996
1054
|
AllowDoxygenCommentStyle: false
|
997
1055
|
AllowGemfileRubyComment: false
|
1056
|
+
AllowRBSInlineAnnotation: false
|
1057
|
+
AllowSteepAnnotation: false
|
998
1058
|
|
999
1059
|
Layout/LeadingEmptyLines:
|
1000
|
-
Description:
|
1060
|
+
Description: Checks for unnecessary blank lines at the beginning of a file.
|
1001
1061
|
Enabled: true
|
1002
1062
|
VersionAdded: '0.57'
|
1003
1063
|
VersionChanged: '0.77'
|
@@ -1042,12 +1102,13 @@ Layout/LineLength:
|
|
1042
1102
|
StyleGuide: '#max-line-length'
|
1043
1103
|
Enabled: true
|
1044
1104
|
VersionAdded: '0.25'
|
1045
|
-
VersionChanged: '1.
|
1105
|
+
VersionChanged: '1.69'
|
1046
1106
|
Max: 120
|
1107
|
+
AllowHeredoc: true
|
1047
1108
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
1048
1109
|
# containing a URI to be longer than Max.
|
1049
|
-
AllowHeredoc: true
|
1050
1110
|
AllowURI: true
|
1111
|
+
AllowQualifiedName: true
|
1051
1112
|
URISchemes:
|
1052
1113
|
- http
|
1053
1114
|
- https
|
@@ -1058,6 +1119,8 @@ Layout/LineLength:
|
|
1058
1119
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
1059
1120
|
# any regular expression listed in this option will be ignored by LineLength.
|
1060
1121
|
AllowedPatterns: []
|
1122
|
+
# If SplitStrings is true, long strings will be split using continuations
|
1123
|
+
SplitStrings: false
|
1061
1124
|
|
1062
1125
|
Layout/MultilineArrayBraceLayout:
|
1063
1126
|
Description: >-
|
@@ -1084,7 +1147,7 @@ Layout/MultilineArrayLineBreaks:
|
|
1084
1147
|
AllowMultilineFinalElement: false
|
1085
1148
|
|
1086
1149
|
Layout/MultilineAssignmentLayout:
|
1087
|
-
Description: '
|
1150
|
+
Description: 'Checks for a newline after the assignment operator in multi-line assignments.'
|
1088
1151
|
StyleGuide: '#indent-conditional-assignment'
|
1089
1152
|
Enabled: false
|
1090
1153
|
VersionAdded: '0.49'
|
@@ -1335,6 +1398,10 @@ Layout/SpaceAroundOperators:
|
|
1335
1398
|
SupportedStylesForExponentOperator:
|
1336
1399
|
- space
|
1337
1400
|
- no_space
|
1401
|
+
EnforcedStyleForRationalLiterals: no_space
|
1402
|
+
SupportedStylesForRationalLiterals:
|
1403
|
+
- space
|
1404
|
+
- no_space
|
1338
1405
|
|
1339
1406
|
Layout/SpaceBeforeBlockBraces:
|
1340
1407
|
Description: >-
|
@@ -1451,7 +1518,6 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
1451
1518
|
- space
|
1452
1519
|
- no_space
|
1453
1520
|
|
1454
|
-
|
1455
1521
|
Layout/SpaceInsideParens:
|
1456
1522
|
Description: 'No spaces after ( or before ).'
|
1457
1523
|
StyleGuide: '#spaces-braces'
|
@@ -1530,7 +1596,6 @@ Lint/AmbiguousBlockAssociation:
|
|
1530
1596
|
Description: >-
|
1531
1597
|
Checks for ambiguous block association with method when param passed without
|
1532
1598
|
parentheses.
|
1533
|
-
StyleGuide: '#syntax'
|
1534
1599
|
Enabled: true
|
1535
1600
|
VersionAdded: '0.48'
|
1536
1601
|
VersionChanged: '1.13'
|
@@ -1568,6 +1633,12 @@ Lint/AmbiguousRegexpLiteral:
|
|
1568
1633
|
VersionAdded: '0.17'
|
1569
1634
|
VersionChanged: '0.83'
|
1570
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
|
+
|
1571
1642
|
Lint/AssignmentInCondition:
|
1572
1643
|
Description: "Don't use assignment in conditions."
|
1573
1644
|
StyleGuide: '#safe-assignment-in-condition'
|
@@ -1587,10 +1658,10 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1587
1658
|
Enabled: true
|
1588
1659
|
Safe: false
|
1589
1660
|
VersionAdded: '0.89'
|
1590
|
-
VersionChanged: '1.
|
1661
|
+
VersionChanged: '1.69'
|
1591
1662
|
|
1592
1663
|
Lint/BooleanSymbol:
|
1593
|
-
Description: '
|
1664
|
+
Description: 'Checks for `:true` and `:false` symbols.'
|
1594
1665
|
Enabled: true
|
1595
1666
|
SafeAutoCorrect: false
|
1596
1667
|
VersionAdded: '0.50'
|
@@ -1617,8 +1688,13 @@ Lint/ConstantOverwrittenInRescue:
|
|
1617
1688
|
Enabled: pending
|
1618
1689
|
VersionAdded: '1.31'
|
1619
1690
|
|
1691
|
+
Lint/ConstantReassignment:
|
1692
|
+
Description: 'Checks for constant reassignments.'
|
1693
|
+
Enabled: pending
|
1694
|
+
VersionAdded: '1.70'
|
1695
|
+
|
1620
1696
|
Lint/ConstantResolution:
|
1621
|
-
Description: '
|
1697
|
+
Description: 'Checks that constants are fully qualified with `::`.'
|
1622
1698
|
Enabled: false
|
1623
1699
|
VersionAdded: '0.86'
|
1624
1700
|
# Restrict this cop to only looking at certain names
|
@@ -1626,11 +1702,16 @@ Lint/ConstantResolution:
|
|
1626
1702
|
# Restrict this cop from only looking at certain names
|
1627
1703
|
Ignore: []
|
1628
1704
|
|
1705
|
+
Lint/CopDirectiveSyntax:
|
1706
|
+
Description: 'Checks that `# rubocop:` directives are strictly formatted.'
|
1707
|
+
Enabled: pending
|
1708
|
+
VersionAdded: '1.72'
|
1709
|
+
|
1629
1710
|
Lint/Debugger:
|
1630
|
-
Description: '
|
1711
|
+
Description: 'Checks for debugger calls.'
|
1631
1712
|
Enabled: true
|
1632
1713
|
VersionAdded: '0.14'
|
1633
|
-
VersionChanged: '1.
|
1714
|
+
VersionChanged: '1.63'
|
1634
1715
|
DebuggerMethods:
|
1635
1716
|
# Groups are available so that a specific group can be disabled in
|
1636
1717
|
# a user's configuration, but are otherwise not significant.
|
@@ -1643,8 +1724,14 @@ Lint/Debugger:
|
|
1643
1724
|
- Kernel.byebug
|
1644
1725
|
- Kernel.remote_byebug
|
1645
1726
|
Capybara:
|
1727
|
+
- page.save_and_open_page
|
1728
|
+
- page.save_and_open_screenshot
|
1729
|
+
- page.save_page
|
1730
|
+
- page.save_screenshot
|
1646
1731
|
- save_and_open_page
|
1647
1732
|
- save_and_open_screenshot
|
1733
|
+
- save_page
|
1734
|
+
- save_screenshot
|
1648
1735
|
debug.rb:
|
1649
1736
|
- binding.b
|
1650
1737
|
- binding.break
|
@@ -1666,9 +1753,13 @@ Lint/Debugger:
|
|
1666
1753
|
- jard
|
1667
1754
|
WebConsole:
|
1668
1755
|
- binding.console
|
1756
|
+
DebuggerRequires:
|
1757
|
+
debug.rb:
|
1758
|
+
- debug/open
|
1759
|
+
- debug/start
|
1669
1760
|
|
1670
1761
|
Lint/DeprecatedClassMethods:
|
1671
|
-
Description: '
|
1762
|
+
Description: 'Checks for deprecated class method calls.'
|
1672
1763
|
Enabled: true
|
1673
1764
|
VersionAdded: '0.19'
|
1674
1765
|
|
@@ -1729,6 +1820,7 @@ Lint/DuplicateBranch:
|
|
1729
1820
|
VersionChanged: '1.7'
|
1730
1821
|
IgnoreLiteralBranches: false
|
1731
1822
|
IgnoreConstantBranches: false
|
1823
|
+
IgnoreDuplicateElseBranch: false
|
1732
1824
|
|
1733
1825
|
Lint/DuplicateCaseCondition:
|
1734
1826
|
Description: 'Do not repeat values in case conditionals.'
|
@@ -1741,13 +1833,13 @@ Lint/DuplicateElsifCondition:
|
|
1741
1833
|
VersionAdded: '0.88'
|
1742
1834
|
|
1743
1835
|
Lint/DuplicateHashKey:
|
1744
|
-
Description: '
|
1836
|
+
Description: 'Checks for duplicate keys in hash literals.'
|
1745
1837
|
Enabled: true
|
1746
1838
|
VersionAdded: '0.34'
|
1747
1839
|
VersionChanged: '0.77'
|
1748
1840
|
|
1749
1841
|
Lint/DuplicateMagicComment:
|
1750
|
-
Description: '
|
1842
|
+
Description: 'Checks for duplicated magic comments.'
|
1751
1843
|
Enabled: pending
|
1752
1844
|
VersionAdded: '1.37'
|
1753
1845
|
|
@@ -1757,7 +1849,7 @@ Lint/DuplicateMatchPattern:
|
|
1757
1849
|
VersionAdded: '1.50'
|
1758
1850
|
|
1759
1851
|
Lint/DuplicateMethods:
|
1760
|
-
Description: '
|
1852
|
+
Description: 'Checks for duplicate method definitions.'
|
1761
1853
|
Enabled: true
|
1762
1854
|
VersionAdded: '0.29'
|
1763
1855
|
|
@@ -1767,7 +1859,7 @@ Lint/DuplicateRegexpCharacterClassElement:
|
|
1767
1859
|
VersionAdded: '1.1'
|
1768
1860
|
|
1769
1861
|
Lint/DuplicateRequire:
|
1770
|
-
Description: '
|
1862
|
+
Description: 'Checks for duplicate `require`s and `require_relative`s.'
|
1771
1863
|
Enabled: true
|
1772
1864
|
SafeAutoCorrect: false
|
1773
1865
|
VersionAdded: '0.90'
|
@@ -1778,13 +1870,18 @@ Lint/DuplicateRescueException:
|
|
1778
1870
|
Enabled: true
|
1779
1871
|
VersionAdded: '0.89'
|
1780
1872
|
|
1873
|
+
Lint/DuplicateSetElement:
|
1874
|
+
Description: 'Checks for duplicate elements in Set.'
|
1875
|
+
Enabled: pending
|
1876
|
+
VersionAdded: '1.67'
|
1877
|
+
|
1781
1878
|
Lint/EachWithObjectArgument:
|
1782
|
-
Description: '
|
1879
|
+
Description: 'Checks for immutable argument given to each_with_object.'
|
1783
1880
|
Enabled: true
|
1784
1881
|
VersionAdded: '0.31'
|
1785
1882
|
|
1786
1883
|
Lint/ElseLayout:
|
1787
|
-
Description: '
|
1884
|
+
Description: 'Checks for odd code arrangement in an else block.'
|
1788
1885
|
Enabled: true
|
1789
1886
|
VersionAdded: '0.17'
|
1790
1887
|
VersionChanged: '1.2'
|
@@ -1806,16 +1903,17 @@ Lint/EmptyClass:
|
|
1806
1903
|
Lint/EmptyConditionalBody:
|
1807
1904
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1808
1905
|
Enabled: true
|
1809
|
-
|
1906
|
+
AutoCorrect: contextual
|
1810
1907
|
AllowComments: true
|
1811
1908
|
VersionAdded: '0.89'
|
1812
|
-
VersionChanged: '1.
|
1909
|
+
VersionChanged: '1.73'
|
1813
1910
|
|
1814
1911
|
Lint/EmptyEnsure:
|
1815
1912
|
Description: 'Checks for empty ensure block.'
|
1816
1913
|
Enabled: true
|
1914
|
+
AutoCorrect: contextual
|
1817
1915
|
VersionAdded: '0.10'
|
1818
|
-
VersionChanged: '
|
1916
|
+
VersionChanged: '1.61'
|
1819
1917
|
|
1820
1918
|
Lint/EmptyExpression:
|
1821
1919
|
Description: 'Checks for empty expressions.'
|
@@ -1837,8 +1935,9 @@ Lint/EmptyInPattern:
|
|
1837
1935
|
Lint/EmptyInterpolation:
|
1838
1936
|
Description: 'Checks for empty string interpolation.'
|
1839
1937
|
Enabled: true
|
1938
|
+
AutoCorrect: contextual
|
1840
1939
|
VersionAdded: '0.20'
|
1841
|
-
VersionChanged: '
|
1940
|
+
VersionChanged: '1.76'
|
1842
1941
|
|
1843
1942
|
Lint/EmptyWhen:
|
1844
1943
|
Description: 'Checks for `when` branches with empty bodies.'
|
@@ -1890,6 +1989,11 @@ Lint/HashCompareByIdentity:
|
|
1890
1989
|
Safe: false
|
1891
1990
|
VersionAdded: '0.93'
|
1892
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
|
+
|
1893
1997
|
Lint/HeredocMethodCallPosition:
|
1894
1998
|
Description: >-
|
1895
1999
|
Checks for the ordering of a method call where
|
@@ -1944,6 +2048,13 @@ Lint/InterpolationCheck:
|
|
1944
2048
|
VersionAdded: '0.50'
|
1945
2049
|
VersionChanged: '1.40'
|
1946
2050
|
|
2051
|
+
Lint/ItWithoutArgumentsInBlock:
|
2052
|
+
Description: 'Checks uses of `it` calls without arguments in block.'
|
2053
|
+
References:
|
2054
|
+
- 'https://bugs.ruby-lang.org/issues/18980'
|
2055
|
+
Enabled: pending
|
2056
|
+
VersionAdded: '1.59'
|
2057
|
+
|
1947
2058
|
Lint/LambdaWithoutLiteralBlock:
|
1948
2059
|
Description: 'Checks uses of lambda without a literal block.'
|
1949
2060
|
Enabled: pending
|
@@ -1952,8 +2063,14 @@ Lint/LambdaWithoutLiteralBlock:
|
|
1952
2063
|
Lint/LiteralAsCondition:
|
1953
2064
|
Description: 'Checks of literals used in conditions.'
|
1954
2065
|
Enabled: true
|
2066
|
+
AutoCorrect: contextual
|
1955
2067
|
VersionAdded: '0.51'
|
1956
2068
|
|
2069
|
+
Lint/LiteralAssignmentInCondition:
|
2070
|
+
Description: 'Checks for literal assignments in the conditions.'
|
2071
|
+
Enabled: pending
|
2072
|
+
VersionAdded: '1.58'
|
2073
|
+
|
1957
2074
|
Lint/LiteralInInterpolation:
|
1958
2075
|
Description: 'Checks for literals used in interpolation.'
|
1959
2076
|
Enabled: true
|
@@ -1988,9 +2105,16 @@ Lint/MissingSuper:
|
|
1988
2105
|
Checks for the presence of constructors and lifecycle callbacks
|
1989
2106
|
without calls to `super`.
|
1990
2107
|
Enabled: true
|
2108
|
+
AllowedParentClasses: []
|
1991
2109
|
VersionAdded: '0.89'
|
1992
2110
|
VersionChanged: '1.4'
|
1993
2111
|
|
2112
|
+
Lint/MixedCaseRange:
|
2113
|
+
Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
|
2114
|
+
Enabled: pending
|
2115
|
+
SafeAutoCorrect: false
|
2116
|
+
VersionAdded: '1.53'
|
2117
|
+
|
1994
2118
|
Lint/MixedRegexpCaptureTypes:
|
1995
2119
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1996
2120
|
Enabled: true
|
@@ -2062,6 +2186,11 @@ Lint/NumberedParameterAssignment:
|
|
2062
2186
|
Enabled: pending
|
2063
2187
|
VersionAdded: '1.9'
|
2064
2188
|
|
2189
|
+
Lint/NumericOperationWithConstantResult:
|
2190
|
+
Description: 'Checks for numeric operations with constant results.'
|
2191
|
+
Enabled: pending
|
2192
|
+
VersionAdded: '1.69'
|
2193
|
+
|
2065
2194
|
Lint/OrAssignmentToConstant:
|
2066
2195
|
Description: 'Checks unintended or-assignment to constant.'
|
2067
2196
|
Enabled: pending
|
@@ -2140,15 +2269,22 @@ Lint/RedundantDirGlobSort:
|
|
2140
2269
|
VersionChanged: '1.26'
|
2141
2270
|
SafeAutoCorrect: false
|
2142
2271
|
|
2272
|
+
Lint/RedundantRegexpQuantifiers:
|
2273
|
+
Description: 'Checks for redundant quantifiers in Regexps.'
|
2274
|
+
Enabled: pending
|
2275
|
+
VersionAdded: '1.53'
|
2276
|
+
|
2143
2277
|
Lint/RedundantRequireStatement:
|
2144
2278
|
Description: 'Checks for unnecessary `require` statement.'
|
2145
2279
|
Enabled: true
|
2146
2280
|
VersionAdded: '0.76'
|
2281
|
+
VersionChanged: '1.73'
|
2147
2282
|
|
2148
2283
|
Lint/RedundantSafeNavigation:
|
2149
2284
|
Description: 'Checks for redundant safe navigation calls.'
|
2150
2285
|
Enabled: true
|
2151
2286
|
VersionAdded: '0.93'
|
2287
|
+
VersionChanged: '1.79'
|
2152
2288
|
AllowedMethods:
|
2153
2289
|
- instance_of?
|
2154
2290
|
- kind_of?
|
@@ -2156,6 +2292,12 @@ Lint/RedundantSafeNavigation:
|
|
2156
2292
|
- eql?
|
2157
2293
|
- respond_to?
|
2158
2294
|
- equal?
|
2295
|
+
InferNonNilReceiver: false
|
2296
|
+
AdditionalNilMethods:
|
2297
|
+
- present?
|
2298
|
+
- blank?
|
2299
|
+
- try
|
2300
|
+
- try!
|
2159
2301
|
Safe: false
|
2160
2302
|
|
2161
2303
|
Lint/RedundantSplatExpansion:
|
@@ -2172,6 +2314,11 @@ Lint/RedundantStringCoercion:
|
|
2172
2314
|
VersionAdded: '0.19'
|
2173
2315
|
VersionChanged: '0.77'
|
2174
2316
|
|
2317
|
+
Lint/RedundantTypeConversion:
|
2318
|
+
Description: 'Checks for redundantly converting a literal to the same type.'
|
2319
|
+
Enabled: pending
|
2320
|
+
VersionAdded: '1.72'
|
2321
|
+
|
2175
2322
|
Lint/RedundantWithIndex:
|
2176
2323
|
Description: 'Checks for redundant `with_index`.'
|
2177
2324
|
Enabled: true
|
@@ -2245,9 +2392,9 @@ Lint/SafeNavigationChain:
|
|
2245
2392
|
|
2246
2393
|
Lint/SafeNavigationConsistency:
|
2247
2394
|
Description: >-
|
2248
|
-
Check to make sure that if safe navigation is used
|
2249
|
-
|
2250
|
-
for all method calls on
|
2395
|
+
Check to make sure that if safe navigation is used in an `&&` or `||` condition,
|
2396
|
+
consistent and appropriate safe navigation, without excess or deficiency,
|
2397
|
+
is used for all method calls on the same object.
|
2251
2398
|
Enabled: true
|
2252
2399
|
VersionAdded: '0.55'
|
2253
2400
|
VersionChanged: '0.77'
|
@@ -2274,6 +2421,7 @@ Lint/SelfAssignment:
|
|
2274
2421
|
Description: 'Checks for self-assignments.'
|
2275
2422
|
Enabled: true
|
2276
2423
|
VersionAdded: '0.89'
|
2424
|
+
AllowRBSInlineAnnotation: false
|
2277
2425
|
|
2278
2426
|
Lint/SendWithMixinArgument:
|
2279
2427
|
Description: 'Checks for `send` method when using mixin.'
|
@@ -2286,7 +2434,6 @@ Lint/ShadowedArgument:
|
|
2286
2434
|
VersionAdded: '0.52'
|
2287
2435
|
IgnoreImplicitReferences: false
|
2288
2436
|
|
2289
|
-
|
2290
2437
|
Lint/ShadowedException:
|
2291
2438
|
Description: >-
|
2292
2439
|
Avoid rescuing a higher level exception
|
@@ -2298,8 +2445,15 @@ Lint/ShadowingOuterLocalVariable:
|
|
2298
2445
|
Description: >-
|
2299
2446
|
Do not use the same name as outer local variable
|
2300
2447
|
for block arguments or block local variables.
|
2301
|
-
Enabled:
|
2448
|
+
Enabled: false
|
2302
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'
|
2303
2457
|
|
2304
2458
|
Lint/StructNewOverride:
|
2305
2459
|
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
@@ -2315,6 +2469,12 @@ Lint/SuppressedException:
|
|
2315
2469
|
VersionAdded: '0.9'
|
2316
2470
|
VersionChanged: '1.12'
|
2317
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
|
+
|
2318
2478
|
Lint/SymbolConversion:
|
2319
2479
|
Description: 'Checks for unnecessary symbol conversions.'
|
2320
2480
|
Enabled: pending
|
@@ -2351,7 +2511,9 @@ Lint/TopLevelReturnWithArgument:
|
|
2351
2511
|
Lint/TrailingCommaInAttributeDeclaration:
|
2352
2512
|
Description: 'Checks for trailing commas in attribute declarations.'
|
2353
2513
|
Enabled: true
|
2514
|
+
AutoCorrect: contextual
|
2354
2515
|
VersionAdded: '0.90'
|
2516
|
+
VersionChanged: '1.61'
|
2355
2517
|
|
2356
2518
|
Lint/TripleQuotes:
|
2357
2519
|
Description: 'Checks for useless triple quote constructs.'
|
@@ -2364,6 +2526,11 @@ Lint/UnderscorePrefixedVariableName:
|
|
2364
2526
|
VersionAdded: '0.21'
|
2365
2527
|
AllowKeywordBlockArguments: false
|
2366
2528
|
|
2529
|
+
Lint/UnescapedBracketInRegexp:
|
2530
|
+
Description: 'Checks for unescaped literal `]` in Regexp.'
|
2531
|
+
Enabled: pending
|
2532
|
+
VersionAdded: '1.68'
|
2533
|
+
|
2367
2534
|
Lint/UnexpectedBlockArity:
|
2368
2535
|
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2369
2536
|
Enabled: pending
|
@@ -2411,8 +2578,9 @@ Lint/UnusedBlockArgument:
|
|
2411
2578
|
Description: 'Checks for unused block arguments.'
|
2412
2579
|
StyleGuide: '#underscore-unused-vars'
|
2413
2580
|
Enabled: true
|
2581
|
+
AutoCorrect: contextual
|
2414
2582
|
VersionAdded: '0.21'
|
2415
|
-
VersionChanged: '
|
2583
|
+
VersionChanged: '1.61'
|
2416
2584
|
IgnoreEmptyBlocks: true
|
2417
2585
|
AllowUnusedKeywordArguments: false
|
2418
2586
|
|
@@ -2420,11 +2588,14 @@ Lint/UnusedMethodArgument:
|
|
2420
2588
|
Description: 'Checks for unused method arguments.'
|
2421
2589
|
StyleGuide: '#underscore-unused-vars'
|
2422
2590
|
Enabled: true
|
2591
|
+
AutoCorrect: contextual
|
2423
2592
|
VersionAdded: '0.21'
|
2424
|
-
VersionChanged: '
|
2593
|
+
VersionChanged: '1.69'
|
2425
2594
|
AllowUnusedKeywordArguments: false
|
2426
2595
|
IgnoreEmptyMethods: true
|
2427
2596
|
IgnoreNotImplementedMethods: true
|
2597
|
+
NotImplementedExceptions:
|
2598
|
+
- NotImplementedError
|
2428
2599
|
|
2429
2600
|
Lint/UriEscapeUnescape:
|
2430
2601
|
Description: >-
|
@@ -2445,8 +2616,9 @@ Lint/UriRegexp:
|
|
2445
2616
|
Lint/UselessAccessModifier:
|
2446
2617
|
Description: 'Checks for useless access modifiers.'
|
2447
2618
|
Enabled: true
|
2619
|
+
AutoCorrect: contextual
|
2448
2620
|
VersionAdded: '0.20'
|
2449
|
-
VersionChanged: '
|
2621
|
+
VersionChanged: '1.61'
|
2450
2622
|
ContextCreatingMethods: []
|
2451
2623
|
MethodCreatingMethods: []
|
2452
2624
|
|
@@ -2454,9 +2626,26 @@ Lint/UselessAssignment:
|
|
2454
2626
|
Description: 'Checks for useless assignment to a local variable.'
|
2455
2627
|
StyleGuide: '#underscore-unused-vars'
|
2456
2628
|
Enabled: true
|
2629
|
+
AutoCorrect: contextual
|
2457
2630
|
VersionAdded: '0.11'
|
2458
|
-
VersionChanged: '1.
|
2459
|
-
|
2631
|
+
VersionChanged: '1.66'
|
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'
|
2460
2649
|
|
2461
2650
|
Lint/UselessElseWithoutRescue:
|
2462
2651
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
@@ -2467,10 +2656,21 @@ Lint/UselessElseWithoutRescue:
|
|
2467
2656
|
Lint/UselessMethodDefinition:
|
2468
2657
|
Description: 'Checks for useless method definitions.'
|
2469
2658
|
Enabled: true
|
2659
|
+
AutoCorrect: contextual
|
2470
2660
|
VersionAdded: '0.90'
|
2471
|
-
VersionChanged: '
|
2661
|
+
VersionChanged: '1.61'
|
2472
2662
|
Safe: false
|
2473
2663
|
|
2664
|
+
Lint/UselessNumericOperation:
|
2665
|
+
Description: 'Checks for useless numeric operations.'
|
2666
|
+
Enabled: pending
|
2667
|
+
VersionAdded: '1.66'
|
2668
|
+
|
2669
|
+
Lint/UselessOr:
|
2670
|
+
Description: 'Checks for useless OR expressions.'
|
2671
|
+
Enabled: pending
|
2672
|
+
VersionAdded: '1.76'
|
2673
|
+
|
2474
2674
|
Lint/UselessRescue:
|
2475
2675
|
Description: 'Checks for useless `rescue`s.'
|
2476
2676
|
Enabled: pending
|
@@ -2491,13 +2691,17 @@ Lint/UselessSetterCall:
|
|
2491
2691
|
Lint/UselessTimes:
|
2492
2692
|
Description: 'Checks for useless `Integer#times` calls.'
|
2493
2693
|
Enabled: true
|
2494
|
-
VersionAdded: '0.91'
|
2495
2694
|
Safe: false
|
2695
|
+
AutoCorrect: contextual
|
2696
|
+
VersionAdded: '0.91'
|
2697
|
+
VersionChanged: '1.61'
|
2496
2698
|
|
2497
2699
|
Lint/Void:
|
2498
2700
|
Description: 'Possible use of operator/literal/variable in void context.'
|
2499
2701
|
Enabled: true
|
2702
|
+
AutoCorrect: contextual
|
2500
2703
|
VersionAdded: '0.9'
|
2704
|
+
VersionChanged: '1.61'
|
2501
2705
|
CheckForMethodsWithNoSideEffects: false
|
2502
2706
|
|
2503
2707
|
#################### Metrics ###############################
|
@@ -2506,8 +2710,8 @@ Metrics/AbcSize:
|
|
2506
2710
|
Description: >-
|
2507
2711
|
A calculated magnitude based on number of assignments,
|
2508
2712
|
branches, and conditions.
|
2509
|
-
|
2510
|
-
-
|
2713
|
+
References:
|
2714
|
+
- https://wiki.c2.com/?AbcMetric
|
2511
2715
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
2512
2716
|
Enabled: true
|
2513
2717
|
VersionAdded: '0.27'
|
@@ -2540,8 +2744,9 @@ Metrics/BlockNesting:
|
|
2540
2744
|
StyleGuide: '#three-is-the-number-thou-shalt-count'
|
2541
2745
|
Enabled: true
|
2542
2746
|
VersionAdded: '0.25'
|
2543
|
-
VersionChanged: '
|
2747
|
+
VersionChanged: '1.65'
|
2544
2748
|
CountBlocks: false
|
2749
|
+
CountModifierForms: false
|
2545
2750
|
Max: 3
|
2546
2751
|
|
2547
2752
|
Metrics/ClassLength:
|
@@ -2625,7 +2830,7 @@ Migration/DepartmentName:
|
|
2625
2830
|
#################### Naming ##############################
|
2626
2831
|
|
2627
2832
|
Naming/AccessorMethodName:
|
2628
|
-
Description:
|
2833
|
+
Description: Checks the naming of accessor methods for get_/set_.
|
2629
2834
|
StyleGuide: '#accessor_mutator_method_names'
|
2630
2835
|
Enabled: true
|
2631
2836
|
VersionAdded: '0.50'
|
@@ -2696,7 +2901,8 @@ Naming/FileName:
|
|
2696
2901
|
VersionChanged: '1.23'
|
2697
2902
|
# Camel case file names listed in `AllCops:Include` and all file names listed
|
2698
2903
|
# in `AllCops:Exclude` are excluded by default. Add extra excludes here.
|
2699
|
-
Exclude:
|
2904
|
+
Exclude:
|
2905
|
+
- Rakefile.rb
|
2700
2906
|
# When `true`, requires that each source file should define a class or module
|
2701
2907
|
# with a name which matches the file name (converted to ... case).
|
2702
2908
|
# It further expects it to be nested inside modules which match the names
|
@@ -2828,6 +3034,7 @@ Naming/MethodName:
|
|
2828
3034
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2829
3035
|
Enabled: true
|
2830
3036
|
VersionAdded: '0.50'
|
3037
|
+
VersionChanged: '1.75'
|
2831
3038
|
EnforcedStyle: snake_case
|
2832
3039
|
SupportedStyles:
|
2833
3040
|
- snake_case
|
@@ -2839,6 +3046,10 @@ Naming/MethodName:
|
|
2839
3046
|
# - '\A\s*onSelectionCleared\s*'
|
2840
3047
|
#
|
2841
3048
|
AllowedPatterns: []
|
3049
|
+
ForbiddenIdentifiers:
|
3050
|
+
- __id__
|
3051
|
+
- __send__
|
3052
|
+
ForbiddenPatterns: []
|
2842
3053
|
|
2843
3054
|
Naming/MethodParameterName:
|
2844
3055
|
Description: >-
|
@@ -2870,22 +3081,42 @@ Naming/MethodParameterName:
|
|
2870
3081
|
# Forbidden names that will register an offense
|
2871
3082
|
ForbiddenNames: []
|
2872
3083
|
|
2873
|
-
Naming/
|
2874
|
-
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 `?`.'
|
2875
3104
|
StyleGuide: '#bool-methods-qmark'
|
2876
3105
|
Enabled: true
|
2877
3106
|
VersionAdded: '0.50'
|
2878
|
-
VersionChanged: '
|
3107
|
+
VersionChanged: '1.75'
|
2879
3108
|
# Predicate name prefixes.
|
2880
3109
|
NamePrefix:
|
2881
3110
|
- is_
|
2882
3111
|
- has_
|
2883
3112
|
- have_
|
3113
|
+
- does_
|
2884
3114
|
# Predicate name prefixes that should be removed.
|
2885
3115
|
ForbiddenPrefixes:
|
2886
3116
|
- is_
|
2887
3117
|
- has_
|
2888
3118
|
- have_
|
3119
|
+
- does_
|
2889
3120
|
# Predicate names which, despite having a forbidden prefix, or no `?`,
|
2890
3121
|
# should still be accepted
|
2891
3122
|
AllowedMethods:
|
@@ -2894,6 +3125,8 @@ Naming/PredicateName:
|
|
2894
3125
|
MethodDefinitionMacros:
|
2895
3126
|
- define_method
|
2896
3127
|
- define_singleton_method
|
3128
|
+
# Use Sorbet's T::Boolean return type to detect predicate methods.
|
3129
|
+
UseSorbetSigs: false
|
2897
3130
|
# Exclude Rspec specs because there is a strong convention to write spec
|
2898
3131
|
# helpers in the form of `have_something` or `be_something`.
|
2899
3132
|
Exclude:
|
@@ -2911,13 +3144,15 @@ Naming/VariableName:
|
|
2911
3144
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2912
3145
|
Enabled: true
|
2913
3146
|
VersionAdded: '0.50'
|
2914
|
-
VersionChanged: '1.
|
3147
|
+
VersionChanged: '1.73'
|
2915
3148
|
EnforcedStyle: snake_case
|
2916
3149
|
SupportedStyles:
|
2917
3150
|
- snake_case
|
2918
3151
|
- camelCase
|
2919
3152
|
AllowedIdentifiers: []
|
2920
3153
|
AllowedPatterns: []
|
3154
|
+
ForbiddenIdentifiers: []
|
3155
|
+
ForbiddenPatterns: []
|
2921
3156
|
|
2922
3157
|
Naming/VariableNumber:
|
2923
3158
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -2933,6 +3168,8 @@ Naming/VariableNumber:
|
|
2933
3168
|
CheckMethodNames: true
|
2934
3169
|
CheckSymbols: true
|
2935
3170
|
AllowedIdentifiers:
|
3171
|
+
- TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
|
3172
|
+
- TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
|
2936
3173
|
- capture3 # Open3.capture3
|
2937
3174
|
- iso8601 # Time#iso8601
|
2938
3175
|
- rfc1123_date # CGI.rfc1123_date
|
@@ -2968,7 +3205,8 @@ Security/JSONLoad:
|
|
2968
3205
|
Description: >-
|
2969
3206
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2970
3207
|
security issues. See reference for more information.
|
2971
|
-
|
3208
|
+
References:
|
3209
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2972
3210
|
Enabled: true
|
2973
3211
|
VersionAdded: '0.43'
|
2974
3212
|
VersionChanged: '1.22'
|
@@ -2980,7 +3218,8 @@ Security/MarshalLoad:
|
|
2980
3218
|
Description: >-
|
2981
3219
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2982
3220
|
security issues. See reference for more information.
|
2983
|
-
|
3221
|
+
References:
|
3222
|
+
- 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2984
3223
|
Enabled: true
|
2985
3224
|
VersionAdded: '0.47'
|
2986
3225
|
|
@@ -2995,7 +3234,8 @@ Security/YAMLLoad:
|
|
2995
3234
|
Description: >-
|
2996
3235
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2997
3236
|
security issues. See reference for more information.
|
2998
|
-
|
3237
|
+
References:
|
3238
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2999
3239
|
Enabled: true
|
3000
3240
|
VersionAdded: '0.47'
|
3001
3241
|
SafeAutoCorrect: false
|
@@ -3006,12 +3246,14 @@ Style/AccessModifierDeclarations:
|
|
3006
3246
|
Description: 'Checks style of how access modifiers are used.'
|
3007
3247
|
Enabled: true
|
3008
3248
|
VersionAdded: '0.57'
|
3009
|
-
VersionChanged: '
|
3249
|
+
VersionChanged: '1.70'
|
3010
3250
|
EnforcedStyle: group
|
3011
3251
|
SupportedStyles:
|
3012
3252
|
- inline
|
3013
3253
|
- group
|
3014
3254
|
AllowModifiersOnSymbols: true
|
3255
|
+
AllowModifiersOnAttrs: true
|
3256
|
+
AllowModifiersOnAliasMethod: true
|
3015
3257
|
SafeAutoCorrect: false
|
3016
3258
|
|
3017
3259
|
Style/AccessorGrouping:
|
@@ -3036,6 +3278,12 @@ Style/Alias:
|
|
3036
3278
|
- prefer_alias
|
3037
3279
|
- prefer_alias_method
|
3038
3280
|
|
3281
|
+
Style/AmbiguousEndlessMethodDefinition:
|
3282
|
+
Description: 'Checks for endless methods inside operators of lower precedence.'
|
3283
|
+
StyleGuide: '#ambiguous-endless-method-defintions'
|
3284
|
+
Enabled: pending
|
3285
|
+
VersionAdded: '1.68'
|
3286
|
+
|
3039
3287
|
Style/AndOr:
|
3040
3288
|
Description: 'Use &&/|| instead of and/or.'
|
3041
3289
|
StyleGuide: '#no-and-or-or'
|
@@ -3055,7 +3303,20 @@ Style/ArgumentsForwarding:
|
|
3055
3303
|
StyleGuide: '#arguments-forwarding'
|
3056
3304
|
Enabled: pending
|
3057
3305
|
AllowOnlyRestArgument: true
|
3306
|
+
UseAnonymousForwarding: true
|
3307
|
+
RedundantRestArgumentNames:
|
3308
|
+
- args
|
3309
|
+
- arguments
|
3310
|
+
RedundantKeywordRestArgumentNames:
|
3311
|
+
- kwargs
|
3312
|
+
- options
|
3313
|
+
- opts
|
3314
|
+
RedundantBlockArgumentNames:
|
3315
|
+
- blk
|
3316
|
+
- block
|
3317
|
+
- proc
|
3058
3318
|
VersionAdded: '1.1'
|
3319
|
+
VersionChanged: '1.58'
|
3059
3320
|
|
3060
3321
|
Style/ArrayCoercion:
|
3061
3322
|
Description: >-
|
@@ -3066,6 +3327,14 @@ Style/ArrayCoercion:
|
|
3066
3327
|
Enabled: false
|
3067
3328
|
VersionAdded: '0.88'
|
3068
3329
|
|
3330
|
+
Style/ArrayFirstLast:
|
3331
|
+
Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
|
3332
|
+
References:
|
3333
|
+
- '#first-and-last'
|
3334
|
+
Enabled: false
|
3335
|
+
VersionAdded: '1.58'
|
3336
|
+
Safe: false
|
3337
|
+
|
3069
3338
|
Style/ArrayIntersect:
|
3070
3339
|
Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
|
3071
3340
|
Enabled: 'pending'
|
@@ -3123,6 +3392,13 @@ Style/BisectedAttrAccessor:
|
|
3123
3392
|
Enabled: true
|
3124
3393
|
VersionAdded: '0.87'
|
3125
3394
|
|
3395
|
+
Style/BitwisePredicate:
|
3396
|
+
Description: 'Prefer bitwise predicate methods over direct comparison operations.'
|
3397
|
+
StyleGuide: '#bitwise-predicate-methods'
|
3398
|
+
Enabled: pending
|
3399
|
+
Safe: false
|
3400
|
+
VersionAdded: '1.68'
|
3401
|
+
|
3126
3402
|
Style/BlockComments:
|
3127
3403
|
Description: 'Do not use block comments.'
|
3128
3404
|
StyleGuide: '#no-block-comments'
|
@@ -3293,6 +3569,7 @@ Style/ClassAndModuleChildren:
|
|
3293
3569
|
SafeAutoCorrect: false
|
3294
3570
|
Enabled: true
|
3295
3571
|
VersionAdded: '0.19'
|
3572
|
+
VersionChanged: '1.74'
|
3296
3573
|
#
|
3297
3574
|
# Basically there are two different styles:
|
3298
3575
|
#
|
@@ -3308,7 +3585,21 @@ Style/ClassAndModuleChildren:
|
|
3308
3585
|
#
|
3309
3586
|
# The compact style is only forced, for classes or modules with one child.
|
3310
3587
|
EnforcedStyle: nested
|
3311
|
-
SupportedStyles:
|
3588
|
+
SupportedStyles: &supported_styles
|
3589
|
+
- nested
|
3590
|
+
- compact
|
3591
|
+
# Configure classes separately, if desired. If not set, or set to `nil`,
|
3592
|
+
# the `EnforcedStyle` value will be used.
|
3593
|
+
EnforcedStyleForClasses: ~
|
3594
|
+
SupportedStylesForClasses:
|
3595
|
+
- ~
|
3596
|
+
- nested
|
3597
|
+
- compact
|
3598
|
+
# Configure modules separately, if desired. If not set, or set to `nil`,
|
3599
|
+
# the `EnforcedStyle` value will be used.
|
3600
|
+
EnforcedStyleForModules: ~
|
3601
|
+
SupportedStylesForModules:
|
3602
|
+
- ~
|
3312
3603
|
- nested
|
3313
3604
|
- compact
|
3314
3605
|
|
@@ -3326,7 +3617,9 @@ Style/ClassEqualityComparison:
|
|
3326
3617
|
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
3327
3618
|
StyleGuide: '#instance-of-vs-class-comparison'
|
3328
3619
|
Enabled: true
|
3620
|
+
SafeAutoCorrect: false
|
3329
3621
|
VersionAdded: '0.93'
|
3622
|
+
VersionChanged: '1.57'
|
3330
3623
|
AllowedMethods:
|
3331
3624
|
- ==
|
3332
3625
|
- equal?
|
@@ -3381,6 +3674,7 @@ Style/CollectionMethods:
|
|
3381
3674
|
PreferredMethods:
|
3382
3675
|
collect: 'map'
|
3383
3676
|
collect!: 'map!'
|
3677
|
+
collect_concat: 'flat_map'
|
3384
3678
|
inject: 'reduce'
|
3385
3679
|
detect: 'find'
|
3386
3680
|
find_all: 'select'
|
@@ -3391,6 +3685,13 @@ Style/CollectionMethods:
|
|
3391
3685
|
- inject
|
3392
3686
|
- reduce
|
3393
3687
|
|
3688
|
+
Style/CollectionQuerying:
|
3689
|
+
Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
|
3690
|
+
StyleGuide: '#collection-querying'
|
3691
|
+
Enabled: pending
|
3692
|
+
VersionAdded: '1.77'
|
3693
|
+
Safe: false
|
3694
|
+
|
3394
3695
|
Style/ColonMethodCall:
|
3395
3696
|
Description: 'Do not use :: for method call.'
|
3396
3697
|
StyleGuide: '#double-colons'
|
@@ -3403,6 +3704,11 @@ Style/ColonMethodDefinition:
|
|
3403
3704
|
Enabled: true
|
3404
3705
|
VersionAdded: '0.52'
|
3405
3706
|
|
3707
|
+
Style/CombinableDefined:
|
3708
|
+
Description: 'Checks successive `defined?` calls that can be combined into a single call.'
|
3709
|
+
Enabled: pending
|
3710
|
+
VersionAdded: '1.68'
|
3711
|
+
|
3406
3712
|
Style/CombinableLoops:
|
3407
3713
|
Description: >-
|
3408
3714
|
Checks for places where multiple consecutive loops over the same data
|
@@ -3453,6 +3759,14 @@ Style/CommentedKeyword:
|
|
3453
3759
|
VersionAdded: '0.51'
|
3454
3760
|
VersionChanged: '1.19'
|
3455
3761
|
|
3762
|
+
Style/ComparableBetween:
|
3763
|
+
Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
|
3764
|
+
Enabled: pending
|
3765
|
+
Safe: false
|
3766
|
+
VersionAdded: '1.74'
|
3767
|
+
VersionChanged: '1.75'
|
3768
|
+
StyleGuide: '#ranges-or-between'
|
3769
|
+
|
3456
3770
|
Style/ComparableClamp:
|
3457
3771
|
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
3458
3772
|
Enabled: pending
|
@@ -3543,6 +3857,12 @@ Style/DefWithParentheses:
|
|
3543
3857
|
VersionAdded: '0.9'
|
3544
3858
|
VersionChanged: '0.12'
|
3545
3859
|
|
3860
|
+
Style/DigChain:
|
3861
|
+
Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
|
3862
|
+
Enabled: pending
|
3863
|
+
Safe: false
|
3864
|
+
VersionAdded: '1.69'
|
3865
|
+
|
3546
3866
|
Style/Dir:
|
3547
3867
|
Description: >-
|
3548
3868
|
Use the `__dir__` method to retrieve the canonicalized
|
@@ -3586,6 +3906,7 @@ Style/DocumentationMethod:
|
|
3586
3906
|
Description: 'Checks for missing documentation comment for public methods.'
|
3587
3907
|
Enabled: false
|
3588
3908
|
VersionAdded: '0.43'
|
3909
|
+
AllowedMethods: []
|
3589
3910
|
Exclude:
|
3590
3911
|
- 'spec/**/*'
|
3591
3912
|
- 'test/**/*'
|
@@ -3634,8 +3955,9 @@ Style/EmptyCaseCondition:
|
|
3634
3955
|
Style/EmptyElse:
|
3635
3956
|
Description: 'Avoid empty else-clauses.'
|
3636
3957
|
Enabled: true
|
3958
|
+
AutoCorrect: contextual
|
3637
3959
|
VersionAdded: '0.28'
|
3638
|
-
VersionChanged: '
|
3960
|
+
VersionChanged: '1.61'
|
3639
3961
|
EnforcedStyle: both
|
3640
3962
|
# empty - warn only on empty `else`
|
3641
3963
|
# nil - warn on `else` with nil in it
|
@@ -3649,7 +3971,9 @@ Style/EmptyElse:
|
|
3649
3971
|
Style/EmptyHeredoc:
|
3650
3972
|
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
3651
3973
|
Enabled: pending
|
3974
|
+
AutoCorrect: contextual
|
3652
3975
|
VersionAdded: '1.32'
|
3976
|
+
VersionChanged: '1.61'
|
3653
3977
|
|
3654
3978
|
Style/EmptyLambdaParameter:
|
3655
3979
|
Description: 'Omit parens for empty lambda parameters.'
|
@@ -3667,12 +3991,24 @@ Style/EmptyMethod:
|
|
3667
3991
|
Description: 'Checks the formatting of empty method definitions.'
|
3668
3992
|
StyleGuide: '#no-single-line-methods'
|
3669
3993
|
Enabled: true
|
3994
|
+
AutoCorrect: contextual
|
3670
3995
|
VersionAdded: '0.46'
|
3996
|
+
VersionChanged: '1.61'
|
3671
3997
|
EnforcedStyle: compact
|
3672
3998
|
SupportedStyles:
|
3673
3999
|
- compact
|
3674
4000
|
- expanded
|
3675
4001
|
|
4002
|
+
Style/EmptyStringInsideInterpolation:
|
4003
|
+
Description: 'Checks for empty strings being assigned inside string interpolation.'
|
4004
|
+
StyleGuide: '#empty-strings-in-interpolation'
|
4005
|
+
Enabled: pending
|
4006
|
+
EnforcedStyle: trailing_conditional
|
4007
|
+
SupportedStyles:
|
4008
|
+
- trailing_conditional
|
4009
|
+
- ternary
|
4010
|
+
VersionAdded: '1.76'
|
4011
|
+
|
3676
4012
|
Style/Encoding:
|
3677
4013
|
Description: 'Use UTF-8 as the source file encoding.'
|
3678
4014
|
StyleGuide: '#utf-8'
|
@@ -3697,6 +4033,8 @@ Style/EndlessMethod:
|
|
3697
4033
|
- allow_single_line
|
3698
4034
|
- allow_always
|
3699
4035
|
- disallow
|
4036
|
+
- require_single_line
|
4037
|
+
- require_always
|
3700
4038
|
|
3701
4039
|
Style/EnvHome:
|
3702
4040
|
Description: "Checks for consistent usage of `ENV['HOME']`."
|
@@ -3749,12 +4087,15 @@ Style/ExponentialNotation:
|
|
3749
4087
|
Style/FetchEnvVar:
|
3750
4088
|
Description: >-
|
3751
4089
|
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
3752
|
-
|
4090
|
+
References:
|
3753
4091
|
- https://rubystyle.guide/#hash-fetch-defaults
|
3754
4092
|
Enabled: pending
|
3755
4093
|
VersionAdded: '1.28'
|
3756
4094
|
# Environment variables to be excluded from the inspection.
|
3757
4095
|
AllowedVars: []
|
4096
|
+
# When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
|
4097
|
+
# When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
|
4098
|
+
DefaultToNil: true
|
3758
4099
|
|
3759
4100
|
Style/FileEmpty:
|
3760
4101
|
Description: >-
|
@@ -3763,12 +4104,24 @@ Style/FileEmpty:
|
|
3763
4104
|
Safe: false
|
3764
4105
|
VersionAdded: '1.48'
|
3765
4106
|
|
4107
|
+
Style/FileNull:
|
4108
|
+
Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
|
4109
|
+
Enabled: pending
|
4110
|
+
SafeAutoCorrect: false
|
4111
|
+
VersionAdded: '1.69'
|
4112
|
+
|
3766
4113
|
Style/FileRead:
|
3767
4114
|
Description: 'Favor `File.(bin)read` convenience methods.'
|
3768
4115
|
StyleGuide: '#file-read'
|
3769
4116
|
Enabled: pending
|
3770
4117
|
VersionAdded: '1.24'
|
3771
4118
|
|
4119
|
+
Style/FileTouch:
|
4120
|
+
Description: 'Favor `FileUtils.touch` for touching files.'
|
4121
|
+
Enabled: pending
|
4122
|
+
VersionAdded: '1.69'
|
4123
|
+
SafeAutoCorrect: false
|
4124
|
+
|
3772
4125
|
Style/FileWrite:
|
3773
4126
|
Description: 'Favor `File.(bin)write` convenience methods.'
|
3774
4127
|
StyleGuide: '#file-write'
|
@@ -3778,7 +4131,8 @@ Style/FileWrite:
|
|
3778
4131
|
Style/FloatDivision:
|
3779
4132
|
Description: 'For performing float division, coerce one side only.'
|
3780
4133
|
StyleGuide: '#float-division'
|
3781
|
-
|
4134
|
+
References:
|
4135
|
+
- 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3782
4136
|
Enabled: true
|
3783
4137
|
VersionAdded: '0.72'
|
3784
4138
|
VersionChanged: '1.9'
|
@@ -3829,8 +4183,14 @@ Style/FormatStringToken:
|
|
3829
4183
|
# style token in a format string to be allowed when enforced style is not
|
3830
4184
|
# `unannotated`.
|
3831
4185
|
MaxUnannotatedPlaceholdersAllowed: 1
|
4186
|
+
# The mode the cop operates in. Two values are allowed:
|
4187
|
+
# * aggressive (default): all strings are considered
|
4188
|
+
# * conservative:
|
4189
|
+
# only register offenses for strings given to `printf`, `sprintf`,
|
4190
|
+
# format` and `%` methods. Other strings are not considered.
|
4191
|
+
Mode: aggressive
|
3832
4192
|
VersionAdded: '0.49'
|
3833
|
-
VersionChanged: '1.
|
4193
|
+
VersionChanged: '1.74'
|
3834
4194
|
AllowedMethods: []
|
3835
4195
|
AllowedPatterns: []
|
3836
4196
|
|
@@ -3855,6 +4215,9 @@ Style/FrozenStringLiteralComment:
|
|
3855
4215
|
# exist in a file.
|
3856
4216
|
- never
|
3857
4217
|
SafeAutoCorrect: false
|
4218
|
+
Exclude:
|
4219
|
+
# Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
|
4220
|
+
- '**/*.arb'
|
3858
4221
|
|
3859
4222
|
Style/GlobalStdStream:
|
3860
4223
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
@@ -3866,14 +4229,15 @@ Style/GlobalStdStream:
|
|
3866
4229
|
Style/GlobalVars:
|
3867
4230
|
Description: 'Do not introduce global variables.'
|
3868
4231
|
StyleGuide: '#instance-vars'
|
3869
|
-
|
4232
|
+
References:
|
4233
|
+
- 'https://www.zenspider.com/ruby/quickref.html'
|
3870
4234
|
Enabled: true
|
3871
4235
|
VersionAdded: '0.13'
|
3872
4236
|
# Built-in global variables are allowed by default.
|
3873
4237
|
AllowedVariables: []
|
3874
4238
|
|
3875
4239
|
Style/GuardClause:
|
3876
|
-
Description: '
|
4240
|
+
Description: 'Checks for conditionals that can be replaced with guard clauses.'
|
3877
4241
|
StyleGuide: '#no-nested-conditionals'
|
3878
4242
|
Enabled: true
|
3879
4243
|
VersionAdded: '0.20'
|
@@ -3899,8 +4263,9 @@ Style/HashConversion:
|
|
3899
4263
|
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3900
4264
|
StyleGuide: '#avoid-hash-constructor'
|
3901
4265
|
Enabled: pending
|
4266
|
+
SafeAutoCorrect: false
|
3902
4267
|
VersionAdded: '1.10'
|
3903
|
-
VersionChanged: '1.
|
4268
|
+
VersionChanged: '1.55'
|
3904
4269
|
AllowSplatArgument: true
|
3905
4270
|
|
3906
4271
|
Style/HashEachMethods:
|
@@ -3922,6 +4287,12 @@ Style/HashExcept:
|
|
3922
4287
|
VersionAdded: '1.7'
|
3923
4288
|
VersionChanged: '1.39'
|
3924
4289
|
|
4290
|
+
Style/HashFetchChain:
|
4291
|
+
Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
|
4292
|
+
Enabled: pending
|
4293
|
+
Safe: false
|
4294
|
+
VersionAdded: '1.75'
|
4295
|
+
|
3925
4296
|
Style/HashLikeCase:
|
3926
4297
|
Description: >-
|
3927
4298
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -3932,6 +4303,14 @@ Style/HashLikeCase:
|
|
3932
4303
|
# to trigger this cop
|
3933
4304
|
MinBranchesCount: 3
|
3934
4305
|
|
4306
|
+
Style/HashSlice:
|
4307
|
+
Description: >-
|
4308
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
4309
|
+
that can be replaced with `Hash#slice` method.
|
4310
|
+
Enabled: pending
|
4311
|
+
Safe: false
|
4312
|
+
VersionAdded: '1.71'
|
4313
|
+
|
3935
4314
|
Style/HashSyntax:
|
3936
4315
|
Description: >-
|
3937
4316
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -3939,7 +4318,7 @@ Style/HashSyntax:
|
|
3939
4318
|
StyleGuide: '#hash-literals'
|
3940
4319
|
Enabled: true
|
3941
4320
|
VersionAdded: '0.9'
|
3942
|
-
VersionChanged: '1.
|
4321
|
+
VersionChanged: '1.67'
|
3943
4322
|
EnforcedStyle: ruby19
|
3944
4323
|
SupportedStyles:
|
3945
4324
|
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
@@ -3951,7 +4330,7 @@ Style/HashSyntax:
|
|
3951
4330
|
# enforces both ruby19 and no_mixed_keys styles
|
3952
4331
|
- ruby19_no_mixed_keys
|
3953
4332
|
# Force hashes that have a hash value omission
|
3954
|
-
EnforcedShorthandSyntax:
|
4333
|
+
EnforcedShorthandSyntax: either
|
3955
4334
|
SupportedShorthandSyntax:
|
3956
4335
|
# forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
|
3957
4336
|
- always
|
@@ -3961,6 +4340,8 @@ Style/HashSyntax:
|
|
3961
4340
|
- either
|
3962
4341
|
# forces use of the 3.1 syntax only if all values can be omitted in the hash.
|
3963
4342
|
- consistent
|
4343
|
+
# allow either (implicit or explicit) syntax but enforce consistency within a single hash
|
4344
|
+
- either_consistent
|
3964
4345
|
# Force hashes that have a symbol value to use hash rockets
|
3965
4346
|
UseHashRocketsWithSymbolValues: false
|
3966
4347
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
@@ -4101,12 +4482,6 @@ Style/InvertibleUnlessCondition:
|
|
4101
4482
|
:none?: :any?
|
4102
4483
|
:even?: :odd?
|
4103
4484
|
:odd?: :even?
|
4104
|
-
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
4105
|
-
# and not enabled by default.
|
4106
|
-
# :present?: :blank?
|
4107
|
-
# :blank?: :present?
|
4108
|
-
# :include?: :exclude?
|
4109
|
-
# :exclude?: :include?
|
4110
4485
|
|
4111
4486
|
Style/IpAddresses:
|
4112
4487
|
Description: "Don't include literal IP addresses in code."
|
@@ -4123,6 +4498,31 @@ Style/IpAddresses:
|
|
4123
4498
|
- '**/gems.rb'
|
4124
4499
|
- '**/*.gemspec'
|
4125
4500
|
|
4501
|
+
Style/ItAssignment:
|
4502
|
+
Description: 'Checks for local variables and method parameters named `it`.'
|
4503
|
+
Enabled: pending
|
4504
|
+
VersionAdded: '1.70'
|
4505
|
+
|
4506
|
+
Style/ItBlockParameter:
|
4507
|
+
Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
|
4508
|
+
Enabled: pending
|
4509
|
+
EnforcedStyle: allow_single_line
|
4510
|
+
SupportedStyles:
|
4511
|
+
- allow_single_line
|
4512
|
+
- only_numbered_parameters
|
4513
|
+
- always
|
4514
|
+
- disallow
|
4515
|
+
VersionAdded: '1.75'
|
4516
|
+
VersionChanged: '1.76'
|
4517
|
+
|
4518
|
+
Style/KeywordArgumentsMerging:
|
4519
|
+
Description: >-
|
4520
|
+
When passing an existing hash as keyword arguments, provide additional arguments
|
4521
|
+
directly rather than using `merge`.
|
4522
|
+
StyleGuide: '#merging-keyword-arguments'
|
4523
|
+
Enabled: pending
|
4524
|
+
VersionAdded: '1.68'
|
4525
|
+
|
4126
4526
|
Style/KeywordParametersOrder:
|
4127
4527
|
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
4128
4528
|
StyleGuide: '#keyword-parameters-order'
|
@@ -4187,6 +4587,14 @@ Style/MapCompactWithConditionalBlock:
|
|
4187
4587
|
Enabled: pending
|
4188
4588
|
VersionAdded: '1.30'
|
4189
4589
|
|
4590
|
+
Style/MapIntoArray:
|
4591
|
+
Description: 'Checks for usages of `each` with `<<`, `push`, or `append` which can be replaced by `map`.'
|
4592
|
+
StyleGuide: '#functional-code'
|
4593
|
+
Enabled: pending
|
4594
|
+
VersionAdded: '1.63'
|
4595
|
+
VersionChanged: '1.67'
|
4596
|
+
Safe: false
|
4597
|
+
|
4190
4598
|
Style/MapToHash:
|
4191
4599
|
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
4192
4600
|
Enabled: pending
|
@@ -4495,7 +4903,7 @@ Style/Next:
|
|
4495
4903
|
StyleGuide: '#no-nested-conditionals'
|
4496
4904
|
Enabled: true
|
4497
4905
|
VersionAdded: '0.22'
|
4498
|
-
VersionChanged: '
|
4906
|
+
VersionChanged: '1.75'
|
4499
4907
|
# With `always` all conditions at the end of an iteration needs to be
|
4500
4908
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
4501
4909
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
@@ -4503,6 +4911,7 @@ Style/Next:
|
|
4503
4911
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
4504
4912
|
# needs to have to trigger this cop
|
4505
4913
|
MinBodyLength: 3
|
4914
|
+
AllowConsecutiveConditionals: false
|
4506
4915
|
SupportedStyles:
|
4507
4916
|
- skip_modifier_ifs
|
4508
4917
|
- always
|
@@ -4634,8 +5043,8 @@ Style/OpenStructUse:
|
|
4634
5043
|
Description: >-
|
4635
5044
|
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
4636
5045
|
version compatibility, and potential security issues.
|
4637
|
-
|
4638
|
-
- https://docs.ruby-lang.org/en/3.0
|
5046
|
+
References:
|
5047
|
+
- https://docs.ruby-lang.org/en/3.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4639
5048
|
|
4640
5049
|
Enabled: pending
|
4641
5050
|
Safe: false
|
@@ -4650,6 +5059,7 @@ Style/OperatorMethodCall:
|
|
4650
5059
|
|
4651
5060
|
Style/OptionHash:
|
4652
5061
|
Description: "Don't use option hashes when you can use keyword arguments."
|
5062
|
+
StyleGuide: '#keyword-arguments-vs-option-hashes'
|
4653
5063
|
Enabled: false
|
4654
5064
|
VersionAdded: '0.33'
|
4655
5065
|
VersionChanged: '0.34'
|
@@ -4772,8 +5182,9 @@ Style/RaiseArgs:
|
|
4772
5182
|
Description: 'Checks the arguments passed to raise/fail.'
|
4773
5183
|
StyleGuide: '#exception-class-messages'
|
4774
5184
|
Enabled: true
|
5185
|
+
Safe: false
|
4775
5186
|
VersionAdded: '0.14'
|
4776
|
-
VersionChanged: '1.
|
5187
|
+
VersionChanged: '1.61'
|
4777
5188
|
EnforcedStyle: exploded
|
4778
5189
|
SupportedStyles:
|
4779
5190
|
- compact # raise Exception.new(msg)
|
@@ -4789,16 +5200,20 @@ Style/RandomWithOffset:
|
|
4789
5200
|
VersionAdded: '0.52'
|
4790
5201
|
|
4791
5202
|
Style/RedundantArgument:
|
4792
|
-
Description: '
|
5203
|
+
Description: 'Checks for a redundant argument passed to certain methods.'
|
4793
5204
|
Enabled: pending
|
4794
5205
|
Safe: false
|
4795
5206
|
VersionAdded: '1.4'
|
4796
|
-
VersionChanged: '1.
|
5207
|
+
VersionChanged: '1.55'
|
4797
5208
|
Methods:
|
4798
5209
|
# Array#join
|
4799
5210
|
join: ''
|
4800
5211
|
# Array#sum
|
4801
5212
|
sum: 0
|
5213
|
+
# Kernel.#exit
|
5214
|
+
exit: true
|
5215
|
+
# Kernel.#exit!
|
5216
|
+
exit!: false
|
4802
5217
|
# String#split
|
4803
5218
|
split: ' '
|
4804
5219
|
# String#chomp
|
@@ -4811,6 +5226,12 @@ Style/RedundantArrayConstructor:
|
|
4811
5226
|
Enabled: pending
|
4812
5227
|
VersionAdded: '1.52'
|
4813
5228
|
|
5229
|
+
Style/RedundantArrayFlatten:
|
5230
|
+
Description: 'Checks for redundant calls of `Array#flatten`.'
|
5231
|
+
Enabled: pending
|
5232
|
+
Safe: false
|
5233
|
+
VersionAdded: '1.76'
|
5234
|
+
|
4814
5235
|
Style/RedundantAssignment:
|
4815
5236
|
Description: 'Checks for redundant assignment before returning.'
|
4816
5237
|
Enabled: true
|
@@ -4832,6 +5253,9 @@ Style/RedundantCondition:
|
|
4832
5253
|
Description: 'Checks for unnecessary conditional expressions.'
|
4833
5254
|
Enabled: true
|
4834
5255
|
VersionAdded: '0.76'
|
5256
|
+
VersionChanged: '1.73'
|
5257
|
+
AllowedMethods:
|
5258
|
+
- nonzero?
|
4835
5259
|
|
4836
5260
|
Style/RedundantConditional:
|
4837
5261
|
Description: "Don't return true/false from a conditional."
|
@@ -4843,6 +5267,11 @@ Style/RedundantConstantBase:
|
|
4843
5267
|
Enabled: pending
|
4844
5268
|
VersionAdded: '1.40'
|
4845
5269
|
|
5270
|
+
Style/RedundantCurrentDirectoryInPath:
|
5271
|
+
Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
|
5272
|
+
Enabled: pending
|
5273
|
+
VersionAdded: '1.53'
|
5274
|
+
|
4846
5275
|
Style/RedundantDoubleSplatHashBraces:
|
4847
5276
|
Description: 'Checks for redundant uses of double splat hash braces.'
|
4848
5277
|
Enabled: pending
|
@@ -4865,7 +5294,8 @@ Style/RedundantFetchBlock:
|
|
4865
5294
|
Description: >-
|
4866
5295
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
4867
5296
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
4868
|
-
|
5297
|
+
References:
|
5298
|
+
- 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
4869
5299
|
Enabled: true
|
4870
5300
|
Safe: false
|
4871
5301
|
# If enabled, this cop will autocorrect usages of
|
@@ -4887,7 +5317,16 @@ Style/RedundantFilterChain:
|
|
4887
5317
|
Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
|
4888
5318
|
`select`/`filter`/`find_all` and change them to use predicate method instead.
|
4889
5319
|
Enabled: pending
|
5320
|
+
SafeAutoCorrect: false
|
4890
5321
|
VersionAdded: '1.52'
|
5322
|
+
VersionChanged: '1.57'
|
5323
|
+
|
5324
|
+
Style/RedundantFormat:
|
5325
|
+
Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
|
5326
|
+
Enabled: pending
|
5327
|
+
SafeAutoCorrect: false
|
5328
|
+
VersionAdded: '1.72'
|
5329
|
+
VersionChanged: '1.72'
|
4891
5330
|
|
4892
5331
|
Style/RedundantFreeze:
|
4893
5332
|
Description: "Checks usages of Object#freeze on immutable objects."
|
@@ -4903,10 +5342,11 @@ Style/RedundantHeredocDelimiterQuotes:
|
|
4903
5342
|
Style/RedundantInitialize:
|
4904
5343
|
Description: 'Checks for redundant `initialize` methods.'
|
4905
5344
|
Enabled: pending
|
5345
|
+
AutoCorrect: contextual
|
4906
5346
|
Safe: false
|
4907
5347
|
AllowComments: true
|
4908
5348
|
VersionAdded: '1.27'
|
4909
|
-
VersionChanged: '1.
|
5349
|
+
VersionChanged: '1.61'
|
4910
5350
|
|
4911
5351
|
Style/RedundantInterpolation:
|
4912
5352
|
Description: 'Checks for strings that are just an interpolated expression.'
|
@@ -4915,8 +5355,13 @@ Style/RedundantInterpolation:
|
|
4915
5355
|
VersionAdded: '0.76'
|
4916
5356
|
VersionChanged: '1.30'
|
4917
5357
|
|
5358
|
+
Style/RedundantInterpolationUnfreeze:
|
5359
|
+
Description: 'Checks for redundant unfreezing of interpolated strings.'
|
5360
|
+
Enabled: pending
|
5361
|
+
VersionAdded: '1.66'
|
5362
|
+
|
4918
5363
|
Style/RedundantLineContinuation:
|
4919
|
-
Description: '
|
5364
|
+
Description: 'Checks for redundant line continuation.'
|
4920
5365
|
Enabled: pending
|
4921
5366
|
VersionAdded: '1.49'
|
4922
5367
|
|
@@ -4931,6 +5376,11 @@ Style/RedundantPercentQ:
|
|
4931
5376
|
Enabled: true
|
4932
5377
|
VersionAdded: '0.76'
|
4933
5378
|
|
5379
|
+
Style/RedundantRegexpArgument:
|
5380
|
+
Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
|
5381
|
+
Enabled: pending
|
5382
|
+
VersionAdded: '1.53'
|
5383
|
+
|
4934
5384
|
Style/RedundantRegexpCharacterClass:
|
4935
5385
|
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
4936
5386
|
Enabled: true
|
@@ -5043,6 +5493,16 @@ Style/ReturnNil:
|
|
5043
5493
|
- return_nil
|
5044
5494
|
VersionAdded: '0.50'
|
5045
5495
|
|
5496
|
+
Style/ReturnNilInPredicateMethodDefinition:
|
5497
|
+
Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
|
5498
|
+
StyleGuide: '#bool-methods-qmark'
|
5499
|
+
Enabled: pending
|
5500
|
+
SafeAutoCorrect: false
|
5501
|
+
AllowedMethods: []
|
5502
|
+
AllowedPatterns: []
|
5503
|
+
VersionAdded: '1.53'
|
5504
|
+
VersionChanged: '1.67'
|
5505
|
+
|
5046
5506
|
Style/SafeNavigation:
|
5047
5507
|
Description: >-
|
5048
5508
|
Transforms usages of a method call safeguarded by
|
@@ -5052,7 +5512,7 @@ Style/SafeNavigation:
|
|
5052
5512
|
be `nil` or truthy, but never `false`.
|
5053
5513
|
Enabled: true
|
5054
5514
|
VersionAdded: '0.43'
|
5055
|
-
VersionChanged: '1.
|
5515
|
+
VersionChanged: '1.67'
|
5056
5516
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
5057
5517
|
# to whatever it used to return.
|
5058
5518
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -5066,11 +5526,19 @@ Style/SafeNavigation:
|
|
5066
5526
|
# Maximum length of method chains for register an offense.
|
5067
5527
|
MaxChainLength: 2
|
5068
5528
|
|
5529
|
+
Style/SafeNavigationChainLength:
|
5530
|
+
Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
|
5531
|
+
StyleGuide: '#safe-navigation'
|
5532
|
+
Enabled: pending
|
5533
|
+
VersionAdded: '1.68'
|
5534
|
+
Max: 2
|
5535
|
+
|
5069
5536
|
Style/Sample:
|
5070
5537
|
Description: >-
|
5071
5538
|
Use `sample` instead of `shuffle.first`,
|
5072
5539
|
`shuffle.last`, and `shuffle[Integer]`.
|
5073
|
-
|
5540
|
+
References:
|
5541
|
+
- 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
5074
5542
|
Enabled: true
|
5075
5543
|
VersionAdded: '0.30'
|
5076
5544
|
|
@@ -5104,6 +5572,13 @@ Style/Send:
|
|
5104
5572
|
Enabled: false
|
5105
5573
|
VersionAdded: '0.33'
|
5106
5574
|
|
5575
|
+
Style/SendWithLiteralMethodName:
|
5576
|
+
Description: 'Detects the use of the `public_send` method with a static method name argument.'
|
5577
|
+
Enabled: pending
|
5578
|
+
Safe: false
|
5579
|
+
AllowSend: true
|
5580
|
+
VersionAdded: '1.64'
|
5581
|
+
|
5107
5582
|
Style/SignalException:
|
5108
5583
|
Description: 'Checks for proper usage of fail and raise.'
|
5109
5584
|
StyleGuide: '#prefer-raise-over-fail'
|
@@ -5135,6 +5610,12 @@ Style/SingleLineBlockParams:
|
|
5135
5610
|
- acc
|
5136
5611
|
- elem
|
5137
5612
|
|
5613
|
+
Style/SingleLineDoEndBlock:
|
5614
|
+
Description: 'Checks for single-line `do`...`end` blocks.'
|
5615
|
+
StyleGuide: '#single-line-do-end-block'
|
5616
|
+
Enabled: pending
|
5617
|
+
VersionAdded: '1.57'
|
5618
|
+
|
5138
5619
|
Style/SingleLineMethods:
|
5139
5620
|
Description: 'Avoid single-line methods.'
|
5140
5621
|
StyleGuide: '#no-single-line-methods'
|
@@ -5144,7 +5625,8 @@ Style/SingleLineMethods:
|
|
5144
5625
|
AllowIfMethodIsEmpty: true
|
5145
5626
|
|
5146
5627
|
Style/SlicingWithRange:
|
5147
|
-
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
5628
|
+
Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
|
5629
|
+
StyleGuide: '#slicing-with-ranges'
|
5148
5630
|
Enabled: true
|
5149
5631
|
VersionAdded: '0.83'
|
5150
5632
|
Safe: false
|
@@ -5173,7 +5655,7 @@ Style/SpecialGlobalVars:
|
|
5173
5655
|
- use_builtin_english_names
|
5174
5656
|
|
5175
5657
|
Style/StabbyLambdaParentheses:
|
5176
|
-
Description: '
|
5658
|
+
Description: 'Checks for the usage of parentheses around stabby lambda arguments.'
|
5177
5659
|
StyleGuide: '#stabby-lambda-with-args'
|
5178
5660
|
Enabled: true
|
5179
5661
|
VersionAdded: '0.35'
|
@@ -5271,6 +5753,17 @@ Style/StructInheritance:
|
|
5271
5753
|
VersionAdded: '0.29'
|
5272
5754
|
VersionChanged: '1.20'
|
5273
5755
|
|
5756
|
+
Style/SuperArguments:
|
5757
|
+
Description: 'Call `super` without arguments and parentheses when the signature is identical.'
|
5758
|
+
Enabled: pending
|
5759
|
+
VersionAdded: '1.64'
|
5760
|
+
|
5761
|
+
Style/SuperWithArgsParentheses:
|
5762
|
+
Description: 'Use parentheses for `super` with arguments.'
|
5763
|
+
StyleGuide: '#super-with-args'
|
5764
|
+
Enabled: pending
|
5765
|
+
VersionAdded: '1.58'
|
5766
|
+
|
5274
5767
|
Style/SwapValues:
|
5275
5768
|
Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
|
5276
5769
|
StyleGuide: '#values-swapping'
|
@@ -5300,7 +5793,7 @@ Style/SymbolProc:
|
|
5300
5793
|
Enabled: true
|
5301
5794
|
Safe: false
|
5302
5795
|
VersionAdded: '0.26'
|
5303
|
-
VersionChanged: '1.
|
5796
|
+
VersionChanged: '1.64'
|
5304
5797
|
AllowMethodsWithArguments: false
|
5305
5798
|
# A list of method names to be always allowed by the check.
|
5306
5799
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
@@ -5362,14 +5855,17 @@ Style/TrailingCommaInArrayLiteral:
|
|
5362
5855
|
StyleGuide: '#no-trailing-array-commas'
|
5363
5856
|
Enabled: true
|
5364
5857
|
VersionAdded: '0.53'
|
5365
|
-
# If `comma`, the cop requires a comma after the last item in an array,
|
5366
|
-
#
|
5367
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5368
|
-
#
|
5858
|
+
# If `comma`, the cop requires a comma after the last item in an array, but only when each item is
|
5859
|
+
# on its own line.
|
5860
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5861
|
+
# array literals.
|
5862
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
|
5863
|
+
# literals, but only when that last item immediately precedes a newline.
|
5369
5864
|
EnforcedStyleForMultiline: no_comma
|
5370
5865
|
SupportedStylesForMultiline:
|
5371
5866
|
- comma
|
5372
5867
|
- consistent_comma
|
5868
|
+
- diff_comma
|
5373
5869
|
- no_comma
|
5374
5870
|
|
5375
5871
|
Style/TrailingCommaInBlockArgs:
|
@@ -5381,14 +5877,17 @@ Style/TrailingCommaInBlockArgs:
|
|
5381
5877
|
Style/TrailingCommaInHashLiteral:
|
5382
5878
|
Description: 'Checks for trailing comma in hash literals.'
|
5383
5879
|
Enabled: true
|
5384
|
-
# If `comma`, the cop requires a comma after the last item in a hash,
|
5385
|
-
#
|
5386
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5387
|
-
#
|
5880
|
+
# If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
|
5881
|
+
# on its own line.
|
5882
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5883
|
+
# hash literals.
|
5884
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
|
5885
|
+
# literals, but only when that last item immediately precedes a newline.
|
5388
5886
|
EnforcedStyleForMultiline: no_comma
|
5389
5887
|
SupportedStylesForMultiline:
|
5390
5888
|
- comma
|
5391
5889
|
- consistent_comma
|
5890
|
+
- diff_comma
|
5392
5891
|
- no_comma
|
5393
5892
|
VersionAdded: '0.53'
|
5394
5893
|
|
@@ -5527,9 +6026,15 @@ Style/WordArray:
|
|
5527
6026
|
# The regular expression `WordRegex` decides what is considered a word.
|
5528
6027
|
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
5529
6028
|
|
6029
|
+
Style/YAMLFileRead:
|
6030
|
+
Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
|
6031
|
+
Enabled: pending
|
6032
|
+
VersionAdded: '1.53'
|
6033
|
+
|
5530
6034
|
Style/YodaCondition:
|
5531
6035
|
Description: 'Forbid or enforce yoda conditions.'
|
5532
|
-
|
6036
|
+
References:
|
6037
|
+
- 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
5533
6038
|
Enabled: true
|
5534
6039
|
EnforcedStyle: forbid_for_all_comparison_operators
|
5535
6040
|
SupportedStyles:
|