rubocop 1.29.1 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/config/default.yml +164 -26
- data/config/obsoletion.yml +25 -1
- data/exe/rubocop +15 -7
- data/lib/rubocop/cache_config.rb +29 -0
- data/lib/rubocop/cli/command/{auto_genenerate_config.rb → auto_generate_config.rb} +20 -5
- data/lib/rubocop/cli/command/execute_runner.rb +1 -1
- data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
- data/lib/rubocop/cli/command/show_cops.rb +1 -1
- data/lib/rubocop/cli/command/suggest_extensions.rb +53 -15
- data/lib/rubocop/cli.rb +2 -0
- data/lib/rubocop/config.rb +6 -2
- data/lib/rubocop/config_finder.rb +68 -0
- data/lib/rubocop/config_loader.rb +15 -41
- data/lib/rubocop/config_loader_resolver.rb +2 -6
- data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +4 -0
- data/lib/rubocop/config_obsoletion.rb +7 -2
- data/lib/rubocop/config_validator.rb +21 -4
- data/lib/rubocop/cop/autocorrect_logic.rb +4 -2
- data/lib/rubocop/cop/base.rb +6 -2
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -1
- data/lib/rubocop/cop/bundler/gem_filename.rb +5 -5
- data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -2
- data/lib/rubocop/cop/cop.rb +1 -1
- data/lib/rubocop/cop/corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/empty_line_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +4 -2
- data/lib/rubocop/cop/correctors/if_then_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +7 -1
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +3 -3
- data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +59 -1
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/punctuation_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/space_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/string_literal_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +2 -2
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +92 -0
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -1
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
- data/lib/rubocop/cop/gemspec/require_mfa.rb +21 -21
- data/lib/rubocop/cop/generator/require_file_injector.rb +2 -2
- data/lib/rubocop/cop/generator.rb +5 -1
- data/lib/rubocop/cop/internal_affairs/cop_description.rb +96 -0
- data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -5
- data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
- data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.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/single_line_comparison.rb +62 -0
- data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +60 -0
- data/lib/rubocop/cop/internal_affairs.rb +4 -0
- data/lib/rubocop/cop/layout/argument_alignment.rb +22 -1
- data/lib/rubocop/cop/layout/assignment_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +17 -13
- data/lib/rubocop/cop/layout/block_end_newline.rb +36 -6
- data/lib/rubocop/cop/layout/case_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
- 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/dot_position.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_comment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +5 -2
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +25 -4
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +7 -5
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +10 -10
- 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 +10 -10
- data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/end_of_line.rb +5 -5
- data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +34 -29
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +21 -14
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +52 -13
- 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/first_parameter_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/hash_alignment.rb +2 -0
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_style.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +13 -6
- data/lib/rubocop/cop/layout/initial_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/layout/leading_empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +112 -0
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +130 -0
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/line_length.rb +7 -2
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
- 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 +4 -2
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +5 -2
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +45 -0
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +3 -3
- data/lib/rubocop/cop/layout/redundant_line_break.rb +2 -2
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_not.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_keyword.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +5 -3
- 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 +1 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +10 -10
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +33 -15
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +8 -8
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +2 -2
- data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
- data/lib/rubocop/cop/legacy/corrector.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +27 -7
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_range.rb +3 -3
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +1 -1
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -1
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.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/constant_overwritten_in_rescue.rb +51 -0
- data/lib/rubocop/cop/lint/debugger.rb +27 -17
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +15 -9
- data/lib/rubocop/cop/lint/deprecated_constants.rb +1 -1
- data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_branch.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_require.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
- data/lib/rubocop/cop/lint/else_layout.rb +3 -3
- data/lib/rubocop/cop/lint/empty_block.rb +2 -2
- data/lib/rubocop/cop/lint/empty_class.rb +1 -1
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +96 -2
- 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_file.rb +1 -1
- data/lib/rubocop/cop/lint/empty_in_pattern.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/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +9 -9
- data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
- data/lib/rubocop/cop/lint/float_comparison.rb +1 -1
- data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
- data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +1 -1
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
- data/lib/rubocop/cop/lint/inherit_exception.rb +1 -1
- data/lib/rubocop/cop/lint/interpolation_check.rb +2 -2
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +2 -2
- data/lib/rubocop/cop/lint/literal_as_condition.rb +6 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +5 -1
- data/lib/rubocop/cop/lint/loop.rb +1 -1
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/missing_super.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 +25 -6
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +157 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +12 -0
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +32 -10
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -3
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
- 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/raise_exception.rb +1 -1
- data/lib/rubocop/cop/lint/rand_one.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +6 -6
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +4 -1
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +16 -3
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_with_index.rb +14 -11
- data/lib/rubocop/cop/lint/redundant_with_object.rb +13 -12
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +1 -1
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +3 -3
- data/lib/rubocop/cop/lint/require_parentheses.rb +1 -1
- data/lib/rubocop/cop/lint/require_range_parentheses.rb +57 -0
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/return_in_void_context.rb +1 -1
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +38 -1
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +1 -1
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
- data/lib/rubocop/cop/lint/script_permission.rb +1 -1
- data/lib/rubocop/cop/lint/self_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -1
- data/lib/rubocop/cop/lint/shadowed_exception.rb +16 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +25 -4
- data/lib/rubocop/cop/lint/struct_new_override.rb +3 -3
- data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
- data/lib/rubocop/cop/lint/syntax.rb +1 -1
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
- data/lib/rubocop/cop/lint/to_json.rb +1 -1
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +2 -2
- data/lib/rubocop/cop/lint/triple_quotes.rb +1 -1
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -1
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +1 -1
- data/lib/rubocop/cop/lint/unified_integer.rb +3 -1
- data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_loop.rb +9 -3
- data/lib/rubocop/cop/lint/unused_block_argument.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 +9 -7
- data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +44 -0
- data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +2 -2
- data/lib/rubocop/cop/lint/useless_setter_call.rb +2 -2
- data/lib/rubocop/cop/lint/useless_times.rb +1 -1
- data/lib/rubocop/cop/lint/void.rb +3 -1
- data/lib/rubocop/cop/metrics/abc_size.rb +4 -2
- data/lib/rubocop/cop/metrics/block_length.rb +7 -7
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/class_length.rb +1 -1
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/method_length.rb +9 -8
- data/lib/rubocop/cop/metrics/module_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/metrics/utils/code_length_calculator.rb +1 -1
- data/lib/rubocop/cop/mixin/allowed_methods.rb +20 -1
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +17 -1
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +5 -1
- data/lib/rubocop/cop/mixin/comments_help.rb +5 -1
- data/lib/rubocop/cop/mixin/def_node.rb +2 -7
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -1
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +82 -2
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +10 -6
- data/lib/rubocop/cop/mixin/method_complexity.rb +8 -13
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +34 -12
- data/lib/rubocop/cop/mixin/percent_array.rb +60 -1
- data/lib/rubocop/cop/mixin/range_help.rb +10 -7
- data/lib/rubocop/cop/mixin/string_help.rb +1 -1
- data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -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/block_forwarding.rb +2 -2
- data/lib/rubocop/cop/naming/block_parameter_name.rb +2 -2
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +1 -1
- data/lib/rubocop/cop/naming/constant_name.rb +3 -3
- data/lib/rubocop/cop/naming/file_name.rb +1 -1
- 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 +1 -1
- data/lib/rubocop/cop/naming/method_name.rb +1 -1
- data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/predicate_name.rb +30 -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 +18 -18
- data/lib/rubocop/cop/security/compound_hash.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/access_modifier_declarations.rb +77 -1
- data/lib/rubocop/cop/style/accessor_grouping.rb +4 -4
- data/lib/rubocop/cop/style/alias.rb +1 -1
- data/lib/rubocop/cop/style/and_or.rb +11 -11
- data/lib/rubocop/cop/style/arguments_forwarding.rb +3 -3
- data/lib/rubocop/cop/style/array_coercion.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/bisected_attr_accessor.rb +1 -1
- data/lib/rubocop/cop/style/block_comments.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +30 -9
- data/lib/rubocop/cop/style/case_equality.rb +41 -11
- data/lib/rubocop/cop/style/case_like_if.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_equality_comparison.rb +51 -4
- data/lib/rubocop/cop/style/class_methods.rb +1 -1
- data/lib/rubocop/cop/style/class_methods_definitions.rb +3 -2
- data/lib/rubocop/cop/style/class_vars.rb +1 -1
- data/lib/rubocop/cop/style/collection_compact.rb +1 -1
- data/lib/rubocop/cop/style/collection_methods.rb +3 -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/combinable_loops.rb +4 -2
- data/lib/rubocop/cop/style/command_literal.rb +1 -1
- data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +4 -4
- data/lib/rubocop/cop/style/conditional_assignment.rb +2 -1
- data/lib/rubocop/cop/style/constant_visibility.rb +1 -1
- data/lib/rubocop/cop/style/date_time.rb +1 -1
- data/lib/rubocop/cop/style/def_with_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/dir.rb +4 -1
- data/lib/rubocop/cop/style/documentation.rb +1 -1
- data/lib/rubocop/cop/style/documentation_method.rb +1 -1
- data/lib/rubocop/cop/style/double_negation.rb +3 -1
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +42 -7
- data/lib/rubocop/cop/style/each_with_object.rb +40 -9
- data/lib/rubocop/cop/style/empty_block_parameter.rb +2 -2
- data/lib/rubocop/cop/style/empty_case_condition.rb +1 -1
- data/lib/rubocop/cop/style/empty_else.rb +40 -3
- data/lib/rubocop/cop/style/empty_heredoc.rb +73 -0
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +2 -2
- data/lib/rubocop/cop/style/empty_literal.rb +1 -1
- data/lib/rubocop/cop/style/empty_method.rb +17 -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/endless_method.rb +1 -1
- data/lib/rubocop/cop/style/env_home.rb +1 -1
- data/lib/rubocop/cop/style/eval_with_location.rb +1 -1
- data/lib/rubocop/cop/style/even_odd.rb +1 -1
- data/lib/rubocop/cop/style/expand_path_arguments.rb +1 -1
- data/lib/rubocop/cop/style/explicit_block_argument.rb +2 -2
- data/lib/rubocop/cop/style/exponential_notation.rb +1 -1
- data/lib/rubocop/cop/style/fetch_env_var.rb +37 -224
- data/lib/rubocop/cop/style/float_division.rb +1 -1
- data/lib/rubocop/cop/style/for.rb +3 -1
- data/lib/rubocop/cop/style/format_string.rb +1 -1
- data/lib/rubocop/cop/style/format_string_token.rb +73 -23
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +6 -3
- data/lib/rubocop/cop/style/global_std_stream.rb +1 -1
- data/lib/rubocop/cop/style/global_vars.rb +1 -1
- data/lib/rubocop/cop/style/guard_clause.rb +35 -22
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +1 -1
- data/lib/rubocop/cop/style/hash_conversion.rb +1 -1
- data/lib/rubocop/cop/style/hash_each_methods.rb +4 -2
- data/lib/rubocop/cop/style/hash_except.rb +85 -9
- data/lib/rubocop/cop/style/hash_like_case.rb +1 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +20 -3
- data/lib/rubocop/cop/style/hash_transform_keys.rb +6 -1
- data/lib/rubocop/cop/style/hash_transform_values.rb +4 -1
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +2 -2
- data/lib/rubocop/cop/style/if_unless_modifier.rb +1 -1
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +4 -2
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +3 -3
- data/lib/rubocop/cop/style/in_pattern_then.rb +1 -1
- data/lib/rubocop/cop/style/inline_comment.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +10 -8
- data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +2 -2
- data/lib/rubocop/cop/style/lambda.rb +1 -1
- data/lib/rubocop/cop/style/lambda_call.rb +1 -1
- data/lib/rubocop/cop/style/line_end_concatenation.rb +2 -2
- data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
- data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +136 -0
- data/lib/rubocop/cop/style/map_to_hash.rb +3 -3
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +4 -4
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +5 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +8 -8
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +20 -3
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +5 -2
- data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/min_max.rb +1 -1
- data/lib/rubocop/cop/style/missing_else.rb +24 -24
- 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 +4 -2
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -2
- data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
- data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +3 -5
- data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
- data/lib/rubocop/cop/style/multiline_method_signature.rb +2 -2
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +3 -3
- data/lib/rubocop/cop/style/multiline_when_then.rb +2 -4
- data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +1 -1
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +1 -1
- data/lib/rubocop/cop/style/nested_file_dirname.rb +1 -1
- data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +11 -2
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +20 -8
- data/lib/rubocop/cop/style/next.rb +3 -5
- data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
- data/lib/rubocop/cop/style/nil_lambda.rb +3 -3
- data/lib/rubocop/cop/style/non_nil_check.rb +1 -1
- data/lib/rubocop/cop/style/not.rb +2 -2
- data/lib/rubocop/cop/style/numbered_parameters.rb +1 -1
- data/lib/rubocop/cop/style/numbered_parameters_limit.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literals.rb +16 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +53 -11
- data/lib/rubocop/cop/style/object_then.rb +3 -1
- data/lib/rubocop/cop/style/one_line_conditional.rb +1 -1
- data/lib/rubocop/cop/style/open_struct_use.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/optional_boolean_parameter.rb +1 -1
- data/lib/rubocop/cop/style/or_assignment.rb +1 -1
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +1 -1
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
- data/lib/rubocop/cop/style/perl_backrefs.rb +23 -2
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +1 -1
- data/lib/rubocop/cop/style/proc.rb +5 -2
- data/lib/rubocop/cop/style/raise_args.rb +1 -1
- data/lib/rubocop/cop/style/random_with_offset.rb +1 -1
- data/lib/rubocop/cop/style/redundant_argument.rb +2 -2
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +19 -6
- data/lib/rubocop/cop/style/redundant_capital_w.rb +1 -1
- data/lib/rubocop/cop/style/redundant_condition.rb +28 -9
- data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
- data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +2 -2
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +1 -1
- data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
- data/lib/rubocop/cop/style/redundant_interpolation.rb +22 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +22 -24
- data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +2 -2
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +2 -2
- data/lib/rubocop/cop/style/redundant_self.rb +3 -1
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +2 -2
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +1 -1
- data/lib/rubocop/cop/style/redundant_sort.rb +22 -7
- data/lib/rubocop/cop/style/redundant_sort_by.rb +25 -9
- data/lib/rubocop/cop/style/regexp_literal.rb +1 -1
- data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
- data/lib/rubocop/cop/style/rescue_standard_error.rb +13 -13
- data/lib/rubocop/cop/style/return_nil.rb +1 -1
- data/lib/rubocop/cop/style/safe_navigation.rb +8 -3
- data/lib/rubocop/cop/style/sample.rb +1 -1
- data/lib/rubocop/cop/style/select_by_regexp.rb +1 -1
- data/lib/rubocop/cop/style/self_assignment.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +28 -4
- data/lib/rubocop/cop/style/send.rb +1 -1
- data/lib/rubocop/cop/style/signal_exception.rb +1 -1
- data/lib/rubocop/cop/style/single_line_block_params.rb +2 -2
- data/lib/rubocop/cop/style/single_line_methods.rb +2 -2
- data/lib/rubocop/cop/style/slicing_with_range.rb +1 -1
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +42 -14
- data/lib/rubocop/cop/style/static_class.rb +1 -1
- data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
- data/lib/rubocop/cop/style/string_concatenation.rb +6 -7
- data/lib/rubocop/cop/style/string_hash_keys.rb +1 -1
- data/lib/rubocop/cop/style/string_literals_in_interpolation.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 +4 -4
- data/lib/rubocop/cop/style/swap_values.rb +2 -2
- data/lib/rubocop/cop/style/symbol_array.rb +9 -6
- data/lib/rubocop/cop/style/symbol_literal.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +48 -14
- data/lib/rubocop/cop/style/ternary_parentheses.rb +2 -14
- data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
- 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_comma_in_arguments.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +2 -2
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +1 -1
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +1 -1
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -1
- data/lib/rubocop/cop/style/trivial_accessors.rb +4 -1
- data/lib/rubocop/cop/style/unless_else.rb +1 -1
- data/lib/rubocop/cop/style/unless_logical_operators.rb +1 -1
- data/lib/rubocop/cop/style/unpack_first.rb +5 -2
- 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/word_array.rb +4 -5
- data/lib/rubocop/cop/style/yoda_condition.rb +1 -1
- data/lib/rubocop/cop/style/zero_length_predicate.rb +1 -1
- data/lib/rubocop/cop/team.rb +2 -2
- data/lib/rubocop/cop/util.rb +3 -3
- data/lib/rubocop/cops_documentation_generator.rb +18 -1
- data/lib/rubocop/ext/range.rb +15 -0
- data/lib/rubocop/feature_loader.rb +94 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +11 -8
- data/lib/rubocop/formatter/formatter_set.rb +20 -19
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +15 -2
- data/lib/rubocop/formatter/html_formatter.rb +3 -4
- data/lib/rubocop/formatter/markdown_formatter.rb +3 -1
- data/lib/rubocop/formatter/offense_count_formatter.rb +2 -0
- data/lib/rubocop/formatter/simple_text_formatter.rb +9 -8
- data/lib/rubocop/formatter/tap_formatter.rb +1 -1
- data/lib/rubocop/formatter.rb +31 -0
- data/lib/rubocop/magic_comment.rb +27 -2
- data/lib/rubocop/options.rb +81 -39
- data/lib/rubocop/rake_task.rb +34 -9
- data/lib/rubocop/result_cache.rb +24 -21
- data/lib/rubocop/rspec/cop_helper.rb +1 -1
- data/lib/rubocop/rspec/expect_offense.rb +3 -3
- data/lib/rubocop/rspec/shared_contexts.rb +29 -9
- data/lib/rubocop/rspec/support.rb +14 -0
- data/lib/rubocop/runner.rb +13 -5
- data/lib/rubocop/server/cache.rb +144 -0
- data/lib/rubocop/server/cli.rb +121 -0
- data/lib/rubocop/server/client_command/base.rb +44 -0
- data/lib/rubocop/server/client_command/exec.rb +59 -0
- data/lib/rubocop/server/client_command/restart.rb +25 -0
- data/lib/rubocop/server/client_command/start.rb +43 -0
- data/lib/rubocop/server/client_command/status.rb +28 -0
- data/lib/rubocop/server/client_command/stop.rb +31 -0
- data/lib/rubocop/server/client_command.rb +26 -0
- data/lib/rubocop/server/core.rb +79 -0
- data/lib/rubocop/server/errors.rb +23 -0
- data/lib/rubocop/server/helper.rb +34 -0
- data/lib/rubocop/server/server_command/base.rb +50 -0
- data/lib/rubocop/server/server_command/exec.rb +34 -0
- data/lib/rubocop/server/server_command/stop.rb +24 -0
- data/lib/rubocop/server/server_command.rb +21 -0
- data/lib/rubocop/server/socket_reader.rb +65 -0
- data/lib/rubocop/server.rb +53 -0
- data/lib/rubocop/target_ruby.rb +7 -5
- data/lib/rubocop/version.rb +17 -9
- data/lib/rubocop.rb +18 -30
- metadata +60 -10
- data/lib/rubocop/cop/gemspec/date_assignment.rb +0 -49
- data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bc2d4bd29fd7e81f4d7118fef9f55bcd2f086fd20ce383d85c2a1b7b26ea4e9
|
4
|
+
data.tar.gz: 9cb3cef8736b03dd0834b94fefe4415a301d78d842df184a1a1d290973376070
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abeba580bae46458f6427c3d21c6532e95ff88e7d981d196f5013fee29c8f911146f229daa8e6f92d2f28bb14790edc46373a4366f9881700df18a7f5a1352fa
|
7
|
+
data.tar.gz: 4bee5fc42db940e95cd6e3fba83680e6d7fd573a8ed3b7c65136a48d5f3b67ba8d299ecdd30a422afb95961d84c9b0452e3d1b6c1952e0edee1cea97ca704952
|
data/README.md
CHANGED
@@ -46,14 +46,14 @@ If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemf
|
|
46
46
|
gem 'rubocop', require: false
|
47
47
|
```
|
48
48
|
|
49
|
-
RuboCop is stable between
|
49
|
+
RuboCop is stable between minor versions, both in terms of API and cop configuration.
|
50
50
|
We aim to ease the maintenance of RuboCop extensions and the upgrades between RuboCop
|
51
51
|
releases. All big changes are reserved for major releases.
|
52
52
|
To prevent an unwanted RuboCop update you might want to use a conservative version lock
|
53
53
|
in your `Gemfile`:
|
54
54
|
|
55
55
|
```rb
|
56
|
-
gem 'rubocop', '~> 1.
|
56
|
+
gem 'rubocop', '~> 1.36', require: false
|
57
57
|
```
|
58
58
|
|
59
59
|
See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
|
@@ -73,11 +73,13 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
|
|
73
73
|
|
74
74
|
## Compatibility
|
75
75
|
|
76
|
-
RuboCop officially supports the following Ruby implementations:
|
76
|
+
RuboCop officially supports the following runtime Ruby implementations:
|
77
77
|
|
78
78
|
* MRI 2.6+
|
79
79
|
* JRuby 9.3+
|
80
80
|
|
81
|
+
Targets Ruby 2.0+ code analysis.
|
82
|
+
|
81
83
|
See the [compatibility documentation](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
|
82
84
|
|
83
85
|
## Readme Badge
|
data/config/default.yml
CHANGED
@@ -153,6 +153,8 @@ AllCops:
|
|
153
153
|
rubocop-sequel: [sequel]
|
154
154
|
rubocop-rake: [rake]
|
155
155
|
rubocop-graphql: [graphql]
|
156
|
+
# Enable/Disable checking the methods extended by Active Support.
|
157
|
+
ActiveSupportExtensionsEnabled: false
|
156
158
|
|
157
159
|
#################### Bundler ###############################
|
158
160
|
|
@@ -235,13 +237,6 @@ Bundler/OrderedGems:
|
|
235
237
|
|
236
238
|
#################### Gemspec ###############################
|
237
239
|
|
238
|
-
Gemspec/DateAssignment:
|
239
|
-
Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
|
240
|
-
Enabled: pending
|
241
|
-
VersionAdded: '1.10'
|
242
|
-
Include:
|
243
|
-
- '**/*.gemspec'
|
244
|
-
|
245
240
|
Gemspec/DependencyVersion:
|
246
241
|
Description: 'Requires or forbids specifying gem dependency versions.'
|
247
242
|
Enabled: false
|
@@ -254,6 +249,13 @@ Gemspec/DependencyVersion:
|
|
254
249
|
- '**/*.gemspec'
|
255
250
|
AllowedGems: []
|
256
251
|
|
252
|
+
Gemspec/DeprecatedAttributeAssignment:
|
253
|
+
Description: Checks that deprecated attribute assignments are not set in a gemspec file.
|
254
|
+
Enabled: pending
|
255
|
+
VersionAdded: '1.30'
|
256
|
+
Include:
|
257
|
+
- '**/*.gemspec'
|
258
|
+
|
257
259
|
Gemspec/DuplicatedAssignment:
|
258
260
|
Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
|
259
261
|
Enabled: true
|
@@ -928,7 +930,7 @@ Layout/IndentationStyle:
|
|
928
930
|
VersionChanged: '0.82'
|
929
931
|
# By default the indentation width from `Layout/IndentationWidth` is used,
|
930
932
|
# but it can be overridden by setting this parameter.
|
931
|
-
# It is used during
|
933
|
+
# It is used during autocorrection to determine how many spaces should
|
932
934
|
# replace each tab.
|
933
935
|
IndentationWidth: ~
|
934
936
|
EnforcedStyle: spaces
|
@@ -967,6 +969,31 @@ Layout/LeadingEmptyLines:
|
|
967
969
|
VersionAdded: '0.57'
|
968
970
|
VersionChanged: '0.77'
|
969
971
|
|
972
|
+
Layout/LineContinuationLeadingSpace:
|
973
|
+
Description: >-
|
974
|
+
Use trailing spaces instead of leading spaces in strings
|
975
|
+
broken over multiple lines (by a backslash).
|
976
|
+
Enabled: pending
|
977
|
+
AutoCorrect: false
|
978
|
+
SafeAutoCorrect: false
|
979
|
+
VersionAdded: '1.31'
|
980
|
+
VersionChanged: '1.32'
|
981
|
+
EnforcedStyle: trailing
|
982
|
+
SupportedStyles:
|
983
|
+
- leading
|
984
|
+
- trailing
|
985
|
+
|
986
|
+
Layout/LineContinuationSpacing:
|
987
|
+
Description: 'Checks the spacing in front of backslash in line continuations.'
|
988
|
+
Enabled: pending
|
989
|
+
AutoCorrect: true
|
990
|
+
SafeAutoCorrect: true
|
991
|
+
VersionAdded: '1.31'
|
992
|
+
EnforcedStyle: space
|
993
|
+
SupportedStyles:
|
994
|
+
- space
|
995
|
+
- no_space
|
996
|
+
|
970
997
|
Layout/LineEndStringConcatenationIndentation:
|
971
998
|
Description: >-
|
972
999
|
Checks the indentation of the next line after a line that
|
@@ -1131,6 +1158,13 @@ Layout/MultilineMethodDefinitionBraceLayout:
|
|
1131
1158
|
- new_line
|
1132
1159
|
- same_line
|
1133
1160
|
|
1161
|
+
Layout/MultilineMethodParameterLineBreaks:
|
1162
|
+
Description: >-
|
1163
|
+
Checks that each parameter in a multi-line method definition
|
1164
|
+
starts on a separate line.
|
1165
|
+
Enabled: false
|
1166
|
+
VersionAdded: '1.32'
|
1167
|
+
|
1134
1168
|
Layout/MultilineOperationIndentation:
|
1135
1169
|
Description: >-
|
1136
1170
|
Checks indentation of binary operations that span more than
|
@@ -1468,7 +1502,9 @@ Lint/AmbiguousBlockAssociation:
|
|
1468
1502
|
Enabled: true
|
1469
1503
|
VersionAdded: '0.48'
|
1470
1504
|
VersionChanged: '1.13'
|
1471
|
-
|
1505
|
+
AllowedMethods: []
|
1506
|
+
AllowedPatterns: []
|
1507
|
+
IgnoredMethods: [] # deprecated
|
1472
1508
|
|
1473
1509
|
Lint/AmbiguousOperator:
|
1474
1510
|
Description: >-
|
@@ -1543,6 +1579,11 @@ Lint/ConstantDefinitionInBlock:
|
|
1543
1579
|
AllowedMethods:
|
1544
1580
|
- enums
|
1545
1581
|
|
1582
|
+
Lint/ConstantOverwrittenInRescue:
|
1583
|
+
Description: 'Checks for overwriting an exception with an exception result by use `rescue =>`.'
|
1584
|
+
Enabled: pending
|
1585
|
+
VersionAdded: '1.31'
|
1586
|
+
|
1546
1587
|
Lint/ConstantResolution:
|
1547
1588
|
Description: 'Check that constants are fully qualified with `::`.'
|
1548
1589
|
Enabled: false
|
@@ -1563,6 +1604,7 @@ Lint/Debugger:
|
|
1563
1604
|
# a user's configuration, but are otherwise not significant.
|
1564
1605
|
Kernel:
|
1565
1606
|
- binding.irb
|
1607
|
+
- Kernel.binding.irb
|
1566
1608
|
Byebug:
|
1567
1609
|
- byebug
|
1568
1610
|
- remote_byebug
|
@@ -1580,6 +1622,9 @@ Lint/Debugger:
|
|
1580
1622
|
- binding.pry
|
1581
1623
|
- binding.remote_pry
|
1582
1624
|
- binding.pry_remote
|
1625
|
+
- Kernel.binding.pry
|
1626
|
+
- Kernel.binding.remote_pry
|
1627
|
+
- Kernel.binding.pry_remote
|
1583
1628
|
- Pry.rescue
|
1584
1629
|
Rails:
|
1585
1630
|
- debugger
|
@@ -1712,8 +1757,10 @@ Lint/EmptyClass:
|
|
1712
1757
|
Lint/EmptyConditionalBody:
|
1713
1758
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1714
1759
|
Enabled: true
|
1760
|
+
SafeAutoCorrect: false
|
1715
1761
|
AllowComments: true
|
1716
1762
|
VersionAdded: '0.89'
|
1763
|
+
VersionChanged: '1.34'
|
1717
1764
|
|
1718
1765
|
Lint/EmptyEnsure:
|
1719
1766
|
Description: 'Checks for empty ensure block.'
|
@@ -1929,6 +1976,13 @@ Lint/NoReturnInBeginEndBlocks:
|
|
1929
1976
|
Enabled: pending
|
1930
1977
|
VersionAdded: '1.2'
|
1931
1978
|
|
1979
|
+
Lint/NonAtomicFileOperation:
|
1980
|
+
Description: Checks for non-atomic file operations.
|
1981
|
+
StyleGuide: '#atomic-file-operations'
|
1982
|
+
Enabled: pending
|
1983
|
+
VersionAdded: '1.31'
|
1984
|
+
SafeAutoCorrect: false
|
1985
|
+
|
1932
1986
|
Lint/NonDeterministicRequireOrder:
|
1933
1987
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1934
1988
|
Enabled: true
|
@@ -1946,7 +2000,9 @@ Lint/NumberConversion:
|
|
1946
2000
|
VersionAdded: '0.53'
|
1947
2001
|
VersionChanged: '1.1'
|
1948
2002
|
SafeAutoCorrect: false
|
1949
|
-
|
2003
|
+
AllowedMethods: []
|
2004
|
+
AllowedPatterns: []
|
2005
|
+
IgnoredMethods: [] # deprecated
|
1950
2006
|
IgnoredClasses:
|
1951
2007
|
- Time
|
1952
2008
|
- DateTime
|
@@ -2095,6 +2151,11 @@ Lint/RequireParentheses:
|
|
2095
2151
|
Enabled: true
|
2096
2152
|
VersionAdded: '0.18'
|
2097
2153
|
|
2154
|
+
Lint/RequireRangeParentheses:
|
2155
|
+
Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
|
2156
|
+
Enabled: pending
|
2157
|
+
VersionAdded: '1.32'
|
2158
|
+
|
2098
2159
|
Lint/RequireRelativeSelfPath:
|
2099
2160
|
Description: 'Checks for uses a file requiring itself with `require_relative`.'
|
2100
2161
|
Enabled: pending
|
@@ -2341,6 +2402,12 @@ Lint/UselessAssignment:
|
|
2341
2402
|
Enabled: true
|
2342
2403
|
VersionAdded: '0.11'
|
2343
2404
|
|
2405
|
+
Lint/UselessElseWithoutRescue:
|
2406
|
+
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
2407
|
+
Enabled: true
|
2408
|
+
VersionAdded: '0.17'
|
2409
|
+
VersionChanged: '1.31'
|
2410
|
+
|
2344
2411
|
Lint/UselessMethodDefinition:
|
2345
2412
|
Description: 'Checks for useless method definitions.'
|
2346
2413
|
Enabled: true
|
@@ -2387,7 +2454,9 @@ Metrics/AbcSize:
|
|
2387
2454
|
VersionChanged: '1.5'
|
2388
2455
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
2389
2456
|
# a Float.
|
2390
|
-
|
2457
|
+
AllowedMethods: []
|
2458
|
+
AllowedPatterns: []
|
2459
|
+
IgnoredMethods: [] # deprecated
|
2391
2460
|
CountRepeatedAttributes: true
|
2392
2461
|
Max: 17
|
2393
2462
|
|
@@ -2400,10 +2469,12 @@ Metrics/BlockLength:
|
|
2400
2469
|
Max: 25
|
2401
2470
|
CountAsOne: []
|
2402
2471
|
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2403
|
-
|
2472
|
+
AllowedMethods:
|
2404
2473
|
# By default, exclude the `#refine` method, as it tends to have larger
|
2405
2474
|
# associated blocks.
|
2406
2475
|
- refine
|
2476
|
+
AllowedPatterns: []
|
2477
|
+
IgnoredMethods: [] # deprecated
|
2407
2478
|
Exclude:
|
2408
2479
|
- '**/*.gemspec'
|
2409
2480
|
|
@@ -2433,7 +2504,9 @@ Metrics/CyclomaticComplexity:
|
|
2433
2504
|
Enabled: true
|
2434
2505
|
VersionAdded: '0.25'
|
2435
2506
|
VersionChanged: '0.81'
|
2436
|
-
|
2507
|
+
AllowedMethods: []
|
2508
|
+
AllowedPatterns: []
|
2509
|
+
IgnoredMethods: [] # deprecated
|
2437
2510
|
Max: 7
|
2438
2511
|
|
2439
2512
|
Metrics/MethodLength:
|
@@ -2446,7 +2519,9 @@ Metrics/MethodLength:
|
|
2446
2519
|
Max: 10
|
2447
2520
|
CountAsOne: []
|
2448
2521
|
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2449
|
-
|
2522
|
+
AllowedMethods: []
|
2523
|
+
AllowedPatterns: []
|
2524
|
+
IgnoredMethods: [] # deprecated
|
2450
2525
|
|
2451
2526
|
Metrics/ModuleLength:
|
2452
2527
|
Description: 'Avoid modules longer than 100 lines of code.'
|
@@ -2474,7 +2549,9 @@ Metrics/PerceivedComplexity:
|
|
2474
2549
|
Enabled: true
|
2475
2550
|
VersionAdded: '0.25'
|
2476
2551
|
VersionChanged: '0.81'
|
2477
|
-
|
2552
|
+
AllowedMethods: []
|
2553
|
+
AllowedPatterns: []
|
2554
|
+
IgnoredMethods: [] # deprecated
|
2478
2555
|
Max: 8
|
2479
2556
|
|
2480
2557
|
################## Migration #############################
|
@@ -2717,6 +2794,7 @@ Naming/MethodParameterName:
|
|
2717
2794
|
AllowNamesEndingInNumbers: true
|
2718
2795
|
# Allowed names that will not register an offense
|
2719
2796
|
AllowedNames:
|
2797
|
+
- as
|
2720
2798
|
- at
|
2721
2799
|
- by
|
2722
2800
|
- db
|
@@ -2871,6 +2949,7 @@ Style/AccessModifierDeclarations:
|
|
2871
2949
|
- inline
|
2872
2950
|
- group
|
2873
2951
|
AllowModifiersOnSymbols: true
|
2952
|
+
SafeAutoCorrect: false
|
2874
2953
|
|
2875
2954
|
Style/AccessorGrouping:
|
2876
2955
|
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
@@ -3005,7 +3084,7 @@ Style/BlockDelimiters:
|
|
3005
3084
|
# This looks at the usage of a block's method to determine its type (e.g. is
|
3006
3085
|
# the result of a `map` assigned to a variable or passed to another
|
3007
3086
|
# method) but exceptions are permitted in the `ProceduralMethods`,
|
3008
|
-
# `FunctionalMethods` and `
|
3087
|
+
# `FunctionalMethods` and `AllowedMethods` sections below.
|
3009
3088
|
- semantic
|
3010
3089
|
# The `braces_for_chaining` style enforces braces around single line blocks
|
3011
3090
|
# and do..end around multi-line blocks, except for multi-line blocks whose
|
@@ -3046,7 +3125,7 @@ Style/BlockDelimiters:
|
|
3046
3125
|
- let!
|
3047
3126
|
- subject
|
3048
3127
|
- watch
|
3049
|
-
|
3128
|
+
AllowedMethods:
|
3050
3129
|
# Methods that can be either procedural or functional and cannot be
|
3051
3130
|
# categorised from their usage alone, e.g.
|
3052
3131
|
#
|
@@ -3063,6 +3142,8 @@ Style/BlockDelimiters:
|
|
3063
3142
|
- lambda
|
3064
3143
|
- proc
|
3065
3144
|
- it
|
3145
|
+
AllowedPatterns: []
|
3146
|
+
IgnoredMethods: [] # deprecated
|
3066
3147
|
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
3067
3148
|
# EnforcedStyle is set to `semantic`. If so:
|
3068
3149
|
#
|
@@ -3107,6 +3188,15 @@ Style/CaseEquality:
|
|
3107
3188
|
# # good
|
3108
3189
|
# String === "string"
|
3109
3190
|
AllowOnConstant: false
|
3191
|
+
# If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
|
3192
|
+
# the case equality operator is `self.class`.
|
3193
|
+
#
|
3194
|
+
# # bad
|
3195
|
+
# some_class === object
|
3196
|
+
#
|
3197
|
+
# # good
|
3198
|
+
# self.class === object
|
3199
|
+
AllowOnSelfClass: false
|
3110
3200
|
|
3111
3201
|
Style/CaseLikeIf:
|
3112
3202
|
Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
@@ -3166,10 +3256,12 @@ Style/ClassEqualityComparison:
|
|
3166
3256
|
StyleGuide: '#instance-of-vs-class-comparison'
|
3167
3257
|
Enabled: true
|
3168
3258
|
VersionAdded: '0.93'
|
3169
|
-
|
3259
|
+
AllowedMethods:
|
3170
3260
|
- ==
|
3171
3261
|
- equal?
|
3172
3262
|
- eql?
|
3263
|
+
AllowedPatterns: []
|
3264
|
+
IgnoredMethods: [] # deprecated
|
3173
3265
|
|
3174
3266
|
Style/ClassMethods:
|
3175
3267
|
Description: 'Use self when defining module/class methods.'
|
@@ -3456,6 +3548,12 @@ Style/EmptyElse:
|
|
3456
3548
|
- empty
|
3457
3549
|
- nil
|
3458
3550
|
- both
|
3551
|
+
AllowComments: false
|
3552
|
+
|
3553
|
+
Style/EmptyHeredoc:
|
3554
|
+
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
3555
|
+
Enabled: pending
|
3556
|
+
VersionAdded: '1.32'
|
3459
3557
|
|
3460
3558
|
Style/EmptyLambdaParameter:
|
3461
3559
|
Description: 'Omit parens for empty lambda parameters.'
|
@@ -3625,7 +3723,9 @@ Style/FormatStringToken:
|
|
3625
3723
|
MaxUnannotatedPlaceholdersAllowed: 1
|
3626
3724
|
VersionAdded: '0.49'
|
3627
3725
|
VersionChanged: '1.0'
|
3628
|
-
|
3726
|
+
AllowedMethods: []
|
3727
|
+
AllowedPatterns: []
|
3728
|
+
IgnoredMethods: [] # deprecated
|
3629
3729
|
|
3630
3730
|
Style/FrozenStringLiteralComment:
|
3631
3731
|
Description: >-
|
@@ -3670,7 +3770,7 @@ Style/GuardClause:
|
|
3670
3770
|
StyleGuide: '#no-nested-conditionals'
|
3671
3771
|
Enabled: true
|
3672
3772
|
VersionAdded: '0.20'
|
3673
|
-
VersionChanged: '1.
|
3773
|
+
VersionChanged: '1.31'
|
3674
3774
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
3675
3775
|
# needs to have to trigger this cop
|
3676
3776
|
MinBodyLength: 1
|
@@ -3711,6 +3811,7 @@ Style/HashExcept:
|
|
3711
3811
|
that can be replaced with `Hash#except` method.
|
3712
3812
|
Enabled: pending
|
3713
3813
|
VersionAdded: '1.7'
|
3814
|
+
VersionChanged: '1.31'
|
3714
3815
|
|
3715
3816
|
Style/HashLikeCase:
|
3716
3817
|
Description: >-
|
@@ -3749,6 +3850,8 @@ Style/HashSyntax:
|
|
3749
3850
|
- never
|
3750
3851
|
# accepts both shorthand and explicit use of hash literal value.
|
3751
3852
|
- either
|
3853
|
+
# like "always", but will avoid mixing styles in a single hash
|
3854
|
+
- consistent
|
3752
3855
|
# Force hashes that have a symbol value to use hash rockets
|
3753
3856
|
UseHashRocketsWithSymbolValues: false
|
3754
3857
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
@@ -3925,6 +4028,31 @@ Style/LineEndConcatenation:
|
|
3925
4028
|
VersionAdded: '0.18'
|
3926
4029
|
VersionChanged: '0.64'
|
3927
4030
|
|
4031
|
+
Style/MagicCommentFormat:
|
4032
|
+
Description: 'Use a consistent style for magic comments.'
|
4033
|
+
Enabled: pending
|
4034
|
+
VersionAdded: '1.35'
|
4035
|
+
EnforcedStyle: snake_case
|
4036
|
+
SupportedStyles:
|
4037
|
+
# `snake` will enforce the magic comment is written
|
4038
|
+
# in snake case (words separated by underscores).
|
4039
|
+
# Eg: froze_string_literal: true
|
4040
|
+
- snake_case
|
4041
|
+
# `kebab` will enforce the magic comment is written
|
4042
|
+
# in kebab case (words separated by hyphens).
|
4043
|
+
# Eg: froze-string-literal: true
|
4044
|
+
- kebab_case
|
4045
|
+
DirectiveCapitalization: lowercase
|
4046
|
+
ValueCapitalization: ~
|
4047
|
+
SupportedCapitalizations:
|
4048
|
+
- lowercase
|
4049
|
+
- uppercase
|
4050
|
+
|
4051
|
+
Style/MapCompactWithConditionalBlock:
|
4052
|
+
Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
|
4053
|
+
Enabled: pending
|
4054
|
+
VersionAdded: '1.30'
|
4055
|
+
|
3928
4056
|
Style/MapToHash:
|
3929
4057
|
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
3930
4058
|
Enabled: pending
|
@@ -3938,7 +4066,8 @@ Style/MethodCallWithArgsParentheses:
|
|
3938
4066
|
VersionAdded: '0.47'
|
3939
4067
|
VersionChanged: '1.7'
|
3940
4068
|
IgnoreMacros: true
|
3941
|
-
|
4069
|
+
AllowedMethods: []
|
4070
|
+
IgnoredMethods: [] # deprecated
|
3942
4071
|
AllowedPatterns: []
|
3943
4072
|
IgnoredPatterns: [] # deprecated
|
3944
4073
|
IncludedMacros: []
|
@@ -3955,7 +4084,9 @@ Style/MethodCallWithoutArgsParentheses:
|
|
3955
4084
|
Description: 'Do not use parentheses for method calls with no arguments.'
|
3956
4085
|
StyleGuide: '#method-invocation-parens'
|
3957
4086
|
Enabled: true
|
3958
|
-
|
4087
|
+
AllowedMethods: []
|
4088
|
+
AllowedPatterns: []
|
4089
|
+
IgnoredMethods: [] # deprecated
|
3959
4090
|
VersionAdded: '0.47'
|
3960
4091
|
VersionChanged: '0.55'
|
3961
4092
|
|
@@ -4307,6 +4438,7 @@ Style/NumericLiterals:
|
|
4307
4438
|
Strict: false
|
4308
4439
|
# You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
|
4309
4440
|
AllowedNumbers: []
|
4441
|
+
AllowedPatterns: []
|
4310
4442
|
|
4311
4443
|
Style/NumericPredicate:
|
4312
4444
|
Description: >-
|
@@ -4325,7 +4457,9 @@ Style/NumericPredicate:
|
|
4325
4457
|
SupportedStyles:
|
4326
4458
|
- predicate
|
4327
4459
|
- comparison
|
4328
|
-
|
4460
|
+
AllowedMethods: []
|
4461
|
+
AllowedPatterns: []
|
4462
|
+
IgnoredMethods: [] # deprecated
|
4329
4463
|
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
4330
4464
|
# false positives.
|
4331
4465
|
Exclude:
|
@@ -4592,7 +4726,9 @@ Style/RedundantInitialize:
|
|
4592
4726
|
Style/RedundantInterpolation:
|
4593
4727
|
Description: 'Checks for strings that are just an interpolated expression.'
|
4594
4728
|
Enabled: true
|
4729
|
+
SafeAutoCorrect: false
|
4595
4730
|
VersionAdded: '0.76'
|
4731
|
+
VersionChanged: '1.30'
|
4596
4732
|
|
4597
4733
|
Style/RedundantParentheses:
|
4598
4734
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
@@ -4706,7 +4842,7 @@ Style/SafeNavigation:
|
|
4706
4842
|
Transforms usages of a method call safeguarded by
|
4707
4843
|
a check for the existence of the object to
|
4708
4844
|
safe navigation (`&.`).
|
4709
|
-
|
4845
|
+
Autocorrection is unsafe as it assumes the object will
|
4710
4846
|
be `nil` or truthy, but never `false`.
|
4711
4847
|
Enabled: true
|
4712
4848
|
VersionAdded: '0.43'
|
@@ -4960,11 +5096,13 @@ Style/SymbolProc:
|
|
4960
5096
|
VersionAdded: '0.26'
|
4961
5097
|
VersionChanged: '1.28'
|
4962
5098
|
AllowMethodsWithArguments: false
|
4963
|
-
# A list of method names to be
|
5099
|
+
# A list of method names to be always allowed by the check.
|
4964
5100
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4965
|
-
|
5101
|
+
AllowedMethods:
|
4966
5102
|
- respond_to
|
4967
5103
|
- define_method
|
5104
|
+
AllowedPatterns: []
|
5105
|
+
IgnoredMethods: [] # deprecated
|
4968
5106
|
AllowComments: false
|
4969
5107
|
|
4970
5108
|
Style/TernaryParentheses:
|
data/config/obsoletion.yml
CHANGED
@@ -55,6 +55,8 @@ renamed:
|
|
55
55
|
|
56
56
|
# Cops that were removed
|
57
57
|
removed:
|
58
|
+
Gemspec/DateAssignment:
|
59
|
+
alternatives: Gemspec/DeprecatedAttributeAssignment
|
58
60
|
Layout/SpaceAfterControlKeyword:
|
59
61
|
alternatives: Layout/SpaceAroundKeyword
|
60
62
|
Layout/SpaceBeforeModifierKeyword:
|
@@ -185,7 +187,9 @@ changed_parameters:
|
|
185
187
|
- Metrics/BlockLength
|
186
188
|
- Metrics/MethodLength
|
187
189
|
parameters: ExcludedMethods
|
188
|
-
|
190
|
+
alternatives:
|
191
|
+
- AllowedMethods
|
192
|
+
- AllowedPatterns
|
189
193
|
severity: warning
|
190
194
|
- cops: Lint/Debugger
|
191
195
|
parameters: DebuggerReceivers
|
@@ -200,6 +204,26 @@ changed_parameters:
|
|
200
204
|
parameters: IgnoredPatterns
|
201
205
|
alternative: AllowedPatterns
|
202
206
|
severity: warning
|
207
|
+
- cops:
|
208
|
+
- Lint/AmbiguousBlockAssociation
|
209
|
+
- Lint/NumberConversion
|
210
|
+
- Metrics/AbcSize
|
211
|
+
- Metrics/BlockLength
|
212
|
+
- Metrics/CyclomaticComplexity
|
213
|
+
- Metrics/MethodLength
|
214
|
+
- Metrics/PerceivedComplexity
|
215
|
+
- Style/BlockDelimiters
|
216
|
+
- Style/ClassEqualityComparison
|
217
|
+
- Style/FormatStringToken
|
218
|
+
- Style/MethodCallWithArgsParentheses
|
219
|
+
- Style/MethodCallWithoutArgsParentheses
|
220
|
+
- Style/NumericPredicate
|
221
|
+
- Style/SymbolLiteral
|
222
|
+
parameters: IgnoredMethods
|
223
|
+
alternatives:
|
224
|
+
- AllowedMethods
|
225
|
+
- AllowedPatterns
|
226
|
+
severity: warning
|
203
227
|
|
204
228
|
# Enforced styles that have been removed or replaced
|
205
229
|
changed_enforced_styles:
|
data/exe/rubocop
CHANGED
@@ -3,13 +3,21 @@
|
|
3
3
|
|
4
4
|
$LOAD_PATH.unshift("#{__dir__}/../lib")
|
5
5
|
|
6
|
-
require 'rubocop'
|
7
|
-
|
6
|
+
require 'rubocop/server'
|
7
|
+
server_cli = RuboCop::Server::CLI.new
|
8
|
+
exit_status = server_cli.run
|
9
|
+
exit exit_status if server_cli.exit?
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
+
if RuboCop::Server.running?
|
12
|
+
exit_status = RuboCop::Server::ClientCommand::Exec.new.run
|
13
|
+
else
|
14
|
+
require 'rubocop'
|
15
|
+
require 'benchmark'
|
11
16
|
|
12
|
-
|
17
|
+
cli = RuboCop::CLI.new
|
13
18
|
|
14
|
-
|
15
|
-
|
19
|
+
time = Benchmark.realtime { exit_status = cli.run }
|
20
|
+
|
21
|
+
puts "Finished in #{time} seconds" if cli.options[:debug] || cli.options[:display_time]
|
22
|
+
end
|
23
|
+
exit exit_status
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
# This class represents the cache config of the caching RuboCop runs.
|
5
|
+
# @api private
|
6
|
+
class CacheConfig
|
7
|
+
def self.root_dir
|
8
|
+
root = ENV.fetch('RUBOCOP_CACHE_ROOT', nil)
|
9
|
+
root ||= yield
|
10
|
+
root ||= if ENV.key?('XDG_CACHE_HOME')
|
11
|
+
# Include user ID in the path to make sure the user has write
|
12
|
+
# access.
|
13
|
+
File.join(ENV.fetch('XDG_CACHE_HOME'), Process.uid.to_s)
|
14
|
+
else
|
15
|
+
# On FreeBSD, the /home path is a symbolic link to /usr/home
|
16
|
+
# and the $HOME environment variable returns the /home path.
|
17
|
+
#
|
18
|
+
# As $HOME is a built-in environment variable, FreeBSD users
|
19
|
+
# always get a warning message.
|
20
|
+
#
|
21
|
+
# To avoid raising warn log messages on FreeBSD, we retrieve
|
22
|
+
# the real path of the home folder.
|
23
|
+
File.join(File.realpath(Dir.home), '.cache')
|
24
|
+
end
|
25
|
+
|
26
|
+
File.join(root, 'rubocop_cache')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -66,6 +66,7 @@ module RuboCop
|
|
66
66
|
execute_runner
|
67
67
|
@options.delete(:only)
|
68
68
|
@config_store = ConfigStore.new
|
69
|
+
@config_store.options_config = @options[:config] if @options[:config]
|
69
70
|
# Save the todo configuration of the LineLength cop.
|
70
71
|
File.read(AUTO_GENERATED_FILE).lines.drop_while { |line| line.start_with?('#') }.join
|
71
72
|
end
|
@@ -95,23 +96,24 @@ module RuboCop
|
|
95
96
|
end
|
96
97
|
|
97
98
|
def add_inheritance_from_auto_generated_file(config_file)
|
98
|
-
file_string = " #{
|
99
|
+
file_string = " #{relative_path_to_todo_from_options_config}"
|
99
100
|
|
100
|
-
config_file ||=
|
101
|
+
config_file ||= ConfigFinder::DOTFILE
|
101
102
|
|
102
103
|
if File.exist?(config_file)
|
103
104
|
files = Array(ConfigLoader.load_yaml_configuration(config_file)['inherit_from'])
|
104
105
|
|
105
|
-
return if files.include?(
|
106
|
+
return if files.include?(relative_path_to_todo_from_options_config)
|
106
107
|
|
107
|
-
files.unshift(
|
108
|
+
files.unshift(relative_path_to_todo_from_options_config)
|
108
109
|
file_string = "\n - #{files.join("\n - ")}" if files.size > 1
|
109
110
|
rubocop_yml_contents = existing_configuration(config_file)
|
110
111
|
end
|
111
112
|
|
112
113
|
write_config_file(config_file, file_string, rubocop_yml_contents)
|
113
114
|
|
114
|
-
puts "Added inheritance from `#{
|
115
|
+
puts "Added inheritance from `#{relative_path_to_todo_from_options_config}` " \
|
116
|
+
"in `#{ConfigFinder::DOTFILE}`."
|
115
117
|
end
|
116
118
|
|
117
119
|
def existing_configuration(config_file)
|
@@ -126,6 +128,19 @@ module RuboCop
|
|
126
128
|
lines.insert(doc_start_index + 1, "inherit_from:#{file_string}\n")
|
127
129
|
File.write(file_name, lines.join("\n"))
|
128
130
|
end
|
131
|
+
|
132
|
+
def relative_path_to_todo_from_options_config
|
133
|
+
return AUTO_GENERATED_FILE if !@options[:config] || options_config_in_root?
|
134
|
+
|
135
|
+
base = Pathname.new('.')
|
136
|
+
config_dir = Pathname.new(File.dirname(@options[:config]))
|
137
|
+
|
138
|
+
"#{base.relative_path_from(config_dir)}/#{AUTO_GENERATED_FILE}"
|
139
|
+
end
|
140
|
+
|
141
|
+
def options_config_in_root?
|
142
|
+
File.dirname(@options[:config]) == '.'
|
143
|
+
end
|
129
144
|
end
|
130
145
|
end
|
131
146
|
end
|
@@ -89,7 +89,7 @@ module RuboCop
|
|
89
89
|
# See: https://github.com/rubocop/rubocop/issues/8673
|
90
90
|
return if INTEGRATION_FORMATTERS.include?(@options[:format])
|
91
91
|
|
92
|
-
return unless @options[:stdin] && @options[:
|
92
|
+
return unless @options[:stdin] && @options[:autocorrect]
|
93
93
|
|
94
94
|
(@options[:stderr] ? $stderr : $stdout).puts '=' * 20
|
95
95
|
print @options[:stdin]
|