rubocop 1.68.0 → 1.71.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 +2 -2
- data/config/default.yml +77 -8
- data/lib/rubocop/cli/command/execute_runner.rb +3 -3
- data/lib/rubocop/cli/command/show_cops.rb +24 -2
- data/lib/rubocop/comment_config.rb +1 -1
- data/lib/rubocop/config.rb +13 -4
- data/lib/rubocop/config_loader.rb +4 -0
- data/lib/rubocop/config_loader_resolver.rb +14 -3
- data/lib/rubocop/config_validator.rb +18 -8
- data/lib/rubocop/cop/autocorrect_logic.rb +32 -35
- data/lib/rubocop/cop/base.rb +7 -1
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +2 -2
- data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
- data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +1 -1
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +1 -2
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +0 -2
- data/lib/rubocop/cop/generator.rb +6 -0
- data/lib/rubocop/cop/internal_affairs/cop_enabled.rb +85 -0
- data/lib/rubocop/cop/internal_affairs/location_expression.rb +2 -1
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -4
- data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +3 -2
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -1
- 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 +229 -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/redundant_source_range.rb +3 -1
- data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +5 -4
- data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +0 -2
- data/lib/rubocop/cop/internal_affairs.rb +5 -0
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/argument_alignment.rb +2 -9
- data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +0 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +1 -2
- data/lib/rubocop/cop/layout/class_structure.rb +9 -9
- data/lib/rubocop/cop/layout/dot_position.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +7 -11
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +3 -3
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +5 -6
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +4 -5
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +3 -1
- data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +3 -8
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -7
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -7
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +6 -4
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -0
- data/lib/rubocop/cop/layout/indentation_width.rb +7 -7
- data/lib/rubocop/cop/layout/leading_comment_space.rb +15 -0
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +11 -2
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +7 -1
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/line_length.rb +119 -4
- 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 +2 -2
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -3
- data/lib/rubocop/cop/layout/parameter_alignment.rb +3 -4
- data/lib/rubocop/cop/layout/redundant_line_break.rb +10 -41
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +4 -3
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
- data/lib/rubocop/cop/layout/space_after_comma.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -1
- data/lib/rubocop/cop/layout/space_around_operators.rb +19 -20
- 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 +6 -0
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +4 -0
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +0 -1
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +5 -3
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
- data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +119 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -3
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +10 -12
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +6 -0
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
- data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
- data/lib/rubocop/cop/lint/debugger.rb +1 -1
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +2 -1
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_set_element.rb +20 -7
- data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
- data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
- data/lib/rubocop/cop/lint/empty_file.rb +0 -2
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/float_comparison.rb +19 -8
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -4
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +1 -1
- data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
- data/lib/rubocop/cop/lint/interpolation_check.rb +9 -0
- data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +3 -0
- data/lib/rubocop/cop/lint/literal_as_condition.rb +1 -0
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +24 -6
- data/lib/rubocop/cop/lint/missing_super.rb +2 -2
- data/lib/rubocop/cop/lint/mixed_case_range.rb +3 -6
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +9 -5
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +2 -2
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +5 -3
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -3
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +0 -1
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -2
- data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +93 -0
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +1 -2
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +3 -2
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -5
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +12 -7
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +8 -7
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -2
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +1 -1
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +0 -1
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_type.rb +3 -7
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +8 -1
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +2 -0
- data/lib/rubocop/cop/lint/self_assignment.rb +8 -10
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/shared_mutable_default.rb +65 -0
- data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
- data/lib/rubocop/cop/lint/syntax.rb +4 -1
- data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +1 -1
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +1 -1
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_code.rb +51 -2
- data/lib/rubocop/cop/lint/unreachable_loop.rb +1 -1
- data/lib/rubocop/cop/lint/unused_method_argument.rb +18 -2
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +4 -4
- data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -0
- data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/useless_numeric_operation.rb +2 -1
- data/lib/rubocop/cop/lint/useless_rescue.rb +1 -1
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +2 -2
- data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -25
- data/lib/rubocop/cop/lint/void.rb +8 -11
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/class_length.rb +9 -9
- data/lib/rubocop/cop/metrics/collection_literal_length.rb +7 -0
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/method_length.rb +8 -1
- data/lib/rubocop/cop/metrics/module_length.rb +1 -1
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +2 -3
- data/lib/rubocop/cop/mixin/check_assignment.rb +4 -12
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +11 -11
- data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +49 -0
- data/lib/rubocop/cop/mixin/comments_help.rb +7 -2
- data/lib/rubocop/cop/mixin/dig_help.rb +27 -0
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -1
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +4 -4
- data/lib/rubocop/cop/mixin/hash_subset.rb +188 -0
- data/lib/rubocop/cop/mixin/line_length_help.rb +5 -4
- data/lib/rubocop/cop/mixin/method_complexity.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +5 -9
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +68 -30
- data/lib/rubocop/cop/mixin/range_help.rb +0 -1
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +8 -3
- data/lib/rubocop/cop/mixin/string_help.rb +1 -1
- data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +3 -3
- data/lib/rubocop/cop/naming/accessor_method_name.rb +6 -6
- data/lib/rubocop/cop/naming/block_forwarding.rb +19 -15
- data/lib/rubocop/cop/naming/constant_name.rb +6 -7
- data/lib/rubocop/cop/naming/file_name.rb +0 -2
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +11 -12
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +6 -14
- data/lib/rubocop/cop/naming/variable_name.rb +3 -4
- data/lib/rubocop/cop/naming/variable_number.rb +2 -3
- data/lib/rubocop/cop/security/compound_hash.rb +2 -0
- data/lib/rubocop/cop/security/yaml_load.rb +3 -2
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +86 -28
- data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +1 -1
- data/lib/rubocop/cop/style/and_or.rb +1 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +39 -23
- data/lib/rubocop/cop/style/array_first_last.rb +18 -2
- data/lib/rubocop/cop/style/array_intersect.rb +5 -4
- data/lib/rubocop/cop/style/bitwise_predicate.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +24 -22
- data/lib/rubocop/cop/style/case_like_if.rb +8 -11
- data/lib/rubocop/cop/style/class_and_module_children.rb +6 -3
- data/lib/rubocop/cop/style/collection_methods.rb +1 -1
- data/lib/rubocop/cop/style/combinable_defined.rb +1 -1
- data/lib/rubocop/cop/style/combinable_loops.rb +2 -2
- data/lib/rubocop/cop/style/commented_keyword.rb +11 -1
- data/lib/rubocop/cop/style/concat_array_literals.rb +1 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +25 -25
- data/lib/rubocop/cop/style/constant_visibility.rb +3 -12
- data/lib/rubocop/cop/style/dig_chain.rb +89 -0
- data/lib/rubocop/cop/style/documentation.rb +1 -1
- data/lib/rubocop/cop/style/double_negation.rb +3 -3
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +4 -7
- data/lib/rubocop/cop/style/each_with_object.rb +2 -3
- data/lib/rubocop/cop/style/empty_else.rb +4 -2
- data/lib/rubocop/cop/style/empty_literal.rb +1 -1
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/eval_with_location.rb +1 -1
- data/lib/rubocop/cop/style/exact_regexp_match.rb +2 -3
- data/lib/rubocop/cop/style/explicit_block_argument.rb +15 -2
- data/lib/rubocop/cop/style/exponential_notation.rb +1 -1
- data/lib/rubocop/cop/style/fetch_env_var.rb +2 -1
- data/lib/rubocop/cop/style/file_null.rb +89 -0
- data/lib/rubocop/cop/style/file_touch.rb +75 -0
- data/lib/rubocop/cop/style/float_division.rb +8 -4
- data/lib/rubocop/cop/style/for.rb +0 -1
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
- data/lib/rubocop/cop/style/global_vars.rb +1 -3
- data/lib/rubocop/cop/style/guard_clause.rb +1 -1
- data/lib/rubocop/cop/style/hash_conversion.rb +1 -2
- data/lib/rubocop/cop/style/hash_each_methods.rb +3 -6
- data/lib/rubocop/cop/style/hash_except.rb +35 -147
- data/lib/rubocop/cop/style/hash_slice.rb +80 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +6 -3
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +22 -3
- data/lib/rubocop/cop/style/if_inside_else.rb +0 -1
- data/lib/rubocop/cop/style/if_unless_modifier.rb +3 -3
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +2 -3
- data/lib/rubocop/cop/style/if_with_semicolon.rb +20 -9
- data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +6 -7
- data/lib/rubocop/cop/style/it_assignment.rb +36 -0
- data/lib/rubocop/cop/style/keyword_arguments_merging.rb +2 -2
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +1 -1
- data/lib/rubocop/cop/style/lambda_call.rb +3 -2
- data/lib/rubocop/cop/style/map_into_array.rb +1 -1
- data/lib/rubocop/cop/style/map_to_hash.rb +1 -1
- data/lib/rubocop/cop/style/map_to_set.rb +3 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +20 -13
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +2 -0
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +8 -11
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +2 -4
- data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/missing_else.rb +2 -0
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +33 -3
- data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
- data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
- data/lib/rubocop/cop/style/multiple_comparison.rb +34 -22
- data/lib/rubocop/cop/style/mutable_constant.rb +7 -8
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -5
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +5 -4
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/object_then.rb +14 -15
- data/lib/rubocop/cop/style/one_line_conditional.rb +25 -4
- data/lib/rubocop/cop/style/open_struct_use.rb +5 -5
- data/lib/rubocop/cop/style/operator_method_call.rb +5 -6
- data/lib/rubocop/cop/style/or_assignment.rb +3 -6
- data/lib/rubocop/cop/style/parallel_assignment.rb +9 -18
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +2 -2
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/proc.rb +1 -2
- data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
- data/lib/rubocop/cop/style/raise_args.rb +7 -5
- data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
- data/lib/rubocop/cop/style/redundant_argument.rb +3 -1
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +1 -1
- data/lib/rubocop/cop/style/redundant_condition.rb +38 -23
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +2 -1
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +6 -10
- data/lib/rubocop/cop/style/redundant_each.rb +1 -1
- data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
- data/lib/rubocop/cop/style/redundant_freeze.rb +2 -2
- data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +44 -23
- data/lib/rubocop/cop/style/redundant_parentheses.rb +12 -12
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +4 -0
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +2 -2
- data/lib/rubocop/cop/style/redundant_self.rb +8 -15
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +20 -32
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +4 -4
- data/lib/rubocop/cop/style/redundant_sort.rb +3 -3
- data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -2
- data/lib/rubocop/cop/style/rescue_modifier.rb +2 -3
- data/lib/rubocop/cop/style/return_nil.rb +1 -1
- data/lib/rubocop/cop/style/safe_navigation.rb +2 -2
- data/lib/rubocop/cop/style/select_by_regexp.rb +1 -1
- data/lib/rubocop/cop/style/self_assignment.rb +11 -17
- data/lib/rubocop/cop/style/semicolon.rb +1 -1
- data/lib/rubocop/cop/style/send_with_literal_method_name.rb +2 -1
- data/lib/rubocop/cop/style/signal_exception.rb +2 -3
- data/lib/rubocop/cop/style/single_argument_dig.rb +9 -5
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +12 -3
- data/lib/rubocop/cop/style/single_line_methods.rb +3 -4
- data/lib/rubocop/cop/style/slicing_with_range.rb +40 -11
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +4 -5
- data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
- data/lib/rubocop/cop/style/string_concatenation.rb +14 -13
- data/lib/rubocop/cop/style/string_literals.rb +1 -1
- data/lib/rubocop/cop/style/string_methods.rb +1 -1
- data/lib/rubocop/cop/style/super_arguments.rb +65 -17
- data/lib/rubocop/cop/style/swap_values.rb +4 -15
- data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/top_level_method_definition.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +4 -1
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -4
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
- data/lib/rubocop/cop/style/while_until_modifier.rb +0 -1
- data/lib/rubocop/cop/style/yoda_condition.rb +8 -4
- data/lib/rubocop/cop/style/yoda_expression.rb +2 -1
- data/lib/rubocop/cop/util.rb +11 -4
- data/lib/rubocop/cop/variable_force/variable.rb +14 -2
- data/lib/rubocop/cop/variable_force/variable_table.rb +3 -3
- data/lib/rubocop/cop/variable_force.rb +4 -10
- data/lib/rubocop/cops_documentation_generator.rb +22 -14
- data/lib/rubocop/directive_comment.rb +9 -8
- data/lib/rubocop/formatter/formatter_set.rb +1 -1
- data/lib/rubocop/lsp/diagnostic.rb +189 -0
- data/lib/rubocop/lsp/logger.rb +2 -2
- data/lib/rubocop/lsp/routes.rb +7 -23
- data/lib/rubocop/lsp/runtime.rb +15 -49
- data/lib/rubocop/lsp/stdin_runner.rb +83 -0
- data/lib/rubocop/magic_comment.rb +3 -3
- data/lib/rubocop/options.rb +2 -1
- data/lib/rubocop/path_util.rb +11 -8
- data/lib/rubocop/result_cache.rb +13 -13
- data/lib/rubocop/rspec/expect_offense.rb +6 -2
- data/lib/rubocop/rspec/shared_contexts.rb +4 -1
- data/lib/rubocop/rspec/support.rb +1 -2
- data/lib/rubocop/runner.rb +5 -6
- data/lib/rubocop/target_finder.rb +1 -0
- data/lib/rubocop/target_ruby.rb +15 -0
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +14 -0
- data/lib/ruby_lsp/rubocop/addon.rb +78 -0
- data/lib/ruby_lsp/rubocop/wraps_built_in_lsp_runtime.rb +50 -0
- metadata +36 -15
- data/lib/rubocop/rspec/host_environment_simulation_helper.rb +0 -28
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.71.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
8
8
|
- Jonas Arvidsson
|
9
9
|
- Yuji Nakayama
|
10
|
-
autorequire:
|
11
10
|
bindir: exe
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: json
|
@@ -94,7 +93,7 @@ dependencies:
|
|
94
93
|
requirements:
|
95
94
|
- - ">="
|
96
95
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
96
|
+
version: 2.9.3
|
98
97
|
- - "<"
|
99
98
|
- !ruby/object:Gem::Version
|
100
99
|
version: '3.0'
|
@@ -104,7 +103,7 @@ dependencies:
|
|
104
103
|
requirements:
|
105
104
|
- - ">="
|
106
105
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
106
|
+
version: 2.9.3
|
108
107
|
- - "<"
|
109
108
|
- !ruby/object:Gem::Version
|
110
109
|
version: '3.0'
|
@@ -114,7 +113,7 @@ dependencies:
|
|
114
113
|
requirements:
|
115
114
|
- - ">="
|
116
115
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
116
|
+
version: 1.38.0
|
118
117
|
- - "<"
|
119
118
|
- !ruby/object:Gem::Version
|
120
119
|
version: '2.0'
|
@@ -124,7 +123,7 @@ dependencies:
|
|
124
123
|
requirements:
|
125
124
|
- - ">="
|
126
125
|
- !ruby/object:Gem::Version
|
127
|
-
version: 1.
|
126
|
+
version: 1.38.0
|
128
127
|
- - "<"
|
129
128
|
- !ruby/object:Gem::Version
|
130
129
|
version: '2.0'
|
@@ -151,7 +150,7 @@ dependencies:
|
|
151
150
|
version: 2.4.0
|
152
151
|
- - "<"
|
153
152
|
- !ruby/object:Gem::Version
|
154
|
-
version: '
|
153
|
+
version: '4.0'
|
155
154
|
type: :runtime
|
156
155
|
prerelease: false
|
157
156
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -161,7 +160,7 @@ dependencies:
|
|
161
160
|
version: 2.4.0
|
162
161
|
- - "<"
|
163
162
|
- !ruby/object:Gem::Version
|
164
|
-
version: '
|
163
|
+
version: '4.0'
|
165
164
|
description: |
|
166
165
|
RuboCop is a Ruby code style checking and code formatting tool.
|
167
166
|
It aims to enforce the community-driven Ruby Style Guide.
|
@@ -266,6 +265,7 @@ files:
|
|
266
265
|
- lib/rubocop/cop/ignored_node.rb
|
267
266
|
- lib/rubocop/cop/internal_affairs.rb
|
268
267
|
- lib/rubocop/cop/internal_affairs/cop_description.rb
|
268
|
+
- lib/rubocop/cop/internal_affairs/cop_enabled.rb
|
269
269
|
- lib/rubocop/cop/internal_affairs/create_empty_file.rb
|
270
270
|
- lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb
|
271
271
|
- lib/rubocop/cop/internal_affairs/example_description.rb
|
@@ -279,9 +279,15 @@ files:
|
|
279
279
|
- lib/rubocop/cop/internal_affairs/node_destructuring.rb
|
280
280
|
- lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb
|
281
281
|
- lib/rubocop/cop/internal_affairs/node_matcher_directive.rb
|
282
|
+
- lib/rubocop/cop/internal_affairs/node_pattern_groups.rb
|
283
|
+
- lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb
|
284
|
+
- lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb
|
285
|
+
- lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb
|
282
286
|
- lib/rubocop/cop/internal_affairs/node_type_predicate.rb
|
283
287
|
- lib/rubocop/cop/internal_affairs/numblock_handler.rb
|
284
288
|
- lib/rubocop/cop/internal_affairs/offense_location_keyword.rb
|
289
|
+
- lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb
|
290
|
+
- lib/rubocop/cop/internal_affairs/operator_keyword.rb
|
285
291
|
- lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb
|
286
292
|
- lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb
|
287
293
|
- lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb
|
@@ -403,6 +409,7 @@ files:
|
|
403
409
|
- lib/rubocop/cop/lint/ambiguous_operator_precedence.rb
|
404
410
|
- lib/rubocop/cop/lint/ambiguous_range.rb
|
405
411
|
- lib/rubocop/cop/lint/ambiguous_regexp_literal.rb
|
412
|
+
- lib/rubocop/cop/lint/array_literal_in_regexp.rb
|
406
413
|
- lib/rubocop/cop/lint/assignment_in_condition.rb
|
407
414
|
- lib/rubocop/cop/lint/big_decimal_new.rb
|
408
415
|
- lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb
|
@@ -410,6 +417,7 @@ files:
|
|
410
417
|
- lib/rubocop/cop/lint/circular_argument_reference.rb
|
411
418
|
- lib/rubocop/cop/lint/constant_definition_in_block.rb
|
412
419
|
- lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb
|
420
|
+
- lib/rubocop/cop/lint/constant_reassignment.rb
|
413
421
|
- lib/rubocop/cop/lint/constant_resolution.rb
|
414
422
|
- lib/rubocop/cop/lint/debugger.rb
|
415
423
|
- lib/rubocop/cop/lint/deprecated_class_methods.rb
|
@@ -445,6 +453,7 @@ files:
|
|
445
453
|
- lib/rubocop/cop/lint/float_out_of_range.rb
|
446
454
|
- lib/rubocop/cop/lint/format_parameter_mismatch.rb
|
447
455
|
- lib/rubocop/cop/lint/hash_compare_by_identity.rb
|
456
|
+
- lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb
|
448
457
|
- lib/rubocop/cop/lint/heredoc_method_call_position.rb
|
449
458
|
- lib/rubocop/cop/lint/identity_comparison.rb
|
450
459
|
- lib/rubocop/cop/lint/implicit_string_concatenation.rb
|
@@ -472,6 +481,7 @@ files:
|
|
472
481
|
- lib/rubocop/cop/lint/non_local_exit_from_iterator.rb
|
473
482
|
- lib/rubocop/cop/lint/number_conversion.rb
|
474
483
|
- lib/rubocop/cop/lint/numbered_parameter_assignment.rb
|
484
|
+
- lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb
|
475
485
|
- lib/rubocop/cop/lint/or_assignment_to_constant.rb
|
476
486
|
- lib/rubocop/cop/lint/ordered_magic_comments.rb
|
477
487
|
- lib/rubocop/cop/lint/out_of_range_regexp_ref.rb
|
@@ -507,6 +517,7 @@ files:
|
|
507
517
|
- lib/rubocop/cop/lint/shadowed_argument.rb
|
508
518
|
- lib/rubocop/cop/lint/shadowed_exception.rb
|
509
519
|
- lib/rubocop/cop/lint/shadowing_outer_local_variable.rb
|
520
|
+
- lib/rubocop/cop/lint/shared_mutable_default.rb
|
510
521
|
- lib/rubocop/cop/lint/struct_new_override.rb
|
511
522
|
- lib/rubocop/cop/lint/suppressed_exception.rb
|
512
523
|
- lib/rubocop/cop/lint/symbol_conversion.rb
|
@@ -529,6 +540,7 @@ files:
|
|
529
540
|
- lib/rubocop/cop/lint/uri_regexp.rb
|
530
541
|
- lib/rubocop/cop/lint/useless_access_modifier.rb
|
531
542
|
- lib/rubocop/cop/lint/useless_assignment.rb
|
543
|
+
- lib/rubocop/cop/lint/useless_defined.rb
|
532
544
|
- lib/rubocop/cop/lint/useless_else_without_rescue.rb
|
533
545
|
- lib/rubocop/cop/lint/useless_method_definition.rb
|
534
546
|
- lib/rubocop/cop/lint/useless_numeric_operation.rb
|
@@ -565,6 +577,7 @@ files:
|
|
565
577
|
- lib/rubocop/cop/mixin/auto_corrector.rb
|
566
578
|
- lib/rubocop/cop/mixin/check_assignment.rb
|
567
579
|
- lib/rubocop/cop/mixin/check_line_breakable.rb
|
580
|
+
- lib/rubocop/cop/mixin/check_single_line_suitability.rb
|
568
581
|
- lib/rubocop/cop/mixin/code_length.rb
|
569
582
|
- lib/rubocop/cop/mixin/comments_help.rb
|
570
583
|
- lib/rubocop/cop/mixin/configurable_enforced_style.rb
|
@@ -573,6 +586,7 @@ files:
|
|
573
586
|
- lib/rubocop/cop/mixin/configurable_naming.rb
|
574
587
|
- lib/rubocop/cop/mixin/configurable_numbering.rb
|
575
588
|
- lib/rubocop/cop/mixin/def_node.rb
|
589
|
+
- lib/rubocop/cop/mixin/dig_help.rb
|
576
590
|
- lib/rubocop/cop/mixin/documentation_comment.rb
|
577
591
|
- lib/rubocop/cop/mixin/duplication.rb
|
578
592
|
- lib/rubocop/cop/mixin/empty_lines_around_body.rb
|
@@ -586,6 +600,7 @@ files:
|
|
586
600
|
- lib/rubocop/cop/mixin/gemspec_help.rb
|
587
601
|
- lib/rubocop/cop/mixin/hash_alignment_styles.rb
|
588
602
|
- lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
|
603
|
+
- lib/rubocop/cop/mixin/hash_subset.rb
|
589
604
|
- lib/rubocop/cop/mixin/hash_transform_method.rb
|
590
605
|
- lib/rubocop/cop/mixin/heredoc.rb
|
591
606
|
- lib/rubocop/cop/mixin/integer_node.rb
|
@@ -701,6 +716,7 @@ files:
|
|
701
716
|
- lib/rubocop/cop/style/data_inheritance.rb
|
702
717
|
- lib/rubocop/cop/style/date_time.rb
|
703
718
|
- lib/rubocop/cop/style/def_with_parentheses.rb
|
719
|
+
- lib/rubocop/cop/style/dig_chain.rb
|
704
720
|
- lib/rubocop/cop/style/dir.rb
|
705
721
|
- lib/rubocop/cop/style/dir_empty.rb
|
706
722
|
- lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb
|
@@ -730,7 +746,9 @@ files:
|
|
730
746
|
- lib/rubocop/cop/style/exponential_notation.rb
|
731
747
|
- lib/rubocop/cop/style/fetch_env_var.rb
|
732
748
|
- lib/rubocop/cop/style/file_empty.rb
|
749
|
+
- lib/rubocop/cop/style/file_null.rb
|
733
750
|
- lib/rubocop/cop/style/file_read.rb
|
751
|
+
- lib/rubocop/cop/style/file_touch.rb
|
734
752
|
- lib/rubocop/cop/style/file_write.rb
|
735
753
|
- lib/rubocop/cop/style/float_division.rb
|
736
754
|
- lib/rubocop/cop/style/for.rb
|
@@ -745,6 +763,7 @@ files:
|
|
745
763
|
- lib/rubocop/cop/style/hash_each_methods.rb
|
746
764
|
- lib/rubocop/cop/style/hash_except.rb
|
747
765
|
- lib/rubocop/cop/style/hash_like_case.rb
|
766
|
+
- lib/rubocop/cop/style/hash_slice.rb
|
748
767
|
- lib/rubocop/cop/style/hash_syntax.rb
|
749
768
|
- lib/rubocop/cop/style/hash_transform_keys.rb
|
750
769
|
- lib/rubocop/cop/style/hash_transform_values.rb
|
@@ -761,6 +780,7 @@ files:
|
|
761
780
|
- lib/rubocop/cop/style/inverse_methods.rb
|
762
781
|
- lib/rubocop/cop/style/invertible_unless_condition.rb
|
763
782
|
- lib/rubocop/cop/style/ip_addresses.rb
|
783
|
+
- lib/rubocop/cop/style/it_assignment.rb
|
764
784
|
- lib/rubocop/cop/style/keyword_arguments_merging.rb
|
765
785
|
- lib/rubocop/cop/style/keyword_parameters_order.rb
|
766
786
|
- lib/rubocop/cop/style/lambda.rb
|
@@ -976,11 +996,13 @@ files:
|
|
976
996
|
- lib/rubocop/formatter/worst_offenders_formatter.rb
|
977
997
|
- lib/rubocop/lockfile.rb
|
978
998
|
- lib/rubocop/lsp.rb
|
999
|
+
- lib/rubocop/lsp/diagnostic.rb
|
979
1000
|
- lib/rubocop/lsp/logger.rb
|
980
1001
|
- lib/rubocop/lsp/routes.rb
|
981
1002
|
- lib/rubocop/lsp/runtime.rb
|
982
1003
|
- lib/rubocop/lsp/server.rb
|
983
1004
|
- lib/rubocop/lsp/severity.rb
|
1005
|
+
- lib/rubocop/lsp/stdin_runner.rb
|
984
1006
|
- lib/rubocop/magic_comment.rb
|
985
1007
|
- lib/rubocop/name_similarity.rb
|
986
1008
|
- lib/rubocop/options.rb
|
@@ -991,7 +1013,6 @@ files:
|
|
991
1013
|
- lib/rubocop/result_cache.rb
|
992
1014
|
- lib/rubocop/rspec/cop_helper.rb
|
993
1015
|
- lib/rubocop/rspec/expect_offense.rb
|
994
|
-
- lib/rubocop/rspec/host_environment_simulation_helper.rb
|
995
1016
|
- lib/rubocop/rspec/parallel_formatter.rb
|
996
1017
|
- lib/rubocop/rspec/shared_contexts.rb
|
997
1018
|
- lib/rubocop/rspec/support.rb
|
@@ -1021,17 +1042,18 @@ files:
|
|
1021
1042
|
- lib/rubocop/version.rb
|
1022
1043
|
- lib/rubocop/warning.rb
|
1023
1044
|
- lib/rubocop/yaml_duplication_checker.rb
|
1045
|
+
- lib/ruby_lsp/rubocop/addon.rb
|
1046
|
+
- lib/ruby_lsp/rubocop/wraps_built_in_lsp_runtime.rb
|
1024
1047
|
homepage: https://github.com/rubocop/rubocop
|
1025
1048
|
licenses:
|
1026
1049
|
- MIT
|
1027
1050
|
metadata:
|
1028
1051
|
homepage_uri: https://rubocop.org/
|
1029
|
-
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.
|
1052
|
+
changelog_uri: https://github.com/rubocop/rubocop/releases/tag/v1.71.2
|
1030
1053
|
source_code_uri: https://github.com/rubocop/rubocop/
|
1031
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
1054
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.71/
|
1032
1055
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
1033
1056
|
rubygems_mfa_required: 'true'
|
1034
|
-
post_install_message:
|
1035
1057
|
rdoc_options: []
|
1036
1058
|
require_paths:
|
1037
1059
|
- lib
|
@@ -1046,8 +1068,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1046
1068
|
- !ruby/object:Gem::Version
|
1047
1069
|
version: '0'
|
1048
1070
|
requirements: []
|
1049
|
-
rubygems_version: 3.
|
1050
|
-
signing_key:
|
1071
|
+
rubygems_version: 3.6.2
|
1051
1072
|
specification_version: 4
|
1052
1073
|
summary: Automatic Ruby code style checking tool.
|
1053
1074
|
test_files: []
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# RuboCop can be run in contexts where unexpected other libraries are included,
|
4
|
-
# which may interfere with its normal behavior. In order to test those
|
5
|
-
# situations, it may be necessary to require another library for the duration
|
6
|
-
# of one spec
|
7
|
-
module HostEnvironmentSimulatorHelper
|
8
|
-
def in_its_own_process_with(*files)
|
9
|
-
if ::Process.respond_to?(:fork)
|
10
|
-
pid = ::Process.fork do
|
11
|
-
# Need to write coverage result under different name
|
12
|
-
if defined?(SimpleCov)
|
13
|
-
SimpleCov.command_name "rspec-fork-#{Process.pid}"
|
14
|
-
SimpleCov.pid = Process.pid
|
15
|
-
end
|
16
|
-
|
17
|
-
files.each { |file| require file }
|
18
|
-
yield
|
19
|
-
end
|
20
|
-
::Process.wait(pid)
|
21
|
-
|
22
|
-
# assert that the block did not fail
|
23
|
-
expect($CHILD_STATUS).to be_success
|
24
|
-
else
|
25
|
-
warn 'Process.fork is not available.'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|