rubocop 1.9.1 → 1.22.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -14
- data/assets/output.html.erb +1 -1
- data/config/default.yml +326 -73
- data/config/obsoletion.yml +4 -0
- data/exe/rubocop +1 -3
- data/lib/rubocop/cached_data.rb +1 -3
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +9 -19
- data/lib/rubocop/cli/command/execute_runner.rb +1 -1
- data/lib/rubocop/cli/command/init_dotfile.rb +1 -3
- data/lib/rubocop/cli/command/show_cops.rb +1 -4
- data/lib/rubocop/cli/command/suggest_extensions.rb +6 -5
- data/lib/rubocop/cli.rb +21 -5
- data/lib/rubocop/comment_config.rb +45 -101
- data/lib/rubocop/config.rb +16 -26
- data/lib/rubocop/config_loader.rb +11 -15
- data/lib/rubocop/config_loader_resolver.rb +44 -21
- data/lib/rubocop/config_obsoletion/cop_rule.rb +1 -2
- data/lib/rubocop/config_store.rb +1 -2
- data/lib/rubocop/config_validator.rb +37 -21
- data/lib/rubocop/cop/autocorrect_logic.rb +3 -8
- data/lib/rubocop/cop/badge.rb +1 -2
- data/lib/rubocop/cop/base.rb +13 -11
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +4 -4
- data/lib/rubocop/cop/bundler/gem_comment.rb +43 -10
- data/lib/rubocop/cop/bundler/gem_filename.rb +103 -0
- data/lib/rubocop/cop/bundler/gem_version.rb +133 -0
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +46 -21
- data/lib/rubocop/cop/bundler/ordered_gems.rb +5 -16
- data/lib/rubocop/cop/commissioner.rb +2 -8
- data/lib/rubocop/cop/cop.rb +4 -18
- data/lib/rubocop/cop/corrector.rb +5 -8
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +6 -12
- 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/lambda_literal_to_method_corrector.rb +2 -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 +11 -12
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -8
- data/lib/rubocop/cop/correctors/require_library_corrector.rb +23 -0
- data/lib/rubocop/cop/documentation.rb +1 -1
- data/lib/rubocop/cop/gemspec/date_assignment.rb +57 -0
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +3 -2
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +5 -16
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +32 -23
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +2 -0
- 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/generator.rb +18 -15
- data/lib/rubocop/cop/internal_affairs/example_description.rb +8 -5
- data/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb +34 -0
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +60 -0
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +3 -5
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +3 -3
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +151 -0
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +2 -3
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +3 -2
- data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +3 -0
- data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +5 -2
- data/lib/rubocop/cop/internal_affairs/undefined_config.rb +71 -0
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +3 -3
- data/lib/rubocop/cop/internal_affairs.rb +4 -0
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +12 -10
- data/lib/rubocop/cop/layout/argument_alignment.rb +36 -19
- data/lib/rubocop/cop/layout/array_alignment.rb +9 -8
- data/lib/rubocop/cop/layout/assignment_indentation.rb +9 -8
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -4
- data/lib/rubocop/cop/layout/block_alignment.rb +12 -23
- data/lib/rubocop/cop/layout/block_end_newline.rb +4 -8
- data/lib/rubocop/cop/layout/case_indentation.rb +57 -11
- data/lib/rubocop/cop/layout/class_structure.rb +12 -12
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +24 -30
- data/lib/rubocop/cop/layout/comment_indentation.rb +18 -22
- data/lib/rubocop/cop/layout/def_end_alignment.rb +2 -6
- data/lib/rubocop/cop/layout/dot_position.rb +42 -9
- data/lib/rubocop/cop/layout/else_alignment.rb +10 -9
- data/lib/rubocop/cop/layout/empty_comment.rb +6 -13
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +44 -23
- 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 +9 -12
- data/lib/rubocop/cop/layout/end_alignment.rb +10 -4
- data/lib/rubocop/cop/layout/end_of_line.rb +1 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +5 -9
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +12 -6
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +13 -11
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -2
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +37 -21
- 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/first_parameter_indentation.rb +8 -7
- data/lib/rubocop/cop/layout/hash_alignment.rb +58 -31
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +4 -11
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +2 -13
- data/lib/rubocop/cop/layout/indentation_consistency.rb +9 -6
- data/lib/rubocop/cop/layout/indentation_style.rb +25 -30
- data/lib/rubocop/cop/layout/indentation_width.rb +34 -13
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -4
- data/lib/rubocop/cop/layout/leading_comment_space.rb +2 -2
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +141 -0
- data/lib/rubocop/cop/layout/line_length.rb +13 -22
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +6 -6
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +1 -2
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +29 -3
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +10 -18
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +6 -6
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -2
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +4 -2
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +6 -6
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +22 -15
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +6 -6
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +13 -8
- data/lib/rubocop/cop/layout/parameter_alignment.rb +8 -7
- data/lib/rubocop/cop/layout/redundant_line_break.rb +140 -0
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +26 -16
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +64 -0
- 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_after_not.rb +1 -0
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +6 -14
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_keyword.rb +33 -8
- data/lib/rubocop/cop/layout/space_around_operators.rb +23 -11
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -3
- data/lib/rubocop/cop/layout/space_before_brackets.rb +3 -4
- data/lib/rubocop/cop/layout/space_before_comment.rb +3 -5
- 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 +6 -11
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +1 -2
- data/lib/rubocop/cop/layout/space_inside_parens.rb +78 -32
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +1 -2
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +24 -1
- 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/ambiguous_operator_precedence.rb +111 -0
- data/lib/rubocop/cop/lint/ambiguous_range.rb +105 -0
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +5 -2
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +7 -5
- data/lib/rubocop/cop/lint/big_decimal_new.rb +1 -0
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +18 -5
- data/lib/rubocop/cop/lint/boolean_symbol.rb +7 -2
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +2 -0
- data/lib/rubocop/cop/lint/constant_resolution.rb +2 -2
- data/lib/rubocop/cop/lint/debugger.rb +59 -15
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +83 -41
- data/lib/rubocop/cop/lint/deprecated_constants.rb +5 -4
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +16 -9
- data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +24 -1
- data/lib/rubocop/cop/lint/duplicate_branch.rb +4 -4
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +1 -3
- data/lib/rubocop/cop/lint/duplicate_methods.rb +14 -12
- data/lib/rubocop/cop/lint/duplicate_require.rb +3 -2
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -0
- data/lib/rubocop/cop/lint/else_layout.rb +12 -10
- data/lib/rubocop/cop/lint/empty_block.rb +18 -2
- 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_in_pattern.rb +62 -0
- 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 +4 -7
- data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -2
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +4 -6
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +13 -3
- 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/incompatible_io_select_with_fiber_scheduler.rb +67 -0
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +4 -7
- data/lib/rubocop/cop/lint/inherit_exception.rb +2 -2
- data/lib/rubocop/cop/lint/interpolation_check.rb +8 -11
- data/lib/rubocop/cop/lint/literal_as_condition.rb +13 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +3 -6
- data/lib/rubocop/cop/lint/loop.rb +5 -5
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +32 -21
- 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/multiple_comparison.rb +5 -4
- data/lib/rubocop/cop/lint/nested_method_definition.rb +4 -2
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +2 -4
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +13 -4
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -0
- data/lib/rubocop/cop/lint/number_conversion.rb +25 -6
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +4 -2
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +1 -2
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +18 -3
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -3
- data/lib/rubocop/cop/lint/percent_string_array.rb +11 -1
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +2 -4
- data/lib/rubocop/cop/lint/raise_exception.rb +7 -2
- data/lib/rubocop/cop/lint/rand_one.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +108 -90
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +5 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +1 -0
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +7 -7
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +10 -10
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_with_index.rb +2 -4
- data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -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/require_relative_self_path.rb +50 -0
- 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 +2 -2
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +4 -10
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +2 -2
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +3 -7
- data/lib/rubocop/cop/lint/shadowed_argument.rb +6 -12
- data/lib/rubocop/cop/lint/shadowed_exception.rb +7 -8
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +2 -1
- data/lib/rubocop/cop/lint/struct_new_override.rb +2 -2
- data/lib/rubocop/cop/lint/suppressed_exception.rb +44 -1
- data/lib/rubocop/cop/lint/symbol_conversion.rb +86 -11
- data/lib/rubocop/cop/lint/syntax.rb +1 -3
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +3 -0
- 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/triple_quotes.rb +1 -1
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -3
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +8 -3
- data/lib/rubocop/cop/lint/unified_integer.rb +1 -0
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +5 -0
- data/lib/rubocop/cop/lint/unreachable_code.rb +3 -5
- data/lib/rubocop/cop/lint/unreachable_loop.rb +15 -7
- data/lib/rubocop/cop/lint/unused_block_argument.rb +10 -8
- data/lib/rubocop/cop/lint/unused_method_argument.rb +4 -5
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -0
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +6 -4
- data/lib/rubocop/cop/lint/useless_assignment.rb +5 -10
- data/lib/rubocop/cop/lint/useless_method_definition.rb +3 -2
- data/lib/rubocop/cop/lint/useless_setter_call.rb +9 -7
- data/lib/rubocop/cop/lint/useless_times.rb +8 -4
- data/lib/rubocop/cop/lint/void.rb +5 -12
- data/lib/rubocop/cop/message_annotator.rb +1 -3
- data/lib/rubocop/cop/metrics/abc_size.rb +6 -0
- 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 +3 -6
- data/lib/rubocop/cop/metrics/parameter_lists.rb +8 -7
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +2 -3
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +5 -8
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +8 -6
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +4 -7
- data/lib/rubocop/cop/migration/department_name.rb +4 -6
- data/lib/rubocop/cop/mixin/alignment.rb +12 -7
- data/lib/rubocop/cop/mixin/annotation_comment.rb +57 -34
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +29 -4
- data/lib/rubocop/cop/mixin/code_length.rb +2 -4
- data/lib/rubocop/cop/mixin/comments_help.rb +5 -1
- 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 +3 -5
- data/lib/rubocop/cop/mixin/documentation_comment.rb +8 -8
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +6 -7
- data/lib/rubocop/cop/mixin/empty_parameter.rb +2 -3
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +2 -5
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +4 -6
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +1 -3
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +30 -8
- data/lib/rubocop/cop/mixin/gem_declaration.rb +13 -0
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +17 -9
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +16 -25
- data/lib/rubocop/cop/mixin/heredoc.rb +5 -0
- data/lib/rubocop/cop/mixin/interpolation.rb +1 -3
- data/lib/rubocop/cop/mixin/line_length_help.rb +13 -10
- data/lib/rubocop/cop/mixin/match_range.rb +2 -5
- data/lib/rubocop/cop/mixin/method_complexity.rb +2 -3
- data/lib/rubocop/cop/mixin/method_preference.rb +1 -2
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +5 -4
- data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +1 -3
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +13 -42
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +2 -3
- data/lib/rubocop/cop/mixin/negative_conditional.rb +4 -2
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +10 -5
- data/lib/rubocop/cop/mixin/percent_array.rb +17 -8
- data/lib/rubocop/cop/mixin/percent_literal.rb +0 -6
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +14 -12
- data/lib/rubocop/cop/mixin/preferred_delimiters.rb +6 -9
- data/lib/rubocop/cop/mixin/range_help.rb +10 -13
- data/lib/rubocop/cop/mixin/rational_literal.rb +1 -0
- data/lib/rubocop/cop/mixin/require_library.rb +59 -0
- data/lib/rubocop/cop/mixin/rescue_node.rb +2 -6
- data/lib/rubocop/cop/mixin/safe_assignment.rb +6 -2
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +2 -4
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +3 -4
- data/lib/rubocop/cop/mixin/statement_modifier.rb +2 -4
- data/lib/rubocop/cop/mixin/string_literals_help.rb +7 -5
- data/lib/rubocop/cop/mixin/symbol_help.rb +13 -0
- data/lib/rubocop/cop/mixin/trailing_body.rb +2 -3
- data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -2
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +7 -13
- data/lib/rubocop/cop/mixin/unused_argument.rb +1 -3
- data/lib/rubocop/cop/mixin/visibility_help.rb +1 -0
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +2 -7
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +2 -2
- data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/constant_name.rb +3 -1
- data/lib/rubocop/cop/naming/file_name.rb +7 -16
- data/lib/rubocop/cop/naming/inclusive_language.rb +266 -0
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +11 -5
- data/lib/rubocop/cop/naming/method_name.rb +4 -2
- data/lib/rubocop/cop/naming/predicate_name.rb +2 -2
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +17 -0
- data/lib/rubocop/cop/offense.rb +3 -8
- data/lib/rubocop/cop/registry.rb +13 -12
- data/lib/rubocop/cop/security/eval.rb +1 -0
- data/lib/rubocop/cop/security/io_methods.rb +49 -0
- data/lib/rubocop/cop/security/json_load.rb +9 -7
- data/lib/rubocop/cop/security/marshal_load.rb +1 -0
- data/lib/rubocop/cop/security/open.rb +5 -0
- data/lib/rubocop/cop/security/yaml_load.rb +5 -0
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +4 -5
- data/lib/rubocop/cop/style/accessor_grouping.rb +3 -5
- data/lib/rubocop/cop/style/alias.rb +6 -12
- data/lib/rubocop/cop/style/and_or.rb +8 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +17 -5
- data/lib/rubocop/cop/style/array_coercion.rb +23 -3
- data/lib/rubocop/cop/style/array_join.rb +1 -0
- data/lib/rubocop/cop/style/ascii_comments.rb +1 -5
- data/lib/rubocop/cop/style/attr.rb +2 -3
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +2 -5
- data/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb +60 -0
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +59 -71
- data/lib/rubocop/cop/style/block_delimiters.rb +50 -2
- data/lib/rubocop/cop/style/case_equality.rb +8 -10
- data/lib/rubocop/cop/style/case_like_if.rb +21 -6
- data/lib/rubocop/cop/style/character_literal.rb +2 -4
- data/lib/rubocop/cop/style/class_and_module_children.rb +42 -10
- data/lib/rubocop/cop/style/class_equality_comparison.rb +3 -0
- data/lib/rubocop/cop/style/class_methods.rb +1 -3
- data/lib/rubocop/cop/style/collection_compact.rb +10 -8
- data/lib/rubocop/cop/style/collection_methods.rb +8 -6
- data/lib/rubocop/cop/style/colon_method_call.rb +2 -3
- data/lib/rubocop/cop/style/combinable_loops.rb +6 -4
- data/lib/rubocop/cop/style/command_literal.rb +4 -9
- data/lib/rubocop/cop/style/comment_annotation.rb +57 -30
- data/lib/rubocop/cop/style/commented_keyword.rb +16 -16
- data/lib/rubocop/cop/style/conditional_assignment.rb +31 -29
- data/lib/rubocop/cop/style/constant_visibility.rb +28 -0
- data/lib/rubocop/cop/style/copyright.rb +3 -6
- data/lib/rubocop/cop/style/date_time.rb +10 -5
- data/lib/rubocop/cop/style/def_with_parentheses.rb +1 -2
- data/lib/rubocop/cop/style/dir.rb +1 -0
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +2 -2
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
- data/lib/rubocop/cop/style/documentation.rb +52 -10
- data/lib/rubocop/cop/style/documentation_method.rb +1 -0
- data/lib/rubocop/cop/style/double_cop_disable_directive.rb +1 -7
- data/lib/rubocop/cop/style/double_negation.rb +30 -8
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +2 -2
- data/lib/rubocop/cop/style/each_with_object.rb +1 -0
- 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 +21 -9
- data/lib/rubocop/cop/style/empty_method.rb +3 -7
- data/lib/rubocop/cop/style/encoding.rb +26 -15
- data/lib/rubocop/cop/style/end_block.rb +1 -2
- data/lib/rubocop/cop/style/endless_method.rb +2 -3
- data/lib/rubocop/cop/style/eval_with_location.rb +91 -31
- data/lib/rubocop/cop/style/even_odd.rb +1 -0
- data/lib/rubocop/cop/style/expand_path_arguments.rb +4 -3
- data/lib/rubocop/cop/style/explicit_block_argument.rb +48 -15
- data/lib/rubocop/cop/style/exponential_notation.rb +6 -7
- data/lib/rubocop/cop/style/float_division.rb +14 -2
- data/lib/rubocop/cop/style/format_string.rb +2 -0
- data/lib/rubocop/cop/style/format_string_token.rb +2 -4
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +15 -12
- data/lib/rubocop/cop/style/global_std_stream.rb +5 -0
- data/lib/rubocop/cop/style/guard_clause.rb +3 -7
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +11 -0
- data/lib/rubocop/cop/style/hash_conversion.rb +133 -0
- data/lib/rubocop/cop/style/hash_each_methods.rb +25 -3
- data/lib/rubocop/cop/style/hash_except.rb +5 -3
- data/lib/rubocop/cop/style/hash_like_case.rb +2 -2
- data/lib/rubocop/cop/style/hash_syntax.rb +21 -25
- data/lib/rubocop/cop/style/hash_transform_keys.rb +8 -9
- data/lib/rubocop/cop/style/hash_transform_values.rb +8 -6
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +83 -8
- data/lib/rubocop/cop/style/if_unless_modifier.rb +40 -13
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +20 -4
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +1 -0
- data/lib/rubocop/cop/style/in_pattern_then.rb +56 -0
- data/lib/rubocop/cop/style/infinite_loop.rb +6 -8
- data/lib/rubocop/cop/style/inverse_methods.rb +14 -9
- 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 +19 -13
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +32 -21
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +47 -3
- 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 +14 -9
- data/lib/rubocop/cop/style/min_max.rb +2 -2
- data/lib/rubocop/cop/style/missing_else.rb +9 -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 +3 -2
- data/lib/rubocop/cop/style/module_function.rb +16 -15
- data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -2
- data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +62 -0
- data/lib/rubocop/cop/style/multiline_method_signature.rb +11 -6
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -2
- data/lib/rubocop/cop/style/multiline_when_then.rb +3 -12
- data/lib/rubocop/cop/style/multiple_comparison.rb +23 -6
- data/lib/rubocop/cop/style/mutable_constant.rb +85 -23
- data/lib/rubocop/cop/style/negated_if.rb +1 -2
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +24 -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/nil_comparison.rb +3 -0
- data/lib/rubocop/cop/style/nil_lambda.rb +30 -12
- data/lib/rubocop/cop/style/non_nil_check.rb +11 -7
- data/lib/rubocop/cop/style/not.rb +2 -2
- data/lib/rubocop/cop/style/numbered_parameters.rb +46 -0
- data/lib/rubocop/cop/style/numbered_parameters_limit.rb +50 -0
- data/lib/rubocop/cop/style/numeric_literals.rb +6 -15
- data/lib/rubocop/cop/style/numeric_predicate.rb +10 -7
- data/lib/rubocop/cop/style/one_line_conditional.rb +1 -2
- data/lib/rubocop/cop/style/option_hash.rb +2 -3
- data/lib/rubocop/cop/style/optional_arguments.rb +6 -5
- data/lib/rubocop/cop/style/optional_boolean_parameter.rb +14 -4
- data/lib/rubocop/cop/style/or_assignment.rb +4 -6
- data/lib/rubocop/cop/style/parallel_assignment.rb +13 -10
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +1 -0
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +2 -4
- data/lib/rubocop/cop/style/percent_q_literals.rb +3 -4
- data/lib/rubocop/cop/style/perl_backrefs.rb +2 -9
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +10 -8
- data/lib/rubocop/cop/style/proc.rb +2 -2
- data/lib/rubocop/cop/style/quoted_symbols.rb +114 -0
- data/lib/rubocop/cop/style/raise_args.rb +6 -8
- data/lib/rubocop/cop/style/random_with_offset.rb +8 -8
- data/lib/rubocop/cop/style/redundant_argument.rb +21 -20
- data/lib/rubocop/cop/style/redundant_assignment.rb +2 -3
- data/lib/rubocop/cop/style/redundant_begin.rb +72 -7
- data/lib/rubocop/cop/style/redundant_capital_w.rb +1 -2
- data/lib/rubocop/cop/style/redundant_condition.rb +4 -8
- data/lib/rubocop/cop/style/redundant_conditional.rb +5 -6
- data/lib/rubocop/cop/style/redundant_exception.rb +5 -6
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +6 -0
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +13 -3
- data/lib/rubocop/cop/style/redundant_freeze.rb +6 -6
- data/lib/rubocop/cop/style/redundant_interpolation.rb +2 -3
- data/lib/rubocop/cop/style/redundant_parentheses.rb +21 -20
- data/lib/rubocop/cop/style/redundant_percent_q.rb +3 -5
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -4
- data/lib/rubocop/cop/style/redundant_return.rb +6 -4
- data/lib/rubocop/cop/style/redundant_self.rb +42 -10
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +8 -5
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +83 -0
- data/lib/rubocop/cop/style/redundant_sort.rb +56 -25
- data/lib/rubocop/cop/style/redundant_sort_by.rb +1 -0
- data/lib/rubocop/cop/style/regexp_literal.rb +15 -10
- data/lib/rubocop/cop/style/rescue_modifier.rb +21 -14
- data/lib/rubocop/cop/style/rescue_standard_error.rb +5 -7
- data/lib/rubocop/cop/style/return_nil.rb +8 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +25 -23
- data/lib/rubocop/cop/style/sample.rb +1 -0
- data/lib/rubocop/cop/style/select_by_regexp.rb +139 -0
- data/lib/rubocop/cop/style/semicolon.rb +32 -24
- data/lib/rubocop/cop/style/send.rb +1 -2
- data/lib/rubocop/cop/style/signal_exception.rb +6 -7
- data/lib/rubocop/cop/style/single_argument_dig.rb +7 -2
- data/lib/rubocop/cop/style/single_line_block_params.rb +5 -6
- data/lib/rubocop/cop/style/single_line_methods.rb +45 -18
- data/lib/rubocop/cop/style/slicing_with_range.rb +14 -0
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +35 -7
- data/lib/rubocop/cop/style/special_global_vars.rb +33 -20
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -2
- data/lib/rubocop/cop/style/static_class.rb +5 -5
- data/lib/rubocop/cop/style/stderr_puts.rb +3 -6
- data/lib/rubocop/cop/style/string_chars.rb +41 -0
- data/lib/rubocop/cop/style/string_concatenation.rb +45 -15
- data/lib/rubocop/cop/style/string_hash_keys.rb +6 -0
- data/lib/rubocop/cop/style/string_literals.rb +5 -7
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +1 -0
- data/lib/rubocop/cop/style/strip.rb +1 -0
- data/lib/rubocop/cop/style/struct_inheritance.rb +15 -0
- data/lib/rubocop/cop/style/swap_values.rb +5 -3
- data/lib/rubocop/cop/style/symbol_array.rb +3 -3
- data/lib/rubocop/cop/style/symbol_literal.rb +1 -3
- data/lib/rubocop/cop/style/symbol_proc.rb +55 -10
- data/lib/rubocop/cop/style/ternary_parentheses.rb +4 -6
- data/lib/rubocop/cop/style/top_level_method_definition.rb +83 -0
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +6 -2
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +21 -6
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +3 -6
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -10
- data/lib/rubocop/cop/style/trivial_accessors.rb +69 -5
- data/lib/rubocop/cop/style/unless_else.rb +1 -2
- data/lib/rubocop/cop/style/unless_logical_operators.rb +105 -0
- data/lib/rubocop/cop/style/unpack_first.rb +2 -1
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
- data/lib/rubocop/cop/style/when_then.rb +4 -2
- data/lib/rubocop/cop/style/while_until_modifier.rb +1 -2
- data/lib/rubocop/cop/style/word_array.rb +22 -5
- data/lib/rubocop/cop/style/yoda_condition.rb +28 -18
- data/lib/rubocop/cop/style/zero_length_predicate.rb +12 -2
- data/lib/rubocop/cop/team.rb +2 -5
- data/lib/rubocop/cop/util.rb +29 -16
- data/lib/rubocop/cop/utils/format_string.rb +1 -3
- data/lib/rubocop/cop/variable_force/assignment.rb +1 -2
- data/lib/rubocop/cop/variable_force/branch.rb +16 -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/cop/variable_force/variable_table.rb +1 -1
- data/lib/rubocop/cop/variable_force.rb +6 -15
- data/lib/rubocop/cops_documentation_generator.rb +24 -26
- data/lib/rubocop/directive_comment.rb +123 -11
- data/lib/rubocop/ext/regexp_parser.rb +3 -6
- data/lib/rubocop/file_finder.rb +1 -3
- data/lib/rubocop/formatter/clang_style_formatter.rb +4 -2
- data/lib/rubocop/formatter/disabled_config_formatter.rb +3 -8
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +2 -6
- 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 +23 -14
- data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
- data/lib/rubocop/formatter/progress_formatter.rb +1 -3
- data/lib/rubocop/formatter/tap_formatter.rb +4 -2
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -1
- data/lib/rubocop/magic_comment.rb +45 -16
- data/lib/rubocop/name_similarity.rb +1 -1
- data/lib/rubocop/options.rb +153 -159
- data/lib/rubocop/path_util.rb +1 -3
- data/lib/rubocop/rake_task.rb +4 -1
- data/lib/rubocop/remote_config.rb +13 -8
- data/lib/rubocop/result_cache.rb +8 -15
- data/lib/rubocop/rspec/cop_helper.rb +3 -3
- data/lib/rubocop/rspec/expect_offense.rb +11 -12
- data/lib/rubocop/rspec/parallel_formatter.rb +90 -0
- data/lib/rubocop/rspec/shared_contexts.rb +8 -15
- data/lib/rubocop/rspec/support.rb +1 -0
- data/lib/rubocop/runner.rb +9 -17
- data/lib/rubocop/target_finder.rb +20 -17
- data/lib/rubocop/target_ruby.rb +25 -21
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop.rb +30 -3
- metadata +44 -11
- data/lib/rubocop/core_ext/hash.rb +0 -20
@@ -8,6 +8,25 @@ module RuboCop
|
|
8
8
|
# that comma to be present. Blocks with more than one argument never
|
9
9
|
# require a trailing comma.
|
10
10
|
#
|
11
|
+
# @safety
|
12
|
+
# This cop is unsafe because a trailing comma can indicate there are
|
13
|
+
# more parameters that are not used.
|
14
|
+
#
|
15
|
+
# For example:
|
16
|
+
# [source,ruby]
|
17
|
+
# ----
|
18
|
+
# # with a trailing comma
|
19
|
+
# {foo: 1, bar: 2, baz: 3}.map {|key,| key }
|
20
|
+
# #=> [:foo, :bar, :baz]
|
21
|
+
#
|
22
|
+
# # without a trailing comma
|
23
|
+
# {foo: 1, bar: 2, baz: 3}.map {|key| key }
|
24
|
+
# #=> [[:foo, 1], [:bar, 2], [:baz, 3]]
|
25
|
+
# ----
|
26
|
+
#
|
27
|
+
# This can be fixed by replacing the trailing comma with a placeholder
|
28
|
+
# argument (such as `|key, _value|`).
|
29
|
+
#
|
11
30
|
# @example
|
12
31
|
# # bad
|
13
32
|
# add { |foo, bar,| foo + bar }
|
@@ -52,9 +71,7 @@ module RuboCop
|
|
52
71
|
|
53
72
|
last_comma_pos = last_comma(node).pos
|
54
73
|
|
55
|
-
add_offense(last_comma_pos)
|
56
|
-
corrector.replace(last_comma_pos, '')
|
57
|
-
end
|
74
|
+
add_offense(last_comma_pos) { |corrector| corrector.replace(last_comma_pos, '') }
|
58
75
|
end
|
59
76
|
|
60
77
|
private
|
@@ -78,9 +95,7 @@ module RuboCop
|
|
78
95
|
def argument_tokens(node)
|
79
96
|
tokens = processed_source.tokens_within(node)
|
80
97
|
pipes = tokens.select { |token| token.type == :tPIPE }
|
81
|
-
begin_pos, end_pos = pipes.map
|
82
|
-
tokens.index(pipe)
|
83
|
-
end
|
98
|
+
begin_pos, end_pos = pipes.map { |pipe| tokens.index(pipe) }
|
84
99
|
|
85
100
|
tokens[begin_pos + 1..end_pos - 1]
|
86
101
|
end
|
@@ -36,11 +36,10 @@ module RuboCop
|
|
36
36
|
class TrailingMethodEndStatement < Base
|
37
37
|
extend AutoCorrector
|
38
38
|
|
39
|
-
MSG = 'Place the end statement of a multi-line method on '
|
40
|
-
'its own line.'
|
39
|
+
MSG = 'Place the end statement of a multi-line method on its own line.'
|
41
40
|
|
42
41
|
def on_def(node)
|
43
|
-
return
|
42
|
+
return if node.endless? || !trailing_end?(node)
|
44
43
|
|
45
44
|
add_offense(node.loc.end) do |corrector|
|
46
45
|
corrector.insert_before(
|
@@ -53,9 +52,7 @@ module RuboCop
|
|
53
52
|
private
|
54
53
|
|
55
54
|
def trailing_end?(node)
|
56
|
-
node.body &&
|
57
|
-
node.multiline? &&
|
58
|
-
body_and_end_on_same_line?(node)
|
55
|
+
node.body && node.multiline? && body_and_end_on_same_line?(node)
|
59
56
|
end
|
60
57
|
|
61
58
|
def body_and_end_on_same_line?(node)
|
@@ -33,8 +33,7 @@ module RuboCop
|
|
33
33
|
include RangeHelp
|
34
34
|
extend AutoCorrector
|
35
35
|
|
36
|
-
MSG = 'Do not use trailing `_`s in parallel assignment. '
|
37
|
-
'Prefer `%<code>s`.'
|
36
|
+
MSG = 'Do not use trailing `_`s in parallel assignment. Prefer `%<code>s`.'
|
38
37
|
UNDERSCORE = '_'
|
39
38
|
DISALLOW = %i[lvasgn splat].freeze
|
40
39
|
private_constant :DISALLOW
|
@@ -91,8 +90,7 @@ module RuboCop
|
|
91
90
|
end
|
92
91
|
|
93
92
|
def allow_named_underscore_variables
|
94
|
-
@allow_named_underscore_variables ||=
|
95
|
-
cop_config['AllowNamedUnderscoreVariables']
|
93
|
+
@allow_named_underscore_variables ||= cop_config['AllowNamedUnderscoreVariables']
|
96
94
|
end
|
97
95
|
|
98
96
|
def unneeded_ranges(node)
|
@@ -121,8 +119,7 @@ module RuboCop
|
|
121
119
|
|
122
120
|
return range_for_parentheses(first_offense, mlhs_node) if Util.parentheses?(mlhs_node)
|
123
121
|
|
124
|
-
range_between(first_offense.source_range.begin_pos,
|
125
|
-
node.loc.operator.begin_pos)
|
122
|
+
range_between(first_offense.source_range.begin_pos, node.loc.operator.begin_pos)
|
126
123
|
end
|
127
124
|
|
128
125
|
def children_offenses(variables)
|
@@ -147,10 +144,7 @@ module RuboCop
|
|
147
144
|
end
|
148
145
|
|
149
146
|
def range_for_parentheses(offense, left)
|
150
|
-
range_between(
|
151
|
-
offense.source_range.begin_pos - 1,
|
152
|
-
left.loc.expression.end_pos - 1
|
153
|
-
)
|
147
|
+
range_between(offense.source_range.begin_pos - 1, left.loc.expression.end_pos - 1)
|
154
148
|
end
|
155
149
|
end
|
156
150
|
end
|
@@ -27,6 +27,71 @@ module RuboCop
|
|
27
27
|
# class << self
|
28
28
|
# attr_reader :baz
|
29
29
|
# end
|
30
|
+
#
|
31
|
+
# @example ExactNameMatch: true (default)
|
32
|
+
# # good
|
33
|
+
# def name
|
34
|
+
# @other_name
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# @example ExactNameMatch: false
|
38
|
+
# # bad
|
39
|
+
# def name
|
40
|
+
# @other_name
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# @example AllowPredicates: true (default)
|
44
|
+
# # good
|
45
|
+
# def foo?
|
46
|
+
# @foo
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# @example AllowPredicates: false
|
50
|
+
# # bad
|
51
|
+
# def foo?
|
52
|
+
# @foo
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# # good
|
56
|
+
# attr_reader :foo
|
57
|
+
#
|
58
|
+
# @example AllowDSLWriters: true (default)
|
59
|
+
# # good
|
60
|
+
# def on_exception(action)
|
61
|
+
# @on_exception=action
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# @example AllowDSLWriters: false
|
65
|
+
# # bad
|
66
|
+
# def on_exception(action)
|
67
|
+
# @on_exception=action
|
68
|
+
# end
|
69
|
+
#
|
70
|
+
# # good
|
71
|
+
# attr_writer :on_exception
|
72
|
+
#
|
73
|
+
# @example IgnoreClassMethods: false (default)
|
74
|
+
# # bad
|
75
|
+
# def self.foo
|
76
|
+
# @foo
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# # good
|
80
|
+
# class << self
|
81
|
+
# attr_reader :foo
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# @example IgnoreClassMethods: true
|
85
|
+
# # good
|
86
|
+
# def self.foo
|
87
|
+
# @foo
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# @example AllowedMethods: ['allowed_method']
|
91
|
+
# # good
|
92
|
+
# def allowed_method
|
93
|
+
# @foo
|
94
|
+
# end
|
30
95
|
class TrivialAccessors < Base
|
31
96
|
include AllowedMethods
|
32
97
|
extend AutoCorrector
|
@@ -107,8 +172,7 @@ module RuboCop
|
|
107
172
|
end
|
108
173
|
|
109
174
|
def trivial_reader?(node)
|
110
|
-
looks_like_trivial_reader?(node) &&
|
111
|
-
!allowed_method_name?(node) && !allowed_reader?(node)
|
175
|
+
looks_like_trivial_reader?(node) && !allowed_method_name?(node) && !allowed_reader?(node)
|
112
176
|
end
|
113
177
|
|
114
178
|
def looks_like_trivial_reader?(node)
|
@@ -120,6 +184,7 @@ module RuboCop
|
|
120
184
|
!allowed_method_name?(node) && !allowed_writer?(node.method_name)
|
121
185
|
end
|
122
186
|
|
187
|
+
# @!method looks_like_trivial_writer?(node)
|
123
188
|
def_node_matcher :looks_like_trivial_writer?, <<~PATTERN
|
124
189
|
{(def _ (args (arg ...)) (ivasgn _ (lvar _)))
|
125
190
|
(defs _ _ (args (arg ...)) (ivasgn _ (lvar _)))}
|
@@ -127,7 +192,7 @@ module RuboCop
|
|
127
192
|
|
128
193
|
def allowed_method_name?(node)
|
129
194
|
allowed_method_names.include?(node.method_name) ||
|
130
|
-
exact_name_match? && !names_match?(node)
|
195
|
+
(exact_name_match? && !names_match?(node))
|
131
196
|
end
|
132
197
|
|
133
198
|
def allowed_writer?(method_name)
|
@@ -145,8 +210,7 @@ module RuboCop
|
|
145
210
|
end
|
146
211
|
|
147
212
|
def trivial_accessor_kind(node)
|
148
|
-
if trivial_writer?(node) &&
|
149
|
-
!dsl_writer?(node.method_name)
|
213
|
+
if trivial_writer?(node) && !dsl_writer?(node.method_name)
|
150
214
|
'writer'
|
151
215
|
elsif trivial_reader?(node)
|
152
216
|
'reader'
|
@@ -23,8 +23,7 @@ module RuboCop
|
|
23
23
|
include RangeHelp
|
24
24
|
extend AutoCorrector
|
25
25
|
|
26
|
-
MSG = 'Do not use `unless` with `else`. Rewrite these with the '
|
27
|
-
'positive case first.'
|
26
|
+
MSG = 'Do not use `unless` with `else`. Rewrite these with the positive case first.'
|
28
27
|
|
29
28
|
def on_if(node)
|
30
29
|
return unless node.unless? && node.else?
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Style
|
6
|
+
# This cop checks for the use of logical operators in an `unless` condition.
|
7
|
+
# It discourages such code, as the condition becomes more difficult
|
8
|
+
# to read and understand.
|
9
|
+
#
|
10
|
+
# This cop supports two styles:
|
11
|
+
# - `forbid_mixed_logical_operators` (default)
|
12
|
+
# - `forbid_logical_operators`
|
13
|
+
#
|
14
|
+
# `forbid_mixed_logical_operators` style forbids the use of more than one type
|
15
|
+
# of logical operators. This makes the `unless` condition easier to read
|
16
|
+
# because either all conditions need to be met or any condition need to be met
|
17
|
+
# in order for the expression to be truthy or falsey.
|
18
|
+
#
|
19
|
+
# `forbid_logical_operators` style forbids any use of logical operator.
|
20
|
+
# This makes it even more easy to read the `unless` condition as
|
21
|
+
# there is only one condition in the expression.
|
22
|
+
#
|
23
|
+
# @example EnforcedStyle: forbid_mixed_logical_operators (default)
|
24
|
+
# # bad
|
25
|
+
# return unless a || b && c
|
26
|
+
# return unless a && b || c
|
27
|
+
# return unless a && b and c
|
28
|
+
# return unless a || b or c
|
29
|
+
# return unless a && b or c
|
30
|
+
# return unless a || b and c
|
31
|
+
#
|
32
|
+
# # good
|
33
|
+
# return unless a && b && c
|
34
|
+
# return unless a || b || c
|
35
|
+
# return unless a and b and c
|
36
|
+
# return unless a or b or c
|
37
|
+
# return unless a?
|
38
|
+
#
|
39
|
+
# @example EnforcedStyle: forbid_logical_operators
|
40
|
+
# # bad
|
41
|
+
# return unless a || b
|
42
|
+
# return unless a && b
|
43
|
+
# return unless a or b
|
44
|
+
# return unless a and b
|
45
|
+
#
|
46
|
+
# # good
|
47
|
+
# return unless a
|
48
|
+
# return unless a?
|
49
|
+
class UnlessLogicalOperators < Base
|
50
|
+
include ConfigurableEnforcedStyle
|
51
|
+
|
52
|
+
FORBID_MIXED_LOGICAL_OPERATORS = 'Do not use mixed logical operators in an `unless`.'
|
53
|
+
FORBID_LOGICAL_OPERATORS = 'Do not use any logical operator in an `unless`.'
|
54
|
+
|
55
|
+
# @!method or_with_and?(node)
|
56
|
+
def_node_matcher :or_with_and?, <<~PATTERN
|
57
|
+
(if (or <`and ...> ) ...)
|
58
|
+
PATTERN
|
59
|
+
|
60
|
+
# @!method and_with_or?(node)
|
61
|
+
def_node_matcher :and_with_or?, <<~PATTERN
|
62
|
+
(if (and <`or ...> ) ...)
|
63
|
+
PATTERN
|
64
|
+
|
65
|
+
# @!method logical_operator?(node)
|
66
|
+
def_node_matcher :logical_operator?, <<~PATTERN
|
67
|
+
(if ({and or} ... ) ...)
|
68
|
+
PATTERN
|
69
|
+
|
70
|
+
def on_if(node)
|
71
|
+
return unless node.unless?
|
72
|
+
|
73
|
+
if style == :forbid_mixed_logical_operators && mixed_logical_operator?(node)
|
74
|
+
add_offense(node, message: FORBID_MIXED_LOGICAL_OPERATORS)
|
75
|
+
elsif style == :forbid_logical_operators && logical_operator?(node)
|
76
|
+
add_offense(node, message: FORBID_LOGICAL_OPERATORS)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def mixed_logical_operator?(node)
|
83
|
+
or_with_and?(node) ||
|
84
|
+
and_with_or?(node) ||
|
85
|
+
mixed_precedence_and?(node) ||
|
86
|
+
mixed_precedence_or?(node)
|
87
|
+
end
|
88
|
+
|
89
|
+
def mixed_precedence_and?(node)
|
90
|
+
and_sources = node.condition.each_descendant(:and).map(&:operator)
|
91
|
+
and_sources << node.condition.operator if node.condition.and_type?
|
92
|
+
|
93
|
+
!(and_sources.all?('&&') || and_sources.all?('and'))
|
94
|
+
end
|
95
|
+
|
96
|
+
def mixed_precedence_or?(node)
|
97
|
+
or_sources = node.condition.each_descendant(:or).map(&:operator)
|
98
|
+
or_sources << node.condition.operator if node.condition.or_type?
|
99
|
+
|
100
|
+
!(or_sources.all?('||') || or_sources.all?('or'))
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -21,9 +21,10 @@ module RuboCop
|
|
21
21
|
extend AutoCorrector
|
22
22
|
|
23
23
|
MSG = 'Use `%<receiver>s.unpack1(%<format>s)` instead of '\
|
24
|
-
|
24
|
+
'`%<receiver>s.unpack(%<format>s)%<method>s`.'
|
25
25
|
RESTRICT_ON_SEND = %i[first [] slice at].freeze
|
26
26
|
|
27
|
+
# @!method unpack_and_first_element?(node)
|
27
28
|
def_node_matcher :unpack_and_first_element?, <<~PATTERN
|
28
29
|
{
|
29
30
|
(send $(send (...) :unpack $(...)) :first)
|
@@ -20,7 +20,7 @@ module RuboCop
|
|
20
20
|
extend AutoCorrector
|
21
21
|
|
22
22
|
MSG = 'Replace interpolated variable `%<variable>s` ' \
|
23
|
-
'with expression `#{%<variable>s}`.'
|
23
|
+
'with expression `#{%<variable>s}`.' # rubocop:disable Lint/InterpolationCheck
|
24
24
|
|
25
25
|
def on_node_with_interpolations(node)
|
26
26
|
var_nodes(node.children).each do |var_node|
|
@@ -20,12 +20,14 @@ module RuboCop
|
|
20
20
|
class WhenThen < Base
|
21
21
|
extend AutoCorrector
|
22
22
|
|
23
|
-
MSG = 'Do not use `when
|
23
|
+
MSG = 'Do not use `when %<expression>s;`. Use `when %<expression>s then` instead.'
|
24
24
|
|
25
25
|
def on_when(node)
|
26
26
|
return if node.multiline? || node.then? || !node.body
|
27
27
|
|
28
|
-
|
28
|
+
message = format(MSG, expression: node.conditions.map(&:source).join(', '))
|
29
|
+
|
30
|
+
add_offense(node.loc.begin, message: message) do |corrector|
|
29
31
|
corrector.replace(node.loc.begin, ' then')
|
30
32
|
end
|
31
33
|
end
|
@@ -37,8 +37,7 @@ module RuboCop
|
|
37
37
|
include StatementModifier
|
38
38
|
extend AutoCorrector
|
39
39
|
|
40
|
-
MSG = 'Favor modifier `%<keyword>s` usage when '
|
41
|
-
'having a single-line body.'
|
40
|
+
MSG = 'Favor modifier `%<keyword>s` usage when having a single-line body.'
|
42
41
|
|
43
42
|
def on_while(node)
|
44
43
|
return unless single_line_as_modifier?(node)
|
@@ -9,6 +9,9 @@ module RuboCop
|
|
9
9
|
# Alternatively, it can check for uses of the %w() syntax, in projects
|
10
10
|
# which do not want to include that syntax.
|
11
11
|
#
|
12
|
+
# NOTE: When using the `percent` style, %w() arrays containing a space
|
13
|
+
# will be registered as offenses.
|
14
|
+
#
|
12
15
|
# Configuration option: MinSize
|
13
16
|
# If set, arrays with fewer elements than this value will not trigger the
|
14
17
|
# cop. For example, a `MinSize` of `3` will not enforce a style on an
|
@@ -21,12 +24,18 @@ module RuboCop
|
|
21
24
|
# # bad
|
22
25
|
# ['foo', 'bar', 'baz']
|
23
26
|
#
|
27
|
+
# # bad (contains spaces)
|
28
|
+
# %w[foo\ bar baz\ quux]
|
29
|
+
#
|
24
30
|
# @example EnforcedStyle: brackets
|
25
31
|
# # good
|
26
32
|
# ['foo', 'bar', 'baz']
|
27
33
|
#
|
28
34
|
# # bad
|
29
35
|
# %w[foo bar baz]
|
36
|
+
#
|
37
|
+
# # good (contains spaces)
|
38
|
+
# ['foo bar', 'baz quux']
|
30
39
|
class WordArray < Base
|
31
40
|
include ArrayMinSize
|
32
41
|
include ArraySyntax
|
@@ -35,7 +44,7 @@ module RuboCop
|
|
35
44
|
extend AutoCorrector
|
36
45
|
|
37
46
|
PERCENT_MSG = 'Use `%w` or `%W` for an array of words.'
|
38
|
-
ARRAY_MSG = 'Use `
|
47
|
+
ARRAY_MSG = 'Use `%<prefer>s` for an array of words.'
|
39
48
|
|
40
49
|
class << self
|
41
50
|
attr_accessor :largest_brackets
|
@@ -53,19 +62,27 @@ module RuboCop
|
|
53
62
|
|
54
63
|
private
|
55
64
|
|
56
|
-
def complex_content?(strings)
|
65
|
+
def complex_content?(strings, complex_regex: word_regex)
|
57
66
|
strings.any? do |s|
|
67
|
+
next unless s.str_content
|
68
|
+
|
58
69
|
string = s.str_content.dup.force_encoding(::Encoding::UTF_8)
|
59
70
|
!string.valid_encoding? ||
|
60
|
-
!
|
71
|
+
(complex_regex && !complex_regex.match?(string)) ||
|
72
|
+
/ /.match?(string)
|
61
73
|
end
|
62
74
|
end
|
63
75
|
|
76
|
+
def invalid_percent_array_contents?(node)
|
77
|
+
# Disallow %w() arrays that contain invalid encoding or spaces
|
78
|
+
complex_content?(node.values, complex_regex: false)
|
79
|
+
end
|
80
|
+
|
64
81
|
def word_regex
|
65
82
|
Regexp.new(cop_config['WordRegex'])
|
66
83
|
end
|
67
84
|
|
68
|
-
def
|
85
|
+
def build_bracketed_array(node)
|
69
86
|
words = node.children.map do |word|
|
70
87
|
if word.dstr_type?
|
71
88
|
string_literal = to_string_literal(word.source)
|
@@ -76,7 +93,7 @@ module RuboCop
|
|
76
93
|
end
|
77
94
|
end
|
78
95
|
|
79
|
-
|
96
|
+
"[#{words.join(', ')}]"
|
80
97
|
end
|
81
98
|
end
|
82
99
|
end
|
@@ -7,6 +7,26 @@ module RuboCop
|
|
7
7
|
# i.e. comparison operations where the order of expression is reversed.
|
8
8
|
# eg. `5 == x`
|
9
9
|
#
|
10
|
+
# @safety
|
11
|
+
# This cop is unsafe because comparison operators can be defined
|
12
|
+
# differently on different classes, and are not guaranteed to
|
13
|
+
# have the same result if reversed.
|
14
|
+
#
|
15
|
+
# For example:
|
16
|
+
#
|
17
|
+
# [source,ruby]
|
18
|
+
# ----
|
19
|
+
# class MyKlass
|
20
|
+
# def ==(other)
|
21
|
+
# true
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# obj = MyKlass.new
|
26
|
+
# obj == 'string' #=> true
|
27
|
+
# 'string' == obj #=> false
|
28
|
+
# ----
|
29
|
+
#
|
10
30
|
# @example EnforcedStyle: forbid_for_all_comparison_operators (default)
|
11
31
|
# # bad
|
12
32
|
# 99 == foo
|
@@ -58,27 +78,20 @@ module RuboCop
|
|
58
78
|
extend AutoCorrector
|
59
79
|
|
60
80
|
MSG = 'Reverse the order of the operands `%<source>s`.'
|
61
|
-
|
62
|
-
REVERSE_COMPARISON = {
|
63
|
-
'<' => '>',
|
64
|
-
'<=' => '>=',
|
65
|
-
'>' => '<',
|
66
|
-
'>=' => '<='
|
67
|
-
}.freeze
|
68
|
-
|
81
|
+
REVERSE_COMPARISON = { '<' => '>', '<=' => '>=', '>' => '<', '>=' => '<=' }.freeze
|
69
82
|
EQUALITY_OPERATORS = %i[== !=].freeze
|
70
|
-
|
71
83
|
NONCOMMUTATIVE_OPERATORS = %i[===].freeze
|
72
|
-
|
73
84
|
PROGRAM_NAMES = %i[$0 $PROGRAM_NAME].freeze
|
85
|
+
RESTRICT_ON_SEND = RuboCop::AST::Node::COMPARISON_OPERATORS
|
74
86
|
|
87
|
+
# @!method file_constant_equal_program_name?(node)
|
75
88
|
def_node_matcher :file_constant_equal_program_name?, <<~PATTERN
|
76
89
|
(send #source_file_path_constant? {:== :!=} (gvar #program_name?))
|
77
90
|
PATTERN
|
78
91
|
|
79
92
|
def on_send(node)
|
80
93
|
return unless yoda_compatible_condition?(node)
|
81
|
-
return if equality_only? && non_equality_operator?(node) ||
|
94
|
+
return if (equality_only? && non_equality_operator?(node)) ||
|
82
95
|
file_constant_equal_program_name?(node)
|
83
96
|
|
84
97
|
valid_yoda?(node) || add_offense(node) do |corrector|
|
@@ -99,16 +112,15 @@ module RuboCop
|
|
99
112
|
end
|
100
113
|
|
101
114
|
def yoda_compatible_condition?(node)
|
102
|
-
node.comparison_method? &&
|
103
|
-
!noncommutative_operator?(node)
|
115
|
+
node.comparison_method? && !noncommutative_operator?(node)
|
104
116
|
end
|
105
117
|
|
106
118
|
def valid_yoda?(node)
|
107
119
|
lhs = node.receiver
|
108
120
|
rhs = node.first_argument
|
109
121
|
|
110
|
-
return true if lhs.literal? && rhs.literal? ||
|
111
|
-
!lhs.literal? && !rhs.literal? ||
|
122
|
+
return true if (lhs.literal? && rhs.literal?) ||
|
123
|
+
(!lhs.literal? && !rhs.literal?) ||
|
112
124
|
interpolation?(lhs)
|
113
125
|
|
114
126
|
enforce_yoda? ? lhs.literal? : rhs.literal?
|
@@ -126,9 +138,7 @@ module RuboCop
|
|
126
138
|
end
|
127
139
|
|
128
140
|
def actual_code_range(node)
|
129
|
-
range_between(
|
130
|
-
node.loc.expression.begin_pos, node.loc.expression.end_pos
|
131
|
-
)
|
141
|
+
range_between(node.loc.expression.begin_pos, node.loc.expression.end_pos)
|
132
142
|
end
|
133
143
|
|
134
144
|
def reverse_comparison(operator)
|
@@ -9,6 +9,12 @@ module RuboCop
|
|
9
9
|
# receiver.length < 1 and receiver.size == 0 that can be
|
10
10
|
# replaced by receiver.empty? and !receiver.empty?.
|
11
11
|
#
|
12
|
+
# @safety
|
13
|
+
# This cop is unsafe because it cannot be guaranteed that the receiver
|
14
|
+
# has an `empty?` method that is defined in terms of `length`. If there
|
15
|
+
# is a non-standard class that redefines `length` or `empty?`, the cop
|
16
|
+
# may register a false positive.
|
17
|
+
#
|
12
18
|
# @example
|
13
19
|
# # bad
|
14
20
|
# [1, 2, 3].length == 0
|
@@ -29,8 +35,7 @@ module RuboCop
|
|
29
35
|
extend AutoCorrector
|
30
36
|
|
31
37
|
ZERO_MSG = 'Use `empty?` instead of `%<lhs>s %<opr>s %<rhs>s`.'
|
32
|
-
NONZERO_MSG = 'Use `!empty?` instead of '
|
33
|
-
'`%<lhs>s %<opr>s %<rhs>s`.'
|
38
|
+
NONZERO_MSG = 'Use `!empty?` instead of `%<lhs>s %<opr>s %<rhs>s`.'
|
34
39
|
|
35
40
|
RESTRICT_ON_SEND = %i[size length].freeze
|
36
41
|
|
@@ -71,6 +76,7 @@ module RuboCop
|
|
71
76
|
end
|
72
77
|
end
|
73
78
|
|
79
|
+
# @!method zero_length_predicate(node)
|
74
80
|
def_node_matcher :zero_length_predicate, <<~PATTERN
|
75
81
|
{(send (send (...) ${:length :size}) $:== (int $0))
|
76
82
|
(send (int $0) $:== (send (...) ${:length :size}))
|
@@ -78,6 +84,7 @@ module RuboCop
|
|
78
84
|
(send (int $1) $:> (send (...) ${:length :size}))}
|
79
85
|
PATTERN
|
80
86
|
|
87
|
+
# @!method nonzero_length_predicate(node)
|
81
88
|
def_node_matcher :nonzero_length_predicate, <<~PATTERN
|
82
89
|
{(send (send (...) ${:length :size}) ${:> :!=} (int $0))
|
83
90
|
(send (int $0) ${:< :!=} (send (...) ${:length :size}))}
|
@@ -90,6 +97,7 @@ module RuboCop
|
|
90
97
|
"!#{other_receiver(node).source}.empty?"
|
91
98
|
end
|
92
99
|
|
100
|
+
# @!method zero_length_receiver(node)
|
93
101
|
def_node_matcher :zero_length_receiver, <<~PATTERN
|
94
102
|
{(send (send $_ _) :== (int 0))
|
95
103
|
(send (int 0) :== (send $_ _))
|
@@ -97,6 +105,7 @@ module RuboCop
|
|
97
105
|
(send (int 1) :> (send $_ _))}
|
98
106
|
PATTERN
|
99
107
|
|
108
|
+
# @!method other_receiver(node)
|
100
109
|
def_node_matcher :other_receiver, <<~PATTERN
|
101
110
|
{(send (send $_ _) _ _)
|
102
111
|
(send _ _ (send $_ _))}
|
@@ -105,6 +114,7 @@ module RuboCop
|
|
105
114
|
# Some collection like objects in the Ruby standard library
|
106
115
|
# implement `#size`, but not `#empty`. We ignore those to
|
107
116
|
# reduce false positives.
|
117
|
+
# @!method non_polymorphic_collection?(node)
|
108
118
|
def_node_matcher :non_polymorphic_collection?, <<~PATTERN
|
109
119
|
{(send (send (send (const {nil? cbase} :File) :stat _) ...) ...)
|
110
120
|
(send (send (send (const {nil? cbase} {:Tempfile :StringIO}) {:new :open} ...) ...) ...)}
|
data/lib/rubocop/cop/team.rb
CHANGED
@@ -107,9 +107,7 @@ module RuboCop
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
needed.map
|
111
|
-
force_class.new(joining_cops)
|
112
|
-
end
|
110
|
+
needed.map { |force_class, joining_cops| force_class.new(joining_cops) }
|
113
111
|
end
|
114
112
|
|
115
113
|
def external_dependency_checksum
|
@@ -247,8 +245,7 @@ module RuboCop
|
|
247
245
|
end
|
248
246
|
|
249
247
|
def handle_error(error, location, cop)
|
250
|
-
message = Rainbow("An error occurred while #{cop.name}"
|
251
|
-
" cop was inspecting #{location}.").red
|
248
|
+
message = Rainbow("An error occurred while #{cop.name} cop was inspecting #{location}.").red
|
252
249
|
@errors << message
|
253
250
|
warn message
|
254
251
|
if debug?
|