rubocop 1.31.1 → 1.51.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/LICENSE.txt +1 -1
- data/README.md +5 -5
- data/config/default.yml +342 -52
- data/config/obsoletion.yml +23 -1
- data/exe/rubocop +1 -1
- data/lib/rubocop/arguments_env.rb +17 -0
- data/lib/rubocop/arguments_file.rb +17 -0
- data/lib/rubocop/cache_config.rb +29 -0
- data/lib/rubocop/cli/command/{auto_genenerate_config.rb → auto_generate_config.rb} +9 -2
- data/lib/rubocop/cli/command/execute_runner.rb +14 -9
- data/lib/rubocop/cli/command/init_dotfile.rb +1 -1
- data/lib/rubocop/cli/command/suggest_extensions.rb +61 -16
- data/lib/rubocop/cli.rb +56 -9
- data/lib/rubocop/comment_config.rb +60 -1
- data/lib/rubocop/config.rb +48 -20
- data/lib/rubocop/config_finder.rb +68 -0
- data/lib/rubocop/config_loader.rb +46 -68
- data/lib/rubocop/config_loader_resolver.rb +11 -12
- data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +4 -0
- data/lib/rubocop/config_obsoletion.rb +9 -4
- data/lib/rubocop/config_validator.rb +1 -1
- data/lib/rubocop/cop/autocorrect_logic.rb +29 -13
- data/lib/rubocop/cop/badge.rb +9 -4
- data/lib/rubocop/cop/base.rb +115 -83
- data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
- data/lib/rubocop/cop/commissioner.rb +19 -6
- data/lib/rubocop/cop/cop.rb +54 -34
- data/lib/rubocop/cop/corrector.rb +31 -11
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +3 -3
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +3 -3
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +3 -3
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +23 -7
- data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +2 -7
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +58 -0
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +2 -2
- data/lib/rubocop/cop/gemspec/dependency_version.rb +17 -19
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +1 -1
- data/lib/rubocop/cop/gemspec/development_dependencies.rb +107 -0
- data/lib/rubocop/cop/gemspec/require_mfa.rb +1 -1
- data/lib/rubocop/cop/generator/require_file_injector.rb +2 -2
- data/lib/rubocop/cop/generator.rb +5 -2
- data/lib/rubocop/cop/internal_affairs/cop_description.rb +8 -6
- data/lib/rubocop/cop/internal_affairs/create_empty_file.rb +37 -0
- data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +111 -0
- data/lib/rubocop/cop/internal_affairs/inherit_deprecated_cop_class.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/lambda_or_proc.rb +46 -0
- data/lib/rubocop/cop/internal_affairs/location_expression.rb +37 -0
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +3 -3
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
- data/lib/rubocop/cop/internal_affairs/processed_source_buffer_name.rb +42 -0
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +11 -3
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +66 -0
- data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +62 -0
- data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +60 -0
- data/lib/rubocop/cop/internal_affairs.rb +9 -0
- data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +16 -12
- data/lib/rubocop/cop/layout/block_end_newline.rb +31 -9
- data/lib/rubocop/cop/layout/class_structure.rb +37 -27
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +2 -6
- data/lib/rubocop/cop/layout/comment_indentation.rb +3 -1
- data/lib/rubocop/cop/layout/empty_comment.rb +3 -3
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines.rb +3 -1
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +7 -2
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +2 -0
- data/lib/rubocop/cop/layout/end_alignment.rb +9 -1
- data/lib/rubocop/cop/layout/end_of_line.rb +4 -4
- data/lib/rubocop/cop/layout/extra_spacing.rb +15 -6
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +15 -4
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +6 -5
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +35 -8
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +5 -5
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +36 -1
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +57 -8
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +52 -19
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +10 -4
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +8 -11
- data/lib/rubocop/cop/layout/indentation_style.rb +7 -2
- data/lib/rubocop/cop/layout/indentation_width.rb +6 -2
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +80 -12
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +18 -8
- data/lib/rubocop/cop/layout/line_length.rb +8 -1
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +31 -1
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +3 -1
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +29 -1
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +39 -2
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +77 -0
- data/lib/rubocop/cop/layout/redundant_line_break.rb +9 -10
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +3 -3
- data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +2 -0
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +1 -1
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +22 -20
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -0
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +27 -9
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +30 -3
- data/lib/rubocop/cop/layout/space_inside_parens.rb +2 -2
- data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +34 -0
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +10 -6
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +5 -4
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +12 -5
- data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
- data/lib/rubocop/cop/legacy/corrector.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +39 -8
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +4 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +11 -1
- data/lib/rubocop/cop/lint/constant_resolution.rb +5 -1
- data/lib/rubocop/cop/lint/debugger.rb +27 -31
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +66 -110
- data/lib/rubocop/cop/lint/deprecated_constants.rb +8 -1
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_branch.rb +0 -2
- data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +122 -0
- data/lib/rubocop/cop/lint/duplicate_methods.rb +48 -18
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +26 -9
- data/lib/rubocop/cop/lint/duplicate_require.rb +1 -1
- data/lib/rubocop/cop/lint/else_layout.rb +3 -7
- data/lib/rubocop/cop/lint/empty_block.rb +3 -7
- data/lib/rubocop/cop/lint/empty_class.rb +3 -1
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +110 -2
- data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +11 -11
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +14 -7
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +15 -17
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
- data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +5 -2
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
- data/lib/rubocop/cop/lint/interpolation_check.rb +4 -3
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +48 -2
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +18 -3
- data/lib/rubocop/cop/lint/missing_super.rb +31 -2
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -0
- data/lib/rubocop/cop/lint/nested_method_definition.rb +53 -9
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +25 -6
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +68 -28
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +12 -0
- data/lib/rubocop/cop/lint/number_conversion.rb +28 -6
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -2
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -0
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +4 -5
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +17 -2
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +5 -0
- data/lib/rubocop/cop/lint/percent_string_array.rb +1 -1
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +49 -9
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +6 -6
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +7 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +48 -10
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +13 -0
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +35 -15
- data/lib/rubocop/cop/lint/redundant_with_index.rb +14 -11
- data/lib/rubocop/cop/lint/redundant_with_object.rb +13 -12
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +2 -1
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -0
- data/lib/rubocop/cop/lint/require_parentheses.rb +3 -1
- data/lib/rubocop/cop/lint/require_range_parentheses.rb +57 -0
- data/lib/rubocop/cop/lint/rescue_type.rb +3 -3
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +41 -8
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +1 -1
- data/lib/rubocop/cop/lint/script_permission.rb +1 -1
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +5 -4
- data/lib/rubocop/cop/lint/shadowed_exception.rb +16 -11
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +28 -3
- data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/syntax.rb +4 -0
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +13 -3
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +23 -9
- data/lib/rubocop/cop/lint/unreachable_loop.rb +12 -6
- data/lib/rubocop/cop/lint/unused_method_argument.rb +6 -1
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +17 -12
- data/lib/rubocop/cop/lint/useless_assignment.rb +56 -1
- data/lib/rubocop/cop/lint/useless_method_definition.rb +12 -4
- data/lib/rubocop/cop/lint/useless_rescue.rb +89 -0
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +15 -5
- data/lib/rubocop/cop/lint/useless_times.rb +1 -1
- data/lib/rubocop/cop/lint/void.rb +92 -21
- data/lib/rubocop/cop/metrics/abc_size.rb +4 -2
- data/lib/rubocop/cop/metrics/block_length.rb +16 -11
- data/lib/rubocop/cop/metrics/block_nesting.rb +2 -2
- data/lib/rubocop/cop/metrics/class_length.rb +11 -5
- data/lib/rubocop/cop/metrics/collection_literal_length.rb +76 -0
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/method_length.rb +17 -11
- data/lib/rubocop/cop/metrics/module_length.rb +10 -5
- data/lib/rubocop/cop/metrics/parameter_lists.rb +27 -0
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +3 -6
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +9 -6
- data/lib/rubocop/cop/migration/department_name.rb +1 -1
- data/lib/rubocop/cop/mixin/alignment.rb +2 -2
- data/lib/rubocop/cop/mixin/allowed_identifiers.rb +2 -2
- data/lib/rubocop/cop/mixin/allowed_methods.rb +23 -2
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +17 -1
- data/lib/rubocop/cop/mixin/annotation_comment.rb +14 -7
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +5 -1
- data/lib/rubocop/cop/mixin/code_length.rb +1 -1
- data/lib/rubocop/cop/mixin/comments_help.rb +29 -7
- data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +21 -9
- data/lib/rubocop/cop/mixin/def_node.rb +2 -7
- data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +2 -1
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +11 -7
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -0
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +1 -1
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +152 -12
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +13 -9
- data/lib/rubocop/cop/mixin/line_length_help.rb +11 -2
- data/lib/rubocop/cop/mixin/method_complexity.rb +13 -16
- data/lib/rubocop/cop/mixin/min_branches_count.rb +40 -0
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +7 -14
- data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +5 -6
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
- data/lib/rubocop/cop/mixin/percent_array.rb +58 -1
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/range_help.rb +22 -5
- data/lib/rubocop/cop/mixin/require_library.rb +2 -0
- data/lib/rubocop/cop/mixin/rescue_node.rb +5 -3
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +18 -3
- data/lib/rubocop/cop/mixin/surrounding_space.rb +13 -11
- data/lib/rubocop/cop/mixin/trailing_comma.rb +2 -2
- data/lib/rubocop/cop/mixin/visibility_help.rb +40 -5
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +1 -1
- data/lib/rubocop/cop/naming/block_forwarding.rb +5 -1
- data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +3 -1
- data/lib/rubocop/cop/naming/constant_name.rb +3 -3
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
- data/lib/rubocop/cop/naming/inclusive_language.rb +28 -6
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +22 -7
- data/lib/rubocop/cop/naming/method_name.rb +3 -3
- data/lib/rubocop/cop/naming/predicate_name.rb +31 -2
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +12 -4
- data/lib/rubocop/cop/registry.rb +73 -45
- data/lib/rubocop/cop/security/compound_hash.rb +2 -1
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +92 -3
- data/lib/rubocop/cop/style/accessor_grouping.rb +46 -20
- data/lib/rubocop/cop/style/alias.rb +9 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +6 -5
- data/lib/rubocop/cop/style/array_intersect.rb +111 -0
- data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
- data/lib/rubocop/cop/style/attr.rb +11 -1
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +1 -1
- data/lib/rubocop/cop/style/block_comments.rb +2 -2
- data/lib/rubocop/cop/style/block_delimiters.rb +44 -10
- data/lib/rubocop/cop/style/case_equality.rb +40 -10
- data/lib/rubocop/cop/style/case_like_if.rb +20 -3
- data/lib/rubocop/cop/style/character_literal.rb +1 -1
- data/lib/rubocop/cop/style/class_and_module_children.rb +8 -15
- data/lib/rubocop/cop/style/class_equality_comparison.rb +94 -12
- data/lib/rubocop/cop/style/class_methods_definitions.rb +2 -1
- data/lib/rubocop/cop/style/collection_compact.rb +21 -5
- data/lib/rubocop/cop/style/collection_methods.rb +2 -0
- data/lib/rubocop/cop/style/colon_method_call.rb +2 -2
- data/lib/rubocop/cop/style/combinable_loops.rb +29 -7
- data/lib/rubocop/cop/style/command_literal.rb +1 -1
- data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +2 -2
- data/lib/rubocop/cop/style/comparable_clamp.rb +125 -0
- data/lib/rubocop/cop/style/concat_array_literals.rb +94 -0
- data/lib/rubocop/cop/style/conditional_assignment.rb +8 -14
- data/lib/rubocop/cop/style/copyright.rb +6 -3
- data/lib/rubocop/cop/style/data_inheritance.rb +75 -0
- data/lib/rubocop/cop/style/dir_empty.rb +60 -0
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +2 -2
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +2 -2
- data/lib/rubocop/cop/style/documentation.rb +22 -10
- data/lib/rubocop/cop/style/documentation_method.rb +10 -4
- data/lib/rubocop/cop/style/double_negation.rb +4 -2
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +41 -6
- data/lib/rubocop/cop/style/each_with_object.rb +40 -9
- data/lib/rubocop/cop/style/empty_block_parameter.rb +2 -2
- data/lib/rubocop/cop/style/empty_else.rb +37 -0
- data/lib/rubocop/cop/style/empty_heredoc.rb +73 -0
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +2 -2
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/endless_method.rb +1 -1
- data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
- data/lib/rubocop/cop/style/exact_regexp_match.rb +62 -0
- data/lib/rubocop/cop/style/explicit_block_argument.rb +5 -1
- data/lib/rubocop/cop/style/fetch_env_var.rb +10 -177
- data/lib/rubocop/cop/style/file_empty.rb +71 -0
- data/lib/rubocop/cop/style/file_read.rb +1 -1
- data/lib/rubocop/cop/style/file_write.rb +1 -1
- data/lib/rubocop/cop/style/for.rb +2 -0
- data/lib/rubocop/cop/style/format_string_token.rb +25 -6
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
- data/lib/rubocop/cop/style/guard_clause.rb +127 -38
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +1 -0
- data/lib/rubocop/cop/style/hash_each_methods.rb +48 -12
- data/lib/rubocop/cop/style/hash_except.rb +27 -16
- data/lib/rubocop/cop/style/hash_like_case.rb +3 -9
- data/lib/rubocop/cop/style/hash_syntax.rb +26 -2
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +15 -0
- data/lib/rubocop/cop/style/if_inside_else.rb +6 -0
- data/lib/rubocop/cop/style/if_unless_modifier.rb +112 -16
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +29 -2
- data/lib/rubocop/cop/style/if_with_semicolon.rb +4 -4
- data/lib/rubocop/cop/style/infinite_loop.rb +2 -5
- data/lib/rubocop/cop/style/inverse_methods.rb +15 -11
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +118 -0
- data/lib/rubocop/cop/style/line_end_concatenation.rb +4 -1
- data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
- data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +2 -2
- data/lib/rubocop/cop/style/map_to_hash.rb +4 -1
- data/lib/rubocop/cop/style/map_to_set.rb +64 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +40 -24
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +5 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +48 -41
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +21 -2
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +4 -1
- data/lib/rubocop/cop/style/method_def_parentheses.rb +11 -4
- data/lib/rubocop/cop/style/min_max.rb +3 -3
- data/lib/rubocop/cop/style/min_max_comparison.rb +83 -0
- data/lib/rubocop/cop/style/missing_else.rb +13 -1
- data/lib/rubocop/cop/style/mixin_grouping.rb +4 -4
- data/lib/rubocop/cop/style/module_function.rb +30 -8
- data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -1
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +0 -4
- data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +1 -1
- data/lib/rubocop/cop/style/multiline_memoization.rb +2 -2
- data/lib/rubocop/cop/style/multiline_method_signature.rb +7 -4
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +18 -3
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +17 -10
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +9 -0
- data/lib/rubocop/cop/style/next.rb +3 -5
- data/lib/rubocop/cop/style/nil_lambda.rb +4 -4
- data/lib/rubocop/cop/style/numbered_parameters_limit.rb +11 -3
- data/lib/rubocop/cop/style/numeric_literals.rb +16 -1
- data/lib/rubocop/cop/style/numeric_predicate.rb +43 -9
- data/lib/rubocop/cop/style/object_then.rb +5 -0
- data/lib/rubocop/cop/style/one_line_conditional.rb +3 -6
- data/lib/rubocop/cop/style/operator_method_call.rb +67 -0
- data/lib/rubocop/cop/style/parallel_assignment.rb +29 -19
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +2 -3
- data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
- data/lib/rubocop/cop/style/perl_backrefs.rb +22 -1
- data/lib/rubocop/cop/style/proc.rb +4 -1
- data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
- data/lib/rubocop/cop/style/redundant_argument.rb +3 -0
- data/lib/rubocop/cop/style/redundant_begin.rb +3 -0
- data/lib/rubocop/cop/style/redundant_condition.rb +41 -8
- data/lib/rubocop/cop/style/redundant_conditional.rb +0 -4
- data/lib/rubocop/cop/style/redundant_constant_base.rb +85 -0
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +45 -0
- data/lib/rubocop/cop/style/redundant_each.rb +116 -0
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +7 -5
- data/lib/rubocop/cop/style/redundant_heredoc_delimiter_quotes.rb +58 -0
- data/lib/rubocop/cop/style/redundant_initialize.rb +3 -1
- data/lib/rubocop/cop/style/redundant_interpolation.rb +2 -2
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +183 -0
- data/lib/rubocop/cop/style/redundant_parentheses.rb +22 -24
- data/lib/rubocop/cop/style/redundant_percent_q.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +9 -3
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +21 -4
- data/lib/rubocop/cop/style/redundant_return.rb +7 -0
- data/lib/rubocop/cop/style/redundant_self.rb +2 -0
- data/lib/rubocop/cop/style/redundant_sort.rb +24 -9
- data/lib/rubocop/cop/style/redundant_sort_by.rb +24 -8
- data/lib/rubocop/cop/style/redundant_string_escape.rb +183 -0
- data/lib/rubocop/cop/style/regexp_literal.rb +11 -2
- data/lib/rubocop/cop/style/require_order.rb +138 -0
- data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
- data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +41 -10
- data/lib/rubocop/cop/style/select_by_regexp.rb +13 -5
- data/lib/rubocop/cop/style/self_assignment.rb +2 -2
- data/lib/rubocop/cop/style/semicolon.rb +63 -5
- data/lib/rubocop/cop/style/signal_exception.rb +8 -6
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/slicing_with_range.rb +1 -1
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +17 -8
- data/lib/rubocop/cop/style/special_global_vars.rb +2 -2
- data/lib/rubocop/cop/style/static_class.rb +32 -1
- data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
- data/lib/rubocop/cop/style/string_hash_keys.rb +4 -1
- data/lib/rubocop/cop/style/string_literals.rb +1 -5
- data/lib/rubocop/cop/style/struct_inheritance.rb +1 -1
- data/lib/rubocop/cop/style/symbol_array.rb +6 -5
- data/lib/rubocop/cop/style/symbol_proc.rb +42 -10
- data/lib/rubocop/cop/style/ternary_parentheses.rb +1 -13
- data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +1 -0
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +4 -4
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -1
- data/lib/rubocop/cop/style/trivial_accessors.rb +4 -1
- data/lib/rubocop/cop/style/unless_logical_operators.rb +1 -0
- data/lib/rubocop/cop/style/unpack_first.rb +3 -3
- data/lib/rubocop/cop/style/word_array.rb +59 -5
- data/lib/rubocop/cop/style/yoda_condition.rb +13 -6
- data/lib/rubocop/cop/style/yoda_expression.rb +90 -0
- data/lib/rubocop/cop/style/zero_length_predicate.rb +40 -19
- data/lib/rubocop/cop/team.rb +63 -56
- data/lib/rubocop/cop/util.rb +44 -8
- data/lib/rubocop/cop/variable_force/assignment.rb +5 -1
- data/lib/rubocop/cop/variable_force/scope.rb +3 -3
- data/lib/rubocop/cop/variable_force/variable.rb +5 -3
- data/lib/rubocop/cop/variable_force/variable_table.rb +6 -4
- data/lib/rubocop/cop/variable_force.rb +18 -30
- data/lib/rubocop/cops_documentation_generator.rb +45 -15
- data/lib/rubocop/directive_comment.rb +4 -4
- data/lib/rubocop/ext/comment.rb +18 -0
- data/lib/rubocop/ext/processed_source.rb +2 -0
- data/lib/rubocop/ext/range.rb +15 -0
- data/lib/rubocop/ext/regexp_node.rb +1 -1
- data/lib/rubocop/ext/regexp_parser.rb +1 -1
- data/lib/rubocop/feature_loader.rb +94 -0
- data/lib/rubocop/file_patterns.rb +43 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +26 -9
- data/lib/rubocop/formatter/html_formatter.rb +4 -4
- data/lib/rubocop/formatter/junit_formatter.rb +4 -1
- data/lib/rubocop/formatter/markdown_formatter.rb +1 -1
- data/lib/rubocop/formatter/offense_count_formatter.rb +8 -5
- data/lib/rubocop/formatter/simple_text_formatter.rb +1 -1
- data/lib/rubocop/formatter/tap_formatter.rb +1 -1
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +6 -3
- data/lib/rubocop/formatter.rb +4 -1
- data/lib/rubocop/options.rb +55 -22
- data/lib/rubocop/path_util.rb +50 -22
- data/lib/rubocop/rake_task.rb +5 -1
- data/lib/rubocop/result_cache.rb +26 -24
- data/lib/rubocop/rspec/cop_helper.rb +26 -3
- data/lib/rubocop/rspec/expect_offense.rb +6 -4
- data/lib/rubocop/rspec/shared_contexts.rb +31 -14
- data/lib/rubocop/rspec/support.rb +17 -2
- data/lib/rubocop/runner.rb +73 -18
- data/lib/rubocop/server/cache.rb +48 -2
- data/lib/rubocop/server/cli.rb +62 -19
- data/lib/rubocop/server/client_command/base.rb +1 -1
- data/lib/rubocop/server/client_command/exec.rb +6 -1
- data/lib/rubocop/server/client_command/start.rb +6 -1
- data/lib/rubocop/server/core.rb +42 -10
- data/lib/rubocop/server/helper.rb +1 -1
- data/lib/rubocop/server/server_command/exec.rb +1 -1
- data/lib/rubocop/server/socket_reader.rb +5 -1
- data/lib/rubocop/server.rb +1 -1
- data/lib/rubocop/target_finder.rb +1 -1
- data/lib/rubocop/target_ruby.rb +5 -5
- data/lib/rubocop/version.rb +10 -4
- data/lib/rubocop.rb +45 -9
- metadata +58 -33
- data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
data/config/default.yml
CHANGED
@@ -140,7 +140,7 @@ AllCops:
|
|
140
140
|
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
141
141
|
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
142
142
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
143
|
-
# supported Ruby version (currently Ruby 2.
|
143
|
+
# supported Ruby version (currently Ruby 2.7).
|
144
144
|
TargetRubyVersion: ~
|
145
145
|
# Determines if a notification for extension libraries should be shown when
|
146
146
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
@@ -153,6 +153,8 @@ AllCops:
|
|
153
153
|
rubocop-sequel: [sequel]
|
154
154
|
rubocop-rake: [rake]
|
155
155
|
rubocop-graphql: [graphql]
|
156
|
+
rubocop-capybara: [capybara]
|
157
|
+
rubocop-factory_bot: [factory_bot, factory_bot_rails]
|
156
158
|
# Enable/Disable checking the methods extended by Active Support.
|
157
159
|
ActiveSupportExtensionsEnabled: false
|
158
160
|
|
@@ -161,7 +163,9 @@ AllCops:
|
|
161
163
|
Bundler/DuplicatedGem:
|
162
164
|
Description: 'Checks for duplicate gem entries in Gemfile.'
|
163
165
|
Enabled: true
|
166
|
+
Severity: warning
|
164
167
|
VersionAdded: '0.46'
|
168
|
+
VersionChanged: '1.40'
|
165
169
|
Include:
|
166
170
|
- '**/*.gemfile'
|
167
171
|
- '**/Gemfile'
|
@@ -213,7 +217,9 @@ Bundler/InsecureProtocolSource:
|
|
213
217
|
because HTTP requests are insecure. Please change your source to
|
214
218
|
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
|
215
219
|
Enabled: true
|
220
|
+
Severity: warning
|
216
221
|
VersionAdded: '0.50'
|
222
|
+
VersionChanged: '1.40'
|
217
223
|
AllowHttpProtocol: true
|
218
224
|
Include:
|
219
225
|
- '**/*.gemfile'
|
@@ -252,14 +258,33 @@ Gemspec/DependencyVersion:
|
|
252
258
|
Gemspec/DeprecatedAttributeAssignment:
|
253
259
|
Description: Checks that deprecated attribute assignments are not set in a gemspec file.
|
254
260
|
Enabled: pending
|
261
|
+
Severity: warning
|
255
262
|
VersionAdded: '1.30'
|
263
|
+
VersionChanged: '1.40'
|
264
|
+
Include:
|
265
|
+
- '**/*.gemspec'
|
266
|
+
|
267
|
+
Gemspec/DevelopmentDependencies:
|
268
|
+
Description: Checks that development dependencies are specified in Gemfile rather than gemspec.
|
269
|
+
Enabled: pending
|
270
|
+
VersionAdded: '1.44'
|
271
|
+
EnforcedStyle: Gemfile
|
272
|
+
SupportedStyles:
|
273
|
+
- Gemfile
|
274
|
+
- gems.rb
|
275
|
+
- gemspec
|
276
|
+
AllowedGems: []
|
256
277
|
Include:
|
257
278
|
- '**/*.gemspec'
|
279
|
+
- '**/Gemfile'
|
280
|
+
- '**/gems.rb'
|
258
281
|
|
259
282
|
Gemspec/DuplicatedAssignment:
|
260
283
|
Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
|
261
284
|
Enabled: true
|
285
|
+
Severity: warning
|
262
286
|
VersionAdded: '0.52'
|
287
|
+
VersionChanged: '1.40'
|
263
288
|
Include:
|
264
289
|
- '**/*.gemspec'
|
265
290
|
|
@@ -278,7 +303,9 @@ Gemspec/OrderedDependencies:
|
|
278
303
|
Gemspec/RequireMFA:
|
279
304
|
Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
|
280
305
|
Enabled: pending
|
306
|
+
Severity: warning
|
281
307
|
VersionAdded: '1.23'
|
308
|
+
VersionChanged: '1.40'
|
282
309
|
Reference:
|
283
310
|
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
284
311
|
Include:
|
@@ -287,8 +314,9 @@ Gemspec/RequireMFA:
|
|
287
314
|
Gemspec/RequiredRubyVersion:
|
288
315
|
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
289
316
|
Enabled: true
|
317
|
+
Severity: warning
|
290
318
|
VersionAdded: '0.52'
|
291
|
-
VersionChanged: '1.
|
319
|
+
VersionChanged: '1.40'
|
292
320
|
Include:
|
293
321
|
- '**/*.gemspec'
|
294
322
|
|
@@ -296,7 +324,9 @@ Gemspec/RubyVersionGlobalsUsage:
|
|
296
324
|
Description: Checks usage of RUBY_VERSION in gemspec.
|
297
325
|
StyleGuide: '#no-ruby-version-in-the-gemspec'
|
298
326
|
Enabled: true
|
327
|
+
Severity: warning
|
299
328
|
VersionAdded: '0.72'
|
329
|
+
VersionChanged: '1.40'
|
300
330
|
Include:
|
301
331
|
- '**/*.gemspec'
|
302
332
|
|
@@ -379,7 +409,7 @@ Layout/AssignmentIndentation:
|
|
379
409
|
right-hand-side of a multi-line assignment.
|
380
410
|
Enabled: true
|
381
411
|
VersionAdded: '0.49'
|
382
|
-
VersionChanged: '
|
412
|
+
VersionChanged: '1.45'
|
383
413
|
# By default the indentation width from `Layout/IndentationWidth` is used,
|
384
414
|
# but it can be overridden by setting this parameter.
|
385
415
|
IndentationWidth: ~
|
@@ -748,6 +778,7 @@ Layout/FirstArrayElementLineBreak:
|
|
748
778
|
multi-line array.
|
749
779
|
Enabled: false
|
750
780
|
VersionAdded: '0.49'
|
781
|
+
AllowMultilineFinalElement: false
|
751
782
|
|
752
783
|
Layout/FirstHashElementIndentation:
|
753
784
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
@@ -780,6 +811,7 @@ Layout/FirstHashElementLineBreak:
|
|
780
811
|
multi-line hash.
|
781
812
|
Enabled: false
|
782
813
|
VersionAdded: '0.49'
|
814
|
+
AllowMultilineFinalElement: false
|
783
815
|
|
784
816
|
Layout/FirstMethodArgumentLineBreak:
|
785
817
|
Description: >-
|
@@ -787,6 +819,7 @@ Layout/FirstMethodArgumentLineBreak:
|
|
787
819
|
multi-line method call.
|
788
820
|
Enabled: false
|
789
821
|
VersionAdded: '0.49'
|
822
|
+
AllowMultilineFinalElement: false
|
790
823
|
|
791
824
|
Layout/FirstMethodParameterLineBreak:
|
792
825
|
Description: >-
|
@@ -794,6 +827,7 @@ Layout/FirstMethodParameterLineBreak:
|
|
794
827
|
multi-line method parameter definition.
|
795
828
|
Enabled: false
|
796
829
|
VersionAdded: '0.49'
|
830
|
+
AllowMultilineFinalElement: false
|
797
831
|
|
798
832
|
Layout/FirstParameterIndentation:
|
799
833
|
Description: >-
|
@@ -946,7 +980,6 @@ Layout/IndentationWidth:
|
|
946
980
|
# Number of spaces for each indentation level.
|
947
981
|
Width: 2
|
948
982
|
AllowedPatterns: []
|
949
|
-
IgnoredPatterns: [] # deprecated
|
950
983
|
|
951
984
|
Layout/InitialIndentation:
|
952
985
|
Description: >-
|
@@ -974,15 +1007,16 @@ Layout/LineContinuationLeadingSpace:
|
|
974
1007
|
Use trailing spaces instead of leading spaces in strings
|
975
1008
|
broken over multiple lines (by a backslash).
|
976
1009
|
Enabled: pending
|
977
|
-
AutoCorrect: false
|
978
|
-
SafeAutoCorrect: false
|
979
1010
|
VersionAdded: '1.31'
|
1011
|
+
VersionChanged: '1.45'
|
1012
|
+
EnforcedStyle: trailing
|
1013
|
+
SupportedStyles:
|
1014
|
+
- leading
|
1015
|
+
- trailing
|
980
1016
|
|
981
1017
|
Layout/LineContinuationSpacing:
|
982
1018
|
Description: 'Checks the spacing in front of backslash in line continuations.'
|
983
1019
|
Enabled: pending
|
984
|
-
AutoCorrect: true
|
985
|
-
SafeAutoCorrect: true
|
986
1020
|
VersionAdded: '1.31'
|
987
1021
|
EnforcedStyle: space
|
988
1022
|
SupportedStyles:
|
@@ -1024,7 +1058,6 @@ Layout/LineLength:
|
|
1024
1058
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
1025
1059
|
# any regular expression listed in this option will be ignored by LineLength.
|
1026
1060
|
AllowedPatterns: []
|
1027
|
-
IgnoredPatterns: [] # deprecated
|
1028
1061
|
|
1029
1062
|
Layout/MultilineArrayBraceLayout:
|
1030
1063
|
Description: >-
|
@@ -1048,6 +1081,7 @@ Layout/MultilineArrayLineBreaks:
|
|
1048
1081
|
starts on a separate line.
|
1049
1082
|
Enabled: false
|
1050
1083
|
VersionAdded: '0.67'
|
1084
|
+
AllowMultilineFinalElement: false
|
1051
1085
|
|
1052
1086
|
Layout/MultilineAssignmentLayout:
|
1053
1087
|
Description: 'Check for a newline after the assignment operator in multi-line assignments.'
|
@@ -1098,6 +1132,7 @@ Layout/MultilineHashKeyLineBreaks:
|
|
1098
1132
|
starts on a separate line.
|
1099
1133
|
Enabled: false
|
1100
1134
|
VersionAdded: '0.67'
|
1135
|
+
AllowMultilineFinalElement: false
|
1101
1136
|
|
1102
1137
|
Layout/MultilineMethodArgumentLineBreaks:
|
1103
1138
|
Description: >-
|
@@ -1105,6 +1140,7 @@ Layout/MultilineMethodArgumentLineBreaks:
|
|
1105
1140
|
starts on a separate line.
|
1106
1141
|
Enabled: false
|
1107
1142
|
VersionAdded: '0.67'
|
1143
|
+
AllowMultilineFinalElement: false
|
1108
1144
|
|
1109
1145
|
Layout/MultilineMethodCallBraceLayout:
|
1110
1146
|
Description: >-
|
@@ -1153,6 +1189,14 @@ Layout/MultilineMethodDefinitionBraceLayout:
|
|
1153
1189
|
- new_line
|
1154
1190
|
- same_line
|
1155
1191
|
|
1192
|
+
Layout/MultilineMethodParameterLineBreaks:
|
1193
|
+
Description: >-
|
1194
|
+
Checks that each parameter in a multi-line method definition
|
1195
|
+
starts on a separate line.
|
1196
|
+
Enabled: false
|
1197
|
+
VersionAdded: '1.32'
|
1198
|
+
AllowMultilineFinalElement: false
|
1199
|
+
|
1156
1200
|
Layout/MultilineOperationIndentation:
|
1157
1201
|
Description: >-
|
1158
1202
|
Checks indentation of binary operations that span more than
|
@@ -1490,7 +1534,8 @@ Lint/AmbiguousBlockAssociation:
|
|
1490
1534
|
Enabled: true
|
1491
1535
|
VersionAdded: '0.48'
|
1492
1536
|
VersionChanged: '1.13'
|
1493
|
-
|
1537
|
+
AllowedMethods: []
|
1538
|
+
AllowedPatterns: []
|
1494
1539
|
|
1495
1540
|
Lint/AmbiguousOperator:
|
1496
1541
|
Description: >-
|
@@ -1527,7 +1572,9 @@ Lint/AssignmentInCondition:
|
|
1527
1572
|
Description: "Don't use assignment in conditions."
|
1528
1573
|
StyleGuide: '#safe-assignment-in-condition'
|
1529
1574
|
Enabled: true
|
1575
|
+
SafeAutoCorrect: false
|
1530
1576
|
VersionAdded: '0.9'
|
1577
|
+
VersionChanged: '1.45'
|
1531
1578
|
AllowSafeAssignment: true
|
1532
1579
|
|
1533
1580
|
Lint/BigDecimalNew:
|
@@ -1583,13 +1630,13 @@ Lint/Debugger:
|
|
1583
1630
|
Description: 'Check for debugger calls.'
|
1584
1631
|
Enabled: true
|
1585
1632
|
VersionAdded: '0.14'
|
1586
|
-
VersionChanged: '1.
|
1587
|
-
DebuggerReceivers: [] # deprecated
|
1633
|
+
VersionChanged: '1.46'
|
1588
1634
|
DebuggerMethods:
|
1589
1635
|
# Groups are available so that a specific group can be disabled in
|
1590
1636
|
# a user's configuration, but are otherwise not significant.
|
1591
1637
|
Kernel:
|
1592
1638
|
- binding.irb
|
1639
|
+
- Kernel.binding.irb
|
1593
1640
|
Byebug:
|
1594
1641
|
- byebug
|
1595
1642
|
- remote_byebug
|
@@ -1607,7 +1654,11 @@ Lint/Debugger:
|
|
1607
1654
|
- binding.pry
|
1608
1655
|
- binding.remote_pry
|
1609
1656
|
- binding.pry_remote
|
1657
|
+
- Kernel.binding.pry
|
1658
|
+
- Kernel.binding.remote_pry
|
1659
|
+
- Kernel.binding.pry_remote
|
1610
1660
|
- Pry.rescue
|
1661
|
+
- pry
|
1611
1662
|
Rails:
|
1612
1663
|
- debugger
|
1613
1664
|
- Kernel.debugger
|
@@ -1625,7 +1676,7 @@ Lint/DeprecatedConstants:
|
|
1625
1676
|
Description: 'Checks for deprecated constants.'
|
1626
1677
|
Enabled: pending
|
1627
1678
|
VersionAdded: '1.8'
|
1628
|
-
VersionChanged: '1.
|
1679
|
+
VersionChanged: '1.40'
|
1629
1680
|
# You can configure deprecated constants.
|
1630
1681
|
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1631
1682
|
# And you can set the deprecated version as `DeprecatedVersion`.
|
@@ -1652,6 +1703,12 @@ Lint/DeprecatedConstants:
|
|
1652
1703
|
'Random::DEFAULT':
|
1653
1704
|
Alternative: 'Random.new'
|
1654
1705
|
DeprecatedVersion: '3.0'
|
1706
|
+
'Struct::Group':
|
1707
|
+
Alternative: 'Etc::Group'
|
1708
|
+
DeprecatedVersion: '3.0'
|
1709
|
+
'Struct::Passwd':
|
1710
|
+
Alternative: 'Etc::Passwd'
|
1711
|
+
DeprecatedVersion: '3.0'
|
1655
1712
|
|
1656
1713
|
Lint/DeprecatedOpenSSLConstant:
|
1657
1714
|
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
@@ -1689,6 +1746,16 @@ Lint/DuplicateHashKey:
|
|
1689
1746
|
VersionAdded: '0.34'
|
1690
1747
|
VersionChanged: '0.77'
|
1691
1748
|
|
1749
|
+
Lint/DuplicateMagicComment:
|
1750
|
+
Description: 'Check for duplicated magic comments.'
|
1751
|
+
Enabled: pending
|
1752
|
+
VersionAdded: '1.37'
|
1753
|
+
|
1754
|
+
Lint/DuplicateMatchPattern:
|
1755
|
+
Description: 'Do not repeat patterns in `in` keywords.'
|
1756
|
+
Enabled: pending
|
1757
|
+
VersionAdded: '1.50'
|
1758
|
+
|
1692
1759
|
Lint/DuplicateMethods:
|
1693
1760
|
Description: 'Check for duplicate method definitions.'
|
1694
1761
|
Enabled: true
|
@@ -1739,8 +1806,10 @@ Lint/EmptyClass:
|
|
1739
1806
|
Lint/EmptyConditionalBody:
|
1740
1807
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1741
1808
|
Enabled: true
|
1809
|
+
SafeAutoCorrect: false
|
1742
1810
|
AllowComments: true
|
1743
1811
|
VersionAdded: '0.89'
|
1812
|
+
VersionChanged: '1.34'
|
1744
1813
|
|
1745
1814
|
Lint/EmptyEnsure:
|
1746
1815
|
Description: 'Checks for empty ensure block.'
|
@@ -1869,11 +1938,11 @@ Lint/InheritException:
|
|
1869
1938
|
- runtime_error
|
1870
1939
|
|
1871
1940
|
Lint/InterpolationCheck:
|
1872
|
-
Description: '
|
1941
|
+
Description: 'Checks for interpolation in a single quoted string.'
|
1873
1942
|
Enabled: true
|
1874
|
-
|
1943
|
+
SafeAutoCorrect: false
|
1875
1944
|
VersionAdded: '0.50'
|
1876
|
-
VersionChanged: '
|
1945
|
+
VersionChanged: '1.40'
|
1877
1946
|
|
1878
1947
|
Lint/LambdaWithoutLiteralBlock:
|
1879
1948
|
Description: 'Checks uses of lambda without a literal block.'
|
@@ -1937,6 +2006,8 @@ Lint/NestedMethodDefinition:
|
|
1937
2006
|
Description: 'Do not use nested method definitions.'
|
1938
2007
|
StyleGuide: '#no-nested-methods'
|
1939
2008
|
Enabled: true
|
2009
|
+
AllowedMethods: []
|
2010
|
+
AllowedPatterns: []
|
1940
2011
|
VersionAdded: '0.32'
|
1941
2012
|
|
1942
2013
|
Lint/NestedPercentLiteral:
|
@@ -1958,6 +2029,7 @@ Lint/NoReturnInBeginEndBlocks:
|
|
1958
2029
|
|
1959
2030
|
Lint/NonAtomicFileOperation:
|
1960
2031
|
Description: Checks for non-atomic file operations.
|
2032
|
+
StyleGuide: '#atomic-file-operations'
|
1961
2033
|
Enabled: pending
|
1962
2034
|
VersionAdded: '1.31'
|
1963
2035
|
SafeAutoCorrect: false
|
@@ -1979,7 +2051,8 @@ Lint/NumberConversion:
|
|
1979
2051
|
VersionAdded: '0.53'
|
1980
2052
|
VersionChanged: '1.1'
|
1981
2053
|
SafeAutoCorrect: false
|
1982
|
-
|
2054
|
+
AllowedMethods: []
|
2055
|
+
AllowedPatterns: []
|
1983
2056
|
IgnoredClasses:
|
1984
2057
|
- Time
|
1985
2058
|
- DateTime
|
@@ -1998,7 +2071,9 @@ Lint/OrAssignmentToConstant:
|
|
1998
2071
|
Lint/OrderedMagicComments:
|
1999
2072
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
2000
2073
|
Enabled: true
|
2074
|
+
SafeAutoCorrect: false
|
2001
2075
|
VersionAdded: '0.53'
|
2076
|
+
VersionChanged: '1.37'
|
2002
2077
|
|
2003
2078
|
Lint/OutOfRangeRegexpRef:
|
2004
2079
|
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
@@ -2128,6 +2203,11 @@ Lint/RequireParentheses:
|
|
2128
2203
|
Enabled: true
|
2129
2204
|
VersionAdded: '0.18'
|
2130
2205
|
|
2206
|
+
Lint/RequireRangeParentheses:
|
2207
|
+
Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
|
2208
|
+
Enabled: pending
|
2209
|
+
VersionAdded: '1.32'
|
2210
|
+
|
2131
2211
|
Lint/RequireRelativeSelfPath:
|
2132
2212
|
Description: 'Checks for uses a file requiring itself with `require_relative`.'
|
2133
2213
|
Enabled: pending
|
@@ -2264,6 +2344,9 @@ Lint/TopLevelReturnWithArgument:
|
|
2264
2344
|
Description: 'Detects top level return statements with argument.'
|
2265
2345
|
Enabled: true
|
2266
2346
|
VersionAdded: '0.89'
|
2347
|
+
# These codes are `eval`-ed in method and their return values may be used.
|
2348
|
+
Exclude:
|
2349
|
+
- '**/*.jb'
|
2267
2350
|
|
2268
2351
|
Lint/TrailingCommaInAttributeDeclaration:
|
2269
2352
|
Description: 'Checks for trailing commas in attribute declarations.'
|
@@ -2323,7 +2406,6 @@ Lint/UnreachableLoop:
|
|
2323
2406
|
# RSpec uses `times` in its message expectations
|
2324
2407
|
# eg. `exactly(2).times`
|
2325
2408
|
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2326
|
-
IgnoredPatterns: [] # deprecated
|
2327
2409
|
|
2328
2410
|
Lint/UnusedBlockArgument:
|
2329
2411
|
Description: 'Checks for unused block arguments.'
|
@@ -2373,6 +2455,8 @@ Lint/UselessAssignment:
|
|
2373
2455
|
StyleGuide: '#underscore-unused-vars'
|
2374
2456
|
Enabled: true
|
2375
2457
|
VersionAdded: '0.11'
|
2458
|
+
VersionChanged: '1.51'
|
2459
|
+
SafeAutoCorrect: false
|
2376
2460
|
|
2377
2461
|
Lint/UselessElseWithoutRescue:
|
2378
2462
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
@@ -2387,6 +2471,11 @@ Lint/UselessMethodDefinition:
|
|
2387
2471
|
VersionChanged: '0.91'
|
2388
2472
|
Safe: false
|
2389
2473
|
|
2474
|
+
Lint/UselessRescue:
|
2475
|
+
Description: 'Checks for useless `rescue`s.'
|
2476
|
+
Enabled: pending
|
2477
|
+
VersionAdded: '1.43'
|
2478
|
+
|
2390
2479
|
Lint/UselessRuby2Keywords:
|
2391
2480
|
Description: 'Finds unnecessary uses of `ruby2_keywords`.'
|
2392
2481
|
Enabled: pending
|
@@ -2426,7 +2515,8 @@ Metrics/AbcSize:
|
|
2426
2515
|
VersionChanged: '1.5'
|
2427
2516
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
2428
2517
|
# a Float.
|
2429
|
-
|
2518
|
+
AllowedMethods: []
|
2519
|
+
AllowedPatterns: []
|
2430
2520
|
CountRepeatedAttributes: true
|
2431
2521
|
Max: 17
|
2432
2522
|
|
@@ -2438,11 +2528,11 @@ Metrics/BlockLength:
|
|
2438
2528
|
CountComments: false # count full line comments?
|
2439
2529
|
Max: 25
|
2440
2530
|
CountAsOne: []
|
2441
|
-
|
2442
|
-
IgnoredMethods:
|
2531
|
+
AllowedMethods:
|
2443
2532
|
# By default, exclude the `#refine` method, as it tends to have larger
|
2444
2533
|
# associated blocks.
|
2445
2534
|
- refine
|
2535
|
+
AllowedPatterns: []
|
2446
2536
|
Exclude:
|
2447
2537
|
- '**/*.gemspec'
|
2448
2538
|
|
@@ -2464,6 +2554,12 @@ Metrics/ClassLength:
|
|
2464
2554
|
Max: 100
|
2465
2555
|
CountAsOne: []
|
2466
2556
|
|
2557
|
+
Metrics/CollectionLiteralLength:
|
2558
|
+
Description: 'Checks for `Array` or `Hash` literals with many entries.'
|
2559
|
+
Enabled: pending
|
2560
|
+
VersionAdded: '1.47'
|
2561
|
+
LengthThreshold: 250
|
2562
|
+
|
2467
2563
|
# Avoid complex methods.
|
2468
2564
|
Metrics/CyclomaticComplexity:
|
2469
2565
|
Description: >-
|
@@ -2472,7 +2568,8 @@ Metrics/CyclomaticComplexity:
|
|
2472
2568
|
Enabled: true
|
2473
2569
|
VersionAdded: '0.25'
|
2474
2570
|
VersionChanged: '0.81'
|
2475
|
-
|
2571
|
+
AllowedMethods: []
|
2572
|
+
AllowedPatterns: []
|
2476
2573
|
Max: 7
|
2477
2574
|
|
2478
2575
|
Metrics/MethodLength:
|
@@ -2484,8 +2581,8 @@ Metrics/MethodLength:
|
|
2484
2581
|
CountComments: false # count full line comments?
|
2485
2582
|
Max: 10
|
2486
2583
|
CountAsOne: []
|
2487
|
-
|
2488
|
-
|
2584
|
+
AllowedMethods: []
|
2585
|
+
AllowedPatterns: []
|
2489
2586
|
|
2490
2587
|
Metrics/ModuleLength:
|
2491
2588
|
Description: 'Avoid modules longer than 100 lines of code.'
|
@@ -2513,7 +2610,8 @@ Metrics/PerceivedComplexity:
|
|
2513
2610
|
Enabled: true
|
2514
2611
|
VersionAdded: '0.25'
|
2515
2612
|
VersionChanged: '0.81'
|
2516
|
-
|
2613
|
+
AllowedMethods: []
|
2614
|
+
AllowedPatterns: []
|
2517
2615
|
Max: 8
|
2518
2616
|
|
2519
2617
|
################## Migration #############################
|
@@ -2684,13 +2782,13 @@ Naming/HeredocDelimiterNaming:
|
|
2684
2782
|
Enabled: true
|
2685
2783
|
VersionAdded: '0.50'
|
2686
2784
|
ForbiddenDelimiters:
|
2687
|
-
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
|
2785
|
+
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/i'
|
2688
2786
|
|
2689
2787
|
Naming/InclusiveLanguage:
|
2690
2788
|
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
2691
2789
|
Enabled: false
|
2692
2790
|
VersionAdded: '1.18'
|
2693
|
-
VersionChanged: '1.
|
2791
|
+
VersionChanged: '1.49'
|
2694
2792
|
CheckIdentifiers: true
|
2695
2793
|
CheckConstants: true
|
2696
2794
|
CheckVariables: true
|
@@ -2742,7 +2840,6 @@ Naming/MethodName:
|
|
2742
2840
|
# - '\A\s*onSelectionCleared\s*'
|
2743
2841
|
#
|
2744
2842
|
AllowedPatterns: []
|
2745
|
-
IgnoredPatterns: [] # deprecated
|
2746
2843
|
|
2747
2844
|
Naming/MethodParameterName:
|
2748
2845
|
Description: >-
|
@@ -2756,10 +2853,13 @@ Naming/MethodParameterName:
|
|
2756
2853
|
AllowNamesEndingInNumbers: true
|
2757
2854
|
# Allowed names that will not register an offense
|
2758
2855
|
AllowedNames:
|
2856
|
+
- as
|
2759
2857
|
- at
|
2760
2858
|
- by
|
2859
|
+
- cc
|
2761
2860
|
- db
|
2762
2861
|
- id
|
2862
|
+
- if
|
2763
2863
|
- in
|
2764
2864
|
- io
|
2765
2865
|
- ip
|
@@ -2840,6 +2940,7 @@ Naming/VariableNumber:
|
|
2840
2940
|
- rfc822 # Time#rfc822
|
2841
2941
|
- rfc2822 # Time#rfc2822
|
2842
2942
|
- rfc3339 # DateTime.rfc3339
|
2943
|
+
- x86_64 # Allowed by default as an underscore separated CPU architecture name
|
2843
2944
|
AllowedPatterns: []
|
2844
2945
|
|
2845
2946
|
#################### Security ##############################
|
@@ -2847,7 +2948,9 @@ Naming/VariableNumber:
|
|
2847
2948
|
Security/CompoundHash:
|
2848
2949
|
Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
|
2849
2950
|
Enabled: pending
|
2951
|
+
Safe: false
|
2850
2952
|
VersionAdded: '1.28'
|
2953
|
+
VersionChanged: '1.51'
|
2851
2954
|
|
2852
2955
|
Security/Eval:
|
2853
2956
|
Description: 'The use of eval represents a serious security risk.'
|
@@ -2910,6 +3013,7 @@ Style/AccessModifierDeclarations:
|
|
2910
3013
|
- inline
|
2911
3014
|
- group
|
2912
3015
|
AllowModifiersOnSymbols: true
|
3016
|
+
SafeAutoCorrect: false
|
2913
3017
|
|
2914
3018
|
Style/AccessorGrouping:
|
2915
3019
|
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
@@ -2963,6 +3067,12 @@ Style/ArrayCoercion:
|
|
2963
3067
|
Enabled: false
|
2964
3068
|
VersionAdded: '0.88'
|
2965
3069
|
|
3070
|
+
Style/ArrayIntersect:
|
3071
|
+
Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
|
3072
|
+
Enabled: 'pending'
|
3073
|
+
Safe: false
|
3074
|
+
VersionAdded: '1.40'
|
3075
|
+
|
2966
3076
|
Style/ArrayJoin:
|
2967
3077
|
Description: 'Use Array#join instead of Array#*.'
|
2968
3078
|
StyleGuide: '#array-join'
|
@@ -3044,7 +3154,7 @@ Style/BlockDelimiters:
|
|
3044
3154
|
# This looks at the usage of a block's method to determine its type (e.g. is
|
3045
3155
|
# the result of a `map` assigned to a variable or passed to another
|
3046
3156
|
# method) but exceptions are permitted in the `ProceduralMethods`,
|
3047
|
-
# `FunctionalMethods` and `
|
3157
|
+
# `FunctionalMethods` and `AllowedMethods` sections below.
|
3048
3158
|
- semantic
|
3049
3159
|
# The `braces_for_chaining` style enforces braces around single line blocks
|
3050
3160
|
# and do..end around multi-line blocks, except for multi-line blocks whose
|
@@ -3085,7 +3195,7 @@ Style/BlockDelimiters:
|
|
3085
3195
|
- let!
|
3086
3196
|
- subject
|
3087
3197
|
- watch
|
3088
|
-
|
3198
|
+
AllowedMethods:
|
3089
3199
|
# Methods that can be either procedural or functional and cannot be
|
3090
3200
|
# categorised from their usage alone, e.g.
|
3091
3201
|
#
|
@@ -3102,6 +3212,7 @@ Style/BlockDelimiters:
|
|
3102
3212
|
- lambda
|
3103
3213
|
- proc
|
3104
3214
|
- it
|
3215
|
+
AllowedPatterns: []
|
3105
3216
|
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
3106
3217
|
# EnforcedStyle is set to `semantic`. If so:
|
3107
3218
|
#
|
@@ -3125,7 +3236,7 @@ Style/BlockDelimiters:
|
|
3125
3236
|
# collection.each do |element| puts element end
|
3126
3237
|
AllowBracesOnProceduralOneLiners: false
|
3127
3238
|
# The BracesRequiredMethods overrides all other configurations except
|
3128
|
-
#
|
3239
|
+
# AllowedMethods. It can be used to enforce that all blocks for specific
|
3129
3240
|
# methods use braces. For example, you can use this to enforce Sorbet
|
3130
3241
|
# signatures use braces even when the rest of your codebase enforces
|
3131
3242
|
# the `line_count_based` style.
|
@@ -3146,6 +3257,15 @@ Style/CaseEquality:
|
|
3146
3257
|
# # good
|
3147
3258
|
# String === "string"
|
3148
3259
|
AllowOnConstant: false
|
3260
|
+
# If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
|
3261
|
+
# the case equality operator is `self.class`.
|
3262
|
+
#
|
3263
|
+
# # bad
|
3264
|
+
# some_class === object
|
3265
|
+
#
|
3266
|
+
# # good
|
3267
|
+
# self.class === object
|
3268
|
+
AllowOnSelfClass: false
|
3149
3269
|
|
3150
3270
|
Style/CaseLikeIf:
|
3151
3271
|
Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
@@ -3153,6 +3273,9 @@ Style/CaseLikeIf:
|
|
3153
3273
|
Enabled: true
|
3154
3274
|
Safe: false
|
3155
3275
|
VersionAdded: '0.88'
|
3276
|
+
VersionChanged: '1.48'
|
3277
|
+
# `MinBranchesCount` defines the number of branches `if` needs to have to trigger this cop.
|
3278
|
+
MinBranchesCount: 3
|
3156
3279
|
|
3157
3280
|
Style/CharacterLiteral:
|
3158
3281
|
Description: 'Checks for uses of character literals.'
|
@@ -3165,7 +3288,7 @@ Style/ClassAndModuleChildren:
|
|
3165
3288
|
StyleGuide: '#namespace-definition'
|
3166
3289
|
# Moving from compact to nested children requires knowledge of whether the
|
3167
3290
|
# outer parent is a module or a class. Moving from nested to compact requires
|
3168
|
-
# verification that the outer parent is defined elsewhere.
|
3291
|
+
# verification that the outer parent is defined elsewhere. RuboCop does not
|
3169
3292
|
# have the knowledge to perform either operation safely and thus requires
|
3170
3293
|
# manual oversight.
|
3171
3294
|
SafeAutoCorrect: false
|
@@ -3205,10 +3328,11 @@ Style/ClassEqualityComparison:
|
|
3205
3328
|
StyleGuide: '#instance-of-vs-class-comparison'
|
3206
3329
|
Enabled: true
|
3207
3330
|
VersionAdded: '0.93'
|
3208
|
-
|
3331
|
+
AllowedMethods:
|
3209
3332
|
- ==
|
3210
3333
|
- equal?
|
3211
3334
|
- eql?
|
3335
|
+
AllowedPatterns: []
|
3212
3336
|
|
3213
3337
|
Style/ClassMethods:
|
3214
3338
|
Description: 'Use self when defining module/class methods.'
|
@@ -3329,6 +3453,17 @@ Style/CommentedKeyword:
|
|
3329
3453
|
VersionAdded: '0.51'
|
3330
3454
|
VersionChanged: '1.19'
|
3331
3455
|
|
3456
|
+
Style/ComparableClamp:
|
3457
|
+
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
3458
|
+
Enabled: pending
|
3459
|
+
VersionAdded: '1.44'
|
3460
|
+
|
3461
|
+
Style/ConcatArrayLiterals:
|
3462
|
+
Description: 'Enforces the use of `Array#push(item)` instead of `Array#concat([item])` to avoid redundant array literals.'
|
3463
|
+
Enabled: pending
|
3464
|
+
Safe: false
|
3465
|
+
VersionAdded: '1.41'
|
3466
|
+
|
3332
3467
|
Style/ConditionalAssignment:
|
3333
3468
|
Description: >-
|
3334
3469
|
Use the return value of `if` and `case` statements for
|
@@ -3384,9 +3519,17 @@ Style/Copyright:
|
|
3384
3519
|
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
3385
3520
|
AutocorrectNotice: ''
|
3386
3521
|
|
3522
|
+
Style/DataInheritance:
|
3523
|
+
Description: 'Checks for inheritance from Data.define.'
|
3524
|
+
StyleGuide: '#no-extend-data-define'
|
3525
|
+
Enabled: pending
|
3526
|
+
SafeAutoCorrect: false
|
3527
|
+
VersionAdded: '1.49'
|
3528
|
+
VersionChanged: '1.51'
|
3529
|
+
|
3387
3530
|
Style/DateTime:
|
3388
3531
|
Description: 'Use Time over DateTime.'
|
3389
|
-
StyleGuide: '#date
|
3532
|
+
StyleGuide: '#date-time'
|
3390
3533
|
Enabled: false
|
3391
3534
|
VersionAdded: '0.51'
|
3392
3535
|
VersionChanged: '0.92'
|
@@ -3407,6 +3550,12 @@ Style/Dir:
|
|
3407
3550
|
Enabled: true
|
3408
3551
|
VersionAdded: '0.50'
|
3409
3552
|
|
3553
|
+
Style/DirEmpty:
|
3554
|
+
Description: >-
|
3555
|
+
Prefer to use `Dir.empty?('path/to/dir')` when checking if a directory is empty.
|
3556
|
+
Enabled: pending
|
3557
|
+
VersionAdded: '1.48'
|
3558
|
+
|
3410
3559
|
Style/DisableCopsWithinSourceCodeDirective:
|
3411
3560
|
Description: >-
|
3412
3561
|
Forbids disabling/enabling cops within source code.
|
@@ -3495,6 +3644,12 @@ Style/EmptyElse:
|
|
3495
3644
|
- empty
|
3496
3645
|
- nil
|
3497
3646
|
- both
|
3647
|
+
AllowComments: false
|
3648
|
+
|
3649
|
+
Style/EmptyHeredoc:
|
3650
|
+
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
3651
|
+
Enabled: pending
|
3652
|
+
VersionAdded: '1.32'
|
3498
3653
|
|
3499
3654
|
Style/EmptyLambdaParameter:
|
3500
3655
|
Description: 'Omit parens for empty lambda parameters.'
|
@@ -3561,6 +3716,11 @@ Style/EvenOdd:
|
|
3561
3716
|
VersionAdded: '0.12'
|
3562
3717
|
VersionChanged: '0.29'
|
3563
3718
|
|
3719
|
+
Style/ExactRegexpMatch:
|
3720
|
+
Description: 'Checks for exact regexp match inside Regexp literals.'
|
3721
|
+
Enabled: pending
|
3722
|
+
VersionAdded: '1.51'
|
3723
|
+
|
3564
3724
|
Style/ExpandPathArguments:
|
3565
3725
|
Description: "Use `expand_path(__dir__)` instead of `expand_path('..', __FILE__)`."
|
3566
3726
|
Enabled: true
|
@@ -3596,6 +3756,13 @@ Style/FetchEnvVar:
|
|
3596
3756
|
# Environment variables to be excluded from the inspection.
|
3597
3757
|
AllowedVars: []
|
3598
3758
|
|
3759
|
+
Style/FileEmpty:
|
3760
|
+
Description: >-
|
3761
|
+
Prefer to use `File.empty?('path/to/file')` when checking if a file is empty.
|
3762
|
+
Enabled: pending
|
3763
|
+
Safe: false
|
3764
|
+
VersionAdded: '1.48'
|
3765
|
+
|
3599
3766
|
Style/FileRead:
|
3600
3767
|
Description: 'Favor `File.(bin)read` convenience methods.'
|
3601
3768
|
StyleGuide: '#file-read'
|
@@ -3664,7 +3831,8 @@ Style/FormatStringToken:
|
|
3664
3831
|
MaxUnannotatedPlaceholdersAllowed: 1
|
3665
3832
|
VersionAdded: '0.49'
|
3666
3833
|
VersionChanged: '1.0'
|
3667
|
-
|
3834
|
+
AllowedMethods: []
|
3835
|
+
AllowedPatterns: []
|
3668
3836
|
|
3669
3837
|
Style/FrozenStringLiteralComment:
|
3670
3838
|
Description: >-
|
@@ -3742,15 +3910,17 @@ Style/HashEachMethods:
|
|
3742
3910
|
Safe: false
|
3743
3911
|
VersionAdded: '0.80'
|
3744
3912
|
VersionChanged: '1.16'
|
3745
|
-
AllowedReceivers:
|
3913
|
+
AllowedReceivers:
|
3914
|
+
- Thread.current
|
3746
3915
|
|
3747
3916
|
Style/HashExcept:
|
3748
3917
|
Description: >-
|
3749
3918
|
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
3750
3919
|
that can be replaced with `Hash#except` method.
|
3751
3920
|
Enabled: pending
|
3921
|
+
Safe: false
|
3752
3922
|
VersionAdded: '1.7'
|
3753
|
-
VersionChanged: '1.
|
3923
|
+
VersionChanged: '1.39'
|
3754
3924
|
|
3755
3925
|
Style/HashLikeCase:
|
3756
3926
|
Description: >-
|
@@ -3789,6 +3959,8 @@ Style/HashSyntax:
|
|
3789
3959
|
- never
|
3790
3960
|
# accepts both shorthand and explicit use of hash literal value.
|
3791
3961
|
- either
|
3962
|
+
# forces use of the 3.1 syntax only if all values can be omitted in the hash.
|
3963
|
+
- consistent
|
3792
3964
|
# Force hashes that have a symbol value to use hash rockets
|
3793
3965
|
UseHashRocketsWithSymbolValues: false
|
3794
3966
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
@@ -3901,16 +4073,41 @@ Style/InverseMethods:
|
|
3901
4073
|
:=~: :!~
|
3902
4074
|
:<: :>=
|
3903
4075
|
:>: :<=
|
3904
|
-
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
3905
|
-
# and not enabled by default.
|
3906
|
-
# :present?: :blank?,
|
3907
|
-
# :include?: :exclude?
|
3908
4076
|
# `InverseBlocks` are methods that are inverted by inverting the return
|
3909
4077
|
# of the block that is passed to the method
|
3910
4078
|
InverseBlocks:
|
3911
4079
|
:select: :reject
|
3912
4080
|
:select!: :reject!
|
3913
4081
|
|
4082
|
+
Style/InvertibleUnlessCondition:
|
4083
|
+
Description: 'Favor `if` with inverted condition over `unless`.'
|
4084
|
+
Enabled: false
|
4085
|
+
Safe: false
|
4086
|
+
VersionAdded: '1.44'
|
4087
|
+
VersionChanged: '1.50'
|
4088
|
+
# `InverseMethods` are methods that can be inverted in a `unless` condition.
|
4089
|
+
# The relationship of inverse methods needs to be defined in both directions.
|
4090
|
+
# Keys and values both need to be defined as symbols.
|
4091
|
+
InverseMethods:
|
4092
|
+
:!=: :==
|
4093
|
+
:>: :<=
|
4094
|
+
:<=: :>
|
4095
|
+
:<: :>=
|
4096
|
+
:>=: :<
|
4097
|
+
:!~: :=~
|
4098
|
+
:zero?: :nonzero?
|
4099
|
+
:nonzero?: :zero?
|
4100
|
+
:any?: :none?
|
4101
|
+
:none?: :any?
|
4102
|
+
:even?: :odd?
|
4103
|
+
:odd?: :even?
|
4104
|
+
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
4105
|
+
# and not enabled by default.
|
4106
|
+
# :present?: :blank?
|
4107
|
+
# :blank?: :present?
|
4108
|
+
# :include?: :exclude?
|
4109
|
+
# :exclude?: :include?
|
4110
|
+
|
3914
4111
|
Style/IpAddresses:
|
3915
4112
|
Description: "Don't include literal IP addresses in code."
|
3916
4113
|
Enabled: false
|
@@ -3965,6 +4162,26 @@ Style/LineEndConcatenation:
|
|
3965
4162
|
VersionAdded: '0.18'
|
3966
4163
|
VersionChanged: '0.64'
|
3967
4164
|
|
4165
|
+
Style/MagicCommentFormat:
|
4166
|
+
Description: 'Use a consistent style for magic comments.'
|
4167
|
+
Enabled: pending
|
4168
|
+
VersionAdded: '1.35'
|
4169
|
+
EnforcedStyle: snake_case
|
4170
|
+
SupportedStyles:
|
4171
|
+
# `snake` will enforce the magic comment is written
|
4172
|
+
# in snake case (words separated by underscores).
|
4173
|
+
# Eg: froze_string_literal: true
|
4174
|
+
- snake_case
|
4175
|
+
# `kebab` will enforce the magic comment is written
|
4176
|
+
# in kebab case (words separated by hyphens).
|
4177
|
+
# Eg: froze-string-literal: true
|
4178
|
+
- kebab_case
|
4179
|
+
DirectiveCapitalization: lowercase
|
4180
|
+
ValueCapitalization: ~
|
4181
|
+
SupportedCapitalizations:
|
4182
|
+
- lowercase
|
4183
|
+
- uppercase
|
4184
|
+
|
3968
4185
|
Style/MapCompactWithConditionalBlock:
|
3969
4186
|
Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
|
3970
4187
|
Enabled: pending
|
@@ -3976,6 +4193,12 @@ Style/MapToHash:
|
|
3976
4193
|
VersionAdded: '1.24'
|
3977
4194
|
Safe: false
|
3978
4195
|
|
4196
|
+
Style/MapToSet:
|
4197
|
+
Description: 'Prefer `to_set` with a block over `map.to_set`.'
|
4198
|
+
Enabled: pending
|
4199
|
+
Safe: false
|
4200
|
+
VersionAdded: '1.42'
|
4201
|
+
|
3979
4202
|
Style/MethodCallWithArgsParentheses:
|
3980
4203
|
Description: 'Use parentheses for method calls with arguments.'
|
3981
4204
|
StyleGuide: '#method-invocation-parens'
|
@@ -3983,9 +4206,8 @@ Style/MethodCallWithArgsParentheses:
|
|
3983
4206
|
VersionAdded: '0.47'
|
3984
4207
|
VersionChanged: '1.7'
|
3985
4208
|
IgnoreMacros: true
|
3986
|
-
|
4209
|
+
AllowedMethods: []
|
3987
4210
|
AllowedPatterns: []
|
3988
|
-
IgnoredPatterns: [] # deprecated
|
3989
4211
|
IncludedMacros: []
|
3990
4212
|
AllowParenthesesInMultilineCall: false
|
3991
4213
|
AllowParenthesesInChaining: false
|
@@ -4000,7 +4222,8 @@ Style/MethodCallWithoutArgsParentheses:
|
|
4000
4222
|
Description: 'Do not use parentheses for method calls with no arguments.'
|
4001
4223
|
StyleGuide: '#method-invocation-parens'
|
4002
4224
|
Enabled: true
|
4003
|
-
|
4225
|
+
AllowedMethods: []
|
4226
|
+
AllowedPatterns: []
|
4004
4227
|
VersionAdded: '0.47'
|
4005
4228
|
VersionChanged: '0.55'
|
4006
4229
|
|
@@ -4031,6 +4254,12 @@ Style/MinMax:
|
|
4031
4254
|
Enabled: true
|
4032
4255
|
VersionAdded: '0.50'
|
4033
4256
|
|
4257
|
+
Style/MinMaxComparison:
|
4258
|
+
Description: 'Enforces the use of `max` or `min` instead of comparison for greater or less.'
|
4259
|
+
Enabled: pending
|
4260
|
+
Safe: false
|
4261
|
+
VersionAdded: '1.42'
|
4262
|
+
|
4034
4263
|
Style/MissingElse:
|
4035
4264
|
Description: >-
|
4036
4265
|
Require if/case expressions to have an else branches.
|
@@ -4352,17 +4581,17 @@ Style/NumericLiterals:
|
|
4352
4581
|
Strict: false
|
4353
4582
|
# You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
|
4354
4583
|
AllowedNumbers: []
|
4584
|
+
AllowedPatterns: []
|
4355
4585
|
|
4356
4586
|
Style/NumericPredicate:
|
4357
4587
|
Description: >-
|
4358
4588
|
Checks for the use of predicate- or comparison methods for
|
4359
4589
|
numeric comparisons.
|
4360
4590
|
StyleGuide: '#predicate-methods'
|
4361
|
-
Safe: false
|
4362
4591
|
# This will change to a new method call which isn't guaranteed to be on the
|
4363
4592
|
# object. Switching these methods has to be done with knowledge of the types
|
4364
4593
|
# of the variables which rubocop doesn't have.
|
4365
|
-
|
4594
|
+
Safe: false
|
4366
4595
|
Enabled: true
|
4367
4596
|
VersionAdded: '0.42'
|
4368
4597
|
VersionChanged: '0.59'
|
@@ -4370,7 +4599,8 @@ Style/NumericPredicate:
|
|
4370
4599
|
SupportedStyles:
|
4371
4600
|
- predicate
|
4372
4601
|
- comparison
|
4373
|
-
|
4602
|
+
AllowedMethods: []
|
4603
|
+
AllowedPatterns: []
|
4374
4604
|
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
4375
4605
|
# false positives.
|
4376
4606
|
Exclude:
|
@@ -4407,7 +4637,15 @@ Style/OpenStructUse:
|
|
4407
4637
|
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4408
4638
|
|
4409
4639
|
Enabled: pending
|
4640
|
+
Safe: false
|
4410
4641
|
VersionAdded: '1.23'
|
4642
|
+
VersionChanged: '1.51'
|
4643
|
+
|
4644
|
+
Style/OperatorMethodCall:
|
4645
|
+
Description: 'Checks for redundant dot before operator method call.'
|
4646
|
+
StyleGuide: '#operator-method-call'
|
4647
|
+
Enabled: pending
|
4648
|
+
VersionAdded: '1.37'
|
4411
4649
|
|
4412
4650
|
Style/OptionHash:
|
4413
4651
|
Description: "Don't use option hashes when you can use keyword arguments."
|
@@ -4554,10 +4792,12 @@ Style/RedundantArgument:
|
|
4554
4792
|
Enabled: pending
|
4555
4793
|
Safe: false
|
4556
4794
|
VersionAdded: '1.4'
|
4557
|
-
VersionChanged: '1.
|
4795
|
+
VersionChanged: '1.40'
|
4558
4796
|
Methods:
|
4559
4797
|
# Array#join
|
4560
4798
|
join: ''
|
4799
|
+
# Array#sum
|
4800
|
+
sum: 0
|
4561
4801
|
# String#split
|
4562
4802
|
split: ' '
|
4563
4803
|
# String#chomp
|
@@ -4592,6 +4832,22 @@ Style/RedundantConditional:
|
|
4592
4832
|
Enabled: true
|
4593
4833
|
VersionAdded: '0.50'
|
4594
4834
|
|
4835
|
+
Style/RedundantConstantBase:
|
4836
|
+
Description: Avoid redundant `::` prefix on constant.
|
4837
|
+
Enabled: pending
|
4838
|
+
VersionAdded: '1.40'
|
4839
|
+
|
4840
|
+
Style/RedundantDoubleSplatHashBraces:
|
4841
|
+
Description: 'Checks for redundant uses of double splat hash braces.'
|
4842
|
+
Enabled: pending
|
4843
|
+
VersionAdded: '1.41'
|
4844
|
+
|
4845
|
+
Style/RedundantEach:
|
4846
|
+
Description: 'Checks for redundant `each`.'
|
4847
|
+
Enabled: pending
|
4848
|
+
Safe: false
|
4849
|
+
VersionAdded: '1.38'
|
4850
|
+
|
4595
4851
|
Style/RedundantException:
|
4596
4852
|
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
4597
4853
|
StyleGuide: '#no-explicit-runtimeerror'
|
@@ -4626,6 +4882,11 @@ Style/RedundantFreeze:
|
|
4626
4882
|
VersionAdded: '0.34'
|
4627
4883
|
VersionChanged: '0.66'
|
4628
4884
|
|
4885
|
+
Style/RedundantHeredocDelimiterQuotes:
|
4886
|
+
Description: 'Checks for redundant heredoc delimiter quotes.'
|
4887
|
+
Enabled: pending
|
4888
|
+
VersionAdded: '1.45'
|
4889
|
+
|
4629
4890
|
Style/RedundantInitialize:
|
4630
4891
|
Description: 'Checks for redundant `initialize` methods.'
|
4631
4892
|
Enabled: pending
|
@@ -4641,6 +4902,11 @@ Style/RedundantInterpolation:
|
|
4641
4902
|
VersionAdded: '0.76'
|
4642
4903
|
VersionChanged: '1.30'
|
4643
4904
|
|
4905
|
+
Style/RedundantLineContinuation:
|
4906
|
+
Description: 'Check for redundant line continuation.'
|
4907
|
+
Enabled: pending
|
4908
|
+
VersionAdded: '1.49'
|
4909
|
+
|
4644
4910
|
Style/RedundantParentheses:
|
4645
4911
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
4646
4912
|
Enabled: true
|
@@ -4703,6 +4969,11 @@ Style/RedundantSortBy:
|
|
4703
4969
|
Enabled: true
|
4704
4970
|
VersionAdded: '0.36'
|
4705
4971
|
|
4972
|
+
Style/RedundantStringEscape:
|
4973
|
+
Description: 'Checks for redundant escapes in string literals.'
|
4974
|
+
Enabled: pending
|
4975
|
+
VersionAdded: '1.37'
|
4976
|
+
|
4706
4977
|
Style/RegexpLiteral:
|
4707
4978
|
Description: 'Use / or %r around regular expressions.'
|
4708
4979
|
StyleGuide: '#percent-r'
|
@@ -4721,6 +4992,12 @@ Style/RegexpLiteral:
|
|
4721
4992
|
# are found in the regexp string.
|
4722
4993
|
AllowInnerSlashes: false
|
4723
4994
|
|
4995
|
+
Style/RequireOrder:
|
4996
|
+
Description: Sort `require` and `require_relative` in alphabetical order.
|
4997
|
+
Enabled: false
|
4998
|
+
SafeAutoCorrect: false
|
4999
|
+
VersionAdded: '1.40'
|
5000
|
+
|
4724
5001
|
Style/RescueModifier:
|
4725
5002
|
Description: 'Avoid using rescue in its modifier form.'
|
4726
5003
|
StyleGuide: '#no-rescue-modifiers'
|
@@ -5005,13 +5282,13 @@ Style/SymbolProc:
|
|
5005
5282
|
Enabled: true
|
5006
5283
|
Safe: false
|
5007
5284
|
VersionAdded: '0.26'
|
5008
|
-
VersionChanged: '1.
|
5285
|
+
VersionChanged: '1.40'
|
5009
5286
|
AllowMethodsWithArguments: false
|
5010
|
-
# A list of method names to be
|
5287
|
+
# A list of method names to be always allowed by the check.
|
5011
5288
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
5012
|
-
|
5013
|
-
- respond_to
|
5289
|
+
AllowedMethods:
|
5014
5290
|
- define_method
|
5291
|
+
AllowedPatterns: []
|
5015
5292
|
AllowComments: false
|
5016
5293
|
|
5017
5294
|
Style/TernaryParentheses:
|
@@ -5250,6 +5527,19 @@ Style/YodaCondition:
|
|
5250
5527
|
VersionAdded: '0.49'
|
5251
5528
|
VersionChanged: '0.75'
|
5252
5529
|
|
5530
|
+
Style/YodaExpression:
|
5531
|
+
Description: 'Forbid the use of yoda expressions.'
|
5532
|
+
Enabled: false
|
5533
|
+
Safe: false
|
5534
|
+
VersionAdded: '1.42'
|
5535
|
+
VersionChanged: '1.43'
|
5536
|
+
SupportedOperators:
|
5537
|
+
- '*'
|
5538
|
+
- '+'
|
5539
|
+
- '&'
|
5540
|
+
- '|'
|
5541
|
+
- '^'
|
5542
|
+
|
5253
5543
|
Style/ZeroLengthPredicate:
|
5254
5544
|
Description: 'Use #empty? when testing for objects of length 0.'
|
5255
5545
|
Enabled: true
|