rubocop 1.48.1 → 1.62.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +7 -5
- data/assets/output.css.erb +159 -0
- data/assets/output.html.erb +1 -160
- data/config/default.yml +217 -35
- data/config/obsoletion.yml +5 -0
- data/lib/rubocop/cli/command/auto_generate_config.rb +22 -8
- data/lib/rubocop/cli/command/execute_runner.rb +7 -2
- data/lib/rubocop/cli/command/lsp.rb +19 -0
- data/lib/rubocop/cli.rb +16 -8
- data/lib/rubocop/config.rb +9 -3
- data/lib/rubocop/config_finder.rb +14 -4
- data/lib/rubocop/config_loader.rb +8 -9
- data/lib/rubocop/config_loader_resolver.rb +4 -3
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +9 -1
- data/lib/rubocop/config_obsoletion.rb +13 -10
- data/lib/rubocop/config_validator.rb +14 -7
- data/lib/rubocop/cop/autocorrect_logic.rb +36 -13
- data/lib/rubocop/cop/base.rb +23 -4
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -0
- 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_version.rb +2 -2
- data/lib/rubocop/cop/bundler/ordered_gems.rb +9 -1
- data/lib/rubocop/cop/cop.rb +2 -2
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +4 -8
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +5 -13
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +7 -4
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -2
- data/lib/rubocop/cop/exclude_limit.rb +1 -1
- data/lib/rubocop/cop/gemspec/dependency_version.rb +2 -2
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +3 -3
- data/lib/rubocop/cop/gemspec/development_dependencies.rb +1 -1
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +9 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +5 -1
- data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/cop_description.rb +33 -9
- data/lib/rubocop/cop/internal_affairs/example_description.rb +45 -24
- data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -1
- 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 +53 -0
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +127 -33
- data/lib/rubocop/cop/internal_affairs/redundant_expect_offense_arguments.rb +34 -0
- data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +11 -2
- data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +29 -2
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -0
- data/lib/rubocop/cop/internal_affairs.rb +2 -0
- data/lib/rubocop/cop/layout/argument_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/class_structure.rb +8 -0
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -2
- data/lib/rubocop/cop/layout/dot_position.rb +1 -5
- data/lib/rubocop/cop/layout/empty_comment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +42 -9
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +14 -7
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +27 -4
- data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +2 -0
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -0
- data/lib/rubocop/cop/layout/end_alignment.rb +20 -4
- data/lib/rubocop/cop/layout/extra_spacing.rb +3 -4
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +6 -1
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +22 -7
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +25 -34
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +7 -19
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +42 -52
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +38 -55
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +6 -6
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +4 -1
- data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +3 -3
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +17 -9
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -0
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +8 -27
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +7 -26
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +4 -21
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +18 -3
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +6 -30
- data/lib/rubocop/cop/layout/redundant_line_break.rb +33 -11
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +4 -4
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +5 -0
- data/lib/rubocop/cop/layout/space_after_comma.rb +9 -1
- data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_operators.rb +53 -21
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +19 -10
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +2 -0
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_parens.rb +3 -3
- data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +5 -0
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +13 -1
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +4 -4
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +2 -2
- data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +1 -1
- data/lib/rubocop/cop/lint/debugger.rb +19 -5
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +3 -3
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -1
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +122 -0
- data/lib/rubocop/cop/lint/duplicate_methods.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +46 -19
- data/lib/rubocop/cop/lint/empty_block.rb +1 -1
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +1 -1
- data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +6 -7
- data/lib/rubocop/cop/lint/float_comparison.rb +10 -0
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +2 -1
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
- data/lib/rubocop/cop/lint/identity_comparison.rb +0 -1
- data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -3
- data/lib/rubocop/cop/lint/inherit_exception.rb +9 -0
- data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +56 -0
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +85 -0
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +1 -1
- data/lib/rubocop/cop/lint/missing_super.rb +34 -5
- data/lib/rubocop/cop/lint/mixed_case_range.rb +111 -0
- data/lib/rubocop/cop/lint/nested_method_definition.rb +2 -2
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +6 -21
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +10 -7
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -5
- data/lib/rubocop/cop/lint/number_conversion.rb +14 -4
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -2
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +0 -1
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +130 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +12 -3
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +72 -8
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +35 -15
- data/lib/rubocop/cop/lint/redundant_with_index.rb +3 -2
- data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -2
- data/lib/rubocop/cop/lint/rescue_type.rb +1 -3
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +14 -8
- data/lib/rubocop/cop/lint/script_permission.rb +3 -3
- data/lib/rubocop/cop/lint/self_assignment.rb +38 -0
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +1 -2
- data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -0
- data/lib/rubocop/cop/lint/shadowed_exception.rb +5 -11
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +7 -1
- data/lib/rubocop/cop/lint/struct_new_override.rb +12 -12
- data/lib/rubocop/cop/lint/suppressed_exception.rb +2 -2
- data/lib/rubocop/cop/lint/symbol_conversion.rb +8 -3
- data/lib/rubocop/cop/lint/syntax.rb +6 -3
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +19 -6
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +23 -9
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +2 -2
- data/lib/rubocop/cop/lint/unreachable_loop.rb +3 -3
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -2
- data/lib/rubocop/cop/lint/useless_assignment.rb +94 -10
- data/lib/rubocop/cop/lint/useless_method_definition.rb +10 -2
- data/lib/rubocop/cop/lint/useless_times.rb +2 -2
- data/lib/rubocop/cop/lint/void.rb +104 -14
- data/lib/rubocop/cop/metrics/abc_size.rb +3 -3
- data/lib/rubocop/cop/metrics/block_length.rb +1 -1
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/class_length.rb +8 -2
- data/lib/rubocop/cop/metrics/method_length.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -2
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +31 -3
- data/lib/rubocop/cop/migration/department_name.rb +2 -2
- data/lib/rubocop/cop/mixin/allowed_receivers.rb +34 -0
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +1 -1
- data/lib/rubocop/cop/mixin/comments_help.rb +19 -11
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -0
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +14 -11
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +1 -1
- data/lib/rubocop/cop/mixin/heredoc.rb +6 -2
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +4 -3
- data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +6 -8
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +1 -1
- data/lib/rubocop/cop/mixin/string_help.rb +4 -2
- data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +1 -1
- data/lib/rubocop/cop/naming/block_forwarding.rb +13 -5
- data/lib/rubocop/cop/naming/constant_name.rb +2 -3
- data/lib/rubocop/cop/naming/file_name.rb +1 -1
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +3 -1
- data/lib/rubocop/cop/naming/inclusive_language.rb +23 -4
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +26 -11
- data/lib/rubocop/cop/naming/predicate_name.rb +2 -2
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +11 -3
- data/lib/rubocop/cop/naming/variable_name.rb +6 -1
- data/lib/rubocop/cop/registry.rb +1 -1
- data/lib/rubocop/cop/security/open.rb +2 -2
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +2 -2
- data/lib/rubocop/cop/style/accessor_grouping.rb +6 -2
- data/lib/rubocop/cop/style/alias.rb +9 -8
- data/lib/rubocop/cop/style/arguments_forwarding.rb +411 -63
- data/lib/rubocop/cop/style/array_first_last.rb +64 -0
- data/lib/rubocop/cop/style/array_intersect.rb +13 -5
- data/lib/rubocop/cop/style/attr.rb +11 -1
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +21 -14
- data/lib/rubocop/cop/style/begin_block.rb +1 -2
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +2 -2
- data/lib/rubocop/cop/style/block_comments.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +5 -4
- data/lib/rubocop/cop/style/case_like_if.rb +5 -5
- data/lib/rubocop/cop/style/class_and_module_children.rb +2 -2
- data/lib/rubocop/cop/style/class_check.rb +1 -0
- data/lib/rubocop/cop/style/class_equality_comparison.rb +58 -40
- data/lib/rubocop/cop/style/class_vars.rb +3 -3
- data/lib/rubocop/cop/style/collection_compact.rb +35 -12
- data/lib/rubocop/cop/style/collection_methods.rb +2 -0
- data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
- data/lib/rubocop/cop/style/combinable_loops.rb +36 -8
- data/lib/rubocop/cop/style/commented_keyword.rb +5 -2
- data/lib/rubocop/cop/style/concat_array_literals.rb +2 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +11 -10
- data/lib/rubocop/cop/style/copyright.rb +6 -3
- data/lib/rubocop/cop/style/data_inheritance.rb +75 -0
- data/lib/rubocop/cop/style/date_time.rb +5 -4
- data/lib/rubocop/cop/style/dir.rb +1 -1
- data/lib/rubocop/cop/style/dir_empty.rb +8 -14
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +2 -2
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +2 -2
- data/lib/rubocop/cop/style/documentation.rb +1 -1
- data/lib/rubocop/cop/style/double_negation.rb +2 -2
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +7 -7
- data/lib/rubocop/cop/style/each_with_object.rb +2 -2
- data/lib/rubocop/cop/style/empty_case_condition.rb +6 -1
- data/lib/rubocop/cop/style/empty_literal.rb +1 -1
- data/lib/rubocop/cop/style/eval_with_location.rb +8 -19
- data/lib/rubocop/cop/style/exact_regexp_match.rb +69 -0
- data/lib/rubocop/cop/style/explicit_block_argument.rb +2 -2
- data/lib/rubocop/cop/style/file_empty.rb +3 -3
- data/lib/rubocop/cop/style/file_read.rb +2 -2
- data/lib/rubocop/cop/style/for.rb +3 -1
- data/lib/rubocop/cop/style/format_string.rb +24 -3
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +4 -2
- data/lib/rubocop/cop/style/guard_clause.rb +28 -0
- data/lib/rubocop/cop/style/hash_conversion.rb +10 -0
- data/lib/rubocop/cop/style/hash_each_methods.rb +106 -33
- data/lib/rubocop/cop/style/hash_except.rb +25 -13
- data/lib/rubocop/cop/style/hash_syntax.rb +9 -2
- 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 +34 -5
- data/lib/rubocop/cop/style/if_inside_else.rb +6 -0
- data/lib/rubocop/cop/style/if_unless_modifier.rb +41 -12
- data/lib/rubocop/cop/style/if_with_semicolon.rb +2 -2
- data/lib/rubocop/cop/style/inverse_methods.rb +14 -13
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +54 -8
- data/lib/rubocop/cop/style/lambda.rb +3 -3
- data/lib/rubocop/cop/style/lambda_call.rb +5 -0
- data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +8 -10
- data/lib/rubocop/cop/style/map_to_hash.rb +19 -6
- data/lib/rubocop/cop/style/map_to_set.rb +4 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +27 -16
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +45 -40
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +20 -0
- data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +2 -2
- data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
- data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
- data/lib/rubocop/cop/style/multiline_method_signature.rb +16 -4
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +6 -4
- data/lib/rubocop/cop/style/multiple_comparison.rb +14 -0
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +3 -11
- data/lib/rubocop/cop/style/next.rb +1 -1
- data/lib/rubocop/cop/style/nil_comparison.rb +2 -0
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
- data/lib/rubocop/cop/style/object_then.rb +5 -3
- data/lib/rubocop/cop/style/open_struct_use.rb +1 -1
- data/lib/rubocop/cop/style/operator_method_call.rb +8 -2
- data/lib/rubocop/cop/style/parallel_assignment.rb +29 -23
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -0
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +2 -3
- 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/raise_args.rb +4 -1
- data/lib/rubocop/cop/style/redundant_argument.rb +10 -4
- data/lib/rubocop/cop/style/redundant_array_constructor.rb +77 -0
- data/lib/rubocop/cop/style/redundant_assignment.rb +10 -2
- data/lib/rubocop/cop/style/redundant_begin.rb +10 -2
- data/lib/rubocop/cop/style/redundant_conditional.rb +2 -10
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +39 -0
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +93 -5
- data/lib/rubocop/cop/style/redundant_each.rb +7 -4
- data/lib/rubocop/cop/style/redundant_exception.rb +32 -12
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +9 -7
- data/lib/rubocop/cop/style/redundant_filter_chain.rb +118 -0
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +203 -0
- data/lib/rubocop/cop/style/redundant_parentheses.rb +72 -23
- data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +100 -0
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +2 -2
- data/lib/rubocop/cop/style/redundant_regexp_constructor.rb +46 -0
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +3 -2
- data/lib/rubocop/cop/style/redundant_return.rb +14 -3
- data/lib/rubocop/cop/style/redundant_self.rb +17 -2
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +8 -1
- data/lib/rubocop/cop/style/redundant_sort.rb +10 -9
- data/lib/rubocop/cop/style/redundant_sort_by.rb +2 -2
- data/lib/rubocop/cop/style/redundant_string_escape.rb +5 -4
- data/lib/rubocop/cop/style/regexp_literal.rb +11 -2
- data/lib/rubocop/cop/style/require_order.rb +11 -5
- data/lib/rubocop/cop/style/rescue_modifier.rb +1 -3
- data/lib/rubocop/cop/style/return_nil.rb +6 -2
- data/lib/rubocop/cop/style/return_nil_in_predicate_method_definition.rb +95 -0
- data/lib/rubocop/cop/style/sample.rb +3 -4
- data/lib/rubocop/cop/style/select_by_regexp.rb +22 -11
- data/lib/rubocop/cop/style/self_assignment.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +20 -4
- data/lib/rubocop/cop/style/signal_exception.rb +1 -1
- data/lib/rubocop/cop/style/single_argument_dig.rb +7 -3
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +67 -0
- data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
- data/lib/rubocop/cop/style/slicing_with_range.rb +76 -10
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +8 -4
- data/lib/rubocop/cop/style/special_global_vars.rb +3 -4
- data/lib/rubocop/cop/style/string_chars.rb +1 -0
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +30 -5
- data/lib/rubocop/cop/style/strip.rb +7 -4
- data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
- data/lib/rubocop/cop/style/super_with_args_parentheses.rb +35 -0
- data/lib/rubocop/cop/style/symbol_array.rb +35 -15
- data/lib/rubocop/cop/style/symbol_proc.rb +36 -0
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +1 -0
- data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
- data/lib/rubocop/cop/style/unless_logical_operators.rb +1 -0
- data/lib/rubocop/cop/style/unpack_first.rb +11 -14
- data/lib/rubocop/cop/style/yaml_file_read.rb +66 -0
- data/lib/rubocop/cop/style/yoda_condition.rb +4 -2
- data/lib/rubocop/cop/style/yoda_expression.rb +8 -7
- data/lib/rubocop/cop/team.rb +1 -1
- data/lib/rubocop/cop/util.rb +1 -1
- data/lib/rubocop/cop/utils/regexp_ranges.rb +113 -0
- data/lib/rubocop/cop/variable_force/assignment.rb +45 -4
- data/lib/rubocop/cop/variable_force/variable_table.rb +2 -2
- data/lib/rubocop/cop/variable_force.rb +1 -0
- data/lib/rubocop/cops_documentation_generator.rb +26 -7
- data/lib/rubocop/directive_comment.rb +10 -8
- data/lib/rubocop/ext/regexp_node.rb +10 -5
- data/lib/rubocop/ext/regexp_parser.rb +5 -2
- data/lib/rubocop/file_finder.rb +4 -7
- data/lib/rubocop/formatter/disabled_config_formatter.rb +17 -6
- data/lib/rubocop/formatter/html_formatter.rb +35 -14
- data/lib/rubocop/formatter/json_formatter.rb +0 -1
- data/lib/rubocop/formatter/junit_formatter.rb +1 -1
- data/lib/rubocop/formatter/offense_count_formatter.rb +12 -2
- data/lib/rubocop/formatter/simple_text_formatter.rb +1 -1
- data/lib/rubocop/formatter.rb +1 -1
- data/lib/rubocop/lsp/logger.rb +22 -0
- data/lib/rubocop/lsp/routes.rb +246 -0
- data/lib/rubocop/lsp/runtime.rb +99 -0
- data/lib/rubocop/lsp/server.rb +71 -0
- data/lib/rubocop/lsp/severity.rb +27 -0
- data/lib/rubocop/lsp.rb +29 -0
- data/lib/rubocop/magic_comment.rb +13 -11
- data/lib/rubocop/options.rb +26 -10
- data/lib/rubocop/path_util.rb +6 -2
- data/lib/rubocop/result_cache.rb +6 -3
- data/lib/rubocop/rspec/cop_helper.rb +8 -2
- data/lib/rubocop/rspec/expect_offense.rb +8 -8
- data/lib/rubocop/rspec/shared_contexts.rb +42 -18
- data/lib/rubocop/rspec/support.rb +2 -0
- data/lib/rubocop/runner.rb +15 -6
- data/lib/rubocop/server/cache.rb +1 -1
- data/lib/rubocop/server/client_command/exec.rb +3 -3
- data/lib/rubocop/server/helper.rb +1 -1
- data/lib/rubocop/server/server_command/exec.rb +1 -2
- data/lib/rubocop/string_interpreter.rb +3 -3
- data/lib/rubocop/target_finder.rb +91 -81
- data/lib/rubocop/target_ruby.rb +85 -78
- data/lib/rubocop/version.rb +27 -8
- data/lib/rubocop.rb +22 -0
- metadata +59 -14
- /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'
|
@@ -140,8 +142,14 @@ AllCops:
|
|
140
142
|
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
141
143
|
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
142
144
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
143
|
-
# supported Ruby version (currently Ruby 2.
|
145
|
+
# supported Ruby version (currently Ruby 2.7).
|
144
146
|
TargetRubyVersion: ~
|
147
|
+
# You can specify the parser engine. There are two options available:
|
148
|
+
# - `parser_whitequark` ... https://github.com/whitequark/parser
|
149
|
+
# - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
|
150
|
+
# By default, `parser` is used. For the `TargetRubyVersion` value, `parser` can be specified for versions `2.0` and above.
|
151
|
+
# `parser_prism` can be specified for versions `3.3` and above. `parser_prism` is faster but still considered experimental.
|
152
|
+
ParserEngine: parser_whitequark
|
145
153
|
# Determines if a notification for extension libraries should be shown when
|
146
154
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
147
155
|
# of gems in the Gemfile that the extension is suggested for, if not already
|
@@ -154,6 +162,7 @@ AllCops:
|
|
154
162
|
rubocop-rake: [rake]
|
155
163
|
rubocop-graphql: [graphql]
|
156
164
|
rubocop-capybara: [capybara]
|
165
|
+
rubocop-factory_bot: [factory_bot, factory_bot_rails]
|
157
166
|
# Enable/Disable checking the methods extended by Active Support.
|
158
167
|
ActiveSupportExtensionsEnabled: false
|
159
168
|
|
@@ -170,6 +179,16 @@ Bundler/DuplicatedGem:
|
|
170
179
|
- '**/Gemfile'
|
171
180
|
- '**/gems.rb'
|
172
181
|
|
182
|
+
Bundler/DuplicatedGroup:
|
183
|
+
Description: 'Checks for duplicate group entries in Gemfile.'
|
184
|
+
Enabled: true
|
185
|
+
Severity: warning
|
186
|
+
VersionAdded: '1.56'
|
187
|
+
Include:
|
188
|
+
- '**/*.gemfile'
|
189
|
+
- '**/Gemfile'
|
190
|
+
- '**/gems.rb'
|
191
|
+
|
173
192
|
Bundler/GemComment:
|
174
193
|
Description: 'Add a comment describing each gem.'
|
175
194
|
Enabled: false
|
@@ -466,7 +485,9 @@ Layout/ClassStructure:
|
|
466
485
|
Description: 'Enforces a configured order of definitions within a class body.'
|
467
486
|
StyleGuide: '#consistent-classes'
|
468
487
|
Enabled: false
|
488
|
+
SafeAutoCorrect: false
|
469
489
|
VersionAdded: '0.52'
|
490
|
+
VersionChanged: '1.53'
|
470
491
|
Categories:
|
471
492
|
module_inclusion:
|
472
493
|
- include
|
@@ -541,7 +562,9 @@ Layout/ElseAlignment:
|
|
541
562
|
Layout/EmptyComment:
|
542
563
|
Description: 'Checks empty comment.'
|
543
564
|
Enabled: true
|
565
|
+
AutoCorrect: contextual
|
544
566
|
VersionAdded: '0.53'
|
567
|
+
VersionChanged: '1.61'
|
545
568
|
AllowBorderComment: true
|
546
569
|
AllowMarginComment: true
|
547
570
|
|
@@ -574,6 +597,8 @@ Layout/EmptyLineBetweenDefs:
|
|
574
597
|
EmptyLineBetweenMethodDefs: true
|
575
598
|
EmptyLineBetweenClassDefs: true
|
576
599
|
EmptyLineBetweenModuleDefs: true
|
600
|
+
# `DefLikeMacros` takes the name of any macro that you want to treat like a def.
|
601
|
+
DefLikeMacros: []
|
577
602
|
# `AllowAdjacentOneLineDefs` means that single line method definitions don't
|
578
603
|
# need an empty line between them. `true` by default.
|
579
604
|
AllowAdjacentOneLineDefs: true
|
@@ -1016,8 +1041,6 @@ Layout/LineContinuationLeadingSpace:
|
|
1016
1041
|
Layout/LineContinuationSpacing:
|
1017
1042
|
Description: 'Checks the spacing in front of backslash in line continuations.'
|
1018
1043
|
Enabled: pending
|
1019
|
-
AutoCorrect: true
|
1020
|
-
SafeAutoCorrect: true
|
1021
1044
|
VersionAdded: '1.31'
|
1022
1045
|
EnforcedStyle: space
|
1023
1046
|
SupportedStyles:
|
@@ -1336,6 +1359,10 @@ Layout/SpaceAroundOperators:
|
|
1336
1359
|
SupportedStylesForExponentOperator:
|
1337
1360
|
- space
|
1338
1361
|
- no_space
|
1362
|
+
EnforcedStyleForRationalLiterals: no_space
|
1363
|
+
SupportedStylesForRationalLiterals:
|
1364
|
+
- space
|
1365
|
+
- no_space
|
1339
1366
|
|
1340
1367
|
Layout/SpaceBeforeBlockBraces:
|
1341
1368
|
Description: >-
|
@@ -1531,7 +1558,6 @@ Lint/AmbiguousBlockAssociation:
|
|
1531
1558
|
Description: >-
|
1532
1559
|
Checks for ambiguous block association with method when param passed without
|
1533
1560
|
parentheses.
|
1534
|
-
StyleGuide: '#syntax'
|
1535
1561
|
Enabled: true
|
1536
1562
|
VersionAdded: '0.48'
|
1537
1563
|
VersionChanged: '1.13'
|
@@ -1752,6 +1778,11 @@ Lint/DuplicateMagicComment:
|
|
1752
1778
|
Enabled: pending
|
1753
1779
|
VersionAdded: '1.37'
|
1754
1780
|
|
1781
|
+
Lint/DuplicateMatchPattern:
|
1782
|
+
Description: 'Do not repeat patterns in `in` keywords.'
|
1783
|
+
Enabled: pending
|
1784
|
+
VersionAdded: '1.50'
|
1785
|
+
|
1755
1786
|
Lint/DuplicateMethods:
|
1756
1787
|
Description: 'Check for duplicate method definitions.'
|
1757
1788
|
Enabled: true
|
@@ -1802,16 +1833,18 @@ Lint/EmptyClass:
|
|
1802
1833
|
Lint/EmptyConditionalBody:
|
1803
1834
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1804
1835
|
Enabled: true
|
1836
|
+
AutoCorrect: contextual
|
1805
1837
|
SafeAutoCorrect: false
|
1806
1838
|
AllowComments: true
|
1807
1839
|
VersionAdded: '0.89'
|
1808
|
-
VersionChanged: '1.
|
1840
|
+
VersionChanged: '1.61'
|
1809
1841
|
|
1810
1842
|
Lint/EmptyEnsure:
|
1811
1843
|
Description: 'Checks for empty ensure block.'
|
1812
1844
|
Enabled: true
|
1845
|
+
AutoCorrect: contextual
|
1813
1846
|
VersionAdded: '0.10'
|
1814
|
-
VersionChanged: '
|
1847
|
+
VersionChanged: '1.61'
|
1815
1848
|
|
1816
1849
|
Lint/EmptyExpression:
|
1817
1850
|
Description: 'Checks for empty expressions.'
|
@@ -1833,8 +1866,9 @@ Lint/EmptyInPattern:
|
|
1833
1866
|
Lint/EmptyInterpolation:
|
1834
1867
|
Description: 'Checks for empty string interpolation.'
|
1835
1868
|
Enabled: true
|
1869
|
+
AutoCorrect: contextual
|
1836
1870
|
VersionAdded: '0.20'
|
1837
|
-
VersionChanged: '
|
1871
|
+
VersionChanged: '1.61'
|
1838
1872
|
|
1839
1873
|
Lint/EmptyWhen:
|
1840
1874
|
Description: 'Checks for `when` branches with empty bodies.'
|
@@ -1940,6 +1974,12 @@ Lint/InterpolationCheck:
|
|
1940
1974
|
VersionAdded: '0.50'
|
1941
1975
|
VersionChanged: '1.40'
|
1942
1976
|
|
1977
|
+
Lint/ItWithoutArgumentsInBlock:
|
1978
|
+
Description: 'Checks uses of `it` calls without arguments in block.'
|
1979
|
+
Reference: 'https://bugs.ruby-lang.org/issues/18980'
|
1980
|
+
Enabled: pending
|
1981
|
+
VersionAdded: '1.59'
|
1982
|
+
|
1943
1983
|
Lint/LambdaWithoutLiteralBlock:
|
1944
1984
|
Description: 'Checks uses of lambda without a literal block.'
|
1945
1985
|
Enabled: pending
|
@@ -1950,6 +1990,11 @@ Lint/LiteralAsCondition:
|
|
1950
1990
|
Enabled: true
|
1951
1991
|
VersionAdded: '0.51'
|
1952
1992
|
|
1993
|
+
Lint/LiteralAssignmentInCondition:
|
1994
|
+
Description: 'Checks for literal assignments in the conditions.'
|
1995
|
+
Enabled: pending
|
1996
|
+
VersionAdded: '1.58'
|
1997
|
+
|
1953
1998
|
Lint/LiteralInInterpolation:
|
1954
1999
|
Description: 'Checks for literals used in interpolation.'
|
1955
2000
|
Enabled: true
|
@@ -1984,9 +2029,16 @@ Lint/MissingSuper:
|
|
1984
2029
|
Checks for the presence of constructors and lifecycle callbacks
|
1985
2030
|
without calls to `super`.
|
1986
2031
|
Enabled: true
|
2032
|
+
AllowedParentClasses: []
|
1987
2033
|
VersionAdded: '0.89'
|
1988
2034
|
VersionChanged: '1.4'
|
1989
2035
|
|
2036
|
+
Lint/MixedCaseRange:
|
2037
|
+
Description: 'Checks for mixed-case character ranges since they include likely unintended characters.'
|
2038
|
+
Enabled: pending
|
2039
|
+
SafeAutoCorrect: false
|
2040
|
+
VersionAdded: '1.53'
|
2041
|
+
|
1990
2042
|
Lint/MixedRegexpCaptureTypes:
|
1991
2043
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1992
2044
|
Enabled: true
|
@@ -2136,10 +2188,17 @@ Lint/RedundantDirGlobSort:
|
|
2136
2188
|
VersionChanged: '1.26'
|
2137
2189
|
SafeAutoCorrect: false
|
2138
2190
|
|
2191
|
+
Lint/RedundantRegexpQuantifiers:
|
2192
|
+
Description: 'Checks for redundant quantifiers in Regexps.'
|
2193
|
+
Enabled: pending
|
2194
|
+
VersionAdded: '1.53'
|
2195
|
+
|
2139
2196
|
Lint/RedundantRequireStatement:
|
2140
2197
|
Description: 'Checks for unnecessary `require` statement.'
|
2141
2198
|
Enabled: true
|
2199
|
+
SafeAutoCorrect: false
|
2142
2200
|
VersionAdded: '0.76'
|
2201
|
+
VersionChanged: '1.57'
|
2143
2202
|
|
2144
2203
|
Lint/RedundantSafeNavigation:
|
2145
2204
|
Description: 'Checks for redundant safe navigation calls.'
|
@@ -2340,11 +2399,16 @@ Lint/TopLevelReturnWithArgument:
|
|
2340
2399
|
Description: 'Detects top level return statements with argument.'
|
2341
2400
|
Enabled: true
|
2342
2401
|
VersionAdded: '0.89'
|
2402
|
+
# These codes are `eval`-ed in method and their return values may be used.
|
2403
|
+
Exclude:
|
2404
|
+
- '**/*.jb'
|
2343
2405
|
|
2344
2406
|
Lint/TrailingCommaInAttributeDeclaration:
|
2345
2407
|
Description: 'Checks for trailing commas in attribute declarations.'
|
2346
2408
|
Enabled: true
|
2409
|
+
AutoCorrect: contextual
|
2347
2410
|
VersionAdded: '0.90'
|
2411
|
+
VersionChanged: '1.61'
|
2348
2412
|
|
2349
2413
|
Lint/TripleQuotes:
|
2350
2414
|
Description: 'Checks for useless triple quote constructs.'
|
@@ -2404,8 +2468,9 @@ Lint/UnusedBlockArgument:
|
|
2404
2468
|
Description: 'Checks for unused block arguments.'
|
2405
2469
|
StyleGuide: '#underscore-unused-vars'
|
2406
2470
|
Enabled: true
|
2471
|
+
AutoCorrect: contextual
|
2407
2472
|
VersionAdded: '0.21'
|
2408
|
-
VersionChanged: '
|
2473
|
+
VersionChanged: '1.61'
|
2409
2474
|
IgnoreEmptyBlocks: true
|
2410
2475
|
AllowUnusedKeywordArguments: false
|
2411
2476
|
|
@@ -2413,8 +2478,9 @@ Lint/UnusedMethodArgument:
|
|
2413
2478
|
Description: 'Checks for unused method arguments.'
|
2414
2479
|
StyleGuide: '#underscore-unused-vars'
|
2415
2480
|
Enabled: true
|
2481
|
+
AutoCorrect: contextual
|
2416
2482
|
VersionAdded: '0.21'
|
2417
|
-
VersionChanged: '
|
2483
|
+
VersionChanged: '1.61'
|
2418
2484
|
AllowUnusedKeywordArguments: false
|
2419
2485
|
IgnoreEmptyMethods: true
|
2420
2486
|
IgnoreNotImplementedMethods: true
|
@@ -2438,8 +2504,9 @@ Lint/UriRegexp:
|
|
2438
2504
|
Lint/UselessAccessModifier:
|
2439
2505
|
Description: 'Checks for useless access modifiers.'
|
2440
2506
|
Enabled: true
|
2507
|
+
AutoCorrect: contextual
|
2441
2508
|
VersionAdded: '0.20'
|
2442
|
-
VersionChanged: '
|
2509
|
+
VersionChanged: '1.61'
|
2443
2510
|
ContextCreatingMethods: []
|
2444
2511
|
MethodCreatingMethods: []
|
2445
2512
|
|
@@ -2447,7 +2514,10 @@ Lint/UselessAssignment:
|
|
2447
2514
|
Description: 'Checks for useless assignment to a local variable.'
|
2448
2515
|
StyleGuide: '#underscore-unused-vars'
|
2449
2516
|
Enabled: true
|
2517
|
+
AutoCorrect: contextual
|
2450
2518
|
VersionAdded: '0.11'
|
2519
|
+
VersionChanged: '1.61'
|
2520
|
+
SafeAutoCorrect: false
|
2451
2521
|
|
2452
2522
|
Lint/UselessElseWithoutRescue:
|
2453
2523
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
@@ -2458,8 +2528,9 @@ Lint/UselessElseWithoutRescue:
|
|
2458
2528
|
Lint/UselessMethodDefinition:
|
2459
2529
|
Description: 'Checks for useless method definitions.'
|
2460
2530
|
Enabled: true
|
2531
|
+
AutoCorrect: contextual
|
2461
2532
|
VersionAdded: '0.90'
|
2462
|
-
VersionChanged: '
|
2533
|
+
VersionChanged: '1.61'
|
2463
2534
|
Safe: false
|
2464
2535
|
|
2465
2536
|
Lint/UselessRescue:
|
@@ -2475,21 +2546,24 @@ Lint/UselessRuby2Keywords:
|
|
2475
2546
|
Lint/UselessSetterCall:
|
2476
2547
|
Description: 'Checks for useless setter call to a local variable.'
|
2477
2548
|
Enabled: true
|
2478
|
-
|
2549
|
+
Safe: false
|
2479
2550
|
VersionAdded: '0.13'
|
2480
2551
|
VersionChanged: '1.2'
|
2481
|
-
Safe: false
|
2482
2552
|
|
2483
2553
|
Lint/UselessTimes:
|
2484
2554
|
Description: 'Checks for useless `Integer#times` calls.'
|
2485
2555
|
Enabled: true
|
2486
|
-
VersionAdded: '0.91'
|
2487
2556
|
Safe: false
|
2557
|
+
AutoCorrect: contextual
|
2558
|
+
VersionAdded: '0.91'
|
2559
|
+
VersionChanged: '1.61'
|
2488
2560
|
|
2489
2561
|
Lint/Void:
|
2490
2562
|
Description: 'Possible use of operator/literal/variable in void context.'
|
2491
2563
|
Enabled: true
|
2564
|
+
AutoCorrect: contextual
|
2492
2565
|
VersionAdded: '0.9'
|
2566
|
+
VersionChanged: '1.61'
|
2493
2567
|
CheckForMethodsWithNoSideEffects: false
|
2494
2568
|
|
2495
2569
|
#################### Metrics ###############################
|
@@ -2779,7 +2853,7 @@ Naming/InclusiveLanguage:
|
|
2779
2853
|
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
2780
2854
|
Enabled: false
|
2781
2855
|
VersionAdded: '1.18'
|
2782
|
-
VersionChanged: '1.
|
2856
|
+
VersionChanged: '1.49'
|
2783
2857
|
CheckIdentifiers: true
|
2784
2858
|
CheckConstants: true
|
2785
2859
|
CheckVariables: true
|
@@ -2939,7 +3013,9 @@ Naming/VariableNumber:
|
|
2939
3013
|
Security/CompoundHash:
|
2940
3014
|
Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
|
2941
3015
|
Enabled: pending
|
3016
|
+
Safe: false
|
2942
3017
|
VersionAdded: '1.28'
|
3018
|
+
VersionChanged: '1.51'
|
2943
3019
|
|
2944
3020
|
Security/Eval:
|
2945
3021
|
Description: 'The use of eval represents a serious security risk.'
|
@@ -3045,7 +3121,20 @@ Style/ArgumentsForwarding:
|
|
3045
3121
|
StyleGuide: '#arguments-forwarding'
|
3046
3122
|
Enabled: pending
|
3047
3123
|
AllowOnlyRestArgument: true
|
3124
|
+
UseAnonymousForwarding: true
|
3125
|
+
RedundantRestArgumentNames:
|
3126
|
+
- args
|
3127
|
+
- arguments
|
3128
|
+
RedundantKeywordRestArgumentNames:
|
3129
|
+
- kwargs
|
3130
|
+
- options
|
3131
|
+
- opts
|
3132
|
+
RedundantBlockArgumentNames:
|
3133
|
+
- blk
|
3134
|
+
- block
|
3135
|
+
- proc
|
3048
3136
|
VersionAdded: '1.1'
|
3137
|
+
VersionChanged: '1.58'
|
3049
3138
|
|
3050
3139
|
Style/ArrayCoercion:
|
3051
3140
|
Description: >-
|
@@ -3056,6 +3145,13 @@ Style/ArrayCoercion:
|
|
3056
3145
|
Enabled: false
|
3057
3146
|
VersionAdded: '0.88'
|
3058
3147
|
|
3148
|
+
Style/ArrayFirstLast:
|
3149
|
+
Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
|
3150
|
+
Reference: '#first-and-last'
|
3151
|
+
Enabled: false
|
3152
|
+
VersionAdded: '1.58'
|
3153
|
+
Safe: false
|
3154
|
+
|
3059
3155
|
Style/ArrayIntersect:
|
3060
3156
|
Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
|
3061
3157
|
Enabled: 'pending'
|
@@ -3277,7 +3373,7 @@ Style/ClassAndModuleChildren:
|
|
3277
3373
|
StyleGuide: '#namespace-definition'
|
3278
3374
|
# Moving from compact to nested children requires knowledge of whether the
|
3279
3375
|
# outer parent is a module or a class. Moving from nested to compact requires
|
3280
|
-
# verification that the outer parent is defined elsewhere.
|
3376
|
+
# verification that the outer parent is defined elsewhere. RuboCop does not
|
3281
3377
|
# have the knowledge to perform either operation safely and thus requires
|
3282
3378
|
# manual oversight.
|
3283
3379
|
SafeAutoCorrect: false
|
@@ -3316,7 +3412,9 @@ Style/ClassEqualityComparison:
|
|
3316
3412
|
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
3317
3413
|
StyleGuide: '#instance-of-vs-class-comparison'
|
3318
3414
|
Enabled: true
|
3415
|
+
SafeAutoCorrect: false
|
3319
3416
|
VersionAdded: '0.93'
|
3417
|
+
VersionChanged: '1.57'
|
3320
3418
|
AllowedMethods:
|
3321
3419
|
- ==
|
3322
3420
|
- equal?
|
@@ -3352,6 +3450,7 @@ Style/CollectionCompact:
|
|
3352
3450
|
Safe: false
|
3353
3451
|
VersionAdded: '1.2'
|
3354
3452
|
VersionChanged: '1.3'
|
3453
|
+
AllowedReceivers: []
|
3355
3454
|
|
3356
3455
|
# Align with the style guide.
|
3357
3456
|
Style/CollectionMethods:
|
@@ -3370,6 +3469,7 @@ Style/CollectionMethods:
|
|
3370
3469
|
PreferredMethods:
|
3371
3470
|
collect: 'map'
|
3372
3471
|
collect!: 'map!'
|
3472
|
+
collect_concat: 'flat_map'
|
3373
3473
|
inject: 'reduce'
|
3374
3474
|
detect: 'find'
|
3375
3475
|
find_all: 'select'
|
@@ -3508,6 +3608,14 @@ Style/Copyright:
|
|
3508
3608
|
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
3509
3609
|
AutocorrectNotice: ''
|
3510
3610
|
|
3611
|
+
Style/DataInheritance:
|
3612
|
+
Description: 'Checks for inheritance from Data.define.'
|
3613
|
+
StyleGuide: '#no-extend-data-define'
|
3614
|
+
Enabled: pending
|
3615
|
+
SafeAutoCorrect: false
|
3616
|
+
VersionAdded: '1.49'
|
3617
|
+
VersionChanged: '1.51'
|
3618
|
+
|
3511
3619
|
Style/DateTime:
|
3512
3620
|
Description: 'Use Time over DateTime.'
|
3513
3621
|
StyleGuide: '#date-time'
|
@@ -3615,8 +3723,9 @@ Style/EmptyCaseCondition:
|
|
3615
3723
|
Style/EmptyElse:
|
3616
3724
|
Description: 'Avoid empty else-clauses.'
|
3617
3725
|
Enabled: true
|
3726
|
+
AutoCorrect: contextual
|
3618
3727
|
VersionAdded: '0.28'
|
3619
|
-
VersionChanged: '
|
3728
|
+
VersionChanged: '1.61'
|
3620
3729
|
EnforcedStyle: both
|
3621
3730
|
# empty - warn only on empty `else`
|
3622
3731
|
# nil - warn on `else` with nil in it
|
@@ -3630,7 +3739,9 @@ Style/EmptyElse:
|
|
3630
3739
|
Style/EmptyHeredoc:
|
3631
3740
|
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
3632
3741
|
Enabled: pending
|
3742
|
+
AutoCorrect: contextual
|
3633
3743
|
VersionAdded: '1.32'
|
3744
|
+
VersionChanged: '1.61'
|
3634
3745
|
|
3635
3746
|
Style/EmptyLambdaParameter:
|
3636
3747
|
Description: 'Omit parens for empty lambda parameters.'
|
@@ -3648,7 +3759,9 @@ Style/EmptyMethod:
|
|
3648
3759
|
Description: 'Checks the formatting of empty method definitions.'
|
3649
3760
|
StyleGuide: '#no-single-line-methods'
|
3650
3761
|
Enabled: true
|
3762
|
+
AutoCorrect: contextual
|
3651
3763
|
VersionAdded: '0.46'
|
3764
|
+
VersionChanged: '1.61'
|
3652
3765
|
EnforcedStyle: compact
|
3653
3766
|
SupportedStyles:
|
3654
3767
|
- compact
|
@@ -3697,6 +3810,11 @@ Style/EvenOdd:
|
|
3697
3810
|
VersionAdded: '0.12'
|
3698
3811
|
VersionChanged: '0.29'
|
3699
3812
|
|
3813
|
+
Style/ExactRegexpMatch:
|
3814
|
+
Description: 'Checks for exact regexp match inside Regexp literals.'
|
3815
|
+
Enabled: pending
|
3816
|
+
VersionAdded: '1.51'
|
3817
|
+
|
3700
3818
|
Style/ExpandPathArguments:
|
3701
3819
|
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
|
3702
3820
|
Enabled: true
|
@@ -3737,7 +3855,6 @@ Style/FileEmpty:
|
|
3737
3855
|
Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
|
3738
3856
|
Enabled: pending
|
3739
3857
|
Safe: false
|
3740
|
-
SafeAutoCorrect: false
|
3741
3858
|
VersionAdded: '1.48'
|
3742
3859
|
|
3743
3860
|
Style/FileRead:
|
@@ -3876,8 +3993,9 @@ Style/HashConversion:
|
|
3876
3993
|
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3877
3994
|
StyleGuide: '#avoid-hash-constructor'
|
3878
3995
|
Enabled: pending
|
3996
|
+
SafeAutoCorrect: false
|
3879
3997
|
VersionAdded: '1.10'
|
3880
|
-
VersionChanged: '1.
|
3998
|
+
VersionChanged: '1.55'
|
3881
3999
|
AllowSplatArgument: true
|
3882
4000
|
|
3883
4001
|
Style/HashEachMethods:
|
@@ -4059,7 +4177,9 @@ Style/InverseMethods:
|
|
4059
4177
|
Style/InvertibleUnlessCondition:
|
4060
4178
|
Description: 'Favor `if` with inverted condition over `unless`.'
|
4061
4179
|
Enabled: false
|
4180
|
+
Safe: false
|
4062
4181
|
VersionAdded: '1.44'
|
4182
|
+
VersionChanged: '1.50'
|
4063
4183
|
# `InverseMethods` are methods that can be inverted in a `unless` condition.
|
4064
4184
|
# The relationship of inverse methods needs to be defined in both directions.
|
4065
4185
|
# Keys and values both need to be defined as symbols.
|
@@ -4076,14 +4196,6 @@ Style/InvertibleUnlessCondition:
|
|
4076
4196
|
:none?: :any?
|
4077
4197
|
:even?: :odd?
|
4078
4198
|
:odd?: :even?
|
4079
|
-
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
4080
|
-
# and not enabled by default.
|
4081
|
-
# :present?: :blank?
|
4082
|
-
# :blank?: :present?
|
4083
|
-
# :include?: :exclude?
|
4084
|
-
# :exclude?: :include?
|
4085
|
-
# :one?: :many?
|
4086
|
-
# :many?: :one?
|
4087
4199
|
|
4088
4200
|
Style/IpAddresses:
|
4089
4201
|
Description: "Don't include literal IP addresses in code."
|
@@ -4360,6 +4472,7 @@ Style/MultipleComparison:
|
|
4360
4472
|
VersionAdded: '0.49'
|
4361
4473
|
VersionChanged: '1.1'
|
4362
4474
|
AllowMethodComparison: true
|
4475
|
+
ComparisonsThreshold: 2
|
4363
4476
|
|
4364
4477
|
Style/MutableConstant:
|
4365
4478
|
Description: 'Do not assign mutable objects to constants.'
|
@@ -4565,11 +4678,10 @@ Style/NumericPredicate:
|
|
4565
4678
|
Checks for the use of predicate- or comparison methods for
|
4566
4679
|
numeric comparisons.
|
4567
4680
|
StyleGuide: '#predicate-methods'
|
4568
|
-
Safe: false
|
4569
4681
|
# This will change to a new method call which isn't guaranteed to be on the
|
4570
4682
|
# object. Switching these methods has to be done with knowledge of the types
|
4571
4683
|
# of the variables which rubocop doesn't have.
|
4572
|
-
|
4684
|
+
Safe: false
|
4573
4685
|
Enabled: true
|
4574
4686
|
VersionAdded: '0.42'
|
4575
4687
|
VersionChanged: '0.59'
|
@@ -4615,7 +4727,9 @@ Style/OpenStructUse:
|
|
4615
4727
|
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4616
4728
|
|
4617
4729
|
Enabled: pending
|
4730
|
+
Safe: false
|
4618
4731
|
VersionAdded: '1.23'
|
4732
|
+
VersionChanged: '1.51'
|
4619
4733
|
|
4620
4734
|
Style/OperatorMethodCall:
|
4621
4735
|
Description: 'Checks for redundant dot before operator method call.'
|
@@ -4625,6 +4739,7 @@ Style/OperatorMethodCall:
|
|
4625
4739
|
|
4626
4740
|
Style/OptionHash:
|
4627
4741
|
Description: "Don't use option hashes when you can use keyword arguments."
|
4742
|
+
StyleGuide: '#keyword-arguments-vs-option-hashes'
|
4628
4743
|
Enabled: false
|
4629
4744
|
VersionAdded: '0.33'
|
4630
4745
|
VersionChanged: '0.34'
|
@@ -4747,8 +4862,9 @@ Style/RaiseArgs:
|
|
4747
4862
|
Description: 'Checks the arguments passed to raise/fail.'
|
4748
4863
|
StyleGuide: '#exception-class-messages'
|
4749
4864
|
Enabled: true
|
4865
|
+
Safe: false
|
4750
4866
|
VersionAdded: '0.14'
|
4751
|
-
VersionChanged: '1.
|
4867
|
+
VersionChanged: '1.61'
|
4752
4868
|
EnforcedStyle: exploded
|
4753
4869
|
SupportedStyles:
|
4754
4870
|
- compact # raise Exception.new(msg)
|
@@ -4768,12 +4884,16 @@ Style/RedundantArgument:
|
|
4768
4884
|
Enabled: pending
|
4769
4885
|
Safe: false
|
4770
4886
|
VersionAdded: '1.4'
|
4771
|
-
VersionChanged: '1.
|
4887
|
+
VersionChanged: '1.55'
|
4772
4888
|
Methods:
|
4773
4889
|
# Array#join
|
4774
4890
|
join: ''
|
4775
4891
|
# Array#sum
|
4776
4892
|
sum: 0
|
4893
|
+
# Kernel.#exit
|
4894
|
+
exit: true
|
4895
|
+
# Kernel.#exit!
|
4896
|
+
exit!: false
|
4777
4897
|
# String#split
|
4778
4898
|
split: ' '
|
4779
4899
|
# String#chomp
|
@@ -4781,6 +4901,11 @@ Style/RedundantArgument:
|
|
4781
4901
|
# String#chomp!
|
4782
4902
|
chomp!: "\n"
|
4783
4903
|
|
4904
|
+
Style/RedundantArrayConstructor:
|
4905
|
+
Description: 'Checks for the instantiation of array using redundant `Array` constructor.'
|
4906
|
+
Enabled: pending
|
4907
|
+
VersionAdded: '1.52'
|
4908
|
+
|
4784
4909
|
Style/RedundantAssignment:
|
4785
4910
|
Description: 'Checks for redundant assignment before returning.'
|
4786
4911
|
Enabled: true
|
@@ -4813,6 +4938,11 @@ Style/RedundantConstantBase:
|
|
4813
4938
|
Enabled: pending
|
4814
4939
|
VersionAdded: '1.40'
|
4815
4940
|
|
4941
|
+
Style/RedundantCurrentDirectoryInPath:
|
4942
|
+
Description: 'Checks for uses a redundant current directory in path.'
|
4943
|
+
Enabled: pending
|
4944
|
+
VersionAdded: '1.53'
|
4945
|
+
|
4816
4946
|
Style/RedundantDoubleSplatHashBraces:
|
4817
4947
|
Description: 'Checks for redundant uses of double splat hash braces.'
|
4818
4948
|
Enabled: pending
|
@@ -4835,7 +4965,7 @@ Style/RedundantFetchBlock:
|
|
4835
4965
|
Description: >-
|
4836
4966
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
4837
4967
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
4838
|
-
Reference: 'https://github.com/
|
4968
|
+
Reference: 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
4839
4969
|
Enabled: true
|
4840
4970
|
Safe: false
|
4841
4971
|
# If enabled, this cop will autocorrect usages of
|
@@ -4852,6 +4982,15 @@ Style/RedundantFileExtensionInRequire:
|
|
4852
4982
|
Enabled: true
|
4853
4983
|
VersionAdded: '0.88'
|
4854
4984
|
|
4985
|
+
Style/RedundantFilterChain:
|
4986
|
+
Description: >-
|
4987
|
+
Identifies usages of `any?`, `empty?`, `none?` or `one?` predicate methods chained to
|
4988
|
+
`select`/`filter`/`find_all` and change them to use predicate method instead.
|
4989
|
+
Enabled: pending
|
4990
|
+
SafeAutoCorrect: false
|
4991
|
+
VersionAdded: '1.52'
|
4992
|
+
VersionChanged: '1.57'
|
4993
|
+
|
4855
4994
|
Style/RedundantFreeze:
|
4856
4995
|
Description: "Checks usages of Object#freeze on immutable objects."
|
4857
4996
|
Enabled: true
|
@@ -4866,10 +5005,11 @@ Style/RedundantHeredocDelimiterQuotes:
|
|
4866
5005
|
Style/RedundantInitialize:
|
4867
5006
|
Description: 'Checks for redundant `initialize` methods.'
|
4868
5007
|
Enabled: pending
|
5008
|
+
AutoCorrect: contextual
|
4869
5009
|
Safe: false
|
4870
5010
|
AllowComments: true
|
4871
5011
|
VersionAdded: '1.27'
|
4872
|
-
VersionChanged: '1.
|
5012
|
+
VersionChanged: '1.61'
|
4873
5013
|
|
4874
5014
|
Style/RedundantInterpolation:
|
4875
5015
|
Description: 'Checks for strings that are just an interpolated expression.'
|
@@ -4878,6 +5018,11 @@ Style/RedundantInterpolation:
|
|
4878
5018
|
VersionAdded: '0.76'
|
4879
5019
|
VersionChanged: '1.30'
|
4880
5020
|
|
5021
|
+
Style/RedundantLineContinuation:
|
5022
|
+
Description: 'Check for redundant line continuation.'
|
5023
|
+
Enabled: pending
|
5024
|
+
VersionAdded: '1.49'
|
5025
|
+
|
4881
5026
|
Style/RedundantParentheses:
|
4882
5027
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
4883
5028
|
Enabled: true
|
@@ -4889,11 +5034,21 @@ Style/RedundantPercentQ:
|
|
4889
5034
|
Enabled: true
|
4890
5035
|
VersionAdded: '0.76'
|
4891
5036
|
|
5037
|
+
Style/RedundantRegexpArgument:
|
5038
|
+
Description: 'Identifies places where argument can be replaced from a deterministic regexp to a string.'
|
5039
|
+
Enabled: pending
|
5040
|
+
VersionAdded: '1.53'
|
5041
|
+
|
4892
5042
|
Style/RedundantRegexpCharacterClass:
|
4893
5043
|
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
4894
5044
|
Enabled: true
|
4895
5045
|
VersionAdded: '0.85'
|
4896
5046
|
|
5047
|
+
Style/RedundantRegexpConstructor:
|
5048
|
+
Description: 'Checks for the instantiation of regexp using redundant `Regexp.new` or `Regexp.compile`.'
|
5049
|
+
Enabled: pending
|
5050
|
+
VersionAdded: '1.52'
|
5051
|
+
|
4897
5052
|
Style/RedundantRegexpEscape:
|
4898
5053
|
Description: 'Checks for redundant escapes in Regexps.'
|
4899
5054
|
Enabled: true
|
@@ -4996,6 +5151,15 @@ Style/ReturnNil:
|
|
4996
5151
|
- return_nil
|
4997
5152
|
VersionAdded: '0.50'
|
4998
5153
|
|
5154
|
+
Style/ReturnNilInPredicateMethodDefinition:
|
5155
|
+
Description: 'Checks if uses of `return` or `return nil` in predicate method definition.'
|
5156
|
+
StyleGuide: '#bool-methods-qmark'
|
5157
|
+
Enabled: pending
|
5158
|
+
SafeAutoCorrect: false
|
5159
|
+
AllowedMethods: []
|
5160
|
+
AllowedPatterns: []
|
5161
|
+
VersionAdded: '1.53'
|
5162
|
+
|
4999
5163
|
Style/SafeNavigation:
|
5000
5164
|
Description: >-
|
5001
5165
|
Transforms usages of a method call safeguarded by
|
@@ -5023,7 +5187,7 @@ Style/Sample:
|
|
5023
5187
|
Description: >-
|
5024
5188
|
Use `sample` instead of `shuffle.first`,
|
5025
5189
|
`shuffle.last`, and `shuffle[Integer]`.
|
5026
|
-
Reference: 'https://github.com/
|
5190
|
+
Reference: 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
5027
5191
|
Enabled: true
|
5028
5192
|
VersionAdded: '0.30'
|
5029
5193
|
|
@@ -5088,6 +5252,12 @@ Style/SingleLineBlockParams:
|
|
5088
5252
|
- acc
|
5089
5253
|
- elem
|
5090
5254
|
|
5255
|
+
Style/SingleLineDoEndBlock:
|
5256
|
+
Description: 'Checks for single-line `do`...`end` blocks.'
|
5257
|
+
StyleGuide: '#single-line-do-end-block'
|
5258
|
+
Enabled: pending
|
5259
|
+
VersionAdded: '1.57'
|
5260
|
+
|
5091
5261
|
Style/SingleLineMethods:
|
5092
5262
|
Description: 'Avoid single-line methods.'
|
5093
5263
|
StyleGuide: '#no-single-line-methods'
|
@@ -5097,7 +5267,8 @@ Style/SingleLineMethods:
|
|
5097
5267
|
AllowIfMethodIsEmpty: true
|
5098
5268
|
|
5099
5269
|
Style/SlicingWithRange:
|
5100
|
-
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
5270
|
+
Description: 'Checks array slicing is done with redundant, endless, and beginless ranges when suitable.'
|
5271
|
+
StyleGuide: '#slicing-with-ranges'
|
5101
5272
|
Enabled: true
|
5102
5273
|
VersionAdded: '0.83'
|
5103
5274
|
Safe: false
|
@@ -5224,6 +5395,12 @@ Style/StructInheritance:
|
|
5224
5395
|
VersionAdded: '0.29'
|
5225
5396
|
VersionChanged: '1.20'
|
5226
5397
|
|
5398
|
+
Style/SuperWithArgsParentheses:
|
5399
|
+
Description: 'Use parentheses for `super` with arguments.'
|
5400
|
+
StyleGuide: '#super-with-args'
|
5401
|
+
Enabled: pending
|
5402
|
+
VersionAdded: '1.58'
|
5403
|
+
|
5227
5404
|
Style/SwapValues:
|
5228
5405
|
Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
|
5229
5406
|
StyleGuide: '#values-swapping'
|
@@ -5480,6 +5657,11 @@ Style/WordArray:
|
|
5480
5657
|
# The regular expression `WordRegex` decides what is considered a word.
|
5481
5658
|
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
5482
5659
|
|
5660
|
+
Style/YAMLFileRead:
|
5661
|
+
Description: 'Checks for the use of `YAML.load`, `YAML.safe_load`, and `YAML.parse` with `File.read` argument.'
|
5662
|
+
Enabled: pending
|
5663
|
+
VersionAdded: '1.53'
|
5664
|
+
|
5483
5665
|
Style/YodaCondition:
|
5484
5666
|
Description: 'Forbid or enforce yoda conditions.'
|
5485
5667
|
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
|