rubocop 0.86.0 → 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 +198 -25
- data/lib/rubocop.rb +30 -5
- data/lib/rubocop/cli.rb +2 -4
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +42 -7
- 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 +3 -3
- 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 +41 -69
- data/lib/rubocop/config_loader_resolver.rb +3 -3
- data/lib/rubocop/config_obsoletion.rb +6 -2
- data/lib/rubocop/config_store.rb +4 -0
- data/lib/rubocop/config_validator.rb +2 -4
- data/lib/rubocop/cop/autocorrect_logic.rb +14 -24
- data/lib/rubocop/cop/badge.rb +1 -1
- data/lib/rubocop/cop/base.rb +407 -0
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +10 -20
- data/lib/rubocop/cop/commissioner.rb +47 -50
- data/lib/rubocop/cop/cop.rb +85 -236
- data/lib/rubocop/cop/corrector.rb +38 -115
- 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/gemspec/ruby_version_globals_usage.rb +1 -1
- data/lib/rubocop/cop/generator.rb +1 -1
- 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/node_type_predicate.rb +11 -14
- 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/case_indentation.rb +18 -19
- data/lib/rubocop/cop/layout/class_structure.rb +5 -44
- 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/empty_lines_around_attribute_accessor.rb +1 -8
- 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_argument_indentation.rb +4 -0
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/hash_alignment.rb +1 -2
- 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 -6
- 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 +22 -27
- 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/legacy/corrections_proxy.rb +49 -0
- data/lib/rubocop/cop/legacy/corrector.rb +29 -0
- 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 +21 -17
- 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 +21 -5
- 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 +15 -21
- 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 +84 -13
- 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 +12 -13
- 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 +3 -3
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +41 -40
- 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 +15 -11
- 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 +10 -2
- 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/syntax.rb +11 -26
- 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 +9 -4
- 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 +26 -16
- 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 +24 -2
- data/lib/rubocop/cop/metrics/block_nesting.rb +2 -2
- data/lib/rubocop/cop/metrics/class_length.rb +26 -3
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +2 -1
- data/lib/rubocop/cop/metrics/method_length.rb +25 -2
- data/lib/rubocop/cop/metrics/module_length.rb +26 -3
- 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 +157 -0
- 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/allowed_methods.rb +19 -0
- data/lib/rubocop/cop/mixin/array_min_size.rb +1 -1
- data/lib/rubocop/cop/mixin/auto_corrector.rb +12 -0
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +2 -2
- data/lib/rubocop/cop/mixin/code_length.rb +26 -5
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +1 -1
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +3 -1
- 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/nil_methods.rb +3 -5
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +6 -1
- 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 +4 -24
- data/lib/rubocop/cop/mixin/trailing_comma.rb +2 -4
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +10 -15
- data/lib/rubocop/cop/mixin/unused_argument.rb +4 -6
- data/lib/rubocop/cop/mixin/visibility_help.rb +50 -0
- data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -2
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +29 -6
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +3 -3
- 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_name.rb +1 -1
- data/lib/rubocop/cop/naming/method_parameter_name.rb +2 -2
- data/lib/rubocop/cop/naming/predicate_name.rb +6 -10
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +12 -11
- data/lib/rubocop/cop/naming/variable_name.rb +1 -1
- data/lib/rubocop/cop/naming/variable_number.rb +1 -1
- data/lib/rubocop/cop/offense.rb +16 -2
- 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 +149 -0
- 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 +141 -0
- 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 +24 -7
- 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 +2 -2
- data/lib/rubocop/cop/style/def_with_parentheses.rb +8 -10
- data/lib/rubocop/cop/style/dir.rb +9 -12
- 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 +20 -21
- 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 +23 -22
- 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 +11 -3
- 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_block_chain.rb +10 -1
- 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 +27 -24
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +5 -6
- 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/proc.rb +1 -1
- data/lib/rubocop/cop/style/random_with_offset.rb +5 -10
- data/lib/rubocop/cop/style/redundant_assignment.rb +117 -0
- data/lib/rubocop/cop/style/redundant_condition.rb +15 -3
- data/lib/rubocop/cop/style/redundant_exception.rb +18 -10
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +26 -7
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +50 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +7 -1
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +2 -1
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +11 -11
- data/lib/rubocop/cop/style/redundant_sort.rb +26 -12
- data/lib/rubocop/cop/style/rescue_standard_error.rb +1 -1
- data/lib/rubocop/cop/style/safe_navigation.rb +4 -4
- data/lib/rubocop/cop/style/signal_exception.rb +3 -1
- 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/stderr_puts.rb +1 -1
- data/lib/rubocop/cop/style/string_concatenation.rb +92 -0
- data/lib/rubocop/cop/style/struct_inheritance.rb +3 -3
- data/lib/rubocop/cop/style/symbol_array.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +2 -2
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +9 -32
- data/lib/rubocop/cop/style/trivial_accessors.rb +8 -7
- data/lib/rubocop/cop/style/zero_length_predicate.rb +12 -8
- data/lib/rubocop/cop/team.rb +98 -82
- data/lib/rubocop/cop/tokens_util.rb +84 -0
- data/lib/rubocop/cop/util.rb +3 -13
- data/lib/rubocop/cop/utils/format_string.rb +1 -2
- 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 +2 -2
- data/lib/rubocop/formatter/formatter_set.rb +1 -0
- data/lib/rubocop/formatter/junit_formatter.rb +1 -1
- data/lib/rubocop/name_similarity.rb +1 -3
- data/lib/rubocop/options.rb +18 -11
- data/lib/rubocop/path_util.rb +17 -17
- data/lib/rubocop/rake_task.rb +7 -9
- data/lib/rubocop/result_cache.rb +12 -8
- data/lib/rubocop/rspec/cop_helper.rb +4 -4
- data/lib/rubocop/rspec/expect_offense.rb +53 -22
- data/lib/rubocop/rspec/shared_contexts.rb +16 -17
- data/lib/rubocop/runner.rb +35 -34
- data/lib/rubocop/target_finder.rb +13 -10
- data/lib/rubocop/target_ruby.rb +1 -1
- data/lib/rubocop/version.rb +2 -2
- metadata +40 -11
- data/lib/rubocop/cop/lint/useless_comparison.rb +0 -28
- data/lib/rubocop/cop/mixin/classish_length.rb +0 -37
- data/lib/rubocop/cop/mixin/parser_diagnostic.rb +0 -37
- data/lib/rubocop/cop/mixin/too_many_lines.rb +0 -35
- 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
@@ -180,6 +180,9 @@ Bundler/OrderedGems:
|
|
180
180
|
VersionAdded: '0.46'
|
181
181
|
VersionChanged: '0.47'
|
182
182
|
TreatCommentsAsGroupSeparators: true
|
183
|
+
# By default, "-" and "_" are ignored for order purposes.
|
184
|
+
# This can be overridden by setting this parameter to true.
|
185
|
+
ConsiderPunctuation: false
|
183
186
|
Include:
|
184
187
|
- '**/*.gemfile'
|
185
188
|
- '**/Gemfile'
|
@@ -200,13 +203,17 @@ Gemspec/OrderedDependencies:
|
|
200
203
|
Enabled: true
|
201
204
|
VersionAdded: '0.51'
|
202
205
|
TreatCommentsAsGroupSeparators: true
|
206
|
+
# By default, "-" and "_" are ignored for order purposes.
|
207
|
+
# This can be overridden by setting this parameter to true.
|
208
|
+
ConsiderPunctuation: false
|
203
209
|
Include:
|
204
210
|
- '**/*.gemspec'
|
205
211
|
|
206
212
|
Gemspec/RequiredRubyVersion:
|
207
|
-
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.'
|
208
214
|
Enabled: true
|
209
215
|
VersionAdded: '0.52'
|
216
|
+
VersionChanged: '0.89'
|
210
217
|
Include:
|
211
218
|
- '**/*.gemspec'
|
212
219
|
|
@@ -1228,7 +1235,7 @@ Layout/SpaceInsideBlockBraces:
|
|
1228
1235
|
|
1229
1236
|
Layout/SpaceInsideHashLiteralBraces:
|
1230
1237
|
Description: "Use spaces inside hash literal braces - or don't."
|
1231
|
-
StyleGuide: '#spaces-
|
1238
|
+
StyleGuide: '#spaces-braces'
|
1232
1239
|
Enabled: true
|
1233
1240
|
VersionAdded: '0.49'
|
1234
1241
|
EnforcedStyle: space
|
@@ -1349,6 +1356,12 @@ Lint/BigDecimalNew:
|
|
1349
1356
|
Enabled: true
|
1350
1357
|
VersionAdded: '0.53'
|
1351
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
|
+
|
1352
1365
|
Lint/BooleanSymbol:
|
1353
1366
|
Description: 'Check for `:true` and `:false` symbols.'
|
1354
1367
|
Enabled: true
|
@@ -1391,12 +1404,18 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
1391
1404
|
Enabled: true
|
1392
1405
|
Safe: false
|
1393
1406
|
VersionAdded: '0.62'
|
1407
|
+
VersionChanged: '0.88'
|
1394
1408
|
|
1395
1409
|
Lint/DuplicateCaseCondition:
|
1396
1410
|
Description: 'Do not repeat values in case conditionals.'
|
1397
1411
|
Enabled: true
|
1398
1412
|
VersionAdded: '0.45'
|
1399
1413
|
|
1414
|
+
Lint/DuplicateElsifCondition:
|
1415
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1416
|
+
Enabled: 'pending'
|
1417
|
+
VersionAdded: '0.88'
|
1418
|
+
|
1400
1419
|
Lint/DuplicateHashKey:
|
1401
1420
|
Description: 'Check for duplicate keys in hash literals.'
|
1402
1421
|
Enabled: true
|
@@ -1408,6 +1427,11 @@ Lint/DuplicateMethods:
|
|
1408
1427
|
Enabled: true
|
1409
1428
|
VersionAdded: '0.29'
|
1410
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
|
+
|
1411
1435
|
Lint/EachWithObjectArgument:
|
1412
1436
|
Description: 'Check for immutable argument given to each_with_object.'
|
1413
1437
|
Enabled: true
|
@@ -1418,6 +1442,12 @@ Lint/ElseLayout:
|
|
1418
1442
|
Enabled: true
|
1419
1443
|
VersionAdded: '0.17'
|
1420
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
|
+
|
1421
1451
|
Lint/EmptyEnsure:
|
1422
1452
|
Description: 'Checks for empty ensure block.'
|
1423
1453
|
Enabled: true
|
@@ -1461,6 +1491,12 @@ Lint/FlipFlop:
|
|
1461
1491
|
Enabled: true
|
1462
1492
|
VersionAdded: '0.16'
|
1463
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
|
+
|
1464
1500
|
Lint/FloatOutOfRange:
|
1465
1501
|
Description: >-
|
1466
1502
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1508,7 +1544,9 @@ Lint/InheritException:
|
|
1508
1544
|
Lint/InterpolationCheck:
|
1509
1545
|
Description: 'Raise warning for interpolation in single q strs.'
|
1510
1546
|
Enabled: true
|
1547
|
+
Safe: false
|
1511
1548
|
VersionAdded: '0.50'
|
1549
|
+
VersionChanged: '0.87'
|
1512
1550
|
|
1513
1551
|
Lint/LiteralAsCondition:
|
1514
1552
|
Description: 'Checks of literals used in conditions.'
|
@@ -1528,6 +1566,7 @@ Lint/Loop:
|
|
1528
1566
|
StyleGuide: '#loop-with-break'
|
1529
1567
|
Enabled: true
|
1530
1568
|
VersionAdded: '0.9'
|
1569
|
+
VersionChanged: '0.89'
|
1531
1570
|
|
1532
1571
|
Lint/MissingCopEnableDirective:
|
1533
1572
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1542,6 +1581,13 @@ Lint/MissingCopEnableDirective:
|
|
1542
1581
|
# .inf for any size
|
1543
1582
|
MaximumRangeSize: .inf
|
1544
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
|
+
|
1545
1591
|
Lint/MixedRegexpCaptureTypes:
|
1546
1592
|
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1547
1593
|
Enabled: pending
|
@@ -1594,6 +1640,12 @@ Lint/OrderedMagicComments:
|
|
1594
1640
|
Enabled: true
|
1595
1641
|
VersionAdded: '0.53'
|
1596
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
|
+
|
1597
1649
|
Lint/ParenthesesAsGroupedExpression:
|
1598
1650
|
Description: >-
|
1599
1651
|
Checks for method calls with a space before the opening
|
@@ -1736,6 +1788,7 @@ Lint/SafeNavigationWithEmpty:
|
|
1736
1788
|
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1737
1789
|
Enabled: true
|
1738
1790
|
VersionAdded: '0.62'
|
1791
|
+
VersionChanged: '0.87'
|
1739
1792
|
|
1740
1793
|
Lint/ScriptPermission:
|
1741
1794
|
Description: 'Grant script file execute permission.'
|
@@ -1743,6 +1796,11 @@ Lint/ScriptPermission:
|
|
1743
1796
|
VersionAdded: '0.49'
|
1744
1797
|
VersionChanged: '0.50'
|
1745
1798
|
|
1799
|
+
Lint/SelfAssignment:
|
1800
|
+
Description: 'Checks for self-assignments.'
|
1801
|
+
Enabled: pending
|
1802
|
+
VersionAdded: '0.89'
|
1803
|
+
|
1746
1804
|
Lint/SendWithMixinArgument:
|
1747
1805
|
Description: 'Checks for `send` method when using mixin.'
|
1748
1806
|
Enabled: true
|
@@ -1793,6 +1851,11 @@ Lint/ToJSON:
|
|
1793
1851
|
Enabled: true
|
1794
1852
|
VersionAdded: '0.66'
|
1795
1853
|
|
1854
|
+
Lint/TopLevelReturnWithArgument:
|
1855
|
+
Description: 'This cop detects top level return statements with argument.'
|
1856
|
+
Enabled: 'pending'
|
1857
|
+
VersionAdded: '0.89'
|
1858
|
+
|
1796
1859
|
Lint/UnderscorePrefixedVariableName:
|
1797
1860
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1798
1861
|
Enabled: true
|
@@ -1809,6 +1872,11 @@ Lint/UnreachableCode:
|
|
1809
1872
|
Enabled: true
|
1810
1873
|
VersionAdded: '0.9'
|
1811
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
|
+
|
1812
1880
|
Lint/UnusedBlockArgument:
|
1813
1881
|
Description: 'Checks for unused block arguments.'
|
1814
1882
|
StyleGuide: '#underscore-unused-vars'
|
@@ -1858,11 +1926,6 @@ Lint/UselessAssignment:
|
|
1858
1926
|
Enabled: true
|
1859
1927
|
VersionAdded: '0.11'
|
1860
1928
|
|
1861
|
-
Lint/UselessComparison:
|
1862
|
-
Description: 'Checks for comparison of something with itself.'
|
1863
|
-
Enabled: true
|
1864
|
-
VersionAdded: '0.11'
|
1865
|
-
|
1866
1929
|
Lint/UselessElseWithoutRescue:
|
1867
1930
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
1868
1931
|
Enabled: true
|
@@ -1896,15 +1959,16 @@ Metrics/AbcSize:
|
|
1896
1959
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1897
1960
|
# a Float.
|
1898
1961
|
IgnoredMethods: []
|
1899
|
-
Max:
|
1962
|
+
Max: 17
|
1900
1963
|
|
1901
1964
|
Metrics/BlockLength:
|
1902
1965
|
Description: 'Avoid long blocks with many lines.'
|
1903
1966
|
Enabled: true
|
1904
1967
|
VersionAdded: '0.44'
|
1905
|
-
VersionChanged: '0.
|
1968
|
+
VersionChanged: '0.87'
|
1906
1969
|
CountComments: false # count full line comments?
|
1907
1970
|
Max: 25
|
1971
|
+
CountAsOne: []
|
1908
1972
|
ExcludedMethods:
|
1909
1973
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1910
1974
|
# associated blocks.
|
@@ -1925,8 +1989,10 @@ Metrics/ClassLength:
|
|
1925
1989
|
Description: 'Avoid classes longer than 100 lines of code.'
|
1926
1990
|
Enabled: true
|
1927
1991
|
VersionAdded: '0.25'
|
1992
|
+
VersionChanged: '0.87'
|
1928
1993
|
CountComments: false # count full line comments?
|
1929
1994
|
Max: 100
|
1995
|
+
CountAsOne: []
|
1930
1996
|
|
1931
1997
|
# Avoid complex methods.
|
1932
1998
|
Metrics/CyclomaticComplexity:
|
@@ -1944,17 +2010,20 @@ Metrics/MethodLength:
|
|
1944
2010
|
StyleGuide: '#short-methods'
|
1945
2011
|
Enabled: true
|
1946
2012
|
VersionAdded: '0.25'
|
1947
|
-
VersionChanged: '0.
|
2013
|
+
VersionChanged: '0.87'
|
1948
2014
|
CountComments: false # count full line comments?
|
1949
2015
|
Max: 10
|
2016
|
+
CountAsOne: []
|
1950
2017
|
ExcludedMethods: []
|
1951
2018
|
|
1952
2019
|
Metrics/ModuleLength:
|
1953
2020
|
Description: 'Avoid modules longer than 100 lines of code.'
|
1954
2021
|
Enabled: true
|
1955
2022
|
VersionAdded: '0.31'
|
2023
|
+
VersionChanged: '0.87'
|
1956
2024
|
CountComments: false # count full line comments?
|
1957
2025
|
Max: 100
|
2026
|
+
CountAsOne: []
|
1958
2027
|
|
1959
2028
|
Metrics/ParameterLists:
|
1960
2029
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
@@ -1972,7 +2041,7 @@ Metrics/PerceivedComplexity:
|
|
1972
2041
|
VersionAdded: '0.25'
|
1973
2042
|
VersionChanged: '0.81'
|
1974
2043
|
IgnoredMethods: []
|
1975
|
-
Max:
|
2044
|
+
Max: 8
|
1976
2045
|
|
1977
2046
|
################## Migration #############################
|
1978
2047
|
|
@@ -1992,10 +2061,12 @@ Naming/AccessorMethodName:
|
|
1992
2061
|
VersionAdded: '0.50'
|
1993
2062
|
|
1994
2063
|
Naming/AsciiIdentifiers:
|
1995
|
-
Description: 'Use only ascii symbols in identifiers.'
|
2064
|
+
Description: 'Use only ascii symbols in identifiers and constants.'
|
1996
2065
|
StyleGuide: '#english-identifiers'
|
1997
2066
|
Enabled: true
|
1998
2067
|
VersionAdded: '0.50'
|
2068
|
+
VersionChanged: '0.87'
|
2069
|
+
AsciiConstants: true
|
1999
2070
|
|
2000
2071
|
Naming/BinaryOperatorParameterName:
|
2001
2072
|
Description: 'When defining binary operators, name the argument other.'
|
@@ -2162,17 +2233,18 @@ Naming/MethodParameterName:
|
|
2162
2233
|
AllowNamesEndingInNumbers: true
|
2163
2234
|
# Allowed names that will not register an offense
|
2164
2235
|
AllowedNames:
|
2165
|
-
-
|
2166
|
-
- id
|
2167
|
-
- to
|
2236
|
+
- at
|
2168
2237
|
- by
|
2169
|
-
-
|
2238
|
+
- db
|
2239
|
+
- id
|
2170
2240
|
- in
|
2171
|
-
-
|
2241
|
+
- io
|
2172
2242
|
- ip
|
2173
|
-
-
|
2243
|
+
- of
|
2244
|
+
- 'on'
|
2174
2245
|
- os
|
2175
2246
|
- pp
|
2247
|
+
- to
|
2176
2248
|
# Forbidden names that will register an offense
|
2177
2249
|
ForbiddenNames: []
|
2178
2250
|
|
@@ -2288,6 +2360,17 @@ Style/AccessModifierDeclarations:
|
|
2288
2360
|
- group
|
2289
2361
|
AllowModifiersOnSymbols: true
|
2290
2362
|
|
2363
|
+
Style/AccessorGrouping:
|
2364
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2365
|
+
Enabled: 'pending'
|
2366
|
+
VersionAdded: '0.87'
|
2367
|
+
EnforcedStyle: grouped
|
2368
|
+
SupportedStyles:
|
2369
|
+
# separated: each accessor goes in a separate statement.
|
2370
|
+
# grouped: accessors are grouped into a single statement.
|
2371
|
+
- separated
|
2372
|
+
- grouped
|
2373
|
+
|
2291
2374
|
Style/Alias:
|
2292
2375
|
Description: 'Use alias instead of alias_method.'
|
2293
2376
|
StyleGuide: '#alias-method-lexically'
|
@@ -2312,6 +2395,15 @@ Style/AndOr:
|
|
2312
2395
|
- always
|
2313
2396
|
- conditionals
|
2314
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
|
+
|
2315
2407
|
Style/ArrayJoin:
|
2316
2408
|
Description: 'Use Array#join instead of Array#*.'
|
2317
2409
|
StyleGuide: '#array-join'
|
@@ -2355,6 +2447,13 @@ Style/BeginBlock:
|
|
2355
2447
|
Enabled: true
|
2356
2448
|
VersionAdded: '0.9'
|
2357
2449
|
|
2450
|
+
Style/BisectedAttrAccessor:
|
2451
|
+
Description: >-
|
2452
|
+
Checks for places where `attr_reader` and `attr_writer`
|
2453
|
+
for the same method can be combined into single `attr_accessor`.
|
2454
|
+
Enabled: 'pending'
|
2455
|
+
VersionAdded: '0.87'
|
2456
|
+
|
2358
2457
|
Style/BlockComments:
|
2359
2458
|
Description: 'Do not use block comments.'
|
2360
2459
|
StyleGuide: '#no-block-comments'
|
@@ -2477,6 +2576,7 @@ Style/CaseEquality:
|
|
2477
2576
|
StyleGuide: '#no-case-equality'
|
2478
2577
|
Enabled: true
|
2479
2578
|
VersionAdded: '0.9'
|
2579
|
+
VersionChanged: '0.89'
|
2480
2580
|
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
2481
2581
|
# the case equality operator is a constant.
|
2482
2582
|
#
|
@@ -2487,6 +2587,12 @@ Style/CaseEquality:
|
|
2487
2587
|
# String === "string"
|
2488
2588
|
AllowOnConstant: false
|
2489
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
|
+
|
2490
2596
|
Style/CharacterLiteral:
|
2491
2597
|
Description: 'Checks for uses of character literals.'
|
2492
2598
|
StyleGuide: '#no-character-literals'
|
@@ -2729,6 +2835,7 @@ Style/DoubleNegation:
|
|
2729
2835
|
VersionAdded: '0.19'
|
2730
2836
|
VersionChanged: '0.84'
|
2731
2837
|
EnforcedStyle: allowed_in_returns
|
2838
|
+
SafeAutoCorrect: false
|
2732
2839
|
SupportedStyles:
|
2733
2840
|
- allowed_in_returns
|
2734
2841
|
- forbidden
|
@@ -2823,6 +2930,16 @@ Style/ExpandPathArguments:
|
|
2823
2930
|
Enabled: true
|
2824
2931
|
VersionAdded: '0.53'
|
2825
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
|
+
|
2826
2943
|
Style/ExponentialNotation:
|
2827
2944
|
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
2828
2945
|
StyleGuide: '#exponential-notation'
|
@@ -2906,6 +3023,12 @@ Style/FrozenStringLiteralComment:
|
|
2906
3023
|
- never
|
2907
3024
|
Safe: false
|
2908
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
|
+
|
2909
3032
|
Style/GlobalVars:
|
2910
3033
|
Description: 'Do not introduce global variables.'
|
2911
3034
|
StyleGuide: '#instance-vars'
|
@@ -2925,6 +3048,18 @@ Style/GuardClause:
|
|
2925
3048
|
# needs to have to trigger this cop
|
2926
3049
|
MinBodyLength: 1
|
2927
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
|
+
|
2928
3063
|
Style/HashEachMethods:
|
2929
3064
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
2930
3065
|
StyleGuide: '#hash-each'
|
@@ -2932,6 +3067,16 @@ Style/HashEachMethods:
|
|
2932
3067
|
VersionAdded: '0.80'
|
2933
3068
|
Safe: false
|
2934
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
|
+
|
2935
3080
|
Style/HashSyntax:
|
2936
3081
|
Description: >-
|
2937
3082
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -2995,6 +3140,7 @@ Style/IfUnlessModifierOfIfUnless:
|
|
2995
3140
|
Avoid modifier if/unless usage on conditionals.
|
2996
3141
|
Enabled: true
|
2997
3142
|
VersionAdded: '0.39'
|
3143
|
+
VersionChanged: '0.87'
|
2998
3144
|
|
2999
3145
|
Style/IfWithSemicolon:
|
3000
3146
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
@@ -3138,12 +3284,6 @@ Style/MethodDefParentheses:
|
|
3138
3284
|
- require_no_parentheses
|
3139
3285
|
- require_no_parentheses_except_multiline
|
3140
3286
|
|
3141
|
-
Style/MethodMissingSuper:
|
3142
|
-
Description: Checks for `method_missing` to call `super`.
|
3143
|
-
StyleGuide: '#no-method-missing'
|
3144
|
-
Enabled: true
|
3145
|
-
VersionAdded: '0.56'
|
3146
|
-
|
3147
3287
|
Style/MinMax:
|
3148
3288
|
Description: >-
|
3149
3289
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
@@ -3485,6 +3625,13 @@ Style/OptionalArguments:
|
|
3485
3625
|
VersionAdded: '0.33'
|
3486
3626
|
VersionChanged: '0.83'
|
3487
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
|
+
|
3488
3635
|
Style/OrAssignment:
|
3489
3636
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
3490
3637
|
StyleGuide: '#double-pipe-for-uninit'
|
@@ -3581,6 +3728,11 @@ Style/RandomWithOffset:
|
|
3581
3728
|
Enabled: true
|
3582
3729
|
VersionAdded: '0.52'
|
3583
3730
|
|
3731
|
+
Style/RedundantAssignment:
|
3732
|
+
Description: 'Checks for redundant assignment before returning.'
|
3733
|
+
Enabled: 'pending'
|
3734
|
+
VersionAdded: '0.87'
|
3735
|
+
|
3584
3736
|
Style/RedundantBegin:
|
3585
3737
|
Description: "Don't use begin blocks when they are not needed."
|
3586
3738
|
StyleGuide: '#begin-implicit'
|
@@ -3623,6 +3775,14 @@ Style/RedundantFetchBlock:
|
|
3623
3775
|
SafeForConstants: false
|
3624
3776
|
VersionAdded: '0.86'
|
3625
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
|
+
|
3626
3786
|
Style/RedundantFreeze:
|
3627
3787
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3628
3788
|
Enabled: true
|
@@ -3790,6 +3950,12 @@ Style/SignalException:
|
|
3790
3950
|
- only_fail
|
3791
3951
|
- semantic
|
3792
3952
|
|
3953
|
+
Style/SingleArgumentDig:
|
3954
|
+
Description: 'Avoid using single argument dig method.'
|
3955
|
+
Enabled: pending
|
3956
|
+
VersionAdded: '0.89'
|
3957
|
+
Safe: false
|
3958
|
+
|
3793
3959
|
Style/SingleLineBlockParams:
|
3794
3960
|
Description: 'Enforces the names of some block params.'
|
3795
3961
|
Enabled: false
|
@@ -3845,6 +4011,13 @@ Style/StderrPuts:
|
|
3845
4011
|
Enabled: true
|
3846
4012
|
VersionAdded: '0.51'
|
3847
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
|
+
|
3848
4021
|
Style/StringHashKeys:
|
3849
4022
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
3850
4023
|
StyleGuide: '#symbols-as-keys'
|
@@ -3924,7 +4097,7 @@ Style/SymbolLiteral:
|
|
3924
4097
|
Style/SymbolProc:
|
3925
4098
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
3926
4099
|
Enabled: true
|
3927
|
-
|
4100
|
+
Safe: false
|
3928
4101
|
VersionAdded: '0.26'
|
3929
4102
|
VersionChanged: '0.64'
|
3930
4103
|
# A list of method names to be ignored by the check.
|