rubocop 1.19.0 → 1.33.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 +417 -83
- data/config/obsoletion.yml +35 -2
- data/exe/rubocop +15 -7
- data/lib/rubocop/cache_config.rb +29 -0
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +21 -6
- data/lib/rubocop/cli/command/execute_runner.rb +1 -1
- 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 +5 -5
- data/lib/rubocop/cli.rb +4 -1
- data/lib/rubocop/config.rb +10 -1
- data/lib/rubocop/config_finder.rb +68 -0
- data/lib/rubocop/config_loader.rb +12 -48
- data/lib/rubocop/config_loader_resolver.rb +2 -2
- 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 +9 -5
- 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/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 +3 -3
- data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +12 -11
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +1 -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.rb +25 -19
- data/lib/rubocop/cop/internal_affairs/cop_description.rb +96 -0
- data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +1 -1
- 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/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/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 +6 -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 +4 -4
- data/lib/rubocop/cop/layout/block_end_newline.rb +33 -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_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 +5 -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 +1 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +34 -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 +1 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +12 -10
- 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 +112 -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 +16 -12
- 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 +2 -2
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +5 -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 +5 -5
- 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 +2 -2
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +2 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +3 -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 +10 -10
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +8 -6
- data/lib/rubocop/cop/layout/space_inside_parens.rb +74 -28
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +2 -2
- 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/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 +8 -6
- 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 +14 -6
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +31 -13
- data/lib/rubocop/cop/lint/deprecated_constants.rb +4 -3
- 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_methods.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -1
- 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 +1 -1
- data/lib/rubocop/cop/lint/empty_class.rb +1 -1
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +64 -3
- 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 +2 -2
- 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 +7 -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 +1 -1
- data/lib/rubocop/cop/lint/loop.rb +5 -4
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/missing_super.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +1 -1
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +157 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +9 -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/out_of_range_regexp_ref.rb +17 -0
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +12 -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 +6 -6
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +5 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +4 -1
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +13 -5
- 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 +1 -1
- data/lib/rubocop/cop/lint/redundant_with_object.rb +1 -1
- 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 +1 -1
- 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 +38 -1
- 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/shadowed_argument.rb +1 -1
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +12 -2
- data/lib/rubocop/cop/lint/struct_new_override.rb +3 -3
- data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
- 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 +5 -5
- data/lib/rubocop/cop/lint/unused_block_argument.rb +1 -1
- data/lib/rubocop/cop/lint/unused_method_argument.rb +4 -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 +1 -1
- 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 +1 -1
- data/lib/rubocop/cop/metrics/abc_size.rb +10 -2
- data/lib/rubocop/cop/metrics/block_length.rb +8 -7
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/class_length.rb +1 -1
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +1 -10
- data/lib/rubocop/cop/metrics/method_length.rb +10 -8
- data/lib/rubocop/cop/metrics/module_length.rb +2 -2
- 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 +24 -5
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +1 -1
- data/lib/rubocop/cop/mixin/allowed_methods.rb +15 -1
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +48 -0
- data/lib/rubocop/cop/mixin/annotation_comment.rb +57 -34
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +4 -0
- data/lib/rubocop/cop/mixin/code_length.rb +1 -1
- data/lib/rubocop/cop/mixin/comments_help.rb +28 -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 +5 -0
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +23 -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 +86 -0
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +3 -3
- 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 +4 -9
- 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 +7 -3
- 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 +2 -2
- data/lib/rubocop/cop/mixin/string_help.rb +1 -1
- data/lib/rubocop/cop/mixin/surrounding_space.rb +4 -2
- data/lib/rubocop/cop/mixin/trailing_body.rb +1 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +1 -1
- 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 +2 -2
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +1 -1
- data/lib/rubocop/cop/naming/constant_name.rb +2 -2
- 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 +12 -11
- 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/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/accessor_grouping.rb +6 -6
- 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 +14 -3
- data/lib/rubocop/cop/style/array_coercion.rb +22 -4
- 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 +57 -14
- data/lib/rubocop/cop/style/case_equality.rb +7 -10
- data/lib/rubocop/cop/style/case_like_if.rb +6 -1
- data/lib/rubocop/cop/style/character_literal.rb +9 -2
- 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 +51 -4
- data/lib/rubocop/cop/style/class_methods.rb +1 -1
- data/lib/rubocop/cop/style/class_methods_definitions.rb +1 -1
- data/lib/rubocop/cop/style/class_vars.rb +1 -1
- data/lib/rubocop/cop/style/collection_compact.rb +41 -21
- data/lib/rubocop/cop/style/collection_methods.rb +9 -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 +6 -5
- 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 +85 -7
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -1
- data/lib/rubocop/cop/style/each_with_object.rb +1 -1
- data/lib/rubocop/cop/style/empty_block_parameter.rb +1 -1
- 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 +1 -1
- data/lib/rubocop/cop/style/empty_literal.rb +2 -2
- data/lib/rubocop/cop/style/empty_method.rb +19 -4
- 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 +1 -1
- 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 +23 -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 +5 -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 +51 -4
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +11 -0
- data/lib/rubocop/cop/style/hash_conversion.rb +3 -2
- data/lib/rubocop/cop/style/hash_each_methods.rb +6 -1
- data/lib/rubocop/cop/style/hash_except.rb +89 -12
- data/lib/rubocop/cop/style/hash_like_case.rb +1 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +39 -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 +5 -4
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +22 -6
- 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 +11 -4
- 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/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 +28 -8
- 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 +1 -1
- 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 +11 -12
- data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
- 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 +3 -5
- 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 +1 -1
- 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 +1 -1
- data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
- data/lib/rubocop/cop/style/nil_lambda.rb +2 -2
- 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 +18 -10
- data/lib/rubocop/cop/style/numeric_predicate.rb +58 -11
- data/lib/rubocop/cop/style/object_then.rb +69 -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/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 +1 -1
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +9 -4
- data/lib/rubocop/cop/style/proc.rb +1 -1
- 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 +21 -11
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +43 -11
- data/lib/rubocop/cop/style/redundant_capital_w.rb +2 -3
- data/lib/rubocop/cop/style/redundant_condition.rb +131 -16
- data/lib/rubocop/cop/style/redundant_conditional.rb +1 -1
- data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +5 -1
- 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 +154 -0
- data/lib/rubocop/cop/style/redundant_interpolation.rb +40 -5
- data/lib/rubocop/cop/style/redundant_parentheses.rb +3 -2
- data/lib/rubocop/cop/style/redundant_percent_q.rb +3 -4
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +12 -3
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +2 -2
- data/lib/rubocop/cop/style/redundant_return.rb +2 -2
- data/lib/rubocop/cop/style/redundant_self.rb +12 -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 +68 -20
- data/lib/rubocop/cop/style/redundant_sort_by.rb +1 -1
- data/lib/rubocop/cop/style/regexp_literal.rb +4 -4
- data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
- 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 +30 -15
- data/lib/rubocop/cop/style/sample.rb +6 -4
- data/lib/rubocop/cop/style/select_by_regexp.rb +144 -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 +3 -3
- 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 +89 -26
- data/lib/rubocop/cop/style/special_global_vars.rb +70 -8
- data/lib/rubocop/cop/style/static_class.rb +6 -6
- 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_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 +9 -6
- data/lib/rubocop/cop/style/symbol_literal.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +86 -8
- data/lib/rubocop/cop/style/ternary_parentheses.rb +18 -5
- 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 +20 -1
- 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 +4 -5
- 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 +3 -3
- data/lib/rubocop/cop/util.rb +25 -6
- data/lib/rubocop/cop/variable_force/branch.rb +1 -1
- data/lib/rubocop/cop/variable_force.rb +1 -5
- data/lib/rubocop/cops_documentation_generator.rb +38 -9
- data/lib/rubocop/formatter/disabled_config_formatter.rb +19 -2
- 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 +7 -12
- 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 +8 -2
- data/lib/rubocop/formatter/simple_text_formatter.rb +9 -8
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +1 -2
- data/lib/rubocop/formatter.rb +31 -0
- data/lib/rubocop/magic_comment.rb +74 -19
- data/lib/rubocop/options.rb +232 -138
- data/lib/rubocop/rake_task.rb +35 -10
- data/lib/rubocop/remote_config.rb +2 -4
- data/lib/rubocop/result_cache.rb +27 -16
- data/lib/rubocop/rspec/cop_helper.rb +3 -3
- 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 +34 -10
- data/lib/rubocop/rspec/support.rb +15 -0
- data/lib/rubocop/runner.rb +40 -11
- data/lib/rubocop/server/cache.rb +141 -0
- data/lib/rubocop/server/cli.rb +121 -0
- data/lib/rubocop/server/client_command/base.rb +44 -0
- data/lib/rubocop/server/client_command/exec.rb +59 -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 +79 -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 +65 -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 +14 -6
- data/lib/rubocop/version.rb +15 -8
- data/lib/rubocop/yaml_duplication_checker.rb +1 -1
- data/lib/rubocop.rb +42 -30
- metadata +97 -13
- 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,6 +152,9 @@ 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
|
|
@@ -174,6 +179,20 @@ Bundler/GemComment:
|
|
174
179
|
IgnoredGems: []
|
175
180
|
OnlyFor: []
|
176
181
|
|
182
|
+
Bundler/GemFilename:
|
183
|
+
Description: 'Enforces the filename for managing gems.'
|
184
|
+
Enabled: true
|
185
|
+
VersionAdded: '1.20'
|
186
|
+
EnforcedStyle: 'Gemfile'
|
187
|
+
SupportedStyles:
|
188
|
+
- 'Gemfile'
|
189
|
+
- 'gems.rb'
|
190
|
+
Include:
|
191
|
+
- '**/Gemfile'
|
192
|
+
- '**/gems.rb'
|
193
|
+
- '**/Gemfile.lock'
|
194
|
+
- '**/gems.locked'
|
195
|
+
|
177
196
|
Bundler/GemVersion:
|
178
197
|
Description: 'Requires or forbids specifying gem versions.'
|
179
198
|
Enabled: false
|
@@ -195,6 +214,7 @@ Bundler/InsecureProtocolSource:
|
|
195
214
|
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
|
196
215
|
Enabled: true
|
197
216
|
VersionAdded: '0.50'
|
217
|
+
AllowHttpProtocol: true
|
198
218
|
Include:
|
199
219
|
- '**/*.gemfile'
|
200
220
|
- '**/Gemfile'
|
@@ -217,10 +237,22 @@ Bundler/OrderedGems:
|
|
217
237
|
|
218
238
|
#################### Gemspec ###############################
|
219
239
|
|
220
|
-
Gemspec/
|
221
|
-
Description: '
|
240
|
+
Gemspec/DependencyVersion:
|
241
|
+
Description: 'Requires or forbids specifying gem dependency versions.'
|
242
|
+
Enabled: false
|
243
|
+
VersionAdded: '1.29'
|
244
|
+
EnforcedStyle: 'required'
|
245
|
+
SupportedStyles:
|
246
|
+
- 'required'
|
247
|
+
- 'forbidden'
|
248
|
+
Include:
|
249
|
+
- '**/*.gemspec'
|
250
|
+
AllowedGems: []
|
251
|
+
|
252
|
+
Gemspec/DeprecatedAttributeAssignment:
|
253
|
+
Description: Checks that deprecated attribute assignments are not set in a gemspec file.
|
222
254
|
Enabled: pending
|
223
|
-
VersionAdded: '1.
|
255
|
+
VersionAdded: '1.30'
|
224
256
|
Include:
|
225
257
|
- '**/*.gemspec'
|
226
258
|
|
@@ -243,11 +275,20 @@ Gemspec/OrderedDependencies:
|
|
243
275
|
Include:
|
244
276
|
- '**/*.gemspec'
|
245
277
|
|
278
|
+
Gemspec/RequireMFA:
|
279
|
+
Description: 'Checks that the gemspec has metadata to require Multi-Factor Authentication from RubyGems.'
|
280
|
+
Enabled: pending
|
281
|
+
VersionAdded: '1.23'
|
282
|
+
Reference:
|
283
|
+
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
284
|
+
Include:
|
285
|
+
- '**/*.gemspec'
|
286
|
+
|
246
287
|
Gemspec/RequiredRubyVersion:
|
247
288
|
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
248
289
|
Enabled: true
|
249
290
|
VersionAdded: '0.52'
|
250
|
-
VersionChanged: '
|
291
|
+
VersionChanged: '1.22'
|
251
292
|
Include:
|
252
293
|
- '**/*.gemspec'
|
253
294
|
|
@@ -403,13 +444,13 @@ Layout/ClassStructure:
|
|
403
444
|
- prepend
|
404
445
|
- extend
|
405
446
|
ExpectedOrder:
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
447
|
+
- module_inclusion
|
448
|
+
- constants
|
449
|
+
- public_class_methods
|
450
|
+
- initializer
|
451
|
+
- public_methods
|
452
|
+
- protected_methods
|
453
|
+
- private_methods
|
413
454
|
|
414
455
|
Layout/ClosingHeredocIndentation:
|
415
456
|
Description: 'Checks the indentation of here document closings.'
|
@@ -424,7 +465,11 @@ Layout/ClosingParenthesisIndentation:
|
|
424
465
|
Layout/CommentIndentation:
|
425
466
|
Description: 'Indentation of comments.'
|
426
467
|
Enabled: true
|
468
|
+
# When true, allows comments to have extra indentation if that aligns them
|
469
|
+
# with a comment on the preceding line.
|
470
|
+
AllowForAlignment: false
|
427
471
|
VersionAdded: '0.49'
|
472
|
+
VersionChanged: '1.24'
|
428
473
|
|
429
474
|
Layout/ConditionPosition:
|
430
475
|
Description: >-
|
@@ -496,13 +541,13 @@ Layout/EmptyLineBetweenDefs:
|
|
496
541
|
StyleGuide: '#empty-lines-between-methods'
|
497
542
|
Enabled: true
|
498
543
|
VersionAdded: '0.49'
|
499
|
-
VersionChanged: '1.
|
544
|
+
VersionChanged: '1.23'
|
500
545
|
EmptyLineBetweenMethodDefs: true
|
501
546
|
EmptyLineBetweenClassDefs: true
|
502
547
|
EmptyLineBetweenModuleDefs: true
|
503
|
-
#
|
504
|
-
# need an empty line between them.
|
505
|
-
AllowAdjacentOneLineDefs:
|
548
|
+
# `AllowAdjacentOneLineDefs` means that single line method definitions don't
|
549
|
+
# need an empty line between them. `true` by default.
|
550
|
+
AllowAdjacentOneLineDefs: true
|
506
551
|
# Can be array to specify minimum and maximum number of empty lines, e.g. [1, 2]
|
507
552
|
NumberOfEmptyLines: 1
|
508
553
|
|
@@ -852,7 +897,7 @@ Layout/HeredocArgumentClosingParenthesis:
|
|
852
897
|
VersionAdded: '0.68'
|
853
898
|
|
854
899
|
Layout/HeredocIndentation:
|
855
|
-
Description: '
|
900
|
+
Description: 'Checks the indentation of the here document bodies.'
|
856
901
|
StyleGuide: '#squiggly-heredocs'
|
857
902
|
Enabled: true
|
858
903
|
VersionAdded: '0.49'
|
@@ -885,7 +930,7 @@ Layout/IndentationStyle:
|
|
885
930
|
VersionChanged: '0.82'
|
886
931
|
# By default the indentation width from `Layout/IndentationWidth` is used,
|
887
932
|
# but it can be overridden by setting this parameter.
|
888
|
-
# It is used during
|
933
|
+
# It is used during autocorrection to determine how many spaces should
|
889
934
|
# replace each tab.
|
890
935
|
IndentationWidth: ~
|
891
936
|
EnforcedStyle: spaces
|
@@ -900,7 +945,8 @@ Layout/IndentationWidth:
|
|
900
945
|
VersionAdded: '0.49'
|
901
946
|
# Number of spaces for each indentation level.
|
902
947
|
Width: 2
|
903
|
-
|
948
|
+
AllowedPatterns: []
|
949
|
+
IgnoredPatterns: [] # deprecated
|
904
950
|
|
905
951
|
Layout/InitialIndentation:
|
906
952
|
Description: >-
|
@@ -923,6 +969,31 @@ Layout/LeadingEmptyLines:
|
|
923
969
|
VersionAdded: '0.57'
|
924
970
|
VersionChanged: '0.77'
|
925
971
|
|
972
|
+
Layout/LineContinuationLeadingSpace:
|
973
|
+
Description: >-
|
974
|
+
Use trailing spaces instead of leading spaces in strings
|
975
|
+
broken over multiple lines (by a backslash).
|
976
|
+
Enabled: pending
|
977
|
+
AutoCorrect: false
|
978
|
+
SafeAutoCorrect: false
|
979
|
+
VersionAdded: '1.31'
|
980
|
+
VersionChanged: '1.32'
|
981
|
+
EnforcedStyle: trailing
|
982
|
+
SupportedStyles:
|
983
|
+
- leading
|
984
|
+
- trailing
|
985
|
+
|
986
|
+
Layout/LineContinuationSpacing:
|
987
|
+
Description: 'Checks the spacing in front of backslash in line continuations.'
|
988
|
+
Enabled: pending
|
989
|
+
AutoCorrect: true
|
990
|
+
SafeAutoCorrect: true
|
991
|
+
VersionAdded: '1.31'
|
992
|
+
EnforcedStyle: space
|
993
|
+
SupportedStyles:
|
994
|
+
- space
|
995
|
+
- no_space
|
996
|
+
|
926
997
|
Layout/LineEndStringConcatenationIndentation:
|
927
998
|
Description: >-
|
928
999
|
Checks the indentation of the next line after a line that
|
@@ -943,7 +1014,6 @@ Layout/LineLength:
|
|
943
1014
|
Enabled: true
|
944
1015
|
VersionAdded: '0.25'
|
945
1016
|
VersionChanged: '1.4'
|
946
|
-
AutoCorrect: true
|
947
1017
|
Max: 120
|
948
1018
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
949
1019
|
# containing a URI to be longer than Max.
|
@@ -955,10 +1025,11 @@ Layout/LineLength:
|
|
955
1025
|
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
956
1026
|
# directives like '# rubocop: enable ...' when calculating a line's length.
|
957
1027
|
IgnoreCopDirectives: true
|
958
|
-
# The
|
1028
|
+
# The AllowedPatterns option is a list of !ruby/regexp and/or string
|
959
1029
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
960
1030
|
# any regular expression listed in this option will be ignored by LineLength.
|
961
|
-
|
1031
|
+
AllowedPatterns: []
|
1032
|
+
IgnoredPatterns: [] # deprecated
|
962
1033
|
|
963
1034
|
Layout/MultilineArrayBraceLayout:
|
964
1035
|
Description: >-
|
@@ -1087,6 +1158,13 @@ Layout/MultilineMethodDefinitionBraceLayout:
|
|
1087
1158
|
- new_line
|
1088
1159
|
- same_line
|
1089
1160
|
|
1161
|
+
Layout/MultilineMethodParameterLineBreaks:
|
1162
|
+
Description: >-
|
1163
|
+
Checks that each parameter in a multi-line method definition
|
1164
|
+
starts on a separate line.
|
1165
|
+
Enabled: false
|
1166
|
+
VersionAdded: '1.32'
|
1167
|
+
|
1090
1168
|
Layout/MultilineOperationIndentation:
|
1091
1169
|
Description: >-
|
1092
1170
|
Checks indentation of binary operations that span more than
|
@@ -1347,10 +1425,11 @@ Layout/SpaceInsideParens:
|
|
1347
1425
|
StyleGuide: '#spaces-braces'
|
1348
1426
|
Enabled: true
|
1349
1427
|
VersionAdded: '0.49'
|
1350
|
-
VersionChanged: '
|
1428
|
+
VersionChanged: '1.22'
|
1351
1429
|
EnforcedStyle: no_space
|
1352
1430
|
SupportedStyles:
|
1353
1431
|
- space
|
1432
|
+
- compact
|
1354
1433
|
- no_space
|
1355
1434
|
|
1356
1435
|
Layout/SpaceInsidePercentLiteralDelimiters:
|
@@ -1423,7 +1502,9 @@ Lint/AmbiguousBlockAssociation:
|
|
1423
1502
|
Enabled: true
|
1424
1503
|
VersionAdded: '0.48'
|
1425
1504
|
VersionChanged: '1.13'
|
1426
|
-
|
1505
|
+
AllowedMethods: []
|
1506
|
+
AllowedPatterns: []
|
1507
|
+
IgnoredMethods: [] # deprecated
|
1427
1508
|
|
1428
1509
|
Lint/AmbiguousOperator:
|
1429
1510
|
Description: >-
|
@@ -1434,6 +1515,13 @@ Lint/AmbiguousOperator:
|
|
1434
1515
|
VersionAdded: '0.17'
|
1435
1516
|
VersionChanged: '0.83'
|
1436
1517
|
|
1518
|
+
Lint/AmbiguousOperatorPrecedence:
|
1519
|
+
Description: >-
|
1520
|
+
Checks for expressions containing multiple binary operations with
|
1521
|
+
ambiguous precedence.
|
1522
|
+
Enabled: pending
|
1523
|
+
VersionAdded: '1.21'
|
1524
|
+
|
1437
1525
|
Lint/AmbiguousRange:
|
1438
1526
|
Description: Checks for ranges with ambiguous boundaries.
|
1439
1527
|
Enabled: pending
|
@@ -1462,7 +1550,7 @@ Lint/BigDecimalNew:
|
|
1462
1550
|
VersionAdded: '0.53'
|
1463
1551
|
|
1464
1552
|
Lint/BinaryOperatorWithIdenticalOperands:
|
1465
|
-
Description: '
|
1553
|
+
Description: 'Checks for places where binary operator has identical operands.'
|
1466
1554
|
Enabled: true
|
1467
1555
|
Safe: false
|
1468
1556
|
VersionAdded: '0.89'
|
@@ -1471,9 +1559,9 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1471
1559
|
Lint/BooleanSymbol:
|
1472
1560
|
Description: 'Check for `:true` and `:false` symbols.'
|
1473
1561
|
Enabled: true
|
1474
|
-
|
1562
|
+
SafeAutoCorrect: false
|
1475
1563
|
VersionAdded: '0.50'
|
1476
|
-
VersionChanged: '
|
1564
|
+
VersionChanged: '1.22'
|
1477
1565
|
|
1478
1566
|
Lint/CircularArgumentReference:
|
1479
1567
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
@@ -1491,6 +1579,11 @@ Lint/ConstantDefinitionInBlock:
|
|
1491
1579
|
AllowedMethods:
|
1492
1580
|
- enums
|
1493
1581
|
|
1582
|
+
Lint/ConstantOverwrittenInRescue:
|
1583
|
+
Description: 'Checks for overwriting an exception with an exception result by use `rescue =>`.'
|
1584
|
+
Enabled: pending
|
1585
|
+
VersionAdded: '1.31'
|
1586
|
+
|
1494
1587
|
Lint/ConstantResolution:
|
1495
1588
|
Description: 'Check that constants are fully qualified with `::`.'
|
1496
1589
|
Enabled: false
|
@@ -1519,6 +1612,11 @@ Lint/Debugger:
|
|
1519
1612
|
Capybara:
|
1520
1613
|
- save_and_open_page
|
1521
1614
|
- save_and_open_screenshot
|
1615
|
+
debug.rb:
|
1616
|
+
- binding.b
|
1617
|
+
- binding.break
|
1618
|
+
- Kernel.binding.b
|
1619
|
+
- Kernel.binding.break
|
1522
1620
|
Pry:
|
1523
1621
|
- binding.pry
|
1524
1622
|
- binding.remote_pry
|
@@ -1527,6 +1625,8 @@ Lint/Debugger:
|
|
1527
1625
|
Rails:
|
1528
1626
|
- debugger
|
1529
1627
|
- Kernel.debugger
|
1628
|
+
RubyJard:
|
1629
|
+
- jard
|
1530
1630
|
WebConsole:
|
1531
1631
|
- binding.console
|
1532
1632
|
|
@@ -1539,6 +1639,7 @@ Lint/DeprecatedConstants:
|
|
1539
1639
|
Description: 'Checks for deprecated constants.'
|
1540
1640
|
Enabled: pending
|
1541
1641
|
VersionAdded: '1.8'
|
1642
|
+
VersionChanged: '1.22'
|
1542
1643
|
# You can configure deprecated constants.
|
1543
1644
|
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1544
1645
|
# And you can set the deprecated version as `DeprecatedVersion`.
|
@@ -1559,6 +1660,9 @@ Lint/DeprecatedConstants:
|
|
1559
1660
|
'FALSE':
|
1560
1661
|
Alternative: 'false'
|
1561
1662
|
DeprecatedVersion: '2.4'
|
1663
|
+
'Net::HTTPServerException':
|
1664
|
+
Alternative: 'Net::HTTPClientException'
|
1665
|
+
DeprecatedVersion: '2.6'
|
1562
1666
|
'Random::DEFAULT':
|
1563
1667
|
Alternative: 'Random.new'
|
1564
1668
|
DeprecatedVersion: '3.0'
|
@@ -1612,7 +1716,9 @@ Lint/DuplicateRegexpCharacterClassElement:
|
|
1612
1716
|
Lint/DuplicateRequire:
|
1613
1717
|
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1614
1718
|
Enabled: true
|
1719
|
+
SafeAutoCorrect: false
|
1615
1720
|
VersionAdded: '0.90'
|
1721
|
+
VersionChanged: '1.28'
|
1616
1722
|
|
1617
1723
|
Lint/DuplicateRescueException:
|
1618
1724
|
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
@@ -1631,7 +1737,7 @@ Lint/ElseLayout:
|
|
1631
1737
|
VersionChanged: '1.2'
|
1632
1738
|
|
1633
1739
|
Lint/EmptyBlock:
|
1634
|
-
Description: '
|
1740
|
+
Description: 'Checks for blocks without a body.'
|
1635
1741
|
Enabled: pending
|
1636
1742
|
VersionAdded: '1.1'
|
1637
1743
|
VersionChanged: '1.15'
|
@@ -1645,10 +1751,11 @@ Lint/EmptyClass:
|
|
1645
1751
|
AllowComments: false
|
1646
1752
|
|
1647
1753
|
Lint/EmptyConditionalBody:
|
1648
|
-
Description: '
|
1754
|
+
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1649
1755
|
Enabled: true
|
1650
1756
|
AllowComments: true
|
1651
1757
|
VersionAdded: '0.89'
|
1758
|
+
VersionChanged: '1.33'
|
1652
1759
|
|
1653
1760
|
Lint/EmptyEnsure:
|
1654
1761
|
Description: 'Checks for empty ensure block.'
|
@@ -1750,6 +1857,13 @@ Lint/ImplicitStringConcatenation:
|
|
1750
1857
|
Enabled: true
|
1751
1858
|
VersionAdded: '0.36'
|
1752
1859
|
|
1860
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
1861
|
+
Description: 'Checks for `IO.select` that is incompatible with Fiber Scheduler.'
|
1862
|
+
Enabled: pending
|
1863
|
+
SafeAutoCorrect: false
|
1864
|
+
VersionAdded: '1.21'
|
1865
|
+
VersionChanged: '1.24'
|
1866
|
+
|
1753
1867
|
Lint/IneffectiveAccessModifier:
|
1754
1868
|
Description: >-
|
1755
1869
|
Checks for attempts to use `private` or `protected` to set
|
@@ -1760,12 +1874,14 @@ Lint/IneffectiveAccessModifier:
|
|
1760
1874
|
Lint/InheritException:
|
1761
1875
|
Description: 'Avoid inheriting from the `Exception` class.'
|
1762
1876
|
Enabled: true
|
1877
|
+
SafeAutoCorrect: false
|
1763
1878
|
VersionAdded: '0.41'
|
1879
|
+
VersionChanged: '1.26'
|
1764
1880
|
# The default base class in favour of `Exception`.
|
1765
|
-
EnforcedStyle:
|
1881
|
+
EnforcedStyle: standard_error
|
1766
1882
|
SupportedStyles:
|
1767
|
-
- runtime_error
|
1768
1883
|
- standard_error
|
1884
|
+
- runtime_error
|
1769
1885
|
|
1770
1886
|
Lint/InterpolationCheck:
|
1771
1887
|
Description: 'Raise warning for interpolation in single q strs.'
|
@@ -1815,7 +1931,7 @@ Lint/MissingCopEnableDirective:
|
|
1815
1931
|
|
1816
1932
|
Lint/MissingSuper:
|
1817
1933
|
Description: >-
|
1818
|
-
|
1934
|
+
Checks for the presence of constructors and lifecycle callbacks
|
1819
1935
|
without calls to `super`.
|
1820
1936
|
Enabled: true
|
1821
1937
|
VersionAdded: '0.89'
|
@@ -1844,7 +1960,7 @@ Lint/NestedPercentLiteral:
|
|
1844
1960
|
VersionAdded: '0.52'
|
1845
1961
|
|
1846
1962
|
Lint/NextWithoutAccumulator:
|
1847
|
-
Description:
|
1963
|
+
Description: >-
|
1848
1964
|
Do not omit the accumulator when calling `next`
|
1849
1965
|
in a `reduce`/`inject` block.
|
1850
1966
|
Enabled: true
|
@@ -1855,6 +1971,13 @@ Lint/NoReturnInBeginEndBlocks:
|
|
1855
1971
|
Enabled: pending
|
1856
1972
|
VersionAdded: '1.2'
|
1857
1973
|
|
1974
|
+
Lint/NonAtomicFileOperation:
|
1975
|
+
Description: Checks for non-atomic file operations.
|
1976
|
+
StyleGuide: '#atomic-file-operations'
|
1977
|
+
Enabled: pending
|
1978
|
+
VersionAdded: '1.31'
|
1979
|
+
SafeAutoCorrect: false
|
1980
|
+
|
1858
1981
|
Lint/NonDeterministicRequireOrder:
|
1859
1982
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1860
1983
|
Enabled: true
|
@@ -1872,7 +1995,9 @@ Lint/NumberConversion:
|
|
1872
1995
|
VersionAdded: '0.53'
|
1873
1996
|
VersionChanged: '1.1'
|
1874
1997
|
SafeAutoCorrect: false
|
1875
|
-
|
1998
|
+
AllowedMethods: []
|
1999
|
+
AllowedPatterns: []
|
2000
|
+
IgnoredMethods: [] # deprecated
|
1876
2001
|
IgnoredClasses:
|
1877
2002
|
- Time
|
1878
2003
|
- DateTime
|
@@ -1955,6 +2080,8 @@ Lint/RedundantDirGlobSort:
|
|
1955
2080
|
Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
|
1956
2081
|
Enabled: pending
|
1957
2082
|
VersionAdded: '1.8'
|
2083
|
+
VersionChanged: '1.26'
|
2084
|
+
SafeAutoCorrect: false
|
1958
2085
|
|
1959
2086
|
Lint/RedundantRequireStatement:
|
1960
2087
|
Description: 'Checks for unnecessary `require` statement.'
|
@@ -1998,6 +2125,12 @@ Lint/RedundantWithObject:
|
|
1998
2125
|
Enabled: true
|
1999
2126
|
VersionAdded: '0.51'
|
2000
2127
|
|
2128
|
+
Lint/RefinementImportMethods:
|
2129
|
+
Description: 'Use `Refinement#import_methods` when using `include` or `prepend` in `refine` block.'
|
2130
|
+
Enabled: pending
|
2131
|
+
SafeAutoCorrect: false
|
2132
|
+
VersionAdded: '1.27'
|
2133
|
+
|
2001
2134
|
Lint/RegexpAsCondition:
|
2002
2135
|
Description: >-
|
2003
2136
|
Do not use regexp literal as a condition.
|
@@ -2013,6 +2146,16 @@ Lint/RequireParentheses:
|
|
2013
2146
|
Enabled: true
|
2014
2147
|
VersionAdded: '0.18'
|
2015
2148
|
|
2149
|
+
Lint/RequireRangeParentheses:
|
2150
|
+
Description: 'Checks that a range literal is enclosed in parentheses when the end of the range is at a line break.'
|
2151
|
+
Enabled: pending
|
2152
|
+
VersionAdded: '1.32'
|
2153
|
+
|
2154
|
+
Lint/RequireRelativeSelfPath:
|
2155
|
+
Description: 'Checks for uses a file requiring itself with `require_relative`.'
|
2156
|
+
Enabled: pending
|
2157
|
+
VersionAdded: '1.22'
|
2158
|
+
|
2016
2159
|
Lint/RescueException:
|
2017
2160
|
Description: 'Avoid rescuing the Exception class.'
|
2018
2161
|
StyleGuide: '#no-blind-rescues'
|
@@ -2131,7 +2274,7 @@ Lint/Syntax:
|
|
2131
2274
|
VersionAdded: '0.9'
|
2132
2275
|
|
2133
2276
|
Lint/ToEnumArguments:
|
2134
|
-
Description: '
|
2277
|
+
Description: 'Ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
2135
2278
|
Enabled: pending
|
2136
2279
|
VersionAdded: '1.1'
|
2137
2280
|
|
@@ -2141,12 +2284,12 @@ Lint/ToJSON:
|
|
2141
2284
|
VersionAdded: '0.66'
|
2142
2285
|
|
2143
2286
|
Lint/TopLevelReturnWithArgument:
|
2144
|
-
Description: '
|
2287
|
+
Description: 'Detects top level return statements with argument.'
|
2145
2288
|
Enabled: true
|
2146
2289
|
VersionAdded: '0.89'
|
2147
2290
|
|
2148
2291
|
Lint/TrailingCommaInAttributeDeclaration:
|
2149
|
-
Description: '
|
2292
|
+
Description: 'Checks for trailing commas in attribute declarations.'
|
2150
2293
|
Enabled: true
|
2151
2294
|
VersionAdded: '0.90'
|
2152
2295
|
|
@@ -2195,14 +2338,15 @@ Lint/UnreachableCode:
|
|
2195
2338
|
VersionAdded: '0.9'
|
2196
2339
|
|
2197
2340
|
Lint/UnreachableLoop:
|
2198
|
-
Description: '
|
2341
|
+
Description: 'Checks for loops that will have at most one iteration.'
|
2199
2342
|
Enabled: true
|
2200
2343
|
VersionAdded: '0.89'
|
2201
2344
|
VersionChanged: '1.7'
|
2202
|
-
|
2345
|
+
AllowedPatterns:
|
2203
2346
|
# RSpec uses `times` in its message expectations
|
2204
2347
|
# eg. `exactly(2).times`
|
2205
2348
|
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2349
|
+
IgnoredPatterns: [] # deprecated
|
2206
2350
|
|
2207
2351
|
Lint/UnusedBlockArgument:
|
2208
2352
|
Description: 'Checks for unused block arguments.'
|
@@ -2257,13 +2401,19 @@ Lint/UselessElseWithoutRescue:
|
|
2257
2401
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
2258
2402
|
Enabled: true
|
2259
2403
|
VersionAdded: '0.17'
|
2404
|
+
VersionChanged: '1.31'
|
2260
2405
|
|
2261
2406
|
Lint/UselessMethodDefinition:
|
2262
2407
|
Description: 'Checks for useless method definitions.'
|
2263
2408
|
Enabled: true
|
2264
2409
|
VersionAdded: '0.90'
|
2410
|
+
VersionChanged: '0.91'
|
2265
2411
|
Safe: false
|
2266
|
-
|
2412
|
+
|
2413
|
+
Lint/UselessRuby2Keywords:
|
2414
|
+
Description: 'Finds unnecessary uses of `ruby2_keywords`.'
|
2415
|
+
Enabled: pending
|
2416
|
+
VersionAdded: '1.23'
|
2267
2417
|
|
2268
2418
|
Lint/UselessSetterCall:
|
2269
2419
|
Description: 'Checks for useless setter call to a local variable.'
|
@@ -2299,7 +2449,9 @@ Metrics/AbcSize:
|
|
2299
2449
|
VersionChanged: '1.5'
|
2300
2450
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
2301
2451
|
# a Float.
|
2302
|
-
|
2452
|
+
AllowedMethods: []
|
2453
|
+
AllowedPatterns: []
|
2454
|
+
IgnoredMethods: [] # deprecated
|
2303
2455
|
CountRepeatedAttributes: true
|
2304
2456
|
Max: 17
|
2305
2457
|
|
@@ -2312,10 +2464,12 @@ Metrics/BlockLength:
|
|
2312
2464
|
Max: 25
|
2313
2465
|
CountAsOne: []
|
2314
2466
|
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2315
|
-
|
2467
|
+
AllowedMethods:
|
2316
2468
|
# By default, exclude the `#refine` method, as it tends to have larger
|
2317
2469
|
# associated blocks.
|
2318
2470
|
- refine
|
2471
|
+
AllowedPatterns: []
|
2472
|
+
IgnoredMethods: [] # deprecated
|
2319
2473
|
Exclude:
|
2320
2474
|
- '**/*.gemspec'
|
2321
2475
|
|
@@ -2345,7 +2499,9 @@ Metrics/CyclomaticComplexity:
|
|
2345
2499
|
Enabled: true
|
2346
2500
|
VersionAdded: '0.25'
|
2347
2501
|
VersionChanged: '0.81'
|
2348
|
-
|
2502
|
+
AllowedMethods: []
|
2503
|
+
AllowedPatterns: []
|
2504
|
+
IgnoredMethods: [] # deprecated
|
2349
2505
|
Max: 7
|
2350
2506
|
|
2351
2507
|
Metrics/MethodLength:
|
@@ -2358,7 +2514,9 @@ Metrics/MethodLength:
|
|
2358
2514
|
Max: 10
|
2359
2515
|
CountAsOne: []
|
2360
2516
|
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2361
|
-
|
2517
|
+
AllowedMethods: []
|
2518
|
+
AllowedPatterns: []
|
2519
|
+
IgnoredMethods: [] # deprecated
|
2362
2520
|
|
2363
2521
|
Metrics/ModuleLength:
|
2364
2522
|
Description: 'Avoid modules longer than 100 lines of code.'
|
@@ -2386,7 +2544,9 @@ Metrics/PerceivedComplexity:
|
|
2386
2544
|
Enabled: true
|
2387
2545
|
VersionAdded: '0.25'
|
2388
2546
|
VersionChanged: '0.81'
|
2389
|
-
|
2547
|
+
AllowedMethods: []
|
2548
|
+
AllowedPatterns: []
|
2549
|
+
IgnoredMethods: [] # deprecated
|
2390
2550
|
Max: 8
|
2391
2551
|
|
2392
2552
|
################## Migration #############################
|
@@ -2421,6 +2581,17 @@ Naming/BinaryOperatorParameterName:
|
|
2421
2581
|
VersionAdded: '0.50'
|
2422
2582
|
VersionChanged: '1.2'
|
2423
2583
|
|
2584
|
+
Naming/BlockForwarding:
|
2585
|
+
Description: 'Use anonymous block forwarding.'
|
2586
|
+
StyleGuide: '#block-forwarding'
|
2587
|
+
Enabled: pending
|
2588
|
+
VersionAdded: '1.24'
|
2589
|
+
EnforcedStyle: anonymous
|
2590
|
+
SupportedStyles:
|
2591
|
+
- anonymous
|
2592
|
+
- explicit
|
2593
|
+
BlockForwardingName: block
|
2594
|
+
|
2424
2595
|
Naming/BlockParameterName:
|
2425
2596
|
Description: >-
|
2426
2597
|
Checks for block parameter names that contain capital letters,
|
@@ -2458,6 +2629,7 @@ Naming/FileName:
|
|
2458
2629
|
StyleGuide: '#snake-case-files'
|
2459
2630
|
Enabled: true
|
2460
2631
|
VersionAdded: '0.50'
|
2632
|
+
VersionChanged: '1.23'
|
2461
2633
|
# Camel case file names listed in `AllCops:Include` and all file names listed
|
2462
2634
|
# in `AllCops:Exclude` are excluded by default. Add extra excludes here.
|
2463
2635
|
Exclude: []
|
@@ -2470,6 +2642,13 @@ Naming/FileName:
|
|
2470
2642
|
# whether each source file's class or module name matches the file name --
|
2471
2643
|
# not whether the nested module hierarchy matches the subdirectory path.
|
2472
2644
|
CheckDefinitionPathHierarchy: true
|
2645
|
+
# paths that are considered root directories, for example "lib" in most ruby projects
|
2646
|
+
# or "app/models" in rails projects
|
2647
|
+
CheckDefinitionPathHierarchyRoots:
|
2648
|
+
- lib
|
2649
|
+
- spec
|
2650
|
+
- test
|
2651
|
+
- src
|
2473
2652
|
# If non-`nil`, expect all source file names to match the following regex.
|
2474
2653
|
# Only the file name itself is matched, not the entire file path.
|
2475
2654
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -2542,8 +2721,9 @@ Naming/HeredocDelimiterNaming:
|
|
2542
2721
|
|
2543
2722
|
Naming/InclusiveLanguage:
|
2544
2723
|
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
2545
|
-
Enabled:
|
2724
|
+
Enabled: false
|
2546
2725
|
VersionAdded: '1.18'
|
2726
|
+
VersionChanged: '1.21'
|
2547
2727
|
CheckIdentifiers: true
|
2548
2728
|
CheckConstants: true
|
2549
2729
|
CheckVariables: true
|
@@ -2590,11 +2770,12 @@ Naming/MethodName:
|
|
2590
2770
|
- camelCase
|
2591
2771
|
# Method names matching patterns are always allowed.
|
2592
2772
|
#
|
2593
|
-
#
|
2773
|
+
# AllowedPatterns:
|
2594
2774
|
# - '\A\s*onSelectionBulkChange\s*'
|
2595
2775
|
# - '\A\s*onSelectionCleared\s*'
|
2596
2776
|
#
|
2597
|
-
|
2777
|
+
AllowedPatterns: []
|
2778
|
+
IgnoredPatterns: [] # deprecated
|
2598
2779
|
|
2599
2780
|
Naming/MethodParameterName:
|
2600
2781
|
Description: >-
|
@@ -2670,6 +2851,7 @@ Naming/VariableName:
|
|
2670
2851
|
- snake_case
|
2671
2852
|
- camelCase
|
2672
2853
|
AllowedIdentifiers: []
|
2854
|
+
AllowedPatterns: []
|
2673
2855
|
|
2674
2856
|
Naming/VariableNumber:
|
2675
2857
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -2691,14 +2873,28 @@ Naming/VariableNumber:
|
|
2691
2873
|
- rfc822 # Time#rfc822
|
2692
2874
|
- rfc2822 # Time#rfc2822
|
2693
2875
|
- rfc3339 # DateTime.rfc3339
|
2876
|
+
AllowedPatterns: []
|
2694
2877
|
|
2695
2878
|
#################### Security ##############################
|
2696
2879
|
|
2880
|
+
Security/CompoundHash:
|
2881
|
+
Description: 'When overwriting Object#hash to combine values, prefer delegating to Array#hash over writing a custom implementation.'
|
2882
|
+
Enabled: pending
|
2883
|
+
VersionAdded: '1.28'
|
2884
|
+
|
2697
2885
|
Security/Eval:
|
2698
2886
|
Description: 'The use of eval represents a serious security risk.'
|
2699
2887
|
Enabled: true
|
2700
2888
|
VersionAdded: '0.47'
|
2701
2889
|
|
2890
|
+
Security/IoMethods:
|
2891
|
+
Description: >-
|
2892
|
+
Checks for the first argument to `IO.read`, `IO.binread`, `IO.write`, `IO.binwrite`,
|
2893
|
+
`IO.foreach`, and `IO.readlines`.
|
2894
|
+
Enabled: pending
|
2895
|
+
Safe: false
|
2896
|
+
VersionAdded: '1.22'
|
2897
|
+
|
2702
2898
|
Security/JSONLoad:
|
2703
2899
|
Description: >-
|
2704
2900
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
@@ -2706,10 +2902,9 @@ Security/JSONLoad:
|
|
2706
2902
|
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2707
2903
|
Enabled: true
|
2708
2904
|
VersionAdded: '0.43'
|
2709
|
-
VersionChanged: '
|
2905
|
+
VersionChanged: '1.22'
|
2710
2906
|
# Autocorrect here will change to a method that may cause crashes depending
|
2711
2907
|
# on the value of the argument.
|
2712
|
-
AutoCorrect: false
|
2713
2908
|
SafeAutoCorrect: false
|
2714
2909
|
|
2715
2910
|
Security/MarshalLoad:
|
@@ -2775,8 +2970,9 @@ Style/AndOr:
|
|
2775
2970
|
Description: 'Use &&/|| instead of and/or.'
|
2776
2971
|
StyleGuide: '#no-and-or-or'
|
2777
2972
|
Enabled: true
|
2973
|
+
SafeAutoCorrect: false
|
2778
2974
|
VersionAdded: '0.9'
|
2779
|
-
VersionChanged: '
|
2975
|
+
VersionChanged: '1.21'
|
2780
2976
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2781
2977
|
# or completely (always).
|
2782
2978
|
EnforcedStyle: conditionals
|
@@ -2810,9 +3006,9 @@ Style/ArrayJoin:
|
|
2810
3006
|
Style/AsciiComments:
|
2811
3007
|
Description: 'Use only ascii symbols in comments.'
|
2812
3008
|
StyleGuide: '#english-comments'
|
2813
|
-
Enabled:
|
3009
|
+
Enabled: false
|
2814
3010
|
VersionAdded: '0.9'
|
2815
|
-
VersionChanged: '
|
3011
|
+
VersionChanged: '1.21'
|
2816
3012
|
AllowedChars:
|
2817
3013
|
- ©
|
2818
3014
|
|
@@ -2881,7 +3077,7 @@ Style/BlockDelimiters:
|
|
2881
3077
|
# This looks at the usage of a block's method to determine its type (e.g. is
|
2882
3078
|
# the result of a `map` assigned to a variable or passed to another
|
2883
3079
|
# method) but exceptions are permitted in the `ProceduralMethods`,
|
2884
|
-
# `FunctionalMethods` and `
|
3080
|
+
# `FunctionalMethods` and `AllowedMethods` sections below.
|
2885
3081
|
- semantic
|
2886
3082
|
# The `braces_for_chaining` style enforces braces around single line blocks
|
2887
3083
|
# and do..end around multi-line blocks, except for multi-line blocks whose
|
@@ -2922,7 +3118,7 @@ Style/BlockDelimiters:
|
|
2922
3118
|
- let!
|
2923
3119
|
- subject
|
2924
3120
|
- watch
|
2925
|
-
|
3121
|
+
AllowedMethods:
|
2926
3122
|
# Methods that can be either procedural or functional and cannot be
|
2927
3123
|
# categorised from their usage alone, e.g.
|
2928
3124
|
#
|
@@ -2939,6 +3135,8 @@ Style/BlockDelimiters:
|
|
2939
3135
|
- lambda
|
2940
3136
|
- proc
|
2941
3137
|
- it
|
3138
|
+
AllowedPatterns: []
|
3139
|
+
IgnoredMethods: [] # deprecated
|
2942
3140
|
# The AllowBracesOnProceduralOneLiners option is ignored unless the
|
2943
3141
|
# EnforcedStyle is set to `semantic`. If so:
|
2944
3142
|
#
|
@@ -2974,7 +3172,7 @@ Style/CaseEquality:
|
|
2974
3172
|
Enabled: true
|
2975
3173
|
VersionAdded: '0.9'
|
2976
3174
|
VersionChanged: '0.89'
|
2977
|
-
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
3175
|
+
# If `AllowOnConstant` option is enabled, the cop will ignore violations when the receiver of
|
2978
3176
|
# the case equality operator is a constant.
|
2979
3177
|
#
|
2980
3178
|
# # bad
|
@@ -2985,7 +3183,7 @@ Style/CaseEquality:
|
|
2985
3183
|
AllowOnConstant: false
|
2986
3184
|
|
2987
3185
|
Style/CaseLikeIf:
|
2988
|
-
Description: '
|
3186
|
+
Description: 'Identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2989
3187
|
StyleGuide: '#case-vs-if-else'
|
2990
3188
|
Enabled: true
|
2991
3189
|
Safe: false
|
@@ -3042,10 +3240,12 @@ Style/ClassEqualityComparison:
|
|
3042
3240
|
StyleGuide: '#instance-of-vs-class-comparison'
|
3043
3241
|
Enabled: true
|
3044
3242
|
VersionAdded: '0.93'
|
3045
|
-
|
3243
|
+
AllowedMethods:
|
3046
3244
|
- ==
|
3047
3245
|
- equal?
|
3048
3246
|
- eql?
|
3247
|
+
AllowedPatterns: []
|
3248
|
+
IgnoredMethods: [] # deprecated
|
3049
3249
|
|
3050
3250
|
Style/ClassMethods:
|
3051
3251
|
Description: 'Use self when defining module/class methods.'
|
@@ -3059,7 +3259,7 @@ Style/ClassMethodsDefinitions:
|
|
3059
3259
|
StyleGuide: '#def-self-class-methods'
|
3060
3260
|
Enabled: false
|
3061
3261
|
VersionAdded: '0.89'
|
3062
|
-
EnforcedStyle:
|
3262
|
+
EnforcedStyle: def_self
|
3063
3263
|
SupportedStyles:
|
3064
3264
|
- def_self
|
3065
3265
|
- self_class
|
@@ -3149,7 +3349,7 @@ Style/CommentAnnotation:
|
|
3149
3349
|
StyleGuide: '#annotate-keywords'
|
3150
3350
|
Enabled: true
|
3151
3351
|
VersionAdded: '0.10'
|
3152
|
-
VersionChanged: '1.
|
3352
|
+
VersionChanged: '1.20'
|
3153
3353
|
Keywords:
|
3154
3354
|
- TODO
|
3155
3355
|
- FIXME
|
@@ -3332,6 +3532,12 @@ Style/EmptyElse:
|
|
3332
3532
|
- empty
|
3333
3533
|
- nil
|
3334
3534
|
- both
|
3535
|
+
AllowComments: false
|
3536
|
+
|
3537
|
+
Style/EmptyHeredoc:
|
3538
|
+
Description: 'Checks for using empty heredoc to reduce redundancy.'
|
3539
|
+
Enabled: pending
|
3540
|
+
VersionAdded: '1.32'
|
3335
3541
|
|
3336
3542
|
Style/EmptyLambdaParameter:
|
3337
3543
|
Description: 'Omit parens for empty lambda parameters.'
|
@@ -3380,6 +3586,12 @@ Style/EndlessMethod:
|
|
3380
3586
|
- allow_always
|
3381
3587
|
- disallow
|
3382
3588
|
|
3589
|
+
Style/EnvHome:
|
3590
|
+
Description: "Checks for consistent usage of `ENV['HOME']`."
|
3591
|
+
Enabled: pending
|
3592
|
+
Safe: false
|
3593
|
+
VersionAdded: '1.29'
|
3594
|
+
|
3383
3595
|
Style/EvalWithLocation:
|
3384
3596
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
3385
3597
|
Enabled: true
|
@@ -3417,6 +3629,28 @@ Style/ExponentialNotation:
|
|
3417
3629
|
- engineering
|
3418
3630
|
- integral
|
3419
3631
|
|
3632
|
+
Style/FetchEnvVar:
|
3633
|
+
Description: >-
|
3634
|
+
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
3635
|
+
Reference:
|
3636
|
+
- https://rubystyle.guide/#hash-fetch-defaults
|
3637
|
+
Enabled: pending
|
3638
|
+
VersionAdded: '1.28'
|
3639
|
+
# Environment variables to be excluded from the inspection.
|
3640
|
+
AllowedVars: []
|
3641
|
+
|
3642
|
+
Style/FileRead:
|
3643
|
+
Description: 'Favor `File.(bin)read` convenience methods.'
|
3644
|
+
StyleGuide: '#file-read'
|
3645
|
+
Enabled: pending
|
3646
|
+
VersionAdded: '1.24'
|
3647
|
+
|
3648
|
+
Style/FileWrite:
|
3649
|
+
Description: 'Favor `File.(bin)write` convenience methods.'
|
3650
|
+
StyleGuide: '#file-write'
|
3651
|
+
Enabled: pending
|
3652
|
+
VersionAdded: '1.24'
|
3653
|
+
|
3420
3654
|
Style/FloatDivision:
|
3421
3655
|
Description: 'For performing float division, coerce one side only.'
|
3422
3656
|
StyleGuide: '#float-division'
|
@@ -3436,8 +3670,9 @@ Style/For:
|
|
3436
3670
|
Description: 'Checks use of for or each in multiline loops.'
|
3437
3671
|
StyleGuide: '#no-for-loops'
|
3438
3672
|
Enabled: true
|
3673
|
+
SafeAutoCorrect: false
|
3439
3674
|
VersionAdded: '0.13'
|
3440
|
-
VersionChanged: '
|
3675
|
+
VersionChanged: '1.26'
|
3441
3676
|
EnforcedStyle: each
|
3442
3677
|
SupportedStyles:
|
3443
3678
|
- each
|
@@ -3472,7 +3707,9 @@ Style/FormatStringToken:
|
|
3472
3707
|
MaxUnannotatedPlaceholdersAllowed: 1
|
3473
3708
|
VersionAdded: '0.49'
|
3474
3709
|
VersionChanged: '1.0'
|
3475
|
-
|
3710
|
+
AllowedMethods: []
|
3711
|
+
AllowedPatterns: []
|
3712
|
+
IgnoredMethods: [] # deprecated
|
3476
3713
|
|
3477
3714
|
Style/FrozenStringLiteralComment:
|
3478
3715
|
Description: >-
|
@@ -3517,10 +3754,11 @@ Style/GuardClause:
|
|
3517
3754
|
StyleGuide: '#no-nested-conditionals'
|
3518
3755
|
Enabled: true
|
3519
3756
|
VersionAdded: '0.20'
|
3520
|
-
VersionChanged: '
|
3757
|
+
VersionChanged: '1.31'
|
3521
3758
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
3522
3759
|
# needs to have to trigger this cop
|
3523
3760
|
MinBodyLength: 1
|
3761
|
+
AllowConsecutiveConditionals: false
|
3524
3762
|
|
3525
3763
|
Style/HashAsLastArrayItem:
|
3526
3764
|
Description: >-
|
@@ -3557,6 +3795,7 @@ Style/HashExcept:
|
|
3557
3795
|
that can be replaced with `Hash#except` method.
|
3558
3796
|
Enabled: pending
|
3559
3797
|
VersionAdded: '1.7'
|
3798
|
+
VersionChanged: '1.31'
|
3560
3799
|
|
3561
3800
|
Style/HashLikeCase:
|
3562
3801
|
Description: >-
|
@@ -3575,7 +3814,7 @@ Style/HashSyntax:
|
|
3575
3814
|
StyleGuide: '#hash-literals'
|
3576
3815
|
Enabled: true
|
3577
3816
|
VersionAdded: '0.9'
|
3578
|
-
VersionChanged: '
|
3817
|
+
VersionChanged: '1.24'
|
3579
3818
|
EnforcedStyle: ruby19
|
3580
3819
|
SupportedStyles:
|
3581
3820
|
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
@@ -3586,6 +3825,15 @@ Style/HashSyntax:
|
|
3586
3825
|
- no_mixed_keys
|
3587
3826
|
# enforces both ruby19 and no_mixed_keys styles
|
3588
3827
|
- ruby19_no_mixed_keys
|
3828
|
+
# Force hashes that have a hash value omission
|
3829
|
+
EnforcedShorthandSyntax: always
|
3830
|
+
SupportedShorthandSyntax:
|
3831
|
+
# forces use of the 3.1 syntax (e.g. {foo:}) when the hash key and value are the same.
|
3832
|
+
- always
|
3833
|
+
# forces use of explicit hash literal value.
|
3834
|
+
- never
|
3835
|
+
# accepts both shorthand and explicit use of hash literal value.
|
3836
|
+
- either
|
3589
3837
|
# Force hashes that have a symbol value to use hash rockets
|
3590
3838
|
UseHashRocketsWithSymbolValues: false
|
3591
3839
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
@@ -3669,7 +3917,7 @@ Style/InPatternThen:
|
|
3669
3917
|
Style/InfiniteLoop:
|
3670
3918
|
Description: >-
|
3671
3919
|
Use Kernel#loop for infinite loops.
|
3672
|
-
This cop is unsafe
|
3920
|
+
This cop is unsafe if the body may raise a `StopIteration` exception.
|
3673
3921
|
Safe: false
|
3674
3922
|
StyleGuide: '#infinite-loop'
|
3675
3923
|
Enabled: true
|
@@ -3700,8 +3948,8 @@ Style/InverseMethods:
|
|
3700
3948
|
:>: :<=
|
3701
3949
|
# `ActiveSupport` defines some common inverse methods. They are listed below,
|
3702
3950
|
# and not enabled by default.
|
3703
|
-
|
3704
|
-
|
3951
|
+
# :present?: :blank?,
|
3952
|
+
# :include?: :exclude?
|
3705
3953
|
# `InverseBlocks` are methods that are inverted by inverting the return
|
3706
3954
|
# of the block that is passed to the method
|
3707
3955
|
InverseBlocks:
|
@@ -3762,6 +4010,17 @@ Style/LineEndConcatenation:
|
|
3762
4010
|
VersionAdded: '0.18'
|
3763
4011
|
VersionChanged: '0.64'
|
3764
4012
|
|
4013
|
+
Style/MapCompactWithConditionalBlock:
|
4014
|
+
Description: 'Prefer `select` or `reject` over `map { ... }.compact`.'
|
4015
|
+
Enabled: pending
|
4016
|
+
VersionAdded: '1.30'
|
4017
|
+
|
4018
|
+
Style/MapToHash:
|
4019
|
+
Description: 'Prefer `to_h` with a block over `map.to_h`.'
|
4020
|
+
Enabled: pending
|
4021
|
+
VersionAdded: '1.24'
|
4022
|
+
Safe: false
|
4023
|
+
|
3765
4024
|
Style/MethodCallWithArgsParentheses:
|
3766
4025
|
Description: 'Use parentheses for method calls with arguments.'
|
3767
4026
|
StyleGuide: '#method-invocation-parens'
|
@@ -3769,8 +4028,10 @@ Style/MethodCallWithArgsParentheses:
|
|
3769
4028
|
VersionAdded: '0.47'
|
3770
4029
|
VersionChanged: '1.7'
|
3771
4030
|
IgnoreMacros: true
|
3772
|
-
|
3773
|
-
|
4031
|
+
AllowedMethods: []
|
4032
|
+
IgnoredMethods: [] # deprecated
|
4033
|
+
AllowedPatterns: []
|
4034
|
+
IgnoredPatterns: [] # deprecated
|
3774
4035
|
IncludedMacros: []
|
3775
4036
|
AllowParenthesesInMultilineCall: false
|
3776
4037
|
AllowParenthesesInChaining: false
|
@@ -3785,7 +4046,9 @@ Style/MethodCallWithoutArgsParentheses:
|
|
3785
4046
|
Description: 'Do not use parentheses for method calls with no arguments.'
|
3786
4047
|
StyleGuide: '#method-invocation-parens'
|
3787
4048
|
Enabled: true
|
3788
|
-
|
4049
|
+
AllowedMethods: []
|
4050
|
+
AllowedPatterns: []
|
4051
|
+
IgnoredMethods: [] # deprecated
|
3789
4052
|
VersionAdded: '0.47'
|
3790
4053
|
VersionChanged: '0.55'
|
3791
4054
|
|
@@ -3976,7 +4239,7 @@ Style/NegatedIf:
|
|
3976
4239
|
|
3977
4240
|
Style/NegatedIfElseCondition:
|
3978
4241
|
Description: >-
|
3979
|
-
|
4242
|
+
Checks for uses of `if-else` and ternary operators with a negated condition
|
3980
4243
|
which can be simplified by inverting condition and swapping branches.
|
3981
4244
|
Enabled: pending
|
3982
4245
|
VersionAdded: '1.2'
|
@@ -4001,6 +4264,11 @@ Style/NegatedWhile:
|
|
4001
4264
|
Enabled: true
|
4002
4265
|
VersionAdded: '0.20'
|
4003
4266
|
|
4267
|
+
Style/NestedFileDirname:
|
4268
|
+
Description: 'Checks for nested `File.dirname`.'
|
4269
|
+
Enabled: pending
|
4270
|
+
VersionAdded: '1.26'
|
4271
|
+
|
4004
4272
|
Style/NestedModifier:
|
4005
4273
|
Description: 'Avoid using nested modifiers.'
|
4006
4274
|
StyleGuide: '#no-nested-modifiers'
|
@@ -4095,6 +4363,21 @@ Style/Not:
|
|
4095
4363
|
VersionAdded: '0.9'
|
4096
4364
|
VersionChanged: '0.20'
|
4097
4365
|
|
4366
|
+
Style/NumberedParameters:
|
4367
|
+
Description: 'Restrict the usage of numbered parameters.'
|
4368
|
+
Enabled: pending
|
4369
|
+
VersionAdded: '1.22'
|
4370
|
+
EnforcedStyle: allow_single_line
|
4371
|
+
SupportedStyles:
|
4372
|
+
- allow_single_line
|
4373
|
+
- disallow
|
4374
|
+
|
4375
|
+
Style/NumberedParametersLimit:
|
4376
|
+
Description: 'Avoid excessive numbered params in a single block.'
|
4377
|
+
Enabled: pending
|
4378
|
+
VersionAdded: '1.22'
|
4379
|
+
Max: 1
|
4380
|
+
|
4098
4381
|
Style/NumericLiteralPrefix:
|
4099
4382
|
Description: 'Use smallcase prefixes for numeric literals.'
|
4100
4383
|
StyleGuide: '#numeric-literal-prefixes'
|
@@ -4105,7 +4388,6 @@ Style/NumericLiteralPrefix:
|
|
4105
4388
|
- zero_with_o
|
4106
4389
|
- zero_only
|
4107
4390
|
|
4108
|
-
|
4109
4391
|
Style/NumericLiterals:
|
4110
4392
|
Description: >-
|
4111
4393
|
Add underscores to large numeric literals to improve their
|
@@ -4116,6 +4398,8 @@ Style/NumericLiterals:
|
|
4116
4398
|
VersionChanged: '0.48'
|
4117
4399
|
MinDigits: 5
|
4118
4400
|
Strict: false
|
4401
|
+
# You can specify allowed numbers. (e.g. port number 3000, 8080, and etc)
|
4402
|
+
AllowedNumbers: []
|
4119
4403
|
|
4120
4404
|
Style/NumericPredicate:
|
4121
4405
|
Description: >-
|
@@ -4134,12 +4418,27 @@ Style/NumericPredicate:
|
|
4134
4418
|
SupportedStyles:
|
4135
4419
|
- predicate
|
4136
4420
|
- comparison
|
4137
|
-
|
4421
|
+
AllowedMethods: []
|
4422
|
+
AllowedPatterns: []
|
4423
|
+
IgnoredMethods: [] # deprecated
|
4138
4424
|
# Exclude RSpec specs because assertions like `expect(1).to be > 0` cause
|
4139
4425
|
# false positives.
|
4140
4426
|
Exclude:
|
4141
4427
|
- 'spec/**/*'
|
4142
4428
|
|
4429
|
+
Style/ObjectThen:
|
4430
|
+
Description: 'Enforces the use of consistent method names `Object#yield_self` or `Object#then`.'
|
4431
|
+
StyleGuide: '#object-yield-self-vs-object-then'
|
4432
|
+
Enabled: pending
|
4433
|
+
VersionAdded: '1.28'
|
4434
|
+
# Use `Object#yield_self` or `Object#then`?
|
4435
|
+
# Prefer `Object#yield_self` to `Object#then` (yield_self)
|
4436
|
+
# Prefer `Object#then` to `Object#yield_self` (then)
|
4437
|
+
EnforcedStyle: 'then'
|
4438
|
+
SupportedStyles:
|
4439
|
+
- then
|
4440
|
+
- yield_self
|
4441
|
+
|
4143
4442
|
Style/OneLineConditional:
|
4144
4443
|
Description: >-
|
4145
4444
|
Favor the ternary operator (?:) or multi-line constructs over
|
@@ -4150,6 +4449,16 @@ Style/OneLineConditional:
|
|
4150
4449
|
VersionAdded: '0.9'
|
4151
4450
|
VersionChanged: '0.90'
|
4152
4451
|
|
4452
|
+
Style/OpenStructUse:
|
4453
|
+
Description: >-
|
4454
|
+
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
4455
|
+
version compatibility, and potential security issues.
|
4456
|
+
Reference:
|
4457
|
+
- https://docs.ruby-lang.org/en/3.0.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4458
|
+
|
4459
|
+
Enabled: pending
|
4460
|
+
VersionAdded: '1.23'
|
4461
|
+
|
4153
4462
|
Style/OptionHash:
|
4154
4463
|
Description: "Don't use option hashes when you can use keyword arguments."
|
4155
4464
|
Enabled: false
|
@@ -4367,10 +4676,20 @@ Style/RedundantFreeze:
|
|
4367
4676
|
VersionAdded: '0.34'
|
4368
4677
|
VersionChanged: '0.66'
|
4369
4678
|
|
4679
|
+
Style/RedundantInitialize:
|
4680
|
+
Description: 'Checks for redundant `initialize` methods.'
|
4681
|
+
Enabled: pending
|
4682
|
+
Safe: false
|
4683
|
+
AllowComments: true
|
4684
|
+
VersionAdded: '1.27'
|
4685
|
+
VersionChanged: '1.28'
|
4686
|
+
|
4370
4687
|
Style/RedundantInterpolation:
|
4371
4688
|
Description: 'Checks for strings that are just an interpolated expression.'
|
4372
4689
|
Enabled: true
|
4690
|
+
SafeAutoCorrect: false
|
4373
4691
|
VersionAdded: '0.76'
|
4692
|
+
VersionChanged: '1.30'
|
4374
4693
|
|
4375
4694
|
Style/RedundantParentheses:
|
4376
4695
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
@@ -4426,6 +4745,8 @@ Style/RedundantSort:
|
|
4426
4745
|
`max_by` instead of `sort_by...last`, etc.
|
4427
4746
|
Enabled: true
|
4428
4747
|
VersionAdded: '0.76'
|
4748
|
+
VersionChanged: '1.22'
|
4749
|
+
Safe: false
|
4429
4750
|
|
4430
4751
|
Style/RedundantSortBy:
|
4431
4752
|
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
@@ -4479,14 +4800,14 @@ Style/ReturnNil:
|
|
4479
4800
|
|
4480
4801
|
Style/SafeNavigation:
|
4481
4802
|
Description: >-
|
4482
|
-
|
4803
|
+
Transforms usages of a method call safeguarded by
|
4483
4804
|
a check for the existence of the object to
|
4484
4805
|
safe navigation (`&.`).
|
4485
|
-
|
4806
|
+
Autocorrection is unsafe as it assumes the object will
|
4486
4807
|
be `nil` or truthy, but never `false`.
|
4487
4808
|
Enabled: true
|
4488
4809
|
VersionAdded: '0.43'
|
4489
|
-
VersionChanged: '
|
4810
|
+
VersionChanged: '1.27'
|
4490
4811
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
4491
4812
|
# to whatever it used to return.
|
4492
4813
|
ConvertCodeThatCanStartToReturnNil: false
|
@@ -4497,6 +4818,8 @@ Style/SafeNavigation:
|
|
4497
4818
|
- try
|
4498
4819
|
- try!
|
4499
4820
|
SafeAutoCorrect: false
|
4821
|
+
# Maximum length of method chains for register an offense.
|
4822
|
+
MaxChainLength: 2
|
4500
4823
|
|
4501
4824
|
Style/Sample:
|
4502
4825
|
Description: >-
|
@@ -4506,6 +4829,12 @@ Style/Sample:
|
|
4506
4829
|
Enabled: true
|
4507
4830
|
VersionAdded: '0.30'
|
4508
4831
|
|
4832
|
+
Style/SelectByRegexp:
|
4833
|
+
Description: 'Prefer grep/grep_v to select/reject with a regexp match.'
|
4834
|
+
Enabled: pending
|
4835
|
+
SafeAutoCorrect: false
|
4836
|
+
VersionAdded: '1.22'
|
4837
|
+
|
4509
4838
|
Style/SelfAssignment:
|
4510
4839
|
Description: >-
|
4511
4840
|
Checks for places where self-assignment shorthand should have
|
@@ -4596,6 +4925,7 @@ Style/SpecialGlobalVars:
|
|
4596
4925
|
SupportedStyles:
|
4597
4926
|
- use_perl_names
|
4598
4927
|
- use_english_names
|
4928
|
+
- use_builtin_english_names
|
4599
4929
|
|
4600
4930
|
Style/StabbyLambdaParentheses:
|
4601
4931
|
Description: 'Check for the usage of parentheses around stabby lambda arguments.'
|
@@ -4692,11 +5022,12 @@ Style/StructInheritance:
|
|
4692
5022
|
Description: 'Checks for inheritance from Struct.new.'
|
4693
5023
|
StyleGuide: '#no-extend-struct-new'
|
4694
5024
|
Enabled: true
|
5025
|
+
SafeAutoCorrect: false
|
4695
5026
|
VersionAdded: '0.29'
|
4696
|
-
VersionChanged: '
|
5027
|
+
VersionChanged: '1.20'
|
4697
5028
|
|
4698
5029
|
Style/SwapValues:
|
4699
|
-
Description: '
|
5030
|
+
Description: 'Enforces the use of shorthand-style swapping of 2 variables.'
|
4700
5031
|
StyleGuide: '#values-swapping'
|
4701
5032
|
Enabled: pending
|
4702
5033
|
VersionAdded: '1.1'
|
@@ -4724,13 +5055,16 @@ Style/SymbolProc:
|
|
4724
5055
|
Enabled: true
|
4725
5056
|
Safe: false
|
4726
5057
|
VersionAdded: '0.26'
|
4727
|
-
VersionChanged: '1.
|
5058
|
+
VersionChanged: '1.28'
|
4728
5059
|
AllowMethodsWithArguments: false
|
4729
|
-
# A list of method names to be
|
5060
|
+
# A list of method names to be always allowed by the check.
|
4730
5061
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4731
|
-
|
5062
|
+
AllowedMethods:
|
4732
5063
|
- respond_to
|
4733
5064
|
- define_method
|
5065
|
+
AllowedPatterns: []
|
5066
|
+
IgnoredMethods: [] # deprecated
|
5067
|
+
AllowComments: false
|
4734
5068
|
|
4735
5069
|
Style/TernaryParentheses:
|
4736
5070
|
Description: 'Checks for use of parentheses around ternary conditions.'
|
@@ -4745,7 +5079,7 @@ Style/TernaryParentheses:
|
|
4745
5079
|
AllowSafeAssignment: true
|
4746
5080
|
|
4747
5081
|
Style/TopLevelMethodDefinition:
|
4748
|
-
Description: '
|
5082
|
+
Description: 'Looks for top-level method definitions.'
|
4749
5083
|
StyleGuide: '#top-level-methods'
|
4750
5084
|
Enabled: false
|
4751
5085
|
VersionAdded: '1.15'
|