rubocop 0.89.0 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/config/default.yml +128 -14
- data/lib/rubocop.rb +30 -4
- data/lib/rubocop/cached_data.rb +1 -0
- data/lib/rubocop/cli/command.rb +1 -0
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -0
- data/lib/rubocop/cli/command/base.rb +1 -0
- data/lib/rubocop/cli/command/execute_runner.rb +9 -0
- data/lib/rubocop/cli/command/init_dotfile.rb +1 -0
- data/lib/rubocop/cli/command/show_cops.rb +2 -1
- data/lib/rubocop/cli/command/version.rb +1 -0
- data/lib/rubocop/cli/environment.rb +1 -0
- data/lib/rubocop/comment_config.rb +17 -10
- data/lib/rubocop/config.rb +1 -1
- data/lib/rubocop/config_loader.rb +21 -10
- data/lib/rubocop/config_loader_resolver.rb +1 -0
- data/lib/rubocop/config_obsoletion.rb +1 -0
- data/lib/rubocop/config_regeneration.rb +33 -0
- data/lib/rubocop/config_store.rb +3 -3
- data/lib/rubocop/config_validator.rb +4 -1
- data/lib/rubocop/cop/base.rb +23 -0
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +5 -1
- data/lib/rubocop/cop/bundler/gem_comment.rb +8 -3
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +2 -0
- data/lib/rubocop/cop/commissioner.rb +47 -7
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +4 -4
- data/lib/rubocop/cop/correctors/condition_corrector.rb +3 -5
- data/lib/rubocop/cop/correctors/empty_line_corrector.rb +9 -10
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +4 -4
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +8 -3
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -8
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +5 -10
- data/lib/rubocop/cop/correctors/punctuation_corrector.rb +8 -10
- data/lib/rubocop/cop/documentation.rb +22 -0
- data/lib/rubocop/cop/generator.rb +2 -1
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -0
- data/lib/rubocop/cop/layout/array_alignment.rb +1 -0
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +77 -0
- data/lib/rubocop/cop/layout/block_alignment.rb +23 -19
- data/lib/rubocop/cop/layout/case_indentation.rb +4 -7
- data/lib/rubocop/cop/layout/class_structure.rb +14 -17
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +4 -6
- data/lib/rubocop/cop/layout/comment_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/condition_position.rb +13 -15
- data/lib/rubocop/cop/layout/def_end_alignment.rb +8 -5
- data/lib/rubocop/cop/layout/dot_position.rb +21 -17
- data/lib/rubocop/cop/layout/empty_comment.rb +30 -23
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +21 -18
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +13 -13
- data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +136 -0
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +21 -23
- data/lib/rubocop/cop/layout/empty_lines.rb +6 -7
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +18 -14
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +7 -8
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +4 -7
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +3 -7
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +2 -5
- data/lib/rubocop/cop/layout/end_alignment.rb +11 -17
- data/lib/rubocop/cop/layout/extra_spacing.rb +14 -21
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +2 -5
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +2 -5
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +4 -8
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +2 -5
- data/lib/rubocop/cop/layout/hash_alignment.rb +17 -20
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +15 -14
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +14 -11
- data/lib/rubocop/cop/layout/initial_indentation.rb +6 -7
- data/lib/rubocop/cop/layout/leading_comment_space.rb +12 -10
- data/lib/rubocop/cop/layout/leading_empty_lines.rb +6 -11
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +10 -14
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +21 -19
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +5 -9
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +41 -22
- data/lib/rubocop/cop/layout/space_after_colon.rb +11 -7
- data/lib/rubocop/cop/layout/space_after_comma.rb +2 -5
- data/lib/rubocop/cop/layout/space_after_method_name.rb +5 -6
- data/lib/rubocop/cop/layout/space_after_not.rb +9 -11
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +2 -5
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +22 -17
- data/lib/rubocop/cop/layout/space_around_keyword.rb +17 -18
- data/lib/rubocop/cop/layout/space_around_operators.rb +17 -16
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +23 -22
- data/lib/rubocop/cop/layout/space_before_comma.rb +3 -5
- data/lib/rubocop/cop/layout/space_before_comment.rb +10 -7
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +7 -7
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +2 -5
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +9 -17
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +20 -23
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -8
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +17 -16
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +19 -37
- data/lib/rubocop/cop/layout/space_inside_parens.rb +9 -14
- data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +5 -10
- data/lib/rubocop/cop/layout/space_inside_range_literal.rb +8 -17
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +16 -24
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +12 -13
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +10 -15
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +11 -11
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +2 -0
- data/lib/rubocop/cop/lint/big_decimal_new.rb +1 -2
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +2 -1
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +74 -0
- data/lib/rubocop/cop/lint/constant_resolution.rb +1 -1
- data/lib/rubocop/cop/lint/debugger.rb +2 -3
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -3
- data/lib/rubocop/cop/lint/duplicate_methods.rb +2 -4
- data/lib/rubocop/cop/lint/duplicate_require.rb +46 -0
- data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +2 -15
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -0
- data/lib/rubocop/cop/lint/empty_file.rb +50 -0
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +2 -0
- data/lib/rubocop/cop/lint/float_comparison.rb +2 -2
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +2 -2
- data/lib/rubocop/cop/lint/identity_comparison.rb +51 -0
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +2 -5
- data/lib/rubocop/cop/lint/inherit_exception.rb +2 -2
- data/lib/rubocop/cop/lint/missing_super.rb +11 -11
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +2 -35
- data/lib/rubocop/cop/lint/multiple_comparison.rb +3 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +1 -0
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +33 -15
- data/lib/rubocop/cop/lint/percent_string_array.rb +8 -12
- data/lib/rubocop/cop/lint/raise_exception.rb +1 -0
- data/lib/rubocop/cop/lint/rand_one.rb +2 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +36 -29
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +14 -4
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +1 -0
- data/lib/rubocop/cop/lint/rescue_type.rb +0 -1
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +3 -1
- data/lib/rubocop/cop/lint/shadowed_exception.rb +6 -6
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +4 -4
- data/lib/rubocop/cop/lint/struct_new_override.rb +1 -0
- data/lib/rubocop/cop/lint/to_json.rb +16 -5
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +57 -0
- data/lib/rubocop/cop/lint/unreachable_loop.rb +3 -6
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +3 -1
- data/lib/rubocop/cop/lint/uri_regexp.rb +10 -25
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +3 -9
- data/lib/rubocop/cop/lint/useless_method_definition.rb +70 -0
- data/lib/rubocop/cop/lint/useless_times.rb +106 -0
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +27 -16
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -0
- data/lib/rubocop/cop/migration/department_name.rb +2 -2
- data/lib/rubocop/cop/mixin/alignment.rb +5 -1
- data/lib/rubocop/cop/mixin/allowed_methods.rb +2 -0
- data/lib/rubocop/cop/mixin/annotation_comment.rb +5 -0
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +17 -8
- data/lib/rubocop/cop/mixin/comments_help.rb +48 -0
- data/lib/rubocop/cop/mixin/configurable_naming.rb +2 -2
- data/lib/rubocop/cop/mixin/configurable_numbering.rb +3 -3
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +8 -7
- data/lib/rubocop/cop/mixin/empty_parameter.rb +3 -1
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +12 -1
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +0 -2
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +3 -1
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +31 -12
- data/lib/rubocop/cop/mixin/line_length_help.rb +1 -3
- data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +3 -1
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +13 -12
- data/lib/rubocop/cop/mixin/negative_conditional.rb +2 -2
- data/lib/rubocop/cop/mixin/percent_array.rb +16 -9
- data/lib/rubocop/cop/mixin/range_help.rb +18 -4
- data/lib/rubocop/cop/mixin/regexp_literal_help.rb +1 -1
- data/lib/rubocop/cop/mixin/rescue_node.rb +11 -1
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +4 -3
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +4 -3
- data/lib/rubocop/cop/mixin/statement_modifier.rb +12 -6
- data/lib/rubocop/cop/mixin/surrounding_space.rb +8 -4
- data/lib/rubocop/cop/mixin/trailing_comma.rb +9 -11
- data/lib/rubocop/cop/mixin/visibility_help.rb +4 -16
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/file_name.rb +1 -1
- data/lib/rubocop/cop/offense.rb +1 -0
- data/lib/rubocop/cop/security/eval.rb +1 -0
- data/lib/rubocop/cop/security/json_load.rb +1 -0
- data/lib/rubocop/cop/security/marshal_load.rb +1 -0
- data/lib/rubocop/cop/security/open.rb +1 -0
- data/lib/rubocop/cop/security/yaml_load.rb +1 -0
- data/lib/rubocop/cop/severity.rb +0 -8
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +8 -19
- data/lib/rubocop/cop/style/accessor_grouping.rb +20 -20
- data/lib/rubocop/cop/style/alias.rb +36 -33
- data/lib/rubocop/cop/style/and_or.rb +9 -11
- data/lib/rubocop/cop/style/array_coercion.rb +4 -0
- data/lib/rubocop/cop/style/array_join.rb +7 -8
- data/lib/rubocop/cop/style/ascii_comments.rb +4 -4
- data/lib/rubocop/cop/style/attr.rb +12 -9
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +4 -5
- 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 +9 -12
- 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 +11 -3
- data/lib/rubocop/cop/style/case_like_if.rb +37 -18
- data/lib/rubocop/cop/style/class_and_module_children.rb +16 -11
- data/lib/rubocop/cop/style/class_check.rb +6 -11
- data/lib/rubocop/cop/style/class_methods.rb +7 -11
- data/lib/rubocop/cop/style/class_methods_definitions.rb +157 -0
- data/lib/rubocop/cop/style/class_vars.rb +7 -12
- data/lib/rubocop/cop/style/collection_methods.rb +11 -17
- data/lib/rubocop/cop/style/colon_method_call.rb +6 -7
- data/lib/rubocop/cop/style/colon_method_definition.rb +6 -6
- data/lib/rubocop/cop/style/combinable_loops.rb +84 -0
- 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 +8 -9
- data/lib/rubocop/cop/style/conditional_assignment.rb +50 -61
- 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 +13 -2
- data/lib/rubocop/cop/style/def_with_parentheses.rb +8 -10
- data/lib/rubocop/cop/style/dir.rb +8 -10
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +7 -9
- data/lib/rubocop/cop/style/documentation.rb +2 -4
- 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 +3 -2
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +5 -8
- data/lib/rubocop/cop/style/each_with_object.rb +16 -17
- data/lib/rubocop/cop/style/empty_block_parameter.rb +9 -10
- 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_lambda_parameter.rb +9 -10
- data/lib/rubocop/cop/style/empty_literal.rb +18 -17
- data/lib/rubocop/cop/style/empty_method.rb +5 -8
- 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 +6 -10
- data/lib/rubocop/cop/style/even_odd.rb +8 -11
- data/lib/rubocop/cop/style/expand_path_arguments.rb +23 -26
- data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -1
- data/lib/rubocop/cop/style/exponential_notation.rb +1 -1
- data/lib/rubocop/cop/style/float_division.rb +3 -1
- data/lib/rubocop/cop/style/for.rb +11 -15
- data/lib/rubocop/cop/style/format_string.rb +18 -23
- data/lib/rubocop/cop/style/format_string_token.rb +4 -7
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +19 -41
- data/lib/rubocop/cop/style/global_vars.rb +2 -2
- data/lib/rubocop/cop/style/guard_clause.rb +4 -4
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +24 -5
- data/lib/rubocop/cop/style/hash_each_methods.rb +5 -8
- data/lib/rubocop/cop/style/hash_syntax.rb +6 -7
- data/lib/rubocop/cop/style/hash_transform_keys.rb +19 -11
- data/lib/rubocop/cop/style/hash_transform_values.rb +18 -10
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +1 -1
- data/lib/rubocop/cop/style/if_inside_else.rb +2 -2
- data/lib/rubocop/cop/style/if_unless_modifier.rb +11 -17
- 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 +2 -1
- data/lib/rubocop/cop/style/infinite_loop.rb +23 -23
- data/lib/rubocop/cop/style/inline_comment.rb +3 -3
- data/lib/rubocop/cop/style/inverse_methods.rb +20 -29
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +53 -0
- data/lib/rubocop/cop/style/lambda.rb +7 -12
- data/lib/rubocop/cop/style/lambda_call.rb +17 -14
- 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 +11 -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 +7 -6
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +12 -3
- 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 +13 -13
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +1 -1
- data/lib/rubocop/cop/style/mixin_grouping.rb +24 -27
- data/lib/rubocop/cop/style/mixin_usage.rb +9 -28
- data/lib/rubocop/cop/style/module_function.rb +10 -13
- data/lib/rubocop/cop/style/multiline_block_chain.rb +2 -2
- 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 +12 -10
- data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +17 -6
- data/lib/rubocop/cop/style/multiline_when_then.rb +10 -11
- 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/negated_if.rb +6 -6
- data/lib/rubocop/cop/style/negated_unless.rb +6 -6
- data/lib/rubocop/cop/style/negated_while.rb +7 -15
- data/lib/rubocop/cop/style/nested_modifier.rb +10 -13
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +14 -12
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +14 -16
- data/lib/rubocop/cop/style/next.rb +10 -14
- data/lib/rubocop/cop/style/nil_comparison.rb +13 -11
- data/lib/rubocop/cop/style/non_nil_check.rb +34 -26
- data/lib/rubocop/cop/style/not.rb +20 -26
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +4 -9
- data/lib/rubocop/cop/style/numeric_predicate.rb +5 -14
- data/lib/rubocop/cop/style/one_line_conditional.rb +73 -23
- data/lib/rubocop/cop/style/option_hash.rb +1 -1
- data/lib/rubocop/cop/style/optional_arguments.rb +1 -1
- data/lib/rubocop/cop/style/optional_boolean_parameter.rb +12 -1
- data/lib/rubocop/cop/style/or_assignment.rb +13 -10
- data/lib/rubocop/cop/style/parallel_assignment.rb +14 -14
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +6 -6
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +13 -19
- data/lib/rubocop/cop/style/percent_q_literals.rb +8 -10
- data/lib/rubocop/cop/style/perl_backrefs.rb +8 -10
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +11 -14
- data/lib/rubocop/cop/style/proc.rb +6 -6
- data/lib/rubocop/cop/style/raise_args.rb +15 -24
- data/lib/rubocop/cop/style/random_with_offset.rb +19 -19
- data/lib/rubocop/cop/style/redundant_assignment.rb +8 -18
- data/lib/rubocop/cop/style/redundant_begin.rb +7 -9
- data/lib/rubocop/cop/style/redundant_capital_w.rb +6 -9
- data/lib/rubocop/cop/style/redundant_condition.rb +5 -6
- data/lib/rubocop/cop/style/redundant_conditional.rb +4 -5
- data/lib/rubocop/cop/style/redundant_exception.rb +1 -3
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +3 -12
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +9 -8
- data/lib/rubocop/cop/style/redundant_freeze.rb +5 -7
- data/lib/rubocop/cop/style/redundant_interpolation.rb +25 -24
- data/lib/rubocop/cop/style/redundant_parentheses.rb +21 -15
- data/lib/rubocop/cop/style/redundant_percent_q.rb +9 -11
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +6 -13
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +5 -14
- data/lib/rubocop/cop/style/redundant_return.rb +17 -17
- data/lib/rubocop/cop/style/redundant_self.rb +9 -11
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +116 -0
- data/lib/rubocop/cop/style/redundant_sort.rb +12 -31
- data/lib/rubocop/cop/style/redundant_sort_by.rb +5 -9
- data/lib/rubocop/cop/style/regexp_literal.rb +10 -21
- data/lib/rubocop/cop/style/rescue_modifier.rb +29 -9
- data/lib/rubocop/cop/style/rescue_standard_error.rb +20 -16
- data/lib/rubocop/cop/style/return_nil.rb +5 -5
- data/lib/rubocop/cop/style/safe_navigation.rb +22 -16
- data/lib/rubocop/cop/style/sample.rb +12 -14
- data/lib/rubocop/cop/style/self_assignment.rb +26 -22
- data/lib/rubocop/cop/style/semicolon.rb +6 -9
- data/lib/rubocop/cop/style/send.rb +4 -5
- data/lib/rubocop/cop/style/signal_exception.rb +23 -19
- data/lib/rubocop/cop/style/single_argument_dig.rb +1 -0
- data/lib/rubocop/cop/style/single_line_block_params.rb +4 -2
- data/lib/rubocop/cop/style/single_line_methods.rb +18 -17
- data/lib/rubocop/cop/style/slicing_with_range.rb +6 -8
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +66 -0
- data/lib/rubocop/cop/style/special_global_vars.rb +10 -15
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +17 -21
- data/lib/rubocop/cop/style/stderr_puts.rb +5 -6
- data/lib/rubocop/cop/style/string_concatenation.rb +16 -2
- data/lib/rubocop/cop/style/string_hash_keys.rb +6 -7
- data/lib/rubocop/cop/style/string_methods.rb +7 -17
- data/lib/rubocop/cop/style/strip.rb +9 -14
- data/lib/rubocop/cop/style/struct_inheritance.rb +3 -6
- data/lib/rubocop/cop/style/symbol_array.rb +5 -16
- data/lib/rubocop/cop/style/symbol_literal.rb +4 -6
- data/lib/rubocop/cop/style/symbol_proc.rb +14 -18
- data/lib/rubocop/cop/style/ternary_parentheses.rb +22 -22
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +3 -6
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +4 -7
- data/lib/rubocop/cop/style/trailing_body_on_module.rb +3 -6
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +2 -5
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +2 -5
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +11 -9
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +2 -5
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +8 -17
- data/lib/rubocop/cop/style/trivial_accessors.rb +26 -30
- data/lib/rubocop/cop/style/unless_else.rb +5 -8
- data/lib/rubocop/cop/style/unpack_first.rb +5 -8
- data/lib/rubocop/cop/style/variable_interpolation.rb +7 -10
- data/lib/rubocop/cop/style/when_then.rb +4 -6
- data/lib/rubocop/cop/style/while_until_do.rb +6 -16
- data/lib/rubocop/cop/style/while_until_modifier.rb +6 -20
- data/lib/rubocop/cop/style/word_array.rb +5 -23
- data/lib/rubocop/cop/style/yoda_condition.rb +4 -15
- data/lib/rubocop/cop/style/zero_length_predicate.rb +12 -18
- data/lib/rubocop/cop/team.rb +1 -0
- data/lib/rubocop/cop/util.rb +2 -1
- data/lib/rubocop/cop/utils/format_string.rb +3 -5
- data/lib/rubocop/cop/variable_force.rb +2 -0
- data/lib/rubocop/cops_documentation_generator.rb +5 -3
- data/lib/rubocop/core_ext/string.rb +2 -2
- data/lib/rubocop/directive_comment.rb +32 -0
- data/lib/rubocop/ext/regexp_node.rb +46 -0
- data/lib/rubocop/file_finder.rb +1 -0
- data/lib/rubocop/formatter/auto_gen_config_formatter.rb +2 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +13 -6
- data/lib/rubocop/formatter/html_formatter.rb +2 -0
- data/lib/rubocop/formatter/junit_formatter.rb +1 -1
- data/lib/rubocop/formatter/progress_formatter.rb +2 -1
- data/lib/rubocop/formatter/quiet_formatter.rb +1 -1
- data/lib/rubocop/formatter/simple_text_formatter.rb +36 -6
- data/lib/rubocop/name_similarity.rb +1 -0
- data/lib/rubocop/options.rb +43 -20
- data/lib/rubocop/remote_config.rb +1 -0
- data/lib/rubocop/result_cache.rb +31 -13
- data/lib/rubocop/rspec/cop_helper.rb +4 -1
- data/lib/rubocop/rspec/expect_offense.rb +14 -9
- data/lib/rubocop/rspec/shared_contexts.rb +13 -5
- data/lib/rubocop/runner.rb +35 -15
- data/lib/rubocop/string_interpreter.rb +3 -0
- data/lib/rubocop/target_finder.rb +5 -1
- data/lib/rubocop/target_ruby.rb +7 -1
- data/lib/rubocop/version.rb +7 -1
- data/lib/rubocop/yaml_duplication_checker.rb +1 -0
- metadata +26 -14
- data/lib/rubocop/cop/tokens_util.rb +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 682e17739f5c067f13eb30a3e84b365533bb0e075da92a40529c943e5a67e3b0
|
4
|
+
data.tar.gz: 2c7e59ef470ad45515bed37249c97419181add1f451379d00b31ff45b21ddd36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bc3d0c3238795b8563b974c99c20d3cfb34dff97bc33f5231d6ef7497f53ce6f4753923bce17954fe30e69b0a8d4146a3b1377d0489e7f10bc97a0b3c69ae7b
|
7
|
+
data.tar.gz: 4131b9c8a874e09d8c0581a04e91b44acc76855afa565cd52a324055a0bd7e1a40d37bc532b8b3781c9af9847335c6596ca8ed17fe9bff03d13283171d77c168
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
**RuboCop** is a Ruby static code analyzer (a.k.a. `linter`) and code formatter. Out of the box it
|
23
23
|
will enforce many of the guidelines outlined in the community [Ruby Style
|
24
24
|
Guide](https://rubystyle.guide). Apart from reporting the problems discovered in your code,
|
25
|
-
RuboCop can also automatically fix many of them you.
|
25
|
+
RuboCop can also automatically fix many of them for you.
|
26
26
|
|
27
27
|
RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
|
28
28
|
[configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
|
@@ -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.92.0', require: false
|
53
53
|
```
|
54
54
|
|
55
55
|
## Quickstart
|
data/config/default.yml
CHANGED
@@ -117,6 +117,8 @@ AllCops:
|
|
117
117
|
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
118
118
|
# taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
|
119
119
|
# `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
|
120
|
+
# The CacheRootDirectory can be overwritten by passing the `--cache-root` command
|
121
|
+
# line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
|
120
122
|
CacheRootDirectory: ~
|
121
123
|
# It is possible for a malicious user to know the location of RuboCop's cache
|
122
124
|
# directory by looking at CacheRootDirectory, and create a symlink in its
|
@@ -309,6 +311,19 @@ Layout/AssignmentIndentation:
|
|
309
311
|
# But it can be overridden by setting this parameter
|
310
312
|
IndentationWidth: ~
|
311
313
|
|
314
|
+
Layout/BeginEndAlignment:
|
315
|
+
Description: 'Align ends corresponding to begins correctly.'
|
316
|
+
Enabled: pending
|
317
|
+
VersionAdded: '0.91'
|
318
|
+
# The value `start_of_line` means that `end` should be aligned the start of the line
|
319
|
+
# where the `begin` keyword is.
|
320
|
+
# The value `begin` means that `end` should be aligned with the `begin` keyword.
|
321
|
+
EnforcedStyleAlignWith: start_of_line
|
322
|
+
SupportedStylesAlignWith:
|
323
|
+
- start_of_line
|
324
|
+
- begin
|
325
|
+
Severity: warning
|
326
|
+
|
312
327
|
Layout/BlockAlignment:
|
313
328
|
Description: 'Align block ends correctly.'
|
314
329
|
Enabled: true
|
@@ -399,7 +414,6 @@ Layout/DefEndAlignment:
|
|
399
414
|
SupportedStylesAlignWith:
|
400
415
|
- start_of_line
|
401
416
|
- def
|
402
|
-
AutoCorrect: false
|
403
417
|
Severity: warning
|
404
418
|
|
405
419
|
Layout/DotPosition:
|
@@ -436,6 +450,14 @@ Layout/EmptyLineAfterMagicComment:
|
|
436
450
|
Enabled: true
|
437
451
|
VersionAdded: '0.49'
|
438
452
|
|
453
|
+
Layout/EmptyLineAfterMultilineCondition:
|
454
|
+
Description: 'Enforces empty line after multiline condition.'
|
455
|
+
# This is disabled, because this style is not very common in practice.
|
456
|
+
Enabled: false
|
457
|
+
VersionAdded: '0.90'
|
458
|
+
Reference:
|
459
|
+
- https://github.com/airbnb/ruby#multiline-if-newline
|
460
|
+
|
439
461
|
Layout/EmptyLineBetweenDefs:
|
440
462
|
Description: 'Use empty lines between defs.'
|
441
463
|
StyleGuide: '#empty-lines-between-methods'
|
@@ -555,7 +577,6 @@ Layout/EndAlignment:
|
|
555
577
|
- keyword
|
556
578
|
- variable
|
557
579
|
- start_of_line
|
558
|
-
AutoCorrect: false
|
559
580
|
Severity: warning
|
560
581
|
|
561
582
|
Layout/EndOfLine:
|
@@ -1374,6 +1395,12 @@ Lint/CircularArgumentReference:
|
|
1374
1395
|
Enabled: true
|
1375
1396
|
VersionAdded: '0.33'
|
1376
1397
|
|
1398
|
+
Lint/ConstantDefinitionInBlock:
|
1399
|
+
Description: 'Do not define constants within a block.'
|
1400
|
+
StyleGuide: '#no-constant-definition-in-block'
|
1401
|
+
Enabled: pending
|
1402
|
+
VersionAdded: '0.91'
|
1403
|
+
|
1377
1404
|
Lint/ConstantResolution:
|
1378
1405
|
Description: 'Check that constants are fully qualified with `::`.'
|
1379
1406
|
Enabled: false
|
@@ -1427,6 +1454,11 @@ Lint/DuplicateMethods:
|
|
1427
1454
|
Enabled: true
|
1428
1455
|
VersionAdded: '0.29'
|
1429
1456
|
|
1457
|
+
Lint/DuplicateRequire:
|
1458
|
+
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1459
|
+
Enabled: pending
|
1460
|
+
VersionAdded: '0.90'
|
1461
|
+
|
1430
1462
|
Lint/DuplicateRescueException:
|
1431
1463
|
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1432
1464
|
Enabled: pending
|
@@ -1453,13 +1485,18 @@ Lint/EmptyEnsure:
|
|
1453
1485
|
Enabled: true
|
1454
1486
|
VersionAdded: '0.10'
|
1455
1487
|
VersionChanged: '0.48'
|
1456
|
-
AutoCorrect: false
|
1457
1488
|
|
1458
1489
|
Lint/EmptyExpression:
|
1459
1490
|
Description: 'Checks for empty expressions.'
|
1460
1491
|
Enabled: true
|
1461
1492
|
VersionAdded: '0.45'
|
1462
1493
|
|
1494
|
+
Lint/EmptyFile:
|
1495
|
+
Description: 'Enforces that Ruby source files are not empty.'
|
1496
|
+
Enabled: pending
|
1497
|
+
AllowComments: true
|
1498
|
+
VersionAdded: '0.90'
|
1499
|
+
|
1463
1500
|
Lint/EmptyInterpolation:
|
1464
1501
|
Description: 'Checks for empty string interpolation.'
|
1465
1502
|
Enabled: true
|
@@ -1517,6 +1554,12 @@ Lint/HeredocMethodCallPosition:
|
|
1517
1554
|
StyleGuide: '#heredoc-method-calls'
|
1518
1555
|
VersionAdded: '0.68'
|
1519
1556
|
|
1557
|
+
Lint/IdentityComparison:
|
1558
|
+
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1559
|
+
Enabled: pending
|
1560
|
+
StyleGuide: '#identity-comparison'
|
1561
|
+
VersionAdded: '0.91'
|
1562
|
+
|
1520
1563
|
Lint/ImplicitStringConcatenation:
|
1521
1564
|
Description: >-
|
1522
1565
|
Checks for adjacent string literals on the same line, which
|
@@ -1768,6 +1811,7 @@ Lint/SafeNavigationChain:
|
|
1768
1811
|
- presence
|
1769
1812
|
- try
|
1770
1813
|
- try!
|
1814
|
+
- in?
|
1771
1815
|
|
1772
1816
|
Lint/SafeNavigationConsistency:
|
1773
1817
|
Description: >-
|
@@ -1856,6 +1900,11 @@ Lint/TopLevelReturnWithArgument:
|
|
1856
1900
|
Enabled: 'pending'
|
1857
1901
|
VersionAdded: '0.89'
|
1858
1902
|
|
1903
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
1904
|
+
Description: 'This cop checks for trailing commas in attribute declarations.'
|
1905
|
+
Enabled: pending
|
1906
|
+
VersionAdded: '0.90'
|
1907
|
+
|
1859
1908
|
Lint/UnderscorePrefixedVariableName:
|
1860
1909
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
1861
1910
|
Enabled: true
|
@@ -1931,6 +1980,13 @@ Lint/UselessElseWithoutRescue:
|
|
1931
1980
|
Enabled: true
|
1932
1981
|
VersionAdded: '0.17'
|
1933
1982
|
|
1983
|
+
Lint/UselessMethodDefinition:
|
1984
|
+
Description: 'Checks for useless method definitions.'
|
1985
|
+
Enabled: pending
|
1986
|
+
VersionAdded: '0.90'
|
1987
|
+
Safe: false
|
1988
|
+
AllowComments: true
|
1989
|
+
|
1934
1990
|
Lint/UselessSetterCall:
|
1935
1991
|
Description: 'Checks for useless setter call to a local variable.'
|
1936
1992
|
Enabled: true
|
@@ -1938,6 +1994,12 @@ Lint/UselessSetterCall:
|
|
1938
1994
|
VersionChanged: '0.80'
|
1939
1995
|
Safe: false
|
1940
1996
|
|
1997
|
+
Lint/UselessTimes:
|
1998
|
+
Description: 'Checks for useless `Integer#times` calls.'
|
1999
|
+
Enabled: pending
|
2000
|
+
VersionAdded: '0.91'
|
2001
|
+
Safe: false
|
2002
|
+
|
1941
2003
|
Lint/Void:
|
1942
2004
|
Description: 'Possible use of operator/literal/variable in void context.'
|
1943
2005
|
Enabled: true
|
@@ -2401,7 +2463,7 @@ Style/ArrayCoercion:
|
|
2401
2463
|
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2402
2464
|
StyleGuide: '#array-coercion'
|
2403
2465
|
Safe: false
|
2404
|
-
Enabled:
|
2466
|
+
Enabled: false
|
2405
2467
|
VersionAdded: '0.88'
|
2406
2468
|
|
2407
2469
|
Style/ArrayJoin:
|
@@ -2591,6 +2653,7 @@ Style/CaseLikeIf:
|
|
2591
2653
|
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2592
2654
|
StyleGuide: '#case-vs-if-else'
|
2593
2655
|
Enabled: 'pending'
|
2656
|
+
Safe: false
|
2594
2657
|
VersionAdded: '0.88'
|
2595
2658
|
|
2596
2659
|
Style/CharacterLiteral:
|
@@ -2608,7 +2671,6 @@ Style/ClassAndModuleChildren:
|
|
2608
2671
|
# have the knowledge to perform either operation safely and thus requires
|
2609
2672
|
# manual oversight.
|
2610
2673
|
SafeAutoCorrect: false
|
2611
|
-
AutoCorrect: false
|
2612
2674
|
Enabled: true
|
2613
2675
|
VersionAdded: '0.19'
|
2614
2676
|
#
|
@@ -2647,6 +2709,16 @@ Style/ClassMethods:
|
|
2647
2709
|
VersionAdded: '0.9'
|
2648
2710
|
VersionChanged: '0.20'
|
2649
2711
|
|
2712
|
+
Style/ClassMethodsDefinitions:
|
2713
|
+
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
2714
|
+
StyleGuide: '#def-self-class-methods'
|
2715
|
+
Enabled: false
|
2716
|
+
VersionAdded: '0.89'
|
2717
|
+
EnforcedStyle: def_self
|
2718
|
+
SupportedStyles:
|
2719
|
+
- def_self
|
2720
|
+
- self_class
|
2721
|
+
|
2650
2722
|
Style/ClassVars:
|
2651
2723
|
Description: 'Avoid the use of class variables.'
|
2652
2724
|
StyleGuide: '#no-class-vars'
|
@@ -2687,6 +2759,14 @@ Style/ColonMethodDefinition:
|
|
2687
2759
|
Enabled: true
|
2688
2760
|
VersionAdded: '0.52'
|
2689
2761
|
|
2762
|
+
Style/CombinableLoops:
|
2763
|
+
Description: >-
|
2764
|
+
Checks for places where multiple consecutive loops over the same data
|
2765
|
+
can be combined into a single loop.
|
2766
|
+
Enabled: pending
|
2767
|
+
Safe: false
|
2768
|
+
VersionAdded: '0.90'
|
2769
|
+
|
2690
2770
|
Style/CommandLiteral:
|
2691
2771
|
Description: 'Use `` or %x around command literals.'
|
2692
2772
|
StyleGuide: '#percent-x'
|
@@ -2783,7 +2863,8 @@ Style/DateTime:
|
|
2783
2863
|
StyleGuide: '#date--time'
|
2784
2864
|
Enabled: false
|
2785
2865
|
VersionAdded: '0.51'
|
2786
|
-
VersionChanged: '0.
|
2866
|
+
VersionChanged: '0.92'
|
2867
|
+
SafeAutoCorrect: false
|
2787
2868
|
AllowCoercion: false
|
2788
2869
|
|
2789
2870
|
Style/DefWithParentheses:
|
@@ -3021,13 +3102,14 @@ Style/FrozenStringLiteralComment:
|
|
3021
3102
|
# `never` will enforce that the frozen string literal comment does not
|
3022
3103
|
# exist in a file.
|
3023
3104
|
- never
|
3024
|
-
|
3105
|
+
SafeAutoCorrect: false
|
3025
3106
|
|
3026
3107
|
Style/GlobalStdStream:
|
3027
3108
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3028
3109
|
StyleGuide: '#global-stdout'
|
3029
3110
|
Enabled: pending
|
3030
3111
|
VersionAdded: '0.89'
|
3112
|
+
SafeAutoCorrect: false
|
3031
3113
|
|
3032
3114
|
Style/GlobalVars:
|
3033
3115
|
Description: 'Do not introduce global variables.'
|
@@ -3101,15 +3183,17 @@ Style/HashSyntax:
|
|
3101
3183
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
3102
3184
|
|
3103
3185
|
Style/HashTransformKeys:
|
3104
|
-
Description: 'Prefer `transform_keys` over `each_with_object`
|
3186
|
+
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3105
3187
|
Enabled: 'pending'
|
3106
3188
|
VersionAdded: '0.80'
|
3189
|
+
VersionChanged: '0.90'
|
3107
3190
|
Safe: false
|
3108
3191
|
|
3109
3192
|
Style/HashTransformValues:
|
3110
|
-
Description: 'Prefer `transform_values` over `each_with_object`
|
3193
|
+
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3111
3194
|
Enabled: 'pending'
|
3112
3195
|
VersionAdded: '0.80'
|
3196
|
+
VersionChanged: '0.90'
|
3113
3197
|
Safe: false
|
3114
3198
|
|
3115
3199
|
Style/IdenticalConditionalBranches:
|
@@ -3200,11 +3284,22 @@ Style/IpAddresses:
|
|
3200
3284
|
Description: "Don't include literal IP addresses in code."
|
3201
3285
|
Enabled: false
|
3202
3286
|
VersionAdded: '0.58'
|
3203
|
-
VersionChanged: '0.
|
3287
|
+
VersionChanged: '0.91'
|
3204
3288
|
# Allow addresses to be permitted
|
3205
3289
|
AllowedAddresses:
|
3206
3290
|
- "::"
|
3207
3291
|
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
3292
|
+
Exclude:
|
3293
|
+
- '**/*.gemfile'
|
3294
|
+
- '**/Gemfile'
|
3295
|
+
- '**/gems.rb'
|
3296
|
+
- '**/*.gemspec'
|
3297
|
+
|
3298
|
+
Style/KeywordParametersOrder:
|
3299
|
+
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3300
|
+
StyleGuide: '#keyword-parameters-order'
|
3301
|
+
Enabled: pending
|
3302
|
+
VersionAdded: '0.90'
|
3208
3303
|
|
3209
3304
|
Style/Lambda:
|
3210
3305
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -3579,7 +3674,6 @@ Style/NumericPredicate:
|
|
3579
3674
|
# object. Switching these methods has to be done with knowledge of the types
|
3580
3675
|
# of the variables which rubocop doesn't have.
|
3581
3676
|
SafeAutoCorrect: false
|
3582
|
-
AutoCorrect: false
|
3583
3677
|
Enabled: true
|
3584
3678
|
VersionAdded: '0.42'
|
3585
3679
|
VersionChanged: '0.59'
|
@@ -3595,12 +3689,13 @@ Style/NumericPredicate:
|
|
3595
3689
|
|
3596
3690
|
Style/OneLineConditional:
|
3597
3691
|
Description: >-
|
3598
|
-
Favor the ternary operator(?:) over
|
3599
|
-
if/then/else/end constructs.
|
3692
|
+
Favor the ternary operator (?:) or multi-line constructs over
|
3693
|
+
single-line if/then/else/end constructs.
|
3600
3694
|
StyleGuide: '#ternary-operator'
|
3601
3695
|
Enabled: true
|
3696
|
+
AlwaysCorrectToMultiline: false
|
3602
3697
|
VersionAdded: '0.9'
|
3603
|
-
VersionChanged: '0.
|
3698
|
+
VersionChanged: '0.90'
|
3604
3699
|
|
3605
3700
|
Style/OptionHash:
|
3606
3701
|
Description: "Don't use option hashes when you can use keyword arguments."
|
@@ -3631,6 +3726,8 @@ Style/OptionalBooleanParameter:
|
|
3631
3726
|
Enabled: pending
|
3632
3727
|
Safe: false
|
3633
3728
|
VersionAdded: '0.89'
|
3729
|
+
AllowedMethods:
|
3730
|
+
- respond_to_missing?
|
3634
3731
|
|
3635
3732
|
Style/OrAssignment:
|
3636
3733
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
@@ -3831,6 +3928,12 @@ Style/RedundantSelf:
|
|
3831
3928
|
VersionAdded: '0.10'
|
3832
3929
|
VersionChanged: '0.13'
|
3833
3930
|
|
3931
|
+
Style/RedundantSelfAssignment:
|
3932
|
+
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
3933
|
+
Enabled: pending
|
3934
|
+
Safe: false
|
3935
|
+
VersionAdded: '0.90'
|
3936
|
+
|
3834
3937
|
Style/RedundantSort:
|
3835
3938
|
Description: >-
|
3836
3939
|
Use `min` instead of `sort.first`,
|
@@ -3893,6 +3996,8 @@ Style/SafeNavigation:
|
|
3893
3996
|
This cop transforms usages of a method call safeguarded by
|
3894
3997
|
a check for the existence of the object to
|
3895
3998
|
safe navigation (`&.`).
|
3999
|
+
Auto-correction is unsafe as it assumes the object will
|
4000
|
+
be `nil` or truthy, but never `false`.
|
3896
4001
|
Enabled: true
|
3897
4002
|
VersionAdded: '0.43'
|
3898
4003
|
VersionChanged: '0.77'
|
@@ -3905,6 +4010,7 @@ Style/SafeNavigation:
|
|
3905
4010
|
- presence
|
3906
4011
|
- try
|
3907
4012
|
- try!
|
4013
|
+
SafeAutoCorrect: false
|
3908
4014
|
|
3909
4015
|
Style/Sample:
|
3910
4016
|
Description: >-
|
@@ -3983,6 +4089,14 @@ Style/SlicingWithRange:
|
|
3983
4089
|
VersionAdded: '0.83'
|
3984
4090
|
Safe: false
|
3985
4091
|
|
4092
|
+
Style/SoleNestedConditional:
|
4093
|
+
Description: >-
|
4094
|
+
Finds sole nested conditional nodes
|
4095
|
+
which can be merged into outer conditional node.
|
4096
|
+
Enabled: pending
|
4097
|
+
VersionAdded: '0.89'
|
4098
|
+
AllowModifier: false
|
4099
|
+
|
3986
4100
|
Style/SpecialGlobalVars:
|
3987
4101
|
Description: 'Avoid Perl-style global variables.'
|
3988
4102
|
StyleGuide: '#no-cryptic-perlisms'
|
data/lib/rubocop.rb
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'English'
|
4
|
+
before_us = $LOADED_FEATURES.dup
|
3
5
|
require 'rainbow'
|
4
6
|
|
5
|
-
require 'English'
|
6
7
|
require 'set'
|
7
8
|
require 'forwardable'
|
8
9
|
require 'regexp_parser'
|
9
10
|
require 'unicode/display_width/no_string_ext'
|
10
|
-
require 'rubocop-ast'
|
11
|
-
require_relative 'rubocop/ast_aliases'
|
12
11
|
|
12
|
+
# we have to require RuboCop's version, before rubocop-ast's
|
13
13
|
require_relative 'rubocop/version'
|
14
|
+
require 'rubocop-ast'
|
15
|
+
|
16
|
+
require_relative 'rubocop/ast_aliases'
|
17
|
+
require_relative 'rubocop/ext/regexp_node'
|
14
18
|
|
15
19
|
require_relative 'rubocop/core_ext/string'
|
16
20
|
require_relative 'rubocop/ext/processed_source'
|
@@ -23,7 +27,6 @@ require_relative 'rubocop/string_interpreter'
|
|
23
27
|
require_relative 'rubocop/error'
|
24
28
|
require_relative 'rubocop/warning'
|
25
29
|
|
26
|
-
require_relative 'rubocop/cop/tokens_util'
|
27
30
|
require_relative 'rubocop/cop/util'
|
28
31
|
require_relative 'rubocop/cop/offense'
|
29
32
|
require_relative 'rubocop/cop/message_annotator'
|
@@ -34,6 +37,7 @@ require_relative 'rubocop/cop/registry'
|
|
34
37
|
require_relative 'rubocop/cop/base'
|
35
38
|
require_relative 'rubocop/cop/cop'
|
36
39
|
require_relative 'rubocop/cop/commissioner'
|
40
|
+
require_relative 'rubocop/cop/documentation'
|
37
41
|
require_relative 'rubocop/cop/corrector'
|
38
42
|
require_relative 'rubocop/cop/force'
|
39
43
|
require_relative 'rubocop/cop/severity'
|
@@ -116,6 +120,7 @@ require_relative 'rubocop/cop/mixin/trailing_comma'
|
|
116
120
|
require_relative 'rubocop/cop/mixin/uncommunicative_name'
|
117
121
|
require_relative 'rubocop/cop/mixin/unused_argument'
|
118
122
|
require_relative 'rubocop/cop/mixin/visibility_help'
|
123
|
+
require_relative 'rubocop/cop/mixin/comments_help' # relies on visibility_help
|
119
124
|
|
120
125
|
require_relative 'rubocop/cop/utils/format_string'
|
121
126
|
|
@@ -151,6 +156,7 @@ require_relative 'rubocop/cop/layout/access_modifier_indentation'
|
|
151
156
|
require_relative 'rubocop/cop/layout/argument_alignment'
|
152
157
|
require_relative 'rubocop/cop/layout/array_alignment'
|
153
158
|
require_relative 'rubocop/cop/layout/assignment_indentation'
|
159
|
+
require_relative 'rubocop/cop/layout/begin_end_alignment'
|
154
160
|
require_relative 'rubocop/cop/layout/block_alignment'
|
155
161
|
require_relative 'rubocop/cop/layout/block_end_newline'
|
156
162
|
require_relative 'rubocop/cop/layout/case_indentation'
|
@@ -165,6 +171,7 @@ require_relative 'rubocop/cop/layout/else_alignment'
|
|
165
171
|
require_relative 'rubocop/cop/layout/empty_comment'
|
166
172
|
require_relative 'rubocop/cop/layout/empty_line_after_guard_clause'
|
167
173
|
require_relative 'rubocop/cop/layout/empty_line_after_magic_comment'
|
174
|
+
require_relative 'rubocop/cop/layout/empty_line_after_multiline_condition'
|
168
175
|
require_relative 'rubocop/cop/layout/empty_line_between_defs'
|
169
176
|
require_relative 'rubocop/cop/layout/empty_lines_around_access_modifier'
|
170
177
|
require_relative 'rubocop/cop/layout/empty_lines_around_arguments'
|
@@ -246,6 +253,7 @@ require_relative 'rubocop/cop/lint/big_decimal_new'
|
|
246
253
|
require_relative 'rubocop/cop/lint/binary_operator_with_identical_operands'
|
247
254
|
require_relative 'rubocop/cop/lint/boolean_symbol'
|
248
255
|
require_relative 'rubocop/cop/lint/circular_argument_reference'
|
256
|
+
require_relative 'rubocop/cop/lint/constant_definition_in_block'
|
249
257
|
require_relative 'rubocop/cop/lint/constant_resolution'
|
250
258
|
require_relative 'rubocop/cop/lint/debugger'
|
251
259
|
require_relative 'rubocop/cop/lint/deprecated_class_methods'
|
@@ -255,12 +263,14 @@ require_relative 'rubocop/cop/lint/duplicate_case_condition'
|
|
255
263
|
require_relative 'rubocop/cop/lint/duplicate_elsif_condition'
|
256
264
|
require_relative 'rubocop/cop/lint/duplicate_hash_key'
|
257
265
|
require_relative 'rubocop/cop/lint/duplicate_methods'
|
266
|
+
require_relative 'rubocop/cop/lint/duplicate_require'
|
258
267
|
require_relative 'rubocop/cop/lint/duplicate_rescue_exception'
|
259
268
|
require_relative 'rubocop/cop/lint/each_with_object_argument'
|
260
269
|
require_relative 'rubocop/cop/lint/else_layout'
|
261
270
|
require_relative 'rubocop/cop/lint/empty_conditional_body'
|
262
271
|
require_relative 'rubocop/cop/lint/empty_ensure'
|
263
272
|
require_relative 'rubocop/cop/lint/empty_expression'
|
273
|
+
require_relative 'rubocop/cop/lint/empty_file'
|
264
274
|
require_relative 'rubocop/cop/lint/empty_interpolation'
|
265
275
|
require_relative 'rubocop/cop/lint/empty_when'
|
266
276
|
require_relative 'rubocop/cop/lint/ensure_return'
|
@@ -270,6 +280,7 @@ require_relative 'rubocop/cop/lint/float_comparison'
|
|
270
280
|
require_relative 'rubocop/cop/lint/float_out_of_range'
|
271
281
|
require_relative 'rubocop/cop/lint/format_parameter_mismatch'
|
272
282
|
require_relative 'rubocop/cop/lint/heredoc_method_call_position'
|
283
|
+
require_relative 'rubocop/cop/lint/identity_comparison'
|
273
284
|
require_relative 'rubocop/cop/lint/implicit_string_concatenation'
|
274
285
|
require_relative 'rubocop/cop/lint/inherit_exception'
|
275
286
|
require_relative 'rubocop/cop/lint/ineffective_access_modifier'
|
@@ -320,6 +331,7 @@ require_relative 'rubocop/cop/lint/suppressed_exception'
|
|
320
331
|
require_relative 'rubocop/cop/lint/syntax'
|
321
332
|
require_relative 'rubocop/cop/lint/to_json'
|
322
333
|
require_relative 'rubocop/cop/lint/top_level_return_with_argument'
|
334
|
+
require_relative 'rubocop/cop/lint/trailing_comma_in_attribute_declaration'
|
323
335
|
require_relative 'rubocop/cop/lint/underscore_prefixed_variable_name'
|
324
336
|
require_relative 'rubocop/cop/lint/unified_integer'
|
325
337
|
require_relative 'rubocop/cop/lint/unreachable_code'
|
@@ -331,7 +343,9 @@ require_relative 'rubocop/cop/lint/uri_regexp'
|
|
331
343
|
require_relative 'rubocop/cop/lint/useless_access_modifier'
|
332
344
|
require_relative 'rubocop/cop/lint/useless_assignment'
|
333
345
|
require_relative 'rubocop/cop/lint/useless_else_without_rescue'
|
346
|
+
require_relative 'rubocop/cop/lint/useless_method_definition'
|
334
347
|
require_relative 'rubocop/cop/lint/useless_setter_call'
|
348
|
+
require_relative 'rubocop/cop/lint/useless_times'
|
335
349
|
require_relative 'rubocop/cop/lint/void'
|
336
350
|
|
337
351
|
require_relative 'rubocop/cop/metrics/utils/iterating_block'
|
@@ -385,10 +399,12 @@ require_relative 'rubocop/cop/style/character_literal'
|
|
385
399
|
require_relative 'rubocop/cop/style/class_and_module_children'
|
386
400
|
require_relative 'rubocop/cop/style/class_check'
|
387
401
|
require_relative 'rubocop/cop/style/class_methods'
|
402
|
+
require_relative 'rubocop/cop/style/class_methods_definitions'
|
388
403
|
require_relative 'rubocop/cop/style/class_vars'
|
389
404
|
require_relative 'rubocop/cop/style/collection_methods'
|
390
405
|
require_relative 'rubocop/cop/style/colon_method_call'
|
391
406
|
require_relative 'rubocop/cop/style/colon_method_definition'
|
407
|
+
require_relative 'rubocop/cop/style/combinable_loops'
|
392
408
|
require_relative 'rubocop/cop/style/command_literal'
|
393
409
|
require_relative 'rubocop/cop/style/comment_annotation'
|
394
410
|
require_relative 'rubocop/cop/style/commented_keyword'
|
@@ -442,6 +458,7 @@ require_relative 'rubocop/cop/style/infinite_loop'
|
|
442
458
|
require_relative 'rubocop/cop/style/inverse_methods'
|
443
459
|
require_relative 'rubocop/cop/style/inline_comment'
|
444
460
|
require_relative 'rubocop/cop/style/ip_addresses'
|
461
|
+
require_relative 'rubocop/cop/style/keyword_parameters_order'
|
445
462
|
require_relative 'rubocop/cop/style/lambda'
|
446
463
|
require_relative 'rubocop/cop/style/lambda_call'
|
447
464
|
require_relative 'rubocop/cop/style/line_end_concatenation'
|
@@ -450,6 +467,8 @@ require_relative 'rubocop/cop/style/method_call_with_args_parentheses'
|
|
450
467
|
require_relative 'rubocop/cop/style/redundant_assignment'
|
451
468
|
require_relative 'rubocop/cop/style/redundant_fetch_block'
|
452
469
|
require_relative 'rubocop/cop/style/redundant_file_extension_in_require'
|
470
|
+
require_relative 'rubocop/cop/style/redundant_self_assignment'
|
471
|
+
require_relative 'rubocop/cop/style/sole_nested_conditional'
|
453
472
|
require_relative 'rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses'
|
454
473
|
require_relative 'rubocop/cop/style/method_call_with_args_parentheses/require_parentheses'
|
455
474
|
require_relative 'rubocop/cop/style/method_called_on_do_end_block'
|
@@ -597,6 +616,7 @@ require_relative 'rubocop/config_obsoletion'
|
|
597
616
|
require_relative 'rubocop/config_store'
|
598
617
|
require_relative 'rubocop/config_validator'
|
599
618
|
require_relative 'rubocop/target_finder'
|
619
|
+
require_relative 'rubocop/directive_comment'
|
600
620
|
require_relative 'rubocop/comment_config'
|
601
621
|
require_relative 'rubocop/magic_comment'
|
602
622
|
require_relative 'rubocop/result_cache'
|
@@ -610,7 +630,13 @@ require_relative 'rubocop/cli/command/execute_runner'
|
|
610
630
|
require_relative 'rubocop/cli/command/init_dotfile'
|
611
631
|
require_relative 'rubocop/cli/command/show_cops'
|
612
632
|
require_relative 'rubocop/cli/command/version'
|
633
|
+
require_relative 'rubocop/config_regeneration'
|
613
634
|
require_relative 'rubocop/options'
|
614
635
|
require_relative 'rubocop/remote_config'
|
615
636
|
require_relative 'rubocop/target_ruby'
|
616
637
|
require_relative 'rubocop/yaml_duplication_checker'
|
638
|
+
|
639
|
+
unless File.exist?("#{__dir__}/../rubocop.gemspec") # Check if we are a gem
|
640
|
+
RuboCop::ResultCache.rubocop_required_features = $LOADED_FEATURES - before_us
|
641
|
+
end
|
642
|
+
RuboCop::AST.rubocop_loaded if RuboCop::AST.respond_to?(:rubocop_loaded)
|