rubocop 0.78.0 → 1.13.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 +69 -39
- data/assets/output.html.erb +1 -1
- data/config/default.yml +1034 -139
- data/config/obsoletion.yml +200 -0
- data/exe/rubocop +2 -4
- data/lib/rubocop.rb +139 -66
- data/lib/rubocop/ast_aliases.rb +8 -0
- data/lib/rubocop/cached_data.rb +4 -4
- data/lib/rubocop/cli.rb +19 -13
- data/lib/rubocop/cli/command.rb +1 -0
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +46 -19
- data/lib/rubocop/cli/command/base.rb +2 -0
- data/lib/rubocop/cli/command/execute_runner.rb +36 -12
- data/lib/rubocop/cli/command/init_dotfile.rb +3 -4
- data/lib/rubocop/cli/command/show_cops.rb +14 -13
- data/lib/rubocop/cli/command/suggest_extensions.rb +81 -0
- data/lib/rubocop/cli/command/version.rb +3 -2
- data/lib/rubocop/cli/environment.rb +1 -0
- data/lib/rubocop/comment_config.rb +54 -98
- data/lib/rubocop/config.rb +76 -34
- data/lib/rubocop/config_loader.rb +118 -114
- data/lib/rubocop/config_loader_resolver.rb +99 -28
- data/lib/rubocop/config_obsoletion.rb +67 -239
- data/lib/rubocop/config_obsoletion/changed_enforced_styles.rb +33 -0
- data/lib/rubocop/config_obsoletion/changed_parameter.rb +21 -0
- data/lib/rubocop/config_obsoletion/cop_rule.rb +33 -0
- data/lib/rubocop/config_obsoletion/extracted_cop.rb +44 -0
- data/lib/rubocop/config_obsoletion/parameter_rule.rb +44 -0
- data/lib/rubocop/config_obsoletion/removed_cop.rb +41 -0
- data/lib/rubocop/config_obsoletion/renamed_cop.rb +34 -0
- data/lib/rubocop/config_obsoletion/rule.rb +41 -0
- data/lib/rubocop/config_obsoletion/split_cop.rb +27 -0
- data/lib/rubocop/config_regeneration.rb +33 -0
- data/lib/rubocop/config_store.rb +31 -7
- data/lib/rubocop/config_validator.rb +89 -103
- data/lib/rubocop/cop/autocorrect_logic.rb +41 -39
- data/lib/rubocop/cop/badge.rb +16 -32
- data/lib/rubocop/cop/base.rb +450 -0
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +30 -6
- data/lib/rubocop/cop/bundler/gem_comment.rb +117 -8
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +13 -20
- data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -4
- data/lib/rubocop/cop/commissioner.rb +98 -74
- data/lib/rubocop/cop/cop.rb +84 -234
- data/lib/rubocop/cop/corrector.rb +63 -117
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +13 -23
- data/lib/rubocop/cop/correctors/condition_corrector.rb +3 -6
- data/lib/rubocop/cop/correctors/each_to_for_corrector.rb +2 -4
- data/lib/rubocop/cop/correctors/empty_line_corrector.rb +9 -10
- data/lib/rubocop/cop/correctors/for_to_each_corrector.rb +1 -2
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +4 -4
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +9 -12
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +35 -6
- data/lib/rubocop/cop/correctors/ordered_gem_corrector.rb +1 -3
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -8
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +10 -21
- data/lib/rubocop/cop/correctors/punctuation_corrector.rb +8 -10
- data/lib/rubocop/cop/correctors/space_corrector.rb +1 -3
- data/lib/rubocop/cop/correctors/string_literal_corrector.rb +6 -8
- data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +15 -18
- data/lib/rubocop/cop/documentation.rb +22 -0
- data/lib/rubocop/cop/exclude_limit.rb +26 -0
- data/lib/rubocop/cop/force.rb +2 -1
- data/lib/rubocop/cop/gemspec/date_assignment.rb +57 -0
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +6 -5
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +4 -8
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +48 -20
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +4 -2
- data/lib/rubocop/cop/generator.rb +14 -25
- data/lib/rubocop/cop/generator/configuration_injector.rb +5 -6
- data/lib/rubocop/cop/generator/require_file_injector.rb +2 -5
- data/lib/rubocop/cop/ignored_node.rb +1 -3
- data/lib/rubocop/cop/internal_affairs.rb +7 -1
- data/lib/rubocop/cop/internal_affairs/empty_line_between_expect_offense_and_correction.rb +68 -0
- data/lib/rubocop/cop/internal_affairs/example_description.rb +92 -0
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +8 -17
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +4 -4
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +151 -0
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +11 -14
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +12 -10
- data/lib/rubocop/cop/internal_affairs/redundant_described_class_as_subject.rb +62 -0
- data/lib/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new.rb +65 -0
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +12 -7
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +11 -8
- data/lib/rubocop/cop/internal_affairs/style_detected_api_use.rb +148 -0
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +6 -6
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +12 -10
- data/lib/rubocop/cop/layout/argument_alignment.rb +8 -9
- data/lib/rubocop/cop/layout/array_alignment.rb +58 -13
- data/lib/rubocop/cop/layout/assignment_indentation.rb +8 -7
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +74 -0
- data/lib/rubocop/cop/layout/block_alignment.rb +35 -43
- data/lib/rubocop/cop/layout/block_end_newline.rb +9 -11
- data/lib/rubocop/cop/layout/case_indentation.rb +22 -28
- data/lib/rubocop/cop/layout/class_structure.rb +58 -74
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +4 -6
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +18 -30
- data/lib/rubocop/cop/layout/comment_indentation.rb +21 -25
- data/lib/rubocop/cop/layout/condition_position.rb +16 -8
- data/lib/rubocop/cop/layout/def_end_alignment.rb +9 -10
- data/lib/rubocop/cop/layout/dot_position.rb +20 -21
- data/lib/rubocop/cop/layout/else_alignment.rb +28 -6
- data/lib/rubocop/cop/layout/empty_comment.rb +29 -29
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +39 -22
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +13 -13
- data/lib/rubocop/cop/layout/empty_line_after_multiline_condition.rb +136 -0
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +140 -39
- data/lib/rubocop/cop/layout/empty_lines.rb +7 -12
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +29 -38
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +13 -9
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +118 -0
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +4 -14
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +2 -5
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +2 -5
- data/lib/rubocop/cop/layout/end_alignment.rb +18 -24
- data/lib/rubocop/cop/layout/end_of_line.rb +8 -8
- data/lib/rubocop/cop/layout/extra_spacing.rb +23 -42
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +40 -13
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +24 -18
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +4 -8
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +25 -21
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +3 -7
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +6 -13
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +3 -7
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +8 -7
- data/lib/rubocop/cop/layout/hash_alignment.rb +37 -40
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +46 -30
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +33 -117
- data/lib/rubocop/cop/layout/indentation_consistency.rb +9 -6
- data/lib/rubocop/cop/layout/indentation_style.rb +110 -0
- data/lib/rubocop/cop/layout/indentation_width.rb +22 -14
- data/lib/rubocop/cop/layout/initial_indentation.rb +7 -11
- data/lib/rubocop/cop/layout/leading_comment_space.rb +46 -13
- data/lib/rubocop/cop/layout/leading_empty_lines.rb +6 -11
- data/lib/rubocop/cop/layout/line_length.rb +61 -42
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +3 -7
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +36 -14
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +51 -38
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +2 -9
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +3 -7
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +6 -13
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +30 -19
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +23 -9
- data/lib/rubocop/cop/layout/parameter_alignment.rb +6 -5
- data/lib/rubocop/cop/layout/redundant_line_break.rb +125 -0
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +37 -30
- data/lib/rubocop/cop/layout/space_after_colon.rb +10 -8
- data/lib/rubocop/cop/layout/space_after_comma.rb +2 -5
- data/lib/rubocop/cop/layout/space_after_method_name.rb +7 -10
- data/lib/rubocop/cop/layout/space_after_not.rb +9 -11
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +2 -5
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +45 -52
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +19 -23
- data/lib/rubocop/cop/layout/space_around_keyword.rb +22 -26
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +98 -0
- data/lib/rubocop/cop/layout/space_around_operators.rb +59 -25
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +41 -25
- data/lib/rubocop/cop/layout/space_before_brackets.rb +65 -0
- data/lib/rubocop/cop/layout/space_before_comma.rb +3 -5
- data/lib/rubocop/cop/layout/space_before_comment.rb +8 -9
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +17 -15
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +2 -5
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +11 -21
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +30 -39
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +5 -15
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +34 -39
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +22 -48
- data/lib/rubocop/cop/layout/space_inside_parens.rb +39 -22
- data/lib/rubocop/cop/layout/space_inside_percent_literal_delimiters.rb +5 -10
- data/lib/rubocop/cop/layout/space_inside_range_literal.rb +9 -18
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +18 -29
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +12 -13
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +10 -15
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +42 -18
- data/lib/rubocop/cop/legacy/corrections_proxy.rb +43 -0
- data/lib/rubocop/cop/legacy/corrector.rb +27 -0
- data/lib/rubocop/cop/lint/ambiguous_assignment.rb +54 -0
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +21 -9
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +53 -5
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +36 -6
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +2 -2
- data/lib/rubocop/cop/lint/big_decimal_new.rb +10 -10
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +55 -0
- data/lib/rubocop/cop/lint/boolean_symbol.rb +24 -4
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +100 -0
- data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
- data/lib/rubocop/cop/lint/debugger.rb +61 -21
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +9 -14
- data/lib/rubocop/cop/lint/deprecated_constants.rb +80 -0
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +148 -0
- data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +8 -2
- data/lib/rubocop/cop/lint/duplicate_branch.rb +154 -0
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +3 -13
- data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +39 -0
- data/lib/rubocop/cop/lint/duplicate_hash_key.rb +2 -4
- data/lib/rubocop/cop/lint/duplicate_methods.rb +12 -16
- data/lib/rubocop/cop/lint/duplicate_regexp_character_class_element.rb +77 -0
- data/lib/rubocop/cop/lint/duplicate_require.rb +47 -0
- data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +47 -0
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +3 -1
- data/lib/rubocop/cop/lint/else_layout.rb +29 -5
- data/lib/rubocop/cop/lint/empty_block.rb +82 -0
- data/lib/rubocop/cop/lint/empty_class.rb +93 -0
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +67 -0
- data/lib/rubocop/cop/lint/empty_ensure.rb +5 -7
- data/lib/rubocop/cop/lint/empty_expression.rb +2 -2
- data/lib/rubocop/cop/lint/empty_file.rb +48 -0
- data/lib/rubocop/cop/lint/empty_interpolation.rb +4 -7
- data/lib/rubocop/cop/lint/empty_when.rb +31 -8
- data/lib/rubocop/cop/lint/ensure_return.rb +29 -16
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +19 -21
- data/lib/rubocop/cop/lint/flip_flop.rb +9 -3
- data/lib/rubocop/cop/lint/float_comparison.rb +93 -0
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -3
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +45 -10
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +38 -0
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +14 -16
- data/lib/rubocop/cop/lint/identity_comparison.rb +51 -0
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +7 -7
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +14 -20
- data/lib/rubocop/cop/lint/inherit_exception.rb +14 -9
- data/lib/rubocop/cop/lint/interpolation_check.rb +20 -7
- data/lib/rubocop/cop/lint/lambda_without_literal_block.rb +44 -0
- data/lib/rubocop/cop/lint/literal_as_condition.rb +24 -15
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +44 -15
- data/lib/rubocop/cop/lint/loop.rb +31 -9
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +9 -12
- data/lib/rubocop/cop/lint/missing_super.rb +101 -0
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +36 -0
- data/lib/rubocop/cop/lint/multiple_comparison.rb +15 -15
- data/lib/rubocop/cop/lint/nested_method_definition.rb +21 -25
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +17 -5
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +2 -1
- data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +58 -0
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +95 -15
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +12 -9
- data/lib/rubocop/cop/lint/number_conversion.rb +97 -23
- data/lib/rubocop/cop/lint/numbered_parameter_assignment.rb +47 -0
- data/lib/rubocop/cop/lint/or_assignment_to_constant.rb +39 -0
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +12 -15
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +96 -0
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +31 -12
- data/lib/rubocop/cop/lint/percent_string_array.rb +6 -11
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +12 -13
- data/lib/rubocop/cop/lint/raise_exception.rb +87 -0
- data/lib/rubocop/cop/lint/rand_one.rb +5 -4
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +71 -75
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +51 -37
- data/lib/rubocop/cop/lint/redundant_dir_glob_sort.rb +50 -0
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +9 -10
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +77 -0
- data/lib/rubocop/cop/lint/redundant_splat_expansion.rb +72 -35
- data/lib/rubocop/cop/lint/redundant_string_coercion.rb +8 -15
- data/lib/rubocop/cop/lint/redundant_with_index.rb +13 -18
- data/lib/rubocop/cop/lint/redundant_with_object.rb +13 -18
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +4 -2
- data/lib/rubocop/cop/lint/require_parentheses.rb +4 -6
- data/lib/rubocop/cop/lint/rescue_exception.rb +3 -4
- data/lib/rubocop/cop/lint/rescue_type.rb +10 -16
- data/lib/rubocop/cop/lint/return_in_void_context.rb +3 -6
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +6 -9
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +15 -17
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +12 -4
- data/lib/rubocop/cop/lint/script_permission.rb +10 -7
- data/lib/rubocop/cop/lint/self_assignment.rb +78 -0
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +11 -19
- data/lib/rubocop/cop/lint/shadowed_argument.rb +8 -14
- data/lib/rubocop/cop/lint/shadowed_exception.rb +18 -30
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +21 -7
- data/lib/rubocop/cop/lint/struct_new_override.rb +59 -0
- data/lib/rubocop/cop/lint/suppressed_exception.rb +55 -18
- data/lib/rubocop/cop/lint/symbol_conversion.rb +188 -0
- data/lib/rubocop/cop/lint/syntax.rb +11 -30
- data/lib/rubocop/cop/lint/to_enum_arguments.rb +89 -0
- data/lib/rubocop/cop/lint/to_json.rb +21 -13
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +34 -0
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +55 -0
- data/lib/rubocop/cop/lint/triple_quotes.rb +71 -0
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +5 -7
- data/lib/rubocop/cop/lint/unexpected_block_arity.rb +85 -0
- data/lib/rubocop/cop/lint/unified_integer.rb +5 -8
- data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +204 -0
- data/lib/rubocop/cop/lint/unreachable_code.rb +5 -7
- data/lib/rubocop/cop/lint/unreachable_loop.rb +186 -0
- data/lib/rubocop/cop/lint/unused_block_argument.rb +12 -11
- data/lib/rubocop/cop/lint/unused_method_argument.rb +42 -11
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +5 -2
- data/lib/rubocop/cop/lint/uri_regexp.rb +12 -47
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +38 -22
- data/lib/rubocop/cop/lint/useless_assignment.rb +9 -13
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +7 -11
- data/lib/rubocop/cop/lint/useless_method_definition.rb +68 -0
- data/lib/rubocop/cop/lint/useless_setter_call.rb +15 -9
- data/lib/rubocop/cop/lint/useless_times.rb +109 -0
- data/lib/rubocop/cop/lint/void.rb +7 -18
- data/lib/rubocop/cop/message_annotator.rb +5 -4
- data/lib/rubocop/cop/metrics/abc_size.rb +26 -2
- data/lib/rubocop/cop/metrics/block_length.rb +40 -10
- data/lib/rubocop/cop/metrics/block_nesting.rb +5 -10
- data/lib/rubocop/cop/metrics/class_length.rb +40 -11
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +38 -6
- data/lib/rubocop/cop/metrics/method_length.rb +32 -4
- data/lib/rubocop/cop/metrics/module_length.rb +29 -9
- data/lib/rubocop/cop/metrics/parameter_lists.rb +74 -11
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +7 -9
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +76 -15
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +160 -0
- data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
- data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +143 -0
- data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +42 -0
- data/lib/rubocop/cop/migration/department_name.rb +51 -16
- data/lib/rubocop/cop/mixin/alignment.rb +18 -11
- data/lib/rubocop/cop/mixin/allowed_identifiers.rb +18 -0
- data/lib/rubocop/cop/mixin/allowed_methods.rb +21 -0
- data/lib/rubocop/cop/mixin/annotation_comment.rb +5 -0
- data/lib/rubocop/cop/mixin/array_min_size.rb +2 -4
- data/lib/rubocop/cop/mixin/auto_corrector.rb +12 -0
- data/lib/rubocop/cop/mixin/check_line_breakable.rb +26 -18
- data/lib/rubocop/cop/mixin/code_length.rb +29 -8
- data/lib/rubocop/cop/mixin/comments_help.rb +42 -0
- data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +7 -5
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +4 -11
- data/lib/rubocop/cop/mixin/configurable_max.rb +1 -0
- data/lib/rubocop/cop/mixin/configurable_naming.rb +2 -2
- data/lib/rubocop/cop/mixin/configurable_numbering.rb +4 -3
- data/lib/rubocop/cop/mixin/def_node.rb +3 -5
- data/lib/rubocop/cop/mixin/documentation_comment.rb +4 -7
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +14 -14
- data/lib/rubocop/cop/mixin/empty_parameter.rb +2 -1
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +16 -2
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +16 -8
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +3 -3
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +12 -9
- data/lib/rubocop/cop/mixin/hash_alignment_styles.rb +3 -6
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +183 -0
- data/lib/rubocop/cop/mixin/ignored_methods.rb +36 -3
- data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
- data/lib/rubocop/cop/mixin/interpolation.rb +1 -3
- data/lib/rubocop/cop/mixin/line_length_help.rb +17 -15
- data/lib/rubocop/cop/mixin/match_range.rb +2 -5
- data/lib/rubocop/cop/mixin/method_complexity.rb +26 -6
- data/lib/rubocop/cop/mixin/method_preference.rb +1 -2
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +4 -3
- data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +13 -42
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +14 -14
- data/lib/rubocop/cop/mixin/negative_conditional.rb +6 -4
- data/lib/rubocop/cop/mixin/nil_methods.rb +3 -5
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +7 -5
- data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
- data/lib/rubocop/cop/mixin/percent_array.rb +14 -9
- data/lib/rubocop/cop/mixin/percent_literal.rb +0 -6
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +6 -12
- data/lib/rubocop/cop/mixin/preferred_delimiters.rb +6 -9
- data/lib/rubocop/cop/mixin/range_help.rb +24 -13
- data/lib/rubocop/cop/mixin/rational_literal.rb +1 -0
- data/lib/rubocop/cop/mixin/rescue_node.rb +13 -7
- data/lib/rubocop/cop/mixin/safe_assignment.rb +6 -2
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +6 -7
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +5 -5
- data/lib/rubocop/cop/mixin/statement_modifier.rb +45 -22
- data/lib/rubocop/cop/mixin/string_help.rb +4 -1
- data/lib/rubocop/cop/mixin/string_literals_help.rb +1 -1
- data/lib/rubocop/cop/mixin/surrounding_space.rb +15 -31
- data/lib/rubocop/cop/mixin/target_ruby_version.rb +5 -1
- data/lib/rubocop/cop/mixin/trailing_body.rb +1 -2
- data/lib/rubocop/cop/mixin/trailing_comma.rb +15 -27
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +25 -32
- data/lib/rubocop/cop/mixin/unused_argument.rb +5 -9
- data/lib/rubocop/cop/mixin/visibility_help.rb +37 -0
- data/lib/rubocop/cop/naming/accessor_method_name.rb +19 -3
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +29 -8
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +17 -7
- data/lib/rubocop/cop/naming/block_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +13 -3
- data/lib/rubocop/cop/naming/constant_name.rb +5 -2
- data/lib/rubocop/cop/naming/file_name.rb +36 -34
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +12 -6
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +4 -4
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +132 -24
- data/lib/rubocop/cop/naming/method_name.rb +31 -3
- data/lib/rubocop/cop/naming/method_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/predicate_name.rb +10 -13
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +59 -15
- data/lib/rubocop/cop/naming/variable_name.rb +3 -1
- data/lib/rubocop/cop/naming/variable_number.rb +94 -9
- data/lib/rubocop/cop/offense.rb +35 -12
- data/lib/rubocop/cop/registry.rb +100 -24
- data/lib/rubocop/cop/security/eval.rb +4 -2
- data/lib/rubocop/cop/security/json_load.rb +8 -8
- data/lib/rubocop/cop/security/marshal_load.rb +4 -4
- data/lib/rubocop/cop/security/open.rb +15 -11
- data/lib/rubocop/cop/security/yaml_load.rb +8 -6
- data/lib/rubocop/cop/severity.rb +4 -14
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +37 -13
- data/lib/rubocop/cop/style/accessor_grouping.rb +150 -0
- data/lib/rubocop/cop/style/alias.rb +46 -45
- data/lib/rubocop/cop/style/and_or.rb +30 -23
- data/lib/rubocop/cop/style/arguments_forwarding.rb +143 -0
- data/lib/rubocop/cop/style/array_coercion.rb +69 -0
- data/lib/rubocop/cop/style/array_join.rb +9 -9
- data/lib/rubocop/cop/style/ascii_comments.rb +6 -7
- data/lib/rubocop/cop/style/attr.rb +15 -15
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +9 -12
- data/lib/rubocop/cop/style/bare_percent_literals.rb +12 -14
- data/lib/rubocop/cop/style/begin_block.rb +2 -2
- data/lib/rubocop/cop/style/bisected_attr_accessor.rb +125 -0
- data/lib/rubocop/cop/style/bisected_attr_accessor/macro.rb +60 -0
- data/lib/rubocop/cop/style/block_comments.rb +14 -18
- data/lib/rubocop/cop/style/block_delimiters.rb +77 -26
- data/lib/rubocop/cop/style/case_equality.rb +55 -4
- data/lib/rubocop/cop/style/case_like_if.rb +258 -0
- data/lib/rubocop/cop/style/character_literal.rb +12 -15
- data/lib/rubocop/cop/style/class_and_module_children.rb +28 -21
- data/lib/rubocop/cop/style/class_check.rb +6 -11
- data/lib/rubocop/cop/style/class_equality_comparison.rb +67 -0
- data/lib/rubocop/cop/style/class_methods.rb +8 -14
- data/lib/rubocop/cop/style/class_methods_definitions.rb +157 -0
- data/lib/rubocop/cop/style/class_vars.rb +23 -7
- data/lib/rubocop/cop/style/collection_compact.rb +91 -0
- data/lib/rubocop/cop/style/collection_methods.rb +24 -15
- data/lib/rubocop/cop/style/colon_method_call.rb +7 -9
- data/lib/rubocop/cop/style/colon_method_definition.rb +6 -6
- data/lib/rubocop/cop/style/combinable_loops.rb +92 -0
- data/lib/rubocop/cop/style/command_literal.rb +22 -28
- data/lib/rubocop/cop/style/comment_annotation.rb +24 -21
- data/lib/rubocop/cop/style/commented_keyword.rb +34 -21
- data/lib/rubocop/cop/style/conditional_assignment.rb +75 -91
- data/lib/rubocop/cop/style/constant_visibility.rb +31 -2
- data/lib/rubocop/cop/style/copyright.rb +21 -24
- data/lib/rubocop/cop/style/date_time.rb +16 -5
- data/lib/rubocop/cop/style/def_with_parentheses.rb +9 -12
- data/lib/rubocop/cop/style/dir.rb +11 -12
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +87 -0
- data/lib/rubocop/cop/style/document_dynamic_eval_definition.rb +169 -0
- data/lib/rubocop/cop/style/documentation.rb +92 -18
- data/lib/rubocop/cop/style/documentation_method.rb +2 -1
- data/lib/rubocop/cop/style/double_cop_disable_directive.rb +12 -15
- data/lib/rubocop/cop/style/double_negation.rb +50 -6
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +7 -10
- data/lib/rubocop/cop/style/each_with_object.rb +17 -19
- data/lib/rubocop/cop/style/empty_block_parameter.rb +9 -10
- data/lib/rubocop/cop/style/empty_case_condition.rb +22 -26
- data/lib/rubocop/cop/style/empty_else.rb +14 -22
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +9 -10
- data/lib/rubocop/cop/style/empty_literal.rb +39 -31
- data/lib/rubocop/cop/style/empty_method.rb +12 -23
- data/lib/rubocop/cop/style/encoding.rb +6 -10
- data/lib/rubocop/cop/style/end_block.rb +7 -4
- data/lib/rubocop/cop/style/endless_method.rb +101 -0
- data/lib/rubocop/cop/style/eval_with_location.rb +143 -54
- data/lib/rubocop/cop/style/even_odd.rb +9 -11
- data/lib/rubocop/cop/style/expand_path_arguments.rb +27 -25
- data/lib/rubocop/cop/style/explicit_block_argument.rb +114 -0
- data/lib/rubocop/cop/style/exponential_notation.rb +116 -0
- data/lib/rubocop/cop/style/float_division.rb +60 -11
- data/lib/rubocop/cop/style/for.rb +7 -13
- data/lib/rubocop/cop/style/format_string.rb +30 -24
- data/lib/rubocop/cop/style/format_string_token.rb +78 -22
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +83 -38
- data/lib/rubocop/cop/style/global_std_stream.rb +66 -0
- data/lib/rubocop/cop/style/global_vars.rb +2 -2
- data/lib/rubocop/cop/style/guard_clause.rb +32 -13
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +88 -0
- data/lib/rubocop/cop/style/hash_conversion.rb +133 -0
- data/lib/rubocop/cop/style/hash_each_methods.rb +86 -0
- data/lib/rubocop/cop/style/hash_except.rb +96 -0
- data/lib/rubocop/cop/style/hash_like_case.rb +77 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +50 -45
- data/lib/rubocop/cop/style/hash_transform_keys.rb +95 -0
- data/lib/rubocop/cop/style/hash_transform_values.rb +92 -0
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +10 -7
- data/lib/rubocop/cop/style/if_inside_else.rb +50 -2
- data/lib/rubocop/cop/style/if_unless_modifier.rb +76 -46
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +11 -3
- data/lib/rubocop/cop/style/if_with_boolean_literal_branches.rb +122 -0
- data/lib/rubocop/cop/style/if_with_semicolon.rb +51 -3
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +3 -1
- data/lib/rubocop/cop/style/infinite_loop.rb +27 -26
- data/lib/rubocop/cop/style/inline_comment.rb +4 -4
- data/lib/rubocop/cop/style/inverse_methods.rb +34 -42
- data/lib/rubocop/cop/style/ip_addresses.rb +3 -4
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +75 -0
- data/lib/rubocop/cop/style/lambda.rb +11 -17
- data/lib/rubocop/cop/style/lambda_call.rb +18 -35
- data/lib/rubocop/cop/style/line_end_concatenation.rb +21 -25
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +58 -207
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +189 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +44 -0
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +19 -12
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +14 -7
- data/lib/rubocop/cop/style/method_def_parentheses.rb +18 -24
- data/lib/rubocop/cop/style/min_max.rb +10 -14
- data/lib/rubocop/cop/style/missing_else.rb +13 -25
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +11 -5
- data/lib/rubocop/cop/style/mixin_grouping.rb +27 -40
- data/lib/rubocop/cop/style/mixin_usage.rb +12 -30
- data/lib/rubocop/cop/style/module_function.rb +70 -25
- data/lib/rubocop/cop/style/multiline_block_chain.rb +13 -5
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +4 -11
- data/lib/rubocop/cop/style/multiline_if_then.rb +5 -11
- data/lib/rubocop/cop/style/multiline_memoization.rb +15 -13
- data/lib/rubocop/cop/style/multiline_method_signature.rb +33 -3
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +32 -11
- data/lib/rubocop/cop/style/multiline_when_then.rb +31 -11
- data/lib/rubocop/cop/style/multiple_comparison.rb +76 -11
- data/lib/rubocop/cop/style/mutable_constant.rb +41 -33
- data/lib/rubocop/cop/style/negated_if.rb +10 -11
- data/lib/rubocop/cop/style/negated_if_else_condition.rb +120 -0
- data/lib/rubocop/cop/style/negated_unless.rb +10 -11
- data/lib/rubocop/cop/style/negated_while.rb +7 -15
- data/lib/rubocop/cop/style/nested_modifier.rb +10 -17
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +23 -20
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +30 -4
- data/lib/rubocop/cop/style/next.rb +18 -27
- data/lib/rubocop/cop/style/nil_comparison.rb +19 -11
- data/lib/rubocop/cop/style/nil_lambda.rb +53 -0
- data/lib/rubocop/cop/style/non_nil_check.rb +56 -34
- data/lib/rubocop/cop/style/not.rb +20 -26
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +6 -11
- data/lib/rubocop/cop/style/numeric_literals.rb +19 -27
- data/lib/rubocop/cop/style/numeric_predicate.rb +17 -24
- data/lib/rubocop/cop/style/one_line_conditional.rb +75 -29
- data/lib/rubocop/cop/style/option_hash.rb +3 -4
- data/lib/rubocop/cop/style/optional_arguments.rb +4 -7
- data/lib/rubocop/cop/style/optional_boolean_parameter.rb +53 -0
- data/lib/rubocop/cop/style/or_assignment.rb +14 -12
- data/lib/rubocop/cop/style/parallel_assignment.rb +27 -24
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +7 -6
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +22 -30
- data/lib/rubocop/cop/style/percent_q_literals.rb +9 -12
- data/lib/rubocop/cop/style/perl_backrefs.rb +84 -16
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +12 -18
- data/lib/rubocop/cop/style/proc.rb +8 -8
- data/lib/rubocop/cop/style/raise_args.rb +39 -37
- data/lib/rubocop/cop/style/random_with_offset.rb +30 -35
- data/lib/rubocop/cop/style/redundant_argument.rb +85 -0
- data/lib/rubocop/cop/style/redundant_assignment.rb +106 -0
- data/lib/rubocop/cop/style/redundant_begin.rb +79 -13
- data/lib/rubocop/cop/style/redundant_capital_w.rb +7 -11
- data/lib/rubocop/cop/style/redundant_condition.rb +43 -18
- data/lib/rubocop/cop/style/redundant_conditional.rb +14 -15
- data/lib/rubocop/cop/style/redundant_exception.rb +22 -17
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +115 -0
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +52 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +16 -14
- data/lib/rubocop/cop/style/redundant_interpolation.rb +32 -27
- data/lib/rubocop/cop/style/redundant_parentheses.rb +51 -38
- data/lib/rubocop/cop/style/redundant_percent_q.rb +14 -17
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +104 -0
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +118 -0
- data/lib/rubocop/cop/style/redundant_return.rb +29 -29
- data/lib/rubocop/cop/style/redundant_self.rb +27 -29
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +118 -0
- data/lib/rubocop/cop/style/redundant_sort.rb +32 -37
- data/lib/rubocop/cop/style/redundant_sort_by.rb +6 -9
- data/lib/rubocop/cop/style/regexp_literal.rb +14 -29
- data/lib/rubocop/cop/style/rescue_modifier.rb +39 -12
- data/lib/rubocop/cop/style/rescue_standard_error.rb +25 -23
- data/lib/rubocop/cop/style/return_nil.rb +13 -8
- data/lib/rubocop/cop/style/safe_navigation.rb +44 -39
- data/lib/rubocop/cop/style/sample.rb +14 -15
- data/lib/rubocop/cop/style/self_assignment.rb +26 -22
- data/lib/rubocop/cop/style/semicolon.rb +10 -10
- data/lib/rubocop/cop/style/send.rb +5 -7
- data/lib/rubocop/cop/style/signal_exception.rb +32 -27
- data/lib/rubocop/cop/style/single_argument_dig.rb +55 -0
- data/lib/rubocop/cop/style/single_line_block_params.rb +34 -12
- data/lib/rubocop/cop/style/single_line_methods.rb +65 -18
- data/lib/rubocop/cop/style/slicing_with_range.rb +38 -0
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +167 -0
- data/lib/rubocop/cop/style/special_global_vars.rb +18 -51
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +18 -25
- data/lib/rubocop/cop/style/static_class.rb +97 -0
- data/lib/rubocop/cop/style/stderr_puts.rb +9 -13
- data/lib/rubocop/cop/style/string_chars.rb +39 -0
- data/lib/rubocop/cop/style/string_concatenation.rb +142 -0
- data/lib/rubocop/cop/style/string_hash_keys.rb +8 -7
- data/lib/rubocop/cop/style/string_literals.rb +16 -13
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +4 -3
- data/lib/rubocop/cop/style/string_methods.rb +7 -17
- data/lib/rubocop/cop/style/strip.rb +10 -14
- data/lib/rubocop/cop/style/struct_inheritance.rb +33 -4
- data/lib/rubocop/cop/style/swap_values.rb +108 -0
- data/lib/rubocop/cop/style/symbol_array.rb +13 -24
- data/lib/rubocop/cop/style/symbol_literal.rb +5 -9
- data/lib/rubocop/cop/style/symbol_proc.rb +50 -32
- data/lib/rubocop/cop/style/ternary_parentheses.rb +30 -35
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +3 -6
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +10 -9
- data/lib/rubocop/cop/style/trailing_body_on_module.rb +3 -6
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +37 -27
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +43 -5
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +86 -0
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +46 -5
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +12 -38
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +16 -31
- data/lib/rubocop/cop/style/trivial_accessors.rb +36 -40
- data/lib/rubocop/cop/style/unless_else.rb +7 -11
- data/lib/rubocop/cop/style/unless_logical_operators.rb +105 -0
- data/lib/rubocop/cop/style/unpack_first.rb +5 -11
- data/lib/rubocop/cop/style/variable_interpolation.rb +8 -11
- data/lib/rubocop/cop/style/when_then.rb +5 -9
- data/lib/rubocop/cop/style/while_until_do.rb +6 -16
- data/lib/rubocop/cop/style/while_until_modifier.rb +16 -24
- data/lib/rubocop/cop/style/word_array.rb +6 -25
- data/lib/rubocop/cop/style/yoda_condition.rb +33 -19
- data/lib/rubocop/cop/style/zero_length_predicate.rb +25 -23
- data/lib/rubocop/cop/team.rb +147 -84
- data/lib/rubocop/cop/util.rb +43 -27
- data/lib/rubocop/cop/utils/format_string.rb +22 -9
- data/lib/rubocop/cop/variable_force.rb +15 -27
- data/lib/rubocop/cop/variable_force/assignment.rb +2 -2
- data/lib/rubocop/cop/variable_force/branch.rb +3 -9
- data/lib/rubocop/cop/variable_force/reference.rb +1 -3
- data/lib/rubocop/cop/variable_force/scope.rb +6 -9
- data/lib/rubocop/cop/variable_force/variable.rb +9 -12
- data/lib/rubocop/cops_documentation_generator.rb +270 -0
- data/lib/rubocop/core_ext/string.rb +2 -2
- data/lib/rubocop/directive_comment.rb +92 -0
- data/lib/rubocop/error.rb +1 -0
- data/lib/rubocop/ext/processed_source.rb +18 -0
- data/lib/rubocop/ext/regexp_node.rb +87 -0
- data/lib/rubocop/ext/regexp_parser.rb +92 -0
- data/lib/rubocop/file_finder.rb +12 -13
- data/lib/rubocop/formatter/auto_gen_config_formatter.rb +2 -1
- data/lib/rubocop/formatter/base_formatter.rb +0 -4
- data/lib/rubocop/formatter/clang_style_formatter.rb +5 -3
- data/lib/rubocop/formatter/disabled_config_formatter.rb +39 -30
- data/lib/rubocop/formatter/emacs_style_formatter.rb +2 -0
- data/lib/rubocop/formatter/formatter_set.rb +6 -6
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +44 -0
- data/lib/rubocop/formatter/html_formatter.rb +6 -10
- data/lib/rubocop/formatter/json_formatter.rb +1 -5
- data/lib/rubocop/formatter/junit_formatter.rb +78 -0
- data/lib/rubocop/formatter/offense_count_formatter.rb +2 -2
- data/lib/rubocop/formatter/pacman_formatter.rb +1 -1
- data/lib/rubocop/formatter/progress_formatter.rb +3 -4
- data/lib/rubocop/formatter/quiet_formatter.rb +1 -1
- data/lib/rubocop/formatter/simple_text_formatter.rb +40 -7
- data/lib/rubocop/formatter/tap_formatter.rb +7 -3
- data/lib/rubocop/formatter/worst_offenders_formatter.rb +2 -2
- data/lib/rubocop/lockfile.rb +40 -0
- data/lib/rubocop/magic_comment.rb +33 -4
- data/lib/rubocop/name_similarity.rb +18 -10
- data/lib/rubocop/options.rb +124 -77
- data/lib/rubocop/path_util.rb +20 -22
- data/lib/rubocop/platform.rb +1 -1
- data/lib/rubocop/rake_task.rb +12 -11
- data/lib/rubocop/remote_config.rb +6 -10
- data/lib/rubocop/result_cache.rb +50 -31
- data/lib/rubocop/rspec/cop_helper.rb +11 -35
- data/lib/rubocop/rspec/expect_offense.rb +129 -40
- data/lib/rubocop/rspec/shared_contexts.rb +78 -35
- data/lib/rubocop/runner.rb +112 -75
- data/lib/rubocop/string_interpreter.rb +3 -0
- data/lib/rubocop/target_finder.rb +53 -50
- data/lib/rubocop/target_ruby.rb +264 -0
- data/lib/rubocop/util.rb +16 -0
- data/lib/rubocop/version.rb +71 -7
- data/lib/rubocop/yaml_duplication_checker.rb +1 -0
- metadata +208 -94
- data/bin/console +0 -10
- data/bin/setup +0 -7
- data/lib/rubocop/ast/builder.rb +0 -82
- data/lib/rubocop/ast/node.rb +0 -644
- data/lib/rubocop/ast/node/alias_node.rb +0 -24
- data/lib/rubocop/ast/node/and_node.rb +0 -29
- data/lib/rubocop/ast/node/args_node.rb +0 -29
- data/lib/rubocop/ast/node/array_node.rb +0 -57
- data/lib/rubocop/ast/node/block_node.rb +0 -117
- data/lib/rubocop/ast/node/break_node.rb +0 -17
- data/lib/rubocop/ast/node/case_node.rb +0 -56
- data/lib/rubocop/ast/node/class_node.rb +0 -31
- data/lib/rubocop/ast/node/def_node.rb +0 -71
- data/lib/rubocop/ast/node/defined_node.rb +0 -17
- data/lib/rubocop/ast/node/ensure_node.rb +0 -17
- data/lib/rubocop/ast/node/float_node.rb +0 -12
- data/lib/rubocop/ast/node/for_node.rb +0 -53
- data/lib/rubocop/ast/node/hash_node.rb +0 -109
- data/lib/rubocop/ast/node/if_node.rb +0 -175
- data/lib/rubocop/ast/node/int_node.rb +0 -12
- data/lib/rubocop/ast/node/keyword_splat_node.rb +0 -45
- data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +0 -16
- data/lib/rubocop/ast/node/mixin/binary_operator_node.rb +0 -43
- data/lib/rubocop/ast/node/mixin/collection_node.rb +0 -15
- data/lib/rubocop/ast/node/mixin/conditional_node.rb +0 -45
- data/lib/rubocop/ast/node/mixin/hash_element_node.rb +0 -125
- data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +0 -261
- data/lib/rubocop/ast/node/mixin/method_identifier_predicates.rb +0 -114
- data/lib/rubocop/ast/node/mixin/modifier_node.rb +0 -17
- data/lib/rubocop/ast/node/mixin/numeric_node.rb +0 -21
- data/lib/rubocop/ast/node/mixin/parameterized_node.rb +0 -61
- data/lib/rubocop/ast/node/mixin/predicate_operator_node.rb +0 -35
- data/lib/rubocop/ast/node/module_node.rb +0 -24
- data/lib/rubocop/ast/node/or_node.rb +0 -29
- data/lib/rubocop/ast/node/pair_node.rb +0 -63
- data/lib/rubocop/ast/node/range_node.rb +0 -18
- data/lib/rubocop/ast/node/regexp_node.rb +0 -35
- data/lib/rubocop/ast/node/resbody_node.rb +0 -24
- data/lib/rubocop/ast/node/retry_node.rb +0 -17
- data/lib/rubocop/ast/node/return_node.rb +0 -24
- data/lib/rubocop/ast/node/self_class_node.rb +0 -24
- data/lib/rubocop/ast/node/send_node.rb +0 -13
- data/lib/rubocop/ast/node/str_node.rb +0 -16
- data/lib/rubocop/ast/node/super_node.rb +0 -21
- data/lib/rubocop/ast/node/symbol_node.rb +0 -12
- data/lib/rubocop/ast/node/until_node.rb +0 -35
- data/lib/rubocop/ast/node/when_node.rb +0 -53
- data/lib/rubocop/ast/node/while_node.rb +0 -35
- data/lib/rubocop/ast/node/yield_node.rb +0 -21
- data/lib/rubocop/ast/sexp.rb +0 -16
- data/lib/rubocop/ast/traversal.rb +0 -183
- data/lib/rubocop/cop/layout/tab.rb +0 -75
- data/lib/rubocop/cop/lint/end_in_method.rb +0 -40
- data/lib/rubocop/cop/lint/useless_comparison.rb +0 -28
- data/lib/rubocop/cop/mixin/classish_length.rb +0 -37
- data/lib/rubocop/cop/mixin/parser_diagnostic.rb +0 -37
- data/lib/rubocop/cop/mixin/too_many_lines.rb +0 -35
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +0 -209
- data/lib/rubocop/cop/style/method_missing_super.rb +0 -34
- data/lib/rubocop/formatter/disabled_lines_formatter.rb +0 -57
- data/lib/rubocop/node_pattern.rb +0 -801
- data/lib/rubocop/processed_source.rb +0 -216
- data/lib/rubocop/string_util.rb +0 -14
- data/lib/rubocop/token.rb +0 -114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 580e325f7dc471739e2f4857d82e279776098ae14fff7367eaa803f688c9e58d
|
4
|
+
data.tar.gz: c8331c8b2ebbecb239d4a63dee21375172d1d2939572516bba910109ef5375a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f9ecd1e28e7fa7946b22aaecc0d5571337d85ca6b9a198e9542a9d26d05c9d0806597ccd66d0090c4318d349c7023fe201103fa197eaa88d5e98534d25ff755
|
7
|
+
data.tar.gz: 4bc7ec5d20c127826a1761b9495669242d53b740509ca13060c1202d0114062fb73a52738b9fb717f5348fdad7cb2a2fb5ee0ea4cc8a9b5823298908a0ce6a5b
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,35 +1,33 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
|
2
|
-
[![CircleCI Status](https://circleci.com/gh/rubocop-hq/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop/tree/master)
|
3
|
-
[![AppVeyor Status](https://ci.appveyor.com/api/projects/status/sj3ye7n5690d0nvg?svg=true)](https://ci.appveyor.com/project/bbatsov/rubocop)
|
4
|
-
[![Coverage Status](https://api.codeclimate.com/v1/badges/ad6e76460499c8c99697/test_coverage)](https://codeclimate.com/github/bbatsov/rubocop)
|
5
|
-
[![Code Climate](https://codeclimate.com/github/bbatsov/rubocop/badges/gpa.svg)](https://codeclimate.com/github/bbatsov/rubocop)
|
6
|
-
[![Inline docs](https://inch-ci.org/github/bbatsov/rubocop.svg)](https://inch-ci.org/github/bbatsov/rubocop)
|
7
|
-
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
|
8
|
-
|
9
|
-
[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
|
10
|
-
[![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
|
11
|
-
[![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
|
12
|
-
[![Tidelift](https://tidelift.com/badges/package/rubygems/rubocop)](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
13
|
-
|
14
1
|
<p align="center">
|
15
|
-
<img src="https://raw.githubusercontent.com/rubocop
|
2
|
+
<img src="https://raw.githubusercontent.com/rubocop/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
|
16
3
|
</p>
|
17
4
|
|
5
|
+
----------
|
6
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
|
8
|
+
[![CircleCI Status](https://circleci.com/gh/rubocop/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop/tree/master)
|
9
|
+
[![Actions Status](https://github.com/rubocop/rubocop/workflows/CI/badge.svg?branch=master)](https://github.com/rubocop/rubocop/actions?query=workflow%3ACI)
|
10
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/test_coverage)](https://codeclimate.com/github/rubocop/rubocop/test_coverage)
|
11
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop/rubocop/maintainability)
|
12
|
+
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=rubocop&package-manager=bundler&version-scheme=semver)
|
13
|
+
[![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg?sanitize=true)](https://discord.gg/wJjWvGRDmm)
|
14
|
+
|
18
15
|
> Role models are important. <br/>
|
19
16
|
> -- Officer Alex J. Murphy / RoboCop
|
20
17
|
|
21
|
-
**RuboCop** is a Ruby static code analyzer and code formatter. Out of
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
**RuboCop** is a Ruby static code analyzer (a.k.a. `linter`) and code formatter. Out of the box it
|
19
|
+
will enforce many of the guidelines outlined in the community [Ruby Style
|
20
|
+
Guide](https://rubystyle.guide). Apart from reporting the problems discovered in your code,
|
21
|
+
RuboCop can also automatically fix many of them for you.
|
25
22
|
|
26
23
|
RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
|
27
|
-
[configuration options](https://github.com/rubocop
|
28
|
-
|
29
|
-
Apart from reporting problems in your code, RuboCop can also
|
30
|
-
automatically fix some of the problems for you.
|
24
|
+
[configuration options](https://github.com/rubocop/rubocop/blob/master/config/default.yml).
|
31
25
|
|
32
|
-
|
26
|
+
----------
|
27
|
+
[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
|
28
|
+
[![OpenCollective](https://opencollective.com/rubocop/backers/badge.svg)](#open-collective-backers)
|
29
|
+
[![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
|
30
|
+
[![Tidelift](https://tidelift.com/badges/package/rubygems/rubocop)](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
33
31
|
|
34
32
|
**Please consider [financially supporting its ongoing development](#funding).**
|
35
33
|
|
@@ -41,21 +39,24 @@ automatically fix some of the problems for you.
|
|
41
39
|
$ gem install rubocop
|
42
40
|
```
|
43
41
|
|
44
|
-
If you'd rather install RuboCop using `bundler`,
|
42
|
+
If you'd rather install RuboCop using `bundler`, add a line for it in your `Gemfile` (but set the `require` option to `false`, as it is a standalone tool):
|
45
43
|
|
46
44
|
```rb
|
47
45
|
gem 'rubocop', require: false
|
48
46
|
```
|
49
47
|
|
50
|
-
RuboCop
|
51
|
-
|
52
|
-
|
53
|
-
might want to use a conservative version lock
|
48
|
+
RuboCop is stable between major versions, both in terms of API and cop configuration.
|
49
|
+
We aim to ease the maintenance of RuboCop extensions and the upgrades between RuboCop
|
50
|
+
releases. All big changes are reserved for major releases.
|
51
|
+
To prevent an unwanted RuboCop update you might want to use a conservative version lock
|
52
|
+
in your `Gemfile`:
|
54
53
|
|
55
54
|
```rb
|
56
|
-
gem 'rubocop', '~>
|
55
|
+
gem 'rubocop', '~> 1.13', require: false
|
57
56
|
```
|
58
57
|
|
58
|
+
See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
|
59
|
+
|
59
60
|
## Quickstart
|
60
61
|
|
61
62
|
Just type `rubocop` in a Ruby project's folder and watch the magic happen.
|
@@ -71,11 +72,30 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
|
|
71
72
|
|
72
73
|
## Compatibility
|
73
74
|
|
74
|
-
RuboCop supports the following Ruby implementations:
|
75
|
+
RuboCop officially supports the following Ruby implementations:
|
75
76
|
|
76
|
-
* MRI 2.
|
77
|
+
* MRI 2.5+
|
77
78
|
* JRuby 9.2+
|
78
79
|
|
80
|
+
See the [compatibility documentation](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
|
81
|
+
|
82
|
+
## Readme Badge
|
83
|
+
|
84
|
+
If you use RuboCop in your project, you can include one of these badges in your readme to let people know that your code is written following the community Ruby Style Guide.
|
85
|
+
|
86
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
|
87
|
+
|
88
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
|
89
|
+
|
90
|
+
|
91
|
+
Here are the Markdown snippets for the two badges:
|
92
|
+
|
93
|
+
``` markdown
|
94
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
|
95
|
+
|
96
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
|
97
|
+
```
|
98
|
+
|
79
99
|
## Team
|
80
100
|
|
81
101
|
Here's a list of RuboCop's core developers:
|
@@ -88,18 +108,23 @@ Here's a list of RuboCop's core developers:
|
|
88
108
|
* [Masataka Kuwabara](https://github.com/pocke)
|
89
109
|
* [Koichi Ito](https://github.com/koic)
|
90
110
|
* [Maxim Krizhanovski](https://github.com/darhazer)
|
111
|
+
* [Benjamin Quorning](https://github.com/bquorning)
|
112
|
+
* [Marc-André Lafortune](https://github.com/marcandre)
|
113
|
+
* [Daniel Vandersluis](https://github.com/dvandersluis)
|
114
|
+
|
115
|
+
See the [team page](https://docs.rubocop.org/rubocop/about/team.html) for more details.
|
91
116
|
|
92
117
|
## Logo
|
93
118
|
|
94
119
|
RuboCop's logo was created by [Dimiter Petrov](https://www.chadomoto.com/). You can find the logo in various
|
95
|
-
formats [here](https://github.com/rubocop
|
120
|
+
formats [here](https://github.com/rubocop/rubocop/tree/master/logo).
|
96
121
|
|
97
122
|
The logo is licensed under a
|
98
123
|
[Creative Commons Attribution-NonCommercial 4.0 International License](https://creativecommons.org/licenses/by-nc/4.0/deed.en_GB).
|
99
124
|
|
100
125
|
## Contributors
|
101
126
|
|
102
|
-
Here's a [list](https://github.com/rubocop
|
127
|
+
Here's a [list](https://github.com/rubocop/rubocop/graphs/contributors) of
|
103
128
|
all the people who have contributed to the development of RuboCop.
|
104
129
|
|
105
130
|
I'm extremely grateful to each and every one of them!
|
@@ -128,14 +153,19 @@ wide array of funding channels to account for your preferences
|
|
128
153
|
currently [Open Collective](https://opencollective.com/rubocop) is our
|
129
154
|
preferred funding platform).
|
130
155
|
|
131
|
-
If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
|
132
|
-
to become a RuboCop sponsor
|
156
|
+
**If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company
|
157
|
+
to become a RuboCop sponsor.**
|
133
158
|
|
134
159
|
You can support the development of RuboCop via
|
135
|
-
[
|
160
|
+
[GitHub Sponsors](https://github.com/sponsors/bbatsov),
|
136
161
|
[Patreon](https://www.patreon.com/bbatsov),
|
137
|
-
[PayPal](https://paypal.me/bbatsov)
|
138
|
-
|
162
|
+
[PayPal](https://paypal.me/bbatsov),
|
163
|
+
[Open Collective](https://opencollective.com/rubocop)
|
164
|
+
and [Tidelift](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
165
|
+
.
|
166
|
+
|
167
|
+
**Note:** If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we'd recommend
|
168
|
+
the use of Tidelift, where you can get a support-like subscription instead.
|
139
169
|
|
140
170
|
### Open Collective Backers
|
141
171
|
|
@@ -213,5 +243,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
|
|
213
243
|
|
214
244
|
## Copyright
|
215
245
|
|
216
|
-
Copyright (c) 2012-
|
246
|
+
Copyright (c) 2012-2021 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
|
217
247
|
further details.
|
data/assets/output.html.erb
CHANGED
@@ -254,7 +254,7 @@
|
|
254
254
|
<% end %>
|
255
255
|
</div>
|
256
256
|
<footer>
|
257
|
-
Generated by <a href="https://github.com/rubocop
|
257
|
+
Generated by <a href="https://github.com/rubocop/rubocop">RuboCop</a>
|
258
258
|
<span class="version"><%= RuboCop::Version::STRING %></span>
|
259
259
|
</footer>
|
260
260
|
</body>
|
data/config/default.yml
CHANGED
@@ -35,6 +35,7 @@ AllCops:
|
|
35
35
|
- '**/*.watchr'
|
36
36
|
- '**/.irbrc'
|
37
37
|
- '**/.pryrc'
|
38
|
+
- '**/.simplecov'
|
38
39
|
- '**/buildfile'
|
39
40
|
- '**/Appraisals'
|
40
41
|
- '**/Berksfile'
|
@@ -53,7 +54,9 @@ AllCops:
|
|
53
54
|
- '**/Podfile'
|
54
55
|
- '**/Puppetfile'
|
55
56
|
- '**/Rakefile'
|
57
|
+
- '**/rakefile'
|
56
58
|
- '**/Snapfile'
|
59
|
+
- '**/Steepfile'
|
57
60
|
- '**/Thorfile'
|
58
61
|
- '**/Vagabondfile'
|
59
62
|
- '**/Vagrantfile'
|
@@ -96,6 +99,14 @@ AllCops:
|
|
96
99
|
# to true in the same configuration.
|
97
100
|
EnabledByDefault: false
|
98
101
|
DisabledByDefault: false
|
102
|
+
# New cops introduced between major versions are set to a special pending status
|
103
|
+
# and are not enabled by default with warning message.
|
104
|
+
# Change this behavior by overriding either `NewCops: enable` or `NewCops: disable`.
|
105
|
+
# When `NewCops` is `enable`, pending cops are enabled in bulk. Can be overridden by
|
106
|
+
# the `--enable-pending-cops` command-line option.
|
107
|
+
# When `NewCops` is `disable`, pending cops are disabled in bulk. Can be overridden by
|
108
|
+
# the `--disable-pending-cops` command-line option.
|
109
|
+
NewCops: pending
|
99
110
|
# Enables the result cache if `true`. Can be overridden by the `--cache` command
|
100
111
|
# line option.
|
101
112
|
UseCache: true
|
@@ -106,6 +117,8 @@ AllCops:
|
|
106
117
|
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
107
118
|
# taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
|
108
119
|
# `$XDG_CACHE_HOME` is not set, it will be `$HOME/.cache/`.
|
120
|
+
# The CacheRootDirectory can be overwritten by passing the `--cache-root` command
|
121
|
+
# line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.
|
109
122
|
CacheRootDirectory: ~
|
110
123
|
# It is possible for a malicious user to know the location of RuboCop's cache
|
111
124
|
# directory by looking at CacheRootDirectory, and create a symlink in its
|
@@ -119,13 +132,24 @@ AllCops:
|
|
119
132
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
120
133
|
# values are specificed as a float (i.e. 2.5); the teeny version of Ruby
|
121
134
|
# should not be included. If the project specifies a Ruby version in the
|
122
|
-
# .ruby-version
|
123
|
-
# the desired version of Ruby by inspecting the
|
124
|
-
#
|
125
|
-
#
|
126
|
-
# from the lock file.) If the
|
127
|
-
#
|
135
|
+
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
136
|
+
# try to determine the desired version of Ruby by inspecting the
|
137
|
+
# .tool-versions file first, then .ruby-version, followed by the Gemfile.lock
|
138
|
+
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
139
|
+
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
140
|
+
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
141
|
+
# supported Ruby version (currently Ruby 2.4).
|
128
142
|
TargetRubyVersion: ~
|
143
|
+
# Determines if a notification for extension libraries should be shown when
|
144
|
+
# rubocop is run. Keys are the name of the extension, and values are an array
|
145
|
+
# of gems in the Gemfile that the extension is suggested for, if not already
|
146
|
+
# included.
|
147
|
+
SuggestExtensions:
|
148
|
+
rubocop-rails: [rails]
|
149
|
+
rubocop-rspec: [rspec, rspec-rails]
|
150
|
+
rubocop-minitest: [minitest]
|
151
|
+
rubocop-sequel: [sequel]
|
152
|
+
rubocop-rake: [rake]
|
129
153
|
|
130
154
|
#################### Bundler ###############################
|
131
155
|
|
@@ -142,12 +166,13 @@ Bundler/GemComment:
|
|
142
166
|
Description: 'Add a comment describing each gem.'
|
143
167
|
Enabled: false
|
144
168
|
VersionAdded: '0.59'
|
145
|
-
VersionChanged: '0.
|
169
|
+
VersionChanged: '0.85'
|
146
170
|
Include:
|
147
171
|
- '**/*.gemfile'
|
148
172
|
- '**/Gemfile'
|
149
173
|
- '**/gems.rb'
|
150
174
|
IgnoredGems: []
|
175
|
+
OnlyFor: []
|
151
176
|
|
152
177
|
Bundler/InsecureProtocolSource:
|
153
178
|
Description: >-
|
@@ -168,6 +193,9 @@ Bundler/OrderedGems:
|
|
168
193
|
VersionAdded: '0.46'
|
169
194
|
VersionChanged: '0.47'
|
170
195
|
TreatCommentsAsGroupSeparators: true
|
196
|
+
# By default, "-" and "_" are ignored for order purposes.
|
197
|
+
# This can be overridden by setting this parameter to true.
|
198
|
+
ConsiderPunctuation: false
|
171
199
|
Include:
|
172
200
|
- '**/*.gemfile'
|
173
201
|
- '**/Gemfile'
|
@@ -175,6 +203,13 @@ Bundler/OrderedGems:
|
|
175
203
|
|
176
204
|
#################### Gemspec ###############################
|
177
205
|
|
206
|
+
Gemspec/DateAssignment:
|
207
|
+
Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
|
208
|
+
Enabled: pending
|
209
|
+
VersionAdded: '1.10'
|
210
|
+
Include:
|
211
|
+
- '**/*.gemspec'
|
212
|
+
|
178
213
|
Gemspec/DuplicatedAssignment:
|
179
214
|
Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
|
180
215
|
Enabled: true
|
@@ -188,13 +223,17 @@ Gemspec/OrderedDependencies:
|
|
188
223
|
Enabled: true
|
189
224
|
VersionAdded: '0.51'
|
190
225
|
TreatCommentsAsGroupSeparators: true
|
226
|
+
# By default, "-" and "_" are ignored for order purposes.
|
227
|
+
# This can be overridden by setting this parameter to true.
|
228
|
+
ConsiderPunctuation: false
|
191
229
|
Include:
|
192
230
|
- '**/*.gemspec'
|
193
231
|
|
194
232
|
Gemspec/RequiredRubyVersion:
|
195
|
-
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml
|
233
|
+
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
196
234
|
Enabled: true
|
197
235
|
VersionAdded: '0.52'
|
236
|
+
VersionChanged: '0.89'
|
198
237
|
Include:
|
199
238
|
- '**/*.gemspec'
|
200
239
|
|
@@ -254,10 +293,30 @@ Layout/ArrayAlignment:
|
|
254
293
|
Description: >-
|
255
294
|
Align the elements of an array literal if they span more than
|
256
295
|
one line.
|
257
|
-
StyleGuide: '#
|
296
|
+
StyleGuide: '#no-double-indent'
|
258
297
|
Enabled: true
|
259
298
|
VersionAdded: '0.49'
|
260
299
|
VersionChanged: '0.77'
|
300
|
+
# Alignment of elements of a multi-line array.
|
301
|
+
#
|
302
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
303
|
+
# column as the first element.
|
304
|
+
#
|
305
|
+
# array = [1, 2, 3,
|
306
|
+
# 4, 5, 6]
|
307
|
+
#
|
308
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
309
|
+
# level of indentation relative to the start of the line with start of array.
|
310
|
+
#
|
311
|
+
# array = [1, 2, 3,
|
312
|
+
# 4, 5, 6]
|
313
|
+
EnforcedStyle: with_first_element
|
314
|
+
SupportedStyles:
|
315
|
+
- with_first_element
|
316
|
+
- with_fixed_indentation
|
317
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
318
|
+
# But it can be overridden by setting this parameter
|
319
|
+
IndentationWidth: ~
|
261
320
|
|
262
321
|
Layout/AssignmentIndentation:
|
263
322
|
Description: >-
|
@@ -270,6 +329,19 @@ Layout/AssignmentIndentation:
|
|
270
329
|
# But it can be overridden by setting this parameter
|
271
330
|
IndentationWidth: ~
|
272
331
|
|
332
|
+
Layout/BeginEndAlignment:
|
333
|
+
Description: 'Align ends corresponding to begins correctly.'
|
334
|
+
Enabled: true
|
335
|
+
VersionAdded: '0.91'
|
336
|
+
# The value `start_of_line` means that `end` should be aligned the start of the line
|
337
|
+
# where the `begin` keyword is.
|
338
|
+
# The value `begin` means that `end` should be aligned with the `begin` keyword.
|
339
|
+
EnforcedStyleAlignWith: start_of_line
|
340
|
+
SupportedStylesAlignWith:
|
341
|
+
- start_of_line
|
342
|
+
- begin
|
343
|
+
Severity: warning
|
344
|
+
|
273
345
|
Layout/BlockAlignment:
|
274
346
|
Description: 'Align block ends correctly.'
|
275
347
|
Enabled: true
|
@@ -346,6 +418,7 @@ Layout/ConditionPosition:
|
|
346
418
|
StyleGuide: '#same-line-condition'
|
347
419
|
Enabled: true
|
348
420
|
VersionAdded: '0.53'
|
421
|
+
VersionChanged: '0.83'
|
349
422
|
|
350
423
|
Layout/DefEndAlignment:
|
351
424
|
Description: 'Align ends corresponding to defs correctly.'
|
@@ -359,7 +432,6 @@ Layout/DefEndAlignment:
|
|
359
432
|
SupportedStylesAlignWith:
|
360
433
|
- start_of_line
|
361
434
|
- def
|
362
|
-
AutoCorrect: false
|
363
435
|
Severity: warning
|
364
436
|
|
365
437
|
Layout/DotPosition:
|
@@ -396,11 +468,23 @@ Layout/EmptyLineAfterMagicComment:
|
|
396
468
|
Enabled: true
|
397
469
|
VersionAdded: '0.49'
|
398
470
|
|
471
|
+
Layout/EmptyLineAfterMultilineCondition:
|
472
|
+
Description: 'Enforces empty line after multiline condition.'
|
473
|
+
# This is disabled, because this style is not very common in practice.
|
474
|
+
Enabled: false
|
475
|
+
VersionAdded: '0.90'
|
476
|
+
Reference:
|
477
|
+
- https://github.com/airbnb/ruby#multiline-if-newline
|
478
|
+
|
399
479
|
Layout/EmptyLineBetweenDefs:
|
400
|
-
Description: 'Use empty lines between defs.'
|
480
|
+
Description: 'Use empty lines between class/module/method defs.'
|
401
481
|
StyleGuide: '#empty-lines-between-methods'
|
402
482
|
Enabled: true
|
403
483
|
VersionAdded: '0.49'
|
484
|
+
VersionChanged: '1.7'
|
485
|
+
EmptyLineBetweenMethodDefs: true
|
486
|
+
EmptyLineBetweenClassDefs: true
|
487
|
+
EmptyLineBetweenModuleDefs: true
|
404
488
|
# If `true`, this parameter means that single line method definitions don't
|
405
489
|
# need an empty line between them.
|
406
490
|
AllowAdjacentOneLineDefs: false
|
@@ -431,6 +515,19 @@ Layout/EmptyLinesAroundArguments:
|
|
431
515
|
Enabled: true
|
432
516
|
VersionAdded: '0.52'
|
433
517
|
|
518
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
519
|
+
Description: "Keep blank lines around attribute accessors."
|
520
|
+
StyleGuide: '#empty-lines-around-attribute-accessor'
|
521
|
+
Enabled: true
|
522
|
+
VersionAdded: '0.83'
|
523
|
+
VersionChanged: '0.84'
|
524
|
+
AllowAliasSyntax: true
|
525
|
+
AllowedMethods:
|
526
|
+
- alias_method
|
527
|
+
- public
|
528
|
+
- protected
|
529
|
+
- private
|
530
|
+
|
434
531
|
Layout/EmptyLinesAroundBeginBody:
|
435
532
|
Description: "Keeps track of empty lines around begin-end bodies."
|
436
533
|
StyleGuide: '#empty-lines-around-bodies'
|
@@ -502,7 +599,6 @@ Layout/EndAlignment:
|
|
502
599
|
- keyword
|
503
600
|
- variable
|
504
601
|
- start_of_line
|
505
|
-
AutoCorrect: false
|
506
602
|
Severity: warning
|
507
603
|
|
508
604
|
Layout/EndOfLine:
|
@@ -745,13 +841,7 @@ Layout/HeredocIndentation:
|
|
745
841
|
StyleGuide: '#squiggly-heredocs'
|
746
842
|
Enabled: true
|
747
843
|
VersionAdded: '0.49'
|
748
|
-
VersionChanged: '0.
|
749
|
-
EnforcedStyle: squiggly
|
750
|
-
SupportedStyles:
|
751
|
-
- squiggly
|
752
|
-
- active_support
|
753
|
-
- powerpack
|
754
|
-
- unindent
|
844
|
+
VersionChanged: '0.85'
|
755
845
|
|
756
846
|
Layout/IndentationConsistency:
|
757
847
|
Description: 'Keep indentation straight.'
|
@@ -772,6 +862,22 @@ Layout/IndentationConsistency:
|
|
772
862
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
773
863
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
774
864
|
|
865
|
+
Layout/IndentationStyle:
|
866
|
+
Description: 'Consistent indentation either with tabs only or spaces only.'
|
867
|
+
StyleGuide: '#spaces-indentation'
|
868
|
+
Enabled: true
|
869
|
+
VersionAdded: '0.49'
|
870
|
+
VersionChanged: '0.82'
|
871
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
872
|
+
# But it can be overridden by setting this parameter
|
873
|
+
# It is used during auto-correction to determine how many spaces should
|
874
|
+
# replace each tab.
|
875
|
+
IndentationWidth: ~
|
876
|
+
EnforcedStyle: spaces
|
877
|
+
SupportedStyles:
|
878
|
+
- spaces
|
879
|
+
- tabs
|
880
|
+
|
775
881
|
Layout/IndentationWidth:
|
776
882
|
Description: 'Use 2 spaces for indentation.'
|
777
883
|
StyleGuide: '#spaces-indentation'
|
@@ -794,6 +900,7 @@ Layout/LeadingCommentSpace:
|
|
794
900
|
VersionAdded: '0.49'
|
795
901
|
VersionChanged: '0.73'
|
796
902
|
AllowDoxygenCommentStyle: false
|
903
|
+
AllowGemfileRubyComment: false
|
797
904
|
|
798
905
|
Layout/LeadingEmptyLines:
|
799
906
|
Description: Check for unnecessary blank lines at the beginning of a file.
|
@@ -802,13 +909,13 @@ Layout/LeadingEmptyLines:
|
|
802
909
|
VersionChanged: '0.77'
|
803
910
|
|
804
911
|
Layout/LineLength:
|
805
|
-
Description: '
|
806
|
-
StyleGuide: '#
|
912
|
+
Description: 'Checks that line length does not exceed the configured limit.'
|
913
|
+
StyleGuide: '#max-line-length'
|
807
914
|
Enabled: true
|
808
915
|
VersionAdded: '0.25'
|
809
|
-
VersionChanged: '
|
810
|
-
AutoCorrect:
|
811
|
-
Max:
|
916
|
+
VersionChanged: '1.4'
|
917
|
+
AutoCorrect: true
|
918
|
+
Max: 120
|
812
919
|
# To make it possible to copy or click on URIs in the code, we allow lines
|
813
920
|
# containing a URI to be longer than Max.
|
814
921
|
AllowHeredoc: true
|
@@ -994,6 +1101,14 @@ Layout/ParameterAlignment:
|
|
994
1101
|
# But it can be overridden by setting this parameter
|
995
1102
|
IndentationWidth: ~
|
996
1103
|
|
1104
|
+
Layout/RedundantLineBreak:
|
1105
|
+
Description: >-
|
1106
|
+
Do not break up an expression into multiple lines when it fits
|
1107
|
+
on a single line.
|
1108
|
+
Enabled: false
|
1109
|
+
InspectBlocks: false
|
1110
|
+
VersionAdded: '1.13'
|
1111
|
+
|
997
1112
|
Layout/RescueEnsureAlignment:
|
998
1113
|
Description: 'Align rescues and ensures correctly.'
|
999
1114
|
Enabled: true
|
@@ -1058,6 +1173,11 @@ Layout/SpaceAroundKeyword:
|
|
1058
1173
|
Enabled: true
|
1059
1174
|
VersionAdded: '0.49'
|
1060
1175
|
|
1176
|
+
Layout/SpaceAroundMethodCallOperator:
|
1177
|
+
Description: 'Checks method call operators to not have spaces around them.'
|
1178
|
+
Enabled: true
|
1179
|
+
VersionAdded: '0.82'
|
1180
|
+
|
1061
1181
|
Layout/SpaceAroundOperators:
|
1062
1182
|
Description: 'Use a single space around operators.'
|
1063
1183
|
StyleGuide: '#spaces-operators'
|
@@ -1086,7 +1206,13 @@ Layout/SpaceBeforeBlockBraces:
|
|
1086
1206
|
SupportedStylesForEmptyBraces:
|
1087
1207
|
- space
|
1088
1208
|
- no_space
|
1089
|
-
VersionChanged: '0.52
|
1209
|
+
VersionChanged: '0.52'
|
1210
|
+
|
1211
|
+
Layout/SpaceBeforeBrackets:
|
1212
|
+
Description: 'Checks for receiver with a space before the opening brackets.'
|
1213
|
+
StyleGuide: '#space-in-brackets-access'
|
1214
|
+
Enabled: pending
|
1215
|
+
VersionAdded: '1.7'
|
1090
1216
|
|
1091
1217
|
Layout/SpaceBeforeComma:
|
1092
1218
|
Description: 'No spaces before commas.'
|
@@ -1166,7 +1292,7 @@ Layout/SpaceInsideBlockBraces:
|
|
1166
1292
|
|
1167
1293
|
Layout/SpaceInsideHashLiteralBraces:
|
1168
1294
|
Description: "Use spaces inside hash literal braces - or don't."
|
1169
|
-
StyleGuide: '#spaces-
|
1295
|
+
StyleGuide: '#spaces-braces'
|
1170
1296
|
Enabled: true
|
1171
1297
|
VersionAdded: '0.49'
|
1172
1298
|
EnforcedStyle: space
|
@@ -1228,18 +1354,6 @@ Layout/SpaceInsideStringInterpolation:
|
|
1228
1354
|
- space
|
1229
1355
|
- no_space
|
1230
1356
|
|
1231
|
-
Layout/Tab:
|
1232
|
-
Description: 'No hard tabs.'
|
1233
|
-
StyleGuide: '#spaces-indentation'
|
1234
|
-
Enabled: true
|
1235
|
-
VersionAdded: '0.49'
|
1236
|
-
VersionChanged: '0.51'
|
1237
|
-
# By default, the indentation width from Layout/IndentationWidth is used
|
1238
|
-
# But it can be overridden by setting this parameter
|
1239
|
-
# It is used during auto-correction to determine how many spaces should
|
1240
|
-
# replace each tab.
|
1241
|
-
IndentationWidth: ~
|
1242
|
-
|
1243
1357
|
Layout/TrailingEmptyLines:
|
1244
1358
|
Description: 'Checks trailing blank lines and final newline.'
|
1245
1359
|
StyleGuide: '#newline-eof'
|
@@ -1256,12 +1370,17 @@ Layout/TrailingWhitespace:
|
|
1256
1370
|
StyleGuide: '#no-trailing-whitespace'
|
1257
1371
|
Enabled: true
|
1258
1372
|
VersionAdded: '0.49'
|
1259
|
-
VersionChanged: '0
|
1373
|
+
VersionChanged: '1.0'
|
1260
1374
|
AllowInHeredoc: false
|
1261
1375
|
|
1262
1376
|
#################### Lint ##################################
|
1263
1377
|
### Warnings
|
1264
1378
|
|
1379
|
+
Lint/AmbiguousAssignment:
|
1380
|
+
Description: 'Checks for mistyped shorthand assignments.'
|
1381
|
+
Enabled: pending
|
1382
|
+
VersionAdded: '1.7'
|
1383
|
+
|
1265
1384
|
Lint/AmbiguousBlockAssociation:
|
1266
1385
|
Description: >-
|
1267
1386
|
Checks for ambiguous block association with method when param passed without
|
@@ -1269,6 +1388,8 @@ Lint/AmbiguousBlockAssociation:
|
|
1269
1388
|
StyleGuide: '#syntax'
|
1270
1389
|
Enabled: true
|
1271
1390
|
VersionAdded: '0.48'
|
1391
|
+
VersionChanged: '1.13'
|
1392
|
+
IgnoredMethods: []
|
1272
1393
|
|
1273
1394
|
Lint/AmbiguousOperator:
|
1274
1395
|
Description: >-
|
@@ -1277,6 +1398,7 @@ Lint/AmbiguousOperator:
|
|
1277
1398
|
StyleGuide: '#method-invocation-parens'
|
1278
1399
|
Enabled: true
|
1279
1400
|
VersionAdded: '0.17'
|
1401
|
+
VersionChanged: '0.83'
|
1280
1402
|
|
1281
1403
|
Lint/AmbiguousRegexpLiteral:
|
1282
1404
|
Description: >-
|
@@ -1284,6 +1406,7 @@ Lint/AmbiguousRegexpLiteral:
|
|
1284
1406
|
a method invocation without parentheses.
|
1285
1407
|
Enabled: true
|
1286
1408
|
VersionAdded: '0.17'
|
1409
|
+
VersionChanged: '0.83'
|
1287
1410
|
|
1288
1411
|
Lint/AssignmentInCondition:
|
1289
1412
|
Description: "Don't use assignment in conditions."
|
@@ -1297,38 +1420,138 @@ Lint/BigDecimalNew:
|
|
1297
1420
|
Enabled: true
|
1298
1421
|
VersionAdded: '0.53'
|
1299
1422
|
|
1423
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
1424
|
+
Description: 'This cop checks for places where binary operator has identical operands.'
|
1425
|
+
Enabled: true
|
1426
|
+
Safe: false
|
1427
|
+
VersionAdded: '0.89'
|
1428
|
+
VersionChanged: '1.7'
|
1429
|
+
|
1300
1430
|
Lint/BooleanSymbol:
|
1301
1431
|
Description: 'Check for `:true` and `:false` symbols.'
|
1302
1432
|
Enabled: true
|
1433
|
+
Safe: false
|
1303
1434
|
VersionAdded: '0.50'
|
1435
|
+
VersionChanged: '0.83'
|
1304
1436
|
|
1305
1437
|
Lint/CircularArgumentReference:
|
1306
1438
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
1307
1439
|
Enabled: true
|
1308
1440
|
VersionAdded: '0.33'
|
1309
1441
|
|
1442
|
+
Lint/ConstantDefinitionInBlock:
|
1443
|
+
Description: 'Do not define constants within a block.'
|
1444
|
+
StyleGuide: '#no-constant-definition-in-block'
|
1445
|
+
Enabled: true
|
1446
|
+
VersionAdded: '0.91'
|
1447
|
+
VersionChanged: '1.3'
|
1448
|
+
# `enums` for Typed Enums via T::Enum in Sorbet.
|
1449
|
+
# https://sorbet.org/docs/tenum
|
1450
|
+
AllowedMethods:
|
1451
|
+
- enums
|
1452
|
+
|
1453
|
+
Lint/ConstantResolution:
|
1454
|
+
Description: 'Check that constants are fully qualified with `::`.'
|
1455
|
+
Enabled: false
|
1456
|
+
VersionAdded: '0.86'
|
1457
|
+
# Restrict this cop to only looking at certain names
|
1458
|
+
Only: []
|
1459
|
+
# Restrict this cop from only looking at certain names
|
1460
|
+
Ignore: []
|
1461
|
+
|
1310
1462
|
Lint/Debugger:
|
1311
1463
|
Description: 'Check for debugger calls.'
|
1312
1464
|
Enabled: true
|
1313
1465
|
VersionAdded: '0.14'
|
1314
|
-
VersionChanged: '
|
1466
|
+
VersionChanged: '1.10'
|
1467
|
+
DebuggerReceivers: [] # deprecated
|
1468
|
+
DebuggerMethods:
|
1469
|
+
# Groups are available so that a specific group can be disabled in
|
1470
|
+
# a user's configuration, but are otherwise not significant.
|
1471
|
+
Kernel:
|
1472
|
+
- binding.irb
|
1473
|
+
Byebug:
|
1474
|
+
- byebug
|
1475
|
+
- remote_byebug
|
1476
|
+
- Kernel.byebug
|
1477
|
+
- Kernel.remote_byebug
|
1478
|
+
Capybara:
|
1479
|
+
- save_and_open_page
|
1480
|
+
- save_and_open_screenshot
|
1481
|
+
Pry:
|
1482
|
+
- binding.pry
|
1483
|
+
- binding.remote_pry
|
1484
|
+
- binding.pry_remote
|
1485
|
+
- Pry.rescue
|
1486
|
+
Rails:
|
1487
|
+
- debugger
|
1488
|
+
- Kernel.debugger
|
1489
|
+
WebConsole:
|
1490
|
+
- binding.console
|
1315
1491
|
|
1316
1492
|
Lint/DeprecatedClassMethods:
|
1317
1493
|
Description: 'Check for deprecated class method calls.'
|
1318
1494
|
Enabled: true
|
1319
1495
|
VersionAdded: '0.19'
|
1320
1496
|
|
1497
|
+
Lint/DeprecatedConstants:
|
1498
|
+
Description: 'Checks for deprecated constants.'
|
1499
|
+
Enabled: pending
|
1500
|
+
VersionAdded: '1.8'
|
1501
|
+
# You can configure deprecated constants.
|
1502
|
+
# If there is an alternative method, you can set alternative value as `Alternative`.
|
1503
|
+
# And you can set the deprecated version as `DeprecatedVersion`.
|
1504
|
+
# These options can be omitted if they are not needed.
|
1505
|
+
#
|
1506
|
+
# DeprecatedConstants:
|
1507
|
+
# 'DEPRECATED_CONSTANT':
|
1508
|
+
# Alternative: 'alternative_value'
|
1509
|
+
# DeprecatedVersion: 'deprecated_version'
|
1510
|
+
#
|
1511
|
+
DeprecatedConstants:
|
1512
|
+
'NIL':
|
1513
|
+
Alternative: 'nil'
|
1514
|
+
DeprecatedVersion: '2.4'
|
1515
|
+
'TRUE':
|
1516
|
+
Alternative: 'true'
|
1517
|
+
DeprecatedVersion: '2.4'
|
1518
|
+
'FALSE':
|
1519
|
+
Alternative: 'false'
|
1520
|
+
DeprecatedVersion: '2.4'
|
1521
|
+
'Random::DEFAULT':
|
1522
|
+
Alternative: 'Random.new'
|
1523
|
+
DeprecatedVersion: '3.0'
|
1524
|
+
|
1525
|
+
Lint/DeprecatedOpenSSLConstant:
|
1526
|
+
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1527
|
+
Enabled: true
|
1528
|
+
VersionAdded: '0.84'
|
1529
|
+
|
1321
1530
|
Lint/DisjunctiveAssignmentInConstructor:
|
1322
1531
|
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1323
1532
|
Enabled: true
|
1324
1533
|
Safe: false
|
1325
1534
|
VersionAdded: '0.62'
|
1535
|
+
VersionChanged: '0.88'
|
1536
|
+
|
1537
|
+
Lint/DuplicateBranch:
|
1538
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when` and `rescue` constructs.
|
1539
|
+
Enabled: pending
|
1540
|
+
VersionAdded: '1.3'
|
1541
|
+
VersionChanged: '1.7'
|
1542
|
+
IgnoreLiteralBranches: false
|
1543
|
+
IgnoreConstantBranches: false
|
1326
1544
|
|
1327
1545
|
Lint/DuplicateCaseCondition:
|
1328
1546
|
Description: 'Do not repeat values in case conditionals.'
|
1329
1547
|
Enabled: true
|
1330
1548
|
VersionAdded: '0.45'
|
1331
1549
|
|
1550
|
+
Lint/DuplicateElsifCondition:
|
1551
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1552
|
+
Enabled: true
|
1553
|
+
VersionAdded: '0.88'
|
1554
|
+
|
1332
1555
|
Lint/DuplicateHashKey:
|
1333
1556
|
Description: 'Check for duplicate keys in hash literals.'
|
1334
1557
|
Enabled: true
|
@@ -1340,6 +1563,21 @@ Lint/DuplicateMethods:
|
|
1340
1563
|
Enabled: true
|
1341
1564
|
VersionAdded: '0.29'
|
1342
1565
|
|
1566
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
1567
|
+
Description: 'Checks for duplicate elements in Regexp character classes.'
|
1568
|
+
Enabled: pending
|
1569
|
+
VersionAdded: '1.1'
|
1570
|
+
|
1571
|
+
Lint/DuplicateRequire:
|
1572
|
+
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1573
|
+
Enabled: true
|
1574
|
+
VersionAdded: '0.90'
|
1575
|
+
|
1576
|
+
Lint/DuplicateRescueException:
|
1577
|
+
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1578
|
+
Enabled: true
|
1579
|
+
VersionAdded: '0.89'
|
1580
|
+
|
1343
1581
|
Lint/EachWithObjectArgument:
|
1344
1582
|
Description: 'Check for immutable argument given to each_with_object.'
|
1345
1583
|
Enabled: true
|
@@ -1349,19 +1587,45 @@ Lint/ElseLayout:
|
|
1349
1587
|
Description: 'Check for odd code arrangement in an else block.'
|
1350
1588
|
Enabled: true
|
1351
1589
|
VersionAdded: '0.17'
|
1590
|
+
VersionChanged: '1.2'
|
1591
|
+
|
1592
|
+
Lint/EmptyBlock:
|
1593
|
+
Description: 'This cop checks for blocks without a body.'
|
1594
|
+
Enabled: pending
|
1595
|
+
VersionAdded: '1.1'
|
1596
|
+
VersionChanged: '1.3'
|
1597
|
+
AllowComments: true
|
1598
|
+
AllowEmptyLambdas: true
|
1599
|
+
|
1600
|
+
Lint/EmptyClass:
|
1601
|
+
Description: 'Checks for classes and metaclasses without a body.'
|
1602
|
+
Enabled: pending
|
1603
|
+
VersionAdded: '1.3'
|
1604
|
+
AllowComments: false
|
1605
|
+
|
1606
|
+
Lint/EmptyConditionalBody:
|
1607
|
+
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1608
|
+
Enabled: true
|
1609
|
+
AllowComments: true
|
1610
|
+
VersionAdded: '0.89'
|
1352
1611
|
|
1353
1612
|
Lint/EmptyEnsure:
|
1354
1613
|
Description: 'Checks for empty ensure block.'
|
1355
1614
|
Enabled: true
|
1356
1615
|
VersionAdded: '0.10'
|
1357
1616
|
VersionChanged: '0.48'
|
1358
|
-
AutoCorrect: false
|
1359
1617
|
|
1360
1618
|
Lint/EmptyExpression:
|
1361
1619
|
Description: 'Checks for empty expressions.'
|
1362
1620
|
Enabled: true
|
1363
1621
|
VersionAdded: '0.45'
|
1364
1622
|
|
1623
|
+
Lint/EmptyFile:
|
1624
|
+
Description: 'Enforces that Ruby source files are not empty.'
|
1625
|
+
Enabled: true
|
1626
|
+
AllowComments: true
|
1627
|
+
VersionAdded: '0.90'
|
1628
|
+
|
1365
1629
|
Lint/EmptyInterpolation:
|
1366
1630
|
Description: 'Checks for empty string interpolation.'
|
1367
1631
|
Enabled: true
|
@@ -1371,18 +1635,16 @@ Lint/EmptyInterpolation:
|
|
1371
1635
|
Lint/EmptyWhen:
|
1372
1636
|
Description: 'Checks for `when` branches with empty bodies.'
|
1373
1637
|
Enabled: true
|
1638
|
+
AllowComments: true
|
1374
1639
|
VersionAdded: '0.45'
|
1375
|
-
|
1376
|
-
Lint/EndInMethod:
|
1377
|
-
Description: 'END blocks should not be placed inside method definitions.'
|
1378
|
-
Enabled: true
|
1379
|
-
VersionAdded: '0.9'
|
1640
|
+
VersionChanged: '0.83'
|
1380
1641
|
|
1381
1642
|
Lint/EnsureReturn:
|
1382
1643
|
Description: 'Do not use return in an ensure block.'
|
1383
1644
|
StyleGuide: '#no-return-ensure'
|
1384
1645
|
Enabled: true
|
1385
1646
|
VersionAdded: '0.9'
|
1647
|
+
VersionChanged: '0.83'
|
1386
1648
|
|
1387
1649
|
Lint/ErbNewArguments:
|
1388
1650
|
Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
|
@@ -1395,6 +1657,12 @@ Lint/FlipFlop:
|
|
1395
1657
|
Enabled: true
|
1396
1658
|
VersionAdded: '0.16'
|
1397
1659
|
|
1660
|
+
Lint/FloatComparison:
|
1661
|
+
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1662
|
+
StyleGuide: '#float-comparison'
|
1663
|
+
Enabled: true
|
1664
|
+
VersionAdded: '0.89'
|
1665
|
+
|
1398
1666
|
Lint/FloatOutOfRange:
|
1399
1667
|
Description: >-
|
1400
1668
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1407,6 +1675,13 @@ Lint/FormatParameterMismatch:
|
|
1407
1675
|
Enabled: true
|
1408
1676
|
VersionAdded: '0.33'
|
1409
1677
|
|
1678
|
+
Lint/HashCompareByIdentity:
|
1679
|
+
Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
|
1680
|
+
StyleGuide: '#identity-comparison'
|
1681
|
+
Enabled: true
|
1682
|
+
Safe: false
|
1683
|
+
VersionAdded: '0.93'
|
1684
|
+
|
1410
1685
|
Lint/HeredocMethodCallPosition:
|
1411
1686
|
Description: >-
|
1412
1687
|
Checks for the ordering of a method call where
|
@@ -1415,6 +1690,12 @@ Lint/HeredocMethodCallPosition:
|
|
1415
1690
|
StyleGuide: '#heredoc-method-calls'
|
1416
1691
|
VersionAdded: '0.68'
|
1417
1692
|
|
1693
|
+
Lint/IdentityComparison:
|
1694
|
+
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1695
|
+
Enabled: true
|
1696
|
+
StyleGuide: '#identity-comparison'
|
1697
|
+
VersionAdded: '0.91'
|
1698
|
+
|
1418
1699
|
Lint/ImplicitStringConcatenation:
|
1419
1700
|
Description: >-
|
1420
1701
|
Checks for adjacent string literals on the same line, which
|
@@ -1442,7 +1723,14 @@ Lint/InheritException:
|
|
1442
1723
|
Lint/InterpolationCheck:
|
1443
1724
|
Description: 'Raise warning for interpolation in single q strs.'
|
1444
1725
|
Enabled: true
|
1726
|
+
Safe: false
|
1445
1727
|
VersionAdded: '0.50'
|
1728
|
+
VersionChanged: '0.87'
|
1729
|
+
|
1730
|
+
Lint/LambdaWithoutLiteralBlock:
|
1731
|
+
Description: 'Checks uses of lambda without a literal block.'
|
1732
|
+
Enabled: pending
|
1733
|
+
VersionAdded: '1.8'
|
1446
1734
|
|
1447
1735
|
Lint/LiteralAsCondition:
|
1448
1736
|
Description: 'Checks of literals used in conditions.'
|
@@ -1462,6 +1750,8 @@ Lint/Loop:
|
|
1462
1750
|
StyleGuide: '#loop-with-break'
|
1463
1751
|
Enabled: true
|
1464
1752
|
VersionAdded: '0.9'
|
1753
|
+
VersionChanged: '1.3'
|
1754
|
+
Safe: false
|
1465
1755
|
|
1466
1756
|
Lint/MissingCopEnableDirective:
|
1467
1757
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1476,11 +1766,25 @@ Lint/MissingCopEnableDirective:
|
|
1476
1766
|
# .inf for any size
|
1477
1767
|
MaximumRangeSize: .inf
|
1478
1768
|
|
1769
|
+
Lint/MissingSuper:
|
1770
|
+
Description: >-
|
1771
|
+
This cop checks for the presence of constructors and lifecycle callbacks
|
1772
|
+
without calls to `super`'.
|
1773
|
+
Enabled: true
|
1774
|
+
VersionAdded: '0.89'
|
1775
|
+
VersionChanged: '1.4'
|
1776
|
+
|
1777
|
+
Lint/MixedRegexpCaptureTypes:
|
1778
|
+
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1779
|
+
Enabled: true
|
1780
|
+
VersionAdded: '0.85'
|
1781
|
+
|
1479
1782
|
Lint/MultipleComparison:
|
1480
1783
|
Description: "Use `&&` operator to compare multiple values."
|
1481
1784
|
Enabled: true
|
1482
1785
|
VersionAdded: '0.47'
|
1483
|
-
VersionChanged: '
|
1786
|
+
VersionChanged: '1.1'
|
1787
|
+
AllowMethodComparison: true
|
1484
1788
|
|
1485
1789
|
Lint/NestedMethodDefinition:
|
1486
1790
|
Description: 'Do not use nested method definitions.'
|
@@ -1500,6 +1804,11 @@ Lint/NextWithoutAccumulator:
|
|
1500
1804
|
Enabled: true
|
1501
1805
|
VersionAdded: '0.36'
|
1502
1806
|
|
1807
|
+
Lint/NoReturnInBeginEndBlocks:
|
1808
|
+
Description: 'Do not `return` inside `begin..end` blocks in assignment contexts.'
|
1809
|
+
Enabled: pending
|
1810
|
+
VersionAdded: '1.2'
|
1811
|
+
|
1503
1812
|
Lint/NonDeterministicRequireOrder:
|
1504
1813
|
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1505
1814
|
Enabled: true
|
@@ -1515,14 +1824,35 @@ Lint/NumberConversion:
|
|
1515
1824
|
Description: 'Checks unsafe usage of number conversion methods.'
|
1516
1825
|
Enabled: false
|
1517
1826
|
VersionAdded: '0.53'
|
1518
|
-
VersionChanged: '
|
1827
|
+
VersionChanged: '1.1'
|
1519
1828
|
SafeAutoCorrect: false
|
1829
|
+
IgnoredMethods: []
|
1830
|
+
IgnoredClasses:
|
1831
|
+
- Time
|
1832
|
+
- DateTime
|
1833
|
+
|
1834
|
+
Lint/NumberedParameterAssignment:
|
1835
|
+
Description: 'Checks for uses of numbered parameter assignment.'
|
1836
|
+
Enabled: pending
|
1837
|
+
VersionAdded: '1.9'
|
1838
|
+
|
1839
|
+
Lint/OrAssignmentToConstant:
|
1840
|
+
Description: 'Checks unintended or-assignment to constant.'
|
1841
|
+
Enabled: pending
|
1842
|
+
Safe: false
|
1843
|
+
VersionAdded: '1.9'
|
1520
1844
|
|
1521
1845
|
Lint/OrderedMagicComments:
|
1522
1846
|
Description: 'Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.'
|
1523
1847
|
Enabled: true
|
1524
1848
|
VersionAdded: '0.53'
|
1525
1849
|
|
1850
|
+
Lint/OutOfRangeRegexpRef:
|
1851
|
+
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1852
|
+
Enabled: true
|
1853
|
+
Safe: false
|
1854
|
+
VersionAdded: '0.89'
|
1855
|
+
|
1526
1856
|
Lint/ParenthesesAsGroupedExpression:
|
1527
1857
|
Description: >-
|
1528
1858
|
Checks for method calls with a space before the opening
|
@@ -1530,6 +1860,7 @@ Lint/ParenthesesAsGroupedExpression:
|
|
1530
1860
|
StyleGuide: '#parens-no-spaces'
|
1531
1861
|
Enabled: true
|
1532
1862
|
VersionAdded: '0.12'
|
1863
|
+
VersionChanged: '0.83'
|
1533
1864
|
|
1534
1865
|
Lint/PercentStringArray:
|
1535
1866
|
Description: >-
|
@@ -1544,6 +1875,16 @@ Lint/PercentSymbolArray:
|
|
1544
1875
|
Enabled: true
|
1545
1876
|
VersionAdded: '0.41'
|
1546
1877
|
|
1878
|
+
Lint/RaiseException:
|
1879
|
+
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1880
|
+
StyleGuide: '#raise-exception'
|
1881
|
+
Enabled: true
|
1882
|
+
Safe: false
|
1883
|
+
VersionAdded: '0.81'
|
1884
|
+
VersionChanged: '0.86'
|
1885
|
+
AllowedImplicitNamespaces:
|
1886
|
+
- 'Gem'
|
1887
|
+
|
1547
1888
|
Lint/RandOne:
|
1548
1889
|
Description: >-
|
1549
1890
|
Checks for `rand(1)` calls. Such calls always return `0`
|
@@ -1564,15 +1905,35 @@ Lint/RedundantCopEnableDirective:
|
|
1564
1905
|
Enabled: true
|
1565
1906
|
VersionAdded: '0.76'
|
1566
1907
|
|
1908
|
+
Lint/RedundantDirGlobSort:
|
1909
|
+
Description: 'Checks for redundant `sort` method to `Dir.glob` and `Dir[]`.'
|
1910
|
+
Enabled: pending
|
1911
|
+
VersionAdded: '1.8'
|
1912
|
+
|
1567
1913
|
Lint/RedundantRequireStatement:
|
1568
1914
|
Description: 'Checks for unnecessary `require` statement.'
|
1569
1915
|
Enabled: true
|
1570
1916
|
VersionAdded: '0.76'
|
1571
1917
|
|
1918
|
+
Lint/RedundantSafeNavigation:
|
1919
|
+
Description: 'Checks for redundant safe navigation calls.'
|
1920
|
+
Enabled: true
|
1921
|
+
VersionAdded: '0.93'
|
1922
|
+
AllowedMethods:
|
1923
|
+
- instance_of?
|
1924
|
+
- kind_of?
|
1925
|
+
- is_a?
|
1926
|
+
- eql?
|
1927
|
+
- respond_to?
|
1928
|
+
- equal?
|
1929
|
+
Safe: false
|
1930
|
+
|
1572
1931
|
Lint/RedundantSplatExpansion:
|
1573
1932
|
Description: 'Checks for splat unnecessarily being called on literals.'
|
1574
1933
|
Enabled: true
|
1575
|
-
|
1934
|
+
VersionAdded: '0.76'
|
1935
|
+
VersionChanged: '1.7'
|
1936
|
+
AllowPercentLiteralArrayArgument: true
|
1576
1937
|
|
1577
1938
|
Lint/RedundantStringCoercion:
|
1578
1939
|
Description: 'Checks for Object#to_s usage in string interpolation.'
|
@@ -1597,6 +1958,7 @@ Lint/RegexpAsCondition:
|
|
1597
1958
|
The regexp literal matches `$_` implicitly.
|
1598
1959
|
Enabled: true
|
1599
1960
|
VersionAdded: '0.51'
|
1961
|
+
VersionChanged: '0.86'
|
1600
1962
|
|
1601
1963
|
Lint/RequireParentheses:
|
1602
1964
|
Description: >-
|
@@ -1610,7 +1972,7 @@ Lint/RescueException:
|
|
1610
1972
|
StyleGuide: '#no-blind-rescues'
|
1611
1973
|
Enabled: true
|
1612
1974
|
VersionAdded: '0.9'
|
1613
|
-
VersionChanged: '0.27
|
1975
|
+
VersionChanged: '0.27'
|
1614
1976
|
|
1615
1977
|
Lint/RescueType:
|
1616
1978
|
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
@@ -1633,6 +1995,7 @@ Lint/SafeNavigationChain:
|
|
1633
1995
|
- presence
|
1634
1996
|
- try
|
1635
1997
|
- try!
|
1998
|
+
- in?
|
1636
1999
|
|
1637
2000
|
Lint/SafeNavigationConsistency:
|
1638
2001
|
Description: >-
|
@@ -1653,6 +2016,7 @@ Lint/SafeNavigationWithEmpty:
|
|
1653
2016
|
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1654
2017
|
Enabled: true
|
1655
2018
|
VersionAdded: '0.62'
|
2019
|
+
VersionChanged: '0.87'
|
1656
2020
|
|
1657
2021
|
Lint/ScriptPermission:
|
1658
2022
|
Description: 'Grant script file execute permission.'
|
@@ -1660,6 +2024,11 @@ Lint/ScriptPermission:
|
|
1660
2024
|
VersionAdded: '0.49'
|
1661
2025
|
VersionChanged: '0.50'
|
1662
2026
|
|
2027
|
+
Lint/SelfAssignment:
|
2028
|
+
Description: 'Checks for self-assignments.'
|
2029
|
+
Enabled: true
|
2030
|
+
VersionAdded: '0.89'
|
2031
|
+
|
1663
2032
|
Lint/SendWithMixinArgument:
|
1664
2033
|
Description: 'Checks for `send` method when using mixin.'
|
1665
2034
|
Enabled: true
|
@@ -1686,23 +2055,58 @@ Lint/ShadowingOuterLocalVariable:
|
|
1686
2055
|
Enabled: true
|
1687
2056
|
VersionAdded: '0.9'
|
1688
2057
|
|
2058
|
+
Lint/StructNewOverride:
|
2059
|
+
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
2060
|
+
Enabled: true
|
2061
|
+
VersionAdded: '0.81'
|
2062
|
+
|
1689
2063
|
Lint/SuppressedException:
|
1690
2064
|
Description: "Don't suppress exceptions."
|
1691
2065
|
StyleGuide: '#dont-hide-exceptions'
|
1692
2066
|
Enabled: true
|
1693
|
-
AllowComments:
|
2067
|
+
AllowComments: true
|
2068
|
+
AllowNil: true
|
1694
2069
|
VersionAdded: '0.9'
|
1695
|
-
VersionChanged: '
|
2070
|
+
VersionChanged: '1.12'
|
2071
|
+
|
2072
|
+
Lint/SymbolConversion:
|
2073
|
+
Description: 'Checks for unnecessary symbol conversions.'
|
2074
|
+
Enabled: pending
|
2075
|
+
VersionAdded: '1.9'
|
2076
|
+
EnforcedStyle: strict
|
2077
|
+
SupportedStyles:
|
2078
|
+
- strict
|
2079
|
+
- consistent
|
1696
2080
|
|
1697
2081
|
Lint/Syntax:
|
1698
|
-
Description: 'Checks syntax
|
2082
|
+
Description: 'Checks for syntax errors.'
|
1699
2083
|
Enabled: true
|
1700
2084
|
VersionAdded: '0.9'
|
1701
2085
|
|
2086
|
+
Lint/ToEnumArguments:
|
2087
|
+
Description: 'This cop ensures that `to_enum`/`enum_for`, called for the current method, has correct arguments.'
|
2088
|
+
Enabled: pending
|
2089
|
+
VersionAdded: '1.1'
|
1702
2090
|
|
1703
2091
|
Lint/ToJSON:
|
1704
2092
|
Description: 'Ensure #to_json includes an optional argument.'
|
1705
2093
|
Enabled: true
|
2094
|
+
VersionAdded: '0.66'
|
2095
|
+
|
2096
|
+
Lint/TopLevelReturnWithArgument:
|
2097
|
+
Description: 'This cop detects top level return statements with argument.'
|
2098
|
+
Enabled: true
|
2099
|
+
VersionAdded: '0.89'
|
2100
|
+
|
2101
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
2102
|
+
Description: 'This cop checks for trailing commas in attribute declarations.'
|
2103
|
+
Enabled: true
|
2104
|
+
VersionAdded: '0.90'
|
2105
|
+
|
2106
|
+
Lint/TripleQuotes:
|
2107
|
+
Description: 'Checks for useless triple quote constructs.'
|
2108
|
+
Enabled: pending
|
2109
|
+
VersionAdded: '1.9'
|
1706
2110
|
|
1707
2111
|
Lint/UnderscorePrefixedVariableName:
|
1708
2112
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
@@ -1710,16 +2114,49 @@ Lint/UnderscorePrefixedVariableName:
|
|
1710
2114
|
VersionAdded: '0.21'
|
1711
2115
|
AllowKeywordBlockArguments: false
|
1712
2116
|
|
2117
|
+
Lint/UnexpectedBlockArity:
|
2118
|
+
Description: 'Looks for blocks that have fewer arguments that the calling method expects.'
|
2119
|
+
Enabled: pending
|
2120
|
+
Safe: false
|
2121
|
+
VersionAdded: '1.5'
|
2122
|
+
Methods:
|
2123
|
+
chunk_while: 2
|
2124
|
+
each_with_index: 2
|
2125
|
+
each_with_object: 2
|
2126
|
+
inject: 2
|
2127
|
+
max: 2
|
2128
|
+
min: 2
|
2129
|
+
minmax: 2
|
2130
|
+
reduce: 2
|
2131
|
+
slice_when: 2
|
2132
|
+
sort: 2
|
2133
|
+
|
1713
2134
|
Lint/UnifiedInteger:
|
1714
2135
|
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1715
2136
|
Enabled: true
|
1716
2137
|
VersionAdded: '0.43'
|
1717
2138
|
|
2139
|
+
Lint/UnmodifiedReduceAccumulator:
|
2140
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator each iteration.
|
2141
|
+
Enabled: pending
|
2142
|
+
VersionAdded: '1.1'
|
2143
|
+
VersionChanged: '1.5'
|
2144
|
+
|
1718
2145
|
Lint/UnreachableCode:
|
1719
2146
|
Description: 'Unreachable code.'
|
1720
2147
|
Enabled: true
|
1721
2148
|
VersionAdded: '0.9'
|
1722
2149
|
|
2150
|
+
Lint/UnreachableLoop:
|
2151
|
+
Description: 'This cop checks for loops that will have at most one iteration.'
|
2152
|
+
Enabled: true
|
2153
|
+
VersionAdded: '0.89'
|
2154
|
+
VersionChanged: '1.7'
|
2155
|
+
IgnoredPatterns:
|
2156
|
+
# RSpec uses `times` in its message expectations
|
2157
|
+
# eg. `exactly(2).times`
|
2158
|
+
- !ruby/regexp /(exactly|at_least|at_most)\(\d+\)\.times/
|
2159
|
+
|
1723
2160
|
Lint/UnusedBlockArgument:
|
1724
2161
|
Description: 'Checks for unused block arguments.'
|
1725
2162
|
StyleGuide: '#underscore-unused-vars'
|
@@ -1734,9 +2171,10 @@ Lint/UnusedMethodArgument:
|
|
1734
2171
|
StyleGuide: '#underscore-unused-vars'
|
1735
2172
|
Enabled: true
|
1736
2173
|
VersionAdded: '0.21'
|
1737
|
-
VersionChanged: '0.
|
2174
|
+
VersionChanged: '0.81'
|
1738
2175
|
AllowUnusedKeywordArguments: false
|
1739
2176
|
IgnoreEmptyMethods: true
|
2177
|
+
IgnoreNotImplementedMethods: true
|
1740
2178
|
|
1741
2179
|
Lint/UriEscapeUnescape:
|
1742
2180
|
Description: >-
|
@@ -1758,7 +2196,7 @@ Lint/UselessAccessModifier:
|
|
1758
2196
|
Description: 'Checks for useless access modifiers.'
|
1759
2197
|
Enabled: true
|
1760
2198
|
VersionAdded: '0.20'
|
1761
|
-
VersionChanged: '0.
|
2199
|
+
VersionChanged: '0.83'
|
1762
2200
|
ContextCreatingMethods: []
|
1763
2201
|
MethodCreatingMethods: []
|
1764
2202
|
|
@@ -1768,20 +2206,31 @@ Lint/UselessAssignment:
|
|
1768
2206
|
Enabled: true
|
1769
2207
|
VersionAdded: '0.11'
|
1770
2208
|
|
1771
|
-
Lint/UselessComparison:
|
1772
|
-
Description: 'Checks for comparison of something with itself.'
|
1773
|
-
Enabled: true
|
1774
|
-
VersionAdded: '0.11'
|
1775
|
-
|
1776
2209
|
Lint/UselessElseWithoutRescue:
|
1777
2210
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
1778
2211
|
Enabled: true
|
1779
2212
|
VersionAdded: '0.17'
|
1780
2213
|
|
2214
|
+
Lint/UselessMethodDefinition:
|
2215
|
+
Description: 'Checks for useless method definitions.'
|
2216
|
+
Enabled: true
|
2217
|
+
VersionAdded: '0.90'
|
2218
|
+
Safe: false
|
2219
|
+
AllowComments: true
|
2220
|
+
|
1781
2221
|
Lint/UselessSetterCall:
|
1782
2222
|
Description: 'Checks for useless setter call to a local variable.'
|
1783
2223
|
Enabled: true
|
2224
|
+
SafeAutoCorrect: false
|
1784
2225
|
VersionAdded: '0.13'
|
2226
|
+
VersionChanged: '1.2'
|
2227
|
+
Safe: false
|
2228
|
+
|
2229
|
+
Lint/UselessTimes:
|
2230
|
+
Description: 'Checks for useless `Integer#times` calls.'
|
2231
|
+
Enabled: true
|
2232
|
+
VersionAdded: '0.91'
|
2233
|
+
Safe: false
|
1785
2234
|
|
1786
2235
|
Lint/Void:
|
1787
2236
|
Description: 'Possible use of operator/literal/variable in void context.'
|
@@ -1800,19 +2249,23 @@ Metrics/AbcSize:
|
|
1800
2249
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
1801
2250
|
Enabled: true
|
1802
2251
|
VersionAdded: '0.27'
|
1803
|
-
VersionChanged: '
|
2252
|
+
VersionChanged: '1.5'
|
1804
2253
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1805
2254
|
# a Float.
|
1806
|
-
|
2255
|
+
IgnoredMethods: []
|
2256
|
+
CountRepeatedAttributes: true
|
2257
|
+
Max: 17
|
1807
2258
|
|
1808
2259
|
Metrics/BlockLength:
|
1809
2260
|
Description: 'Avoid long blocks with many lines.'
|
1810
2261
|
Enabled: true
|
1811
2262
|
VersionAdded: '0.44'
|
1812
|
-
VersionChanged: '
|
2263
|
+
VersionChanged: '1.5'
|
1813
2264
|
CountComments: false # count full line comments?
|
1814
2265
|
Max: 25
|
1815
|
-
|
2266
|
+
CountAsOne: []
|
2267
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2268
|
+
IgnoredMethods:
|
1816
2269
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1817
2270
|
# associated blocks.
|
1818
2271
|
- refine
|
@@ -1832,8 +2285,10 @@ Metrics/ClassLength:
|
|
1832
2285
|
Description: 'Avoid classes longer than 100 lines of code.'
|
1833
2286
|
Enabled: true
|
1834
2287
|
VersionAdded: '0.25'
|
2288
|
+
VersionChanged: '0.87'
|
1835
2289
|
CountComments: false # count full line comments?
|
1836
2290
|
Max: 100
|
2291
|
+
CountAsOne: []
|
1837
2292
|
|
1838
2293
|
# Avoid complex methods.
|
1839
2294
|
Metrics/CyclomaticComplexity:
|
@@ -1842,32 +2297,40 @@ Metrics/CyclomaticComplexity:
|
|
1842
2297
|
of test cases needed to validate a method.
|
1843
2298
|
Enabled: true
|
1844
2299
|
VersionAdded: '0.25'
|
1845
|
-
|
2300
|
+
VersionChanged: '0.81'
|
2301
|
+
IgnoredMethods: []
|
2302
|
+
Max: 7
|
1846
2303
|
|
1847
2304
|
Metrics/MethodLength:
|
1848
2305
|
Description: 'Avoid methods longer than 10 lines of code.'
|
1849
2306
|
StyleGuide: '#short-methods'
|
1850
2307
|
Enabled: true
|
1851
2308
|
VersionAdded: '0.25'
|
1852
|
-
VersionChanged: '
|
2309
|
+
VersionChanged: '1.5'
|
1853
2310
|
CountComments: false # count full line comments?
|
1854
2311
|
Max: 10
|
1855
|
-
|
2312
|
+
CountAsOne: []
|
2313
|
+
ExcludedMethods: [] # deprecated, retained for backwards compatibility
|
2314
|
+
IgnoredMethods: []
|
1856
2315
|
|
1857
2316
|
Metrics/ModuleLength:
|
1858
2317
|
Description: 'Avoid modules longer than 100 lines of code.'
|
1859
2318
|
Enabled: true
|
1860
2319
|
VersionAdded: '0.31'
|
2320
|
+
VersionChanged: '0.87'
|
1861
2321
|
CountComments: false # count full line comments?
|
1862
2322
|
Max: 100
|
2323
|
+
CountAsOne: []
|
1863
2324
|
|
1864
2325
|
Metrics/ParameterLists:
|
1865
2326
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
1866
2327
|
StyleGuide: '#too-many-params'
|
1867
2328
|
Enabled: true
|
1868
2329
|
VersionAdded: '0.25'
|
2330
|
+
VersionChanged: '1.5'
|
1869
2331
|
Max: 5
|
1870
2332
|
CountKeywordArgs: true
|
2333
|
+
MaxOptionalParameters: 3
|
1871
2334
|
|
1872
2335
|
Metrics/PerceivedComplexity:
|
1873
2336
|
Description: >-
|
@@ -1875,7 +2338,9 @@ Metrics/PerceivedComplexity:
|
|
1875
2338
|
human reader.
|
1876
2339
|
Enabled: true
|
1877
2340
|
VersionAdded: '0.25'
|
1878
|
-
|
2341
|
+
VersionChanged: '0.81'
|
2342
|
+
IgnoredMethods: []
|
2343
|
+
Max: 8
|
1879
2344
|
|
1880
2345
|
################## Migration #############################
|
1881
2346
|
|
@@ -1883,7 +2348,8 @@ Migration/DepartmentName:
|
|
1883
2348
|
Description: >-
|
1884
2349
|
Check that cop names in rubocop:disable (etc) comments are
|
1885
2350
|
given with department name.
|
1886
|
-
Enabled:
|
2351
|
+
Enabled: true
|
2352
|
+
VersionAdded: '0.75'
|
1887
2353
|
|
1888
2354
|
#################### Naming ##############################
|
1889
2355
|
|
@@ -1894,16 +2360,19 @@ Naming/AccessorMethodName:
|
|
1894
2360
|
VersionAdded: '0.50'
|
1895
2361
|
|
1896
2362
|
Naming/AsciiIdentifiers:
|
1897
|
-
Description: 'Use only ascii symbols in identifiers.'
|
2363
|
+
Description: 'Use only ascii symbols in identifiers and constants.'
|
1898
2364
|
StyleGuide: '#english-identifiers'
|
1899
2365
|
Enabled: true
|
1900
2366
|
VersionAdded: '0.50'
|
2367
|
+
VersionChanged: '0.87'
|
2368
|
+
AsciiConstants: true
|
1901
2369
|
|
1902
2370
|
Naming/BinaryOperatorParameterName:
|
1903
2371
|
Description: 'When defining binary operators, name the argument other.'
|
1904
2372
|
StyleGuide: '#other-arg'
|
1905
2373
|
Enabled: true
|
1906
2374
|
VersionAdded: '0.50'
|
2375
|
+
VersionChanged: '1.2'
|
1907
2376
|
|
1908
2377
|
Naming/BlockParameterName:
|
1909
2378
|
Description: >-
|
@@ -1925,6 +2394,11 @@ Naming/ClassAndModuleCamelCase:
|
|
1925
2394
|
StyleGuide: '#camelcase-classes'
|
1926
2395
|
Enabled: true
|
1927
2396
|
VersionAdded: '0.50'
|
2397
|
+
VersionChanged: '0.85'
|
2398
|
+
# Allowed class/module names can be specified here.
|
2399
|
+
# These can be full or part of the name.
|
2400
|
+
AllowedNames:
|
2401
|
+
- module_parent
|
1928
2402
|
|
1929
2403
|
Naming/ConstantName:
|
1930
2404
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
@@ -1945,6 +2419,10 @@ Naming/FileName:
|
|
1945
2419
|
# It further expects it to be nested inside modules which match the names
|
1946
2420
|
# of subdirectories in its path.
|
1947
2421
|
ExpectMatchingDefinition: false
|
2422
|
+
# When `false`, changes the behavior of ExpectMatchingDefinition to match only
|
2423
|
+
# whether each source file's class or module name matches the file name --
|
2424
|
+
# not whether the nested module hierarchy matches the subdirectory path.
|
2425
|
+
CheckDefinitionPathHierarchy: true
|
1948
2426
|
# If non-`nil`, expect all source file names to match the following regex.
|
1949
2427
|
# Only the file name itself is matched, not the entire file path.
|
1950
2428
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -2001,6 +2479,7 @@ Naming/HeredocDelimiterCase:
|
|
2001
2479
|
StyleGuide: '#heredoc-delimiters'
|
2002
2480
|
Enabled: true
|
2003
2481
|
VersionAdded: '0.50'
|
2482
|
+
VersionChanged: '1.2'
|
2004
2483
|
EnforcedStyle: uppercase
|
2005
2484
|
SupportedStyles:
|
2006
2485
|
- lowercase
|
@@ -2019,12 +2498,13 @@ Naming/MemoizedInstanceVariableName:
|
|
2019
2498
|
Memoized method name should match memo instance variable name.
|
2020
2499
|
Enabled: true
|
2021
2500
|
VersionAdded: '0.53'
|
2022
|
-
VersionChanged: '
|
2501
|
+
VersionChanged: '1.2'
|
2023
2502
|
EnforcedStyleForLeadingUnderscores: disallowed
|
2024
2503
|
SupportedStylesForLeadingUnderscores:
|
2025
2504
|
- disallowed
|
2026
2505
|
- required
|
2027
2506
|
- optional
|
2507
|
+
Safe: false
|
2028
2508
|
|
2029
2509
|
Naming/MethodName:
|
2030
2510
|
Description: 'Use the configured style when naming methods.'
|
@@ -2055,16 +2535,18 @@ Naming/MethodParameterName:
|
|
2055
2535
|
AllowNamesEndingInNumbers: true
|
2056
2536
|
# Allowed names that will not register an offense
|
2057
2537
|
AllowedNames:
|
2058
|
-
-
|
2059
|
-
- id
|
2060
|
-
- to
|
2538
|
+
- at
|
2061
2539
|
- by
|
2062
|
-
-
|
2540
|
+
- db
|
2541
|
+
- id
|
2063
2542
|
- in
|
2064
|
-
-
|
2543
|
+
- io
|
2065
2544
|
- ip
|
2066
|
-
-
|
2545
|
+
- of
|
2546
|
+
- 'on'
|
2067
2547
|
- os
|
2548
|
+
- pp
|
2549
|
+
- to
|
2068
2550
|
# Forbidden names that will register an offense
|
2069
2551
|
ForbiddenNames: []
|
2070
2552
|
|
@@ -2109,20 +2591,33 @@ Naming/VariableName:
|
|
2109
2591
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
2110
2592
|
Enabled: true
|
2111
2593
|
VersionAdded: '0.50'
|
2594
|
+
VersionChanged: '1.8'
|
2112
2595
|
EnforcedStyle: snake_case
|
2113
2596
|
SupportedStyles:
|
2114
2597
|
- snake_case
|
2115
2598
|
- camelCase
|
2599
|
+
AllowedIdentifiers: []
|
2116
2600
|
|
2117
2601
|
Naming/VariableNumber:
|
2118
|
-
Description: 'Use the configured style when numbering variables.'
|
2602
|
+
Description: 'Use the configured style when numbering symbols, methods and variables.'
|
2603
|
+
StyleGuide: '#snake-case-symbols-methods-vars-with-numbers'
|
2119
2604
|
Enabled: true
|
2120
2605
|
VersionAdded: '0.50'
|
2606
|
+
VersionChanged: '1.4'
|
2121
2607
|
EnforcedStyle: normalcase
|
2122
2608
|
SupportedStyles:
|
2123
2609
|
- snake_case
|
2124
2610
|
- normalcase
|
2125
2611
|
- non_integer
|
2612
|
+
CheckMethodNames: true
|
2613
|
+
CheckSymbols: true
|
2614
|
+
AllowedIdentifiers:
|
2615
|
+
- capture3 # Open3.capture3
|
2616
|
+
- iso8601 # Time#iso8601
|
2617
|
+
- rfc1123_date # CGI.rfc1123_date
|
2618
|
+
- rfc822 # Time#rfc822
|
2619
|
+
- rfc2822 # Time#rfc2822
|
2620
|
+
- rfc3339 # DateTime.rfc3339
|
2126
2621
|
|
2127
2622
|
#################### Security ##############################
|
2128
2623
|
|
@@ -2135,7 +2630,7 @@ Security/JSONLoad:
|
|
2135
2630
|
Description: >-
|
2136
2631
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2137
2632
|
security issues. See reference for more information.
|
2138
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2633
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2139
2634
|
Enabled: true
|
2140
2635
|
VersionAdded: '0.43'
|
2141
2636
|
VersionChanged: '0.44'
|
@@ -2148,21 +2643,22 @@ Security/MarshalLoad:
|
|
2148
2643
|
Description: >-
|
2149
2644
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2150
2645
|
security issues. See reference for more information.
|
2151
|
-
Reference: 'https://ruby-doc.org/core-2.
|
2646
|
+
Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2152
2647
|
Enabled: true
|
2153
2648
|
VersionAdded: '0.47'
|
2154
2649
|
|
2155
2650
|
Security/Open:
|
2156
|
-
Description: 'The use of Kernel#open
|
2651
|
+
Description: 'The use of `Kernel#open` and `URI.open` represent a serious security risk.'
|
2157
2652
|
Enabled: true
|
2158
2653
|
VersionAdded: '0.53'
|
2654
|
+
VersionChanged: '1.0'
|
2159
2655
|
Safe: false
|
2160
2656
|
|
2161
2657
|
Security/YAMLLoad:
|
2162
2658
|
Description: >-
|
2163
2659
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2164
2660
|
security issues. See reference for more information.
|
2165
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2661
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2166
2662
|
Enabled: true
|
2167
2663
|
VersionAdded: '0.47'
|
2168
2664
|
SafeAutoCorrect: false
|
@@ -2173,10 +2669,23 @@ Style/AccessModifierDeclarations:
|
|
2173
2669
|
Description: 'Checks style of how access modifiers are used.'
|
2174
2670
|
Enabled: true
|
2175
2671
|
VersionAdded: '0.57'
|
2672
|
+
VersionChanged: '0.81'
|
2176
2673
|
EnforcedStyle: group
|
2177
2674
|
SupportedStyles:
|
2178
2675
|
- inline
|
2179
2676
|
- group
|
2677
|
+
AllowModifiersOnSymbols: true
|
2678
|
+
|
2679
|
+
Style/AccessorGrouping:
|
2680
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2681
|
+
Enabled: true
|
2682
|
+
VersionAdded: '0.87'
|
2683
|
+
EnforcedStyle: grouped
|
2684
|
+
SupportedStyles:
|
2685
|
+
# separated: each accessor goes in a separate statement.
|
2686
|
+
# grouped: accessors are grouped into a single statement.
|
2687
|
+
- separated
|
2688
|
+
- grouped
|
2180
2689
|
|
2181
2690
|
Style/Alias:
|
2182
2691
|
Description: 'Use alias instead of alias_method.'
|
@@ -2197,11 +2706,27 @@ Style/AndOr:
|
|
2197
2706
|
VersionChanged: '0.25'
|
2198
2707
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2199
2708
|
# or completely (always).
|
2200
|
-
EnforcedStyle:
|
2709
|
+
EnforcedStyle: conditionals
|
2201
2710
|
SupportedStyles:
|
2202
2711
|
- always
|
2203
2712
|
- conditionals
|
2204
2713
|
|
2714
|
+
Style/ArgumentsForwarding:
|
2715
|
+
Description: 'Use arguments forwarding.'
|
2716
|
+
StyleGuide: '#arguments-forwarding'
|
2717
|
+
Enabled: pending
|
2718
|
+
AllowOnlyRestArgument: true
|
2719
|
+
VersionAdded: '1.1'
|
2720
|
+
|
2721
|
+
Style/ArrayCoercion:
|
2722
|
+
Description: >-
|
2723
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
2724
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2725
|
+
StyleGuide: '#array-coercion'
|
2726
|
+
Safe: false
|
2727
|
+
Enabled: false
|
2728
|
+
VersionAdded: '0.88'
|
2729
|
+
|
2205
2730
|
Style/ArrayJoin:
|
2206
2731
|
Description: 'Use Array#join instead of Array#*.'
|
2207
2732
|
StyleGuide: '#array-join'
|
@@ -2215,7 +2740,8 @@ Style/AsciiComments:
|
|
2215
2740
|
Enabled: true
|
2216
2741
|
VersionAdded: '0.9'
|
2217
2742
|
VersionChanged: '0.52'
|
2218
|
-
AllowedChars:
|
2743
|
+
AllowedChars:
|
2744
|
+
- ©
|
2219
2745
|
|
2220
2746
|
Style/Attr:
|
2221
2747
|
Description: 'Checks for uses of Module#attr.'
|
@@ -2245,6 +2771,13 @@ Style/BeginBlock:
|
|
2245
2771
|
Enabled: true
|
2246
2772
|
VersionAdded: '0.9'
|
2247
2773
|
|
2774
|
+
Style/BisectedAttrAccessor:
|
2775
|
+
Description: >-
|
2776
|
+
Checks for places where `attr_reader` and `attr_writer`
|
2777
|
+
for the same method can be combined into single `attr_accessor`.
|
2778
|
+
Enabled: true
|
2779
|
+
VersionAdded: '0.87'
|
2780
|
+
|
2248
2781
|
Style/BlockComments:
|
2249
2782
|
Description: 'Do not use block comments.'
|
2250
2783
|
StyleGuide: '#no-block-comments'
|
@@ -2355,30 +2888,35 @@ Style/BlockDelimiters:
|
|
2355
2888
|
# # also good
|
2356
2889
|
# collection.each do |element| puts element end
|
2357
2890
|
AllowBracesOnProceduralOneLiners: false
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
EnforcedStyle: no_braces
|
2365
|
-
SupportedStyles:
|
2366
|
-
# The `braces` style enforces braces around all method parameters that are
|
2367
|
-
# hashes.
|
2368
|
-
- braces
|
2369
|
-
# The `no_braces` style checks that the last parameter doesn't have braces
|
2370
|
-
# around it.
|
2371
|
-
- no_braces
|
2372
|
-
# The `context_dependent` style checks that the last parameter doesn't have
|
2373
|
-
# braces around it, but requires braces if the second to last parameter is
|
2374
|
-
# also a hash literal.
|
2375
|
-
- context_dependent
|
2891
|
+
# The BracesRequiredMethods overrides all other configurations except
|
2892
|
+
# IgnoredMethods. It can be used to enforce that all blocks for specific
|
2893
|
+
# methods use braces. For example, you can use this to enforce Sorbet
|
2894
|
+
# signatures use braces even when the rest of your codebase enforces
|
2895
|
+
# the `line_count_based` style.
|
2896
|
+
BracesRequiredMethods: []
|
2376
2897
|
|
2377
2898
|
Style/CaseEquality:
|
2378
2899
|
Description: 'Avoid explicit use of the case equality operator(===).'
|
2379
2900
|
StyleGuide: '#no-case-equality'
|
2380
2901
|
Enabled: true
|
2381
2902
|
VersionAdded: '0.9'
|
2903
|
+
VersionChanged: '0.89'
|
2904
|
+
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
2905
|
+
# the case equality operator is a constant.
|
2906
|
+
#
|
2907
|
+
# # bad
|
2908
|
+
# /string/ === "string"
|
2909
|
+
#
|
2910
|
+
# # good
|
2911
|
+
# String === "string"
|
2912
|
+
AllowOnConstant: false
|
2913
|
+
|
2914
|
+
Style/CaseLikeIf:
|
2915
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2916
|
+
StyleGuide: '#case-vs-if-else'
|
2917
|
+
Enabled: true
|
2918
|
+
Safe: false
|
2919
|
+
VersionAdded: '0.88'
|
2382
2920
|
|
2383
2921
|
Style/CharacterLiteral:
|
2384
2922
|
Description: 'Checks for uses of character literals.'
|
@@ -2395,7 +2933,6 @@ Style/ClassAndModuleChildren:
|
|
2395
2933
|
# have the knowledge to perform either operation safely and thus requires
|
2396
2934
|
# manual oversight.
|
2397
2935
|
SafeAutoCorrect: false
|
2398
|
-
AutoCorrect: false
|
2399
2936
|
Enabled: true
|
2400
2937
|
VersionAdded: '0.19'
|
2401
2938
|
#
|
@@ -2419,6 +2956,7 @@ Style/ClassAndModuleChildren:
|
|
2419
2956
|
|
2420
2957
|
Style/ClassCheck:
|
2421
2958
|
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
2959
|
+
StyleGuide: '#is-a-vs-kind-of'
|
2422
2960
|
Enabled: true
|
2423
2961
|
VersionAdded: '0.24'
|
2424
2962
|
EnforcedStyle: is_a?
|
@@ -2426,6 +2964,16 @@ Style/ClassCheck:
|
|
2426
2964
|
- is_a?
|
2427
2965
|
- kind_of?
|
2428
2966
|
|
2967
|
+
Style/ClassEqualityComparison:
|
2968
|
+
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
2969
|
+
StyleGuide: '#instance-of-vs-class-comparison'
|
2970
|
+
Enabled: true
|
2971
|
+
VersionAdded: '0.93'
|
2972
|
+
IgnoredMethods:
|
2973
|
+
- ==
|
2974
|
+
- equal?
|
2975
|
+
- eql?
|
2976
|
+
|
2429
2977
|
Style/ClassMethods:
|
2430
2978
|
Description: 'Use self when defining module/class methods.'
|
2431
2979
|
StyleGuide: '#def-self-class-methods'
|
@@ -2433,19 +2981,36 @@ Style/ClassMethods:
|
|
2433
2981
|
VersionAdded: '0.9'
|
2434
2982
|
VersionChanged: '0.20'
|
2435
2983
|
|
2984
|
+
Style/ClassMethodsDefinitions:
|
2985
|
+
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
2986
|
+
StyleGuide: '#def-self-class-methods'
|
2987
|
+
Enabled: false
|
2988
|
+
VersionAdded: '0.89'
|
2989
|
+
EnforcedStyle: def_self
|
2990
|
+
SupportedStyles:
|
2991
|
+
- def_self
|
2992
|
+
- self_class
|
2993
|
+
|
2436
2994
|
Style/ClassVars:
|
2437
2995
|
Description: 'Avoid the use of class variables.'
|
2438
2996
|
StyleGuide: '#no-class-vars'
|
2439
2997
|
Enabled: true
|
2440
2998
|
VersionAdded: '0.13'
|
2441
2999
|
|
3000
|
+
Style/CollectionCompact:
|
3001
|
+
Description: 'Use `{Array,Hash}#{compact,compact!}` instead of custom logic to reject nils.'
|
3002
|
+
Enabled: pending
|
3003
|
+
Safe: false
|
3004
|
+
VersionAdded: '1.2'
|
3005
|
+
VersionChanged: '1.3'
|
3006
|
+
|
2442
3007
|
# Align with the style guide.
|
2443
3008
|
Style/CollectionMethods:
|
2444
3009
|
Description: 'Preferred collection methods.'
|
2445
|
-
StyleGuide: '#map-find-select-reduce-size'
|
3010
|
+
StyleGuide: '#map-find-select-reduce-include-size'
|
2446
3011
|
Enabled: false
|
2447
3012
|
VersionAdded: '0.9'
|
2448
|
-
VersionChanged: '
|
3013
|
+
VersionChanged: '1.7'
|
2449
3014
|
Safe: false
|
2450
3015
|
# Mapping from undesired method to desired method
|
2451
3016
|
# e.g. to use `detect` over `find`:
|
@@ -2459,6 +3024,12 @@ Style/CollectionMethods:
|
|
2459
3024
|
inject: 'reduce'
|
2460
3025
|
detect: 'find'
|
2461
3026
|
find_all: 'select'
|
3027
|
+
member?: 'include?'
|
3028
|
+
# Methods in this array accept a final symbol as an implicit block
|
3029
|
+
# eg. `inject(:+)`
|
3030
|
+
MethodsAcceptingSymbol:
|
3031
|
+
- inject
|
3032
|
+
- reduce
|
2462
3033
|
|
2463
3034
|
Style/ColonMethodCall:
|
2464
3035
|
Description: 'Do not use :: for method call.'
|
@@ -2472,6 +3043,14 @@ Style/ColonMethodDefinition:
|
|
2472
3043
|
Enabled: true
|
2473
3044
|
VersionAdded: '0.52'
|
2474
3045
|
|
3046
|
+
Style/CombinableLoops:
|
3047
|
+
Description: >-
|
3048
|
+
Checks for places where multiple consecutive loops over the same data
|
3049
|
+
can be combined into a single loop.
|
3050
|
+
Enabled: true
|
3051
|
+
Safe: false
|
3052
|
+
VersionAdded: '0.90'
|
3053
|
+
|
2475
3054
|
Style/CommandLiteral:
|
2476
3055
|
Description: 'Use `` or %x around command literals.'
|
2477
3056
|
StyleGuide: '#percent-x'
|
@@ -2493,22 +3072,24 @@ Style/CommandLiteral:
|
|
2493
3072
|
Style/CommentAnnotation:
|
2494
3073
|
Description: >-
|
2495
3074
|
Checks formatting of special comments
|
2496
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
3075
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE).
|
2497
3076
|
StyleGuide: '#annotate-keywords'
|
2498
3077
|
Enabled: true
|
2499
3078
|
VersionAdded: '0.10'
|
2500
|
-
VersionChanged: '
|
3079
|
+
VersionChanged: '1.3'
|
2501
3080
|
Keywords:
|
2502
3081
|
- TODO
|
2503
3082
|
- FIXME
|
2504
3083
|
- OPTIMIZE
|
2505
3084
|
- HACK
|
2506
3085
|
- REVIEW
|
3086
|
+
- NOTE
|
2507
3087
|
|
2508
3088
|
Style/CommentedKeyword:
|
2509
3089
|
Description: 'Do not place comments on the same line as certain keywords.'
|
2510
3090
|
Enabled: true
|
2511
3091
|
VersionAdded: '0.51'
|
3092
|
+
VersionChanged: '1.7'
|
2512
3093
|
|
2513
3094
|
Style/ConditionalAssignment:
|
2514
3095
|
Description: >-
|
@@ -2537,6 +3118,8 @@ Style/ConstantVisibility:
|
|
2537
3118
|
visibility declarations.
|
2538
3119
|
Enabled: false
|
2539
3120
|
VersionAdded: '0.66'
|
3121
|
+
VersionChanged: '1.10'
|
3122
|
+
IgnoreModules: false
|
2540
3123
|
|
2541
3124
|
# Checks that you have put a copyright in a comment before any code.
|
2542
3125
|
#
|
@@ -2568,7 +3151,8 @@ Style/DateTime:
|
|
2568
3151
|
StyleGuide: '#date--time'
|
2569
3152
|
Enabled: false
|
2570
3153
|
VersionAdded: '0.51'
|
2571
|
-
VersionChanged: '0.
|
3154
|
+
VersionChanged: '0.92'
|
3155
|
+
SafeAutoCorrect: false
|
2572
3156
|
AllowCoercion: false
|
2573
3157
|
|
2574
3158
|
Style/DefWithParentheses:
|
@@ -2585,10 +3169,28 @@ Style/Dir:
|
|
2585
3169
|
Enabled: true
|
2586
3170
|
VersionAdded: '0.50'
|
2587
3171
|
|
3172
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
3173
|
+
Description: >-
|
3174
|
+
Forbids disabling/enabling cops within source code.
|
3175
|
+
Enabled: false
|
3176
|
+
VersionAdded: '0.82'
|
3177
|
+
VersionChanged: '1.9'
|
3178
|
+
AllowedCops: []
|
3179
|
+
|
3180
|
+
Style/DocumentDynamicEvalDefinition:
|
3181
|
+
Description: >-
|
3182
|
+
When using `class_eval` (or other `eval`) with string interpolation,
|
3183
|
+
add a comment block showing its appearance if interpolated.
|
3184
|
+
StyleGuide: '#eval-comment-docs'
|
3185
|
+
Enabled: pending
|
3186
|
+
VersionAdded: '1.1'
|
3187
|
+
VersionChanged: '1.3'
|
3188
|
+
|
2588
3189
|
Style/Documentation:
|
2589
3190
|
Description: 'Document classes and non-namespace modules.'
|
2590
3191
|
Enabled: true
|
2591
3192
|
VersionAdded: '0.9'
|
3193
|
+
AllowedConstants: []
|
2592
3194
|
Exclude:
|
2593
3195
|
- 'spec/**/*'
|
2594
3196
|
- 'test/**/*'
|
@@ -2612,6 +3214,12 @@ Style/DoubleNegation:
|
|
2612
3214
|
StyleGuide: '#no-bang-bang'
|
2613
3215
|
Enabled: true
|
2614
3216
|
VersionAdded: '0.19'
|
3217
|
+
VersionChanged: '1.2'
|
3218
|
+
EnforcedStyle: allowed_in_returns
|
3219
|
+
SafeAutoCorrect: false
|
3220
|
+
SupportedStyles:
|
3221
|
+
- allowed_in_returns
|
3222
|
+
- forbidden
|
2615
3223
|
|
2616
3224
|
Style/EachForSimpleLoop:
|
2617
3225
|
Description: >-
|
@@ -2684,6 +3292,18 @@ Style/EndBlock:
|
|
2684
3292
|
StyleGuide: '#no-END-blocks'
|
2685
3293
|
Enabled: true
|
2686
3294
|
VersionAdded: '0.9'
|
3295
|
+
VersionChanged: '0.81'
|
3296
|
+
|
3297
|
+
Style/EndlessMethod:
|
3298
|
+
Description: 'Avoid the use of multi-lined endless method definitions.'
|
3299
|
+
StyleGuide: '#endless-methods'
|
3300
|
+
Enabled: pending
|
3301
|
+
VersionAdded: '1.8'
|
3302
|
+
EnforcedStyle: allow_single_line
|
3303
|
+
SupportedStyles:
|
3304
|
+
- allow_single_line
|
3305
|
+
- allow_always
|
3306
|
+
- disallow
|
2687
3307
|
|
2688
3308
|
Style/EvalWithLocation:
|
2689
3309
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
@@ -2702,12 +3322,34 @@ Style/ExpandPathArguments:
|
|
2702
3322
|
Enabled: true
|
2703
3323
|
VersionAdded: '0.53'
|
2704
3324
|
|
3325
|
+
Style/ExplicitBlockArgument:
|
3326
|
+
Description: >-
|
3327
|
+
Consider using explicit block argument to avoid writing block literal
|
3328
|
+
that just passes its arguments to another block.
|
3329
|
+
StyleGuide: '#block-argument'
|
3330
|
+
Enabled: true
|
3331
|
+
VersionAdded: '0.89'
|
3332
|
+
VersionChanged: '1.8'
|
3333
|
+
|
3334
|
+
Style/ExponentialNotation:
|
3335
|
+
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
3336
|
+
StyleGuide: '#exponential-notation'
|
3337
|
+
Enabled: true
|
3338
|
+
VersionAdded: '0.82'
|
3339
|
+
EnforcedStyle: scientific
|
3340
|
+
SupportedStyles:
|
3341
|
+
- scientific
|
3342
|
+
- engineering
|
3343
|
+
- integral
|
3344
|
+
|
2705
3345
|
Style/FloatDivision:
|
2706
3346
|
Description: 'For performing float division, coerce one side only.'
|
2707
3347
|
StyleGuide: '#float-division'
|
2708
|
-
Reference: 'https://
|
3348
|
+
Reference: 'https://blog.rubystyle.guide/ruby/2019/06/21/float-division.html'
|
2709
3349
|
Enabled: true
|
2710
3350
|
VersionAdded: '0.72'
|
3351
|
+
VersionChanged: '1.9'
|
3352
|
+
Safe: false
|
2711
3353
|
EnforcedStyle: single_coerce
|
2712
3354
|
SupportedStyles:
|
2713
3355
|
- left_coerce
|
@@ -2749,8 +3391,13 @@ Style/FormatStringToken:
|
|
2749
3391
|
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
2750
3392
|
- template
|
2751
3393
|
- unannotated
|
3394
|
+
# `MaxUnannotatedPlaceholdersAllowed` defines the number of `unannotated`
|
3395
|
+
# style token in a format string to be allowed when enforced style is not
|
3396
|
+
# `unannotated`.
|
3397
|
+
MaxUnannotatedPlaceholdersAllowed: 1
|
2752
3398
|
VersionAdded: '0.49'
|
2753
|
-
VersionChanged: '0
|
3399
|
+
VersionChanged: '1.0'
|
3400
|
+
IgnoredMethods: []
|
2754
3401
|
|
2755
3402
|
Style/FrozenStringLiteralComment:
|
2756
3403
|
Description: >-
|
@@ -2758,17 +3405,28 @@ Style/FrozenStringLiteralComment:
|
|
2758
3405
|
to help transition to frozen string literals by default.
|
2759
3406
|
Enabled: true
|
2760
3407
|
VersionAdded: '0.36'
|
2761
|
-
VersionChanged: '0.
|
3408
|
+
VersionChanged: '0.79'
|
2762
3409
|
EnforcedStyle: always
|
2763
3410
|
SupportedStyles:
|
2764
3411
|
# `always` will always add the frozen string literal comment to a file
|
2765
3412
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
2766
|
-
# string literal.
|
2767
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
3413
|
+
# string literal. It is possible that this will create errors.
|
2768
3414
|
- always
|
3415
|
+
# `always_true` will add the frozen string literal comment to a file,
|
3416
|
+
# similarly to the `always` style, but will also change any disabled
|
3417
|
+
# comments (e.g. `# frozen_string_literal: false`) to be enabled.
|
3418
|
+
- always_true
|
2769
3419
|
# `never` will enforce that the frozen string literal comment does not
|
2770
3420
|
# exist in a file.
|
2771
3421
|
- never
|
3422
|
+
SafeAutoCorrect: false
|
3423
|
+
|
3424
|
+
Style/GlobalStdStream:
|
3425
|
+
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3426
|
+
StyleGuide: '#global-stdout'
|
3427
|
+
Enabled: true
|
3428
|
+
VersionAdded: '0.89'
|
3429
|
+
SafeAutoCorrect: false
|
2772
3430
|
|
2773
3431
|
Style/GlobalVars:
|
2774
3432
|
Description: 'Do not introduce global variables.'
|
@@ -2789,6 +3447,49 @@ Style/GuardClause:
|
|
2789
3447
|
# needs to have to trigger this cop
|
2790
3448
|
MinBodyLength: 1
|
2791
3449
|
|
3450
|
+
Style/HashAsLastArrayItem:
|
3451
|
+
Description: >-
|
3452
|
+
Checks for presence or absence of braces around hash literal as a last
|
3453
|
+
array item depending on configuration.
|
3454
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
3455
|
+
Enabled: true
|
3456
|
+
VersionAdded: '0.88'
|
3457
|
+
EnforcedStyle: braces
|
3458
|
+
SupportedStyles:
|
3459
|
+
- braces
|
3460
|
+
- no_braces
|
3461
|
+
|
3462
|
+
Style/HashConversion:
|
3463
|
+
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3464
|
+
Enabled: pending
|
3465
|
+
VersionAdded: '1.10'
|
3466
|
+
VersionChanged: '1.11'
|
3467
|
+
AllowSplatArgument: true
|
3468
|
+
|
3469
|
+
Style/HashEachMethods:
|
3470
|
+
Description: 'Use Hash#each_key and Hash#each_value.'
|
3471
|
+
StyleGuide: '#hash-each'
|
3472
|
+
Enabled: true
|
3473
|
+
VersionAdded: '0.80'
|
3474
|
+
Safe: false
|
3475
|
+
|
3476
|
+
Style/HashExcept:
|
3477
|
+
Description: >-
|
3478
|
+
Checks for usages of `Hash#reject`, `Hash#select`, and `Hash#filter` methods
|
3479
|
+
that can be replaced with `Hash#except` method.
|
3480
|
+
Enabled: pending
|
3481
|
+
VersionAdded: '1.7'
|
3482
|
+
|
3483
|
+
Style/HashLikeCase:
|
3484
|
+
Description: >-
|
3485
|
+
Checks for places where `case-when` represents a simple 1:1
|
3486
|
+
mapping and can be replaced with a hash lookup.
|
3487
|
+
Enabled: true
|
3488
|
+
VersionAdded: '0.88'
|
3489
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3490
|
+
# to trigger this cop
|
3491
|
+
MinBranchesCount: 3
|
3492
|
+
|
2792
3493
|
Style/HashSyntax:
|
2793
3494
|
Description: >-
|
2794
3495
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -2812,6 +3513,20 @@ Style/HashSyntax:
|
|
2812
3513
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
2813
3514
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
2814
3515
|
|
3516
|
+
Style/HashTransformKeys:
|
3517
|
+
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3518
|
+
Enabled: true
|
3519
|
+
VersionAdded: '0.80'
|
3520
|
+
VersionChanged: '0.90'
|
3521
|
+
Safe: false
|
3522
|
+
|
3523
|
+
Style/HashTransformValues:
|
3524
|
+
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3525
|
+
Enabled: true
|
3526
|
+
VersionAdded: '0.80'
|
3527
|
+
VersionChanged: '0.90'
|
3528
|
+
Safe: false
|
3529
|
+
|
2815
3530
|
Style/IdenticalConditionalBranches:
|
2816
3531
|
Description: >-
|
2817
3532
|
Checks that conditional statements do not have an identical
|
@@ -2825,6 +3540,7 @@ Style/IfInsideElse:
|
|
2825
3540
|
Enabled: true
|
2826
3541
|
AllowIfModifier: false
|
2827
3542
|
VersionAdded: '0.36'
|
3543
|
+
VersionChanged: '1.3'
|
2828
3544
|
|
2829
3545
|
Style/IfUnlessModifier:
|
2830
3546
|
Description: >-
|
@@ -2840,12 +3556,22 @@ Style/IfUnlessModifierOfIfUnless:
|
|
2840
3556
|
Avoid modifier if/unless usage on conditionals.
|
2841
3557
|
Enabled: true
|
2842
3558
|
VersionAdded: '0.39'
|
3559
|
+
VersionChanged: '0.87'
|
3560
|
+
|
3561
|
+
Style/IfWithBooleanLiteralBranches:
|
3562
|
+
Description: 'Checks for redundant `if` with boolean literal branches.'
|
3563
|
+
Enabled: pending
|
3564
|
+
VersionAdded: '1.9'
|
3565
|
+
SafeAutoCorrect: false
|
3566
|
+
AllowedMethods:
|
3567
|
+
- nonzero?
|
2843
3568
|
|
2844
3569
|
Style/IfWithSemicolon:
|
2845
3570
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
2846
3571
|
StyleGuide: '#no-semicolon-ifs'
|
2847
3572
|
Enabled: true
|
2848
3573
|
VersionAdded: '0.9'
|
3574
|
+
VersionChanged: '0.83'
|
2849
3575
|
|
2850
3576
|
Style/ImplicitRuntimeError:
|
2851
3577
|
Description: >-
|
@@ -2855,12 +3581,14 @@ Style/ImplicitRuntimeError:
|
|
2855
3581
|
VersionAdded: '0.41'
|
2856
3582
|
|
2857
3583
|
Style/InfiniteLoop:
|
2858
|
-
Description:
|
3584
|
+
Description: >-
|
3585
|
+
Use Kernel#loop for infinite loops.
|
3586
|
+
This cop is unsafe in the body may raise a `StopIteration` exception.
|
3587
|
+
Safe: false
|
2859
3588
|
StyleGuide: '#infinite-loop'
|
2860
3589
|
Enabled: true
|
2861
3590
|
VersionAdded: '0.26'
|
2862
3591
|
VersionChanged: '0.61'
|
2863
|
-
SafeAutoCorrect: true
|
2864
3592
|
|
2865
3593
|
Style/InlineComment:
|
2866
3594
|
Description: 'Avoid trailing inline comments.'
|
@@ -2898,11 +3626,23 @@ Style/IpAddresses:
|
|
2898
3626
|
Description: "Don't include literal IP addresses in code."
|
2899
3627
|
Enabled: false
|
2900
3628
|
VersionAdded: '0.58'
|
2901
|
-
VersionChanged: '0.
|
3629
|
+
VersionChanged: '0.91'
|
2902
3630
|
# Allow addresses to be permitted
|
2903
3631
|
AllowedAddresses:
|
2904
3632
|
- "::"
|
2905
3633
|
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
3634
|
+
Exclude:
|
3635
|
+
- '**/*.gemfile'
|
3636
|
+
- '**/Gemfile'
|
3637
|
+
- '**/gems.rb'
|
3638
|
+
- '**/*.gemspec'
|
3639
|
+
|
3640
|
+
Style/KeywordParametersOrder:
|
3641
|
+
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3642
|
+
StyleGuide: '#keyword-parameters-order'
|
3643
|
+
Enabled: true
|
3644
|
+
VersionAdded: '0.90'
|
3645
|
+
VersionChanged: '1.7'
|
2906
3646
|
|
2907
3647
|
Style/Lambda:
|
2908
3648
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -2920,7 +3660,7 @@ Style/LambdaCall:
|
|
2920
3660
|
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
2921
3661
|
StyleGuide: '#proc-call'
|
2922
3662
|
Enabled: true
|
2923
|
-
VersionAdded: '0.13
|
3663
|
+
VersionAdded: '0.13'
|
2924
3664
|
VersionChanged: '0.14'
|
2925
3665
|
EnforcedStyle: call
|
2926
3666
|
SupportedStyles:
|
@@ -2941,7 +3681,7 @@ Style/MethodCallWithArgsParentheses:
|
|
2941
3681
|
StyleGuide: '#method-invocation-parens'
|
2942
3682
|
Enabled: false
|
2943
3683
|
VersionAdded: '0.47'
|
2944
|
-
VersionChanged: '
|
3684
|
+
VersionChanged: '1.7'
|
2945
3685
|
IgnoreMacros: true
|
2946
3686
|
IgnoredMethods: []
|
2947
3687
|
IgnoredPatterns: []
|
@@ -2949,6 +3689,7 @@ Style/MethodCallWithArgsParentheses:
|
|
2949
3689
|
AllowParenthesesInMultilineCall: false
|
2950
3690
|
AllowParenthesesInChaining: false
|
2951
3691
|
AllowParenthesesInCamelCaseMethod: false
|
3692
|
+
AllowParenthesesInStringInterpolation: false
|
2952
3693
|
EnforcedStyle: require_parentheses
|
2953
3694
|
SupportedStyles:
|
2954
3695
|
- require_parentheses
|
@@ -2975,19 +3716,13 @@ Style/MethodDefParentheses:
|
|
2975
3716
|
StyleGuide: '#method-parens'
|
2976
3717
|
Enabled: true
|
2977
3718
|
VersionAdded: '0.16'
|
2978
|
-
VersionChanged: '
|
3719
|
+
VersionChanged: '1.7'
|
2979
3720
|
EnforcedStyle: require_parentheses
|
2980
3721
|
SupportedStyles:
|
2981
3722
|
- require_parentheses
|
2982
3723
|
- require_no_parentheses
|
2983
3724
|
- require_no_parentheses_except_multiline
|
2984
3725
|
|
2985
|
-
Style/MethodMissingSuper:
|
2986
|
-
Description: Checks for `method_missing` to call `super`.
|
2987
|
-
StyleGuide: '#no-method-missing'
|
2988
|
-
Enabled: true
|
2989
|
-
VersionAdded: '0.56'
|
2990
|
-
|
2991
3726
|
Style/MinMax:
|
2992
3727
|
Description: >-
|
2993
3728
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
@@ -3050,6 +3785,7 @@ Style/ModuleFunction:
|
|
3050
3785
|
SupportedStyles:
|
3051
3786
|
- module_function
|
3052
3787
|
- extend_self
|
3788
|
+
- forbidden
|
3053
3789
|
Autocorrect: false
|
3054
3790
|
SafeAutoCorrect: false
|
3055
3791
|
|
@@ -3086,6 +3822,7 @@ Style/MultilineMethodSignature:
|
|
3086
3822
|
Description: 'Avoid multi-line method signatures.'
|
3087
3823
|
Enabled: false
|
3088
3824
|
VersionAdded: '0.59'
|
3825
|
+
VersionChanged: '1.7'
|
3089
3826
|
|
3090
3827
|
Style/MultilineTernaryOperator:
|
3091
3828
|
Description: >-
|
@@ -3094,6 +3831,7 @@ Style/MultilineTernaryOperator:
|
|
3094
3831
|
StyleGuide: '#no-multiline-ternary'
|
3095
3832
|
Enabled: true
|
3096
3833
|
VersionAdded: '0.9'
|
3834
|
+
VersionChanged: '0.86'
|
3097
3835
|
|
3098
3836
|
Style/MultilineWhenThen:
|
3099
3837
|
Description: 'Do not use then for multi-line when statement.'
|
@@ -3107,12 +3845,14 @@ Style/MultipleComparison:
|
|
3107
3845
|
use Array#include? instead.
|
3108
3846
|
Enabled: true
|
3109
3847
|
VersionAdded: '0.49'
|
3848
|
+
VersionChanged: '1.1'
|
3110
3849
|
|
3111
3850
|
Style/MutableConstant:
|
3112
3851
|
Description: 'Do not assign mutable objects to constants.'
|
3113
3852
|
Enabled: true
|
3114
3853
|
VersionAdded: '0.34'
|
3115
|
-
VersionChanged: '
|
3854
|
+
VersionChanged: '1.8'
|
3855
|
+
SafeAutoCorrect: false
|
3116
3856
|
EnforcedStyle: literals
|
3117
3857
|
SupportedStyles:
|
3118
3858
|
# literals: freeze literals assigned to constants
|
@@ -3141,6 +3881,13 @@ Style/NegatedIf:
|
|
3141
3881
|
- prefix
|
3142
3882
|
- postfix
|
3143
3883
|
|
3884
|
+
Style/NegatedIfElseCondition:
|
3885
|
+
Description: >-
|
3886
|
+
This cop checks for uses of `if-else` and ternary operators with a negated condition
|
3887
|
+
which can be simplified by inverting condition and swapping branches.
|
3888
|
+
Enabled: pending
|
3889
|
+
VersionAdded: '1.2'
|
3890
|
+
|
3144
3891
|
Style/NegatedUnless:
|
3145
3892
|
Description: 'Favor if over unless for negative conditions.'
|
3146
3893
|
StyleGuide: '#if-for-negatives'
|
@@ -3198,6 +3945,7 @@ Style/NestedTernaryOperator:
|
|
3198
3945
|
StyleGuide: '#no-nested-ternary'
|
3199
3946
|
Enabled: true
|
3200
3947
|
VersionAdded: '0.9'
|
3948
|
+
VersionChanged: '0.86'
|
3201
3949
|
|
3202
3950
|
Style/Next:
|
3203
3951
|
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
@@ -3227,6 +3975,11 @@ Style/NilComparison:
|
|
3227
3975
|
- predicate
|
3228
3976
|
- comparison
|
3229
3977
|
|
3978
|
+
Style/NilLambda:
|
3979
|
+
Description: 'Prefer `-> {}` to `-> { nil }`.'
|
3980
|
+
Enabled: pending
|
3981
|
+
VersionAdded: '1.3'
|
3982
|
+
|
3230
3983
|
Style/NonNilCheck:
|
3231
3984
|
Description: 'Checks for redundant nil checks.'
|
3232
3985
|
StyleGuide: '#no-non-nil-checks'
|
@@ -3280,7 +4033,6 @@ Style/NumericPredicate:
|
|
3280
4033
|
# object. Switching these methods has to be done with knowledge of the types
|
3281
4034
|
# of the variables which rubocop doesn't have.
|
3282
4035
|
SafeAutoCorrect: false
|
3283
|
-
AutoCorrect: false
|
3284
4036
|
Enabled: true
|
3285
4037
|
VersionAdded: '0.42'
|
3286
4038
|
VersionChanged: '0.59'
|
@@ -3296,12 +4048,13 @@ Style/NumericPredicate:
|
|
3296
4048
|
|
3297
4049
|
Style/OneLineConditional:
|
3298
4050
|
Description: >-
|
3299
|
-
Favor the ternary operator(?:) over
|
3300
|
-
if/then/else/end constructs.
|
4051
|
+
Favor the ternary operator (?:) or multi-line constructs over
|
4052
|
+
single-line if/then/else/end constructs.
|
3301
4053
|
StyleGuide: '#ternary-operator'
|
3302
4054
|
Enabled: true
|
4055
|
+
AlwaysCorrectToMultiline: false
|
3303
4056
|
VersionAdded: '0.9'
|
3304
|
-
VersionChanged: '0.
|
4057
|
+
VersionChanged: '0.90'
|
3305
4058
|
|
3306
4059
|
Style/OptionHash:
|
3307
4060
|
Description: "Don't use option hashes when you can use keyword arguments."
|
@@ -3322,7 +4075,18 @@ Style/OptionalArguments:
|
|
3322
4075
|
of the argument list.
|
3323
4076
|
StyleGuide: '#optional-arguments'
|
3324
4077
|
Enabled: true
|
4078
|
+
Safe: false
|
3325
4079
|
VersionAdded: '0.33'
|
4080
|
+
VersionChanged: '0.83'
|
4081
|
+
|
4082
|
+
Style/OptionalBooleanParameter:
|
4083
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
4084
|
+
StyleGuide: '#boolean-keyword-arguments'
|
4085
|
+
Enabled: true
|
4086
|
+
Safe: false
|
4087
|
+
VersionAdded: '0.89'
|
4088
|
+
AllowedMethods:
|
4089
|
+
- respond_to_missing?
|
3326
4090
|
|
3327
4091
|
Style/OrAssignment:
|
3328
4092
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
@@ -3365,7 +4129,7 @@ Style/PercentLiteralDelimiters:
|
|
3365
4129
|
'%r': '{}'
|
3366
4130
|
'%w': '[]'
|
3367
4131
|
'%W': '[]'
|
3368
|
-
VersionChanged: '0.48
|
4132
|
+
VersionChanged: '0.48'
|
3369
4133
|
|
3370
4134
|
Style/PercentQLiterals:
|
3371
4135
|
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
@@ -3406,11 +4170,12 @@ Style/RaiseArgs:
|
|
3406
4170
|
StyleGuide: '#exception-class-messages'
|
3407
4171
|
Enabled: true
|
3408
4172
|
VersionAdded: '0.14'
|
3409
|
-
VersionChanged: '
|
4173
|
+
VersionChanged: '1.2'
|
3410
4174
|
EnforcedStyle: exploded
|
3411
4175
|
SupportedStyles:
|
3412
4176
|
- compact # raise Exception.new(msg)
|
3413
4177
|
- exploded # raise Exception, msg
|
4178
|
+
AllowedCompactTypes: []
|
3414
4179
|
|
3415
4180
|
Style/RandomWithOffset:
|
3416
4181
|
Description: >-
|
@@ -3420,6 +4185,27 @@ Style/RandomWithOffset:
|
|
3420
4185
|
Enabled: true
|
3421
4186
|
VersionAdded: '0.52'
|
3422
4187
|
|
4188
|
+
Style/RedundantArgument:
|
4189
|
+
Description: 'Check for a redundant argument passed to certain methods.'
|
4190
|
+
Enabled: pending
|
4191
|
+
Safe: false
|
4192
|
+
VersionAdded: '1.4'
|
4193
|
+
VersionChanged: '1.7'
|
4194
|
+
Methods:
|
4195
|
+
# Array#join
|
4196
|
+
join: ''
|
4197
|
+
# String#split
|
4198
|
+
split: ' '
|
4199
|
+
# String#chomp
|
4200
|
+
chomp: "\n"
|
4201
|
+
# String#chomp!
|
4202
|
+
chomp!: "\n"
|
4203
|
+
|
4204
|
+
Style/RedundantAssignment:
|
4205
|
+
Description: 'Checks for redundant assignment before returning.'
|
4206
|
+
Enabled: true
|
4207
|
+
VersionAdded: '0.87'
|
4208
|
+
|
3423
4209
|
Style/RedundantBegin:
|
3424
4210
|
Description: "Don't use begin blocks when they are not needed."
|
3425
4211
|
StyleGuide: '#begin-implicit'
|
@@ -3449,6 +4235,27 @@ Style/RedundantException:
|
|
3449
4235
|
VersionAdded: '0.14'
|
3450
4236
|
VersionChanged: '0.29'
|
3451
4237
|
|
4238
|
+
Style/RedundantFetchBlock:
|
4239
|
+
Description: >-
|
4240
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
4241
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
4242
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
4243
|
+
Enabled: true
|
4244
|
+
Safe: false
|
4245
|
+
# If enabled, this cop will autocorrect usages of
|
4246
|
+
# `fetch` being called with block returning a constant.
|
4247
|
+
# This can be dangerous since constants will not be defined at that moment.
|
4248
|
+
SafeForConstants: false
|
4249
|
+
VersionAdded: '0.86'
|
4250
|
+
|
4251
|
+
Style/RedundantFileExtensionInRequire:
|
4252
|
+
Description: >-
|
4253
|
+
Checks for the presence of superfluous `.rb` extension in
|
4254
|
+
the filename provided to `require` and `require_relative`.
|
4255
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
4256
|
+
Enabled: true
|
4257
|
+
VersionAdded: '0.88'
|
4258
|
+
|
3452
4259
|
Style/RedundantFreeze:
|
3453
4260
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3454
4261
|
Enabled: true
|
@@ -3471,6 +4278,16 @@ Style/RedundantPercentQ:
|
|
3471
4278
|
Enabled: true
|
3472
4279
|
VersionAdded: '0.76'
|
3473
4280
|
|
4281
|
+
Style/RedundantRegexpCharacterClass:
|
4282
|
+
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
4283
|
+
Enabled: true
|
4284
|
+
VersionAdded: '0.85'
|
4285
|
+
|
4286
|
+
Style/RedundantRegexpEscape:
|
4287
|
+
Description: 'Checks for redundant escapes in Regexps.'
|
4288
|
+
Enabled: true
|
4289
|
+
VersionAdded: '0.85'
|
4290
|
+
|
3474
4291
|
Style/RedundantReturn:
|
3475
4292
|
Description: "Don't use return where it's not required."
|
3476
4293
|
StyleGuide: '#no-explicit-return'
|
@@ -3487,6 +4304,12 @@ Style/RedundantSelf:
|
|
3487
4304
|
VersionAdded: '0.10'
|
3488
4305
|
VersionChanged: '0.13'
|
3489
4306
|
|
4307
|
+
Style/RedundantSelfAssignment:
|
4308
|
+
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
4309
|
+
Enabled: true
|
4310
|
+
Safe: false
|
4311
|
+
VersionAdded: '0.90'
|
4312
|
+
|
3490
4313
|
Style/RedundantSort:
|
3491
4314
|
Description: >-
|
3492
4315
|
Use `min` instead of `sort.first`,
|
@@ -3549,6 +4372,8 @@ Style/SafeNavigation:
|
|
3549
4372
|
This cop transforms usages of a method call safeguarded by
|
3550
4373
|
a check for the existence of the object to
|
3551
4374
|
safe navigation (`&.`).
|
4375
|
+
Auto-correction is unsafe as it assumes the object will
|
4376
|
+
be `nil` or truthy, but never `false`.
|
3552
4377
|
Enabled: true
|
3553
4378
|
VersionAdded: '0.43'
|
3554
4379
|
VersionChanged: '0.77'
|
@@ -3561,6 +4386,7 @@ Style/SafeNavigation:
|
|
3561
4386
|
- presence
|
3562
4387
|
- try
|
3563
4388
|
- try!
|
4389
|
+
SafeAutoCorrect: false
|
3564
4390
|
|
3565
4391
|
Style/Sample:
|
3566
4392
|
Description: >-
|
@@ -3606,11 +4432,17 @@ Style/SignalException:
|
|
3606
4432
|
- only_fail
|
3607
4433
|
- semantic
|
3608
4434
|
|
4435
|
+
Style/SingleArgumentDig:
|
4436
|
+
Description: 'Avoid using single argument dig method.'
|
4437
|
+
Enabled: true
|
4438
|
+
VersionAdded: '0.89'
|
4439
|
+
Safe: false
|
4440
|
+
|
3609
4441
|
Style/SingleLineBlockParams:
|
3610
4442
|
Description: 'Enforces the names of some block params.'
|
3611
4443
|
Enabled: false
|
3612
4444
|
VersionAdded: '0.16'
|
3613
|
-
VersionChanged: '
|
4445
|
+
VersionChanged: '1.6'
|
3614
4446
|
Methods:
|
3615
4447
|
- reduce:
|
3616
4448
|
- acc
|
@@ -3624,9 +4456,24 @@ Style/SingleLineMethods:
|
|
3624
4456
|
StyleGuide: '#no-single-line-methods'
|
3625
4457
|
Enabled: true
|
3626
4458
|
VersionAdded: '0.9'
|
3627
|
-
VersionChanged: '
|
4459
|
+
VersionChanged: '1.8'
|
3628
4460
|
AllowIfMethodIsEmpty: true
|
3629
4461
|
|
4462
|
+
Style/SlicingWithRange:
|
4463
|
+
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
4464
|
+
Enabled: true
|
4465
|
+
VersionAdded: '0.83'
|
4466
|
+
Safe: false
|
4467
|
+
|
4468
|
+
Style/SoleNestedConditional:
|
4469
|
+
Description: >-
|
4470
|
+
Finds sole nested conditional nodes
|
4471
|
+
which can be merged into outer conditional node.
|
4472
|
+
Enabled: true
|
4473
|
+
VersionAdded: '0.89'
|
4474
|
+
VersionChanged: '1.5'
|
4475
|
+
AllowModifier: false
|
4476
|
+
|
3630
4477
|
Style/SpecialGlobalVars:
|
3631
4478
|
Description: 'Avoid Perl-style global variables.'
|
3632
4479
|
StyleGuide: '#no-cryptic-perlisms'
|
@@ -3649,12 +4496,34 @@ Style/StabbyLambdaParentheses:
|
|
3649
4496
|
- require_parentheses
|
3650
4497
|
- require_no_parentheses
|
3651
4498
|
|
4499
|
+
Style/StaticClass:
|
4500
|
+
Description: 'Prefer modules to classes with only class methods.'
|
4501
|
+
StyleGuide: '#modules-vs-classes'
|
4502
|
+
Enabled: false
|
4503
|
+
Safe: false
|
4504
|
+
VersionAdded: '1.3'
|
4505
|
+
|
3652
4506
|
Style/StderrPuts:
|
3653
4507
|
Description: 'Use `warn` instead of `$stderr.puts`.'
|
3654
4508
|
StyleGuide: '#warn'
|
3655
4509
|
Enabled: true
|
3656
4510
|
VersionAdded: '0.51'
|
3657
4511
|
|
4512
|
+
Style/StringChars:
|
4513
|
+
Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
|
4514
|
+
StyleGuide: '#string-chars'
|
4515
|
+
Enabled: pending
|
4516
|
+
Safe: false
|
4517
|
+
VersionAdded: '1.12'
|
4518
|
+
|
4519
|
+
Style/StringConcatenation:
|
4520
|
+
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4521
|
+
StyleGuide: '#string-interpolation'
|
4522
|
+
Enabled: true
|
4523
|
+
Safe: false
|
4524
|
+
VersionAdded: '0.89'
|
4525
|
+
VersionChanged: '1.6'
|
4526
|
+
|
3658
4527
|
Style/StringHashKeys:
|
3659
4528
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
3660
4529
|
StyleGuide: '#symbols-as-keys'
|
@@ -3692,7 +4561,7 @@ Style/StringMethods:
|
|
3692
4561
|
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
3693
4562
|
Enabled: false
|
3694
4563
|
VersionAdded: '0.34'
|
3695
|
-
VersionChanged: '0.34
|
4564
|
+
VersionChanged: '0.34'
|
3696
4565
|
# Mapping from undesired method to desired_method
|
3697
4566
|
# e.g. to use `to_sym` over `intern`:
|
3698
4567
|
#
|
@@ -3712,6 +4581,14 @@ Style/StructInheritance:
|
|
3712
4581
|
StyleGuide: '#no-extend-struct-new'
|
3713
4582
|
Enabled: true
|
3714
4583
|
VersionAdded: '0.29'
|
4584
|
+
VersionChanged: '0.86'
|
4585
|
+
|
4586
|
+
Style/SwapValues:
|
4587
|
+
Description: 'This cop enforces the use of shorthand-style swapping of 2 variables.'
|
4588
|
+
StyleGuide: '#values-swapping'
|
4589
|
+
Enabled: pending
|
4590
|
+
VersionAdded: '1.1'
|
4591
|
+
SafeAutoCorrect: false
|
3715
4592
|
|
3716
4593
|
Style/SymbolArray:
|
3717
4594
|
Description: 'Use %i or %I for arrays of symbols.'
|
@@ -3733,9 +4610,10 @@ Style/SymbolLiteral:
|
|
3733
4610
|
Style/SymbolProc:
|
3734
4611
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
3735
4612
|
Enabled: true
|
3736
|
-
|
4613
|
+
Safe: false
|
3737
4614
|
VersionAdded: '0.26'
|
3738
|
-
VersionChanged: '
|
4615
|
+
VersionChanged: '1.5'
|
4616
|
+
AllowMethodsWithArguments: false
|
3739
4617
|
# A list of method names to be ignored by the check.
|
3740
4618
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
3741
4619
|
IgnoredMethods:
|
@@ -3789,22 +4667,29 @@ Style/TrailingCommaInArrayLiteral:
|
|
3789
4667
|
StyleGuide: '#no-trailing-array-commas'
|
3790
4668
|
Enabled: true
|
3791
4669
|
VersionAdded: '0.53'
|
4670
|
+
# If `comma`, the cop requires a comma after the last item in an array,
|
3792
4671
|
# but only when each item is on its own line.
|
3793
4672
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
3794
|
-
# non-empty array literals.
|
4673
|
+
# non-empty, multiline array literals.
|
3795
4674
|
EnforcedStyleForMultiline: no_comma
|
3796
4675
|
SupportedStylesForMultiline:
|
3797
4676
|
- comma
|
3798
4677
|
- consistent_comma
|
3799
4678
|
- no_comma
|
3800
4679
|
|
4680
|
+
Style/TrailingCommaInBlockArgs:
|
4681
|
+
Description: 'Checks for useless trailing commas in block arguments.'
|
4682
|
+
Enabled: false
|
4683
|
+
Safe: false
|
4684
|
+
VersionAdded: '0.81'
|
4685
|
+
|
3801
4686
|
Style/TrailingCommaInHashLiteral:
|
3802
4687
|
Description: 'Checks for trailing comma in hash literals.'
|
3803
4688
|
Enabled: true
|
3804
4689
|
# If `comma`, the cop requires a comma after the last item in a hash,
|
3805
4690
|
# but only when each item is on its own line.
|
3806
4691
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
3807
|
-
# non-empty hash literals.
|
4692
|
+
# non-empty, multiline hash literals.
|
3808
4693
|
EnforcedStyleForMultiline: no_comma
|
3809
4694
|
SupportedStylesForMultiline:
|
3810
4695
|
- comma
|
@@ -3881,6 +4766,16 @@ Style/UnlessElse:
|
|
3881
4766
|
Enabled: true
|
3882
4767
|
VersionAdded: '0.9'
|
3883
4768
|
|
4769
|
+
Style/UnlessLogicalOperators:
|
4770
|
+
Description: >-
|
4771
|
+
Checks for use of logical operators in an unless condition.
|
4772
|
+
Enabled: false
|
4773
|
+
VersionAdded: '1.11'
|
4774
|
+
EnforcedStyle: forbid_mixed_logical_operators
|
4775
|
+
SupportedStyles:
|
4776
|
+
- forbid_mixed_logical_operators
|
4777
|
+
- forbid_logical_operators
|
4778
|
+
|
3884
4779
|
Style/UnpackFirst:
|
3885
4780
|
Description: >-
|
3886
4781
|
Checks for accessing the first element of `String#unpack`
|