rubocop 1.19.0 → 1.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +8 -7
- data/config/default.yml +529 -90
- data/config/obsoletion.yml +35 -2
- data/exe/rubocop +15 -7
- 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} +21 -6
- data/lib/rubocop/cli/command/execute_runner.rb +8 -8
- data/lib/rubocop/cli/command/init_dotfile.rb +2 -2
- data/lib/rubocop/cli/command/show_cops.rb +1 -1
- data/lib/rubocop/cli/command/show_docs_url.rb +48 -0
- data/lib/rubocop/cli/command/suggest_extensions.rb +62 -17
- data/lib/rubocop/cli.rb +4 -1
- data/lib/rubocop/comment_config.rb +41 -1
- data/lib/rubocop/config.rb +16 -6
- data/lib/rubocop/config_finder.rb +68 -0
- data/lib/rubocop/config_loader.rb +25 -49
- data/lib/rubocop/config_loader_resolver.rb +4 -8
- data/lib/rubocop/config_obsoletion/changed_parameter.rb +5 -0
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +3 -1
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +4 -0
- data/lib/rubocop/config_obsoletion.rb +7 -2
- data/lib/rubocop/config_validator.rb +30 -5
- data/lib/rubocop/cop/autocorrect_logic.rb +8 -2
- data/lib/rubocop/cop/badge.rb +8 -2
- data/lib/rubocop/cop/base.rb +11 -14
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +4 -8
- data/lib/rubocop/cop/bundler/gem_comment.rb +3 -3
- data/lib/rubocop/cop/bundler/gem_filename.rb +103 -0
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +45 -21
- data/lib/rubocop/cop/bundler/ordered_gems.rb +5 -14
- data/lib/rubocop/cop/commissioner.rb +3 -1
- data/lib/rubocop/cop/cop.rb +1 -1
- data/lib/rubocop/cop/corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/condition_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/empty_line_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +4 -2
- data/lib/rubocop/cop/correctors/if_then_corrector.rb +55 -0
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +3 -3
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +8 -2
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +25 -9
- data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +12 -11
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +59 -1
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/punctuation_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/space_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/string_literal_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +2 -2
- data/lib/rubocop/cop/documentation.rb +20 -3
- data/lib/rubocop/cop/gemspec/dependency_version.rb +156 -0
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +92 -0
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +6 -22
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +4 -13
- data/lib/rubocop/cop/gemspec/require_mfa.rb +145 -0
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +41 -27
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +4 -11
- data/lib/rubocop/cop/generator/require_file_injector.rb +2 -2
- data/lib/rubocop/cop/generator.rb +26 -21
- data/lib/rubocop/cop/internal_affairs/cop_description.rb +96 -0
- data/lib/rubocop/cop/internal_affairs/create_empty_file.rb +37 -0
- data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/example_heredoc_delimiter.rb +111 -0
- data/lib/rubocop/cop/internal_affairs/lambda_or_proc.rb +46 -0
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +60 -0
- data/lib/rubocop/cop/internal_affairs/method_name_end_with.rb +80 -0
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +2 -6
- data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +69 -0
- data/lib/rubocop/cop/internal_affairs/redundant_context_config_parameter.rb +46 -0
- data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_method_dispatch_node.rb +47 -0
- data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +62 -0
- data/lib/rubocop/cop/internal_affairs/undefined_config.rb +3 -1
- data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +60 -0
- data/lib/rubocop/cop/internal_affairs.rb +11 -0
- data/lib/rubocop/cop/layout/argument_alignment.rb +57 -9
- data/lib/rubocop/cop/layout/assignment_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +20 -16
- data/lib/rubocop/cop/layout/block_end_newline.rb +36 -6
- data/lib/rubocop/cop/layout/case_indentation.rb +17 -1
- data/lib/rubocop/cop/layout/class_structure.rb +2 -1
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/comment_indentation.rb +33 -4
- data/lib/rubocop/cop/layout/condition_position.rb +1 -1
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/dot_position.rb +39 -6
- data/lib/rubocop/cop/layout/else_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_comment.rb +3 -3
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +23 -2
- data/lib/rubocop/cop/layout/empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +5 -2
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +25 -4
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +7 -5
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +10 -10
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +12 -5
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +10 -10
- data/lib/rubocop/cop/layout/end_alignment.rb +3 -4
- data/lib/rubocop/cop/layout/end_of_line.rb +5 -5
- data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +35 -29
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +22 -15
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +53 -14
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +10 -3
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -2
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_consistency.rb +1 -1
- data/lib/rubocop/cop/layout/indentation_style.rb +2 -2
- data/lib/rubocop/cop/layout/indentation_width.rb +18 -12
- data/lib/rubocop/cop/layout/initial_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/leading_comment_space.rb +2 -2
- data/lib/rubocop/cop/layout/leading_empty_lines.rb +1 -1
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +133 -0
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +130 -0
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/line_length.rb +20 -13
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +3 -3
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +7 -5
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +7 -1
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +23 -6
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +45 -0
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +9 -10
- data/lib/rubocop/cop/layout/redundant_line_break.rb +6 -6
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +8 -7
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +16 -5
- data/lib/rubocop/cop/layout/space_after_colon.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_not.rb +2 -1
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +3 -3
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +2 -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 +5 -3
- data/lib/rubocop/cop/layout/space_before_brackets.rb +8 -0
- data/lib/rubocop/cop/layout/space_before_comment.rb +2 -2
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +5 -1
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +12 -6
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +23 -19
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -0
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +33 -15
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +30 -3
- data/lib/rubocop/cop/layout/space_inside_parens.rb +74 -28
- data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +34 -0
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +8 -4
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +1 -1
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +9 -9
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +3 -3
- data/lib/rubocop/cop/legacy/corrections_proxy.rb +1 -1
- data/lib/rubocop/cop/legacy/corrector.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +28 -7
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +7 -7
- data/lib/rubocop/cop/lint/ambiguous_operator_precedence.rb +111 -0
- data/lib/rubocop/cop/lint/ambiguous_range.rb +13 -13
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +6 -2
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +19 -7
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +19 -6
- data/lib/rubocop/cop/lint/boolean_symbol.rb +6 -1
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +1 -1
- data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +51 -0
- data/lib/rubocop/cop/lint/debugger.rb +29 -21
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +35 -17
- data/lib/rubocop/cop/lint/deprecated_constants.rb +12 -4
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +6 -0
- data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +24 -1
- data/lib/rubocop/cop/lint/duplicate_branch.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_magic_comment.rb +73 -0
- data/lib/rubocop/cop/lint/duplicate_methods.rb +29 -10
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +26 -7
- data/lib/rubocop/cop/lint/duplicate_require.rb +11 -2
- data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +2 -2
- data/lib/rubocop/cop/lint/else_layout.rb +13 -9
- data/lib/rubocop/cop/lint/empty_block.rb +3 -7
- data/lib/rubocop/cop/lint/empty_class.rb +4 -2
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +112 -4
- data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
- data/lib/rubocop/cop/lint/empty_expression.rb +1 -1
- data/lib/rubocop/cop/lint/empty_file.rb +1 -1
- data/lib/rubocop/cop/lint/empty_in_pattern.rb +4 -2
- data/lib/rubocop/cop/lint/empty_interpolation.rb +1 -1
- data/lib/rubocop/cop/lint/empty_when.rb +4 -2
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +11 -11
- data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
- data/lib/rubocop/cop/lint/float_comparison.rb +1 -1
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -2
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +12 -3
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +1 -1
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
- data/lib/rubocop/cop/lint/incompatible_io_select_with_fiber_scheduler.rb +79 -0
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
- data/lib/rubocop/cop/lint/inherit_exception.rb +19 -28
- data/lib/rubocop/cop/lint/interpolation_check.rb +8 -2
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +10 -3
- data/lib/rubocop/cop/lint/literal_as_condition.rb +6 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +5 -1
- data/lib/rubocop/cop/lint/loop.rb +5 -4
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +19 -4
- data/lib/rubocop/cop/lint/missing_super.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +51 -2
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +25 -6
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +157 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +21 -5
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +47 -11
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +2 -2
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +4 -3
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +4 -5
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +18 -1
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +17 -8
- data/lib/rubocop/cop/lint/percent_string_array.rb +11 -1
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +1 -1
- data/lib/rubocop/cop/lint/raise_exception.rb +5 -1
- data/lib/rubocop/cop/lint/rand_one.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +42 -10
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +12 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +38 -7
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +18 -4
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_with_index.rb +14 -11
- data/lib/rubocop/cop/lint/redundant_with_object.rb +13 -12
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +51 -0
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +3 -3
- data/lib/rubocop/cop/lint/require_parentheses.rb +2 -2
- data/lib/rubocop/cop/lint/require_range_parentheses.rb +57 -0
- data/lib/rubocop/cop/lint/require_relative_self_path.rb +50 -0
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/return_in_void_context.rb +6 -18
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +49 -2
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +1 -1
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
- data/lib/rubocop/cop/lint/script_permission.rb +1 -1
- data/lib/rubocop/cop/lint/self_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +5 -4
- data/lib/rubocop/cop/lint/shadowed_argument.rb +1 -1
- data/lib/rubocop/cop/lint/shadowed_exception.rb +16 -11
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +37 -2
- data/lib/rubocop/cop/lint/struct_new_override.rb +3 -3
- data/lib/rubocop/cop/lint/suppressed_exception.rb +2 -2
- data/lib/rubocop/cop/lint/symbol_conversion.rb +5 -4
- data/lib/rubocop/cop/lint/syntax.rb +2 -3
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
- data/lib/rubocop/cop/lint/to_json.rb +1 -1
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +2 -2
- data/lib/rubocop/cop/lint/triple_quotes.rb +1 -1
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +1 -1
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +9 -4
- data/lib/rubocop/cop/lint/unified_integer.rb +3 -1
- data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_loop.rb +13 -7
- data/lib/rubocop/cop/lint/unused_block_argument.rb +1 -1
- data/lib/rubocop/cop/lint/unused_method_argument.rb +8 -5
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
- data/lib/rubocop/cop/lint/uri_regexp.rb +1 -1
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +9 -7
- data/lib/rubocop/cop/lint/useless_assignment.rb +1 -1
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +2 -3
- data/lib/rubocop/cop/lint/useless_method_definition.rb +4 -3
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +117 -0
- data/lib/rubocop/cop/lint/useless_setter_call.rb +8 -5
- data/lib/rubocop/cop/lint/useless_times.rb +19 -14
- data/lib/rubocop/cop/lint/void.rb +8 -6
- data/lib/rubocop/cop/metrics/abc_size.rb +11 -3
- data/lib/rubocop/cop/metrics/block_length.rb +17 -11
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/class_length.rb +10 -5
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -10
- data/lib/rubocop/cop/metrics/method_length.rb +19 -12
- data/lib/rubocop/cop/metrics/module_length.rb +11 -6
- data/lib/rubocop/cop/metrics/parameter_lists.rb +6 -3
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +2 -2
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +3 -4
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +29 -7
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +1 -1
- data/lib/rubocop/cop/mixin/allowed_methods.rb +20 -1
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +56 -0
- data/lib/rubocop/cop/mixin/annotation_comment.rb +57 -34
- 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 +40 -2
- data/lib/rubocop/cop/mixin/def_node.rb +2 -7
- data/lib/rubocop/cop/mixin/documentation_comment.rb +5 -2
- data/lib/rubocop/cop/mixin/duplication.rb +1 -1
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +1 -2
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +7 -1
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +27 -1
- data/lib/rubocop/cop/mixin/gemspec_help.rb +30 -0
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +4 -3
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +183 -0
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +13 -9
- data/lib/rubocop/cop/mixin/heredoc.rb +1 -3
- data/lib/rubocop/cop/mixin/line_length_help.rb +17 -6
- data/lib/rubocop/cop/mixin/method_complexity.rb +8 -13
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +35 -13
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +6 -5
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +1 -1
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +9 -1
- data/lib/rubocop/cop/mixin/percent_array.rb +70 -3
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +9 -1
- data/lib/rubocop/cop/mixin/preferred_delimiters.rb +2 -2
- data/lib/rubocop/cop/mixin/range_help.rb +33 -7
- data/lib/rubocop/cop/mixin/rescue_node.rb +3 -1
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +17 -3
- data/lib/rubocop/cop/mixin/string_help.rb +1 -1
- data/lib/rubocop/cop/mixin/surrounding_space.rb +14 -10
- data/lib/rubocop/cop/mixin/trailing_body.rb +1 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
- data/lib/rubocop/cop/mixin/visibility_help.rb +40 -5
- data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -2
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +1 -4
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/block_forwarding.rb +121 -0
- data/lib/rubocop/cop/naming/block_parameter_name.rb +3 -3
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +1 -1
- data/lib/rubocop/cop/naming/constant_name.rb +4 -4
- data/lib/rubocop/cop/naming/file_name.rb +39 -6
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +1 -1
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +1 -1
- data/lib/rubocop/cop/naming/inclusive_language.rb +13 -12
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +6 -5
- data/lib/rubocop/cop/naming/method_name.rb +6 -6
- data/lib/rubocop/cop/naming/method_parameter_name.rb +2 -2
- data/lib/rubocop/cop/naming/predicate_name.rb +32 -3
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +8 -1
- data/lib/rubocop/cop/naming/variable_name.rb +10 -1
- data/lib/rubocop/cop/naming/variable_number.rb +28 -18
- data/lib/rubocop/cop/offense.rb +1 -1
- data/lib/rubocop/cop/registry.rb +32 -14
- data/lib/rubocop/cop/security/compound_hash.rb +105 -0
- data/lib/rubocop/cop/security/eval.rb +1 -1
- data/lib/rubocop/cop/security/io_methods.rb +49 -0
- data/lib/rubocop/cop/security/json_load.rb +9 -8
- data/lib/rubocop/cop/security/marshal_load.rb +1 -1
- data/lib/rubocop/cop/security/open.rb +15 -1
- data/lib/rubocop/cop/security/yaml_load.rb +14 -4
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +76 -2
- data/lib/rubocop/cop/style/accessor_grouping.rb +13 -9
- data/lib/rubocop/cop/style/alias.rb +4 -4
- data/lib/rubocop/cop/style/and_or.rb +14 -9
- data/lib/rubocop/cop/style/arguments_forwarding.rb +16 -5
- data/lib/rubocop/cop/style/array_coercion.rb +22 -4
- data/lib/rubocop/cop/style/array_intersect.rb +111 -0
- data/lib/rubocop/cop/style/array_join.rb +1 -1
- data/lib/rubocop/cop/style/ascii_comments.rb +1 -4
- data/lib/rubocop/cop/style/attr.rb +1 -1
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +1 -1
- data/lib/rubocop/cop/style/bare_percent_literals.rb +1 -1
- data/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb +1 -1
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +1 -1
- data/lib/rubocop/cop/style/block_comments.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +58 -15
- data/lib/rubocop/cop/style/case_equality.rb +47 -20
- data/lib/rubocop/cop/style/case_like_if.rb +6 -1
- data/lib/rubocop/cop/style/character_literal.rb +10 -3
- data/lib/rubocop/cop/style/class_and_module_children.rb +14 -5
- data/lib/rubocop/cop/style/class_check.rb +1 -1
- data/lib/rubocop/cop/style/class_equality_comparison.rb +55 -6
- data/lib/rubocop/cop/style/class_methods.rb +1 -1
- data/lib/rubocop/cop/style/class_methods_definitions.rb +3 -2
- data/lib/rubocop/cop/style/class_vars.rb +1 -1
- data/lib/rubocop/cop/style/collection_compact.rb +51 -22
- data/lib/rubocop/cop/style/collection_methods.rb +11 -7
- data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
- data/lib/rubocop/cop/style/colon_method_definition.rb +1 -1
- data/lib/rubocop/cop/style/combinable_loops.rb +9 -6
- data/lib/rubocop/cop/style/command_literal.rb +1 -1
- data/lib/rubocop/cop/style/comment_annotation.rb +26 -40
- data/lib/rubocop/cop/style/commented_keyword.rb +12 -7
- data/lib/rubocop/cop/style/conditional_assignment.rb +2 -1
- data/lib/rubocop/cop/style/constant_visibility.rb +1 -1
- data/lib/rubocop/cop/style/date_time.rb +6 -1
- data/lib/rubocop/cop/style/def_with_parentheses.rb +17 -12
- data/lib/rubocop/cop/style/dir.rb +4 -1
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +1 -1
- data/lib/rubocop/cop/style/documentation.rb +24 -9
- data/lib/rubocop/cop/style/documentation_method.rb +1 -1
- data/lib/rubocop/cop/style/double_negation.rb +87 -7
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +42 -7
- data/lib/rubocop/cop/style/each_with_object.rb +40 -9
- data/lib/rubocop/cop/style/empty_block_parameter.rb +2 -2
- data/lib/rubocop/cop/style/empty_case_condition.rb +13 -4
- data/lib/rubocop/cop/style/empty_else.rb +40 -3
- data/lib/rubocop/cop/style/empty_heredoc.rb +73 -0
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +2 -2
- data/lib/rubocop/cop/style/empty_literal.rb +2 -2
- data/lib/rubocop/cop/style/empty_method.rb +20 -5
- data/lib/rubocop/cop/style/encoding.rb +27 -16
- data/lib/rubocop/cop/style/end_block.rb +1 -1
- data/lib/rubocop/cop/style/endless_method.rb +2 -2
- data/lib/rubocop/cop/style/env_home.rb +56 -0
- data/lib/rubocop/cop/style/eval_with_location.rb +1 -1
- data/lib/rubocop/cop/style/even_odd.rb +1 -1
- data/lib/rubocop/cop/style/expand_path_arguments.rb +1 -1
- data/lib/rubocop/cop/style/explicit_block_argument.rb +27 -13
- data/lib/rubocop/cop/style/exponential_notation.rb +1 -1
- data/lib/rubocop/cop/style/fetch_env_var.rb +132 -0
- data/lib/rubocop/cop/style/file_read.rb +112 -0
- data/lib/rubocop/cop/style/file_write.rb +136 -0
- data/lib/rubocop/cop/style/float_division.rb +11 -3
- data/lib/rubocop/cop/style/for.rb +7 -1
- data/lib/rubocop/cop/style/format_string.rb +1 -1
- data/lib/rubocop/cop/style/format_string_token.rb +74 -23
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +13 -5
- data/lib/rubocop/cop/style/global_std_stream.rb +5 -1
- data/lib/rubocop/cop/style/global_vars.rb +1 -1
- data/lib/rubocop/cop/style/guard_clause.rb +151 -25
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +12 -0
- data/lib/rubocop/cop/style/hash_conversion.rb +3 -2
- data/lib/rubocop/cop/style/hash_each_methods.rb +41 -12
- data/lib/rubocop/cop/style/hash_except.rb +93 -12
- data/lib/rubocop/cop/style/hash_like_case.rb +1 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +56 -3
- data/lib/rubocop/cop/style/hash_transform_keys.rb +16 -13
- data/lib/rubocop/cop/style/hash_transform_values.rb +14 -13
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +19 -17
- data/lib/rubocop/cop/style/if_inside_else.rb +15 -0
- data/lib/rubocop/cop/style/if_unless_modifier.rb +6 -5
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +47 -8
- data/lib/rubocop/cop/style/if_with_semicolon.rb +2 -1
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +3 -3
- data/lib/rubocop/cop/style/in_pattern_then.rb +1 -1
- data/lib/rubocop/cop/style/infinite_loop.rb +4 -3
- data/lib/rubocop/cop/style/inline_comment.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +19 -10
- data/lib/rubocop/cop/style/ip_addresses.rb +1 -1
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +2 -2
- data/lib/rubocop/cop/style/lambda.rb +1 -1
- data/lib/rubocop/cop/style/lambda_call.rb +14 -22
- data/lib/rubocop/cop/style/line_end_concatenation.rb +16 -3
- data/lib/rubocop/cop/style/magic_comment_format.rb +307 -0
- data/lib/rubocop/cop/style/map_compact_with_conditional_block.rb +136 -0
- data/lib/rubocop/cop/style/map_to_hash.rb +68 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +43 -12
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +6 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +15 -13
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +20 -3
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +5 -2
- data/lib/rubocop/cop/style/method_def_parentheses.rb +18 -14
- data/lib/rubocop/cop/style/min_max.rb +1 -1
- data/lib/rubocop/cop/style/missing_else.rb +24 -24
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +1 -1
- data/lib/rubocop/cop/style/mixin_grouping.rb +2 -2
- data/lib/rubocop/cop/style/mixin_usage.rb +1 -1
- data/lib/rubocop/cop/style/module_function.rb +33 -12
- data/lib/rubocop/cop/style/multiline_block_chain.rb +4 -2
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -2
- data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
- data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +4 -6
- data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
- data/lib/rubocop/cop/style/multiline_method_signature.rb +2 -2
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +37 -11
- data/lib/rubocop/cop/style/multiline_when_then.rb +3 -5
- data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +74 -7
- data/lib/rubocop/cop/style/negated_if.rb +1 -1
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +8 -2
- data/lib/rubocop/cop/style/negated_unless.rb +1 -1
- data/lib/rubocop/cop/style/nested_file_dirname.rb +66 -0
- data/lib/rubocop/cop/style/nested_modifier.rb +1 -1
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +11 -2
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +20 -8
- data/lib/rubocop/cop/style/next.rb +4 -6
- data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
- data/lib/rubocop/cop/style/nil_lambda.rb +4 -4
- data/lib/rubocop/cop/style/non_nil_check.rb +3 -3
- data/lib/rubocop/cop/style/not.rb +4 -4
- data/lib/rubocop/cop/style/numbered_parameters.rb +46 -0
- data/lib/rubocop/cop/style/numbered_parameters_limit.rb +50 -0
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literals.rb +33 -10
- data/lib/rubocop/cop/style/numeric_predicate.rb +58 -11
- data/lib/rubocop/cop/style/object_then.rb +74 -0
- data/lib/rubocop/cop/style/one_line_conditional.rb +19 -40
- data/lib/rubocop/cop/style/open_struct_use.rb +69 -0
- data/lib/rubocop/cop/style/operator_method_call.rb +53 -0
- data/lib/rubocop/cop/style/option_hash.rb +1 -1
- data/lib/rubocop/cop/style/optional_arguments.rb +5 -1
- data/lib/rubocop/cop/style/optional_boolean_parameter.rb +16 -5
- data/lib/rubocop/cop/style/or_assignment.rb +1 -1
- data/lib/rubocop/cop/style/parallel_assignment.rb +1 -1
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +13 -3
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/percent_q_literals.rb +3 -3
- data/lib/rubocop/cop/style/perl_backrefs.rb +23 -2
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +9 -4
- data/lib/rubocop/cop/style/proc.rb +5 -2
- data/lib/rubocop/cop/style/quoted_symbols.rb +22 -8
- data/lib/rubocop/cop/style/raise_args.rb +11 -5
- data/lib/rubocop/cop/style/random_with_offset.rb +1 -1
- data/lib/rubocop/cop/style/redundant_argument.rb +24 -11
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +46 -11
- data/lib/rubocop/cop/style/redundant_capital_w.rb +2 -3
- data/lib/rubocop/cop/style/redundant_condition.rb +134 -16
- data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
- data/lib/rubocop/cop/style/redundant_constant_base.rb +72 -0
- data/lib/rubocop/cop/style/redundant_each.rb +116 -0
- data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +6 -2
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +13 -4
- data/lib/rubocop/cop/style/redundant_freeze.rb +5 -5
- data/lib/rubocop/cop/style/redundant_initialize.rb +156 -0
- data/lib/rubocop/cop/style/redundant_interpolation.rb +40 -5
- data/lib/rubocop/cop/style/redundant_parentheses.rb +22 -24
- data/lib/rubocop/cop/style/redundant_percent_q.rb +3 -4
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +20 -4
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +14 -5
- data/lib/rubocop/cop/style/redundant_return.rb +9 -2
- data/lib/rubocop/cop/style/redundant_self.rb +14 -2
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +7 -7
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +24 -29
- data/lib/rubocop/cop/style/redundant_sort.rb +69 -21
- data/lib/rubocop/cop/style/redundant_sort_by.rb +25 -9
- data/lib/rubocop/cop/style/redundant_string_escape.rb +181 -0
- data/lib/rubocop/cop/style/regexp_literal.rb +4 -4
- data/lib/rubocop/cop/style/require_order.rb +88 -0
- data/lib/rubocop/cop/style/rescue_modifier.rb +2 -2
- data/lib/rubocop/cop/style/rescue_standard_error.rb +13 -13
- data/lib/rubocop/cop/style/return_nil.rb +3 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +69 -23
- data/lib/rubocop/cop/style/sample.rb +6 -4
- data/lib/rubocop/cop/style/select_by_regexp.rb +148 -0
- data/lib/rubocop/cop/style/self_assignment.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +28 -4
- data/lib/rubocop/cop/style/send.rb +1 -1
- data/lib/rubocop/cop/style/signal_exception.rb +1 -1
- data/lib/rubocop/cop/style/single_argument_dig.rb +10 -0
- data/lib/rubocop/cop/style/single_line_block_params.rb +4 -4
- data/lib/rubocop/cop/style/single_line_methods.rb +2 -2
- data/lib/rubocop/cop/style/slicing_with_range.rb +14 -1
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +103 -31
- data/lib/rubocop/cop/style/special_global_vars.rb +70 -8
- data/lib/rubocop/cop/style/static_class.rb +38 -7
- data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
- data/lib/rubocop/cop/style/string_chars.rb +4 -2
- data/lib/rubocop/cop/style/string_concatenation.rb +17 -8
- data/lib/rubocop/cop/style/string_hash_keys.rb +5 -1
- data/lib/rubocop/cop/style/string_literals.rb +1 -5
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +1 -1
- data/lib/rubocop/cop/style/string_methods.rb +1 -1
- data/lib/rubocop/cop/style/strip.rb +1 -1
- data/lib/rubocop/cop/style/struct_inheritance.rb +7 -3
- data/lib/rubocop/cop/style/swap_values.rb +8 -4
- data/lib/rubocop/cop/style/symbol_array.rb +12 -7
- data/lib/rubocop/cop/style/symbol_literal.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +90 -8
- data/lib/rubocop/cop/style/ternary_parentheses.rb +19 -18
- data/lib/rubocop/cop/style/top_level_method_definition.rb +3 -1
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +1 -1
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +1 -1
- data/lib/rubocop/cop/style/trailing_body_on_module.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +2 -2
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +21 -2
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +2 -2
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +2 -5
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +1 -1
- data/lib/rubocop/cop/style/trivial_accessors.rb +12 -10
- data/lib/rubocop/cop/style/unless_else.rb +5 -1
- data/lib/rubocop/cop/style/unless_logical_operators.rb +1 -1
- data/lib/rubocop/cop/style/unpack_first.rb +5 -2
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
- data/lib/rubocop/cop/style/when_then.rb +1 -1
- data/lib/rubocop/cop/style/word_array.rb +7 -6
- data/lib/rubocop/cop/style/yoda_condition.rb +25 -8
- data/lib/rubocop/cop/style/zero_length_predicate.rb +7 -1
- data/lib/rubocop/cop/team.rb +7 -8
- data/lib/rubocop/cop/util.rb +25 -6
- data/lib/rubocop/cop/variable_force/assignment.rb +1 -1
- data/lib/rubocop/cop/variable_force/branch.rb +1 -1
- data/lib/rubocop/cop/variable_force/variable_table.rb +1 -1
- data/lib/rubocop/cop/variable_force.rb +21 -34
- data/lib/rubocop/cops_documentation_generator.rb +40 -10
- data/lib/rubocop/ext/processed_source.rb +2 -0
- data/lib/rubocop/ext/range.rb +15 -0
- data/lib/rubocop/feature_loader.rb +94 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +45 -11
- data/lib/rubocop/formatter/formatter_set.rb +20 -18
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +15 -2
- data/lib/rubocop/formatter/html_formatter.rb +11 -16
- data/lib/rubocop/formatter/json_formatter.rb +4 -1
- data/lib/rubocop/formatter/markdown_formatter.rb +78 -0
- data/lib/rubocop/formatter/offense_count_formatter.rb +15 -6
- data/lib/rubocop/formatter/simple_text_formatter.rb +9 -8
- data/lib/rubocop/formatter/tap_formatter.rb +1 -1
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +6 -4
- data/lib/rubocop/formatter.rb +33 -0
- data/lib/rubocop/magic_comment.rb +74 -19
- data/lib/rubocop/optimized_patterns.rb +38 -0
- data/lib/rubocop/options.rb +258 -152
- data/lib/rubocop/path_util.rb +14 -2
- data/lib/rubocop/rake_task.rb +35 -10
- data/lib/rubocop/remote_config.rb +2 -4
- data/lib/rubocop/result_cache.rb +28 -17
- data/lib/rubocop/rspec/cop_helper.rb +27 -4
- data/lib/rubocop/rspec/expect_offense.rb +9 -5
- data/lib/rubocop/rspec/parallel_formatter.rb +90 -0
- data/lib/rubocop/rspec/shared_contexts.rb +47 -10
- data/lib/rubocop/rspec/support.rb +16 -1
- data/lib/rubocop/runner.rb +59 -22
- data/lib/rubocop/server/cache.rb +148 -0
- data/lib/rubocop/server/cli.rb +128 -0
- data/lib/rubocop/server/client_command/base.rb +44 -0
- data/lib/rubocop/server/client_command/exec.rb +64 -0
- data/lib/rubocop/server/client_command/restart.rb +25 -0
- data/lib/rubocop/server/client_command/start.rb +43 -0
- data/lib/rubocop/server/client_command/status.rb +28 -0
- data/lib/rubocop/server/client_command/stop.rb +31 -0
- data/lib/rubocop/server/client_command.rb +26 -0
- data/lib/rubocop/server/core.rb +96 -0
- data/lib/rubocop/server/errors.rb +23 -0
- data/lib/rubocop/server/helper.rb +34 -0
- data/lib/rubocop/server/server_command/base.rb +50 -0
- data/lib/rubocop/server/server_command/exec.rb +34 -0
- data/lib/rubocop/server/server_command/stop.rb +24 -0
- data/lib/rubocop/server/server_command.rb +21 -0
- data/lib/rubocop/server/socket_reader.rb +69 -0
- data/lib/rubocop/server.rb +53 -0
- data/lib/rubocop/string_interpreter.rb +4 -4
- data/lib/rubocop/target_finder.rb +1 -1
- data/lib/rubocop/target_ruby.rb +15 -7
- data/lib/rubocop/version.rb +22 -9
- data/lib/rubocop/yaml_duplication_checker.rb +1 -1
- data/lib/rubocop.rb +64 -37
- metadata +116 -14
- data/lib/rubocop/cop/gemspec/date_assignment.rb +0 -57
- data/lib/rubocop/cop/mixin/ignored_methods.rb +0 -52
- data/lib/rubocop/cop/mixin/ignored_pattern.rb +0 -29
data/config/default.yml
CHANGED
@@ -78,6 +78,8 @@ AllCops:
|
|
78
78
|
# When specifying style guide URLs, any paths and/or fragments will be
|
79
79
|
# evaluated relative to the base URL.
|
80
80
|
StyleGuideBaseURL: https://rubystyle.guide
|
81
|
+
# Documentation URLs will be constructed using the base URL.
|
82
|
+
DocumentationBaseURL: https://docs.rubocop.org/rubocop
|
81
83
|
# Extra details are not displayed in offense messages by default. Change
|
82
84
|
# behavior by overriding ExtraDetails, or by giving the
|
83
85
|
# `-E/--extra-details` option.
|
@@ -130,7 +132,7 @@ AllCops:
|
|
130
132
|
# What MRI version of the Ruby interpreter is the inspected code intended to
|
131
133
|
# run on? (If there is more than one, set this to the lowest version.)
|
132
134
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
133
|
-
# values are
|
135
|
+
# values are specified as a float (i.e. 3.0); the teeny version of Ruby
|
134
136
|
# should not be included. If the project specifies a Ruby version in the
|
135
137
|
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
136
138
|
# try to determine the desired version of Ruby by inspecting the
|
@@ -138,7 +140,7 @@ AllCops:
|
|
138
140
|
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
139
141
|
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
140
142
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
141
|
-
# supported Ruby version (currently Ruby 2.
|
143
|
+
# supported Ruby version (currently Ruby 2.6).
|
142
144
|
TargetRubyVersion: ~
|
143
145
|
# Determines if a notification for extension libraries should be shown when
|
144
146
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
@@ -150,13 +152,18 @@ AllCops:
|
|
150
152
|
rubocop-minitest: [minitest]
|
151
153
|
rubocop-sequel: [sequel]
|
152
154
|
rubocop-rake: [rake]
|
155
|
+
rubocop-graphql: [graphql]
|
156
|
+
# Enable/Disable checking the methods extended by Active Support.
|
157
|
+
ActiveSupportExtensionsEnabled: false
|
153
158
|
|
154
159
|
#################### Bundler ###############################
|
155
160
|
|
156
161
|
Bundler/DuplicatedGem:
|
157
162
|
Description: 'Checks for duplicate gem entries in Gemfile.'
|
158
163
|
Enabled: true
|
164
|
+
Severity: warning
|
159
165
|
VersionAdded: '0.46'
|
166
|
+
VersionChanged: '1.40'
|
160
167
|
Include:
|
161
168
|
- '**/*.gemfile'
|
162
169
|
- '**/Gemfile'
|
@@ -174,6 +181,20 @@ Bundler/GemComment:
|
|
174
181
|
IgnoredGems: []
|
175
182
|
OnlyFor: []
|
176
183
|
|
184
|
+
Bundler/GemFilename:
|
185
|
+
Description: 'Enforces the filename for managing gems.'
|
186
|
+
Enabled: true
|
187
|
+
VersionAdded: '1.20'
|
188
|
+
EnforcedStyle: 'Gemfile'
|
189
|
+
SupportedStyles:
|
190
|
+
- 'Gemfile'
|
191
|
+
- 'gems.rb'
|
192
|
+
Include:
|
193
|
+
- '**/Gemfile'
|
194
|
+
- '**/gems.rb'
|
195
|
+
- '**/Gemfile.lock'
|
196
|
+
- '**/gems.locked'
|
197
|
+
|
177
198
|
Bundler/GemVersion:
|
178
199
|
Description: 'Requires or forbids specifying gem versions.'
|
179
200
|
Enabled: false
|
@@ -194,7 +215,10 @@ Bundler/InsecureProtocolSource:
|
|
194
215
|
because HTTP requests are insecure. Please change your source to
|
195
216
|
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
|
196
217
|
Enabled: true
|
218
|
+
Severity: warning
|
197
219
|
VersionAdded: '0.50'
|
220
|
+
VersionChanged: '1.40'
|
221
|
+
AllowHttpProtocol: true
|
198
222
|
Include:
|
199
223
|
- '**/*.gemfile'
|
200
224
|
- '**/Gemfile'
|
@@ -217,17 +241,33 @@ Bundler/OrderedGems:
|
|
217
241
|
|
218
242
|
#################### Gemspec ###############################
|
219
243
|
|
220
|
-
Gemspec/
|
221
|
-
Description: '
|
244
|
+
Gemspec/DependencyVersion:
|
245
|
+
Description: 'Requires or forbids specifying gem dependency versions.'
|
246
|
+
Enabled: false
|
247
|
+
VersionAdded: '1.29'
|
248
|
+
EnforcedStyle: 'required'
|
249
|
+
SupportedStyles:
|
250
|
+
- 'required'
|
251
|
+
- 'forbidden'
|
252
|
+
Include:
|
253
|
+
- '**/*.gemspec'
|
254
|
+
AllowedGems: []
|
255
|
+
|
256
|
+
Gemspec/DeprecatedAttributeAssignment:
|
257
|
+
Description: Checks that deprecated attribute assignments are not set in a gemspec file.
|
222
258
|
Enabled: pending
|
223
|
-
|
259
|
+
Severity: warning
|
260
|
+
VersionAdded: '1.30'
|
261
|
+
VersionChanged: '1.40'
|
224
262
|
Include:
|
225
263
|
- '**/*.gemspec'
|
226
264
|
|
227
265
|
Gemspec/DuplicatedAssignment:
|
228
266
|
Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
|
229
267
|
Enabled: true
|
268
|
+
Severity: warning
|
230
269
|
VersionAdded: '0.52'
|
270
|
+
VersionChanged: '1.40'
|
231
271
|
Include:
|
232
272
|
- '**/*.gemspec'
|
233
273
|
|
@@ -243,11 +283,23 @@ Gemspec/OrderedDependencies:
|
|
243
283
|
Include:
|
244
284
|
- '**/*.gemspec'
|
245
285
|
|
286
|
+
Gemspec/RequireMFA:
|
287
|
+
Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
|
288
|
+
Enabled: pending
|
289
|
+
Severity: warning
|
290
|
+
VersionAdded: '1.23'
|
291
|
+
VersionChanged: '1.40'
|
292
|
+
Reference:
|
293
|
+
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
294
|
+
Include:
|
295
|
+
- '**/*.gemspec'
|
296
|
+
|
246
297
|
Gemspec/RequiredRubyVersion:
|
247
298
|
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
248
299
|
Enabled: true
|
300
|
+
Severity: warning
|
249
301
|
VersionAdded: '0.52'
|
250
|
-
VersionChanged: '
|
302
|
+
VersionChanged: '1.40'
|
251
303
|
Include:
|
252
304
|
- '**/*.gemspec'
|
253
305
|
|
@@ -255,7 +307,9 @@ Gemspec/RubyVersionGlobalsUsage:
|
|
255
307
|
Description: Checks usage of RUBY_VERSION in gemspec.
|
256
308
|
StyleGuide: '#no-ruby-version-in-the-gemspec'
|
257
309
|
Enabled: true
|
310
|
+
Severity: warning
|
258
311
|
VersionAdded: '0.72'
|
312
|
+
VersionChanged: '1.40'
|
259
313
|
Include:
|
260
314
|
- '**/*.gemspec'
|
261
315
|
|
@@ -337,8 +391,9 @@ Layout/AssignmentIndentation:
|
|
337
391
|
Checks the indentation of the first line of the
|
338
392
|
right-hand-side of a multi-line assignment.
|
339
393
|
Enabled: true
|
394
|
+
SafeAutoCorrect: false
|
340
395
|
VersionAdded: '0.49'
|
341
|
-
VersionChanged: '
|
396
|
+
VersionChanged: '1.40'
|
342
397
|
# By default the indentation width from `Layout/IndentationWidth` is used,
|
343
398
|
# but it can be overridden by setting this parameter.
|
344
399
|
IndentationWidth: ~
|
@@ -403,13 +458,13 @@ Layout/ClassStructure:
|
|
403
458
|
- prepend
|
404
459
|
- extend
|
405
460
|
ExpectedOrder:
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
461
|
+
- module_inclusion
|
462
|
+
- constants
|
463
|
+
- public_class_methods
|
464
|
+
- initializer
|
465
|
+
- public_methods
|
466
|
+
- protected_methods
|
467
|
+
- private_methods
|
413
468
|
|
414
469
|
Layout/ClosingHeredocIndentation:
|
415
470
|
Description: 'Checks the indentation of here document closings.'
|
@@ -424,7 +479,11 @@ Layout/ClosingParenthesisIndentation:
|
|
424
479
|
Layout/CommentIndentation:
|
425
480
|
Description: 'Indentation of comments.'
|
426
481
|
Enabled: true
|
482
|
+
# When true, allows comments to have extra indentation if that aligns them
|
483
|
+
# with a comment on the preceding line.
|
484
|
+
AllowForAlignment: false
|
427
485
|
VersionAdded: '0.49'
|
486
|
+
VersionChanged: '1.24'
|
428
487
|
|
429
488
|
Layout/ConditionPosition:
|
430
489
|
Description: >-
|
@@ -496,13 +555,13 @@ Layout/EmptyLineBetweenDefs:
|
|
496
555
|
StyleGuide: '#empty-lines-between-methods'
|
497
556
|
Enabled: true
|
498
557
|
VersionAdded: '0.49'
|
499
|
-
VersionChanged: '1.
|
558
|
+
VersionChanged: '1.23'
|
500
559
|
EmptyLineBetweenMethodDefs: true
|
501
560
|
EmptyLineBetweenClassDefs: true
|
502
561
|
EmptyLineBetweenModuleDefs: true
|
503
|
-
#
|
504
|
-
# need an empty line between them.
|
505
|
-
AllowAdjacentOneLineDefs:
|
562
|
+
# `AllowAdjacentOneLineDefs` means that single line method definitions don't
|
563
|
+
# need an empty line between them. `true` by default.
|
564
|
+
AllowAdjacentOneLineDefs: true
|
506
565
|
# Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
|
507
566
|
NumberOfEmptyLines: 1
|
508
567
|
|
@@ -852,7 +911,7 @@ Layout/HeredocArgumentClosingParenthesis:
|
|
852
911
|
VersionAdded: '0.68'
|
853
912
|
|
854
913
|
Layout/HeredocIndentation:
|
855
|
-
Description: '
|
914
|
+
Description: 'Checks the indentation of the here document bodies.'
|
856
915
|
StyleGuide: '#squiggly-heredocs'
|
857
916
|
Enabled: true
|
858
917
|
VersionAdded: '0.49'
|
@@ -885,7 +944,7 @@ Layout/IndentationStyle:
|
|
885
944
|
VersionChanged: '0.82'
|
886
945
|
# By default the indentation width from `Layout/IndentationWidth` is used,
|
887
946
|
# but it can be overridden by setting this parameter.
|
888
|
-
# It is used during
|
947
|
+
# It is used during autocorrection to determine how many spaces should
|
889
948
|
# replace each tab.
|
890
949
|
IndentationWidth: ~
|
891
950
|
EnforcedStyle: spaces
|
@@ -900,7 +959,8 @@ Layout/IndentationWidth:
|
|
900
959
|
VersionAdded: '0.49'
|
901
960
|
# Number of spaces for each indentation level.
|
902
961
|
Width: 2
|
903
|
-
|
962
|
+
AllowedPatterns: []
|
963
|
+
IgnoredPatterns: [] # deprecated
|
904
964
|
|
905
965
|
Layout/InitialIndentation:
|
906
966
|
Description: >-
|
@@ -923,6 +983,31 @@ Layout/LeadingEmptyLines:
|
|
923
983
|
VersionAdded: '0.57'
|
924
984
|
VersionChanged: '0.77'
|
925
985
|
|
986
|
+
Layout/LineContinuationLeadingSpace:
|
987
|
+
Description: >-
|
988
|
+
Use trailing spaces instead of leading spaces in strings
|
989
|
+
broken over multiple lines (by a backslash).
|
990
|
+
Enabled: pending
|
991
|
+
AutoCorrect: false
|
992
|
+
SafeAutoCorrect: false
|
993
|
+
VersionAdded: '1.31'
|
994
|
+
VersionChanged: '1.32'
|
995
|
+
EnforcedStyle: trailing
|
996
|
+
SupportedStyles:
|
997
|
+
- leading
|
998
|
+
- trailing
|
999
|
+
|
1000
|
+
Layout/LineContinuationSpacing:
|
1001
|
+
Description: 'Checks the spacing in front of backslash in line continuations.'
|
1002
|
+
Enabled: pending
|
1003
|
+
AutoCorrect: true
|
1004
|
+
SafeAutoCorrect: true
|
1005
|
+
VersionAdded: '1.31'
|
1006
|
+
EnforcedStyle: space
|
1007
|
+
SupportedStyles:
|
1008
|
+
- space
|
1009
|
+
- no_space
|
1010
|
+
|
926
1011
|
Layout/LineEndStringConcatenationIndentation:
|
927
1012
|
Description: >-
|
928
1013
|
Checks the indentation of the next line after a line that
|
@@ -943,7 +1028,6 @@ Layout/LineLength:
|
|
943
1028
|
Enabled: true
|
944
1029
|
VersionAdded: '0.25'
|
945
1030
|
VersionChanged: '1.4'
|
946
|
-
AutoCorrect: true
|
947
1031
|
Max: 120
|
948
1032
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
949
1033
|
# containing a URI to be longer than Max.
|
@@ -955,10 +1039,11 @@ Layout/LineLength:
|
|
955
1039
|
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
956
1040
|
# directives like '# rubocop: enable ...' when calculating a line's length.
|
957
1041
|
IgnoreCopDirectives: true
|
958
|
-
# The
|
1042
|
+
# The AllowedPatterns option is a list of !ruby/regexp and/or string
|
959
1043
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
960
1044
|
# any regular expression listed in this option will be ignored by LineLength.
|
961
|
-
|
1045
|
+
AllowedPatterns: []
|
1046
|
+
IgnoredPatterns: [] # deprecated
|
962
1047
|
|
963
1048
|
Layout/MultilineArrayBraceLayout:
|
964
1049
|
Description: >-
|
@@ -1087,6 +1172,13 @@ Layout/MultilineMethodDefinitionBraceLayout:
|
|
1087
1172
|
- new_line
|
1088
1173
|
- same_line
|
1089
1174
|
|
1175
|
+
Layout/MultilineMethodParameterLineBreaks:
|
1176
|
+
Description: >-
|
1177
|
+
Checks that each parameter in a multi-line method definition
|
1178
|
+
starts on a separate line.
|
1179
|
+
Enabled: false
|
1180
|
+
VersionAdded: '1.32'
|
1181
|
+
|
1090
1182
|
Layout/MultilineOperationIndentation:
|
1091
1183
|
Description: >-
|
1092
1184
|
Checks indentation of binary operations that span more than
|
@@ -1347,10 +1439,11 @@ Layout/SpaceInsideParens:
|
|
1347
1439
|
StyleGuide: '#spaces-braces'
|
1348
1440
|
Enabled: true
|
1349
1441
|
VersionAdded: '0.49'
|
1350
|
-
VersionChanged: '
|
1442
|
+
VersionChanged: '1.22'
|
1351
1443
|
EnforcedStyle: no_space
|
1352
1444
|
SupportedStyles:
|
1353
1445
|
- space
|
1446
|
+
- compact
|
1354
1447
|
- no_space
|
1355
1448
|
|
1356
1449
|
Layout/SpaceInsidePercentLiteralDelimiters:
|
@@ -1423,7 +1516,9 @@ Lint/AmbiguousBlockAssociation:
|
|
1423
1516
|
Enabled: true
|
1424
1517
|
VersionAdded: '0.48'
|
1425
1518
|
VersionChanged: '1.13'
|
1426
|
-
|
1519
|
+
AllowedMethods: []
|
1520
|
+
AllowedPatterns: []
|
1521
|
+
IgnoredMethods: [] # deprecated
|
1427
1522
|
|
1428
1523
|
Lint/AmbiguousOperator:
|
1429
1524
|
Description: >-
|
@@ -1434,6 +1529,13 @@ Lint/AmbiguousOperator:
|
|
1434
1529
|
VersionAdded: '0.17'
|
1435
1530
|
VersionChanged: '0.83'
|
1436
1531
|
|
1532
|
+
Lint/AmbiguousOperatorPrecedence:
|
1533
|
+
Description: >-
|
1534
|
+
Checks for expressions containing multiple binary operations with
|
1535
|
+
ambiguous precedence.
|
1536
|
+
Enabled: pending
|
1537
|
+
VersionAdded: '1.21'
|
1538
|
+
|
1437
1539
|
Lint/AmbiguousRange:
|
1438
1540
|
Description: Checks for ranges with ambiguous boundaries.
|
1439
1541
|
Enabled: pending
|
@@ -1462,7 +1564,7 @@ Lint/BigDecimalNew:
|
|
1462
1564
|
VersionAdded: '0.53'
|
1463
1565
|
|
1464
1566
|
Lint/BinaryOperatorWithIdenticalOperands:
|
1465
|
-
Description: '
|
1567
|
+
Description: 'Checks for places where binary operator has identical operands.'
|
1466
1568
|
Enabled: true
|
1467
1569
|
Safe: false
|
1468
1570
|
VersionAdded: '0.89'
|
@@ -1471,9 +1573,9 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1471
1573
|
Lint/BooleanSymbol:
|
1472
1574
|
Description: 'Check for `:true` and `:false` symbols.'
|
1473
1575
|
Enabled: true
|
1474
|
-
|
1576
|
+
SafeAutoCorrect: false
|
1475
1577
|
VersionAdded: '0.50'
|
1476
|
-
VersionChanged: '
|
1578
|
+
VersionChanged: '1.22'
|
1477
1579
|
|
1478
1580
|
Lint/CircularArgumentReference:
|
1479
1581
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
@@ -1491,6 +1593,11 @@ Lint/ConstantDefinitionInBlock:
|
|
1491
1593
|
AllowedMethods:
|
1492
1594
|
- enums
|
1493
1595
|
|
1596
|
+
Lint/ConstantOverwrittenInRescue:
|
1597
|
+
Description: 'Checks for overwriting an exception with an exception result by use `rescue =>`.'
|
1598
|
+
Enabled: pending
|
1599
|
+
VersionAdded: '1.31'
|
1600
|
+
|
1494
1601
|
Lint/ConstantResolution:
|
1495
1602
|
Description: 'Check that constants are fully qualified with `::`.'
|
1496
1603
|
Enabled: false
|
@@ -1511,6 +1618,7 @@ Lint/Debugger:
|
|
1511
1618
|
# a user's configuration, but are otherwise not significant.
|
1512
1619
|
Kernel:
|
1513
1620
|
- binding.irb
|
1621
|
+
- Kernel.binding.irb
|
1514
1622
|
Byebug:
|
1515
1623
|
- byebug
|
1516
1624
|
- remote_byebug
|
@@ -1519,14 +1627,24 @@ Lint/Debugger:
|
|
1519
1627
|
Capybara:
|
1520
1628
|
- save_and_open_page
|
1521
1629
|
- save_and_open_screenshot
|
1630
|
+
debug.rb:
|
1631
|
+
- binding.b
|
1632
|
+
- binding.break
|
1633
|
+
- Kernel.binding.b
|
1634
|
+
- Kernel.binding.break
|
1522
1635
|
Pry:
|
1523
1636
|
- binding.pry
|
1524
1637
|
- binding.remote_pry
|
1525
1638
|
- binding.pry_remote
|
1639
|
+
- Kernel.binding.pry
|
1640
|
+
- Kernel.binding.remote_pry
|
1641
|
+
- Kernel.binding.pry_remote
|
1526
1642
|
- Pry.rescue
|
1527
1643
|
Rails:
|
1528
1644
|
- debugger
|
1529
1645
|
- Kernel.debugger
|
1646
|
+
RubyJard:
|
1647
|
+
- jard
|
1530
1648
|
WebConsole:
|
1531
1649
|
- binding.console
|
1532
1650
|
|
@@ -1539,6 +1657,7 @@ Lint/DeprecatedConstants:
|
|
1539
1657
|
Description: 'Checks for deprecated constants.'
|
1540
1658
|
Enabled: pending
|
1541
1659
|
VersionAdded: '1.8'
|
1660
|
+
VersionChanged: '1.40'
|
1542
1661
|
# You can configure deprecated constants.
|
1543
1662
|
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1544
1663
|
# And you can set the deprecated version as `DeprecatedVersion`.
|
@@ -1559,9 +1678,18 @@ Lint/DeprecatedConstants:
|
|
1559
1678
|
'FALSE':
|
1560
1679
|
Alternative: 'false'
|
1561
1680
|
DeprecatedVersion: '2.4'
|
1681
|
+
'Net::HTTPServerException':
|
1682
|
+
Alternative: 'Net::HTTPClientException'
|
1683
|
+
DeprecatedVersion: '2.6'
|
1562
1684
|
'Random::DEFAULT':
|
1563
1685
|
Alternative: 'Random.new'
|
1564
1686
|
DeprecatedVersion: '3.0'
|
1687
|
+
'Struct::Group':
|
1688
|
+
Alternative: 'Etc::Group'
|
1689
|
+
DeprecatedVersion: '3.0'
|
1690
|
+
'Struct::Passwd':
|
1691
|
+
Alternative: 'Etc::Passwd'
|
1692
|
+
DeprecatedVersion: '3.0'
|
1565
1693
|
|
1566
1694
|
Lint/DeprecatedOpenSSLConstant:
|
1567
1695
|
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
@@ -1599,6 +1727,11 @@ Lint/DuplicateHashKey:
|
|
1599
1727
|
VersionAdded: '0.34'
|
1600
1728
|
VersionChanged: '0.77'
|
1601
1729
|
|
1730
|
+
Lint/DuplicateMagicComment:
|
1731
|
+
Description: 'Check for duplicated magic comments.'
|
1732
|
+
Enabled: pending
|
1733
|
+
VersionAdded: '1.37'
|
1734
|
+
|
1602
1735
|
Lint/DuplicateMethods:
|
1603
1736
|
Description: 'Check for duplicate method definitions.'
|
1604
1737
|
Enabled: true
|
@@ -1612,7 +1745,9 @@ Lint/DuplicateRegexpCharacterClassElement:
|
|
1612
1745
|
Lint/DuplicateRequire:
|
1613
1746
|
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1614
1747
|
Enabled: true
|
1748
|
+
SafeAutoCorrect: false
|
1615
1749
|
VersionAdded: '0.90'
|
1750
|
+
VersionChanged: '1.28'
|
1616
1751
|
|
1617
1752
|
Lint/DuplicateRescueException:
|
1618
1753
|
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
@@ -1631,7 +1766,7 @@ Lint/ElseLayout:
|
|
1631
1766
|
VersionChanged: '1.2'
|
1632
1767
|
|
1633
1768
|
Lint/EmptyBlock:
|
1634
|
-
Description: '
|
1769
|
+
Description: 'Checks for blocks without a body.'
|
1635
1770
|
Enabled: pending
|
1636
1771
|
VersionAdded: '1.1'
|
1637
1772
|
VersionChanged: '1.15'
|
@@ -1645,10 +1780,12 @@ Lint/EmptyClass:
|
|
1645
1780
|
AllowComments: false
|
1646
1781
|
|
1647
1782
|
Lint/EmptyConditionalBody:
|
1648
|
-
Description: '
|
1783
|
+
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1649
1784
|
Enabled: true
|
1785
|
+
SafeAutoCorrect: false
|
1650
1786
|
AllowComments: true
|
1651
1787
|
VersionAdded: '0.89'
|
1788
|
+
VersionChanged: '1.34'
|
1652
1789
|
|
1653
1790
|
Lint/EmptyEnsure:
|
1654
1791
|
Description: 'Checks for empty ensure block.'
|
@@ -1750,6 +1887,13 @@ Lint/ImplicitStringConcatenation:
|
|
1750
1887
|
Enabled: true
|
1751
1888
|
VersionAdded: '0.36'
|
1752
1889
|
|
1890
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
1891
|
+
Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
|
1892
|
+
Enabled: pending
|
1893
|
+
SafeAutoCorrect: false
|
1894
|
+
VersionAdded: '1.21'
|
1895
|
+
VersionChanged: '1.24'
|
1896
|
+
|
1753
1897
|
Lint/IneffectiveAccessModifier:
|
1754
1898
|
Description: >-
|
1755
1899
|
Checks for attempts to use `private` or `protected` to set
|
@@ -1760,19 +1904,21 @@ Lint/IneffectiveAccessModifier:
|
|
1760
1904
|
Lint/InheritException:
|
1761
1905
|
Description: 'Avoid inheriting from the `Exception` class.'
|
1762
1906
|
Enabled: true
|
1907
|
+
SafeAutoCorrect: false
|
1763
1908
|
VersionAdded: '0.41'
|
1909
|
+
VersionChanged: '1.26'
|
1764
1910
|
# The default base class in favour of `Exception`.
|
1765
|
-
EnforcedStyle:
|
1911
|
+
EnforcedStyle: standard_error
|
1766
1912
|
SupportedStyles:
|
1767
|
-
- runtime_error
|
1768
1913
|
- standard_error
|
1914
|
+
- runtime_error
|
1769
1915
|
|
1770
1916
|
Lint/InterpolationCheck:
|
1771
|
-
Description: '
|
1917
|
+
Description: 'Checks for interpolation in a single quoted string.'
|
1772
1918
|
Enabled: true
|
1773
|
-
|
1919
|
+
SafeAutoCorrect: false
|
1774
1920
|
VersionAdded: '0.50'
|
1775
|
-
VersionChanged: '
|
1921
|
+
VersionChanged: '1.40'
|
1776
1922
|
|
1777
1923
|
Lint/LambdaWithoutLiteralBlock:
|
1778
1924
|
Description: 'Checks uses of lambda without a literal block.'
|
@@ -1815,7 +1961,7 @@ Lint/MissingCopEnableDirective:
|
|
1815
1961
|
|
1816
1962
|
Lint/MissingSuper:
|
1817
1963
|
Description: >-
|
1818
|
-
|
1964
|
+
Checks for the presence of constructors and lifecycle callbacks
|
1819
1965
|
without calls to `super`.
|
1820
1966
|
Enabled: true
|
1821
1967
|
VersionAdded: '0.89'
|
@@ -1836,6 +1982,8 @@ Lint/NestedMethodDefinition:
|
|
1836
1982
|
Description: 'Do not use nested method definitions.'
|
1837
1983
|
StyleGuide: '#no-nested-methods'
|
1838
1984
|
Enabled: true
|
1985
|
+
AllowedMethods: []
|
1986
|
+
AllowedPatterns: []
|
1839
1987
|
VersionAdded: '0.32'
|
1840
1988
|
|
1841
1989
|
Lint/NestedPercentLiteral:
|
@@ -1844,7 +1992,7 @@ Lint/NestedPercentLiteral:
|
|
1844
1992
|
VersionAdded: '0.52'
|
1845
1993
|
|
1846
1994
|
Lint/NextWithoutAccumulator:
|
1847
|
-
Description:
|
1995
|
+
Description: >-
|
1848
1996
|
Do not omit the accumulator when calling `next`
|
1849
1997
|
in a `reduce`/`inject` block.
|
1850
1998
|
Enabled: true
|
@@ -1855,6 +2003,13 @@ Lint/NoReturnInBeginEndBlocks:
|
|
1855
2003
|
Enabled: pending
|
1856
2004
|
VersionAdded: '1.2'
|
1857
2005
|
|
2006
|
+
Lint/NonAtomicFileOperation:
|
2007
|
+
Description: Checks for non-atomic file operations.
|
2008
|
+
StyleGuide: '#atomic-file-operations'
|
2009
|
+
Enabled: pending
|
2010
|
+
VersionAdded: '1.31'
|
2011
|
+
SafeAutoCorrect: false
|
2012
|
+
|
1858
2013
|
Lint/NonDeterministicRequireOrder:
|
1859
2014
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1860
2015
|
Enabled: true
|
@@ -1872,7 +2027,9 @@ Lint/NumberConversion:
|
|
1872
2027
|
VersionAdded: '0.53'
|
1873
2028
|
VersionChanged: '1.1'
|
1874
2029
|
SafeAutoCorrect: false
|
1875
|
-
|
2030
|
+
AllowedMethods: []
|
2031
|
+
AllowedPatterns: []
|
2032
|
+
IgnoredMethods: [] # deprecated
|
1876
2033
|
IgnoredClasses:
|
1877
2034
|
- Time
|
1878
2035
|
- DateTime
|
@@ -1891,7 +2048,9 @@ Lint/OrAssignmentToConstant:
|
|
1891
2048
|
Lint/OrderedMagicComments:
|
1892
2049
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
1893
2050
|
Enabled: true
|
2051
|
+
SafeAutoCorrect: false
|
1894
2052
|
VersionAdded: '0.53'
|
2053
|
+
VersionChanged: '1.37'
|
1895
2054
|
|
1896
2055
|
Lint/OutOfRangeRegexpRef:
|
1897
2056
|
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
@@ -1955,6 +2114,8 @@ Lint/RedundantDirGlobSort:
|
|
1955
2114
|
Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
|
1956
2115
|
Enabled: pending
|
1957
2116
|
VersionAdded: '1.8'
|
2117
|
+
VersionChanged: '1.26'
|
2118
|
+
SafeAutoCorrect: false
|
1958
2119
|
|
1959
2120
|
Lint/RedundantRequireStatement:
|
1960
2121
|
Description: 'Checks for unnecessary `require` statement.'
|
@@ -1998,6 +2159,12 @@ Lint/RedundantWithObject:
|
|
1998
2159
|
Enabled: true
|
1999
2160
|
VersionAdded: '0.51'
|
2000
2161
|
|
2162
|
+
Lint/RefinementImportMethods:
|
2163
|
+
Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
|
2164
|
+
Enabled: pending
|
2165
|
+
SafeAutoCorrect: false
|
2166
|
+
VersionAdded: '1.27'
|
2167
|
+
|
2001
2168
|
Lint/RegexpAsCondition:
|
2002
2169
|
Description: >-
|
2003
2170
|
Do not use regexp literal as a condition.
|
@@ -2013,6 +2180,16 @@ Lint/RequireParentheses:
|
|
2013
2180
|
Enabled: true
|
2014
2181
|
VersionAdded: '0.18'
|
2015
2182
|
|
2183
|
+
Lint/RequireRangeParentheses:
|
2184
|
+
Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
|
2185
|
+
Enabled: pending
|
2186
|
+
VersionAdded: '1.32'
|
2187
|
+
|
2188
|
+
Lint/RequireRelativeSelfPath:
|
2189
|
+
Description: 'Checks for uses a file requiring itself with `require_relative`.'
|
2190
|
+
Enabled: pending
|
2191
|
+
VersionAdded: '1.22'
|
2192
|
+
|
2016
2193
|
Lint/RescueException:
|
2017
2194
|
Description: 'Avoid rescuing the Exception class.'
|
2018
2195
|
StyleGuide: '#no-blind-rescues'
|
@@ -2131,7 +2308,7 @@ Lint/Syntax:
|
|
2131
2308
|
VersionAdded: '0.9'
|
2132
2309
|
|
2133
2310
|
Lint/ToEnumArguments:
|
2134
|
-
Description: '
|
2311
|
+
Description: 'Ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
2135
2312
|
Enabled: pending
|
2136
2313
|
VersionAdded: '1.1'
|
2137
2314
|
|
@@ -2141,12 +2318,12 @@ Lint/ToJSON:
|
|
2141
2318
|
VersionAdded: '0.66'
|
2142
2319
|
|
2143
2320
|
Lint/TopLevelReturnWithArgument:
|
2144
|
-
Description: '
|
2321
|
+
Description: 'Detects top level return statements with argument.'
|
2145
2322
|
Enabled: true
|
2146
2323
|
VersionAdded: '0.89'
|
2147
2324
|
|
2148
2325
|
Lint/TrailingCommaInAttributeDeclaration:
|
2149
|
-
Description: '
|
2326
|
+
Description: 'Checks for trailing commas in attribute declarations.'
|
2150
2327
|
Enabled: true
|
2151
2328
|
VersionAdded: '0.90'
|
2152
2329
|
|
@@ -2195,14 +2372,15 @@ Lint/UnreachableCode:
|
|
2195
2372
|
VersionAdded: '0.9'
|
2196
2373
|
|
2197
2374
|
Lint/UnreachableLoop:
|
2198
|
-
Description: '
|
2375
|
+
Description: 'Checks for loops that will have at most one iteration.'
|
2199
2376
|
Enabled: true
|
2200
2377
|
VersionAdded: '0.89'
|
2201
2378
|
VersionChanged: '1.7'
|
2202
|
-
|
2379
|
+
AllowedPatterns:
|
2203
2380
|
# RSpec uses `times` in its message expectations
|
2204
2381
|
# eg. `exactly(2).times`
|
2205
2382
|
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2383
|
+
IgnoredPatterns: [] # deprecated
|
2206
2384
|
|
2207
2385
|
Lint/UnusedBlockArgument:
|
2208
2386
|
Description: 'Checks for unused block arguments.'
|
@@ -2257,13 +2435,19 @@ Lint/UselessElseWithoutRescue:
|
|
2257
2435
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
2258
2436
|
Enabled: true
|
2259
2437
|
VersionAdded: '0.17'
|
2438
|
+
VersionChanged: '1.31'
|
2260
2439
|
|
2261
2440
|
Lint/UselessMethodDefinition:
|
2262
2441
|
Description: 'Checks for useless method definitions.'
|
2263
2442
|
Enabled: true
|
2264
2443
|
VersionAdded: '0.90'
|
2444
|
+
VersionChanged: '0.91'
|
2265
2445
|
Safe: false
|
2266
|
-
|
2446
|
+
|
2447
|
+
Lint/UselessRuby2Keywords:
|
2448
|
+
Description: 'Finds unnecessary uses of `ruby2_keywords`.'
|
2449
|
+
Enabled: pending
|
2450
|
+
VersionAdded: '1.23'
|
2267
2451
|
|
2268
2452
|
Lint/UselessSetterCall:
|
2269
2453
|
Description: 'Checks for useless setter call to a local variable.'
|
@@ -2299,7 +2483,9 @@ Metrics/AbcSize:
|
|
2299
2483
|
VersionChanged: '1.5'
|
2300
2484
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
2301
2485
|
# a Float.
|
2302
|
-
|
2486
|
+
AllowedMethods: []
|
2487
|
+
AllowedPatterns: []
|
2488
|
+
IgnoredMethods: [] # deprecated
|
2303
2489
|
CountRepeatedAttributes: true
|
2304
2490
|
Max: 17
|
2305
2491
|
|
@@ -2312,10 +2498,12 @@ Metrics/BlockLength:
|
|
2312
2498
|
Max: 25
|
2313
2499
|
CountAsOne: []
|
2314
2500
|
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2315
|
-
|
2501
|
+
AllowedMethods:
|
2316
2502
|
# By default, exclude the `#refine` method, as it tends to have larger
|
2317
2503
|
# associated blocks.
|
2318
2504
|
- refine
|
2505
|
+
AllowedPatterns: []
|
2506
|
+
IgnoredMethods: [] # deprecated
|
2319
2507
|
Exclude:
|
2320
2508
|
- '**/*.gemspec'
|
2321
2509
|
|
@@ -2345,7 +2533,9 @@ Metrics/CyclomaticComplexity:
|
|
2345
2533
|
Enabled: true
|
2346
2534
|
VersionAdded: '0.25'
|
2347
2535
|
VersionChanged: '0.81'
|
2348
|
-
|
2536
|
+
AllowedMethods: []
|
2537
|
+
AllowedPatterns: []
|
2538
|
+
IgnoredMethods: [] # deprecated
|
2349
2539
|
Max: 7
|
2350
2540
|
|
2351
2541
|
Metrics/MethodLength:
|
@@ -2358,7 +2548,9 @@ Metrics/MethodLength:
|
|
2358
2548
|
Max: 10
|
2359
2549
|
CountAsOne: []
|
2360
2550
|
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2361
|
-
|
2551
|
+
AllowedMethods: []
|
2552
|
+
AllowedPatterns: []
|
2553
|
+
IgnoredMethods: [] # deprecated
|
2362
2554
|
|
2363
2555
|
Metrics/ModuleLength:
|
2364
2556
|
Description: 'Avoid modules longer than 100 lines of code.'
|
@@ -2386,7 +2578,9 @@ Metrics/PerceivedComplexity:
|
|
2386
2578
|
Enabled: true
|
2387
2579
|
VersionAdded: '0.25'
|
2388
2580
|
VersionChanged: '0.81'
|
2389
|
-
|
2581
|
+
AllowedMethods: []
|
2582
|
+
AllowedPatterns: []
|
2583
|
+
IgnoredMethods: [] # deprecated
|
2390
2584
|
Max: 8
|
2391
2585
|
|
2392
2586
|
################## Migration #############################
|
@@ -2421,6 +2615,17 @@ Naming/BinaryOperatorParameterName:
|
|
2421
2615
|
VersionAdded: '0.50'
|
2422
2616
|
VersionChanged: '1.2'
|
2423
2617
|
|
2618
|
+
Naming/BlockForwarding:
|
2619
|
+
Description: 'Use anonymous block forwarding.'
|
2620
|
+
StyleGuide: '#block-forwarding'
|
2621
|
+
Enabled: pending
|
2622
|
+
VersionAdded: '1.24'
|
2623
|
+
EnforcedStyle: anonymous
|
2624
|
+
SupportedStyles:
|
2625
|
+
- anonymous
|
2626
|
+
- explicit
|
2627
|
+
BlockForwardingName: block
|
2628
|
+
|
2424
2629
|
Naming/BlockParameterName:
|
2425
2630
|
Description: >-
|
2426
2631
|
Checks for block parameter names that contain capital letters,
|
@@ -2458,6 +2663,7 @@ Naming/FileName:
|
|
2458
2663
|
StyleGuide: '#snake-case-files'
|
2459
2664
|
Enabled: true
|
2460
2665
|
VersionAdded: '0.50'
|
2666
|
+
VersionChanged: '1.23'
|
2461
2667
|
# Camel case file names listed in `AllCops:Include` and all file names listed
|
2462
2668
|
# in `AllCops:Exclude` are excluded by default. Add extra excludes here.
|
2463
2669
|
Exclude: []
|
@@ -2470,6 +2676,13 @@ Naming/FileName:
|
|
2470
2676
|
# whether each source file's class or module name matches the file name --
|
2471
2677
|
# not whether the nested module hierarchy matches the subdirectory path.
|
2472
2678
|
CheckDefinitionPathHierarchy: true
|
2679
|
+
# paths that are considered root directories, for example "lib" in most ruby projects
|
2680
|
+
# or "app/models" in rails projects
|
2681
|
+
CheckDefinitionPathHierarchyRoots:
|
2682
|
+
- lib
|
2683
|
+
- spec
|
2684
|
+
- test
|
2685
|
+
- src
|
2473
2686
|
# If non-`nil`, expect all source file names to match the following regex.
|
2474
2687
|
# Only the file name itself is matched, not the entire file path.
|
2475
2688
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -2542,8 +2755,9 @@ Naming/HeredocDelimiterNaming:
|
|
2542
2755
|
|
2543
2756
|
Naming/InclusiveLanguage:
|
2544
2757
|
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
2545
|
-
Enabled:
|
2758
|
+
Enabled: false
|
2546
2759
|
VersionAdded: '1.18'
|
2760
|
+
VersionChanged: '1.21'
|
2547
2761
|
CheckIdentifiers: true
|
2548
2762
|
CheckConstants: true
|
2549
2763
|
CheckVariables: true
|
@@ -2590,11 +2804,12 @@ Naming/MethodName:
|
|
2590
2804
|
- camelCase
|
2591
2805
|
# Method names matching patterns are always allowed.
|
2592
2806
|
#
|
2593
|
-
#
|
2807
|
+
# AllowedPatterns:
|
2594
2808
|
# - '\A\s*onSelectionBulkChange\s*'
|
2595
2809
|
# - '\A\s*onSelectionCleared\s*'
|
2596
2810
|
#
|
2597
|
-
|
2811
|
+
AllowedPatterns: []
|
2812
|
+
IgnoredPatterns: [] # deprecated
|
2598
2813
|
|
2599
2814
|
Naming/MethodParameterName:
|
2600
2815
|
Description: >-
|
@@ -2608,10 +2823,13 @@ Naming/MethodParameterName:
|
|
2608
2823
|
AllowNamesEndingInNumbers: true
|
2609
2824
|
# Allowed names that will not register an offense
|
2610
2825
|
AllowedNames:
|
2826
|
+
- as
|
2611
2827
|
- at
|
2612
2828
|
- by
|
2829
|
+
- cc
|
2613
2830
|
- db
|
2614
2831
|
- id
|
2832
|
+
- if
|
2615
2833
|
- in
|
2616
2834
|
- io
|
2617
2835
|
- ip
|
@@ -2670,6 +2888,7 @@ Naming/VariableName:
|
|
2670
2888
|
- snake_case
|
2671
2889
|
- camelCase
|
2672
2890
|
AllowedIdentifiers: []
|
2891
|
+
AllowedPatterns: []
|
2673
2892
|
|
2674
2893
|
Naming/VariableNumber:
|
2675
2894
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -2691,14 +2910,28 @@ Naming/VariableNumber:
|
|
2691
2910
|
- rfc822 # Time#rfc822
|
2692
2911
|
- rfc2822 # Time#rfc2822
|
2693
2912
|
- rfc3339 # DateTime.rfc3339
|
2913
|
+
AllowedPatterns: []
|
2694
2914
|
|
2695
2915
|
#################### Security ##############################
|
2696
2916
|
|
2917
|
+
Security/CompoundHash:
|
2918
|
+
Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
|
2919
|
+
Enabled: pending
|
2920
|
+
VersionAdded: '1.28'
|
2921
|
+
|
2697
2922
|
Security/Eval:
|
2698
2923
|
Description: 'The use of eval represents a serious security risk.'
|
2699
2924
|
Enabled: true
|
2700
2925
|
VersionAdded: '0.47'
|
2701
2926
|
|
2927
|
+
Security/IoMethods:
|
2928
|
+
Description: >-
|
2929
|
+
Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
|
2930
|
+
`IO.foreach`, and `IO.readlines`.
|
2931
|
+
Enabled: pending
|
2932
|
+
Safe: false
|
2933
|
+
VersionAdded: '1.22'
|
2934
|
+
|
2702
2935
|
Security/JSONLoad:
|
2703
2936
|
Description: >-
|
2704
2937
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
@@ -2706,10 +2939,9 @@ Security/JSONLoad:
|
|
2706
2939
|
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2707
2940
|
Enabled: true
|
2708
2941
|
VersionAdded: '0.43'
|
2709
|
-
VersionChanged: '
|
2942
|
+
VersionChanged: '1.22'
|
2710
2943
|
# Autocorrect here will change to a method that may cause crashes depending
|
2711
2944
|
# on the value of the argument.
|
2712
|
-
AutoCorrect: false
|
2713
2945
|
SafeAutoCorrect: false
|
2714
2946
|
|
2715
2947
|
Security/MarshalLoad:
|
@@ -2748,6 +2980,7 @@ Style/AccessModifierDeclarations:
|
|
2748
2980
|
- inline
|
2749
2981
|
- group
|
2750
2982
|
AllowModifiersOnSymbols: true
|
2983
|
+
SafeAutoCorrect: false
|
2751
2984
|
|
2752
2985
|
Style/AccessorGrouping:
|
2753
2986
|
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
@@ -2775,8 +3008,9 @@ Style/AndOr:
|
|
2775
3008
|
Description: 'Use &&/|| instead of and/or.'
|
2776
3009
|
StyleGuide: '#no-and-or-or'
|
2777
3010
|
Enabled: true
|
3011
|
+
SafeAutoCorrect: false
|
2778
3012
|
VersionAdded: '0.9'
|
2779
|
-
VersionChanged: '
|
3013
|
+
VersionChanged: '1.21'
|
2780
3014
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2781
3015
|
# or completely (always).
|
2782
3016
|
EnforcedStyle: conditionals
|
@@ -2800,6 +3034,11 @@ Style/ArrayCoercion:
|
|
2800
3034
|
Enabled: false
|
2801
3035
|
VersionAdded: '0.88'
|
2802
3036
|
|
3037
|
+
Style/ArrayIntersect:
|
3038
|
+
Description: 'Use `array1.intersect?(array2)` instead of `(array1 & array2).any?`.'
|
3039
|
+
Enabled: 'pending'
|
3040
|
+
VersionAdded: '1.40'
|
3041
|
+
|
2803
3042
|
Style/ArrayJoin:
|
2804
3043
|
Description: 'Use Array#join instead of Array#*.'
|
2805
3044
|
StyleGuide: '#array-join'
|
@@ -2810,9 +3049,9 @@ Style/ArrayJoin:
|
|
2810
3049
|
Style/AsciiComments:
|
2811
3050
|
Description: 'Use only ascii symbols in comments.'
|
2812
3051
|
StyleGuide: '#english-comments'
|
2813
|
-
Enabled:
|
3052
|
+
Enabled: false
|
2814
3053
|
VersionAdded: '0.9'
|
2815
|
-
VersionChanged: '
|
3054
|
+
VersionChanged: '1.21'
|
2816
3055
|
AllowedChars:
|
2817
3056
|
- ©
|
2818
3057
|
|
@@ -2881,7 +3120,7 @@ Style/BlockDelimiters:
|
|
2881
3120
|
# This looks at the usage of a block's method to determine its type (e.g. is
|
2882
3121
|
# the result of a `map` assigned to a variable or passed to another
|
2883
3122
|
# method) but exceptions are permitted in the `ProceduralMethods`,
|
2884
|
-
# `FunctionalMethods` and `
|
3123
|
+
# `FunctionalMethods` and `AllowedMethods` sections below.
|
2885
3124
|
- semantic
|
2886
3125
|
# The `braces_for_chaining` style enforces braces around single line blocks
|
2887
3126
|
# and do..end around multi-line blocks, except for multi-line blocks whose
|
@@ -2922,7 +3161,7 @@ Style/BlockDelimiters:
|
|
2922
3161
|
- let!
|
2923
3162
|
- subject
|
2924
3163
|
- watch
|
2925
|
-
|
3164
|
+
AllowedMethods:
|
2926
3165
|
# Methods that can be either procedural or functional and cannot be
|
2927
3166
|
# categorised from their usage alone, e.g.
|
2928
3167
|
#
|
@@ -2939,6 +3178,8 @@ Style/BlockDelimiters:
|
|
2939
3178
|
- lambda
|
2940
3179
|
- proc
|
2941
3180
|
- it
|
3181
|
+
AllowedPatterns: []
|
3182
|
+
IgnoredMethods: [] # deprecated
|
2942
3183
|
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
2943
3184
|
# EnforcedStyle is set to `semantic`. If so:
|
2944
3185
|
#
|
@@ -2974,7 +3215,7 @@ Style/CaseEquality:
|
|
2974
3215
|
Enabled: true
|
2975
3216
|
VersionAdded: '0.9'
|
2976
3217
|
VersionChanged: '0.89'
|
2977
|
-
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
3218
|
+
# If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
|
2978
3219
|
# the case equality operator is a constant.
|
2979
3220
|
#
|
2980
3221
|
# # bad
|
@@ -2983,9 +3224,18 @@ Style/CaseEquality:
|
|
2983
3224
|
# # good
|
2984
3225
|
# String === "string"
|
2985
3226
|
AllowOnConstant: false
|
3227
|
+
# If `AllowOnSelfClass` option is enabled, the cop will ignore violations when the receiver of
|
3228
|
+
# the case equality operator is `self.class`.
|
3229
|
+
#
|
3230
|
+
# # bad
|
3231
|
+
# some_class === object
|
3232
|
+
#
|
3233
|
+
# # good
|
3234
|
+
# self.class === object
|
3235
|
+
AllowOnSelfClass: false
|
2986
3236
|
|
2987
3237
|
Style/CaseLikeIf:
|
2988
|
-
Description: '
|
3238
|
+
Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2989
3239
|
StyleGuide: '#case-vs-if-else'
|
2990
3240
|
Enabled: true
|
2991
3241
|
Safe: false
|
@@ -3042,10 +3292,12 @@ Style/ClassEqualityComparison:
|
|
3042
3292
|
StyleGuide: '#instance-of-vs-class-comparison'
|
3043
3293
|
Enabled: true
|
3044
3294
|
VersionAdded: '0.93'
|
3045
|
-
|
3295
|
+
AllowedMethods:
|
3046
3296
|
- ==
|
3047
3297
|
- equal?
|
3048
3298
|
- eql?
|
3299
|
+
AllowedPatterns: []
|
3300
|
+
IgnoredMethods: [] # deprecated
|
3049
3301
|
|
3050
3302
|
Style/ClassMethods:
|
3051
3303
|
Description: 'Use self when defining module/class methods.'
|
@@ -3059,7 +3311,7 @@ Style/ClassMethodsDefinitions:
|
|
3059
3311
|
StyleGuide: '#def-self-class-methods'
|
3060
3312
|
Enabled: false
|
3061
3313
|
VersionAdded: '0.89'
|
3062
|
-
EnforcedStyle:
|
3314
|
+
EnforcedStyle: def_self
|
3063
3315
|
SupportedStyles:
|
3064
3316
|
- def_self
|
3065
3317
|
- self_class
|
@@ -3149,7 +3401,7 @@ Style/CommentAnnotation:
|
|
3149
3401
|
StyleGuide: '#annotate-keywords'
|
3150
3402
|
Enabled: true
|
3151
3403
|
VersionAdded: '0.10'
|
3152
|
-
VersionChanged: '1.
|
3404
|
+
VersionChanged: '1.20'
|
3153
3405
|
Keywords:
|
3154
3406
|
- TODO
|
3155
3407
|
- FIXME
|
@@ -3223,7 +3475,7 @@ Style/Copyright:
|
|
3223
3475
|
|
3224
3476
|
Style/DateTime:
|
3225
3477
|
Description: 'Use Time over DateTime.'
|
3226
|
-
StyleGuide: '#date
|
3478
|
+
StyleGuide: '#date-time'
|
3227
3479
|
Enabled: false
|
3228
3480
|
VersionAdded: '0.51'
|
3229
3481
|
VersionChanged: '0.92'
|
@@ -3332,6 +3584,12 @@ Style/EmptyElse:
|
|
3332
3584
|
- empty
|
3333
3585
|
- nil
|
3334
3586
|
- both
|
3587
|
+
AllowComments: false
|
3588
|
+
|
3589
|
+
Style/EmptyHeredoc:
|
3590
|
+
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
3591
|
+
Enabled: pending
|
3592
|
+
VersionAdded: '1.32'
|
3335
3593
|
|
3336
3594
|
Style/EmptyLambdaParameter:
|
3337
3595
|
Description: 'Omit parens for empty lambda parameters.'
|
@@ -3380,6 +3638,12 @@ Style/EndlessMethod:
|
|
3380
3638
|
- allow_always
|
3381
3639
|
- disallow
|
3382
3640
|
|
3641
|
+
Style/EnvHome:
|
3642
|
+
Description: "Checks for consistent usage of `ENV['HOME']`."
|
3643
|
+
Enabled: pending
|
3644
|
+
Safe: false
|
3645
|
+
VersionAdded: '1.29'
|
3646
|
+
|
3383
3647
|
Style/EvalWithLocation:
|
3384
3648
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
3385
3649
|
Enabled: true
|
@@ -3417,6 +3681,28 @@ Style/ExponentialNotation:
|
|
3417
3681
|
- engineering
|
3418
3682
|
- integral
|
3419
3683
|
|
3684
|
+
Style/FetchEnvVar:
|
3685
|
+
Description: >-
|
3686
|
+
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
3687
|
+
Reference:
|
3688
|
+
- https://rubystyle.guide/#hash-fetch-defaults
|
3689
|
+
Enabled: pending
|
3690
|
+
VersionAdded: '1.28'
|
3691
|
+
# Environment variables to be excluded from the inspection.
|
3692
|
+
AllowedVars: []
|
3693
|
+
|
3694
|
+
Style/FileRead:
|
3695
|
+
Description: 'Favor `File.(bin)read` convenience methods.'
|
3696
|
+
StyleGuide: '#file-read'
|
3697
|
+
Enabled: pending
|
3698
|
+
VersionAdded: '1.24'
|
3699
|
+
|
3700
|
+
Style/FileWrite:
|
3701
|
+
Description: 'Favor `File.(bin)write` convenience methods.'
|
3702
|
+
StyleGuide: '#file-write'
|
3703
|
+
Enabled: pending
|
3704
|
+
VersionAdded: '1.24'
|
3705
|
+
|
3420
3706
|
Style/FloatDivision:
|
3421
3707
|
Description: 'For performing float division, coerce one side only.'
|
3422
3708
|
StyleGuide: '#float-division'
|
@@ -3436,8 +3722,9 @@ Style/For:
|
|
3436
3722
|
Description: 'Checks use of for or each in multiline loops.'
|
3437
3723
|
StyleGuide: '#no-for-loops'
|
3438
3724
|
Enabled: true
|
3725
|
+
SafeAutoCorrect: false
|
3439
3726
|
VersionAdded: '0.13'
|
3440
|
-
VersionChanged: '
|
3727
|
+
VersionChanged: '1.26'
|
3441
3728
|
EnforcedStyle: each
|
3442
3729
|
SupportedStyles:
|
3443
3730
|
- each
|
@@ -3472,7 +3759,9 @@ Style/FormatStringToken:
|
|
3472
3759
|
MaxUnannotatedPlaceholdersAllowed: 1
|
3473
3760
|
VersionAdded: '0.49'
|
3474
3761
|
VersionChanged: '1.0'
|
3475
|
-
|
3762
|
+
AllowedMethods: []
|
3763
|
+
AllowedPatterns: []
|
3764
|
+
IgnoredMethods: [] # deprecated
|
3476
3765
|
|
3477
3766
|
Style/FrozenStringLiteralComment:
|
3478
3767
|
Description: >-
|
@@ -3517,10 +3806,11 @@ Style/GuardClause:
|
|
3517
3806
|
StyleGuide: '#no-nested-conditionals'
|
3518
3807
|
Enabled: true
|
3519
3808
|
VersionAdded: '0.20'
|
3520
|
-
VersionChanged: '
|
3809
|
+
VersionChanged: '1.31'
|
3521
3810
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
3522
3811
|
# needs to have to trigger this cop
|
3523
3812
|
MinBodyLength: 1
|
3813
|
+
AllowConsecutiveConditionals: false
|
3524
3814
|
|
3525
3815
|
Style/HashAsLastArrayItem:
|
3526
3816
|
Description: >-
|
@@ -3556,7 +3846,9 @@ Style/HashExcept:
|
|
3556
3846
|
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
3557
3847
|
that can be replaced with `Hash#except` method.
|
3558
3848
|
Enabled: pending
|
3849
|
+
Safe: false
|
3559
3850
|
VersionAdded: '1.7'
|
3851
|
+
VersionChanged: '1.39'
|
3560
3852
|
|
3561
3853
|
Style/HashLikeCase:
|
3562
3854
|
Description: >-
|
@@ -3575,7 +3867,7 @@ Style/HashSyntax:
|
|
3575
3867
|
StyleGuide: '#hash-literals'
|
3576
3868
|
Enabled: true
|
3577
3869
|
VersionAdded: '0.9'
|
3578
|
-
VersionChanged: '
|
3870
|
+
VersionChanged: '1.24'
|
3579
3871
|
EnforcedStyle: ruby19
|
3580
3872
|
SupportedStyles:
|
3581
3873
|
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
@@ -3586,6 +3878,17 @@ Style/HashSyntax:
|
|
3586
3878
|
- no_mixed_keys
|
3587
3879
|
# enforces both ruby19 and no_mixed_keys styles
|
3588
3880
|
- ruby19_no_mixed_keys
|
3881
|
+
# Force hashes that have a hash value omission
|
3882
|
+
EnforcedShorthandSyntax: always
|
3883
|
+
SupportedShorthandSyntax:
|
3884
|
+
# forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
|
3885
|
+
- always
|
3886
|
+
# forces use of explicit hash literal value.
|
3887
|
+
- never
|
3888
|
+
# accepts both shorthand and explicit use of hash literal value.
|
3889
|
+
- either
|
3890
|
+
# like "either", but will avoid mixing styles in a single hash
|
3891
|
+
- consistent
|
3589
3892
|
# Force hashes that have a symbol value to use hash rockets
|
3590
3893
|
UseHashRocketsWithSymbolValues: false
|
3591
3894
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
@@ -3669,7 +3972,7 @@ Style/InPatternThen:
|
|
3669
3972
|
Style/InfiniteLoop:
|
3670
3973
|
Description: >-
|
3671
3974
|
Use Kernel#loop for infinite loops.
|
3672
|
-
This cop is unsafe
|
3975
|
+
This cop is unsafe if the body may raise a `StopIteration` exception.
|
3673
3976
|
Safe: false
|
3674
3977
|
StyleGuide: '#infinite-loop'
|
3675
3978
|
Enabled: true
|
@@ -3700,8 +4003,8 @@ Style/InverseMethods:
|
|
3700
4003
|
:>: :<=
|
3701
4004
|
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
3702
4005
|
# and not enabled by default.
|
3703
|
-
|
3704
|
-
|
4006
|
+
# :present?: :blank?,
|
4007
|
+
# :include?: :exclude?
|
3705
4008
|
# `InverseBlocks` are methods that are inverted by inverting the return
|
3706
4009
|
# of the block that is passed to the method
|
3707
4010
|
InverseBlocks:
|
@@ -3762,6 +4065,37 @@ Style/LineEndConcatenation:
|
|
3762
4065
|
VersionAdded: '0.18'
|
3763
4066
|
VersionChanged: '0.64'
|
3764
4067
|
|
4068
|
+
Style/MagicCommentFormat:
|
4069
|
+
Description: 'Use a consistent style for magic comments.'
|
4070
|
+
Enabled: pending
|
4071
|
+
VersionAdded: '1.35'
|
4072
|
+
EnforcedStyle: snake_case
|
4073
|
+
SupportedStyles:
|
4074
|
+
# `snake` will enforce the magic comment is written
|
4075
|
+
# in snake case (words separated by underscores).
|
4076
|
+
# Eg: froze_string_literal: true
|
4077
|
+
- snake_case
|
4078
|
+
# `kebab` will enforce the magic comment is written
|
4079
|
+
# in kebab case (words separated by hyphens).
|
4080
|
+
# Eg: froze-string-literal: true
|
4081
|
+
- kebab_case
|
4082
|
+
DirectiveCapitalization: lowercase
|
4083
|
+
ValueCapitalization: ~
|
4084
|
+
SupportedCapitalizations:
|
4085
|
+
- lowercase
|
4086
|
+
- uppercase
|
4087
|
+
|
4088
|
+
Style/MapCompactWithConditionalBlock:
|
4089
|
+
Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
|
4090
|
+
Enabled: pending
|
4091
|
+
VersionAdded: '1.30'
|
4092
|
+
|
4093
|
+
Style/MapToHash:
|
4094
|
+
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
4095
|
+
Enabled: pending
|
4096
|
+
VersionAdded: '1.24'
|
4097
|
+
Safe: false
|
4098
|
+
|
3765
4099
|
Style/MethodCallWithArgsParentheses:
|
3766
4100
|
Description: 'Use parentheses for method calls with arguments.'
|
3767
4101
|
StyleGuide: '#method-invocation-parens'
|
@@ -3769,8 +4103,10 @@ Style/MethodCallWithArgsParentheses:
|
|
3769
4103
|
VersionAdded: '0.47'
|
3770
4104
|
VersionChanged: '1.7'
|
3771
4105
|
IgnoreMacros: true
|
3772
|
-
|
3773
|
-
|
4106
|
+
AllowedMethods: []
|
4107
|
+
IgnoredMethods: [] # deprecated
|
4108
|
+
AllowedPatterns: []
|
4109
|
+
IgnoredPatterns: [] # deprecated
|
3774
4110
|
IncludedMacros: []
|
3775
4111
|
AllowParenthesesInMultilineCall: false
|
3776
4112
|
AllowParenthesesInChaining: false
|
@@ -3785,7 +4121,9 @@ Style/MethodCallWithoutArgsParentheses:
|
|
3785
4121
|
Description: 'Do not use parentheses for method calls with no arguments.'
|
3786
4122
|
StyleGuide: '#method-invocation-parens'
|
3787
4123
|
Enabled: true
|
3788
|
-
|
4124
|
+
AllowedMethods: []
|
4125
|
+
AllowedPatterns: []
|
4126
|
+
IgnoredMethods: [] # deprecated
|
3789
4127
|
VersionAdded: '0.47'
|
3790
4128
|
VersionChanged: '0.55'
|
3791
4129
|
|
@@ -3976,7 +4314,7 @@ Style/NegatedIf:
|
|
3976
4314
|
|
3977
4315
|
Style/NegatedIfElseCondition:
|
3978
4316
|
Description: >-
|
3979
|
-
|
4317
|
+
Checks for uses of `if-else` and ternary operators with a negated condition
|
3980
4318
|
which can be simplified by inverting condition and swapping branches.
|
3981
4319
|
Enabled: pending
|
3982
4320
|
VersionAdded: '1.2'
|
@@ -4001,6 +4339,11 @@ Style/NegatedWhile:
|
|
4001
4339
|
Enabled: true
|
4002
4340
|
VersionAdded: '0.20'
|
4003
4341
|
|
4342
|
+
Style/NestedFileDirname:
|
4343
|
+
Description: 'Checks for nested `File.dirname`.'
|
4344
|
+
Enabled: pending
|
4345
|
+
VersionAdded: '1.26'
|
4346
|
+
|
4004
4347
|
Style/NestedModifier:
|
4005
4348
|
Description: 'Avoid using nested modifiers.'
|
4006
4349
|
StyleGuide: '#no-nested-modifiers'
|
@@ -4095,6 +4438,21 @@ Style/Not:
|
|
4095
4438
|
VersionAdded: '0.9'
|
4096
4439
|
VersionChanged: '0.20'
|
4097
4440
|
|
4441
|
+
Style/NumberedParameters:
|
4442
|
+
Description: 'Restrict the usage of numbered parameters.'
|
4443
|
+
Enabled: pending
|
4444
|
+
VersionAdded: '1.22'
|
4445
|
+
EnforcedStyle: allow_single_line
|
4446
|
+
SupportedStyles:
|
4447
|
+
- allow_single_line
|
4448
|
+
- disallow
|
4449
|
+
|
4450
|
+
Style/NumberedParametersLimit:
|
4451
|
+
Description: 'Avoid excessive numbered params in a single block.'
|
4452
|
+
Enabled: pending
|
4453
|
+
VersionAdded: '1.22'
|
4454
|
+
Max: 1
|
4455
|
+
|
4098
4456
|
Style/NumericLiteralPrefix:
|
4099
4457
|
Description: 'Use smallcase prefixes for numeric literals.'
|
4100
4458
|
StyleGuide: '#numeric-literal-prefixes'
|
@@ -4105,7 +4463,6 @@ Style/NumericLiteralPrefix:
|
|
4105
4463
|
- zero_with_o
|
4106
4464
|
- zero_only
|
4107
4465
|
|
4108
|
-
|
4109
4466
|
Style/NumericLiterals:
|
4110
4467
|
Description: >-
|
4111
4468
|
Add underscores to large numeric literals to improve their
|
@@ -4116,6 +4473,9 @@ Style/NumericLiterals:
|
|
4116
4473
|
VersionChanged: '0.48'
|
4117
4474
|
MinDigits: 5
|
4118
4475
|
Strict: false
|
4476
|
+
# You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
|
4477
|
+
AllowedNumbers: []
|
4478
|
+
AllowedPatterns: []
|
4119
4479
|
|
4120
4480
|
Style/NumericPredicate:
|
4121
4481
|
Description: >-
|
@@ -4134,12 +4494,27 @@ Style/NumericPredicate:
|
|
4134
4494
|
SupportedStyles:
|
4135
4495
|
- predicate
|
4136
4496
|
- comparison
|
4137
|
-
|
4497
|
+
AllowedMethods: []
|
4498
|
+
AllowedPatterns: []
|
4499
|
+
IgnoredMethods: [] # deprecated
|
4138
4500
|
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
4139
4501
|
# false positives.
|
4140
4502
|
Exclude:
|
4141
4503
|
- 'spec/**/*'
|
4142
4504
|
|
4505
|
+
Style/ObjectThen:
|
4506
|
+
Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
|
4507
|
+
StyleGuide: '#object-yield-self-vs-object-then'
|
4508
|
+
Enabled: pending
|
4509
|
+
VersionAdded: '1.28'
|
4510
|
+
# Use `Object#yield_self` or `Object#then`?
|
4511
|
+
# Prefer `Object#yield_self` to `Object#then` (yield_self)
|
4512
|
+
# Prefer `Object#then` to `Object#yield_self` (then)
|
4513
|
+
EnforcedStyle: 'then'
|
4514
|
+
SupportedStyles:
|
4515
|
+
- then
|
4516
|
+
- yield_self
|
4517
|
+
|
4143
4518
|
Style/OneLineConditional:
|
4144
4519
|
Description: >-
|
4145
4520
|
Favor the ternary operator (?:) or multi-line constructs over
|
@@ -4150,6 +4525,22 @@ Style/OneLineConditional:
|
|
4150
4525
|
VersionAdded: '0.9'
|
4151
4526
|
VersionChanged: '0.90'
|
4152
4527
|
|
4528
|
+
Style/OpenStructUse:
|
4529
|
+
Description: >-
|
4530
|
+
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
4531
|
+
version compatibility, and potential security issues.
|
4532
|
+
Reference:
|
4533
|
+
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4534
|
+
|
4535
|
+
Enabled: pending
|
4536
|
+
VersionAdded: '1.23'
|
4537
|
+
|
4538
|
+
Style/OperatorMethodCall:
|
4539
|
+
Description: 'Checks for redundant dot before operator method call.'
|
4540
|
+
StyleGuide: '#operator-method-call'
|
4541
|
+
Enabled: pending
|
4542
|
+
VersionAdded: '1.37'
|
4543
|
+
|
4153
4544
|
Style/OptionHash:
|
4154
4545
|
Description: "Don't use option hashes when you can use keyword arguments."
|
4155
4546
|
Enabled: false
|
@@ -4295,10 +4686,12 @@ Style/RedundantArgument:
|
|
4295
4686
|
Enabled: pending
|
4296
4687
|
Safe: false
|
4297
4688
|
VersionAdded: '1.4'
|
4298
|
-
VersionChanged: '1.
|
4689
|
+
VersionChanged: '1.40'
|
4299
4690
|
Methods:
|
4300
4691
|
# Array#join
|
4301
4692
|
join: ''
|
4693
|
+
# Array#sum
|
4694
|
+
sum: 0
|
4302
4695
|
# String#split
|
4303
4696
|
split: ' '
|
4304
4697
|
# String#chomp
|
@@ -4333,6 +4726,17 @@ Style/RedundantConditional:
|
|
4333
4726
|
Enabled: true
|
4334
4727
|
VersionAdded: '0.50'
|
4335
4728
|
|
4729
|
+
Style/RedundantConstantBase:
|
4730
|
+
Description: Avoid redundant `::` prefix on constant.
|
4731
|
+
Enabled: pending
|
4732
|
+
VersionAdded: '1.40'
|
4733
|
+
|
4734
|
+
Style/RedundantEach:
|
4735
|
+
Description: 'Checks for redundant `each`.'
|
4736
|
+
Enabled: pending
|
4737
|
+
Safe: false
|
4738
|
+
VersionAdded: '1.38'
|
4739
|
+
|
4336
4740
|
Style/RedundantException:
|
4337
4741
|
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
4338
4742
|
StyleGuide: '#no-explicit-runtimeerror'
|
@@ -4367,10 +4771,20 @@ Style/RedundantFreeze:
|
|
4367
4771
|
VersionAdded: '0.34'
|
4368
4772
|
VersionChanged: '0.66'
|
4369
4773
|
|
4774
|
+
Style/RedundantInitialize:
|
4775
|
+
Description: 'Checks for redundant `initialize` methods.'
|
4776
|
+
Enabled: pending
|
4777
|
+
Safe: false
|
4778
|
+
AllowComments: true
|
4779
|
+
VersionAdded: '1.27'
|
4780
|
+
VersionChanged: '1.28'
|
4781
|
+
|
4370
4782
|
Style/RedundantInterpolation:
|
4371
4783
|
Description: 'Checks for strings that are just an interpolated expression.'
|
4372
4784
|
Enabled: true
|
4785
|
+
SafeAutoCorrect: false
|
4373
4786
|
VersionAdded: '0.76'
|
4787
|
+
VersionChanged: '1.30'
|
4374
4788
|
|
4375
4789
|
Style/RedundantParentheses:
|
4376
4790
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
@@ -4426,12 +4840,19 @@ Style/RedundantSort:
|
|
4426
4840
|
`max_by` instead of `sort_by...last`, etc.
|
4427
4841
|
Enabled: true
|
4428
4842
|
VersionAdded: '0.76'
|
4843
|
+
VersionChanged: '1.22'
|
4844
|
+
Safe: false
|
4429
4845
|
|
4430
4846
|
Style/RedundantSortBy:
|
4431
4847
|
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
4432
4848
|
Enabled: true
|
4433
4849
|
VersionAdded: '0.36'
|
4434
4850
|
|
4851
|
+
Style/RedundantStringEscape:
|
4852
|
+
Description: 'Checks for redundant escapes in string literals.'
|
4853
|
+
Enabled: pending
|
4854
|
+
VersionAdded: '1.37'
|
4855
|
+
|
4435
4856
|
Style/RegexpLiteral:
|
4436
4857
|
Description: 'Use / or %r around regular expressions.'
|
4437
4858
|
StyleGuide: '#percent-r'
|
@@ -4450,6 +4871,12 @@ Style/RegexpLiteral:
|
|
4450
4871
|
# are found in the regexp string.
|
4451
4872
|
AllowInnerSlashes: false
|
4452
4873
|
|
4874
|
+
Style/RequireOrder:
|
4875
|
+
Description: Sort `require` and `require_relative` in alphabetical order.
|
4876
|
+
Enabled: false
|
4877
|
+
SafeAutoCorrect: false
|
4878
|
+
VersionAdded: '1.40'
|
4879
|
+
|
4453
4880
|
Style/RescueModifier:
|
4454
4881
|
Description: 'Avoid using rescue in its modifier form.'
|
4455
4882
|
StyleGuide: '#no-rescue-modifiers'
|
@@ -4479,14 +4906,14 @@ Style/ReturnNil:
|
|
4479
4906
|
|
4480
4907
|
Style/SafeNavigation:
|
4481
4908
|
Description: >-
|
4482
|
-
|
4909
|
+
Transforms usages of a method call safeguarded by
|
4483
4910
|
a check for the existence of the object to
|
4484
4911
|
safe navigation (`&.`).
|
4485
|
-
|
4912
|
+
Autocorrection is unsafe as it assumes the object will
|
4486
4913
|
be `nil` or truthy, but never `false`.
|
4487
4914
|
Enabled: true
|
4488
4915
|
VersionAdded: '0.43'
|
4489
|
-
VersionChanged: '
|
4916
|
+
VersionChanged: '1.27'
|
4490
4917
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
4491
4918
|
# to whatever it used to return.
|
4492
4919
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -4497,6 +4924,8 @@ Style/SafeNavigation:
|
|
4497
4924
|
- try
|
4498
4925
|
- try!
|
4499
4926
|
SafeAutoCorrect: false
|
4927
|
+
# Maximum length of method chains for register an offense.
|
4928
|
+
MaxChainLength: 2
|
4500
4929
|
|
4501
4930
|
Style/Sample:
|
4502
4931
|
Description: >-
|
@@ -4506,6 +4935,12 @@ Style/Sample:
|
|
4506
4935
|
Enabled: true
|
4507
4936
|
VersionAdded: '0.30'
|
4508
4937
|
|
4938
|
+
Style/SelectByRegexp:
|
4939
|
+
Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
|
4940
|
+
Enabled: pending
|
4941
|
+
SafeAutoCorrect: false
|
4942
|
+
VersionAdded: '1.22'
|
4943
|
+
|
4509
4944
|
Style/SelfAssignment:
|
4510
4945
|
Description: >-
|
4511
4946
|
Checks for places where self-assignment shorthand should have
|
@@ -4596,6 +5031,7 @@ Style/SpecialGlobalVars:
|
|
4596
5031
|
SupportedStyles:
|
4597
5032
|
- use_perl_names
|
4598
5033
|
- use_english_names
|
5034
|
+
- use_builtin_english_names
|
4599
5035
|
|
4600
5036
|
Style/StabbyLambdaParentheses:
|
4601
5037
|
Description: 'Check for the usage of parentheses around stabby lambda arguments.'
|
@@ -4692,11 +5128,12 @@ Style/StructInheritance:
|
|
4692
5128
|
Description: 'Checks for inheritance from Struct.new.'
|
4693
5129
|
StyleGuide: '#no-extend-struct-new'
|
4694
5130
|
Enabled: true
|
5131
|
+
SafeAutoCorrect: false
|
4695
5132
|
VersionAdded: '0.29'
|
4696
|
-
VersionChanged: '
|
5133
|
+
VersionChanged: '1.20'
|
4697
5134
|
|
4698
5135
|
Style/SwapValues:
|
4699
|
-
Description: '
|
5136
|
+
Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
|
4700
5137
|
StyleGuide: '#values-swapping'
|
4701
5138
|
Enabled: pending
|
4702
5139
|
VersionAdded: '1.1'
|
@@ -4724,13 +5161,15 @@ Style/SymbolProc:
|
|
4724
5161
|
Enabled: true
|
4725
5162
|
Safe: false
|
4726
5163
|
VersionAdded: '0.26'
|
4727
|
-
VersionChanged: '1.
|
5164
|
+
VersionChanged: '1.40'
|
4728
5165
|
AllowMethodsWithArguments: false
|
4729
|
-
# A list of method names to be
|
5166
|
+
# A list of method names to be always allowed by the check.
|
4730
5167
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4731
|
-
|
4732
|
-
- respond_to
|
5168
|
+
AllowedMethods:
|
4733
5169
|
- define_method
|
5170
|
+
AllowedPatterns: []
|
5171
|
+
IgnoredMethods: [] # deprecated
|
5172
|
+
AllowComments: false
|
4734
5173
|
|
4735
5174
|
Style/TernaryParentheses:
|
4736
5175
|
Description: 'Checks for use of parentheses around ternary conditions.'
|
@@ -4745,7 +5184,7 @@ Style/TernaryParentheses:
|
|
4745
5184
|
AllowSafeAssignment: true
|
4746
5185
|
|
4747
5186
|
Style/TopLevelMethodDefinition:
|
4748
|
-
Description: '
|
5187
|
+
Description: 'Looks for top-level method definitions.'
|
4749
5188
|
StyleGuide: '#top-level-methods'
|
4750
5189
|
Enabled: false
|
4751
5190
|
VersionAdded: '1.15'
|