rubocop 1.67.0 → 1.79.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +23 -19
- data/config/default.yml +371 -71
- data/config/internal_affairs.yml +20 -0
- data/config/obsoletion.yml +8 -3
- data/lib/rubocop/cached_data.rb +12 -4
- data/lib/rubocop/cli/command/execute_runner.rb +4 -4
- data/lib/rubocop/cli/command/show_cops.rb +24 -2
- data/lib/rubocop/cli/command/suggest_extensions.rb +7 -1
- data/lib/rubocop/cli/command/version.rb +2 -2
- data/lib/rubocop/cli.rb +13 -2
- data/lib/rubocop/comment_config.rb +2 -2
- data/lib/rubocop/config.rb +52 -10
- data/lib/rubocop/config_loader.rb +53 -47
- data/lib/rubocop/config_loader_resolver.rb +36 -10
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +4 -3
- data/lib/rubocop/config_obsoletion/renamed_cop.rb +18 -3
- data/lib/rubocop/config_obsoletion.rb +46 -2
- data/lib/rubocop/config_validator.rb +25 -14
- data/lib/rubocop/cop/autocorrect_logic.rb +51 -26
- data/lib/rubocop/cop/base.rb +7 -1
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +2 -2
- data/lib/rubocop/cop/bundler/gem_comment.rb +1 -1
- data/lib/rubocop/cop/bundler/gem_filename.rb +0 -1
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +0 -1
- data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +1 -12
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +1 -1
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -2
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -0
- data/lib/rubocop/cop/gemspec/attribute_assignment.rb +91 -0
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +1 -2
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +37 -15
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
- data/lib/rubocop/cop/gemspec/require_mfa.rb +15 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +0 -2
- data/lib/rubocop/cop/generator.rb +6 -0
- data/lib/rubocop/cop/internal_affairs/cop_enabled.rb +85 -0
- data/lib/rubocop/cop/internal_affairs/example_description.rb +9 -5
- data/lib/rubocop/cop/internal_affairs/location_exists.rb +116 -0
- data/lib/rubocop/cop/internal_affairs/location_expression.rb +2 -1
- data/lib/rubocop/cop/internal_affairs/location_line_equality_comparison.rb +3 -4
- data/lib/rubocop/cop/internal_affairs/node_first_or_last_argument.rb +3 -2
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +5 -5
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_processor.rb +63 -0
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups/ast_walker.rb +131 -0
- data/lib/rubocop/cop/internal_affairs/node_pattern_groups.rb +231 -0
- data/lib/rubocop/cop/internal_affairs/node_type_group.rb +92 -0
- data/lib/rubocop/cop/internal_affairs/node_type_multiple_predicates.rb +126 -0
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +4 -3
- data/lib/rubocop/cop/internal_affairs/numblock_handler.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/on_send_without_on_csend.rb +90 -0
- data/lib/rubocop/cop/internal_affairs/operator_keyword.rb +48 -0
- data/lib/rubocop/cop/internal_affairs/plugin.rb +33 -0
- data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +6 -5
- data/lib/rubocop/cop/internal_affairs/redundant_source_range.rb +3 -1
- data/lib/rubocop/cop/internal_affairs/single_line_comparison.rb +5 -4
- data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +0 -2
- data/lib/rubocop/cop/internal_affairs/undefined_config.rb +13 -2
- data/lib/rubocop/cop/internal_affairs/useless_restrict_on_send.rb +1 -1
- data/lib/rubocop/cop/internal_affairs.rb +7 -16
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/argument_alignment.rb +2 -9
- data/lib/rubocop/cop/layout/array_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +0 -1
- data/lib/rubocop/cop/layout/block_alignment.rb +3 -2
- data/lib/rubocop/cop/layout/block_end_newline.rb +1 -0
- data/lib/rubocop/cop/layout/class_structure.rb +44 -9
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +5 -5
- data/lib/rubocop/cop/layout/def_end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/dot_position.rb +1 -1
- data/lib/rubocop/cop/layout/else_alignment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +3 -3
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +7 -11
- data/lib/rubocop/cop/layout/empty_lines_after_module_inclusion.rb +99 -0
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +37 -7
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +5 -6
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +1 -0
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +4 -5
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +23 -1
- data/lib/rubocop/cop/layout/end_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +1 -1
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +4 -9
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +2 -7
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +2 -7
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +1 -1
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/hash_alignment.rb +8 -6
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +2 -1
- data/lib/rubocop/cop/layout/indentation_width.rb +8 -7
- data/lib/rubocop/cop/layout/leading_comment_space.rb +57 -2
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +11 -2
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +7 -1
- data/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/line_length.rb +149 -9
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -0
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +25 -0
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +4 -4
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +1 -0
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +3 -4
- data/lib/rubocop/cop/layout/parameter_alignment.rb +3 -4
- data/lib/rubocop/cop/layout/redundant_line_break.rb +19 -46
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +6 -7
- data/lib/rubocop/cop/layout/single_line_block_chain.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_colon.rb +2 -2
- data/lib/rubocop/cop/layout/space_after_comma.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_method_name.rb +1 -1
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +11 -1
- data/lib/rubocop/cop/layout/space_around_keyword.rb +8 -2
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_operators.rb +31 -21
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -0
- data/lib/rubocop/cop/layout/space_before_brackets.rb +7 -40
- data/lib/rubocop/cop/layout/space_before_comma.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +18 -3
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -0
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +7 -0
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +0 -1
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +5 -3
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +1 -1
- data/lib/rubocop/cop/lint/ambiguous_range.rb +5 -0
- data/lib/rubocop/cop/lint/array_literal_in_regexp.rb +118 -0
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -3
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +10 -12
- data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +4 -1
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +3 -3
- data/lib/rubocop/cop/lint/constant_reassignment.rb +148 -0
- data/lib/rubocop/cop/lint/cop_directive_syntax.rb +84 -0
- data/lib/rubocop/cop/lint/debugger.rb +3 -3
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +1 -1
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +3 -2
- data/lib/rubocop/cop/lint/duplicate_branch.rb +39 -4
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +111 -23
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_set_element.rb +20 -7
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +14 -64
- data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
- data/lib/rubocop/cop/lint/empty_expression.rb +0 -2
- data/lib/rubocop/cop/lint/empty_file.rb +0 -2
- data/lib/rubocop/cop/lint/empty_interpolation.rb +3 -1
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +0 -6
- data/lib/rubocop/cop/lint/float_comparison.rb +51 -18
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -4
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +2 -2
- data/lib/rubocop/cop/lint/hash_new_with_keyword_arguments_as_default.rb +55 -0
- data/lib/rubocop/cop/lint/identity_comparison.rb +19 -15
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +1 -1
- data/lib/rubocop/cop/lint/interpolation_check.rb +9 -0
- data/lib/rubocop/cop/lint/it_without_arguments_in_block.rb +3 -0
- data/lib/rubocop/cop/lint/literal_as_condition.rb +125 -10
- data/lib/rubocop/cop/lint/literal_assignment_in_condition.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +24 -6
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/missing_super.rb +2 -2
- data/lib/rubocop/cop/lint/mixed_case_range.rb +5 -8
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +10 -6
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +2 -2
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +12 -3
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +3 -3
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +3 -3
- data/lib/rubocop/cop/lint/number_conversion.rb +0 -1
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +1 -2
- data/lib/rubocop/cop/lint/numeric_operation_with_constant_result.rb +94 -0
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +2 -3
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +3 -2
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -5
- data/lib/rubocop/cop/lint/raise_exception.rb +29 -10
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_regexp_quantifiers.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +0 -21
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +113 -9
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +8 -7
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +2 -2
- data/lib/rubocop/cop/lint/redundant_type_conversion.rb +261 -0
- data/lib/rubocop/cop/lint/redundant_with_index.rb +3 -0
- data/lib/rubocop/cop/lint/redundant_with_object.rb +3 -0
- data/lib/rubocop/cop/lint/refinement_import_methods.rb +1 -1
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +0 -1
- data/lib/rubocop/cop/lint/require_range_parentheses.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/rescue_type.rb +4 -8
- data/lib/rubocop/cop/lint/return_in_void_context.rb +9 -11
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +17 -1
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +5 -1
- data/lib/rubocop/cop/lint/self_assignment.rb +33 -10
- data/lib/rubocop/cop/lint/shadowed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +13 -1
- data/lib/rubocop/cop/lint/shared_mutable_default.rb +76 -0
- data/lib/rubocop/cop/lint/suppressed_exception.rb +1 -1
- data/lib/rubocop/cop/lint/suppressed_exception_in_number_conversion.rb +111 -0
- data/lib/rubocop/cop/lint/symbol_conversion.rb +1 -1
- data/lib/rubocop/cop/lint/syntax.rb +4 -1
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +1 -1
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +1 -1
- data/lib/rubocop/cop/lint/unescaped_bracket_in_regexp.rb +88 -0
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +3 -1
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_code.rb +52 -2
- data/lib/rubocop/cop/lint/unreachable_loop.rb +6 -6
- data/lib/rubocop/cop/lint/unused_method_argument.rb +18 -2
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +34 -8
- data/lib/rubocop/cop/lint/useless_assignment.rb +3 -1
- data/lib/rubocop/cop/lint/useless_constant_scoping.rb +71 -0
- data/lib/rubocop/cop/lint/useless_default_value_argument.rb +90 -0
- data/lib/rubocop/cop/lint/useless_defined.rb +55 -0
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +4 -0
- data/lib/rubocop/cop/lint/useless_method_definition.rb +1 -1
- data/lib/rubocop/cop/lint/useless_numeric_operation.rb +3 -1
- data/lib/rubocop/cop/lint/useless_or.rb +98 -0
- data/lib/rubocop/cop/lint/useless_rescue.rb +2 -2
- data/lib/rubocop/cop/lint/useless_ruby2_keywords.rb +5 -5
- data/lib/rubocop/cop/lint/useless_setter_call.rb +14 -25
- data/lib/rubocop/cop/lint/utils/nil_receiver_checker.rb +121 -0
- data/lib/rubocop/cop/lint/void.rb +16 -12
- data/lib/rubocop/cop/message_annotator.rb +7 -3
- data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
- data/lib/rubocop/cop/metrics/block_length.rb +1 -0
- data/lib/rubocop/cop/metrics/block_nesting.rb +1 -1
- data/lib/rubocop/cop/metrics/class_length.rb +9 -9
- data/lib/rubocop/cop/metrics/collection_literal_length.rb +7 -0
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +5 -2
- data/lib/rubocop/cop/metrics/method_length.rb +9 -1
- data/lib/rubocop/cop/metrics/module_length.rb +1 -1
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +1 -1
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +3 -4
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +7 -7
- data/lib/rubocop/cop/mixin/alignment.rb +3 -3
- data/lib/rubocop/cop/mixin/allowed_pattern.rb +4 -4
- data/lib/rubocop/cop/mixin/check_assignment.rb +4 -12
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +22 -12
- data/lib/rubocop/cop/mixin/check_single_line_suitability.rb +49 -0
- data/lib/rubocop/cop/mixin/comments_help.rb +8 -3
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/mixin/dig_help.rb +27 -0
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +1 -1
- data/lib/rubocop/cop/mixin/endless_method_rewriter.rb +24 -0
- data/lib/rubocop/cop/mixin/forbidden_identifiers.rb +20 -0
- data/lib/rubocop/cop/mixin/forbidden_pattern.rb +16 -0
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +4 -3
- data/lib/rubocop/cop/mixin/gemspec_help.rb +22 -0
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +15 -14
- data/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb +22 -22
- data/lib/rubocop/cop/mixin/hash_subset.rb +203 -0
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +74 -74
- data/lib/rubocop/cop/mixin/line_length_help.rb +27 -10
- data/lib/rubocop/cop/mixin/method_complexity.rb +2 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +7 -9
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +1 -1
- data/lib/rubocop/cop/mixin/percent_literal.rb +1 -1
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +68 -30
- data/lib/rubocop/cop/mixin/range_help.rb +15 -4
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +1 -1
- data/lib/rubocop/cop/mixin/statement_modifier.rb +8 -3
- data/lib/rubocop/cop/mixin/string_help.rb +2 -2
- data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +17 -1
- data/lib/rubocop/cop/mixin/trailing_comma.rb +21 -5
- data/lib/rubocop/cop/naming/accessor_method_name.rb +6 -6
- data/lib/rubocop/cop/naming/block_forwarding.rb +20 -16
- data/lib/rubocop/cop/naming/constant_name.rb +6 -7
- data/lib/rubocop/cop/naming/file_name.rb +2 -4
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +12 -13
- data/lib/rubocop/cop/naming/method_name.rb +185 -15
- data/lib/rubocop/cop/naming/predicate_method.rb +306 -0
- data/lib/rubocop/cop/naming/{predicate_name.rb → predicate_prefix.rb} +48 -4
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +6 -14
- data/lib/rubocop/cop/naming/variable_name.rb +50 -6
- data/lib/rubocop/cop/naming/variable_number.rb +2 -3
- data/lib/rubocop/cop/offense.rb +2 -3
- data/lib/rubocop/cop/registry.rb +9 -6
- data/lib/rubocop/cop/security/compound_hash.rb +2 -0
- data/lib/rubocop/cop/security/eval.rb +2 -1
- data/lib/rubocop/cop/security/open.rb +1 -0
- data/lib/rubocop/cop/security/yaml_load.rb +3 -2
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +114 -34
- data/lib/rubocop/cop/style/accessor_grouping.rb +32 -6
- data/lib/rubocop/cop/style/ambiguous_endless_method_definition.rb +79 -0
- data/lib/rubocop/cop/style/and_or.rb +1 -1
- data/lib/rubocop/cop/style/arguments_forwarding.rb +57 -44
- data/lib/rubocop/cop/style/array_first_last.rb +18 -2
- data/lib/rubocop/cop/style/array_intersect.rb +84 -42
- data/lib/rubocop/cop/style/bitwise_predicate.rb +100 -0
- data/lib/rubocop/cop/style/block_delimiters.rb +44 -26
- data/lib/rubocop/cop/style/case_like_if.rb +9 -12
- data/lib/rubocop/cop/style/class_and_module_children.rb +52 -11
- data/lib/rubocop/cop/style/class_equality_comparison.rb +1 -1
- data/lib/rubocop/cop/style/collection_methods.rb +2 -1
- data/lib/rubocop/cop/style/collection_querying.rb +167 -0
- data/lib/rubocop/cop/style/combinable_defined.rb +115 -0
- data/lib/rubocop/cop/style/combinable_loops.rb +3 -2
- data/lib/rubocop/cop/style/command_literal.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +20 -3
- data/lib/rubocop/cop/style/comparable_between.rb +78 -0
- data/lib/rubocop/cop/style/concat_array_literals.rb +1 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +42 -28
- data/lib/rubocop/cop/style/constant_visibility.rb +3 -12
- data/lib/rubocop/cop/style/data_inheritance.rb +7 -0
- data/lib/rubocop/cop/style/def_with_parentheses.rb +18 -5
- data/lib/rubocop/cop/style/dig_chain.rb +89 -0
- data/lib/rubocop/cop/style/documentation.rb +1 -1
- data/lib/rubocop/cop/style/double_negation.rb +4 -4
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +4 -7
- data/lib/rubocop/cop/style/each_with_object.rb +2 -3
- data/lib/rubocop/cop/style/empty_else.rb +4 -2
- data/lib/rubocop/cop/style/empty_literal.rb +5 -1
- data/lib/rubocop/cop/style/empty_method.rb +1 -1
- data/lib/rubocop/cop/style/empty_string_inside_interpolation.rb +100 -0
- data/lib/rubocop/cop/style/endless_method.rb +150 -18
- data/lib/rubocop/cop/style/eval_with_location.rb +4 -4
- data/lib/rubocop/cop/style/exact_regexp_match.rb +2 -3
- data/lib/rubocop/cop/style/expand_path_arguments.rb +2 -7
- data/lib/rubocop/cop/style/explicit_block_argument.rb +16 -3
- data/lib/rubocop/cop/style/exponential_notation.rb +6 -5
- data/lib/rubocop/cop/style/fetch_env_var.rb +34 -7
- data/lib/rubocop/cop/style/file_null.rb +89 -0
- data/lib/rubocop/cop/style/file_touch.rb +75 -0
- data/lib/rubocop/cop/style/float_division.rb +8 -4
- data/lib/rubocop/cop/style/for.rb +1 -1
- data/lib/rubocop/cop/style/format_string_token.rb +38 -11
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +3 -2
- data/lib/rubocop/cop/style/global_std_stream.rb +3 -0
- data/lib/rubocop/cop/style/global_vars.rb +1 -3
- data/lib/rubocop/cop/style/guard_clause.rb +17 -3
- data/lib/rubocop/cop/style/hash_conversion.rb +16 -9
- data/lib/rubocop/cop/style/hash_each_methods.rb +6 -8
- data/lib/rubocop/cop/style/hash_except.rb +35 -147
- data/lib/rubocop/cop/style/hash_fetch_chain.rb +104 -0
- data/lib/rubocop/cop/style/hash_slice.rb +80 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +9 -3
- data/lib/rubocop/cop/style/hash_transform_keys.rb +2 -2
- data/lib/rubocop/cop/style/hash_transform_values.rb +2 -2
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +25 -6
- data/lib/rubocop/cop/style/if_inside_else.rb +10 -14
- data/lib/rubocop/cop/style/if_unless_modifier.rb +36 -9
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +4 -7
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +3 -4
- data/lib/rubocop/cop/style/if_with_semicolon.rb +20 -9
- data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +16 -13
- data/lib/rubocop/cop/style/invertible_unless_condition.rb +2 -2
- data/lib/rubocop/cop/style/ip_addresses.rb +2 -2
- data/lib/rubocop/cop/style/it_assignment.rb +93 -0
- data/lib/rubocop/cop/style/it_block_parameter.rb +121 -0
- data/lib/rubocop/cop/style/keyword_arguments_merging.rb +67 -0
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +14 -8
- data/lib/rubocop/cop/style/lambda.rb +1 -0
- data/lib/rubocop/cop/style/lambda_call.rb +10 -4
- data/lib/rubocop/cop/style/line_end_concatenation.rb +10 -4
- data/lib/rubocop/cop/style/map_into_array.rb +11 -3
- data/lib/rubocop/cop/style/map_to_hash.rb +12 -1
- data/lib/rubocop/cop/style/map_to_set.rb +3 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +28 -20
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +18 -0
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +8 -11
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -4
- data/lib/rubocop/cop/style/method_def_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/min_max_comparison.rb +13 -5
- data/lib/rubocop/cop/style/missing_else.rb +2 -0
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +33 -3
- data/lib/rubocop/cop/style/multiline_block_chain.rb +3 -2
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -0
- data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
- data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -9
- data/lib/rubocop/cop/style/multiple_comparison.rb +52 -51
- data/lib/rubocop/cop/style/mutable_constant.rb +7 -8
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +7 -5
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +5 -4
- data/lib/rubocop/cop/style/next.rb +44 -0
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/object_then.rb +15 -15
- data/lib/rubocop/cop/style/one_line_conditional.rb +25 -4
- data/lib/rubocop/cop/style/open_struct_use.rb +5 -5
- data/lib/rubocop/cop/style/operator_method_call.rb +5 -6
- data/lib/rubocop/cop/style/or_assignment.rb +3 -6
- data/lib/rubocop/cop/style/parallel_assignment.rb +41 -38
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +2 -2
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +1 -1
- data/lib/rubocop/cop/style/percent_q_literals.rb +1 -1
- data/lib/rubocop/cop/style/proc.rb +2 -2
- data/lib/rubocop/cop/style/quoted_symbols.rb +1 -1
- data/lib/rubocop/cop/style/raise_args.rb +15 -13
- data/lib/rubocop/cop/style/random_with_offset.rb +3 -3
- data/lib/rubocop/cop/style/redundant_argument.rb +3 -1
- data/lib/rubocop/cop/style/redundant_array_flatten.rb +50 -0
- data/lib/rubocop/cop/style/redundant_assignment.rb +1 -1
- data/lib/rubocop/cop/style/redundant_begin.rb +2 -1
- data/lib/rubocop/cop/style/redundant_condition.rb +95 -23
- data/lib/rubocop/cop/style/redundant_current_directory_in_path.rb +16 -5
- data/lib/rubocop/cop/style/redundant_double_splat_hash_braces.rb +6 -10
- data/lib/rubocop/cop/style/redundant_each.rb +1 -1
- data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +1 -9
- data/lib/rubocop/cop/style/redundant_format.rb +262 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +4 -4
- data/lib/rubocop/cop/style/redundant_initialize.rb +12 -3
- data/lib/rubocop/cop/style/redundant_interpolation.rb +1 -1
- data/lib/rubocop/cop/style/redundant_line_continuation.rb +55 -19
- data/lib/rubocop/cop/style/redundant_parentheses.rb +86 -26
- data/lib/rubocop/cop/style/redundant_regexp_argument.rb +4 -0
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +1 -1
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +2 -2
- data/lib/rubocop/cop/style/redundant_self.rb +15 -18
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +20 -32
- data/lib/rubocop/cop/style/redundant_self_assignment_branch.rb +4 -4
- data/lib/rubocop/cop/style/redundant_sort.rb +3 -3
- data/lib/rubocop/cop/style/redundant_sort_by.rb +17 -1
- data/lib/rubocop/cop/style/redundant_string_escape.rb +2 -2
- data/lib/rubocop/cop/style/regexp_literal.rb +1 -1
- data/lib/rubocop/cop/style/rescue_modifier.rb +5 -3
- data/lib/rubocop/cop/style/return_nil.rb +2 -2
- data/lib/rubocop/cop/style/safe_navigation.rb +56 -16
- data/lib/rubocop/cop/style/safe_navigation_chain_length.rb +52 -0
- data/lib/rubocop/cop/style/select_by_regexp.rb +5 -2
- data/lib/rubocop/cop/style/self_assignment.rb +11 -17
- data/lib/rubocop/cop/style/semicolon.rb +1 -1
- data/lib/rubocop/cop/style/send_with_literal_method_name.rb +2 -1
- data/lib/rubocop/cop/style/signal_exception.rb +2 -3
- data/lib/rubocop/cop/style/single_argument_dig.rb +9 -5
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/single_line_do_end_block.rb +15 -4
- data/lib/rubocop/cop/style/single_line_methods.rb +13 -11
- data/lib/rubocop/cop/style/slicing_with_range.rb +40 -11
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +68 -102
- data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/string_concatenation.rb +15 -15
- data/lib/rubocop/cop/style/string_literals.rb +1 -1
- data/lib/rubocop/cop/style/string_methods.rb +1 -1
- data/lib/rubocop/cop/style/struct_inheritance.rb +8 -1
- data/lib/rubocop/cop/style/super_arguments.rb +66 -19
- data/lib/rubocop/cop/style/swap_values.rb +4 -15
- data/lib/rubocop/cop/style/symbol_proc.rb +3 -1
- data/lib/rubocop/cop/style/ternary_parentheses.rb +25 -4
- data/lib/rubocop/cop/style/top_level_method_definition.rb +2 -1
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +11 -2
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +47 -6
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +1 -1
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +48 -6
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +4 -4
- data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -2
- data/lib/rubocop/cop/style/while_until_modifier.rb +0 -1
- data/lib/rubocop/cop/style/yoda_condition.rb +8 -4
- data/lib/rubocop/cop/style/yoda_expression.rb +2 -1
- data/lib/rubocop/cop/team.rb +1 -1
- data/lib/rubocop/cop/util.rb +12 -5
- data/lib/rubocop/cop/utils/format_string.rb +10 -5
- data/lib/rubocop/cop/variable_force/assignment.rb +24 -5
- data/lib/rubocop/cop/variable_force/branch.rb +1 -1
- data/lib/rubocop/cop/variable_force/scope.rb +1 -1
- data/lib/rubocop/cop/variable_force/variable.rb +14 -3
- data/lib/rubocop/cop/variable_force/variable_table.rb +5 -5
- data/lib/rubocop/cop/variable_force.rb +23 -18
- data/lib/rubocop/cops_documentation_generator.rb +51 -25
- data/lib/rubocop/directive_comment.rb +45 -11
- data/lib/rubocop/ext/regexp_node.rb +0 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +3 -2
- data/lib/rubocop/formatter/formatter_set.rb +1 -1
- data/lib/rubocop/formatter/fuubar_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +1 -1
- data/lib/rubocop/formatter/markdown_formatter.rb +1 -0
- data/lib/rubocop/formatter/offense_count_formatter.rb +1 -1
- data/lib/rubocop/formatter/pacman_formatter.rb +2 -1
- data/lib/rubocop/lsp/diagnostic.rb +189 -0
- data/lib/rubocop/lsp/logger.rb +2 -2
- data/lib/rubocop/lsp/routes.rb +10 -26
- data/lib/rubocop/lsp/runtime.rb +18 -50
- data/lib/rubocop/lsp/server.rb +0 -2
- data/lib/rubocop/lsp/stdin_runner.rb +85 -0
- data/lib/rubocop/magic_comment.rb +11 -3
- data/lib/rubocop/options.rb +28 -12
- data/lib/rubocop/path_util.rb +15 -8
- data/lib/rubocop/pending_cops_reporter.rb +56 -0
- data/lib/rubocop/plugin/configuration_integrator.rb +143 -0
- data/lib/rubocop/plugin/load_error.rb +26 -0
- data/lib/rubocop/plugin/loader.rb +100 -0
- data/lib/rubocop/plugin/not_supported_error.rb +29 -0
- data/lib/rubocop/plugin.rb +46 -0
- data/lib/rubocop/rake_task.rb +4 -1
- data/lib/rubocop/result_cache.rb +13 -13
- data/lib/rubocop/rspec/cop_helper.rb +13 -1
- data/lib/rubocop/rspec/expect_offense.rb +15 -5
- data/lib/rubocop/rspec/shared_contexts.rb +38 -1
- data/lib/rubocop/rspec/support.rb +4 -2
- data/lib/rubocop/runner.rb +26 -15
- data/lib/rubocop/server/cache.rb +51 -13
- data/lib/rubocop/server/cli.rb +2 -2
- data/lib/rubocop/server/client_command/base.rb +10 -0
- data/lib/rubocop/server/client_command/exec.rb +2 -1
- data/lib/rubocop/server/client_command/start.rb +11 -1
- data/lib/rubocop/target_finder.rb +7 -2
- data/lib/rubocop/target_ruby.rb +17 -2
- data/lib/rubocop/version.rb +53 -12
- data/lib/rubocop.rb +43 -2
- data/lib/ruby_lsp/rubocop/addon.rb +75 -0
- data/lib/ruby_lsp/rubocop/runtime_adapter.rb +65 -0
- metadata +89 -17
- data/lib/rubocop/cop/utils/regexp_ranges.rb +0 -113
- data/lib/rubocop/rspec/host_environment_simulation_helper.rb +0 -28
data/config/default.yml
CHANGED
@@ -146,12 +146,14 @@ AllCops:
|
|
146
146
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
147
147
|
# supported Ruby version (currently Ruby 2.7).
|
148
148
|
TargetRubyVersion: ~
|
149
|
-
#
|
149
|
+
# RuboCop choses the parser engine automatically but you can also specify it yourself.
|
150
|
+
# These options are available:
|
151
|
+
# - `default`
|
150
152
|
# - `parser_whitequark` ... https://github.com/whitequark/parser
|
151
153
|
# - `parser_prism` ... https://github.com/ruby/prism (`Prism::Translation::Parser`)
|
152
|
-
#
|
153
|
-
#
|
154
|
-
ParserEngine:
|
154
|
+
# Not every parser engine can handle every `TargetRubyVersion`. `parser_whitequark`
|
155
|
+
# only works with versions 3.4 and below, `parser_prism` with versions 3.3 and above.
|
156
|
+
ParserEngine: default
|
155
157
|
# Determines if a notification for extension libraries should be shown when
|
156
158
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
157
159
|
# of gems in the Gemfile that the extension is suggested for, if not already
|
@@ -272,12 +274,20 @@ Bundler/OrderedGems:
|
|
272
274
|
Gemspec/AddRuntimeDependency:
|
273
275
|
Description: 'Prefer `add_dependency` over `add_runtime_dependency`.'
|
274
276
|
StyleGuide: '#add_dependency_vs_add_runtime_dependency'
|
275
|
-
|
277
|
+
References:
|
278
|
+
- https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
|
276
279
|
Enabled: pending
|
277
280
|
VersionAdded: '1.65'
|
278
281
|
Include:
|
279
282
|
- '**/*.gemspec'
|
280
283
|
|
284
|
+
Gemspec/AttributeAssignment:
|
285
|
+
Description: 'Use consistent style for Gemspec attributes assignment.'
|
286
|
+
Enabled: pending
|
287
|
+
VersionAdded: '1.77'
|
288
|
+
Include:
|
289
|
+
- '**/*.gemspec'
|
290
|
+
|
281
291
|
Gemspec/DependencyVersion:
|
282
292
|
Description: 'Requires or forbids specifying gem dependency versions.'
|
283
293
|
Enabled: false
|
@@ -341,7 +351,7 @@ Gemspec/RequireMFA:
|
|
341
351
|
Severity: warning
|
342
352
|
VersionAdded: '1.23'
|
343
353
|
VersionChanged: '1.40'
|
344
|
-
|
354
|
+
References:
|
345
355
|
- https://guides.rubygems.org/mfa-requirement-opt-in/
|
346
356
|
Include:
|
347
357
|
- '**/*.gemspec'
|
@@ -368,7 +378,7 @@ Gemspec/RubyVersionGlobalsUsage:
|
|
368
378
|
#################### Layout ###########################
|
369
379
|
|
370
380
|
Layout/AccessModifierIndentation:
|
371
|
-
Description:
|
381
|
+
Description: Checks indentation of private/protected visibility modifiers.
|
372
382
|
StyleGuide: '#indent-public-private-protected'
|
373
383
|
Enabled: true
|
374
384
|
VersionAdded: '0.49'
|
@@ -602,7 +612,7 @@ Layout/EmptyLineAfterMultilineCondition:
|
|
602
612
|
# This is disabled, because this style is not very common in practice.
|
603
613
|
Enabled: false
|
604
614
|
VersionAdded: '0.90'
|
605
|
-
|
615
|
+
References:
|
606
616
|
- https://github.com/airbnb/ruby#multiline-if-newline
|
607
617
|
|
608
618
|
Layout/EmptyLineBetweenDefs:
|
@@ -628,6 +638,12 @@ Layout/EmptyLines:
|
|
628
638
|
Enabled: true
|
629
639
|
VersionAdded: '0.49'
|
630
640
|
|
641
|
+
Layout/EmptyLinesAfterModuleInclusion:
|
642
|
+
Description: 'Keeps track of empty lines after module inclusion methods.'
|
643
|
+
StyleGuide: '#empty-lines-after-module-inclusion'
|
644
|
+
Enabled: pending
|
645
|
+
VersionAdded: '1.79'
|
646
|
+
|
631
647
|
Layout/EmptyLinesAroundAccessModifier:
|
632
648
|
Description: "Keep blank lines around access modifiers."
|
633
649
|
StyleGuide: '#empty-lines-around-access-modifier'
|
@@ -637,7 +653,7 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
637
653
|
SupportedStyles:
|
638
654
|
- around
|
639
655
|
- only_before
|
640
|
-
|
656
|
+
References:
|
641
657
|
# A reference to `EnforcedStyle: only_before`.
|
642
658
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
643
659
|
|
@@ -994,7 +1010,7 @@ Layout/IndentationConsistency:
|
|
994
1010
|
SupportedStyles:
|
995
1011
|
- normal
|
996
1012
|
- indented_internal_methods
|
997
|
-
|
1013
|
+
References:
|
998
1014
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
999
1015
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
1000
1016
|
|
@@ -1038,9 +1054,10 @@ Layout/LeadingCommentSpace:
|
|
1038
1054
|
AllowDoxygenCommentStyle: false
|
1039
1055
|
AllowGemfileRubyComment: false
|
1040
1056
|
AllowRBSInlineAnnotation: false
|
1057
|
+
AllowSteepAnnotation: false
|
1041
1058
|
|
1042
1059
|
Layout/LeadingEmptyLines:
|
1043
|
-
Description:
|
1060
|
+
Description: Checks for unnecessary blank lines at the beginning of a file.
|
1044
1061
|
Enabled: true
|
1045
1062
|
VersionAdded: '0.57'
|
1046
1063
|
VersionChanged: '0.77'
|
@@ -1085,12 +1102,13 @@ Layout/LineLength:
|
|
1085
1102
|
StyleGuide: '#max-line-length'
|
1086
1103
|
Enabled: true
|
1087
1104
|
VersionAdded: '0.25'
|
1088
|
-
VersionChanged: '1.
|
1105
|
+
VersionChanged: '1.69'
|
1089
1106
|
Max: 120
|
1107
|
+
AllowHeredoc: true
|
1090
1108
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
1091
1109
|
# containing a URI to be longer than Max.
|
1092
|
-
AllowHeredoc: true
|
1093
1110
|
AllowURI: true
|
1111
|
+
AllowQualifiedName: true
|
1094
1112
|
URISchemes:
|
1095
1113
|
- http
|
1096
1114
|
- https
|
@@ -1101,6 +1119,8 @@ Layout/LineLength:
|
|
1101
1119
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
1102
1120
|
# any regular expression listed in this option will be ignored by LineLength.
|
1103
1121
|
AllowedPatterns: []
|
1122
|
+
# If SplitStrings is true, long strings will be split using continuations
|
1123
|
+
SplitStrings: false
|
1104
1124
|
|
1105
1125
|
Layout/MultilineArrayBraceLayout:
|
1106
1126
|
Description: >-
|
@@ -1127,7 +1147,7 @@ Layout/MultilineArrayLineBreaks:
|
|
1127
1147
|
AllowMultilineFinalElement: false
|
1128
1148
|
|
1129
1149
|
Layout/MultilineAssignmentLayout:
|
1130
|
-
Description: '
|
1150
|
+
Description: 'Checks for a newline after the assignment operator in multi-line assignments.'
|
1131
1151
|
StyleGuide: '#indent-conditional-assignment'
|
1132
1152
|
Enabled: false
|
1133
1153
|
VersionAdded: '0.49'
|
@@ -1498,7 +1518,6 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
1498
1518
|
- space
|
1499
1519
|
- no_space
|
1500
1520
|
|
1501
|
-
|
1502
1521
|
Layout/SpaceInsideParens:
|
1503
1522
|
Description: 'No spaces after ( or before ).'
|
1504
1523
|
StyleGuide: '#spaces-braces'
|
@@ -1614,6 +1633,12 @@ Lint/AmbiguousRegexpLiteral:
|
|
1614
1633
|
VersionAdded: '0.17'
|
1615
1634
|
VersionChanged: '0.83'
|
1616
1635
|
|
1636
|
+
Lint/ArrayLiteralInRegexp:
|
1637
|
+
Description: 'Checks for an array literal interpolated inside a regexp.'
|
1638
|
+
Enabled: pending
|
1639
|
+
VersionAdded: '1.71'
|
1640
|
+
SafeAutoCorrect: false
|
1641
|
+
|
1617
1642
|
Lint/AssignmentInCondition:
|
1618
1643
|
Description: "Don't use assignment in conditions."
|
1619
1644
|
StyleGuide: '#safe-assignment-in-condition'
|
@@ -1633,10 +1658,10 @@ Lint/BinaryOperatorWithIdenticalOperands:
|
|
1633
1658
|
Enabled: true
|
1634
1659
|
Safe: false
|
1635
1660
|
VersionAdded: '0.89'
|
1636
|
-
VersionChanged: '1.
|
1661
|
+
VersionChanged: '1.69'
|
1637
1662
|
|
1638
1663
|
Lint/BooleanSymbol:
|
1639
|
-
Description: '
|
1664
|
+
Description: 'Checks for `:true` and `:false` symbols.'
|
1640
1665
|
Enabled: true
|
1641
1666
|
SafeAutoCorrect: false
|
1642
1667
|
VersionAdded: '0.50'
|
@@ -1663,8 +1688,13 @@ Lint/ConstantOverwrittenInRescue:
|
|
1663
1688
|
Enabled: pending
|
1664
1689
|
VersionAdded: '1.31'
|
1665
1690
|
|
1691
|
+
Lint/ConstantReassignment:
|
1692
|
+
Description: 'Checks for constant reassignments.'
|
1693
|
+
Enabled: pending
|
1694
|
+
VersionAdded: '1.70'
|
1695
|
+
|
1666
1696
|
Lint/ConstantResolution:
|
1667
|
-
Description: '
|
1697
|
+
Description: 'Checks that constants are fully qualified with `::`.'
|
1668
1698
|
Enabled: false
|
1669
1699
|
VersionAdded: '0.86'
|
1670
1700
|
# Restrict this cop to only looking at certain names
|
@@ -1672,8 +1702,13 @@ Lint/ConstantResolution:
|
|
1672
1702
|
# Restrict this cop from only looking at certain names
|
1673
1703
|
Ignore: []
|
1674
1704
|
|
1705
|
+
Lint/CopDirectiveSyntax:
|
1706
|
+
Description: 'Checks that `# rubocop:` directives are strictly formatted.'
|
1707
|
+
Enabled: pending
|
1708
|
+
VersionAdded: '1.72'
|
1709
|
+
|
1675
1710
|
Lint/Debugger:
|
1676
|
-
Description: '
|
1711
|
+
Description: 'Checks for debugger calls.'
|
1677
1712
|
Enabled: true
|
1678
1713
|
VersionAdded: '0.14'
|
1679
1714
|
VersionChanged: '1.63'
|
@@ -1724,7 +1759,7 @@ Lint/Debugger:
|
|
1724
1759
|
- debug/start
|
1725
1760
|
|
1726
1761
|
Lint/DeprecatedClassMethods:
|
1727
|
-
Description: '
|
1762
|
+
Description: 'Checks for deprecated class method calls.'
|
1728
1763
|
Enabled: true
|
1729
1764
|
VersionAdded: '0.19'
|
1730
1765
|
|
@@ -1785,6 +1820,7 @@ Lint/DuplicateBranch:
|
|
1785
1820
|
VersionChanged: '1.7'
|
1786
1821
|
IgnoreLiteralBranches: false
|
1787
1822
|
IgnoreConstantBranches: false
|
1823
|
+
IgnoreDuplicateElseBranch: false
|
1788
1824
|
|
1789
1825
|
Lint/DuplicateCaseCondition:
|
1790
1826
|
Description: 'Do not repeat values in case conditionals.'
|
@@ -1797,13 +1833,13 @@ Lint/DuplicateElsifCondition:
|
|
1797
1833
|
VersionAdded: '0.88'
|
1798
1834
|
|
1799
1835
|
Lint/DuplicateHashKey:
|
1800
|
-
Description: '
|
1836
|
+
Description: 'Checks for duplicate keys in hash literals.'
|
1801
1837
|
Enabled: true
|
1802
1838
|
VersionAdded: '0.34'
|
1803
1839
|
VersionChanged: '0.77'
|
1804
1840
|
|
1805
1841
|
Lint/DuplicateMagicComment:
|
1806
|
-
Description: '
|
1842
|
+
Description: 'Checks for duplicated magic comments.'
|
1807
1843
|
Enabled: pending
|
1808
1844
|
VersionAdded: '1.37'
|
1809
1845
|
|
@@ -1813,7 +1849,7 @@ Lint/DuplicateMatchPattern:
|
|
1813
1849
|
VersionAdded: '1.50'
|
1814
1850
|
|
1815
1851
|
Lint/DuplicateMethods:
|
1816
|
-
Description: '
|
1852
|
+
Description: 'Checks for duplicate method definitions.'
|
1817
1853
|
Enabled: true
|
1818
1854
|
VersionAdded: '0.29'
|
1819
1855
|
|
@@ -1823,7 +1859,7 @@ Lint/DuplicateRegexpCharacterClassElement:
|
|
1823
1859
|
VersionAdded: '1.1'
|
1824
1860
|
|
1825
1861
|
Lint/DuplicateRequire:
|
1826
|
-
Description: '
|
1862
|
+
Description: 'Checks for duplicate `require`s and `require_relative`s.'
|
1827
1863
|
Enabled: true
|
1828
1864
|
SafeAutoCorrect: false
|
1829
1865
|
VersionAdded: '0.90'
|
@@ -1840,12 +1876,12 @@ Lint/DuplicateSetElement:
|
|
1840
1876
|
VersionAdded: '1.67'
|
1841
1877
|
|
1842
1878
|
Lint/EachWithObjectArgument:
|
1843
|
-
Description: '
|
1879
|
+
Description: 'Checks for immutable argument given to each_with_object.'
|
1844
1880
|
Enabled: true
|
1845
1881
|
VersionAdded: '0.31'
|
1846
1882
|
|
1847
1883
|
Lint/ElseLayout:
|
1848
|
-
Description: '
|
1884
|
+
Description: 'Checks for odd code arrangement in an else block.'
|
1849
1885
|
Enabled: true
|
1850
1886
|
VersionAdded: '0.17'
|
1851
1887
|
VersionChanged: '1.2'
|
@@ -1868,10 +1904,9 @@ Lint/EmptyConditionalBody:
|
|
1868
1904
|
Description: 'Checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1869
1905
|
Enabled: true
|
1870
1906
|
AutoCorrect: contextual
|
1871
|
-
SafeAutoCorrect: false
|
1872
1907
|
AllowComments: true
|
1873
1908
|
VersionAdded: '0.89'
|
1874
|
-
VersionChanged: '1.
|
1909
|
+
VersionChanged: '1.73'
|
1875
1910
|
|
1876
1911
|
Lint/EmptyEnsure:
|
1877
1912
|
Description: 'Checks for empty ensure block.'
|
@@ -1902,7 +1937,7 @@ Lint/EmptyInterpolation:
|
|
1902
1937
|
Enabled: true
|
1903
1938
|
AutoCorrect: contextual
|
1904
1939
|
VersionAdded: '0.20'
|
1905
|
-
VersionChanged: '1.
|
1940
|
+
VersionChanged: '1.76'
|
1906
1941
|
|
1907
1942
|
Lint/EmptyWhen:
|
1908
1943
|
Description: 'Checks for `when` branches with empty bodies.'
|
@@ -1954,6 +1989,11 @@ Lint/HashCompareByIdentity:
|
|
1954
1989
|
Safe: false
|
1955
1990
|
VersionAdded: '0.93'
|
1956
1991
|
|
1992
|
+
Lint/HashNewWithKeywordArgumentsAsDefault:
|
1993
|
+
Description: 'Checks for the deprecated use of keyword arguments for hash default in `Hash.new`.'
|
1994
|
+
Enabled: pending
|
1995
|
+
VersionAdded: '1.69'
|
1996
|
+
|
1957
1997
|
Lint/HeredocMethodCallPosition:
|
1958
1998
|
Description: >-
|
1959
1999
|
Checks for the ordering of a method call where
|
@@ -2010,7 +2050,8 @@ Lint/InterpolationCheck:
|
|
2010
2050
|
|
2011
2051
|
Lint/ItWithoutArgumentsInBlock:
|
2012
2052
|
Description: 'Checks uses of `it` calls without arguments in block.'
|
2013
|
-
|
2053
|
+
References:
|
2054
|
+
- 'https://bugs.ruby-lang.org/issues/18980'
|
2014
2055
|
Enabled: pending
|
2015
2056
|
VersionAdded: '1.59'
|
2016
2057
|
|
@@ -2022,6 +2063,7 @@ Lint/LambdaWithoutLiteralBlock:
|
|
2022
2063
|
Lint/LiteralAsCondition:
|
2023
2064
|
Description: 'Checks of literals used in conditions.'
|
2024
2065
|
Enabled: true
|
2066
|
+
AutoCorrect: contextual
|
2025
2067
|
VersionAdded: '0.51'
|
2026
2068
|
|
2027
2069
|
Lint/LiteralAssignmentInCondition:
|
@@ -2144,6 +2186,11 @@ Lint/NumberedParameterAssignment:
|
|
2144
2186
|
Enabled: pending
|
2145
2187
|
VersionAdded: '1.9'
|
2146
2188
|
|
2189
|
+
Lint/NumericOperationWithConstantResult:
|
2190
|
+
Description: 'Checks for numeric operations with constant results.'
|
2191
|
+
Enabled: pending
|
2192
|
+
VersionAdded: '1.69'
|
2193
|
+
|
2147
2194
|
Lint/OrAssignmentToConstant:
|
2148
2195
|
Description: 'Checks unintended or-assignment to constant.'
|
2149
2196
|
Enabled: pending
|
@@ -2230,14 +2277,14 @@ Lint/RedundantRegexpQuantifiers:
|
|
2230
2277
|
Lint/RedundantRequireStatement:
|
2231
2278
|
Description: 'Checks for unnecessary `require` statement.'
|
2232
2279
|
Enabled: true
|
2233
|
-
SafeAutoCorrect: false
|
2234
2280
|
VersionAdded: '0.76'
|
2235
|
-
VersionChanged: '1.
|
2281
|
+
VersionChanged: '1.73'
|
2236
2282
|
|
2237
2283
|
Lint/RedundantSafeNavigation:
|
2238
2284
|
Description: 'Checks for redundant safe navigation calls.'
|
2239
2285
|
Enabled: true
|
2240
2286
|
VersionAdded: '0.93'
|
2287
|
+
VersionChanged: '1.79'
|
2241
2288
|
AllowedMethods:
|
2242
2289
|
- instance_of?
|
2243
2290
|
- kind_of?
|
@@ -2245,6 +2292,12 @@ Lint/RedundantSafeNavigation:
|
|
2245
2292
|
- eql?
|
2246
2293
|
- respond_to?
|
2247
2294
|
- equal?
|
2295
|
+
InferNonNilReceiver: false
|
2296
|
+
AdditionalNilMethods:
|
2297
|
+
- present?
|
2298
|
+
- blank?
|
2299
|
+
- try
|
2300
|
+
- try!
|
2248
2301
|
Safe: false
|
2249
2302
|
|
2250
2303
|
Lint/RedundantSplatExpansion:
|
@@ -2261,6 +2314,11 @@ Lint/RedundantStringCoercion:
|
|
2261
2314
|
VersionAdded: '0.19'
|
2262
2315
|
VersionChanged: '0.77'
|
2263
2316
|
|
2317
|
+
Lint/RedundantTypeConversion:
|
2318
|
+
Description: 'Checks for redundantly converting a literal to the same type.'
|
2319
|
+
Enabled: pending
|
2320
|
+
VersionAdded: '1.72'
|
2321
|
+
|
2264
2322
|
Lint/RedundantWithIndex:
|
2265
2323
|
Description: 'Checks for redundant `with_index`.'
|
2266
2324
|
Enabled: true
|
@@ -2363,6 +2421,7 @@ Lint/SelfAssignment:
|
|
2363
2421
|
Description: 'Checks for self-assignments.'
|
2364
2422
|
Enabled: true
|
2365
2423
|
VersionAdded: '0.89'
|
2424
|
+
AllowRBSInlineAnnotation: false
|
2366
2425
|
|
2367
2426
|
Lint/SendWithMixinArgument:
|
2368
2427
|
Description: 'Checks for `send` method when using mixin.'
|
@@ -2375,7 +2434,6 @@ Lint/ShadowedArgument:
|
|
2375
2434
|
VersionAdded: '0.52'
|
2376
2435
|
IgnoreImplicitReferences: false
|
2377
2436
|
|
2378
|
-
|
2379
2437
|
Lint/ShadowedException:
|
2380
2438
|
Description: >-
|
2381
2439
|
Avoid rescuing a higher level exception
|
@@ -2387,8 +2445,15 @@ Lint/ShadowingOuterLocalVariable:
|
|
2387
2445
|
Description: >-
|
2388
2446
|
Do not use the same name as outer local variable
|
2389
2447
|
for block arguments or block local variables.
|
2390
|
-
Enabled:
|
2448
|
+
Enabled: false
|
2391
2449
|
VersionAdded: '0.9'
|
2450
|
+
VersionChanged: '1.76'
|
2451
|
+
|
2452
|
+
Lint/SharedMutableDefault:
|
2453
|
+
Description: 'Checks for mutable literals used as default arguments during Hash initialization.'
|
2454
|
+
StyleGuide: '#no-mutable-defaults'
|
2455
|
+
Enabled: pending
|
2456
|
+
VersionAdded: '1.70'
|
2392
2457
|
|
2393
2458
|
Lint/StructNewOverride:
|
2394
2459
|
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
@@ -2404,6 +2469,12 @@ Lint/SuppressedException:
|
|
2404
2469
|
VersionAdded: '0.9'
|
2405
2470
|
VersionChanged: '1.12'
|
2406
2471
|
|
2472
|
+
Lint/SuppressedExceptionInNumberConversion:
|
2473
|
+
Description: 'Checks for cases where exceptions unrelated to the numeric constructors may be unintentionally swallowed.'
|
2474
|
+
Enabled: pending
|
2475
|
+
SafeAutoCorrect: false
|
2476
|
+
VersionAdded: '1.72'
|
2477
|
+
|
2407
2478
|
Lint/SymbolConversion:
|
2408
2479
|
Description: 'Checks for unnecessary symbol conversions.'
|
2409
2480
|
Enabled: pending
|
@@ -2455,6 +2526,11 @@ Lint/UnderscorePrefixedVariableName:
|
|
2455
2526
|
VersionAdded: '0.21'
|
2456
2527
|
AllowKeywordBlockArguments: false
|
2457
2528
|
|
2529
|
+
Lint/UnescapedBracketInRegexp:
|
2530
|
+
Description: 'Checks for unescaped literal `]` in Regexp.'
|
2531
|
+
Enabled: pending
|
2532
|
+
VersionAdded: '1.68'
|
2533
|
+
|
2458
2534
|
Lint/UnexpectedBlockArity:
|
2459
2535
|
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2460
2536
|
Enabled: pending
|
@@ -2514,10 +2590,12 @@ Lint/UnusedMethodArgument:
|
|
2514
2590
|
Enabled: true
|
2515
2591
|
AutoCorrect: contextual
|
2516
2592
|
VersionAdded: '0.21'
|
2517
|
-
VersionChanged: '1.
|
2593
|
+
VersionChanged: '1.69'
|
2518
2594
|
AllowUnusedKeywordArguments: false
|
2519
2595
|
IgnoreEmptyMethods: true
|
2520
2596
|
IgnoreNotImplementedMethods: true
|
2597
|
+
NotImplementedExceptions:
|
2598
|
+
- NotImplementedError
|
2521
2599
|
|
2522
2600
|
Lint/UriEscapeUnescape:
|
2523
2601
|
Description: >-
|
@@ -2552,6 +2630,23 @@ Lint/UselessAssignment:
|
|
2552
2630
|
VersionAdded: '0.11'
|
2553
2631
|
VersionChanged: '1.66'
|
2554
2632
|
|
2633
|
+
Lint/UselessConstantScoping:
|
2634
|
+
Description: 'Checks for useless constant scoping.'
|
2635
|
+
Enabled: pending
|
2636
|
+
VersionAdded: '1.72'
|
2637
|
+
|
2638
|
+
Lint/UselessDefaultValueArgument:
|
2639
|
+
Description: 'Checks for usage of `fetch` or `Array.new` with default value argument and block.'
|
2640
|
+
Enabled: pending
|
2641
|
+
VersionAdded: '1.76'
|
2642
|
+
Safe: false
|
2643
|
+
AllowedReceivers: []
|
2644
|
+
|
2645
|
+
Lint/UselessDefined:
|
2646
|
+
Description: 'Checks for calls to `defined?` with strings and symbols. The result of such a call will always be truthy.'
|
2647
|
+
Enabled: pending
|
2648
|
+
VersionAdded: '1.69'
|
2649
|
+
|
2555
2650
|
Lint/UselessElseWithoutRescue:
|
2556
2651
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
2557
2652
|
Enabled: true
|
@@ -2571,6 +2666,11 @@ Lint/UselessNumericOperation:
|
|
2571
2666
|
Enabled: pending
|
2572
2667
|
VersionAdded: '1.66'
|
2573
2668
|
|
2669
|
+
Lint/UselessOr:
|
2670
|
+
Description: 'Checks for useless OR expressions.'
|
2671
|
+
Enabled: pending
|
2672
|
+
VersionAdded: '1.76'
|
2673
|
+
|
2574
2674
|
Lint/UselessRescue:
|
2575
2675
|
Description: 'Checks for useless `rescue`s.'
|
2576
2676
|
Enabled: pending
|
@@ -2610,8 +2710,8 @@ Metrics/AbcSize:
|
|
2610
2710
|
Description: >-
|
2611
2711
|
A calculated magnitude based on number of assignments,
|
2612
2712
|
branches, and conditions.
|
2613
|
-
|
2614
|
-
-
|
2713
|
+
References:
|
2714
|
+
- https://wiki.c2.com/?AbcMetric
|
2615
2715
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
2616
2716
|
Enabled: true
|
2617
2717
|
VersionAdded: '0.27'
|
@@ -2730,7 +2830,7 @@ Migration/DepartmentName:
|
|
2730
2830
|
#################### Naming ##############################
|
2731
2831
|
|
2732
2832
|
Naming/AccessorMethodName:
|
2733
|
-
Description:
|
2833
|
+
Description: Checks the naming of accessor methods for get_/set_.
|
2734
2834
|
StyleGuide: '#accessor_mutator_method_names'
|
2735
2835
|
Enabled: true
|
2736
2836
|
VersionAdded: '0.50'
|
@@ -2934,6 +3034,7 @@ Naming/MethodName:
|
|
2934
3034
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2935
3035
|
Enabled: true
|
2936
3036
|
VersionAdded: '0.50'
|
3037
|
+
VersionChanged: '1.75'
|
2937
3038
|
EnforcedStyle: snake_case
|
2938
3039
|
SupportedStyles:
|
2939
3040
|
- snake_case
|
@@ -2945,6 +3046,10 @@ Naming/MethodName:
|
|
2945
3046
|
# - '\A\s*onSelectionCleared\s*'
|
2946
3047
|
#
|
2947
3048
|
AllowedPatterns: []
|
3049
|
+
ForbiddenIdentifiers:
|
3050
|
+
- __id__
|
3051
|
+
- __send__
|
3052
|
+
ForbiddenPatterns: []
|
2948
3053
|
|
2949
3054
|
Naming/MethodParameterName:
|
2950
3055
|
Description: >-
|
@@ -2976,22 +3081,42 @@ Naming/MethodParameterName:
|
|
2976
3081
|
# Forbidden names that will register an offense
|
2977
3082
|
ForbiddenNames: []
|
2978
3083
|
|
2979
|
-
Naming/
|
2980
|
-
Description: '
|
3084
|
+
Naming/PredicateMethod:
|
3085
|
+
Description: 'Checks that predicate methods end with `?` and non-predicate methods do not.'
|
3086
|
+
Enabled: pending
|
3087
|
+
VersionAdded: '1.76'
|
3088
|
+
VersionChanged: '1.78'
|
3089
|
+
# In `aggressive` mode, the cop will register an offense for predicate methods that
|
3090
|
+
# may return a non-boolean value.
|
3091
|
+
# In `conservative` mode, the cop will *not* register an offense for predicate methods
|
3092
|
+
# that may return a non-boolean value.
|
3093
|
+
Mode: conservative
|
3094
|
+
AllowedMethods:
|
3095
|
+
- call
|
3096
|
+
AllowedPatterns: []
|
3097
|
+
AllowBangMethods: false
|
3098
|
+
# Methods that are known to not return a boolean value, despite ending in `?`.
|
3099
|
+
WaywardPredicates:
|
3100
|
+
- nonzero?
|
3101
|
+
|
3102
|
+
Naming/PredicatePrefix:
|
3103
|
+
Description: 'Predicate method names should not be prefixed and end with a `?`.'
|
2981
3104
|
StyleGuide: '#bool-methods-qmark'
|
2982
3105
|
Enabled: true
|
2983
3106
|
VersionAdded: '0.50'
|
2984
|
-
VersionChanged: '
|
3107
|
+
VersionChanged: '1.75'
|
2985
3108
|
# Predicate name prefixes.
|
2986
3109
|
NamePrefix:
|
2987
3110
|
- is_
|
2988
3111
|
- has_
|
2989
3112
|
- have_
|
3113
|
+
- does_
|
2990
3114
|
# Predicate name prefixes that should be removed.
|
2991
3115
|
ForbiddenPrefixes:
|
2992
3116
|
- is_
|
2993
3117
|
- has_
|
2994
3118
|
- have_
|
3119
|
+
- does_
|
2995
3120
|
# Predicate names which, despite having a forbidden prefix, or no `?`,
|
2996
3121
|
# should still be accepted
|
2997
3122
|
AllowedMethods:
|
@@ -3000,6 +3125,8 @@ Naming/PredicateName:
|
|
3000
3125
|
MethodDefinitionMacros:
|
3001
3126
|
- define_method
|
3002
3127
|
- define_singleton_method
|
3128
|
+
# Use Sorbet's T::Boolean return type to detect predicate methods.
|
3129
|
+
UseSorbetSigs: false
|
3003
3130
|
# Exclude Rspec specs because there is a strong convention to write spec
|
3004
3131
|
# helpers in the form of `have_something` or `be_something`.
|
3005
3132
|
Exclude:
|
@@ -3017,13 +3144,15 @@ Naming/VariableName:
|
|
3017
3144
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
3018
3145
|
Enabled: true
|
3019
3146
|
VersionAdded: '0.50'
|
3020
|
-
VersionChanged: '1.
|
3147
|
+
VersionChanged: '1.73'
|
3021
3148
|
EnforcedStyle: snake_case
|
3022
3149
|
SupportedStyles:
|
3023
3150
|
- snake_case
|
3024
3151
|
- camelCase
|
3025
3152
|
AllowedIdentifiers: []
|
3026
3153
|
AllowedPatterns: []
|
3154
|
+
ForbiddenIdentifiers: []
|
3155
|
+
ForbiddenPatterns: []
|
3027
3156
|
|
3028
3157
|
Naming/VariableNumber:
|
3029
3158
|
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
@@ -3039,6 +3168,8 @@ Naming/VariableNumber:
|
|
3039
3168
|
CheckMethodNames: true
|
3040
3169
|
CheckSymbols: true
|
3041
3170
|
AllowedIdentifiers:
|
3171
|
+
- TLS1_1 # OpenSSL::SSL::TLS1_1_VERSION
|
3172
|
+
- TLS1_2 # OpenSSL::SSL::TLS1_2_VERSION
|
3042
3173
|
- capture3 # Open3.capture3
|
3043
3174
|
- iso8601 # Time#iso8601
|
3044
3175
|
- rfc1123_date # CGI.rfc1123_date
|
@@ -3074,7 +3205,8 @@ Security/JSONLoad:
|
|
3074
3205
|
Description: >-
|
3075
3206
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
3076
3207
|
security issues. See reference for more information.
|
3077
|
-
|
3208
|
+
References:
|
3209
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
3078
3210
|
Enabled: true
|
3079
3211
|
VersionAdded: '0.43'
|
3080
3212
|
VersionChanged: '1.22'
|
@@ -3086,7 +3218,8 @@ Security/MarshalLoad:
|
|
3086
3218
|
Description: >-
|
3087
3219
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
3088
3220
|
security issues. See reference for more information.
|
3089
|
-
|
3221
|
+
References:
|
3222
|
+
- 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
3090
3223
|
Enabled: true
|
3091
3224
|
VersionAdded: '0.47'
|
3092
3225
|
|
@@ -3101,7 +3234,8 @@ Security/YAMLLoad:
|
|
3101
3234
|
Description: >-
|
3102
3235
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
3103
3236
|
security issues. See reference for more information.
|
3104
|
-
|
3237
|
+
References:
|
3238
|
+
- 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
3105
3239
|
Enabled: true
|
3106
3240
|
VersionAdded: '0.47'
|
3107
3241
|
SafeAutoCorrect: false
|
@@ -3112,13 +3246,14 @@ Style/AccessModifierDeclarations:
|
|
3112
3246
|
Description: 'Checks style of how access modifiers are used.'
|
3113
3247
|
Enabled: true
|
3114
3248
|
VersionAdded: '0.57'
|
3115
|
-
VersionChanged: '
|
3249
|
+
VersionChanged: '1.70'
|
3116
3250
|
EnforcedStyle: group
|
3117
3251
|
SupportedStyles:
|
3118
3252
|
- inline
|
3119
3253
|
- group
|
3120
3254
|
AllowModifiersOnSymbols: true
|
3121
3255
|
AllowModifiersOnAttrs: true
|
3256
|
+
AllowModifiersOnAliasMethod: true
|
3122
3257
|
SafeAutoCorrect: false
|
3123
3258
|
|
3124
3259
|
Style/AccessorGrouping:
|
@@ -3143,6 +3278,12 @@ Style/Alias:
|
|
3143
3278
|
- prefer_alias
|
3144
3279
|
- prefer_alias_method
|
3145
3280
|
|
3281
|
+
Style/AmbiguousEndlessMethodDefinition:
|
3282
|
+
Description: 'Checks for endless methods inside operators of lower precedence.'
|
3283
|
+
StyleGuide: '#ambiguous-endless-method-defintions'
|
3284
|
+
Enabled: pending
|
3285
|
+
VersionAdded: '1.68'
|
3286
|
+
|
3146
3287
|
Style/AndOr:
|
3147
3288
|
Description: 'Use &&/|| instead of and/or.'
|
3148
3289
|
StyleGuide: '#no-and-or-or'
|
@@ -3188,7 +3329,8 @@ Style/ArrayCoercion:
|
|
3188
3329
|
|
3189
3330
|
Style/ArrayFirstLast:
|
3190
3331
|
Description: 'Use `arr.first` and `arr.last` instead of `arr[0]` and `arr[-1]`.'
|
3191
|
-
|
3332
|
+
References:
|
3333
|
+
- '#first-and-last'
|
3192
3334
|
Enabled: false
|
3193
3335
|
VersionAdded: '1.58'
|
3194
3336
|
Safe: false
|
@@ -3250,6 +3392,13 @@ Style/BisectedAttrAccessor:
|
|
3250
3392
|
Enabled: true
|
3251
3393
|
VersionAdded: '0.87'
|
3252
3394
|
|
3395
|
+
Style/BitwisePredicate:
|
3396
|
+
Description: 'Prefer bitwise predicate methods over direct comparison operations.'
|
3397
|
+
StyleGuide: '#bitwise-predicate-methods'
|
3398
|
+
Enabled: pending
|
3399
|
+
Safe: false
|
3400
|
+
VersionAdded: '1.68'
|
3401
|
+
|
3253
3402
|
Style/BlockComments:
|
3254
3403
|
Description: 'Do not use block comments.'
|
3255
3404
|
StyleGuide: '#no-block-comments'
|
@@ -3420,6 +3569,7 @@ Style/ClassAndModuleChildren:
|
|
3420
3569
|
SafeAutoCorrect: false
|
3421
3570
|
Enabled: true
|
3422
3571
|
VersionAdded: '0.19'
|
3572
|
+
VersionChanged: '1.74'
|
3423
3573
|
#
|
3424
3574
|
# Basically there are two different styles:
|
3425
3575
|
#
|
@@ -3435,7 +3585,21 @@ Style/ClassAndModuleChildren:
|
|
3435
3585
|
#
|
3436
3586
|
# The compact style is only forced, for classes or modules with one child.
|
3437
3587
|
EnforcedStyle: nested
|
3438
|
-
SupportedStyles:
|
3588
|
+
SupportedStyles: &supported_styles
|
3589
|
+
- nested
|
3590
|
+
- compact
|
3591
|
+
# Configure classes separately, if desired. If not set, or set to `nil`,
|
3592
|
+
# the `EnforcedStyle` value will be used.
|
3593
|
+
EnforcedStyleForClasses: ~
|
3594
|
+
SupportedStylesForClasses:
|
3595
|
+
- ~
|
3596
|
+
- nested
|
3597
|
+
- compact
|
3598
|
+
# Configure modules separately, if desired. If not set, or set to `nil`,
|
3599
|
+
# the `EnforcedStyle` value will be used.
|
3600
|
+
EnforcedStyleForModules: ~
|
3601
|
+
SupportedStylesForModules:
|
3602
|
+
- ~
|
3439
3603
|
- nested
|
3440
3604
|
- compact
|
3441
3605
|
|
@@ -3521,6 +3685,13 @@ Style/CollectionMethods:
|
|
3521
3685
|
- inject
|
3522
3686
|
- reduce
|
3523
3687
|
|
3688
|
+
Style/CollectionQuerying:
|
3689
|
+
Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
|
3690
|
+
StyleGuide: '#collection-querying'
|
3691
|
+
Enabled: pending
|
3692
|
+
VersionAdded: '1.77'
|
3693
|
+
Safe: false
|
3694
|
+
|
3524
3695
|
Style/ColonMethodCall:
|
3525
3696
|
Description: 'Do not use :: for method call.'
|
3526
3697
|
StyleGuide: '#double-colons'
|
@@ -3533,6 +3704,11 @@ Style/ColonMethodDefinition:
|
|
3533
3704
|
Enabled: true
|
3534
3705
|
VersionAdded: '0.52'
|
3535
3706
|
|
3707
|
+
Style/CombinableDefined:
|
3708
|
+
Description: 'Checks successive `defined?` calls that can be combined into a single call.'
|
3709
|
+
Enabled: pending
|
3710
|
+
VersionAdded: '1.68'
|
3711
|
+
|
3536
3712
|
Style/CombinableLoops:
|
3537
3713
|
Description: >-
|
3538
3714
|
Checks for places where multiple consecutive loops over the same data
|
@@ -3583,6 +3759,14 @@ Style/CommentedKeyword:
|
|
3583
3759
|
VersionAdded: '0.51'
|
3584
3760
|
VersionChanged: '1.19'
|
3585
3761
|
|
3762
|
+
Style/ComparableBetween:
|
3763
|
+
Description: 'Enforces the use of `Comparable#between?` instead of logical comparison.'
|
3764
|
+
Enabled: pending
|
3765
|
+
Safe: false
|
3766
|
+
VersionAdded: '1.74'
|
3767
|
+
VersionChanged: '1.75'
|
3768
|
+
StyleGuide: '#ranges-or-between'
|
3769
|
+
|
3586
3770
|
Style/ComparableClamp:
|
3587
3771
|
Description: 'Enforces the use of `Comparable#clamp` instead of comparison by minimum and maximum.'
|
3588
3772
|
Enabled: pending
|
@@ -3673,6 +3857,12 @@ Style/DefWithParentheses:
|
|
3673
3857
|
VersionAdded: '0.9'
|
3674
3858
|
VersionChanged: '0.12'
|
3675
3859
|
|
3860
|
+
Style/DigChain:
|
3861
|
+
Description: 'Use `dig` with multiple parameters instead of chaining multiple calls.'
|
3862
|
+
Enabled: pending
|
3863
|
+
Safe: false
|
3864
|
+
VersionAdded: '1.69'
|
3865
|
+
|
3676
3866
|
Style/Dir:
|
3677
3867
|
Description: >-
|
3678
3868
|
Use the `__dir__` method to retrieve the canonicalized
|
@@ -3809,6 +3999,16 @@ Style/EmptyMethod:
|
|
3809
3999
|
- compact
|
3810
4000
|
- expanded
|
3811
4001
|
|
4002
|
+
Style/EmptyStringInsideInterpolation:
|
4003
|
+
Description: 'Checks for empty strings being assigned inside string interpolation.'
|
4004
|
+
StyleGuide: '#empty-strings-in-interpolation'
|
4005
|
+
Enabled: pending
|
4006
|
+
EnforcedStyle: trailing_conditional
|
4007
|
+
SupportedStyles:
|
4008
|
+
- trailing_conditional
|
4009
|
+
- ternary
|
4010
|
+
VersionAdded: '1.76'
|
4011
|
+
|
3812
4012
|
Style/Encoding:
|
3813
4013
|
Description: 'Use UTF-8 as the source file encoding.'
|
3814
4014
|
StyleGuide: '#utf-8'
|
@@ -3833,6 +4033,8 @@ Style/EndlessMethod:
|
|
3833
4033
|
- allow_single_line
|
3834
4034
|
- allow_always
|
3835
4035
|
- disallow
|
4036
|
+
- require_single_line
|
4037
|
+
- require_always
|
3836
4038
|
|
3837
4039
|
Style/EnvHome:
|
3838
4040
|
Description: "Checks for consistent usage of `ENV['HOME']`."
|
@@ -3885,12 +4087,15 @@ Style/ExponentialNotation:
|
|
3885
4087
|
Style/FetchEnvVar:
|
3886
4088
|
Description: >-
|
3887
4089
|
Suggests `ENV.fetch` for the replacement of `ENV[]`.
|
3888
|
-
|
4090
|
+
References:
|
3889
4091
|
- https://rubystyle.guide/#hash-fetch-defaults
|
3890
4092
|
Enabled: pending
|
3891
4093
|
VersionAdded: '1.28'
|
3892
4094
|
# Environment variables to be excluded from the inspection.
|
3893
4095
|
AllowedVars: []
|
4096
|
+
# When `true`, autocorrects `ENV["key"]` to `ENV.fetch("key", nil)`.
|
4097
|
+
# When `false`, autocorrects `ENV["key"]` to `ENV.fetch("key")`.
|
4098
|
+
DefaultToNil: true
|
3894
4099
|
|
3895
4100
|
Style/FileEmpty:
|
3896
4101
|
Description: >-
|
@@ -3899,12 +4104,24 @@ Style/FileEmpty:
|
|
3899
4104
|
Safe: false
|
3900
4105
|
VersionAdded: '1.48'
|
3901
4106
|
|
4107
|
+
Style/FileNull:
|
4108
|
+
Description: 'Use `File::NULL` instead of hardcoding "dev/null".'
|
4109
|
+
Enabled: pending
|
4110
|
+
SafeAutoCorrect: false
|
4111
|
+
VersionAdded: '1.69'
|
4112
|
+
|
3902
4113
|
Style/FileRead:
|
3903
4114
|
Description: 'Favor `File.(bin)read` convenience methods.'
|
3904
4115
|
StyleGuide: '#file-read'
|
3905
4116
|
Enabled: pending
|
3906
4117
|
VersionAdded: '1.24'
|
3907
4118
|
|
4119
|
+
Style/FileTouch:
|
4120
|
+
Description: 'Favor `FileUtils.touch` for touching files.'
|
4121
|
+
Enabled: pending
|
4122
|
+
VersionAdded: '1.69'
|
4123
|
+
SafeAutoCorrect: false
|
4124
|
+
|
3908
4125
|
Style/FileWrite:
|
3909
4126
|
Description: 'Favor `File.(bin)write` convenience methods.'
|
3910
4127
|
StyleGuide: '#file-write'
|
@@ -3914,7 +4131,8 @@ Style/FileWrite:
|
|
3914
4131
|
Style/FloatDivision:
|
3915
4132
|
Description: 'For performing float division, coerce one side only.'
|
3916
4133
|
StyleGuide: '#float-division'
|
3917
|
-
|
4134
|
+
References:
|
4135
|
+
- 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
3918
4136
|
Enabled: true
|
3919
4137
|
VersionAdded: '0.72'
|
3920
4138
|
VersionChanged: '1.9'
|
@@ -3965,8 +4183,14 @@ Style/FormatStringToken:
|
|
3965
4183
|
# style token in a format string to be allowed when enforced style is not
|
3966
4184
|
# `unannotated`.
|
3967
4185
|
MaxUnannotatedPlaceholdersAllowed: 1
|
4186
|
+
# The mode the cop operates in. Two values are allowed:
|
4187
|
+
# * aggressive (default): all strings are considered
|
4188
|
+
# * conservative:
|
4189
|
+
# only register offenses for strings given to `printf`, `sprintf`,
|
4190
|
+
# format` and `%` methods. Other strings are not considered.
|
4191
|
+
Mode: aggressive
|
3968
4192
|
VersionAdded: '0.49'
|
3969
|
-
VersionChanged: '1.
|
4193
|
+
VersionChanged: '1.74'
|
3970
4194
|
AllowedMethods: []
|
3971
4195
|
AllowedPatterns: []
|
3972
4196
|
|
@@ -3991,6 +4215,9 @@ Style/FrozenStringLiteralComment:
|
|
3991
4215
|
# exist in a file.
|
3992
4216
|
- never
|
3993
4217
|
SafeAutoCorrect: false
|
4218
|
+
Exclude:
|
4219
|
+
# Prevent the Ruby warning: `'frozen_string_literal' is ignored after any tokens` when using Active Admin.
|
4220
|
+
- '**/*.arb'
|
3994
4221
|
|
3995
4222
|
Style/GlobalStdStream:
|
3996
4223
|
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
@@ -4002,14 +4229,15 @@ Style/GlobalStdStream:
|
|
4002
4229
|
Style/GlobalVars:
|
4003
4230
|
Description: 'Do not introduce global variables.'
|
4004
4231
|
StyleGuide: '#instance-vars'
|
4005
|
-
|
4232
|
+
References:
|
4233
|
+
- 'https://www.zenspider.com/ruby/quickref.html'
|
4006
4234
|
Enabled: true
|
4007
4235
|
VersionAdded: '0.13'
|
4008
4236
|
# Built-in global variables are allowed by default.
|
4009
4237
|
AllowedVariables: []
|
4010
4238
|
|
4011
4239
|
Style/GuardClause:
|
4012
|
-
Description: '
|
4240
|
+
Description: 'Checks for conditionals that can be replaced with guard clauses.'
|
4013
4241
|
StyleGuide: '#no-nested-conditionals'
|
4014
4242
|
Enabled: true
|
4015
4243
|
VersionAdded: '0.20'
|
@@ -4059,6 +4287,12 @@ Style/HashExcept:
|
|
4059
4287
|
VersionAdded: '1.7'
|
4060
4288
|
VersionChanged: '1.39'
|
4061
4289
|
|
4290
|
+
Style/HashFetchChain:
|
4291
|
+
Description: 'Use `Hash#dig` instead of chained `fetch` calls.'
|
4292
|
+
Enabled: pending
|
4293
|
+
Safe: false
|
4294
|
+
VersionAdded: '1.75'
|
4295
|
+
|
4062
4296
|
Style/HashLikeCase:
|
4063
4297
|
Description: >-
|
4064
4298
|
Checks for places where `case-when` represents a simple 1:1
|
@@ -4069,6 +4303,14 @@ Style/HashLikeCase:
|
|
4069
4303
|
# to trigger this cop
|
4070
4304
|
MinBranchesCount: 3
|
4071
4305
|
|
4306
|
+
Style/HashSlice:
|
4307
|
+
Description: >-
|
4308
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
4309
|
+
that can be replaced with `Hash#slice` method.
|
4310
|
+
Enabled: pending
|
4311
|
+
Safe: false
|
4312
|
+
VersionAdded: '1.71'
|
4313
|
+
|
4072
4314
|
Style/HashSyntax:
|
4073
4315
|
Description: >-
|
4074
4316
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -4256,6 +4498,31 @@ Style/IpAddresses:
|
|
4256
4498
|
- '**/gems.rb'
|
4257
4499
|
- '**/*.gemspec'
|
4258
4500
|
|
4501
|
+
Style/ItAssignment:
|
4502
|
+
Description: 'Checks for local variables and method parameters named `it`.'
|
4503
|
+
Enabled: pending
|
4504
|
+
VersionAdded: '1.70'
|
4505
|
+
|
4506
|
+
Style/ItBlockParameter:
|
4507
|
+
Description: 'Checks for blocks with one argument where `it` block parameter can be used.'
|
4508
|
+
Enabled: pending
|
4509
|
+
EnforcedStyle: allow_single_line
|
4510
|
+
SupportedStyles:
|
4511
|
+
- allow_single_line
|
4512
|
+
- only_numbered_parameters
|
4513
|
+
- always
|
4514
|
+
- disallow
|
4515
|
+
VersionAdded: '1.75'
|
4516
|
+
VersionChanged: '1.76'
|
4517
|
+
|
4518
|
+
Style/KeywordArgumentsMerging:
|
4519
|
+
Description: >-
|
4520
|
+
When passing an existing hash as keyword arguments, provide additional arguments
|
4521
|
+
directly rather than using `merge`.
|
4522
|
+
StyleGuide: '#merging-keyword-arguments'
|
4523
|
+
Enabled: pending
|
4524
|
+
VersionAdded: '1.68'
|
4525
|
+
|
4259
4526
|
Style/KeywordParametersOrder:
|
4260
4527
|
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
4261
4528
|
StyleGuide: '#keyword-parameters-order'
|
@@ -4636,7 +4903,7 @@ Style/Next:
|
|
4636
4903
|
StyleGuide: '#no-nested-conditionals'
|
4637
4904
|
Enabled: true
|
4638
4905
|
VersionAdded: '0.22'
|
4639
|
-
VersionChanged: '
|
4906
|
+
VersionChanged: '1.75'
|
4640
4907
|
# With `always` all conditions at the end of an iteration needs to be
|
4641
4908
|
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
4642
4909
|
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
@@ -4644,6 +4911,7 @@ Style/Next:
|
|
4644
4911
|
# `MinBodyLength` defines the number of lines of the a body of an `if` or `unless`
|
4645
4912
|
# needs to have to trigger this cop
|
4646
4913
|
MinBodyLength: 3
|
4914
|
+
AllowConsecutiveConditionals: false
|
4647
4915
|
SupportedStyles:
|
4648
4916
|
- skip_modifier_ifs
|
4649
4917
|
- always
|
@@ -4775,8 +5043,8 @@ Style/OpenStructUse:
|
|
4775
5043
|
Description: >-
|
4776
5044
|
Avoid using OpenStruct. As of Ruby 3.0, use is officially discouraged due to performance,
|
4777
5045
|
version compatibility, and potential security issues.
|
4778
|
-
|
4779
|
-
- https://docs.ruby-lang.org/en/3.0
|
5046
|
+
References:
|
5047
|
+
- https://docs.ruby-lang.org/en/3.0/OpenStruct.html#class-OpenStruct-label-Caveats
|
4780
5048
|
|
4781
5049
|
Enabled: pending
|
4782
5050
|
Safe: false
|
@@ -4932,7 +5200,7 @@ Style/RandomWithOffset:
|
|
4932
5200
|
VersionAdded: '0.52'
|
4933
5201
|
|
4934
5202
|
Style/RedundantArgument:
|
4935
|
-
Description: '
|
5203
|
+
Description: 'Checks for a redundant argument passed to certain methods.'
|
4936
5204
|
Enabled: pending
|
4937
5205
|
Safe: false
|
4938
5206
|
VersionAdded: '1.4'
|
@@ -4958,6 +5226,12 @@ Style/RedundantArrayConstructor:
|
|
4958
5226
|
Enabled: pending
|
4959
5227
|
VersionAdded: '1.52'
|
4960
5228
|
|
5229
|
+
Style/RedundantArrayFlatten:
|
5230
|
+
Description: 'Checks for redundant calls of `Array#flatten`.'
|
5231
|
+
Enabled: pending
|
5232
|
+
Safe: false
|
5233
|
+
VersionAdded: '1.76'
|
5234
|
+
|
4961
5235
|
Style/RedundantAssignment:
|
4962
5236
|
Description: 'Checks for redundant assignment before returning.'
|
4963
5237
|
Enabled: true
|
@@ -4979,6 +5253,9 @@ Style/RedundantCondition:
|
|
4979
5253
|
Description: 'Checks for unnecessary conditional expressions.'
|
4980
5254
|
Enabled: true
|
4981
5255
|
VersionAdded: '0.76'
|
5256
|
+
VersionChanged: '1.73'
|
5257
|
+
AllowedMethods:
|
5258
|
+
- nonzero?
|
4982
5259
|
|
4983
5260
|
Style/RedundantConditional:
|
4984
5261
|
Description: "Don't return true/false from a conditional."
|
@@ -4991,7 +5268,7 @@ Style/RedundantConstantBase:
|
|
4991
5268
|
VersionAdded: '1.40'
|
4992
5269
|
|
4993
5270
|
Style/RedundantCurrentDirectoryInPath:
|
4994
|
-
Description: 'Checks for
|
5271
|
+
Description: 'Checks for a redundant current directory in a path given to `require_relative`.'
|
4995
5272
|
Enabled: pending
|
4996
5273
|
VersionAdded: '1.53'
|
4997
5274
|
|
@@ -5017,7 +5294,8 @@ Style/RedundantFetchBlock:
|
|
5017
5294
|
Description: >-
|
5018
5295
|
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
5019
5296
|
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
5020
|
-
|
5297
|
+
References:
|
5298
|
+
- 'https://github.com/fastruby/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
5021
5299
|
Enabled: true
|
5022
5300
|
Safe: false
|
5023
5301
|
# If enabled, this cop will autocorrect usages of
|
@@ -5043,6 +5321,13 @@ Style/RedundantFilterChain:
|
|
5043
5321
|
VersionAdded: '1.52'
|
5044
5322
|
VersionChanged: '1.57'
|
5045
5323
|
|
5324
|
+
Style/RedundantFormat:
|
5325
|
+
Description: 'Checks for usages of `Kernel#format` or `Kernel#sprintf` with only a single argument.'
|
5326
|
+
Enabled: pending
|
5327
|
+
SafeAutoCorrect: false
|
5328
|
+
VersionAdded: '1.72'
|
5329
|
+
VersionChanged: '1.72'
|
5330
|
+
|
5046
5331
|
Style/RedundantFreeze:
|
5047
5332
|
Description: "Checks usages of Object#freeze on immutable objects."
|
5048
5333
|
Enabled: true
|
@@ -5076,7 +5361,7 @@ Style/RedundantInterpolationUnfreeze:
|
|
5076
5361
|
VersionAdded: '1.66'
|
5077
5362
|
|
5078
5363
|
Style/RedundantLineContinuation:
|
5079
|
-
Description: '
|
5364
|
+
Description: 'Checks for redundant line continuation.'
|
5080
5365
|
Enabled: pending
|
5081
5366
|
VersionAdded: '1.49'
|
5082
5367
|
|
@@ -5241,11 +5526,19 @@ Style/SafeNavigation:
|
|
5241
5526
|
# Maximum length of method chains for register an offense.
|
5242
5527
|
MaxChainLength: 2
|
5243
5528
|
|
5529
|
+
Style/SafeNavigationChainLength:
|
5530
|
+
Description: 'Enforces safe navigation chains length to not exceed the configured maximum.'
|
5531
|
+
StyleGuide: '#safe-navigation'
|
5532
|
+
Enabled: pending
|
5533
|
+
VersionAdded: '1.68'
|
5534
|
+
Max: 2
|
5535
|
+
|
5244
5536
|
Style/Sample:
|
5245
5537
|
Description: >-
|
5246
5538
|
Use `sample` instead of `shuffle.first`,
|
5247
5539
|
`shuffle.last`, and `shuffle[Integer]`.
|
5248
|
-
|
5540
|
+
References:
|
5541
|
+
- 'https://github.com/fastruby/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
5249
5542
|
Enabled: true
|
5250
5543
|
VersionAdded: '0.30'
|
5251
5544
|
|
@@ -5362,7 +5655,7 @@ Style/SpecialGlobalVars:
|
|
5362
5655
|
- use_builtin_english_names
|
5363
5656
|
|
5364
5657
|
Style/StabbyLambdaParentheses:
|
5365
|
-
Description: '
|
5658
|
+
Description: 'Checks for the usage of parentheses around stabby lambda arguments.'
|
5366
5659
|
StyleGuide: '#stabby-lambda-with-args'
|
5367
5660
|
Enabled: true
|
5368
5661
|
VersionAdded: '0.35'
|
@@ -5562,14 +5855,17 @@ Style/TrailingCommaInArrayLiteral:
|
|
5562
5855
|
StyleGuide: '#no-trailing-array-commas'
|
5563
5856
|
Enabled: true
|
5564
5857
|
VersionAdded: '0.53'
|
5565
|
-
# If `comma`, the cop requires a comma after the last item in an array,
|
5566
|
-
#
|
5567
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5568
|
-
#
|
5858
|
+
# If `comma`, the cop requires a comma after the last item in an array, but only when each item is
|
5859
|
+
# on its own line.
|
5860
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5861
|
+
# array literals.
|
5862
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline array
|
5863
|
+
# literals, but only when that last item immediately precedes a newline.
|
5569
5864
|
EnforcedStyleForMultiline: no_comma
|
5570
5865
|
SupportedStylesForMultiline:
|
5571
5866
|
- comma
|
5572
5867
|
- consistent_comma
|
5868
|
+
- diff_comma
|
5573
5869
|
- no_comma
|
5574
5870
|
|
5575
5871
|
Style/TrailingCommaInBlockArgs:
|
@@ -5581,14 +5877,17 @@ Style/TrailingCommaInBlockArgs:
|
|
5581
5877
|
Style/TrailingCommaInHashLiteral:
|
5582
5878
|
Description: 'Checks for trailing comma in hash literals.'
|
5583
5879
|
Enabled: true
|
5584
|
-
# If `comma`, the cop requires a comma after the last item in a hash,
|
5585
|
-
#
|
5586
|
-
# If `consistent_comma`, the cop requires a comma after the last item of all
|
5587
|
-
#
|
5880
|
+
# If `comma`, the cop requires a comma after the last item in a hash, but only when each item is
|
5881
|
+
# on its own line.
|
5882
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all non-empty, multiline
|
5883
|
+
# hash literals.
|
5884
|
+
# If `diff_comma`, the cop requires a comma after the last item of all non-empty, multiline hash
|
5885
|
+
# literals, but only when that last item immediately precedes a newline.
|
5588
5886
|
EnforcedStyleForMultiline: no_comma
|
5589
5887
|
SupportedStylesForMultiline:
|
5590
5888
|
- comma
|
5591
5889
|
- consistent_comma
|
5890
|
+
- diff_comma
|
5592
5891
|
- no_comma
|
5593
5892
|
VersionAdded: '0.53'
|
5594
5893
|
|
@@ -5734,7 +6033,8 @@ Style/YAMLFileRead:
|
|
5734
6033
|
|
5735
6034
|
Style/YodaCondition:
|
5736
6035
|
Description: 'Forbid or enforce yoda conditions.'
|
5737
|
-
|
6036
|
+
References:
|
6037
|
+
- 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
5738
6038
|
Enabled: true
|
5739
6039
|
EnforcedStyle: forbid_for_all_comparison_operators
|
5740
6040
|
SupportedStyles:
|