rubocop 1.12.1 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/config/default.yml +10 -0
- data/exe/rubocop +1 -3
- data/lib/rubocop.rb +1 -1
- data/lib/rubocop/cached_data.rb +1 -3
- data/lib/rubocop/cli.rb +4 -6
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +9 -19
- data/lib/rubocop/cli/command/init_dotfile.rb +1 -3
- data/lib/rubocop/cli/command/show_cops.rb +1 -4
- data/lib/rubocop/comment_config.rb +2 -7
- data/lib/rubocop/config.rb +11 -26
- data/lib/rubocop/config_loader.rb +5 -11
- data/lib/rubocop/config_loader_resolver.rb +22 -14
- data/lib/rubocop/config_obsoletion/cop_rule.rb +1 -2
- data/lib/rubocop/config_store.rb +1 -2
- data/lib/rubocop/config_validator.rb +5 -10
- data/lib/rubocop/cop/autocorrect_logic.rb +3 -8
- data/lib/rubocop/cop/badge.rb +1 -2
- data/lib/rubocop/cop/base.rb +8 -6
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -2
- data/lib/rubocop/cop/bundler/gem_comment.rb +42 -8
- data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -4
- data/lib/rubocop/cop/commissioner.rb +2 -8
- data/lib/rubocop/cop/cop.rb +4 -18
- data/lib/rubocop/cop/corrector.rb +1 -4
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +3 -6
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +2 -4
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +1 -2
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +3 -6
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +1 -3
- data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -3
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -8
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -2
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -4
- data/lib/rubocop/cop/generator.rb +1 -4
- data/lib/rubocop/cop/generator/configuration_injector.rb +1 -2
- data/lib/rubocop/cop/generator/require_file_injector.rb +2 -5
- data/lib/rubocop/cop/internal_affairs/example_description.rb +6 -4
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +2 -5
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +1 -3
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -3
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +1 -2
- data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +1 -2
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +1 -3
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +1 -2
- data/lib/rubocop/cop/layout/argument_alignment.rb +2 -4
- data/lib/rubocop/cop/layout/assignment_indentation.rb +2 -4
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -4
- data/lib/rubocop/cop/layout/block_alignment.rb +7 -19
- data/lib/rubocop/cop/layout/case_indentation.rb +1 -3
- data/lib/rubocop/cop/layout/class_structure.rb +4 -10
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +4 -15
- data/lib/rubocop/cop/layout/comment_indentation.rb +1 -5
- data/lib/rubocop/cop/layout/def_end_alignment.rb +2 -6
- data/lib/rubocop/cop/layout/dot_position.rb +1 -3
- data/lib/rubocop/cop/layout/else_alignment.rb +1 -3
- data/lib/rubocop/cop/layout/empty_comment.rb +5 -12
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +2 -5
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -6
- data/lib/rubocop/cop/layout/empty_lines.rb +1 -3
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +8 -18
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +2 -8
- data/lib/rubocop/cop/layout/end_alignment.rb +1 -2
- data/lib/rubocop/cop/layout/end_of_line.rb +1 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +3 -7
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +1 -2
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -2
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -5
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -2
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -2
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +1 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +3 -6
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -9
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +2 -6
- data/lib/rubocop/cop/layout/indentation_style.rb +1 -3
- data/lib/rubocop/cop/layout/indentation_width.rb +1 -2
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -4
- data/lib/rubocop/cop/layout/line_length.rb +4 -15
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +1 -2
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +7 -15
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -2
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -2
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +4 -10
- data/lib/rubocop/cop/layout/redundant_line_break.rb +125 -0
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +3 -6
- data/lib/rubocop/cop/layout/space_after_colon.rb +1 -3
- data/lib/rubocop/cop/layout/space_after_method_name.rb +2 -4
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +6 -14
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +1 -2
- data/lib/rubocop/cop/layout/space_around_keyword.rb +3 -6
- data/lib/rubocop/cop/layout/space_around_operators.rb +4 -9
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -2
- data/lib/rubocop/cop/layout/space_before_brackets.rb +1 -3
- data/lib/rubocop/cop/layout/space_before_comment.rb +1 -3
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +5 -11
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +2 -4
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +5 -10
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +2 -7
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -10
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +1 -2
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +1 -2
- data/lib/rubocop/cop/legacy/corrections_proxy.rb +2 -8
- data/lib/rubocop/cop/legacy/corrector.rb +1 -3
- data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -6
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +14 -7
- data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -2
- data/lib/rubocop/cop/lint/constant_resolution.rb +1 -2
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +2 -4
- data/lib/rubocop/cop/lint/deprecated_constants.rb +3 -3
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +2 -5
- data/lib/rubocop/cop/lint/duplicate_branch.rb +1 -2
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +1 -3
- data/lib/rubocop/cop/lint/duplicate_methods.rb +3 -7
- data/lib/rubocop/cop/lint/else_layout.rb +1 -3
- data/lib/rubocop/cop/lint/empty_ensure.rb +1 -3
- data/lib/rubocop/cop/lint/empty_file.rb +1 -3
- data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -3
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -3
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +3 -7
- data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -2
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +3 -6
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -2
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -2
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +3 -7
- data/lib/rubocop/cop/lint/inherit_exception.rb +1 -2
- data/lib/rubocop/cop/lint/interpolation_check.rb +3 -11
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +3 -6
- data/lib/rubocop/cop/lint/loop.rb +1 -2
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +3 -7
- data/lib/rubocop/cop/lint/missing_super.rb +1 -2
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -2
- data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -2
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -3
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +1 -3
- data/lib/rubocop/cop/lint/number_conversion.rb +1 -2
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +1 -2
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +1 -3
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -3
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -3
- data/lib/rubocop/cop/lint/raise_exception.rb +1 -2
- data/lib/rubocop/cop/lint/rand_one.rb +1 -2
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +8 -20
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +1 -3
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +3 -7
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -2
- data/lib/rubocop/cop/lint/redundant_with_index.rb +1 -4
- data/lib/rubocop/cop/lint/redundant_with_object.rb +1 -4
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +1 -3
- data/lib/rubocop/cop/lint/require_parentheses.rb +2 -4
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -2
- data/lib/rubocop/cop/lint/rescue_type.rb +2 -7
- data/lib/rubocop/cop/lint/return_in_void_context.rb +1 -2
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +1 -2
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +4 -10
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -2
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +2 -7
- data/lib/rubocop/cop/lint/shadowed_argument.rb +4 -11
- data/lib/rubocop/cop/lint/shadowed_exception.rb +7 -8
- data/lib/rubocop/cop/lint/struct_new_override.rb +1 -2
- data/lib/rubocop/cop/lint/symbol_conversion.rb +2 -4
- data/lib/rubocop/cop/lint/syntax.rb +1 -3
- data/lib/rubocop/cop/lint/to_json.rb +1 -2
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -3
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -3
- data/lib/rubocop/cop/lint/unreachable_code.rb +2 -5
- data/lib/rubocop/cop/lint/unreachable_loop.rb +2 -5
- data/lib/rubocop/cop/lint/unused_block_argument.rb +4 -8
- data/lib/rubocop/cop/lint/unused_method_argument.rb +1 -2
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +2 -4
- data/lib/rubocop/cop/lint/useless_assignment.rb +4 -9
- data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -3
- data/lib/rubocop/cop/lint/void.rb +4 -11
- data/lib/rubocop/cop/message_annotator.rb +1 -3
- data/lib/rubocop/cop/metrics/block_nesting.rb +2 -7
- data/lib/rubocop/cop/metrics/class_length.rb +1 -3
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -2
- data/lib/rubocop/cop/metrics/module_length.rb +2 -6
- data/lib/rubocop/cop/metrics/parameter_lists.rb +2 -5
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -2
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +4 -7
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +2 -7
- data/lib/rubocop/cop/migration/department_name.rb +3 -7
- data/lib/rubocop/cop/mixin/alignment.rb +2 -4
- data/lib/rubocop/cop/mixin/code_length.rb +1 -3
- data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +2 -2
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +3 -8
- data/lib/rubocop/cop/mixin/def_node.rb +2 -5
- data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -5
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +3 -7
- data/lib/rubocop/cop/mixin/empty_parameter.rb +1 -3
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -3
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -6
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -3
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +3 -9
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +3 -6
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +7 -22
- data/lib/rubocop/cop/mixin/interpolation.rb +1 -3
- data/lib/rubocop/cop/mixin/line_length_help.rb +2 -4
- data/lib/rubocop/cop/mixin/match_range.rb +2 -5
- data/lib/rubocop/cop/mixin/method_complexity.rb +1 -3
- data/lib/rubocop/cop/mixin/method_preference.rb +1 -2
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +1 -2
- data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +1 -3
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +7 -17
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -2
- data/lib/rubocop/cop/mixin/negative_conditional.rb +1 -2
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -4
- data/lib/rubocop/cop/mixin/percent_array.rb +1 -3
- data/lib/rubocop/cop/mixin/percent_literal.rb +0 -6
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +5 -11
- data/lib/rubocop/cop/mixin/preferred_delimiters.rb +3 -6
- data/lib/rubocop/cop/mixin/range_help.rb +10 -13
- data/lib/rubocop/cop/mixin/rescue_node.rb +2 -6
- data/lib/rubocop/cop/mixin/safe_assignment.rb +1 -2
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +2 -4
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -2
- data/lib/rubocop/cop/mixin/statement_modifier.rb +1 -3
- data/lib/rubocop/cop/mixin/trailing_body.rb +1 -2
- data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -2
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +3 -7
- data/lib/rubocop/cop/mixin/unused_argument.rb +1 -3
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +2 -4
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -2
- data/lib/rubocop/cop/naming/file_name.rb +7 -16
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +2 -3
- data/lib/rubocop/cop/naming/method_name.rb +1 -2
- data/lib/rubocop/cop/naming/predicate_name.rb +1 -2
- data/lib/rubocop/cop/offense.rb +3 -8
- data/lib/rubocop/cop/registry.rb +3 -11
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +1 -3
- data/lib/rubocop/cop/style/accessor_grouping.rb +1 -3
- data/lib/rubocop/cop/style/alias.rb +5 -12
- data/lib/rubocop/cop/style/arguments_forwarding.rb +1 -3
- data/lib/rubocop/cop/style/ascii_comments.rb +1 -2
- data/lib/rubocop/cop/style/attr.rb +1 -3
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +2 -5
- data/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb +1 -3
- data/lib/rubocop/cop/style/case_like_if.rb +1 -2
- data/lib/rubocop/cop/style/character_literal.rb +2 -4
- data/lib/rubocop/cop/style/class_and_module_children.rb +3 -6
- data/lib/rubocop/cop/style/class_methods.rb +1 -3
- data/lib/rubocop/cop/style/collection_compact.rb +1 -3
- data/lib/rubocop/cop/style/colon_method_call.rb +1 -3
- data/lib/rubocop/cop/style/combinable_loops.rb +3 -2
- data/lib/rubocop/cop/style/command_literal.rb +3 -8
- data/lib/rubocop/cop/style/comment_annotation.rb +3 -6
- data/lib/rubocop/cop/style/commented_keyword.rb +2 -8
- data/lib/rubocop/cop/style/conditional_assignment.rb +10 -24
- data/lib/rubocop/cop/style/copyright.rb +3 -6
- data/lib/rubocop/cop/style/date_time.rb +2 -5
- data/lib/rubocop/cop/style/def_with_parentheses.rb +1 -2
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -2
- data/lib/rubocop/cop/style/empty_case_condition.rb +2 -7
- data/lib/rubocop/cop/style/empty_else.rb +3 -9
- data/lib/rubocop/cop/style/empty_literal.rb +4 -8
- data/lib/rubocop/cop/style/empty_method.rb +3 -7
- data/lib/rubocop/cop/style/end_block.rb +1 -2
- data/lib/rubocop/cop/style/endless_method.rb +1 -3
- data/lib/rubocop/cop/style/eval_with_location.rb +2 -4
- data/lib/rubocop/cop/style/expand_path_arguments.rb +1 -3
- data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -4
- data/lib/rubocop/cop/style/format_string_token.rb +1 -4
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -8
- data/lib/rubocop/cop/style/guard_clause.rb +3 -7
- data/lib/rubocop/cop/style/hash_conversion.rb +28 -3
- data/lib/rubocop/cop/style/hash_each_methods.rb +1 -2
- data/lib/rubocop/cop/style/hash_like_case.rb +1 -2
- data/lib/rubocop/cop/style/hash_syntax.rb +4 -9
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -3
- data/lib/rubocop/cop/style/if_unless_modifier.rb +41 -13
- data/lib/rubocop/cop/style/infinite_loop.rb +2 -5
- data/lib/rubocop/cop/style/inverse_methods.rb +3 -7
- data/lib/rubocop/cop/style/ip_addresses.rb +1 -2
- data/lib/rubocop/cop/style/lambda.rb +2 -4
- data/lib/rubocop/cop/style/lambda_call.rb +1 -2
- data/lib/rubocop/cop/style/line_end_concatenation.rb +5 -12
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +7 -13
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +1 -2
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +2 -4
- data/lib/rubocop/cop/style/method_def_parentheses.rb +4 -8
- data/lib/rubocop/cop/style/min_max.rb +1 -2
- data/lib/rubocop/cop/style/missing_else.rb +2 -4
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +1 -2
- data/lib/rubocop/cop/style/mixin_grouping.rb +4 -10
- data/lib/rubocop/cop/style/mixin_usage.rb +1 -2
- data/lib/rubocop/cop/style/module_function.rb +3 -6
- data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -2
- data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -3
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -2
- data/lib/rubocop/cop/style/multiple_comparison.rb +2 -4
- data/lib/rubocop/cop/style/mutable_constant.rb +4 -10
- data/lib/rubocop/cop/style/negated_if.rb +1 -2
- data/lib/rubocop/cop/style/negated_unless.rb +1 -2
- data/lib/rubocop/cop/style/nested_modifier.rb +3 -7
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +2 -3
- data/lib/rubocop/cop/style/next.rb +4 -9
- data/lib/rubocop/cop/style/non_nil_check.rb +2 -5
- data/lib/rubocop/cop/style/numeric_literals.rb +3 -11
- data/lib/rubocop/cop/style/numeric_predicate.rb +2 -7
- data/lib/rubocop/cop/style/one_line_conditional.rb +1 -2
- data/lib/rubocop/cop/style/option_hash.rb +1 -3
- data/lib/rubocop/cop/style/optional_arguments.rb +2 -5
- data/lib/rubocop/cop/style/or_assignment.rb +2 -6
- data/lib/rubocop/cop/style/parallel_assignment.rb +6 -9
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -3
- data/lib/rubocop/cop/style/percent_q_literals.rb +1 -2
- data/lib/rubocop/cop/style/perl_backrefs.rb +2 -9
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -4
- data/lib/rubocop/cop/style/proc.rb +1 -2
- data/lib/rubocop/cop/style/raise_args.rb +4 -8
- data/lib/rubocop/cop/style/random_with_offset.rb +3 -8
- data/lib/rubocop/cop/style/redundant_argument.rb +2 -11
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -3
- data/lib/rubocop/cop/style/redundant_begin.rb +4 -4
- data/lib/rubocop/cop/style/redundant_capital_w.rb +1 -2
- data/lib/rubocop/cop/style/redundant_condition.rb +2 -5
- data/lib/rubocop/cop/style/redundant_conditional.rb +3 -6
- data/lib/rubocop/cop/style/redundant_exception.rb +3 -6
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
- data/lib/rubocop/cop/style/redundant_freeze.rb +1 -2
- data/lib/rubocop/cop/style/redundant_interpolation.rb +1 -2
- data/lib/rubocop/cop/style/redundant_parentheses.rb +8 -20
- data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -2
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -4
- data/lib/rubocop/cop/style/redundant_return.rb +3 -5
- data/lib/rubocop/cop/style/redundant_self.rb +2 -6
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +2 -2
- data/lib/rubocop/cop/style/redundant_sort.rb +2 -5
- data/lib/rubocop/cop/style/regexp_literal.rb +4 -8
- data/lib/rubocop/cop/style/rescue_modifier.rb +4 -0
- data/lib/rubocop/cop/style/rescue_standard_error.rb +3 -7
- data/lib/rubocop/cop/style/return_nil.rb +1 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +10 -21
- data/lib/rubocop/cop/style/send.rb +1 -2
- data/lib/rubocop/cop/style/signal_exception.rb +3 -7
- data/lib/rubocop/cop/style/single_argument_dig.rb +1 -2
- data/lib/rubocop/cop/style/single_line_block_params.rb +2 -5
- data/lib/rubocop/cop/style/single_line_methods.rb +15 -4
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +1 -2
- data/lib/rubocop/cop/style/special_global_vars.rb +6 -18
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -2
- data/lib/rubocop/cop/style/stderr_puts.rb +2 -6
- data/lib/rubocop/cop/style/string_chars.rb +2 -1
- data/lib/rubocop/cop/style/string_concatenation.rb +8 -10
- data/lib/rubocop/cop/style/string_literals.rb +2 -5
- data/lib/rubocop/cop/style/struct_inheritance.rb +9 -1
- data/lib/rubocop/cop/style/symbol_literal.rb +1 -3
- data/lib/rubocop/cop/style/symbol_proc.rb +4 -9
- data/lib/rubocop/cop/style/ternary_parentheses.rb +3 -6
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +1 -2
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +2 -6
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +2 -5
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -10
- data/lib/rubocop/cop/style/trivial_accessors.rb +2 -4
- data/lib/rubocop/cop/style/unless_else.rb +1 -2
- data/lib/rubocop/cop/style/unless_logical_operators.rb +2 -2
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
- data/lib/rubocop/cop/style/when_then.rb +1 -3
- data/lib/rubocop/cop/style/while_until_modifier.rb +1 -2
- data/lib/rubocop/cop/style/word_array.rb +1 -2
- data/lib/rubocop/cop/style/yoda_condition.rb +3 -11
- data/lib/rubocop/cop/style/zero_length_predicate.rb +1 -2
- data/lib/rubocop/cop/team.rb +2 -5
- data/lib/rubocop/cop/util.rb +4 -10
- data/lib/rubocop/cop/utils/format_string.rb +1 -3
- data/lib/rubocop/cop/variable_force.rb +6 -15
- data/lib/rubocop/cop/variable_force/assignment.rb +1 -2
- data/lib/rubocop/cop/variable_force/branch.rb +1 -2
- data/lib/rubocop/cop/variable_force/reference.rb +1 -3
- data/lib/rubocop/cop/variable_force/scope.rb +4 -8
- data/lib/rubocop/cop/variable_force/variable.rb +2 -4
- data/lib/rubocop/cops_documentation_generator.rb +7 -21
- data/lib/rubocop/file_finder.rb +1 -3
- data/lib/rubocop/formatter/disabled_config_formatter.rb +3 -8
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +1 -5
- data/lib/rubocop/formatter/html_formatter.rb +4 -10
- data/lib/rubocop/formatter/json_formatter.rb +1 -5
- data/lib/rubocop/formatter/junit_formatter.rb +3 -9
- data/lib/rubocop/formatter/progress_formatter.rb +1 -3
- data/lib/rubocop/options.rb +27 -41
- data/lib/rubocop/path_util.rb +1 -3
- data/lib/rubocop/rake_task.rb +3 -0
- data/lib/rubocop/remote_config.rb +4 -7
- data/lib/rubocop/result_cache.rb +5 -12
- data/lib/rubocop/rspec/cop_helper.rb +1 -1
- data/lib/rubocop/rspec/expect_offense.rb +4 -9
- data/lib/rubocop/rspec/shared_contexts.rb +4 -15
- data/lib/rubocop/runner.rb +7 -14
- data/lib/rubocop/target_finder.rb +11 -16
- data/lib/rubocop/target_ruby.rb +4 -8
- data/lib/rubocop/version.rb +1 -1
- metadata +5 -5
- data/lib/rubocop/core_ext/hash.rb +0 -20
data/lib/rubocop/runner.rb
CHANGED
@@ -112,9 +112,7 @@ module RuboCop
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def list_files(paths)
|
115
|
-
paths.each
|
116
|
-
puts PathUtil.relative_path(path)
|
117
|
-
end
|
115
|
+
paths.each { |path| puts PathUtil.relative_path(path) }
|
118
116
|
end
|
119
117
|
|
120
118
|
def process_file(file)
|
@@ -193,11 +191,10 @@ module RuboCop
|
|
193
191
|
|
194
192
|
def redundant_cop_disable_directive(file)
|
195
193
|
config = @config_store.for_file(file)
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
end
|
194
|
+
return unless config.for_cop(Cop::Lint::RedundantCopDisableDirective).fetch('Enabled')
|
195
|
+
|
196
|
+
cop = Cop::Lint::RedundantCopDisableDirective.new(config, @options)
|
197
|
+
yield cop if cop.relevant_file?(file)
|
201
198
|
end
|
202
199
|
|
203
200
|
def filtered_run?
|
@@ -206,9 +203,7 @@ module RuboCop
|
|
206
203
|
|
207
204
|
def file_started(file)
|
208
205
|
puts "Scanning #{file}" if @options[:debug]
|
209
|
-
formatter_set.file_started(file,
|
210
|
-
cli_options: @options,
|
211
|
-
config_store: @config_store)
|
206
|
+
formatter_set.file_started(file, cli_options: @options, config_store: @config_store)
|
212
207
|
end
|
213
208
|
|
214
209
|
def file_finished(file, offenses)
|
@@ -372,9 +367,7 @@ module RuboCop
|
|
372
367
|
@formatter_set ||= begin
|
373
368
|
set = Formatter::FormatterSet.new(@options)
|
374
369
|
pairs = @options[:formatters] || [['progress']]
|
375
|
-
pairs.each
|
376
|
-
set.add_formatter(formatter_key, output_path)
|
377
|
-
end
|
370
|
+
pairs.each { |formatter_key, output_path| set.add_formatter(formatter_key, output_path) }
|
378
371
|
set
|
379
372
|
end
|
380
373
|
end
|
@@ -61,9 +61,7 @@ module RuboCop
|
|
61
61
|
hidden_files = all_files.select { |file| file.include?(HIDDEN_PATH_SUBSTRING) }.sort
|
62
62
|
base_dir_config = @config_store.for(base_dir)
|
63
63
|
|
64
|
-
target_files = all_files.select
|
65
|
-
to_inspect?(file, hidden_files, base_dir_config)
|
66
|
-
end
|
64
|
+
target_files = all_files.select { |file| to_inspect?(file, hidden_files, base_dir_config) }
|
67
65
|
|
68
66
|
target_files.sort_by!(&order)
|
69
67
|
end
|
@@ -99,10 +97,13 @@ module RuboCop
|
|
99
97
|
base_dir = base_dir.gsub('/{}/', '/\{}/')
|
100
98
|
dirs = Dir.glob(File.join(base_dir.gsub('/**/', '/\**/'), '*/'), flags)
|
101
99
|
.reject do |dir|
|
102
|
-
dir.end_with?('/./', '/../')
|
100
|
+
next true if dir.end_with?('/./', '/../')
|
101
|
+
next true if File.fnmatch?(exclude_pattern, dir, flags)
|
102
|
+
|
103
|
+
File.symlink?(dir.chomp('/')) && File.fnmatch?(exclude_pattern,
|
104
|
+
"#{File.realpath(dir)}/", flags)
|
103
105
|
end
|
104
|
-
dirs.flat_map { |dir| wanted_dir_patterns(dir, exclude_pattern, flags) }
|
105
|
-
.unshift(base_dir)
|
106
|
+
dirs.flat_map { |dir| wanted_dir_patterns(dir, exclude_pattern, flags) }.unshift(base_dir)
|
106
107
|
end
|
107
108
|
|
108
109
|
def combined_exclude_glob_patterns(base_dir)
|
@@ -118,9 +119,7 @@ module RuboCop
|
|
118
119
|
|
119
120
|
def ruby_extensions
|
120
121
|
@ruby_extensions ||= begin
|
121
|
-
ext_patterns = all_cops_include.select
|
122
|
-
pattern.start_with?('**/*.')
|
123
|
-
end
|
122
|
+
ext_patterns = all_cops_include.select { |pattern| pattern.start_with?('**/*.') }
|
124
123
|
ext_patterns.map { |pattern| pattern.sub('**/*', '') }
|
125
124
|
end
|
126
125
|
end
|
@@ -131,16 +130,13 @@ module RuboCop
|
|
131
130
|
|
132
131
|
def ruby_filenames
|
133
132
|
@ruby_filenames ||= begin
|
134
|
-
file_patterns = all_cops_include.reject
|
135
|
-
pattern.start_with?('**/*.')
|
136
|
-
end
|
133
|
+
file_patterns = all_cops_include.reject { |pattern| pattern.start_with?('**/*.') }
|
137
134
|
file_patterns.map { |pattern| pattern.sub('**/', '') }
|
138
135
|
end
|
139
136
|
end
|
140
137
|
|
141
138
|
def all_cops_include
|
142
|
-
@all_cops_include ||=
|
143
|
-
@config_store.for_pwd.for_all_cops['Include'].map(&:to_s)
|
139
|
+
@all_cops_include ||= @config_store.for_pwd.for_all_cops['Include'].map(&:to_s)
|
144
140
|
end
|
145
141
|
|
146
142
|
def ruby_executable?(file)
|
@@ -163,8 +159,7 @@ module RuboCop
|
|
163
159
|
end
|
164
160
|
|
165
161
|
def ruby_file?(file)
|
166
|
-
stdin? || ruby_extension?(file) || ruby_filename?(file) ||
|
167
|
-
ruby_executable?(file)
|
162
|
+
stdin? || ruby_extension?(file) || ruby_filename?(file) || ruby_executable?(file)
|
168
163
|
end
|
169
164
|
|
170
165
|
def configured_include?(file)
|
data/lib/rubocop/target_ruby.rb
CHANGED
@@ -4,11 +4,11 @@ module RuboCop
|
|
4
4
|
# The kind of Ruby that code inspected by RuboCop is written in.
|
5
5
|
# @api private
|
6
6
|
class TargetRuby
|
7
|
-
KNOWN_RUBIES = [2.
|
7
|
+
KNOWN_RUBIES = [2.5, 2.6, 2.7, 3.0].freeze
|
8
8
|
DEFAULT_VERSION = KNOWN_RUBIES.first
|
9
9
|
|
10
10
|
OBSOLETE_RUBIES = {
|
11
|
-
1.9 => '0.41', 2.0 => '0.50', 2.1 => '0.57', 2.2 => '0.68', 2.3 => '0.81'
|
11
|
+
1.9 => '0.41', 2.0 => '0.50', 2.1 => '0.57', 2.2 => '0.68', 2.3 => '0.81', 2.4 => '1.12'
|
12
12
|
}.freeze
|
13
13
|
private_constant :KNOWN_RUBIES, :OBSOLETE_RUBIES
|
14
14
|
|
@@ -65,15 +65,11 @@ module RuboCop
|
|
65
65
|
file = version_file
|
66
66
|
return unless file && File.file?(file)
|
67
67
|
|
68
|
-
File.read(file).match(pattern)
|
69
|
-
md[:version].to_f
|
70
|
-
end
|
68
|
+
File.read(file).match(pattern) { |md| md[:version].to_f }
|
71
69
|
end
|
72
70
|
|
73
71
|
def version_file
|
74
|
-
@version_file ||=
|
75
|
-
@config.find_file_upwards(filename,
|
76
|
-
@config.base_dir_for_path_parameters)
|
72
|
+
@version_file ||= @config.find_file_upwards(filename, @config.base_dir_for_path_parameters)
|
77
73
|
end
|
78
74
|
end
|
79
75
|
|
data/lib/rubocop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-04-
|
13
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parallel
|
@@ -331,6 +331,7 @@ files:
|
|
331
331
|
- lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb
|
332
332
|
- lib/rubocop/cop/layout/multiline_operation_indentation.rb
|
333
333
|
- lib/rubocop/cop/layout/parameter_alignment.rb
|
334
|
+
- lib/rubocop/cop/layout/redundant_line_break.rb
|
334
335
|
- lib/rubocop/cop/layout/rescue_ensure_alignment.rb
|
335
336
|
- lib/rubocop/cop/layout/space_after_colon.rb
|
336
337
|
- lib/rubocop/cop/layout/space_after_comma.rb
|
@@ -814,7 +815,6 @@ files:
|
|
814
815
|
- lib/rubocop/cop/variable_force/variable.rb
|
815
816
|
- lib/rubocop/cop/variable_force/variable_table.rb
|
816
817
|
- lib/rubocop/cops_documentation_generator.rb
|
817
|
-
- lib/rubocop/core_ext/hash.rb
|
818
818
|
- lib/rubocop/core_ext/string.rb
|
819
819
|
- lib/rubocop/directive_comment.rb
|
820
820
|
- lib/rubocop/error.rb
|
@@ -872,7 +872,7 @@ metadata:
|
|
872
872
|
homepage_uri: https://rubocop.org/
|
873
873
|
changelog_uri: https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md
|
874
874
|
source_code_uri: https://github.com/rubocop/rubocop/
|
875
|
-
documentation_uri: https://docs.rubocop.org/rubocop/1.
|
875
|
+
documentation_uri: https://docs.rubocop.org/rubocop/1.13/
|
876
876
|
bug_tracker_uri: https://github.com/rubocop/rubocop/issues
|
877
877
|
post_install_message:
|
878
878
|
rdoc_options: []
|
@@ -882,7 +882,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
882
882
|
requirements:
|
883
883
|
- - ">="
|
884
884
|
- !ruby/object:Gem::Version
|
885
|
-
version: 2.
|
885
|
+
version: 2.5.0
|
886
886
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
887
887
|
requirements:
|
888
888
|
- - ">="
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Extensions to the core Hash class
|
4
|
-
class Hash
|
5
|
-
unless method_defined?(:slice)
|
6
|
-
# Adds `Hash#slice` for Ruby 2.4.
|
7
|
-
# Returns a hash containing a subset of keys. If a given key is not
|
8
|
-
# in the hash, it will not be returned.
|
9
|
-
#
|
10
|
-
# @return [Hash] hash containing only the keys given.
|
11
|
-
#
|
12
|
-
# @example
|
13
|
-
# { one: 1, two: 2 }.slice(:two, :three) #=> { two: 2 }
|
14
|
-
def slice(*keys)
|
15
|
-
h = {}
|
16
|
-
keys.each { |k| h[k] = self[k] if key?(k) }
|
17
|
-
h
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|