rubocop 0.68.1 → 0.69.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 -3
- data/config/default.yml +25 -9
- data/lib/rubocop.rb +1 -0
- data/lib/rubocop/ast/node.rb +6 -2
- data/lib/rubocop/ast/node/array_node.rb +2 -2
- data/lib/rubocop/ast/node/block_node.rb +2 -2
- data/lib/rubocop/ast/node/for_node.rb +1 -1
- data/lib/rubocop/ast/node/hash_node.rb +1 -1
- data/lib/rubocop/ast/node/if_node.rb +1 -1
- data/lib/rubocop/ast/node/keyword_splat_node.rb +1 -1
- data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +3 -3
- data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +2 -2
- data/lib/rubocop/ast/node/mixin/parameterized_node.rb +1 -1
- data/lib/rubocop/ast/node/mixin/predicate_operator_node.rb +4 -4
- data/lib/rubocop/ast/node/pair_node.rb +4 -4
- data/lib/rubocop/ast/node/until_node.rb +1 -1
- data/lib/rubocop/ast/node/when_node.rb +1 -1
- data/lib/rubocop/ast/node/while_node.rb +1 -1
- data/lib/rubocop/cli.rb +6 -6
- data/lib/rubocop/comment_config.rb +6 -6
- data/lib/rubocop/config.rb +8 -6
- data/lib/rubocop/config_loader.rb +3 -3
- data/lib/rubocop/cop/badge.rb +1 -1
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -1
- data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +1 -1
- data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +5 -5
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +1 -1
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -1
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +0 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +7 -7
- data/lib/rubocop/cop/generator.rb +6 -6
- data/lib/rubocop/cop/generator/configuration_injector.rb +5 -5
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +1 -1
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/align_arguments.rb +2 -2
- data/lib/rubocop/cop/layout/align_array.rb +1 -1
- data/lib/rubocop/cop/layout/align_hash.rb +3 -3
- data/lib/rubocop/cop/layout/align_parameters.rb +2 -2
- data/lib/rubocop/cop/layout/block_alignment.rb +4 -4
- data/lib/rubocop/cop/layout/block_end_newline.rb +0 -1
- data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/class_structure.rb +2 -2
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +4 -4
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/condition_position.rb +1 -1
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_comment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +5 -5
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +1 -1
- data/lib/rubocop/cop/layout/end_of_line.rb +2 -2
- data/lib/rubocop/cop/layout/extra_spacing.rb +5 -5
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +3 -10
- data/lib/rubocop/cop/layout/indent_assignment.rb +1 -1
- data/lib/rubocop/cop/layout/indent_first_argument.rb +1 -1
- data/lib/rubocop/cop/layout/indent_first_array_element.rb +1 -1
- data/lib/rubocop/cop/layout/indent_first_hash_element.rb +1 -1
- data/lib/rubocop/cop/layout/indent_first_parameter.rb +2 -2
- data/lib/rubocop/cop/layout/indent_heredoc.rb +9 -47
- data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +2 -2
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/leading_blank_lines.rb +1 -1
- data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +4 -4
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +2 -2
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +2 -2
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +4 -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 +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +4 -4
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +4 -4
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/space_after_colon.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_method_name.rb +2 -2
- data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +9 -9
- data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -2
- data/lib/rubocop/cop/layout/space_before_comment.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +1 -1
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +4 -3
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_parens.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_range_literal.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +2 -2
- data/lib/rubocop/cop/layout/tab.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_blank_lines.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +1 -1
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +2 -2
- data/lib/rubocop/cop/lint/big_decimal_new.rb +1 -1
- data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
- data/lib/rubocop/cop/lint/debugger.rb +1 -1
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
- data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +1 -1
- data/lib/rubocop/cop/lint/duplicated_key.rb +1 -1
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
- data/lib/rubocop/cop/lint/else_layout.rb +1 -1
- data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
- data/lib/rubocop/cop/lint/empty_expression.rb +1 -1
- data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
- data/lib/rubocop/cop/lint/empty_when.rb +1 -1
- data/lib/rubocop/cop/lint/end_in_method.rb +1 -1
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
- data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +7 -8
- data/lib/rubocop/cop/lint/handle_exceptions.rb +1 -1
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +5 -6
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +5 -5
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +4 -4
- data/lib/rubocop/cop/lint/inherit_exception.rb +22 -1
- data/lib/rubocop/cop/lint/interpolation_check.rb +1 -1
- data/lib/rubocop/cop/lint/literal_as_condition.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +1 -1
- data/lib/rubocop/cop/lint/loop.rb +1 -1
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +2 -2
- data/lib/rubocop/cop/lint/multiple_compare.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +16 -1
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +1 -1
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +2 -2
- data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
- data/lib/rubocop/cop/lint/rand_one.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_with_index.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_with_object.rb +2 -2
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +1 -1
- data/lib/rubocop/cop/lint/require_parentheses.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_type.rb +1 -1
- data/lib/rubocop/cop/lint/return_in_void_context.rb +2 -2
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +1 -4
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +2 -2
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
- data/lib/rubocop/cop/lint/script_permission.rb +2 -2
- data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -1
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +1 -1
- data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +2 -2
- data/lib/rubocop/cop/lint/to_json.rb +1 -1
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -1
- data/lib/rubocop/cop/lint/unified_integer.rb +3 -1
- data/lib/rubocop/cop/lint/unneeded_cop_disable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/unneeded_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/unneeded_require_statement.rb +1 -1
- data/lib/rubocop/cop/lint/unneeded_splat_expansion.rb +7 -7
- data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
- data/lib/rubocop/cop/lint/unused_method_argument.rb +1 -1
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
- data/lib/rubocop/cop/lint/uri_regexp.rb +1 -1
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +1 -1
- data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/useless_comparison.rb +1 -1
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +1 -1
- data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
- data/lib/rubocop/cop/lint/void.rb +6 -6
- data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
- data/lib/rubocop/cop/metrics/block_length.rb +2 -2
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/line_length.rb +1 -1
- data/lib/rubocop/cop/metrics/method_length.rb +1 -1
- data/lib/rubocop/cop/metrics/parameter_lists.rb +1 -1
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
- data/lib/rubocop/cop/mixin/alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/check_assignment.rb +1 -1
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +3 -3
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +3 -4
- data/lib/rubocop/cop/mixin/min_body_length.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +4 -4
- data/lib/rubocop/cop/mixin/negative_conditional.rb +1 -1
- data/lib/rubocop/cop/mixin/percent_array.rb +2 -2
- data/lib/rubocop/cop/mixin/range_help.rb +1 -1
- data/lib/rubocop/cop/mixin/rescue_node.rb +1 -2
- data/lib/rubocop/cop/mixin/safe_mode.rb +1 -1
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/surrounding_space.rb +3 -3
- data/lib/rubocop/cop/mixin/too_many_lines.rb +2 -2
- data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +4 -4
- data/lib/rubocop/cop/naming/accessor_method_name.rb +2 -2
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +1 -1
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +1 -1
- data/lib/rubocop/cop/naming/constant_name.rb +4 -4
- data/lib/rubocop/cop/naming/file_name.rb +3 -3
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +2 -2
- data/lib/rubocop/cop/naming/method_name.rb +1 -1
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +1 -1
- data/lib/rubocop/cop/naming/variable_name.rb +1 -1
- data/lib/rubocop/cop/naming/variable_number.rb +1 -1
- data/lib/rubocop/cop/rails/action_filter.rb +1 -1
- data/lib/rubocop/cop/rails/active_record_aliases.rb +1 -1
- data/lib/rubocop/cop/rails/active_record_override.rb +1 -1
- data/lib/rubocop/cop/rails/active_support_aliases.rb +1 -1
- data/lib/rubocop/cop/rails/application_job.rb +3 -3
- data/lib/rubocop/cop/rails/application_record.rb +3 -3
- data/lib/rubocop/cop/rails/assert_not.rb +1 -1
- data/lib/rubocop/cop/rails/belongs_to.rb +2 -2
- data/lib/rubocop/cop/rails/blank.rb +3 -3
- data/lib/rubocop/cop/rails/bulk_change_table.rb +4 -4
- data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +1 -1
- data/lib/rubocop/cop/rails/date.rb +11 -6
- data/lib/rubocop/cop/rails/delegate.rb +1 -1
- data/lib/rubocop/cop/rails/delegate_allow_blank.rb +1 -1
- data/lib/rubocop/cop/rails/dynamic_find_by.rb +1 -1
- data/lib/rubocop/cop/rails/enum_uniqueness.rb +1 -1
- data/lib/rubocop/cop/rails/environment_comparison.rb +2 -2
- data/lib/rubocop/cop/rails/exit.rb +1 -1
- data/lib/rubocop/cop/rails/file_path.rb +2 -2
- data/lib/rubocop/cop/rails/find_by.rb +1 -1
- data/lib/rubocop/cop/rails/find_each.rb +2 -3
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +1 -1
- data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +1 -1
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +1 -1
- data/lib/rubocop/cop/rails/http_status.rb +4 -4
- data/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +1 -1
- data/lib/rubocop/cop/rails/inverse_of.rb +2 -2
- data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +1 -1
- data/lib/rubocop/cop/rails/link_to_blank.rb +9 -2
- data/lib/rubocop/cop/rails/not_null_column.rb +1 -1
- data/lib/rubocop/cop/rails/output.rb +1 -1
- data/lib/rubocop/cop/rails/output_safety.rb +2 -2
- data/lib/rubocop/cop/rails/pluralization_grammar.rb +1 -1
- data/lib/rubocop/cop/rails/presence.rb +1 -1
- data/lib/rubocop/cop/rails/present.rb +3 -3
- data/lib/rubocop/cop/rails/read_write_attribute.rb +1 -1
- data/lib/rubocop/cop/rails/redundant_allow_nil.rb +2 -2
- data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +1 -1
- data/lib/rubocop/cop/rails/reflection_class_name.rb +1 -1
- data/lib/rubocop/cop/rails/refute_methods.rb +1 -1
- data/lib/rubocop/cop/rails/relative_date_constant.rb +2 -2
- data/lib/rubocop/cop/rails/request_referer.rb +1 -1
- data/lib/rubocop/cop/rails/reversible_migration.rb +4 -4
- data/lib/rubocop/cop/rails/safe_navigation.rb +2 -6
- data/lib/rubocop/cop/rails/save_bang.rb +8 -8
- data/lib/rubocop/cop/rails/scope_args.rb +1 -1
- data/lib/rubocop/cop/rails/skips_model_validations.rb +1 -1
- data/lib/rubocop/cop/rails/time_zone.rb +53 -39
- data/lib/rubocop/cop/rails/uniq_before_pluck.rb +3 -3
- data/lib/rubocop/cop/rails/unknown_env.rb +2 -2
- data/lib/rubocop/cop/rails/validation.rb +1 -1
- data/lib/rubocop/cop/registry.rb +1 -1
- data/lib/rubocop/cop/security/eval.rb +1 -1
- data/lib/rubocop/cop/security/json_load.rb +1 -1
- data/lib/rubocop/cop/security/marshal_load.rb +1 -1
- data/lib/rubocop/cop/security/open.rb +1 -1
- data/lib/rubocop/cop/security/yaml_load.rb +1 -1
- data/lib/rubocop/cop/style/alias.rb +3 -3
- data/lib/rubocop/cop/style/and_or.rb +1 -1
- data/lib/rubocop/cop/style/array_join.rb +1 -1
- data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
- data/lib/rubocop/cop/style/attr.rb +1 -1
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +1 -1
- data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
- data/lib/rubocop/cop/style/begin_block.rb +1 -1
- data/lib/rubocop/cop/style/block_comments.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +0 -1
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +1 -1
- data/lib/rubocop/cop/style/case_equality.rb +1 -1
- data/lib/rubocop/cop/style/character_literal.rb +1 -1
- data/lib/rubocop/cop/style/class_and_module_children.rb +5 -5
- data/lib/rubocop/cop/style/class_check.rb +1 -1
- data/lib/rubocop/cop/style/class_methods.rb +1 -1
- data/lib/rubocop/cop/style/class_vars.rb +1 -1
- data/lib/rubocop/cop/style/collection_methods.rb +1 -1
- data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
- data/lib/rubocop/cop/style/colon_method_definition.rb +1 -1
- data/lib/rubocop/cop/style/command_literal.rb +2 -2
- data/lib/rubocop/cop/style/comment_annotation.rb +2 -2
- data/lib/rubocop/cop/style/commented_keyword.rb +1 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +14 -14
- data/lib/rubocop/cop/style/constant_visibility.rb +1 -1
- data/lib/rubocop/cop/style/copyright.rb +2 -2
- data/lib/rubocop/cop/style/date_time.rb +2 -2
- data/lib/rubocop/cop/style/def_with_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/dir.rb +1 -1
- data/lib/rubocop/cop/style/documentation.rb +2 -2
- data/lib/rubocop/cop/style/documentation_method.rb +1 -1
- data/lib/rubocop/cop/style/double_negation.rb +1 -1
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -1
- data/lib/rubocop/cop/style/each_with_object.rb +3 -3
- data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
- data/lib/rubocop/cop/style/empty_case_condition.rb +1 -1
- data/lib/rubocop/cop/style/empty_else.rb +2 -2
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +1 -1
- data/lib/rubocop/cop/style/empty_literal.rb +3 -3
- data/lib/rubocop/cop/style/empty_method.rb +2 -2
- data/lib/rubocop/cop/style/encoding.rb +2 -2
- data/lib/rubocop/cop/style/end_block.rb +1 -1
- data/lib/rubocop/cop/style/eval_with_location.rb +3 -3
- data/lib/rubocop/cop/style/even_odd.rb +1 -1
- data/lib/rubocop/cop/style/expand_path_arguments.rb +3 -3
- data/lib/rubocop/cop/style/for.rb +2 -2
- data/lib/rubocop/cop/style/format_string.rb +1 -1
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +5 -21
- data/lib/rubocop/cop/style/global_vars.rb +1 -1
- data/lib/rubocop/cop/style/guard_clause.rb +3 -3
- data/lib/rubocop/cop/style/hash_syntax.rb +3 -3
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
- data/lib/rubocop/cop/style/if_inside_else.rb +2 -2
- data/lib/rubocop/cop/style/if_unless_modifier.rb +1 -1
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +1 -1
- data/lib/rubocop/cop/style/if_with_semicolon.rb +2 -2
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +1 -1
- data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
- data/lib/rubocop/cop/style/inline_comment.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +7 -1
- data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
- data/lib/rubocop/cop/style/lambda.rb +2 -2
- data/lib/rubocop/cop/style/line_end_concatenation.rb +2 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +3 -3
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +2 -2
- data/lib/rubocop/cop/style/method_def_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/method_missing_super.rb +1 -1
- data/lib/rubocop/cop/style/min_max.rb +1 -1
- data/lib/rubocop/cop/style/missing_else.rb +3 -3
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +1 -1
- data/lib/rubocop/cop/style/mixin_grouping.rb +1 -1
- data/lib/rubocop/cop/style/mixin_usage.rb +1 -1
- data/lib/rubocop/cop/style/module_function.rb +3 -3
- data/lib/rubocop/cop/style/multiline_block_chain.rb +2 -2
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +1 -1
- data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
- data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
- data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -1
- data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +3 -3
- data/lib/rubocop/cop/style/negated_if.rb +1 -1
- data/lib/rubocop/cop/style/negated_unless.rb +89 -0
- data/lib/rubocop/cop/style/nested_modifier.rb +4 -4
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +1 -1
- data/lib/rubocop/cop/style/next.rb +5 -5
- data/lib/rubocop/cop/style/nil_comparison.rb +2 -2
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +5 -5
- data/lib/rubocop/cop/style/numeric_literals.rb +2 -2
- data/lib/rubocop/cop/style/numeric_predicate.rb +2 -10
- data/lib/rubocop/cop/style/one_line_conditional.rb +1 -1
- data/lib/rubocop/cop/style/option_hash.rb +1 -1
- data/lib/rubocop/cop/style/optional_arguments.rb +1 -1
- data/lib/rubocop/cop/style/or_assignment.rb +1 -1
- data/lib/rubocop/cop/style/parallel_assignment.rb +2 -2
- data/lib/rubocop/cop/style/percent_q_literals.rb +2 -2
- data/lib/rubocop/cop/style/perl_backrefs.rb +1 -1
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
- data/lib/rubocop/cop/style/proc.rb +1 -1
- data/lib/rubocop/cop/style/raise_args.rb +2 -2
- data/lib/rubocop/cop/style/random_with_offset.rb +1 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +2 -2
- data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
- data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
- data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +6 -6
- data/lib/rubocop/cop/style/redundant_return.rb +3 -3
- data/lib/rubocop/cop/style/redundant_self.rb +2 -2
- data/lib/rubocop/cop/style/redundant_sort_by.rb +1 -1
- data/lib/rubocop/cop/style/regexp_literal.rb +2 -2
- data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
- data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
- data/lib/rubocop/cop/style/return_nil.rb +2 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +2 -7
- data/lib/rubocop/cop/style/sample.rb +1 -1
- data/lib/rubocop/cop/style/self_assignment.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +1 -1
- data/lib/rubocop/cop/style/send.rb +1 -1
- data/lib/rubocop/cop/style/signal_exception.rb +2 -2
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
- data/lib/rubocop/cop/style/special_global_vars.rb +5 -5
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/stderr_puts.rb +0 -1
- data/lib/rubocop/cop/style/string_hash_keys.rb +2 -1
- 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/strip.rb +1 -1
- data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
- data/lib/rubocop/cop/style/symbol_array.rb +2 -2
- data/lib/rubocop/cop/style/symbol_literal.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
- data/lib/rubocop/cop/style/ternary_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +1 -1
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +1 -1
- data/lib/rubocop/cop/style/trailing_body_on_module.rb +1 -1
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +1 -1
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +2 -2
- data/lib/rubocop/cop/style/trivial_accessors.rb +2 -2
- data/lib/rubocop/cop/style/unless_else.rb +2 -2
- data/lib/rubocop/cop/style/unneeded_capital_w.rb +1 -1
- data/lib/rubocop/cop/style/unneeded_condition.rb +4 -4
- data/lib/rubocop/cop/style/unneeded_interpolation.rb +3 -3
- data/lib/rubocop/cop/style/unneeded_percent_q.rb +7 -7
- data/lib/rubocop/cop/style/unneeded_sort.rb +2 -2
- data/lib/rubocop/cop/style/unpack_first.rb +1 -1
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
- data/lib/rubocop/cop/style/when_then.rb +1 -1
- data/lib/rubocop/cop/style/while_until_do.rb +1 -1
- data/lib/rubocop/cop/style/while_until_modifier.rb +1 -1
- data/lib/rubocop/cop/style/word_array.rb +2 -2
- data/lib/rubocop/cop/style/yoda_condition.rb +1 -1
- data/lib/rubocop/cop/style/zero_length_predicate.rb +2 -2
- data/lib/rubocop/cop/util.rb +2 -2
- data/lib/rubocop/cop/variable_force/variable_table.rb +1 -1
- data/lib/rubocop/core_ext/string.rb +1 -1
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +2 -2
- data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +1 -1
- data/lib/rubocop/formatter/progress_formatter.rb +1 -1
- data/lib/rubocop/formatter/simple_text_formatter.rb +1 -1
- data/lib/rubocop/magic_comment.rb +4 -4
- data/lib/rubocop/node_pattern.rb +9 -9
- data/lib/rubocop/options.rb +2 -2
- data/lib/rubocop/processed_source.rb +3 -5
- data/lib/rubocop/rspec/cop_helper.rb +2 -2
- data/lib/rubocop/rspec/expect_offense.rb +5 -5
- data/lib/rubocop/rspec/shared_contexts.rb +0 -4
- data/lib/rubocop/runner.rb +1 -1
- data/lib/rubocop/string_interpreter.rb +7 -7
- data/lib/rubocop/version.rb +2 -2
- metadata +11 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ceeff27cb7a9a5422da99021b22d3d729445de0cfc8db0fcd451a7b59644564
|
4
|
+
data.tar.gz: 975afb9f919e4b698091be763cbe0ae668aff0a76e79eea297eaf46113156049
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 502807f9a65b63922679174a7e32e7232d1191ea30b06199811f2c7485cdd47b02548a576f88e6bbadee9ed5e2a525eec570674d6b69fdfe5bfa2843edad465f
|
7
|
+
data.tar.gz: fdd08613fb4d3292b99f2b9764df4b91981b5c31300c879cfdd80203f2965b8994187dff36f79e0c16c38665f9b76bf93ad57f1b0df834a42ffe9aa057f82070
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
53
53
|
might want to use a conservative version lock in your `Gemfile`:
|
54
54
|
|
55
55
|
```rb
|
56
|
-
gem 'rubocop', '~> 0.
|
56
|
+
gem 'rubocop', '~> 0.69.0', require: false
|
57
57
|
```
|
58
58
|
|
59
59
|
## Quickstart
|
@@ -73,8 +73,8 @@ You can read a ton more about RuboCop in its [official manual](https://docs.rubo
|
|
73
73
|
|
74
74
|
RuboCop supports the following Ruby implementations:
|
75
75
|
|
76
|
-
* MRI 2.
|
77
|
-
* JRuby 9.
|
76
|
+
* MRI 2.3+
|
77
|
+
* JRuby 9.1+
|
78
78
|
|
79
79
|
The Rails cops support the following versions:
|
80
80
|
|
data/config/default.yml
CHANGED
@@ -123,7 +123,7 @@ AllCops:
|
|
123
123
|
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
|
124
124
|
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
|
125
125
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
126
|
-
# use the oldest officially supported Ruby version (currently Ruby 2.
|
126
|
+
# use the oldest officially supported Ruby version (currently Ruby 2.3).
|
127
127
|
TargetRubyVersion: ~
|
128
128
|
# What version of Rails is the inspected code using? If a value is specified
|
129
129
|
# for TargetRailsVersion then it is used. Acceptable values are specificed
|
@@ -650,6 +650,7 @@ Layout/HeredocArgumentClosingParenthesis:
|
|
650
650
|
Checks for the placement of the closing parenthesis in a
|
651
651
|
method call that passes a HEREDOC string as an argument.
|
652
652
|
Enabled: false
|
653
|
+
StyleGuide: '#heredoc-argument-closing-parentheses'
|
653
654
|
VersionAdded: '0.68'
|
654
655
|
|
655
656
|
Layout/IndentAssignment:
|
@@ -756,9 +757,9 @@ Layout/IndentHeredoc:
|
|
756
757
|
StyleGuide: '#squiggly-heredocs'
|
757
758
|
Enabled: true
|
758
759
|
VersionAdded: '0.49'
|
759
|
-
|
760
|
+
VersionChanged: '0.69'
|
761
|
+
EnforcedStyle: squiggly
|
760
762
|
SupportedStyles:
|
761
|
-
- auto_detection
|
762
763
|
- squiggly
|
763
764
|
- active_support
|
764
765
|
- powerpack
|
@@ -1365,6 +1366,7 @@ Lint/HeredocMethodCallPosition:
|
|
1365
1366
|
Checks for the ordering of a method call where
|
1366
1367
|
the receiver of the call is a HEREDOC.
|
1367
1368
|
Enabled: false
|
1369
|
+
StyleGuide: '#heredoc-method-calls'
|
1368
1370
|
VersionAdded: '0.68'
|
1369
1371
|
|
1370
1372
|
Lint/ImplicitStringConcatenation:
|
@@ -2310,7 +2312,10 @@ Rails/LexicallyScopedActionFilter:
|
|
2310
2312
|
|
2311
2313
|
Rails/LinkToBlank:
|
2312
2314
|
Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
|
2313
|
-
Reference:
|
2315
|
+
Reference:
|
2316
|
+
- https://mathiasbynens.github.io/rel-noopener/
|
2317
|
+
- https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
|
2318
|
+
- https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
|
2314
2319
|
Enabled: true
|
2315
2320
|
VersionAdded: '0.62'
|
2316
2321
|
|
@@ -3128,12 +3133,9 @@ Style/FrozenStringLiteralComment:
|
|
3128
3133
|
to help transition to frozen string literals by default.
|
3129
3134
|
Enabled: true
|
3130
3135
|
VersionAdded: '0.36'
|
3131
|
-
VersionChanged: '0.
|
3132
|
-
EnforcedStyle:
|
3136
|
+
VersionChanged: '0.69'
|
3137
|
+
EnforcedStyle: always
|
3133
3138
|
SupportedStyles:
|
3134
|
-
# `when_needed` will add the frozen string literal comment to files
|
3135
|
-
# only when the `TargetRubyVersion` is set to 2.3+.
|
3136
|
-
- when_needed
|
3137
3139
|
# `always` will always add the frozen string literal comment to a file
|
3138
3140
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
3139
3141
|
# string literal. If you run code against multiple versions of Ruby, it is
|
@@ -3505,6 +3507,20 @@ Style/NegatedIf:
|
|
3505
3507
|
- prefix
|
3506
3508
|
- postfix
|
3507
3509
|
|
3510
|
+
Style/NegatedUnless:
|
3511
|
+
Description: 'Favor if over unless for negative conditions.'
|
3512
|
+
StyleGuide: '#if-for-negatives'
|
3513
|
+
Enabled: true
|
3514
|
+
VersionAdded: '0.69'
|
3515
|
+
EnforcedStyle: both
|
3516
|
+
SupportedStyles:
|
3517
|
+
# both: prefix and postfix negated `unless` should both use `if`
|
3518
|
+
# prefix: only use `if` for negated `unless` statements positioned before the body of the statement
|
3519
|
+
# postfix: only use `if` for negated `unless` statements positioned after the body of the statement
|
3520
|
+
- both
|
3521
|
+
- prefix
|
3522
|
+
- postfix
|
3523
|
+
|
3508
3524
|
Style/NegatedWhile:
|
3509
3525
|
Description: 'Favor until over while for negative conditions.'
|
3510
3526
|
StyleGuide: '#until-for-negatives'
|
data/lib/rubocop.rb
CHANGED
@@ -464,6 +464,7 @@ require_relative 'rubocop/cop/style/multiline_ternary_operator'
|
|
464
464
|
require_relative 'rubocop/cop/style/multiple_comparison'
|
465
465
|
require_relative 'rubocop/cop/style/mutable_constant'
|
466
466
|
require_relative 'rubocop/cop/style/negated_if'
|
467
|
+
require_relative 'rubocop/cop/style/negated_unless'
|
467
468
|
require_relative 'rubocop/cop/style/negated_while'
|
468
469
|
require_relative 'rubocop/cop/style/nested_modifier'
|
469
470
|
require_relative 'rubocop/cop/style/nested_parenthesized_calls'
|
data/lib/rubocop/ast/node.rb
CHANGED
@@ -459,12 +459,16 @@ module RuboCop
|
|
459
459
|
loc.respond_to?(:begin) && loc.begin && loc.begin.is?('(')
|
460
460
|
end
|
461
461
|
|
462
|
+
def call_type?
|
463
|
+
send_type? || csend_type?
|
464
|
+
end
|
465
|
+
|
462
466
|
def chained?
|
463
|
-
parent
|
467
|
+
parent&.call_type? && eql?(parent.receiver)
|
464
468
|
end
|
465
469
|
|
466
470
|
def argument?
|
467
|
-
parent
|
471
|
+
parent&.send_type? && parent.arguments.include?(self)
|
468
472
|
end
|
469
473
|
|
470
474
|
def numeric_type?
|
@@ -22,7 +22,7 @@ module RuboCop
|
|
22
22
|
#
|
23
23
|
# @return [Boolean] whether the array is enclosed in square brackets
|
24
24
|
def square_brackets?
|
25
|
-
loc.begin
|
25
|
+
loc.begin&.is?('[')
|
26
26
|
end
|
27
27
|
|
28
28
|
# Checks whether the `array` literal is delimited by percent brackets.
|
@@ -40,7 +40,7 @@ module RuboCop
|
|
40
40
|
if type
|
41
41
|
loc.begin && loc.begin.source =~ PERCENT_LITERAL_TYPES[type]
|
42
42
|
else
|
43
|
-
loc.begin
|
43
|
+
loc.begin&.source&.start_with?('%')
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -50,14 +50,14 @@ module RuboCop
|
|
50
50
|
#
|
51
51
|
# @return [Boolean] whether the `block` literal is enclosed in braces
|
52
52
|
def braces?
|
53
|
-
loc.end
|
53
|
+
loc.end&.is?('}')
|
54
54
|
end
|
55
55
|
|
56
56
|
# Checks whether the `block` literal is delimited by `do`-`end` keywords.
|
57
57
|
#
|
58
58
|
# @return [Boolean] whether the `block` literal is enclosed in `do`-`end`
|
59
59
|
def keywords?
|
60
|
-
loc.end
|
60
|
+
loc.end&.is?('end')
|
61
61
|
end
|
62
62
|
|
63
63
|
# The delimiters for this `block` literal.
|
@@ -103,7 +103,7 @@ module RuboCop
|
|
103
103
|
#
|
104
104
|
# @return [Boolean] whether the `if` node has at least one `elsif` branch
|
105
105
|
def elsif_conditional?
|
106
|
-
else_branch
|
106
|
+
else_branch&.if_type? && else_branch&.elsif?
|
107
107
|
end
|
108
108
|
|
109
109
|
# Returns the branch of the `if` node that gets evaluated when its
|
@@ -116,7 +116,7 @@ module RuboCop
|
|
116
116
|
#
|
117
117
|
# @return [Boolean] whether the receiver of this method dispatch is `self`
|
118
118
|
def self_receiver?
|
119
|
-
receiver
|
119
|
+
receiver&.self_type?
|
120
120
|
end
|
121
121
|
|
122
122
|
# Checks whether the *explicit* receiver of this method dispatch is a
|
@@ -125,7 +125,7 @@ module RuboCop
|
|
125
125
|
# @return [Boolean] whether the receiver of this method dispatch
|
126
126
|
# is a `const` node
|
127
127
|
def const_receiver?
|
128
|
-
receiver
|
128
|
+
receiver&.const_type?
|
129
129
|
end
|
130
130
|
|
131
131
|
# Checks whether the method dispatch is the implicit form of `#call`,
|
@@ -140,7 +140,7 @@ module RuboCop
|
|
140
140
|
#
|
141
141
|
# @return [Boolean] whether the dispatched method has a block
|
142
142
|
def block_literal?
|
143
|
-
parent
|
143
|
+
parent&.block_type? && eql?(parent.send_node)
|
144
144
|
end
|
145
145
|
|
146
146
|
# Checks whether this node is an arithmetic operation
|
@@ -79,14 +79,14 @@ module RuboCop
|
|
79
79
|
#
|
80
80
|
# @return [Boolean] whether the receiver of this node is `self`
|
81
81
|
def self_receiver?
|
82
|
-
receiver
|
82
|
+
receiver&.self_type?
|
83
83
|
end
|
84
84
|
|
85
85
|
# Checks whether the *explicit* receiver of node is a `const` node.
|
86
86
|
#
|
87
87
|
# @return [Boolean] whether the receiver of this node is a `const` node
|
88
88
|
def const_receiver?
|
89
|
-
receiver
|
89
|
+
receiver&.const_type?
|
90
90
|
end
|
91
91
|
|
92
92
|
# Checks whether this is a negation method, i.e. `!` or keyword `not`.
|
@@ -5,10 +5,10 @@ module RuboCop
|
|
5
5
|
# Common functionality for nodes that are predicates:
|
6
6
|
# `or`, `and` ...
|
7
7
|
module PredicateOperatorNode
|
8
|
-
LOGICAL_AND = '&&'
|
9
|
-
SEMANTIC_AND = 'and'
|
10
|
-
LOGICAL_OR = '||'
|
11
|
-
SEMANTIC_OR = 'or'
|
8
|
+
LOGICAL_AND = '&&'
|
9
|
+
SEMANTIC_AND = 'and'
|
10
|
+
LOGICAL_OR = '||'
|
11
|
+
SEMANTIC_OR = 'or'
|
12
12
|
|
13
13
|
# Returns the operator as a string.
|
14
14
|
#
|
@@ -8,10 +8,10 @@ module RuboCop
|
|
8
8
|
class PairNode < Node
|
9
9
|
include HashElementNode
|
10
10
|
|
11
|
-
HASH_ROCKET = '=>'
|
12
|
-
SPACED_HASH_ROCKET = ' => '
|
13
|
-
COLON = ':'
|
14
|
-
SPACED_COLON = ': '
|
11
|
+
HASH_ROCKET = '=>'
|
12
|
+
SPACED_HASH_ROCKET = ' => '
|
13
|
+
COLON = ':'
|
14
|
+
SPACED_COLON = ': '
|
15
15
|
|
16
16
|
# Checks whether the `pair` uses a hash rocket delimiter.
|
17
17
|
#
|
data/lib/rubocop/cli.rb
CHANGED
@@ -7,13 +7,13 @@ module RuboCop
|
|
7
7
|
class CLI
|
8
8
|
include Formatter::TextUtil
|
9
9
|
|
10
|
-
PHASE_1 = 'Phase 1 of 2: run Metrics/LineLength cop'
|
11
|
-
PHASE_2 = 'Phase 2 of 2: run all cops'
|
10
|
+
PHASE_1 = 'Phase 1 of 2: run Metrics/LineLength cop'
|
11
|
+
PHASE_2 = 'Phase 2 of 2: run all cops'
|
12
12
|
|
13
13
|
PHASE_1_OVERRIDDEN = '(skipped because the default Metrics/LineLength:Max' \
|
14
|
-
' is overridden)'
|
14
|
+
' is overridden)'
|
15
15
|
PHASE_1_DISABLED = '(skipped because Metrics/LineLength is ' \
|
16
|
-
'disabled)'
|
16
|
+
'disabled)'
|
17
17
|
|
18
18
|
STATUS_SUCCESS = 0
|
19
19
|
STATUS_OFFENSES = 1
|
@@ -145,7 +145,7 @@ module RuboCop
|
|
145
145
|
|
146
146
|
STATUS_ERROR
|
147
147
|
else
|
148
|
-
description =
|
148
|
+
description = <<~DESC
|
149
149
|
# The behavior of RuboCop can be controlled via the .rubocop.yml
|
150
150
|
# configuration file. It makes it possible to enable/disable
|
151
151
|
# certain cops (checks) and to alter their behavior if they accept
|
@@ -317,7 +317,7 @@ module RuboCop
|
|
317
317
|
|
318
318
|
errors.each { |error| warn error }
|
319
319
|
|
320
|
-
warn
|
320
|
+
warn <<~WARNING
|
321
321
|
Errors are usually caused by RuboCop bugs.
|
322
322
|
Please, report your problems to RuboCop's issue tracker.
|
323
323
|
#{Gem.loaded_specs['rubocop'].metadata['bug_tracker_uri']}
|
@@ -4,11 +4,11 @@ module RuboCop
|
|
4
4
|
# This class parses the special `rubocop:disable` comments in a source
|
5
5
|
# and provides a way to check if each cop is enabled at arbitrary line.
|
6
6
|
class CommentConfig
|
7
|
-
UNNEEDED_DISABLE = 'Lint/UnneededCopDisableDirective'
|
7
|
+
UNNEEDED_DISABLE = 'Lint/UnneededCopDisableDirective'
|
8
8
|
|
9
|
-
COP_NAME_PATTERN = '([A-Z]\w+/)?(?:[A-Z]\w+)'
|
10
|
-
COP_NAMES_PATTERN = "(?:#{COP_NAME_PATTERN} , )*#{COP_NAME_PATTERN}"
|
11
|
-
COPS_PATTERN = "(all|#{COP_NAMES_PATTERN})"
|
9
|
+
COP_NAME_PATTERN = '([A-Z]\w+/)?(?:[A-Z]\w+)'
|
10
|
+
COP_NAMES_PATTERN = "(?:#{COP_NAME_PATTERN} , )*#{COP_NAME_PATTERN}"
|
11
|
+
COPS_PATTERN = "(all|#{COP_NAMES_PATTERN})"
|
12
12
|
|
13
13
|
COMMENT_DIRECTIVE_REGEXP = Regexp.new(
|
14
14
|
('# rubocop : ((?:dis|en)able)\b ' + COPS_PATTERN).gsub(' ', '\s*')
|
@@ -175,7 +175,7 @@ module RuboCop
|
|
175
175
|
def handle_enable_all(names, extras, comment)
|
176
176
|
enabled_cops = 0
|
177
177
|
names.each do |name, counter|
|
178
|
-
next unless counter
|
178
|
+
next unless counter.positive?
|
179
179
|
|
180
180
|
names[name] -= 1
|
181
181
|
enabled_cops += 1
|
@@ -189,7 +189,7 @@ module RuboCop
|
|
189
189
|
names[name] ||= 0
|
190
190
|
if disabled
|
191
191
|
names[name] += 1
|
192
|
-
elsif names[name]
|
192
|
+
elsif (names[name]).positive?
|
193
193
|
names[name] -= 1
|
194
194
|
else
|
195
195
|
extras << [comment, name]
|
data/lib/rubocop/config.rb
CHANGED
@@ -19,11 +19,13 @@ module RuboCop
|
|
19
19
|
INTERNAL_PARAMS = %w[Description StyleGuide VersionAdded
|
20
20
|
VersionChanged Reference Safe SafeAutoCorrect].freeze
|
21
21
|
|
22
|
-
# 2.
|
23
|
-
DEFAULT_RUBY_VERSION = 2.
|
24
|
-
KNOWN_RUBIES = [2.
|
25
|
-
OBSOLETE_RUBIES = {
|
26
|
-
|
22
|
+
# 2.3 is the oldest officially supported Ruby version.
|
23
|
+
DEFAULT_RUBY_VERSION = 2.3
|
24
|
+
KNOWN_RUBIES = [2.3, 2.4, 2.5, 2.6].freeze
|
25
|
+
OBSOLETE_RUBIES = {
|
26
|
+
1.9 => '0.50', 2.0 => '0.50', 2.1 => '0.58', 2.2 => '0.69'
|
27
|
+
}.freeze
|
28
|
+
RUBY_VERSION_FILENAME = '.ruby-version'
|
27
29
|
DEFAULT_RAILS_VERSION = 5.0
|
28
30
|
OBSOLETE_COPS = {
|
29
31
|
'Style/FlipFlop' =>
|
@@ -570,7 +572,7 @@ module RuboCop
|
|
570
572
|
end
|
571
573
|
|
572
574
|
def obsolete_parameter_message(cop, parameter, alternative)
|
573
|
-
return unless self[cop]
|
575
|
+
return unless self[cop]&.key?(parameter)
|
574
576
|
|
575
577
|
"obsolete parameter #{parameter} (for #{cop}) " \
|
576
578
|
"found in #{smart_loaded_path}" \
|
@@ -14,11 +14,11 @@ module RuboCop
|
|
14
14
|
# during a run of the rubocop program, if files in several
|
15
15
|
# directories are inspected.
|
16
16
|
class ConfigLoader
|
17
|
-
DOTFILE = '.rubocop.yml'
|
18
|
-
XDG_CONFIG = 'config.yml'
|
17
|
+
DOTFILE = '.rubocop.yml'
|
18
|
+
XDG_CONFIG = 'config.yml'
|
19
19
|
RUBOCOP_HOME = File.realpath(File.join(File.dirname(__FILE__), '..', '..'))
|
20
20
|
DEFAULT_FILE = File.join(RUBOCOP_HOME, 'config', 'default.yml')
|
21
|
-
AUTO_GENERATED_FILE = '.rubocop_todo.yml'
|
21
|
+
AUTO_GENERATED_FILE = '.rubocop_todo.yml'
|
22
22
|
|
23
23
|
class << self
|
24
24
|
include FileFinder
|