rubocop 0.87.1 → 0.89.1
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 +1 -1
- data/bin/rubocop-profile +32 -0
- data/config/default.yml +153 -22
- data/lib/rubocop.rb +22 -4
- data/lib/rubocop/cli.rb +2 -2
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +3 -3
- data/lib/rubocop/cli/command/base.rb +1 -0
- data/lib/rubocop/cli/command/execute_runner.rb +1 -1
- data/lib/rubocop/cli/command/show_cops.rb +2 -2
- data/lib/rubocop/cli/command/version.rb +2 -2
- data/lib/rubocop/comment_config.rb +5 -7
- data/lib/rubocop/config.rb +20 -3
- data/lib/rubocop/config_loader.rb +22 -9
- data/lib/rubocop/config_loader_resolver.rb +3 -3
- data/lib/rubocop/config_obsoletion.rb +6 -1
- data/lib/rubocop/config_store.rb +4 -0
- data/lib/rubocop/config_validator.rb +2 -4
- data/lib/rubocop/cop/autocorrect_logic.rb +1 -1
- data/lib/rubocop/cop/badge.rb +1 -1
- data/lib/rubocop/cop/base.rb +14 -6
- data/lib/rubocop/cop/commissioner.rb +0 -1
- data/lib/rubocop/cop/cop.rb +1 -1
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +4 -4
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +26 -0
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/punctuation_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +15 -18
- data/lib/rubocop/cop/force.rb +1 -0
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +38 -12
- data/lib/rubocop/cop/generator/configuration_injector.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +4 -12
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +8 -8
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +10 -7
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +7 -8
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -2
- data/lib/rubocop/cop/layout/block_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/class_structure.rb +3 -7
- data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines.rb +0 -2
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +1 -0
- data/lib/rubocop/cop/layout/end_alignment.rb +3 -2
- data/lib/rubocop/cop/layout/extra_spacing.rb +22 -36
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/indentation_style.rb +0 -2
- data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +16 -5
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +0 -2
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +3 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +33 -66
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +3 -2
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +7 -4
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +15 -10
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +11 -13
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +2 -2
- data/lib/rubocop/cop/lint/big_decimal_new.rb +10 -10
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +50 -0
- data/lib/rubocop/cop/lint/boolean_symbol.rb +16 -11
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
- data/lib/rubocop/cop/lint/constant_resolution.rb +1 -1
- data/lib/rubocop/cop/lint/debugger.rb +7 -1
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +9 -10
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +17 -13
- data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +8 -2
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +39 -0
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +9 -6
- data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +60 -0
- 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_conditional_body.rb +67 -0
- data/lib/rubocop/cop/lint/empty_ensure.rb +5 -5
- data/lib/rubocop/cop/lint/empty_expression.rb +2 -2
- data/lib/rubocop/cop/lint/empty_interpolation.rb +5 -6
- data/lib/rubocop/cop/lint/empty_when.rb +2 -2
- data/lib/rubocop/cop/lint/ensure_return.rb +27 -29
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +11 -10
- data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
- data/lib/rubocop/cop/lint/float_comparison.rb +93 -0
- data/lib/rubocop/cop/lint/float_out_of_range.rb +1 -1
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +5 -4
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +13 -14
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +5 -4
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +8 -8
- data/lib/rubocop/cop/lint/inherit_exception.rb +12 -7
- data/lib/rubocop/cop/lint/interpolation_check.rb +18 -15
- data/lib/rubocop/cop/lint/literal_as_condition.rb +14 -2
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +7 -7
- data/lib/rubocop/cop/lint/loop.rb +23 -2
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +6 -5
- data/lib/rubocop/cop/lint/missing_super.rb +99 -0
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
- data/lib/rubocop/cop/lint/multiple_comparison.rb +6 -9
- data/lib/rubocop/cop/lint/nested_method_definition.rb +14 -20
- 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_deterministic_require_order.rb +82 -11
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +2 -2
- data/lib/rubocop/cop/lint/number_conversion.rb +6 -9
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +11 -13
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +90 -0
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +4 -10
- data/lib/rubocop/cop/lint/percent_string_array.rb +13 -12
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +13 -12
- data/lib/rubocop/cop/lint/raise_exception.rb +12 -10
- data/lib/rubocop/cop/lint/rand_one.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +16 -19
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +7 -11
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +4 -7
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +13 -9
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +6 -13
- data/lib/rubocop/cop/lint/redundant_with_index.rb +11 -14
- data/lib/rubocop/cop/lint/redundant_with_object.rb +11 -14
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +4 -6
- data/lib/rubocop/cop/lint/require_parentheses.rb +2 -2
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_type.rb +8 -8
- data/lib/rubocop/cop/lint/return_in_void_context.rb +2 -4
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +3 -6
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +14 -10
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +7 -7
- data/lib/rubocop/cop/lint/script_permission.rb +10 -7
- data/lib/rubocop/cop/lint/self_assignment.rb +78 -0
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +5 -11
- data/lib/rubocop/cop/lint/shadowed_argument.rb +3 -3
- data/lib/rubocop/cop/lint/shadowed_exception.rb +2 -2
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +3 -3
- data/lib/rubocop/cop/lint/struct_new_override.rb +1 -1
- data/lib/rubocop/cop/lint/suppressed_exception.rb +4 -7
- data/lib/rubocop/cop/lint/to_json.rb +4 -6
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +34 -0
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +4 -4
- data/lib/rubocop/cop/lint/unified_integer.rb +4 -6
- data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_loop.rb +174 -0
- data/lib/rubocop/cop/lint/unused_block_argument.rb +8 -3
- data/lib/rubocop/cop/lint/unused_method_argument.rb +8 -3
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
- data/lib/rubocop/cop/lint/uri_regexp.rb +11 -47
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +25 -15
- data/lib/rubocop/cop/lint/useless_assignment.rb +4 -4
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +6 -15
- data/lib/rubocop/cop/lint/useless_setter_call.rb +4 -6
- data/lib/rubocop/cop/lint/void.rb +3 -7
- 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/block_nesting.rb +2 -2
- data/lib/rubocop/cop/metrics/class_length.rb +2 -2
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +2 -1
- data/lib/rubocop/cop/metrics/method_length.rb +2 -2
- data/lib/rubocop/cop/metrics/module_length.rb +2 -2
- data/lib/rubocop/cop/metrics/parameter_lists.rb +2 -6
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +7 -8
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +48 -5
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +52 -24
- data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +37 -0
- data/lib/rubocop/cop/migration/department_name.rb +14 -16
- data/lib/rubocop/cop/mixin/alignment.rb +2 -1
- data/lib/rubocop/cop/mixin/array_min_size.rb +1 -1
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +2 -2
- data/lib/rubocop/cop/mixin/code_length.rb +22 -5
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +5 -11
- data/lib/rubocop/cop/mixin/line_length_help.rb +1 -3
- data/lib/rubocop/cop/mixin/method_complexity.rb +10 -2
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -2
- data/lib/rubocop/cop/mixin/percent_array.rb +2 -6
- data/lib/rubocop/cop/mixin/range_help.rb +18 -4
- data/lib/rubocop/cop/mixin/statement_modifier.rb +39 -10
- data/lib/rubocop/cop/mixin/surrounding_space.rb +0 -25
- data/lib/rubocop/cop/mixin/trailing_comma.rb +2 -4
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +6 -13
- data/lib/rubocop/cop/mixin/unused_argument.rb +4 -6
- data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -2
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +3 -3
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +2 -2
- data/lib/rubocop/cop/naming/constant_name.rb +2 -2
- data/lib/rubocop/cop/naming/file_name.rb +3 -3
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +2 -2
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +2 -2
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +2 -2
- data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/predicate_name.rb +3 -5
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +12 -11
- data/lib/rubocop/cop/registry.rb +3 -3
- data/lib/rubocop/cop/security/eval.rb +2 -2
- data/lib/rubocop/cop/security/json_load.rb +6 -8
- data/lib/rubocop/cop/security/marshal_load.rb +2 -4
- data/lib/rubocop/cop/security/open.rb +2 -2
- data/lib/rubocop/cop/security/yaml_load.rb +6 -6
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +16 -9
- data/lib/rubocop/cop/style/accessor_grouping.rb +29 -20
- data/lib/rubocop/cop/style/alias.rb +41 -36
- data/lib/rubocop/cop/style/and_or.rb +9 -11
- data/lib/rubocop/cop/style/array_coercion.rb +63 -0
- data/lib/rubocop/cop/style/array_join.rb +6 -8
- data/lib/rubocop/cop/style/ascii_comments.rb +4 -4
- data/lib/rubocop/cop/style/attr.rb +11 -9
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +5 -7
- data/lib/rubocop/cop/style/bare_percent_literals.rb +10 -12
- data/lib/rubocop/cop/style/begin_block.rb +2 -2
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +14 -18
- data/lib/rubocop/cop/style/block_comments.rb +14 -18
- data/lib/rubocop/cop/style/block_delimiters.rb +23 -23
- data/lib/rubocop/cop/style/case_equality.rb +22 -3
- data/lib/rubocop/cop/style/case_like_if.rb +220 -0
- data/lib/rubocop/cop/style/class_and_module_children.rb +14 -11
- data/lib/rubocop/cop/style/class_check.rb +7 -9
- data/lib/rubocop/cop/style/class_methods.rb +7 -11
- data/lib/rubocop/cop/style/class_vars.rb +6 -10
- data/lib/rubocop/cop/style/collection_methods.rb +11 -17
- data/lib/rubocop/cop/style/colon_method_call.rb +8 -9
- data/lib/rubocop/cop/style/colon_method_definition.rb +6 -6
- data/lib/rubocop/cop/style/command_literal.rb +23 -24
- data/lib/rubocop/cop/style/comment_annotation.rb +15 -15
- data/lib/rubocop/cop/style/commented_keyword.rb +6 -3
- data/lib/rubocop/cop/style/conditional_assignment.rb +13 -4
- data/lib/rubocop/cop/style/constant_visibility.rb +3 -2
- data/lib/rubocop/cop/style/copyright.rb +12 -12
- data/lib/rubocop/cop/style/date_time.rb +1 -1
- data/lib/rubocop/cop/style/def_with_parentheses.rb +8 -10
- data/lib/rubocop/cop/style/dir.rb +7 -10
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +7 -9
- data/lib/rubocop/cop/style/documentation.rb +6 -8
- data/lib/rubocop/cop/style/documentation_method.rb +1 -1
- data/lib/rubocop/cop/style/double_cop_disable_directive.rb +12 -15
- data/lib/rubocop/cop/style/double_negation.rb +2 -2
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +5 -8
- data/lib/rubocop/cop/style/each_with_object.rb +16 -19
- data/lib/rubocop/cop/style/empty_case_condition.rb +19 -20
- data/lib/rubocop/cop/style/empty_else.rb +17 -19
- data/lib/rubocop/cop/style/empty_literal.rb +15 -16
- data/lib/rubocop/cop/style/empty_method.rb +10 -13
- data/lib/rubocop/cop/style/encoding.rb +5 -9
- data/lib/rubocop/cop/style/end_block.rb +4 -6
- data/lib/rubocop/cop/style/eval_with_location.rb +9 -7
- data/lib/rubocop/cop/style/even_odd.rb +7 -11
- data/lib/rubocop/cop/style/expand_path_arguments.rb +21 -20
- data/lib/rubocop/cop/style/explicit_block_argument.rb +102 -0
- data/lib/rubocop/cop/style/exponential_notation.rb +7 -9
- data/lib/rubocop/cop/style/float_division.rb +8 -11
- data/lib/rubocop/cop/style/for.rb +11 -15
- data/lib/rubocop/cop/style/format_string.rb +21 -19
- data/lib/rubocop/cop/style/format_string_token.rb +10 -12
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +19 -41
- data/lib/rubocop/cop/style/global_std_stream.rb +65 -0
- data/lib/rubocop/cop/style/global_vars.rb +2 -2
- data/lib/rubocop/cop/style/guard_clause.rb +5 -6
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +69 -0
- data/lib/rubocop/cop/style/hash_each_methods.rb +5 -8
- data/lib/rubocop/cop/style/hash_like_case.rb +76 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +4 -3
- data/lib/rubocop/cop/style/hash_transform_keys.rb +3 -2
- data/lib/rubocop/cop/style/hash_transform_values.rb +2 -1
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +2 -2
- data/lib/rubocop/cop/style/if_inside_else.rb +3 -3
- data/lib/rubocop/cop/style/if_unless_modifier.rb +18 -40
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +3 -7
- data/lib/rubocop/cop/style/if_with_semicolon.rb +3 -6
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +1 -1
- data/lib/rubocop/cop/style/infinite_loop.rb +24 -24
- data/lib/rubocop/cop/style/inline_comment.rb +3 -3
- data/lib/rubocop/cop/style/inverse_methods.rb +22 -32
- data/lib/rubocop/cop/style/lambda.rb +7 -12
- data/lib/rubocop/cop/style/lambda_call.rb +14 -13
- data/lib/rubocop/cop/style/line_end_concatenation.rb +19 -16
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +2 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +16 -11
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +4 -8
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +8 -7
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +2 -2
- data/lib/rubocop/cop/style/method_def_parentheses.rb +11 -16
- data/lib/rubocop/cop/style/min_max.rb +8 -12
- data/lib/rubocop/cop/style/missing_else.rb +11 -21
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +10 -3
- data/lib/rubocop/cop/style/mixin_grouping.rb +24 -27
- data/lib/rubocop/cop/style/mixin_usage.rb +1 -1
- data/lib/rubocop/cop/style/module_function.rb +10 -13
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +3 -10
- data/lib/rubocop/cop/style/multiline_if_then.rb +4 -10
- data/lib/rubocop/cop/style/multiline_memoization.rb +14 -12
- data/lib/rubocop/cop/style/multiline_method_signature.rb +2 -2
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +4 -6
- data/lib/rubocop/cop/style/multiline_when_then.rb +7 -9
- data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +23 -20
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +3 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +7 -4
- data/lib/rubocop/cop/style/optional_boolean_parameter.rb +42 -0
- data/lib/rubocop/cop/style/parallel_assignment.rb +5 -5
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/random_with_offset.rb +1 -0
- data/lib/rubocop/cop/style/redundant_condition.rb +15 -3
- data/lib/rubocop/cop/style/redundant_exception.rb +4 -0
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +50 -0
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +9 -9
- data/lib/rubocop/cop/style/redundant_sort.rb +26 -12
- data/lib/rubocop/cop/style/safe_navigation.rb +4 -4
- data/lib/rubocop/cop/style/signal_exception.rb +2 -0
- data/lib/rubocop/cop/style/single_argument_dig.rb +54 -0
- data/lib/rubocop/cop/style/single_line_methods.rb +1 -1
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +3 -2
- data/lib/rubocop/cop/style/string_concatenation.rb +92 -0
- data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
- data/lib/rubocop/cop/style/symbol_array.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +9 -32
- data/lib/rubocop/cop/style/zero_length_predicate.rb +10 -6
- data/lib/rubocop/cop/team.rb +1 -1
- data/lib/rubocop/cop/tokens_util.rb +84 -0
- data/lib/rubocop/cop/util.rb +3 -13
- data/lib/rubocop/cop/variable_force.rb +0 -2
- data/lib/rubocop/cop/variable_force/branch.rb +1 -0
- data/lib/rubocop/cop/variable_force/variable.rb +7 -5
- data/lib/rubocop/cops_documentation_generator.rb +282 -0
- data/lib/rubocop/error.rb +1 -0
- data/lib/rubocop/file_finder.rb +12 -12
- data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
- data/lib/rubocop/formatter/formatter_set.rb +1 -0
- data/lib/rubocop/formatter/junit_formatter.rb +1 -1
- data/lib/rubocop/options.rb +3 -3
- data/lib/rubocop/path_util.rb +17 -17
- data/lib/rubocop/rake_task.rb +1 -0
- data/lib/rubocop/result_cache.rb +12 -8
- data/lib/rubocop/rspec/expect_offense.rb +31 -5
- data/lib/rubocop/rspec/shared_contexts.rb +13 -14
- data/lib/rubocop/runner.rb +6 -7
- data/lib/rubocop/target_finder.rb +13 -10
- data/lib/rubocop/version.rb +2 -2
- metadata +28 -8
- data/lib/rubocop/cop/lint/useless_comparison.rb +0 -28
- data/lib/rubocop/cop/mixin/parser_diagnostic.rb +0 -37
- data/lib/rubocop/cop/mixin/too_many_lines.rb +0 -25
- data/lib/rubocop/cop/style/method_missing_super.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3201b273ee3a04b13a9f41d768d230a5be311881c7fd0b39f24aa0d99a8a16ad
|
4
|
+
data.tar.gz: 794ba4bfcadcee6a8a9aae92f88c167dc1f75122e69f4bee08baa8f22976c1bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2ea28c0fbfaa2f37ef651b91f38e3084fda1d8c829ebc1aaa839c793f0b759deb692bc70482d863797ab33799af9e083ab7f274f4faa905b956b4b53fbab96b
|
7
|
+
data.tar.gz: 2ac4b6b2e1852c4ca1df725c6de4f6d34442633cb7dea00f27499ebae6e24ad006110dd0b473c781961d6e44819039a5e5748ac0de6ec0a1b2cbceb950c3fcf2
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
49
49
|
might want to use a conservative version lock in your `Gemfile`:
|
50
50
|
|
51
51
|
```rb
|
52
|
-
gem 'rubocop', '~> 0.
|
52
|
+
gem 'rubocop', '~> 0.89.1', require: false
|
53
53
|
```
|
54
54
|
|
55
55
|
## Quickstart
|
data/bin/rubocop-profile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
if ARGV.include?('-h') || ARGV.include?('--help')
|
5
|
+
puts "Usage: same as main `rubocop` command but gathers profiling info"
|
6
|
+
puts "Additional option: `--memory` to print memory usage"
|
7
|
+
exit(0)
|
8
|
+
end
|
9
|
+
with_mem = ARGV.delete('--memory')
|
10
|
+
ARGV.unshift '--cache', 'false' unless ARGV.include?('--cache')
|
11
|
+
|
12
|
+
require 'stackprof'
|
13
|
+
if with_mem
|
14
|
+
require 'memory_profiler'
|
15
|
+
MemoryProfiler.start
|
16
|
+
end
|
17
|
+
StackProf.start
|
18
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
19
|
+
begin
|
20
|
+
load "#{__dir__}/../exe/rubocop"
|
21
|
+
ensure
|
22
|
+
delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
23
|
+
puts "Finished in #{delta.round(1)} seconds"
|
24
|
+
StackProf.stop
|
25
|
+
if with_mem
|
26
|
+
puts "Building memory report..."
|
27
|
+
report = MemoryProfiler.stop
|
28
|
+
end
|
29
|
+
Dir.mkdir('tmp') unless File.exist?('tmp')
|
30
|
+
StackProf.results('tmp/stackprof.dump')
|
31
|
+
report&.pretty_print(scale_bytes: true)
|
32
|
+
end
|
data/config/default.yml
CHANGED
@@ -210,9 +210,10 @@ Gemspec/OrderedDependencies:
|
|
210
210
|
- '**/*.gemspec'
|
211
211
|
|
212
212
|
Gemspec/RequiredRubyVersion:
|
213
|
-
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml
|
213
|
+
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
214
214
|
Enabled: true
|
215
215
|
VersionAdded: '0.52'
|
216
|
+
VersionChanged: '0.89'
|
216
217
|
Include:
|
217
218
|
- '**/*.gemspec'
|
218
219
|
|
@@ -1234,7 +1235,7 @@ Layout/SpaceInsideBlockBraces:
|
|
1234
1235
|
|
1235
1236
|
Layout/SpaceInsideHashLiteralBraces:
|
1236
1237
|
Description: "Use spaces inside hash literal braces - or don't."
|
1237
|
-
StyleGuide: '#spaces-
|
1238
|
+
StyleGuide: '#spaces-braces'
|
1238
1239
|
Enabled: true
|
1239
1240
|
VersionAdded: '0.49'
|
1240
1241
|
EnforcedStyle: space
|
@@ -1355,6 +1356,12 @@ Lint/BigDecimalNew:
|
|
1355
1356
|
Enabled: true
|
1356
1357
|
VersionAdded: '0.53'
|
1357
1358
|
|
1359
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
1360
|
+
Description: 'This cop checks for places where binary operator has identical operands.'
|
1361
|
+
Enabled: pending
|
1362
|
+
Safe: false
|
1363
|
+
VersionAdded: '0.89'
|
1364
|
+
|
1358
1365
|
Lint/BooleanSymbol:
|
1359
1366
|
Description: 'Check for `:true` and `:false` symbols.'
|
1360
1367
|
Enabled: true
|
@@ -1397,12 +1404,18 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
1397
1404
|
Enabled: true
|
1398
1405
|
Safe: false
|
1399
1406
|
VersionAdded: '0.62'
|
1407
|
+
VersionChanged: '0.88'
|
1400
1408
|
|
1401
1409
|
Lint/DuplicateCaseCondition:
|
1402
1410
|
Description: 'Do not repeat values in case conditionals.'
|
1403
1411
|
Enabled: true
|
1404
1412
|
VersionAdded: '0.45'
|
1405
1413
|
|
1414
|
+
Lint/DuplicateElsifCondition:
|
1415
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1416
|
+
Enabled: 'pending'
|
1417
|
+
VersionAdded: '0.88'
|
1418
|
+
|
1406
1419
|
Lint/DuplicateHashKey:
|
1407
1420
|
Description: 'Check for duplicate keys in hash literals.'
|
1408
1421
|
Enabled: true
|
@@ -1414,6 +1427,11 @@ Lint/DuplicateMethods:
|
|
1414
1427
|
Enabled: true
|
1415
1428
|
VersionAdded: '0.29'
|
1416
1429
|
|
1430
|
+
Lint/DuplicateRescueException:
|
1431
|
+
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1432
|
+
Enabled: pending
|
1433
|
+
VersionAdded: '0.89'
|
1434
|
+
|
1417
1435
|
Lint/EachWithObjectArgument:
|
1418
1436
|
Description: 'Check for immutable argument given to each_with_object.'
|
1419
1437
|
Enabled: true
|
@@ -1424,6 +1442,12 @@ Lint/ElseLayout:
|
|
1424
1442
|
Enabled: true
|
1425
1443
|
VersionAdded: '0.17'
|
1426
1444
|
|
1445
|
+
Lint/EmptyConditionalBody:
|
1446
|
+
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1447
|
+
Enabled: 'pending'
|
1448
|
+
AllowComments: true
|
1449
|
+
VersionAdded: '0.89'
|
1450
|
+
|
1427
1451
|
Lint/EmptyEnsure:
|
1428
1452
|
Description: 'Checks for empty ensure block.'
|
1429
1453
|
Enabled: true
|
@@ -1467,6 +1491,12 @@ Lint/FlipFlop:
|
|
1467
1491
|
Enabled: true
|
1468
1492
|
VersionAdded: '0.16'
|
1469
1493
|
|
1494
|
+
Lint/FloatComparison:
|
1495
|
+
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1496
|
+
StyleGuide: '#float-comparison'
|
1497
|
+
Enabled: pending
|
1498
|
+
VersionAdded: '0.89'
|
1499
|
+
|
1470
1500
|
Lint/FloatOutOfRange:
|
1471
1501
|
Description: >-
|
1472
1502
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1514,7 +1544,7 @@ Lint/InheritException:
|
|
1514
1544
|
Lint/InterpolationCheck:
|
1515
1545
|
Description: 'Raise warning for interpolation in single q strs.'
|
1516
1546
|
Enabled: true
|
1517
|
-
|
1547
|
+
Safe: false
|
1518
1548
|
VersionAdded: '0.50'
|
1519
1549
|
VersionChanged: '0.87'
|
1520
1550
|
|
@@ -1536,6 +1566,7 @@ Lint/Loop:
|
|
1536
1566
|
StyleGuide: '#loop-with-break'
|
1537
1567
|
Enabled: true
|
1538
1568
|
VersionAdded: '0.9'
|
1569
|
+
VersionChanged: '0.89'
|
1539
1570
|
|
1540
1571
|
Lint/MissingCopEnableDirective:
|
1541
1572
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1550,6 +1581,13 @@ Lint/MissingCopEnableDirective:
|
|
1550
1581
|
# .inf for any size
|
1551
1582
|
MaximumRangeSize: .inf
|
1552
1583
|
|
1584
|
+
Lint/MissingSuper:
|
1585
|
+
Description: >-
|
1586
|
+
This cop checks for the presence of constructors and lifecycle callbacks
|
1587
|
+
without calls to `super`'.
|
1588
|
+
Enabled: pending
|
1589
|
+
VersionAdded: '0.89'
|
1590
|
+
|
1553
1591
|
Lint/MixedRegexpCaptureTypes:
|
1554
1592
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1555
1593
|
Enabled: pending
|
@@ -1602,6 +1640,12 @@ Lint/OrderedMagicComments:
|
|
1602
1640
|
Enabled: true
|
1603
1641
|
VersionAdded: '0.53'
|
1604
1642
|
|
1643
|
+
Lint/OutOfRangeRegexpRef:
|
1644
|
+
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1645
|
+
Enabled: pending
|
1646
|
+
Safe: false
|
1647
|
+
VersionAdded: '0.89'
|
1648
|
+
|
1605
1649
|
Lint/ParenthesesAsGroupedExpression:
|
1606
1650
|
Description: >-
|
1607
1651
|
Checks for method calls with a space before the opening
|
@@ -1752,6 +1796,11 @@ Lint/ScriptPermission:
|
|
1752
1796
|
VersionAdded: '0.49'
|
1753
1797
|
VersionChanged: '0.50'
|
1754
1798
|
|
1799
|
+
Lint/SelfAssignment:
|
1800
|
+
Description: 'Checks for self-assignments.'
|
1801
|
+
Enabled: pending
|
1802
|
+
VersionAdded: '0.89'
|
1803
|
+
|
1755
1804
|
Lint/SendWithMixinArgument:
|
1756
1805
|
Description: 'Checks for `send` method when using mixin.'
|
1757
1806
|
Enabled: true
|
@@ -1802,6 +1851,11 @@ Lint/ToJSON:
|
|
1802
1851
|
Enabled: true
|
1803
1852
|
VersionAdded: '0.66'
|
1804
1853
|
|
1854
|
+
Lint/TopLevelReturnWithArgument:
|
1855
|
+
Description: 'This cop detects top level return statements with argument.'
|
1856
|
+
Enabled: 'pending'
|
1857
|
+
VersionAdded: '0.89'
|
1858
|
+
|
1805
1859
|
Lint/UnderscorePrefixedVariableName:
|
1806
1860
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1807
1861
|
Enabled: true
|
@@ -1818,6 +1872,11 @@ Lint/UnreachableCode:
|
|
1818
1872
|
Enabled: true
|
1819
1873
|
VersionAdded: '0.9'
|
1820
1874
|
|
1875
|
+
Lint/UnreachableLoop:
|
1876
|
+
Description: 'This cop checks for loops that will have at most one iteration.'
|
1877
|
+
Enabled: pending
|
1878
|
+
VersionAdded: '0.89'
|
1879
|
+
|
1821
1880
|
Lint/UnusedBlockArgument:
|
1822
1881
|
Description: 'Checks for unused block arguments.'
|
1823
1882
|
StyleGuide: '#underscore-unused-vars'
|
@@ -1867,11 +1926,6 @@ Lint/UselessAssignment:
|
|
1867
1926
|
Enabled: true
|
1868
1927
|
VersionAdded: '0.11'
|
1869
1928
|
|
1870
|
-
Lint/UselessComparison:
|
1871
|
-
Description: 'Checks for comparison of something with itself.'
|
1872
|
-
Enabled: true
|
1873
|
-
VersionAdded: '0.11'
|
1874
|
-
|
1875
1929
|
Lint/UselessElseWithoutRescue:
|
1876
1930
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
1877
1931
|
Enabled: true
|
@@ -1905,7 +1959,7 @@ Metrics/AbcSize:
|
|
1905
1959
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1906
1960
|
# a Float.
|
1907
1961
|
IgnoredMethods: []
|
1908
|
-
Max:
|
1962
|
+
Max: 17
|
1909
1963
|
|
1910
1964
|
Metrics/BlockLength:
|
1911
1965
|
Description: 'Avoid long blocks with many lines.'
|
@@ -1987,7 +2041,7 @@ Metrics/PerceivedComplexity:
|
|
1987
2041
|
VersionAdded: '0.25'
|
1988
2042
|
VersionChanged: '0.81'
|
1989
2043
|
IgnoredMethods: []
|
1990
|
-
Max:
|
2044
|
+
Max: 8
|
1991
2045
|
|
1992
2046
|
################## Migration #############################
|
1993
2047
|
|
@@ -2179,17 +2233,18 @@ Naming/MethodParameterName:
|
|
2179
2233
|
AllowNamesEndingInNumbers: true
|
2180
2234
|
# Allowed names that will not register an offense
|
2181
2235
|
AllowedNames:
|
2182
|
-
-
|
2183
|
-
- id
|
2184
|
-
- to
|
2236
|
+
- at
|
2185
2237
|
- by
|
2186
|
-
-
|
2238
|
+
- db
|
2239
|
+
- id
|
2187
2240
|
- in
|
2188
|
-
-
|
2241
|
+
- io
|
2189
2242
|
- ip
|
2190
|
-
-
|
2243
|
+
- of
|
2244
|
+
- 'on'
|
2191
2245
|
- os
|
2192
2246
|
- pp
|
2247
|
+
- to
|
2193
2248
|
# Forbidden names that will register an offense
|
2194
2249
|
ForbiddenNames: []
|
2195
2250
|
|
@@ -2340,6 +2395,15 @@ Style/AndOr:
|
|
2340
2395
|
- always
|
2341
2396
|
- conditionals
|
2342
2397
|
|
2398
|
+
Style/ArrayCoercion:
|
2399
|
+
Description: >-
|
2400
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
2401
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2402
|
+
StyleGuide: '#array-coercion'
|
2403
|
+
Safe: false
|
2404
|
+
Enabled: 'pending'
|
2405
|
+
VersionAdded: '0.88'
|
2406
|
+
|
2343
2407
|
Style/ArrayJoin:
|
2344
2408
|
Description: 'Use Array#join instead of Array#*.'
|
2345
2409
|
StyleGuide: '#array-join'
|
@@ -2512,6 +2576,7 @@ Style/CaseEquality:
|
|
2512
2576
|
StyleGuide: '#no-case-equality'
|
2513
2577
|
Enabled: true
|
2514
2578
|
VersionAdded: '0.9'
|
2579
|
+
VersionChanged: '0.89'
|
2515
2580
|
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
2516
2581
|
# the case equality operator is a constant.
|
2517
2582
|
#
|
@@ -2522,6 +2587,12 @@ Style/CaseEquality:
|
|
2522
2587
|
# String === "string"
|
2523
2588
|
AllowOnConstant: false
|
2524
2589
|
|
2590
|
+
Style/CaseLikeIf:
|
2591
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2592
|
+
StyleGuide: '#case-vs-if-else'
|
2593
|
+
Enabled: 'pending'
|
2594
|
+
VersionAdded: '0.88'
|
2595
|
+
|
2525
2596
|
Style/CharacterLiteral:
|
2526
2597
|
Description: 'Checks for uses of character literals.'
|
2527
2598
|
StyleGuide: '#no-character-literals'
|
@@ -2859,6 +2930,16 @@ Style/ExpandPathArguments:
|
|
2859
2930
|
Enabled: true
|
2860
2931
|
VersionAdded: '0.53'
|
2861
2932
|
|
2933
|
+
Style/ExplicitBlockArgument:
|
2934
|
+
Description: >-
|
2935
|
+
Consider using explicit block argument to avoid writing block literal
|
2936
|
+
that just passes its arguments to another block.
|
2937
|
+
StyleGuide: '#block-argument'
|
2938
|
+
Enabled: pending
|
2939
|
+
# May change the yielding arity.
|
2940
|
+
Safe: false
|
2941
|
+
VersionAdded: '0.89'
|
2942
|
+
|
2862
2943
|
Style/ExponentialNotation:
|
2863
2944
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
2864
2945
|
StyleGuide: '#exponential-notation'
|
@@ -2942,6 +3023,12 @@ Style/FrozenStringLiteralComment:
|
|
2942
3023
|
- never
|
2943
3024
|
Safe: false
|
2944
3025
|
|
3026
|
+
Style/GlobalStdStream:
|
3027
|
+
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3028
|
+
StyleGuide: '#global-stdout'
|
3029
|
+
Enabled: pending
|
3030
|
+
VersionAdded: '0.89'
|
3031
|
+
|
2945
3032
|
Style/GlobalVars:
|
2946
3033
|
Description: 'Do not introduce global variables.'
|
2947
3034
|
StyleGuide: '#instance-vars'
|
@@ -2961,6 +3048,18 @@ Style/GuardClause:
|
|
2961
3048
|
# needs to have to trigger this cop
|
2962
3049
|
MinBodyLength: 1
|
2963
3050
|
|
3051
|
+
Style/HashAsLastArrayItem:
|
3052
|
+
Description: >-
|
3053
|
+
Checks for presence or absence of braces around hash literal as a last
|
3054
|
+
array item depending on configuration.
|
3055
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
3056
|
+
Enabled: 'pending'
|
3057
|
+
VersionAdded: '0.88'
|
3058
|
+
EnforcedStyle: braces
|
3059
|
+
SupportedStyles:
|
3060
|
+
- braces
|
3061
|
+
- no_braces
|
3062
|
+
|
2964
3063
|
Style/HashEachMethods:
|
2965
3064
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
2966
3065
|
StyleGuide: '#hash-each'
|
@@ -2968,6 +3067,16 @@ Style/HashEachMethods:
|
|
2968
3067
|
VersionAdded: '0.80'
|
2969
3068
|
Safe: false
|
2970
3069
|
|
3070
|
+
Style/HashLikeCase:
|
3071
|
+
Description: >-
|
3072
|
+
Checks for places where `case-when` represents a simple 1:1
|
3073
|
+
mapping and can be replaced with a hash lookup.
|
3074
|
+
Enabled: 'pending'
|
3075
|
+
VersionAdded: '0.88'
|
3076
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3077
|
+
# to trigger this cop
|
3078
|
+
MinBranchesCount: 3
|
3079
|
+
|
2971
3080
|
Style/HashSyntax:
|
2972
3081
|
Description: >-
|
2973
3082
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -3175,12 +3284,6 @@ Style/MethodDefParentheses:
|
|
3175
3284
|
- require_no_parentheses
|
3176
3285
|
- require_no_parentheses_except_multiline
|
3177
3286
|
|
3178
|
-
Style/MethodMissingSuper:
|
3179
|
-
Description: Checks for `method_missing` to call `super`.
|
3180
|
-
StyleGuide: '#no-method-missing'
|
3181
|
-
Enabled: true
|
3182
|
-
VersionAdded: '0.56'
|
3183
|
-
|
3184
3287
|
Style/MinMax:
|
3185
3288
|
Description: >-
|
3186
3289
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
@@ -3522,6 +3625,13 @@ Style/OptionalArguments:
|
|
3522
3625
|
VersionAdded: '0.33'
|
3523
3626
|
VersionChanged: '0.83'
|
3524
3627
|
|
3628
|
+
Style/OptionalBooleanParameter:
|
3629
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
3630
|
+
StyleGuide: '#boolean-keyword-arguments'
|
3631
|
+
Enabled: pending
|
3632
|
+
Safe: false
|
3633
|
+
VersionAdded: '0.89'
|
3634
|
+
|
3525
3635
|
Style/OrAssignment:
|
3526
3636
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
3527
3637
|
StyleGuide: '#double-pipe-for-uninit'
|
@@ -3665,6 +3775,14 @@ Style/RedundantFetchBlock:
|
|
3665
3775
|
SafeForConstants: false
|
3666
3776
|
VersionAdded: '0.86'
|
3667
3777
|
|
3778
|
+
Style/RedundantFileExtensionInRequire:
|
3779
|
+
Description: >-
|
3780
|
+
Checks for the presence of superfluous `.rb` extension in
|
3781
|
+
the filename provided to `require` and `require_relative`.
|
3782
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
3783
|
+
Enabled: 'pending'
|
3784
|
+
VersionAdded: '0.88'
|
3785
|
+
|
3668
3786
|
Style/RedundantFreeze:
|
3669
3787
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3670
3788
|
Enabled: true
|
@@ -3832,6 +3950,12 @@ Style/SignalException:
|
|
3832
3950
|
- only_fail
|
3833
3951
|
- semantic
|
3834
3952
|
|
3953
|
+
Style/SingleArgumentDig:
|
3954
|
+
Description: 'Avoid using single argument dig method.'
|
3955
|
+
Enabled: pending
|
3956
|
+
VersionAdded: '0.89'
|
3957
|
+
Safe: false
|
3958
|
+
|
3835
3959
|
Style/SingleLineBlockParams:
|
3836
3960
|
Description: 'Enforces the names of some block params.'
|
3837
3961
|
Enabled: false
|
@@ -3887,6 +4011,13 @@ Style/StderrPuts:
|
|
3887
4011
|
Enabled: true
|
3888
4012
|
VersionAdded: '0.51'
|
3889
4013
|
|
4014
|
+
Style/StringConcatenation:
|
4015
|
+
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4016
|
+
StyleGuide: '#string-interpolation'
|
4017
|
+
Enabled: pending
|
4018
|
+
Safe: false
|
4019
|
+
VersionAdded: '0.89'
|
4020
|
+
|
3890
4021
|
Style/StringHashKeys:
|
3891
4022
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
3892
4023
|
StyleGuide: '#symbols-as-keys'
|
data/lib/rubocop.rb
CHANGED
@@ -23,6 +23,7 @@ require_relative 'rubocop/string_interpreter'
|
|
23
23
|
require_relative 'rubocop/error'
|
24
24
|
require_relative 'rubocop/warning'
|
25
25
|
|
26
|
+
require_relative 'rubocop/cop/tokens_util'
|
26
27
|
require_relative 'rubocop/cop/util'
|
27
28
|
require_relative 'rubocop/cop/offense'
|
28
29
|
require_relative 'rubocop/cop/message_annotator'
|
@@ -81,6 +82,7 @@ require_relative 'rubocop/cop/mixin/integer_node'
|
|
81
82
|
require_relative 'rubocop/cop/mixin/interpolation'
|
82
83
|
require_relative 'rubocop/cop/mixin/line_length_help'
|
83
84
|
require_relative 'rubocop/cop/mixin/match_range'
|
85
|
+
require_relative 'rubocop/cop/metrics/utils/repeated_csend_discount'
|
84
86
|
require_relative 'rubocop/cop/mixin/method_complexity'
|
85
87
|
require_relative 'rubocop/cop/mixin/method_preference'
|
86
88
|
require_relative 'rubocop/cop/mixin/min_body_length'
|
@@ -94,7 +96,6 @@ require_relative 'rubocop/cop/mixin/nil_methods'
|
|
94
96
|
require_relative 'rubocop/cop/mixin/on_normal_if_unless'
|
95
97
|
require_relative 'rubocop/cop/mixin/ordered_gem_node'
|
96
98
|
require_relative 'rubocop/cop/mixin/parentheses'
|
97
|
-
require_relative 'rubocop/cop/mixin/parser_diagnostic'
|
98
99
|
require_relative 'rubocop/cop/mixin/percent_array'
|
99
100
|
require_relative 'rubocop/cop/mixin/percent_literal'
|
100
101
|
require_relative 'rubocop/cop/mixin/preceding_following_alignment'
|
@@ -110,7 +111,6 @@ require_relative 'rubocop/cop/mixin/statement_modifier'
|
|
110
111
|
require_relative 'rubocop/cop/mixin/string_help'
|
111
112
|
require_relative 'rubocop/cop/mixin/string_literals_help'
|
112
113
|
require_relative 'rubocop/cop/mixin/target_ruby_version'
|
113
|
-
require_relative 'rubocop/cop/mixin/too_many_lines'
|
114
114
|
require_relative 'rubocop/cop/mixin/trailing_body'
|
115
115
|
require_relative 'rubocop/cop/mixin/trailing_comma'
|
116
116
|
require_relative 'rubocop/cop/mixin/uncommunicative_name'
|
@@ -243,6 +243,7 @@ require_relative 'rubocop/cop/lint/ambiguous_operator'
|
|
243
243
|
require_relative 'rubocop/cop/lint/ambiguous_regexp_literal'
|
244
244
|
require_relative 'rubocop/cop/lint/assignment_in_condition'
|
245
245
|
require_relative 'rubocop/cop/lint/big_decimal_new'
|
246
|
+
require_relative 'rubocop/cop/lint/binary_operator_with_identical_operands'
|
246
247
|
require_relative 'rubocop/cop/lint/boolean_symbol'
|
247
248
|
require_relative 'rubocop/cop/lint/circular_argument_reference'
|
248
249
|
require_relative 'rubocop/cop/lint/constant_resolution'
|
@@ -251,10 +252,13 @@ require_relative 'rubocop/cop/lint/deprecated_class_methods'
|
|
251
252
|
require_relative 'rubocop/cop/lint/deprecated_open_ssl_constant'
|
252
253
|
require_relative 'rubocop/cop/lint/disjunctive_assignment_in_constructor'
|
253
254
|
require_relative 'rubocop/cop/lint/duplicate_case_condition'
|
255
|
+
require_relative 'rubocop/cop/lint/duplicate_elsif_condition'
|
254
256
|
require_relative 'rubocop/cop/lint/duplicate_hash_key'
|
255
257
|
require_relative 'rubocop/cop/lint/duplicate_methods'
|
258
|
+
require_relative 'rubocop/cop/lint/duplicate_rescue_exception'
|
256
259
|
require_relative 'rubocop/cop/lint/each_with_object_argument'
|
257
260
|
require_relative 'rubocop/cop/lint/else_layout'
|
261
|
+
require_relative 'rubocop/cop/lint/empty_conditional_body'
|
258
262
|
require_relative 'rubocop/cop/lint/empty_ensure'
|
259
263
|
require_relative 'rubocop/cop/lint/empty_expression'
|
260
264
|
require_relative 'rubocop/cop/lint/empty_interpolation'
|
@@ -262,6 +266,7 @@ require_relative 'rubocop/cop/lint/empty_when'
|
|
262
266
|
require_relative 'rubocop/cop/lint/ensure_return'
|
263
267
|
require_relative 'rubocop/cop/lint/erb_new_arguments'
|
264
268
|
require_relative 'rubocop/cop/lint/flip_flop'
|
269
|
+
require_relative 'rubocop/cop/lint/float_comparison'
|
265
270
|
require_relative 'rubocop/cop/lint/float_out_of_range'
|
266
271
|
require_relative 'rubocop/cop/lint/format_parameter_mismatch'
|
267
272
|
require_relative 'rubocop/cop/lint/heredoc_method_call_position'
|
@@ -273,6 +278,7 @@ require_relative 'rubocop/cop/lint/literal_as_condition'
|
|
273
278
|
require_relative 'rubocop/cop/lint/literal_in_interpolation'
|
274
279
|
require_relative 'rubocop/cop/lint/loop'
|
275
280
|
require_relative 'rubocop/cop/lint/missing_cop_enable_directive'
|
281
|
+
require_relative 'rubocop/cop/lint/missing_super'
|
276
282
|
require_relative 'rubocop/cop/lint/mixed_regexp_capture_types'
|
277
283
|
require_relative 'rubocop/cop/lint/multiple_comparison'
|
278
284
|
require_relative 'rubocop/cop/lint/nested_method_definition'
|
@@ -282,6 +288,7 @@ require_relative 'rubocop/cop/lint/non_deterministic_require_order'
|
|
282
288
|
require_relative 'rubocop/cop/lint/non_local_exit_from_iterator'
|
283
289
|
require_relative 'rubocop/cop/lint/number_conversion'
|
284
290
|
require_relative 'rubocop/cop/lint/ordered_magic_comments'
|
291
|
+
require_relative 'rubocop/cop/lint/out_of_range_regexp_ref'
|
285
292
|
require_relative 'rubocop/cop/lint/parentheses_as_grouped_expression'
|
286
293
|
require_relative 'rubocop/cop/lint/percent_string_array'
|
287
294
|
require_relative 'rubocop/cop/lint/percent_symbol_array'
|
@@ -303,6 +310,7 @@ require_relative 'rubocop/cop/lint/safe_navigation_consistency'
|
|
303
310
|
require_relative 'rubocop/cop/lint/safe_navigation_chain'
|
304
311
|
require_relative 'rubocop/cop/lint/safe_navigation_with_empty'
|
305
312
|
require_relative 'rubocop/cop/lint/script_permission'
|
313
|
+
require_relative 'rubocop/cop/lint/self_assignment'
|
306
314
|
require_relative 'rubocop/cop/lint/send_with_mixin_argument'
|
307
315
|
require_relative 'rubocop/cop/lint/shadowed_argument'
|
308
316
|
require_relative 'rubocop/cop/lint/shadowed_exception'
|
@@ -311,16 +319,17 @@ require_relative 'rubocop/cop/lint/struct_new_override'
|
|
311
319
|
require_relative 'rubocop/cop/lint/suppressed_exception'
|
312
320
|
require_relative 'rubocop/cop/lint/syntax'
|
313
321
|
require_relative 'rubocop/cop/lint/to_json'
|
322
|
+
require_relative 'rubocop/cop/lint/top_level_return_with_argument'
|
314
323
|
require_relative 'rubocop/cop/lint/underscore_prefixed_variable_name'
|
315
324
|
require_relative 'rubocop/cop/lint/unified_integer'
|
316
325
|
require_relative 'rubocop/cop/lint/unreachable_code'
|
326
|
+
require_relative 'rubocop/cop/lint/unreachable_loop'
|
317
327
|
require_relative 'rubocop/cop/lint/unused_block_argument'
|
318
328
|
require_relative 'rubocop/cop/lint/unused_method_argument'
|
319
329
|
require_relative 'rubocop/cop/lint/uri_escape_unescape'
|
320
330
|
require_relative 'rubocop/cop/lint/uri_regexp'
|
321
331
|
require_relative 'rubocop/cop/lint/useless_access_modifier'
|
322
332
|
require_relative 'rubocop/cop/lint/useless_assignment'
|
323
|
-
require_relative 'rubocop/cop/lint/useless_comparison'
|
324
333
|
require_relative 'rubocop/cop/lint/useless_else_without_rescue'
|
325
334
|
require_relative 'rubocop/cop/lint/useless_setter_call'
|
326
335
|
require_relative 'rubocop/cop/lint/void'
|
@@ -360,6 +369,7 @@ require_relative 'rubocop/cop/style/access_modifier_declarations'
|
|
360
369
|
require_relative 'rubocop/cop/style/accessor_grouping'
|
361
370
|
require_relative 'rubocop/cop/style/alias'
|
362
371
|
require_relative 'rubocop/cop/style/and_or'
|
372
|
+
require_relative 'rubocop/cop/style/array_coercion'
|
363
373
|
require_relative 'rubocop/cop/style/array_join'
|
364
374
|
require_relative 'rubocop/cop/style/ascii_comments'
|
365
375
|
require_relative 'rubocop/cop/style/attr'
|
@@ -370,6 +380,7 @@ require_relative 'rubocop/cop/style/bisected_attr_accessor'
|
|
370
380
|
require_relative 'rubocop/cop/style/block_comments'
|
371
381
|
require_relative 'rubocop/cop/style/block_delimiters'
|
372
382
|
require_relative 'rubocop/cop/style/case_equality'
|
383
|
+
require_relative 'rubocop/cop/style/case_like_if'
|
373
384
|
require_relative 'rubocop/cop/style/character_literal'
|
374
385
|
require_relative 'rubocop/cop/style/class_and_module_children'
|
375
386
|
require_relative 'rubocop/cop/style/class_check'
|
@@ -405,15 +416,19 @@ require_relative 'rubocop/cop/style/end_block'
|
|
405
416
|
require_relative 'rubocop/cop/style/eval_with_location'
|
406
417
|
require_relative 'rubocop/cop/style/even_odd'
|
407
418
|
require_relative 'rubocop/cop/style/expand_path_arguments'
|
419
|
+
require_relative 'rubocop/cop/style/explicit_block_argument'
|
408
420
|
require_relative 'rubocop/cop/style/exponential_notation'
|
409
421
|
require_relative 'rubocop/cop/style/float_division'
|
410
422
|
require_relative 'rubocop/cop/style/for'
|
411
423
|
require_relative 'rubocop/cop/style/format_string'
|
412
424
|
require_relative 'rubocop/cop/style/format_string_token'
|
413
425
|
require_relative 'rubocop/cop/style/frozen_string_literal_comment'
|
426
|
+
require_relative 'rubocop/cop/style/global_std_stream'
|
414
427
|
require_relative 'rubocop/cop/style/global_vars'
|
415
428
|
require_relative 'rubocop/cop/style/guard_clause'
|
429
|
+
require_relative 'rubocop/cop/style/hash_as_last_array_item'
|
416
430
|
require_relative 'rubocop/cop/style/hash_each_methods'
|
431
|
+
require_relative 'rubocop/cop/style/hash_like_case'
|
417
432
|
require_relative 'rubocop/cop/style/hash_syntax'
|
418
433
|
require_relative 'rubocop/cop/style/hash_transform_keys'
|
419
434
|
require_relative 'rubocop/cop/style/hash_transform_values'
|
@@ -434,11 +449,11 @@ require_relative 'rubocop/cop/style/method_call_without_args_parentheses'
|
|
434
449
|
require_relative 'rubocop/cop/style/method_call_with_args_parentheses'
|
435
450
|
require_relative 'rubocop/cop/style/redundant_assignment'
|
436
451
|
require_relative 'rubocop/cop/style/redundant_fetch_block'
|
452
|
+
require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
|
437
453
|
require_relative 'rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses'
|
438
454
|
require_relative 'rubocop/cop/style/method_call_with_args_parentheses/require_parentheses'
|
439
455
|
require_relative 'rubocop/cop/style/method_called_on_do_end_block'
|
440
456
|
require_relative 'rubocop/cop/style/method_def_parentheses'
|
441
|
-
require_relative 'rubocop/cop/style/method_missing_super'
|
442
457
|
require_relative 'rubocop/cop/style/min_max'
|
443
458
|
require_relative 'rubocop/cop/style/missing_else'
|
444
459
|
require_relative 'rubocop/cop/style/missing_respond_to_missing'
|
@@ -471,6 +486,7 @@ require_relative 'rubocop/cop/style/one_line_conditional'
|
|
471
486
|
require_relative 'rubocop/cop/style/or_assignment'
|
472
487
|
require_relative 'rubocop/cop/style/option_hash'
|
473
488
|
require_relative 'rubocop/cop/style/optional_arguments'
|
489
|
+
require_relative 'rubocop/cop/style/optional_boolean_parameter'
|
474
490
|
require_relative 'rubocop/cop/style/parallel_assignment'
|
475
491
|
require_relative 'rubocop/cop/style/parentheses_around_condition'
|
476
492
|
require_relative 'rubocop/cop/style/percent_literal_delimiters'
|
@@ -505,12 +521,14 @@ require_relative 'rubocop/cop/style/self_assignment'
|
|
505
521
|
require_relative 'rubocop/cop/style/semicolon'
|
506
522
|
require_relative 'rubocop/cop/style/send'
|
507
523
|
require_relative 'rubocop/cop/style/signal_exception'
|
524
|
+
require_relative 'rubocop/cop/style/single_argument_dig'
|
508
525
|
require_relative 'rubocop/cop/style/single_line_block_params'
|
509
526
|
require_relative 'rubocop/cop/style/single_line_methods'
|
510
527
|
require_relative 'rubocop/cop/style/slicing_with_range'
|
511
528
|
require_relative 'rubocop/cop/style/special_global_vars'
|
512
529
|
require_relative 'rubocop/cop/style/stabby_lambda_parentheses'
|
513
530
|
require_relative 'rubocop/cop/style/stderr_puts'
|
531
|
+
require_relative 'rubocop/cop/style/string_concatenation'
|
514
532
|
require_relative 'rubocop/cop/style/string_hash_keys'
|
515
533
|
require_relative 'rubocop/cop/style/string_literals'
|
516
534
|
require_relative 'rubocop/cop/style/string_literals_in_interpolation'
|