rubocop 0.75.1 → 0.93.1
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 +31 -23
- data/bin/rubocop-profile +32 -0
- data/config/default.yml +940 -401
- data/lib/rubocop.rb +130 -94
- data/lib/rubocop/ast_aliases.rb +8 -0
- data/lib/rubocop/cached_data.rb +3 -1
- data/lib/rubocop/cli.rb +20 -232
- data/lib/rubocop/cli/command.rb +22 -0
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +141 -0
- data/lib/rubocop/cli/command/base.rb +35 -0
- data/lib/rubocop/cli/command/execute_runner.rb +85 -0
- data/lib/rubocop/cli/command/init_dotfile.rb +46 -0
- data/lib/rubocop/cli/command/show_cops.rb +77 -0
- data/lib/rubocop/cli/command/version.rb +18 -0
- data/lib/rubocop/cli/environment.rb +22 -0
- data/lib/rubocop/comment_config.rb +26 -14
- data/lib/rubocop/config.rb +68 -14
- data/lib/rubocop/config_loader.rb +89 -102
- data/lib/rubocop/config_loader_resolver.rb +51 -10
- data/lib/rubocop/config_obsoletion.rb +81 -11
- data/lib/rubocop/config_regeneration.rb +33 -0
- data/lib/rubocop/config_store.rb +19 -5
- data/lib/rubocop/config_validator.rb +98 -113
- data/lib/rubocop/cop/autocorrect_logic.rb +21 -29
- data/lib/rubocop/cop/badge.rb +6 -6
- data/lib/rubocop/cop/base.rb +430 -0
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +5 -1
- data/lib/rubocop/cop/bundler/gem_comment.rb +82 -8
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +14 -22
- data/lib/rubocop/cop/commissioner.rb +84 -60
- data/lib/rubocop/cop/cop.rb +91 -202
- data/lib/rubocop/cop/corrector.rb +69 -121
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +7 -11
- data/lib/rubocop/cop/correctors/condition_corrector.rb +3 -6
- data/lib/rubocop/cop/correctors/empty_line_corrector.rb +9 -10
- data/lib/rubocop/cop/correctors/lambda_literal_to_method_corrector.rb +4 -4
- data/lib/rubocop/cop/correctors/line_break_corrector.rb +10 -10
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +34 -3
- data/lib/rubocop/cop/correctors/parentheses_corrector.rb +5 -8
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +6 -11
- data/lib/rubocop/cop/correctors/punctuation_corrector.rb +8 -10
- data/lib/rubocop/cop/correctors/space_corrector.rb +2 -5
- data/lib/rubocop/cop/correctors/string_literal_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +15 -18
- data/lib/rubocop/cop/documentation.rb +22 -0
- data/lib/rubocop/cop/force.rb +1 -0
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +2 -4
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +42 -16
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +1 -1
- data/lib/rubocop/cop/generator.rb +9 -8
- data/lib/rubocop/cop/generator/configuration_injector.rb +5 -5
- data/lib/rubocop/cop/ignored_node.rb +1 -3
- data/lib/rubocop/cop/internal_affairs.rb +1 -0
- data/lib/rubocop/cop/internal_affairs/method_name_equal.rb +52 -0
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +12 -14
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +9 -8
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +11 -7
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +8 -8
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -2
- data/lib/rubocop/cop/layout/{align_arguments.rb → argument_alignment.rb} +1 -1
- data/lib/rubocop/cop/layout/array_alignment.rb +83 -0
- data/lib/rubocop/cop/layout/{indent_assignment.rb → assignment_indentation.rb} +1 -1
- data/lib/rubocop/cop/layout/begin_end_alignment.rb +77 -0
- data/lib/rubocop/cop/layout/block_alignment.rb +24 -20
- data/lib/rubocop/cop/layout/block_end_newline.rb +5 -3
- data/lib/rubocop/cop/layout/case_indentation.rb +21 -25
- data/lib/rubocop/cop/layout/class_structure.rb +35 -70
- data/lib/rubocop/cop/layout/closing_heredoc_indentation.rb +4 -6
- data/lib/rubocop/cop/layout/comment_indentation.rb +14 -17
- data/lib/rubocop/cop/layout/condition_position.rb +16 -8
- data/lib/rubocop/cop/layout/def_end_alignment.rb +8 -5
- data/lib/rubocop/cop/layout/dot_position.rb +21 -20
- data/lib/rubocop/cop/layout/else_alignment.rb +8 -0
- data/lib/rubocop/cop/layout/empty_comment.rb +38 -40
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +21 -18
- 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 +22 -23
- data/lib/rubocop/cop/layout/empty_lines.rb +6 -9
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +20 -20
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +7 -8
- 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 +3 -7
- 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 +14 -19
- data/lib/rubocop/cop/layout/end_of_line.rb +11 -6
- data/lib/rubocop/cop/layout/extra_spacing.rb +23 -37
- data/lib/rubocop/cop/layout/{indent_first_argument.rb → first_argument_indentation.rb} +17 -13
- data/lib/rubocop/cop/layout/{indent_first_array_element.rb → first_array_element_indentation.rb} +18 -14
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +3 -6
- data/lib/rubocop/cop/layout/{indent_first_hash_element.rb → first_hash_element_indentation.rb} +5 -5
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +2 -5
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +5 -11
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +2 -5
- data/lib/rubocop/cop/layout/{indent_first_parameter.rb → first_parameter_indentation.rb} +5 -5
- data/lib/rubocop/cop/layout/{align_hash.rb → hash_alignment.rb} +39 -35
- data/lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb +18 -21
- data/lib/rubocop/cop/layout/heredoc_indentation.rb +176 -0
- data/lib/rubocop/cop/layout/{tab.rb → indentation_style.rb} +48 -8
- data/lib/rubocop/cop/layout/indentation_width.rb +1 -3
- data/lib/rubocop/cop/layout/initial_indentation.rb +6 -7
- data/lib/rubocop/cop/layout/leading_comment_space.rb +46 -13
- data/lib/rubocop/cop/layout/{leading_blank_lines.rb → leading_empty_lines.rb} +6 -11
- data/lib/rubocop/cop/{metrics → layout}/line_length.rb +78 -119
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +11 -15
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +50 -29
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +2 -9
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +6 -12
- data/lib/rubocop/cop/layout/multiline_method_call_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +2 -5
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +13 -4
- data/lib/rubocop/cop/layout/{align_parameters.rb → parameter_alignment.rb} +1 -1
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +41 -22
- data/lib/rubocop/cop/layout/space_after_colon.rb +12 -8
- data/lib/rubocop/cop/layout/space_after_comma.rb +2 -5
- data/lib/rubocop/cop/layout/space_after_method_name.rb +5 -6
- 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 +22 -27
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +17 -21
- data/lib/rubocop/cop/layout/space_around_keyword.rb +31 -20
- data/lib/rubocop/cop/layout/space_around_method_call_operator.rb +98 -0
- data/lib/rubocop/cop/layout/space_around_operators.rb +82 -21
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +54 -22
- data/lib/rubocop/cop/layout/space_before_comma.rb +3 -5
- data/lib/rubocop/cop/layout/space_before_comment.rb +9 -8
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +15 -7
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +2 -5
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +17 -23
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +32 -33
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -8
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +16 -19
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +21 -46
- data/lib/rubocop/cop/layout/space_inside_parens.rb +15 -20
- 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 +17 -27
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +12 -13
- data/lib/rubocop/cop/layout/{trailing_blank_lines.rb → trailing_empty_lines.rb} +10 -15
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +28 -12
- data/lib/rubocop/cop/legacy/corrections_proxy.rb +49 -0
- data/lib/rubocop/cop/legacy/corrector.rb +29 -0
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +9 -4
- data/lib/rubocop/cop/lint/ambiguous_operator.rb +53 -5
- data/lib/rubocop/cop/lint/ambiguous_regexp_literal.rb +35 -6
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +2 -2
- data/lib/rubocop/cop/lint/big_decimal_new.rb +9 -10
- data/lib/rubocop/cop/lint/binary_operator_with_identical_operands.rb +50 -0
- data/lib/rubocop/cop/lint/boolean_symbol.rb +22 -2
- data/lib/rubocop/cop/lint/circular_argument_reference.rb +1 -1
- data/lib/rubocop/cop/lint/constant_definition_in_block.rb +74 -0
- data/lib/rubocop/cop/lint/constant_resolution.rb +89 -0
- data/lib/rubocop/cop/lint/debugger.rb +8 -3
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +7 -10
- data/lib/rubocop/cop/lint/deprecated_open_ssl_constant.rb +141 -0
- data/lib/rubocop/cop/lint/disjunctive_assignment_in_constructor.rb +9 -3
- data/lib/rubocop/cop/lint/duplicate_case_condition.rb +1 -1
- data/lib/rubocop/cop/lint/duplicate_elsif_condition.rb +39 -0
- data/lib/rubocop/cop/lint/{duplicated_key.rb → duplicate_hash_key.rb} +1 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +8 -11
- data/lib/rubocop/cop/lint/duplicate_require.rb +46 -0
- data/lib/rubocop/cop/lint/duplicate_rescue_exception.rb +47 -0
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +3 -2
- data/lib/rubocop/cop/lint/else_layout.rb +1 -1
- data/lib/rubocop/cop/lint/empty_conditional_body.rb +67 -0
- data/lib/rubocop/cop/lint/empty_ensure.rb +5 -5
- data/lib/rubocop/cop/lint/empty_expression.rb +2 -2
- data/lib/rubocop/cop/lint/empty_file.rb +50 -0
- data/lib/rubocop/cop/lint/empty_interpolation.rb +5 -6
- data/lib/rubocop/cop/lint/empty_when.rb +31 -8
- data/lib/rubocop/cop/lint/ensure_return.rb +29 -14
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +21 -19
- data/lib/rubocop/cop/lint/flip_flop.rb +1 -1
- data/lib/rubocop/cop/lint/float_comparison.rb +93 -0
- data/lib/rubocop/cop/lint/float_out_of_range.rb +2 -2
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +41 -4
- data/lib/rubocop/cop/lint/hash_compare_by_identity.rb +37 -0
- data/lib/rubocop/cop/lint/heredoc_method_call_position.rb +13 -14
- data/lib/rubocop/cop/lint/identity_comparison.rb +51 -0
- data/lib/rubocop/cop/lint/implicit_string_concatenation.rb +6 -5
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +11 -14
- data/lib/rubocop/cop/lint/inherit_exception.rb +12 -7
- data/lib/rubocop/cop/lint/interpolation_check.rb +21 -5
- data/lib/rubocop/cop/lint/literal_as_condition.rb +24 -15
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +7 -7
- data/lib/rubocop/cop/lint/loop.rb +30 -7
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +8 -7
- data/lib/rubocop/cop/lint/missing_super.rb +99 -0
- data/lib/rubocop/cop/lint/mixed_regexp_capture_types.rb +37 -0
- data/lib/rubocop/cop/lint/{multiple_compare.rb → multiple_comparison.rb} +10 -11
- data/lib/rubocop/cop/lint/nested_method_definition.rb +17 -23
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +2 -2
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/non_deterministic_require_order.rb +160 -0
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +9 -9
- data/lib/rubocop/cop/lint/number_conversion.rb +7 -9
- data/lib/rubocop/cop/lint/ordered_magic_comments.rb +11 -13
- data/lib/rubocop/cop/lint/out_of_range_regexp_ref.rb +79 -0
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +33 -12
- data/lib/rubocop/cop/lint/percent_string_array.rb +6 -11
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +14 -13
- data/lib/rubocop/cop/lint/raise_exception.rb +86 -0
- data/lib/rubocop/cop/lint/rand_one.rb +3 -2
- data/lib/rubocop/cop/lint/{unneeded_cop_disable_directive.rb → redundant_cop_disable_directive.rb} +84 -76
- data/lib/rubocop/cop/lint/{unneeded_cop_enable_directive.rb → redundant_cop_enable_directive.rb} +37 -28
- data/lib/rubocop/cop/lint/{unneeded_require_statement.rb → redundant_require_statement.rb} +8 -10
- data/lib/rubocop/cop/lint/redundant_safe_navigation.rb +78 -0
- data/lib/rubocop/cop/lint/{unneeded_splat_expansion.rb → redundant_splat_expansion.rb} +20 -16
- data/lib/rubocop/cop/lint/{string_conversion_in_interpolation.rb → redundant_string_coercion.rb} +6 -13
- data/lib/rubocop/cop/lint/redundant_with_index.rb +12 -15
- data/lib/rubocop/cop/lint/redundant_with_object.rb +12 -15
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +6 -2
- data/lib/rubocop/cop/lint/require_parentheses.rb +2 -2
- data/lib/rubocop/cop/lint/rescue_exception.rb +2 -2
- data/lib/rubocop/cop/lint/rescue_type.rb +8 -9
- data/lib/rubocop/cop/lint/return_in_void_context.rb +2 -4
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +7 -11
- data/lib/rubocop/cop/lint/safe_navigation_consistency.rb +14 -10
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +10 -2
- 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 +8 -12
- data/lib/rubocop/cop/lint/shadowed_argument.rb +3 -3
- data/lib/rubocop/cop/lint/shadowed_exception.rb +8 -8
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +7 -7
- data/lib/rubocop/cop/lint/struct_new_override.rb +59 -0
- data/lib/rubocop/cop/lint/{handle_exceptions.rb → suppressed_exception.rb} +21 -27
- data/lib/rubocop/cop/lint/syntax.rb +11 -28
- data/lib/rubocop/cop/lint/to_json.rb +20 -11
- data/lib/rubocop/cop/lint/top_level_return_with_argument.rb +34 -0
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +57 -0
- data/lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb +4 -4
- data/lib/rubocop/cop/lint/unified_integer.rb +4 -8
- data/lib/rubocop/cop/lint/unreachable_code.rb +2 -2
- data/lib/rubocop/cop/lint/unreachable_loop.rb +171 -0
- data/lib/rubocop/cop/lint/unused_block_argument.rb +8 -3
- data/lib/rubocop/cop/lint/unused_method_argument.rb +40 -9
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +4 -2
- data/lib/rubocop/cop/lint/uri_regexp.rb +12 -47
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +87 -39
- data/lib/rubocop/cop/lint/useless_assignment.rb +7 -6
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +7 -11
- data/lib/rubocop/cop/lint/useless_method_definition.rb +70 -0
- data/lib/rubocop/cop/lint/useless_setter_call.rb +9 -7
- data/lib/rubocop/cop/lint/useless_times.rb +106 -0
- data/lib/rubocop/cop/lint/void.rb +7 -11
- data/lib/rubocop/cop/metrics/abc_size.rb +2 -2
- data/lib/rubocop/cop/metrics/block_length.rb +27 -3
- data/lib/rubocop/cop/metrics/block_nesting.rb +2 -2
- data/lib/rubocop/cop/metrics/class_length.rb +39 -8
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +37 -4
- data/lib/rubocop/cop/metrics/method_length.rb +26 -3
- data/lib/rubocop/cop/metrics/module_length.rb +26 -3
- data/lib/rubocop/cop/metrics/parameter_lists.rb +2 -6
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +7 -8
- data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +80 -9
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +158 -0
- data/lib/rubocop/cop/metrics/utils/iterating_block.rb +61 -0
- data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +37 -0
- data/lib/rubocop/cop/migration/department_name.rb +55 -16
- data/lib/rubocop/cop/mixin/alignment.rb +7 -5
- 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 +19 -16
- data/lib/rubocop/cop/mixin/code_length.rb +26 -5
- data/lib/rubocop/cop/mixin/comments_help.rb +48 -0
- data/lib/rubocop/cop/mixin/configurable_enforced_style.rb +5 -3
- data/lib/rubocop/cop/mixin/configurable_formatting.rb +3 -5
- data/lib/rubocop/cop/mixin/configurable_naming.rb +2 -2
- data/lib/rubocop/cop/mixin/configurable_numbering.rb +3 -3
- data/lib/rubocop/cop/mixin/documentation_comment.rb +2 -2
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +8 -7
- data/lib/rubocop/cop/mixin/empty_parameter.rb +3 -1
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +18 -2
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +3 -1
- data/lib/rubocop/cop/mixin/first_element_line_break.rb +4 -2
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +14 -5
- data/lib/rubocop/cop/mixin/{hash_alignment.rb → hash_alignment_styles.rb} +1 -1
- data/lib/rubocop/cop/mixin/hash_transform_method.rb +197 -0
- data/lib/rubocop/cop/mixin/ignored_pattern.rb +1 -1
- data/lib/rubocop/cop/mixin/line_length_help.rb +87 -0
- data/lib/rubocop/cop/mixin/method_complexity.rb +17 -3
- data/lib/rubocop/cop/mixin/multiline_element_line_breaks.rb +3 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +13 -12
- data/lib/rubocop/cop/mixin/negative_conditional.rb +2 -2
- data/lib/rubocop/cop/mixin/nil_methods.rb +4 -6
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +6 -1
- data/lib/rubocop/cop/mixin/parentheses.rb +1 -2
- data/lib/rubocop/cop/mixin/percent_array.rb +16 -9
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/range_help.rb +19 -5
- data/lib/rubocop/cop/mixin/rational_literal.rb +18 -0
- data/lib/rubocop/cop/mixin/rescue_node.rb +11 -1
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +4 -3
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +4 -3
- data/lib/rubocop/cop/mixin/statement_modifier.rb +46 -23
- 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_comma.rb +27 -33
- data/lib/rubocop/cop/mixin/uncommunicative_name.rb +13 -18
- data/lib/rubocop/cop/mixin/unused_argument.rb +4 -6
- data/lib/rubocop/cop/mixin/visibility_help.rb +38 -0
- data/lib/rubocop/cop/naming/accessor_method_name.rb +4 -2
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +29 -6
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +4 -4
- data/lib/rubocop/cop/naming/{uncommunicative_block_param_name.rb → block_parameter_name.rb} +3 -3
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +13 -3
- data/lib/rubocop/cop/naming/constant_name.rb +3 -2
- data/lib/rubocop/cop/naming/file_name.rb +40 -22
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +2 -2
- data/lib/rubocop/cop/naming/heredoc_delimiter_naming.rb +8 -8
- data/lib/rubocop/cop/naming/memoized_instance_variable_name.rb +3 -3
- data/lib/rubocop/cop/naming/method_name.rb +27 -1
- data/lib/rubocop/cop/naming/{uncommunicative_method_param_name.rb → method_parameter_name.rb} +3 -3
- data/lib/rubocop/cop/naming/predicate_name.rb +10 -14
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +13 -12
- data/lib/rubocop/cop/naming/variable_name.rb +1 -1
- data/lib/rubocop/cop/naming/variable_number.rb +1 -1
- data/lib/rubocop/cop/offense.rb +41 -2
- data/lib/rubocop/cop/registry.rb +80 -15
- data/lib/rubocop/cop/security/eval.rb +3 -2
- data/lib/rubocop/cop/security/json_load.rb +7 -8
- data/lib/rubocop/cop/security/marshal_load.rb +3 -4
- data/lib/rubocop/cop/security/open.rb +3 -2
- data/lib/rubocop/cop/security/yaml_load.rb +7 -6
- data/lib/rubocop/cop/severity.rb +1 -11
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +36 -13
- data/lib/rubocop/cop/style/accessor_grouping.rb +152 -0
- data/lib/rubocop/cop/style/alias.rb +44 -37
- data/lib/rubocop/cop/style/and_or.rb +16 -19
- data/lib/rubocop/cop/style/array_coercion.rb +67 -0
- data/lib/rubocop/cop/style/array_join.rb +8 -9
- data/lib/rubocop/cop/style/ascii_comments.rb +4 -4
- data/lib/rubocop/cop/style/attr.rb +22 -13
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +7 -7
- 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 +141 -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 +54 -4
- data/lib/rubocop/cop/style/case_like_if.rb +252 -0
- data/lib/rubocop/cop/style/character_literal.rb +2 -2
- data/lib/rubocop/cop/style/class_and_module_children.rb +17 -12
- data/lib/rubocop/cop/style/class_check.rb +6 -11
- data/lib/rubocop/cop/style/class_equality_comparison.rb +64 -0
- data/lib/rubocop/cop/style/class_methods.rb +7 -11
- 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_methods.rb +13 -17
- data/lib/rubocop/cop/style/colon_method_call.rb +8 -9
- data/lib/rubocop/cop/style/colon_method_definition.rb +6 -6
- data/lib/rubocop/cop/style/combinable_loops.rb +91 -0
- data/lib/rubocop/cop/style/command_literal.rb +24 -25
- data/lib/rubocop/cop/style/comment_annotation.rb +23 -17
- data/lib/rubocop/cop/style/commented_keyword.rb +13 -11
- data/lib/rubocop/cop/style/conditional_assignment.rb +69 -73
- data/lib/rubocop/cop/style/constant_visibility.rb +3 -2
- data/lib/rubocop/cop/style/copyright.rb +27 -23
- data/lib/rubocop/cop/style/date_time.rb +14 -3
- data/lib/rubocop/cop/style/def_with_parentheses.rb +8 -10
- data/lib/rubocop/cop/style/dir.rb +10 -12
- data/lib/rubocop/cop/style/disable_cops_within_source_code_directive.rb +47 -0
- data/lib/rubocop/cop/style/documentation.rb +51 -15
- data/lib/rubocop/cop/style/documentation_method.rb +1 -1
- data/lib/rubocop/cop/style/double_cop_disable_directive.rb +14 -17
- data/lib/rubocop/cop/style/double_negation.rb +44 -6
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +5 -8
- data/lib/rubocop/cop/style/each_with_object.rb +16 -19
- data/lib/rubocop/cop/style/empty_block_parameter.rb +9 -10
- data/lib/rubocop/cop/style/empty_case_condition.rb +29 -28
- data/lib/rubocop/cop/style/empty_else.rb +17 -19
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +9 -10
- data/lib/rubocop/cop/style/empty_literal.rb +26 -27
- data/lib/rubocop/cop/style/empty_method.rb +13 -20
- data/lib/rubocop/cop/style/encoding.rb +6 -10
- data/lib/rubocop/cop/style/end_block.rb +6 -2
- data/lib/rubocop/cop/style/eval_with_location.rb +8 -8
- data/lib/rubocop/cop/style/even_odd.rb +9 -12
- data/lib/rubocop/cop/style/expand_path_arguments.rb +26 -25
- data/lib/rubocop/cop/style/explicit_block_argument.rb +106 -0
- data/lib/rubocop/cop/style/exponential_notation.rb +117 -0
- data/lib/rubocop/cop/style/float_division.rb +10 -11
- data/lib/rubocop/cop/style/for.rb +7 -15
- data/lib/rubocop/cop/style/format_string.rb +30 -28
- data/lib/rubocop/cop/style/format_string_token.rb +15 -16
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +98 -35
- data/lib/rubocop/cop/style/global_std_stream.rb +65 -0
- data/lib/rubocop/cop/style/global_vars.rb +2 -2
- data/lib/rubocop/cop/style/guard_clause.rb +34 -10
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +88 -0
- data/lib/rubocop/cop/style/hash_each_methods.rb +86 -0
- data/lib/rubocop/cop/style/hash_like_case.rb +76 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +27 -18
- data/lib/rubocop/cop/style/hash_transform_keys.rb +91 -0
- data/lib/rubocop/cop/style/hash_transform_values.rb +88 -0
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +2 -2
- data/lib/rubocop/cop/style/if_inside_else.rb +2 -2
- data/lib/rubocop/cop/style/if_unless_modifier.rb +80 -44
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +11 -3
- data/lib/rubocop/cop/style/if_with_semicolon.rb +15 -2
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +2 -1
- data/lib/rubocop/cop/style/infinite_loop.rb +28 -27
- data/lib/rubocop/cop/style/inline_comment.rb +4 -4
- data/lib/rubocop/cop/style/inverse_methods.rb +37 -37
- data/lib/rubocop/cop/style/ip_addresses.rb +5 -5
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +53 -0
- data/lib/rubocop/cop/style/lambda.rb +9 -13
- data/lib/rubocop/cop/style/lambda_call.rb +17 -34
- data/lib/rubocop/cop/style/line_end_concatenation.rb +33 -26
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +9 -206
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +174 -0
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/require_parentheses.rb +48 -0
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +9 -10
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +12 -3
- data/lib/rubocop/cop/style/method_def_parentheses.rb +21 -22
- data/lib/rubocop/cop/style/min_max.rb +8 -12
- data/lib/rubocop/cop/style/missing_else.rb +11 -21
- data/lib/rubocop/cop/style/missing_respond_to_missing.rb +10 -3
- data/lib/rubocop/cop/style/mixin_grouping.rb +26 -29
- data/lib/rubocop/cop/style/mixin_usage.rb +9 -28
- data/lib/rubocop/cop/style/module_function.rb +64 -21
- data/lib/rubocop/cop/style/multiline_block_chain.rb +12 -3
- 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 +2 -2
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +31 -9
- data/lib/rubocop/cop/style/multiline_when_then.rb +29 -11
- data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +27 -26
- data/lib/rubocop/cop/style/negated_if.rb +9 -9
- data/lib/rubocop/cop/style/negated_unless.rb +9 -9
- data/lib/rubocop/cop/style/negated_while.rb +7 -15
- data/lib/rubocop/cop/style/nested_modifier.rb +13 -14
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +21 -22
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +29 -2
- data/lib/rubocop/cop/style/next.rb +19 -23
- data/lib/rubocop/cop/style/nil_comparison.rb +13 -11
- data/lib/rubocop/cop/style/non_nil_check.rb +55 -35
- 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 +8 -4
- data/lib/rubocop/cop/style/numeric_predicate.rb +11 -16
- data/lib/rubocop/cop/style/one_line_conditional.rb +76 -29
- data/lib/rubocop/cop/style/option_hash.rb +4 -4
- data/lib/rubocop/cop/style/optional_arguments.rb +2 -2
- data/lib/rubocop/cop/style/optional_boolean_parameter.rb +53 -0
- data/lib/rubocop/cop/style/or_assignment.rb +16 -12
- data/lib/rubocop/cop/style/parallel_assignment.rb +18 -18
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +6 -6
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +21 -27
- data/lib/rubocop/cop/style/percent_q_literals.rb +8 -10
- data/lib/rubocop/cop/style/perl_backrefs.rb +8 -10
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +11 -14
- data/lib/rubocop/cop/style/proc.rb +7 -7
- data/lib/rubocop/cop/style/raise_args.rb +12 -24
- data/lib/rubocop/cop/style/random_with_offset.rb +24 -29
- data/lib/rubocop/cop/style/redundant_assignment.rb +107 -0
- data/lib/rubocop/cop/style/redundant_begin.rb +35 -9
- data/lib/rubocop/cop/style/{unneeded_capital_w.rb → redundant_capital_w.rb} +6 -9
- data/lib/rubocop/cop/style/{unneeded_condition.rb → redundant_condition.rb} +42 -15
- data/lib/rubocop/cop/style/redundant_conditional.rb +9 -9
- data/lib/rubocop/cop/style/redundant_exception.rb +19 -13
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +113 -0
- data/lib/rubocop/cop/style/redundant_file_extension_in_require.rb +51 -0
- data/lib/rubocop/cop/style/redundant_freeze.rb +6 -8
- data/lib/rubocop/cop/style/{unneeded_interpolation.rb → redundant_interpolation.rb} +31 -25
- data/lib/rubocop/cop/style/redundant_parentheses.rb +34 -26
- data/lib/rubocop/cop/style/{unneeded_percent_q.rb → redundant_percent_q.rb} +13 -15
- data/lib/rubocop/cop/style/redundant_regexp_character_class.rb +98 -0
- data/lib/rubocop/cop/style/redundant_regexp_escape.rb +105 -0
- data/lib/rubocop/cop/style/redundant_return.rb +40 -44
- data/lib/rubocop/cop/style/redundant_self.rb +15 -20
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +116 -0
- data/lib/rubocop/cop/style/{unneeded_sort.rb → redundant_sort.rb} +31 -34
- data/lib/rubocop/cop/style/redundant_sort_by.rb +5 -9
- data/lib/rubocop/cop/style/regexp_literal.rb +10 -21
- data/lib/rubocop/cop/style/rescue_modifier.rb +29 -9
- data/lib/rubocop/cop/style/rescue_standard_error.rb +21 -17
- data/lib/rubocop/cop/style/return_nil.rb +6 -6
- data/lib/rubocop/cop/style/safe_navigation.rb +35 -30
- data/lib/rubocop/cop/style/sample.rb +13 -15
- data/lib/rubocop/cop/style/self_assignment.rb +26 -22
- data/lib/rubocop/cop/style/semicolon.rb +9 -12
- data/lib/rubocop/cop/style/send.rb +4 -5
- data/lib/rubocop/cop/style/signal_exception.rb +26 -20
- data/lib/rubocop/cop/style/single_argument_dig.rb +55 -0
- data/lib/rubocop/cop/style/single_line_block_params.rb +4 -2
- data/lib/rubocop/cop/style/single_line_methods.rb +18 -17
- data/lib/rubocop/cop/style/slicing_with_range.rb +37 -0
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +66 -0
- data/lib/rubocop/cop/style/special_global_vars.rb +17 -28
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +17 -23
- data/lib/rubocop/cop/style/stderr_puts.rb +6 -7
- data/lib/rubocop/cop/style/string_concatenation.rb +106 -0
- data/lib/rubocop/cop/style/string_hash_keys.rb +6 -7
- data/lib/rubocop/cop/style/string_methods.rb +7 -17
- data/lib/rubocop/cop/style/strip.rb +9 -14
- data/lib/rubocop/cop/style/struct_inheritance.rb +22 -4
- data/lib/rubocop/cop/style/symbol_array.rb +13 -24
- data/lib/rubocop/cop/style/symbol_literal.rb +6 -8
- data/lib/rubocop/cop/style/symbol_proc.rb +16 -20
- data/lib/rubocop/cop/style/ternary_parentheses.rb +25 -28
- data/lib/rubocop/cop/style/trailing_body_on_class.rb +3 -6
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +4 -7
- 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 +90 -0
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +46 -5
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +9 -32
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +16 -21
- data/lib/rubocop/cop/style/trivial_accessors.rb +35 -38
- data/lib/rubocop/cop/style/unless_else.rb +6 -9
- data/lib/rubocop/cop/style/unpack_first.rb +4 -11
- data/lib/rubocop/cop/style/variable_interpolation.rb +7 -10
- data/lib/rubocop/cop/style/when_then.rb +5 -7
- data/lib/rubocop/cop/style/while_until_do.rb +6 -16
- data/lib/rubocop/cop/style/while_until_modifier.rb +8 -22
- data/lib/rubocop/cop/style/word_array.rb +6 -24
- data/lib/rubocop/cop/style/yoda_condition.rb +29 -8
- data/lib/rubocop/cop/style/zero_length_predicate.rb +19 -21
- data/lib/rubocop/cop/team.rb +143 -77
- data/lib/rubocop/cop/util.rb +30 -17
- data/lib/rubocop/cop/utils/format_string.rb +31 -24
- data/lib/rubocop/cop/variable_force.rb +16 -17
- data/lib/rubocop/cop/variable_force/assignment.rb +1 -0
- data/lib/rubocop/cop/variable_force/branch.rb +2 -7
- data/lib/rubocop/cop/variable_force/scope.rb +1 -0
- data/lib/rubocop/cop/variable_force/variable.rb +7 -8
- data/lib/rubocop/cops_documentation_generator.rb +284 -0
- data/lib/rubocop/core_ext/string.rb +2 -2
- data/lib/rubocop/directive_comment.rb +32 -0
- data/lib/rubocop/error.rb +1 -0
- data/lib/rubocop/ext/processed_source.rb +18 -0
- data/lib/rubocop/ext/regexp_node.rb +62 -0
- data/lib/rubocop/file_finder.rb +13 -12
- 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 +0 -2
- data/lib/rubocop/formatter/disabled_config_formatter.rb +15 -16
- data/lib/rubocop/formatter/formatter_set.rb +4 -5
- data/lib/rubocop/formatter/html_formatter.rb +2 -0
- data/lib/rubocop/formatter/json_formatter.rb +6 -5
- data/lib/rubocop/formatter/junit_formatter.rb +84 -0
- data/lib/rubocop/formatter/pacman_formatter.rb +1 -1
- data/lib/rubocop/formatter/progress_formatter.rb +2 -1
- data/lib/rubocop/formatter/quiet_formatter.rb +1 -1
- data/lib/rubocop/formatter/simple_text_formatter.rb +36 -6
- data/lib/rubocop/formatter/tap_formatter.rb +0 -2
- data/lib/rubocop/magic_comment.rb +1 -1
- data/lib/rubocop/name_similarity.rb +18 -10
- data/lib/rubocop/options.rb +103 -46
- data/lib/rubocop/path_util.rb +19 -19
- data/lib/rubocop/platform.rb +1 -1
- data/lib/rubocop/rake_task.rb +8 -9
- data/lib/rubocop/remote_config.rb +2 -3
- data/lib/rubocop/result_cache.rb +69 -27
- data/lib/rubocop/rspec/cop_helper.rb +11 -31
- data/lib/rubocop/rspec/expect_offense.rb +104 -25
- data/lib/rubocop/rspec/shared_contexts.rb +79 -29
- data/lib/rubocop/runner.rb +123 -74
- data/lib/rubocop/string_interpreter.rb +3 -0
- data/lib/rubocop/target_finder.rb +61 -50
- data/lib/rubocop/target_ruby.rb +160 -0
- data/lib/rubocop/version.rb +12 -4
- data/lib/rubocop/yaml_duplication_checker.rb +1 -0
- metadata +176 -117
- data/lib/rubocop/ast/builder.rb +0 -81
- data/lib/rubocop/ast/node.rb +0 -640
- 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 -115
- 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/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/align_array.rb +0 -39
- data/lib/rubocop/cop/layout/indent_heredoc.rb +0 -256
- 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/safe_mode.rb +0 -24
- 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 -799
- 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: b8ce11205d6a6bb518654cbe498544aa799fbb8d9c9057afd2f551edfc35bbb8
|
4
|
+
data.tar.gz: a1f79001991b28508ca7c9a79d75ed58f39ae0dcf2bad419d6a75919b3a3d539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32001a91575c41b5ca71b6a148af79f45b2a7b8cbc3909a0dcbb7a652f5e62b6a79a84c14189eda64fd3d2a9e8c40d207c37c0f5a78a156e1f636c5191b995e
|
7
|
+
data.tar.gz: 9ac5df57938099031807a96bd87a7fb9c5f7f40c314528b4c3254edb45b1386ce199fa9c394c9e7531655d117df9d3d5215bd66e4a927b9b2b0878e0eac2a1f6
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="https://raw.githubusercontent.com/rubocop-hq/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
----------
|
6
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
|
1
7
|
[![Gem Version](https://badge.fury.io/rb/rubocop.svg)](https://badge.fury.io/rb/rubocop)
|
2
8
|
[![CircleCI Status](https://circleci.com/gh/rubocop-hq/rubocop/tree/master.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop/tree/master)
|
3
|
-
[![
|
4
|
-
[![Coverage
|
5
|
-
[![
|
6
|
-
[![Inline docs](https://inch-ci.org/github/bbatsov/rubocop.svg)](https://inch-ci.org/github/bbatsov/rubocop)
|
9
|
+
[![Actions Status](https://github.com/rubocop-hq/rubocop/workflows/CI/badge.svg?branch=master)](https://github.com/rubocop-hq/rubocop/actions?query=workflow%3ACI)
|
10
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/test_coverage)](https://codeclimate.com/github/rubocop-hq/rubocop/test_coverage)
|
11
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/d2d67f728e88ea84ac69/maintainability)](https://codeclimate.com/github/rubocop-hq/rubocop/maintainability)
|
7
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)
|
8
13
|
|
9
14
|
[![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
|
@@ -11,26 +16,17 @@
|
|
11
16
|
[![OpenCollective](https://opencollective.com/rubocop/sponsors/badge.svg)](#open-collective-sponsors)
|
12
17
|
[![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
18
|
|
14
|
-
<p align="center">
|
15
|
-
<img src="https://raw.githubusercontent.com/rubocop-hq/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
|
16
|
-
</p>
|
17
|
-
|
18
19
|
> Role models are important. <br/>
|
19
20
|
> -- Officer Alex J. Murphy / RoboCop
|
20
21
|
|
21
|
-
**RuboCop** is a Ruby static code analyzer and code formatter. Out of
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
**RuboCop** is a Ruby static code analyzer (a.k.a. `linter`) and code formatter. Out of the box it
|
23
|
+
will enforce many of the guidelines outlined in the community [Ruby Style
|
24
|
+
Guide](https://rubystyle.guide). Apart from reporting the problems discovered in your code,
|
25
|
+
RuboCop can also automatically fix many of them for you.
|
25
26
|
|
26
27
|
RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
|
27
28
|
[configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
|
28
29
|
|
29
|
-
Apart from reporting problems in your code, RuboCop can also
|
30
|
-
automatically fix some of the problems for you.
|
31
|
-
|
32
|
-
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bbatsov/rubocop?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
33
|
-
|
34
30
|
**Please consider [financially supporting its ongoing development](#funding).**
|
35
31
|
|
36
32
|
## Installation
|
@@ -41,7 +37,7 @@ automatically fix some of the problems for you.
|
|
41
37
|
$ gem install rubocop
|
42
38
|
```
|
43
39
|
|
44
|
-
If you'd rather install RuboCop using `bundler`,
|
40
|
+
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
41
|
|
46
42
|
```rb
|
47
43
|
gem 'rubocop', require: false
|
@@ -53,7 +49,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
53
49
|
might want to use a conservative version lock in your `Gemfile`:
|
54
50
|
|
55
51
|
```rb
|
56
|
-
gem 'rubocop', '~> 0.
|
52
|
+
gem 'rubocop', '~> 0.93.1', require: false
|
57
53
|
```
|
58
54
|
|
59
55
|
## Quickstart
|
@@ -73,8 +69,18 @@ You can read a lot more about RuboCop in its [official docs](https://docs.ruboco
|
|
73
69
|
|
74
70
|
RuboCop supports the following Ruby implementations:
|
75
71
|
|
76
|
-
* MRI 2.
|
77
|
-
* JRuby 9.
|
72
|
+
* MRI 2.4+
|
73
|
+
* JRuby 9.2+
|
74
|
+
|
75
|
+
See [compatibility](https://docs.rubocop.org/rubocop/compatibility.html) for further details.
|
76
|
+
|
77
|
+
## Readme Badge
|
78
|
+
|
79
|
+
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.
|
80
|
+
|
81
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
|
82
|
+
|
83
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)
|
78
84
|
|
79
85
|
## Team
|
80
86
|
|
@@ -88,6 +94,8 @@ Here's a list of RuboCop's core developers:
|
|
88
94
|
* [Masataka Kuwabara](https://github.com/pocke)
|
89
95
|
* [Koichi Ito](https://github.com/koic)
|
90
96
|
* [Maxim Krizhanovski](https://github.com/darhazer)
|
97
|
+
* [Benjamin Quorning](https://github.com/bquorning)
|
98
|
+
* [Marc-André Lafortune](https://github.com/marcandre)
|
91
99
|
|
92
100
|
## Logo
|
93
101
|
|
@@ -132,7 +140,7 @@ If you're working in a company that's making significant use of RuboCop we'd app
|
|
132
140
|
to become a RuboCop sponsor.
|
133
141
|
|
134
142
|
You can support the development of RuboCop via
|
135
|
-
[
|
143
|
+
[GitHub Sponsors](https://github.com/sponsors/bbatsov),
|
136
144
|
[Patreon](https://www.patreon.com/bbatsov),
|
137
145
|
[PayPal](https://paypal.me/bbatsov)
|
138
146
|
and [Open Collective](https://opencollective.com/rubocop).
|
@@ -213,5 +221,5 @@ RuboCop's changelog is available [here](CHANGELOG.md).
|
|
213
221
|
|
214
222
|
## Copyright
|
215
223
|
|
216
|
-
Copyright (c) 2012-
|
224
|
+
Copyright (c) 2012-2020 Bozhidar Batsov. See [LICENSE.txt](LICENSE.txt) for
|
217
225
|
further details.
|
data/bin/rubocop-profile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
if ARGV.include?('-h') || ARGV.include?('--help')
|
5
|
+
puts "Usage: same as main `rubocop` command but gathers profiling info"
|
6
|
+
puts "Additional option: `--memory` to print memory usage"
|
7
|
+
exit(0)
|
8
|
+
end
|
9
|
+
with_mem = ARGV.delete('--memory')
|
10
|
+
ARGV.unshift '--cache', 'false' unless ARGV.include?('--cache')
|
11
|
+
|
12
|
+
require 'stackprof'
|
13
|
+
if with_mem
|
14
|
+
require 'memory_profiler'
|
15
|
+
MemoryProfiler.start
|
16
|
+
end
|
17
|
+
StackProf.start
|
18
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
19
|
+
begin
|
20
|
+
load "#{__dir__}/../exe/rubocop"
|
21
|
+
ensure
|
22
|
+
delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
23
|
+
puts "Finished in #{delta.round(1)} seconds"
|
24
|
+
StackProf.stop
|
25
|
+
if with_mem
|
26
|
+
puts "Building memory report..."
|
27
|
+
report = MemoryProfiler.stop
|
28
|
+
end
|
29
|
+
Dir.mkdir('tmp') unless File.exist?('tmp')
|
30
|
+
StackProf.results('tmp/stackprof.dump')
|
31
|
+
report&.pretty_print(scale_bytes: true)
|
32
|
+
end
|
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,12 +54,15 @@ 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'
|
60
63
|
Exclude:
|
61
64
|
- 'node_modules/**/*'
|
65
|
+
- 'tmp/**/*'
|
62
66
|
- 'vendor/**/*'
|
63
67
|
- '.git/**/*'
|
64
68
|
# Default formatter will be used if no `-f/--format` option is given.
|
@@ -95,6 +99,14 @@ AllCops:
|
|
95
99
|
# to true in the same configuration.
|
96
100
|
EnabledByDefault: false
|
97
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
|
98
110
|
# Enables the result cache if `true`. Can be overridden by the `--cache` command
|
99
111
|
# line option.
|
100
112
|
UseCache: true
|
@@ -105,6 +117,8 @@ AllCops:
|
|
105
117
|
# CacheRootDirectory is ~ (nil), which it is by default, the root will be
|
106
118
|
# taken from the environment variable `$XDG_CACHE_HOME` if it is set, or if
|
107
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.
|
108
122
|
CacheRootDirectory: ~
|
109
123
|
# It is possible for a malicious user to know the location of RuboCop's cache
|
110
124
|
# directory by looking at CacheRootDirectory, and create a symlink in its
|
@@ -123,7 +137,7 @@ AllCops:
|
|
123
137
|
# followed by the Gemfile.lock or gems.locked file. (Although the Ruby version
|
124
138
|
# is specified in the Gemfile or gems.rb file, RuboCop reads the final value
|
125
139
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
126
|
-
# use the oldest officially supported Ruby version (currently Ruby 2.
|
140
|
+
# use the oldest officially supported Ruby version (currently Ruby 2.4).
|
127
141
|
TargetRubyVersion: ~
|
128
142
|
|
129
143
|
#################### Bundler ###############################
|
@@ -141,11 +155,13 @@ Bundler/GemComment:
|
|
141
155
|
Description: 'Add a comment describing each gem.'
|
142
156
|
Enabled: false
|
143
157
|
VersionAdded: '0.59'
|
158
|
+
VersionChanged: '0.85'
|
144
159
|
Include:
|
145
160
|
- '**/*.gemfile'
|
146
161
|
- '**/Gemfile'
|
147
162
|
- '**/gems.rb'
|
148
|
-
|
163
|
+
IgnoredGems: []
|
164
|
+
OnlyFor: []
|
149
165
|
|
150
166
|
Bundler/InsecureProtocolSource:
|
151
167
|
Description: >-
|
@@ -166,6 +182,9 @@ Bundler/OrderedGems:
|
|
166
182
|
VersionAdded: '0.46'
|
167
183
|
VersionChanged: '0.47'
|
168
184
|
TreatCommentsAsGroupSeparators: true
|
185
|
+
# By default, "-" and "_" are ignored for order purposes.
|
186
|
+
# This can be overridden by setting this parameter to true.
|
187
|
+
ConsiderPunctuation: false
|
169
188
|
Include:
|
170
189
|
- '**/*.gemfile'
|
171
190
|
- '**/Gemfile'
|
@@ -186,18 +205,23 @@ Gemspec/OrderedDependencies:
|
|
186
205
|
Enabled: true
|
187
206
|
VersionAdded: '0.51'
|
188
207
|
TreatCommentsAsGroupSeparators: true
|
208
|
+
# By default, "-" and "_" are ignored for order purposes.
|
209
|
+
# This can be overridden by setting this parameter to true.
|
210
|
+
ConsiderPunctuation: false
|
189
211
|
Include:
|
190
212
|
- '**/*.gemspec'
|
191
213
|
|
192
214
|
Gemspec/RequiredRubyVersion:
|
193
|
-
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml
|
215
|
+
Description: 'Checks that `required_ruby_version` of gemspec is specified and equal to `TargetRubyVersion` of .rubocop.yml.'
|
194
216
|
Enabled: true
|
195
217
|
VersionAdded: '0.52'
|
218
|
+
VersionChanged: '0.89'
|
196
219
|
Include:
|
197
220
|
- '**/*.gemspec'
|
198
|
-
|
221
|
+
|
199
222
|
Gemspec/RubyVersionGlobalsUsage:
|
200
223
|
Description: Checks usage of RUBY_VERSION in gemspec.
|
224
|
+
StyleGuide: '#no-ruby-version-in-the-gemspec'
|
201
225
|
Enabled: true
|
202
226
|
VersionAdded: '0.72'
|
203
227
|
Include:
|
@@ -218,13 +242,14 @@ Layout/AccessModifierIndentation:
|
|
218
242
|
# But it can be overridden by setting this parameter
|
219
243
|
IndentationWidth: ~
|
220
244
|
|
221
|
-
Layout/
|
245
|
+
Layout/ArgumentAlignment:
|
222
246
|
Description: >-
|
223
247
|
Align the arguments of a method call if they span more
|
224
248
|
than one line.
|
225
249
|
StyleGuide: '#no-double-indent'
|
226
250
|
Enabled: true
|
227
251
|
VersionAdded: '0.68'
|
252
|
+
VersionChanged: '0.77'
|
228
253
|
# Alignment of arguments in multi-line method calls.
|
229
254
|
#
|
230
255
|
# The `with_first_argument` style aligns the following lines along the same
|
@@ -246,120 +271,59 @@ Layout/AlignArguments:
|
|
246
271
|
# But it can be overridden by setting this parameter
|
247
272
|
IndentationWidth: ~
|
248
273
|
|
249
|
-
Layout/
|
274
|
+
Layout/ArrayAlignment:
|
250
275
|
Description: >-
|
251
276
|
Align the elements of an array literal if they span more than
|
252
277
|
one line.
|
253
|
-
StyleGuide: '#align-multiline-arrays'
|
254
|
-
Enabled: true
|
255
|
-
VersionAdded: '0.49'
|
256
|
-
|
257
|
-
Layout/AlignHash:
|
258
|
-
Description: >-
|
259
|
-
Align the elements of a hash literal if they span more than
|
260
|
-
one line.
|
261
|
-
Enabled: true
|
262
|
-
AllowMultipleStyles: true
|
263
|
-
VersionAdded: '0.49'
|
264
|
-
# Alignment of entries using hash rocket as separator. Valid values are:
|
265
|
-
#
|
266
|
-
# key - left alignment of keys
|
267
|
-
# 'a' => 2
|
268
|
-
# 'bb' => 3
|
269
|
-
# separator - alignment of hash rockets, keys are right aligned
|
270
|
-
# 'a' => 2
|
271
|
-
# 'bb' => 3
|
272
|
-
# table - left alignment of keys, hash rockets, and values
|
273
|
-
# 'a' => 2
|
274
|
-
# 'bb' => 3
|
275
|
-
EnforcedHashRocketStyle: key
|
276
|
-
SupportedHashRocketStyles:
|
277
|
-
- key
|
278
|
-
- separator
|
279
|
-
- table
|
280
|
-
# Alignment of entries using colon as separator. Valid values are:
|
281
|
-
#
|
282
|
-
# key - left alignment of keys
|
283
|
-
# a: 0
|
284
|
-
# bb: 1
|
285
|
-
# separator - alignment of colons, keys are right aligned
|
286
|
-
# a: 0
|
287
|
-
# bb: 1
|
288
|
-
# table - left alignment of keys and values
|
289
|
-
# a: 0
|
290
|
-
# bb: 1
|
291
|
-
EnforcedColonStyle: key
|
292
|
-
SupportedColonStyles:
|
293
|
-
- key
|
294
|
-
- separator
|
295
|
-
- table
|
296
|
-
# Select whether hashes that are the last argument in a method call should be
|
297
|
-
# inspected? Valid values are:
|
298
|
-
#
|
299
|
-
# always_inspect - Inspect both implicit and explicit hashes.
|
300
|
-
# Registers an offense for:
|
301
|
-
# function(a: 1,
|
302
|
-
# b: 2)
|
303
|
-
# Registers an offense for:
|
304
|
-
# function({a: 1,
|
305
|
-
# b: 2})
|
306
|
-
# always_ignore - Ignore both implicit and explicit hashes.
|
307
|
-
# Accepts:
|
308
|
-
# function(a: 1,
|
309
|
-
# b: 2)
|
310
|
-
# Accepts:
|
311
|
-
# function({a: 1,
|
312
|
-
# b: 2})
|
313
|
-
# ignore_implicit - Ignore only implicit hashes.
|
314
|
-
# Accepts:
|
315
|
-
# function(a: 1,
|
316
|
-
# b: 2)
|
317
|
-
# Registers an offense for:
|
318
|
-
# function({a: 1,
|
319
|
-
# b: 2})
|
320
|
-
# ignore_explicit - Ignore only explicit hashes.
|
321
|
-
# Accepts:
|
322
|
-
# function({a: 1,
|
323
|
-
# b: 2})
|
324
|
-
# Registers an offense for:
|
325
|
-
# function(a: 1,
|
326
|
-
# b: 2)
|
327
|
-
EnforcedLastArgumentHashStyle: always_inspect
|
328
|
-
SupportedLastArgumentHashStyles:
|
329
|
-
- always_inspect
|
330
|
-
- always_ignore
|
331
|
-
- ignore_implicit
|
332
|
-
- ignore_explicit
|
333
|
-
|
334
|
-
Layout/AlignParameters:
|
335
|
-
Description: >-
|
336
|
-
Align the parameters of a method definition if they span more
|
337
|
-
than one line.
|
338
278
|
StyleGuide: '#no-double-indent'
|
339
279
|
Enabled: true
|
340
280
|
VersionAdded: '0.49'
|
341
|
-
VersionChanged: '0.
|
342
|
-
# Alignment of
|
281
|
+
VersionChanged: '0.77'
|
282
|
+
# Alignment of elements of a multi-line array.
|
343
283
|
#
|
344
284
|
# The `with_first_parameter` style aligns the following lines along the same
|
345
|
-
# column as the first
|
285
|
+
# column as the first element.
|
346
286
|
#
|
347
|
-
#
|
348
|
-
#
|
287
|
+
# array = [1, 2, 3,
|
288
|
+
# 4, 5, 6]
|
349
289
|
#
|
350
290
|
# The `with_fixed_indentation` style aligns the following lines with one
|
351
|
-
# level of indentation relative to the start of the line with
|
291
|
+
# level of indentation relative to the start of the line with start of array.
|
352
292
|
#
|
353
|
-
#
|
354
|
-
#
|
355
|
-
EnforcedStyle:
|
293
|
+
# array = [1, 2, 3,
|
294
|
+
# 4, 5, 6]
|
295
|
+
EnforcedStyle: with_first_element
|
356
296
|
SupportedStyles:
|
357
|
-
-
|
297
|
+
- with_first_element
|
358
298
|
- with_fixed_indentation
|
359
299
|
# By default, the indentation width from Layout/IndentationWidth is used
|
360
300
|
# But it can be overridden by setting this parameter
|
361
301
|
IndentationWidth: ~
|
362
302
|
|
303
|
+
Layout/AssignmentIndentation:
|
304
|
+
Description: >-
|
305
|
+
Checks the indentation of the first line of the
|
306
|
+
right-hand-side of a multi-line assignment.
|
307
|
+
Enabled: true
|
308
|
+
VersionAdded: '0.49'
|
309
|
+
VersionChanged: '0.77'
|
310
|
+
# By default, the indentation width from `Layout/IndentationWidth` is used
|
311
|
+
# But it can be overridden by setting this parameter
|
312
|
+
IndentationWidth: ~
|
313
|
+
|
314
|
+
Layout/BeginEndAlignment:
|
315
|
+
Description: 'Align ends corresponding to begins correctly.'
|
316
|
+
Enabled: pending
|
317
|
+
VersionAdded: '0.91'
|
318
|
+
# The value `start_of_line` means that `end` should be aligned the start of the line
|
319
|
+
# where the `begin` keyword is.
|
320
|
+
# The value `begin` means that `end` should be aligned with the `begin` keyword.
|
321
|
+
EnforcedStyleAlignWith: start_of_line
|
322
|
+
SupportedStylesAlignWith:
|
323
|
+
- start_of_line
|
324
|
+
- begin
|
325
|
+
Severity: warning
|
326
|
+
|
363
327
|
Layout/BlockAlignment:
|
364
328
|
Description: 'Align block ends correctly.'
|
365
329
|
Enabled: true
|
@@ -436,6 +400,7 @@ Layout/ConditionPosition:
|
|
436
400
|
StyleGuide: '#same-line-condition'
|
437
401
|
Enabled: true
|
438
402
|
VersionAdded: '0.53'
|
403
|
+
VersionChanged: '0.83'
|
439
404
|
|
440
405
|
Layout/DefEndAlignment:
|
441
406
|
Description: 'Align ends corresponding to defs correctly.'
|
@@ -449,7 +414,6 @@ Layout/DefEndAlignment:
|
|
449
414
|
SupportedStylesAlignWith:
|
450
415
|
- start_of_line
|
451
416
|
- def
|
452
|
-
AutoCorrect: false
|
453
417
|
Severity: warning
|
454
418
|
|
455
419
|
Layout/DotPosition:
|
@@ -486,6 +450,14 @@ Layout/EmptyLineAfterMagicComment:
|
|
486
450
|
Enabled: true
|
487
451
|
VersionAdded: '0.49'
|
488
452
|
|
453
|
+
Layout/EmptyLineAfterMultilineCondition:
|
454
|
+
Description: 'Enforces empty line after multiline condition.'
|
455
|
+
# This is disabled, because this style is not very common in practice.
|
456
|
+
Enabled: false
|
457
|
+
VersionAdded: '0.90'
|
458
|
+
Reference:
|
459
|
+
- https://github.com/airbnb/ruby#multiline-if-newline
|
460
|
+
|
489
461
|
Layout/EmptyLineBetweenDefs:
|
490
462
|
Description: 'Use empty lines between defs.'
|
491
463
|
StyleGuide: '#empty-lines-between-methods'
|
@@ -521,6 +493,19 @@ Layout/EmptyLinesAroundArguments:
|
|
521
493
|
Enabled: true
|
522
494
|
VersionAdded: '0.52'
|
523
495
|
|
496
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
497
|
+
Description: "Keep blank lines around attribute accessors."
|
498
|
+
StyleGuide: '#empty-lines-around-attribute-accessor'
|
499
|
+
Enabled: pending
|
500
|
+
VersionAdded: '0.83'
|
501
|
+
VersionChanged: '0.84'
|
502
|
+
AllowAliasSyntax: true
|
503
|
+
AllowedMethods:
|
504
|
+
- alias_method
|
505
|
+
- public
|
506
|
+
- protected
|
507
|
+
- private
|
508
|
+
|
524
509
|
Layout/EmptyLinesAroundBeginBody:
|
525
510
|
Description: "Keeps track of empty lines around begin-end bodies."
|
526
511
|
StyleGuide: '#empty-lines-around-bodies'
|
@@ -592,7 +577,6 @@ Layout/EndAlignment:
|
|
592
577
|
- keyword
|
593
578
|
- variable
|
594
579
|
- start_of_line
|
595
|
-
AutoCorrect: false
|
596
580
|
Severity: warning
|
597
581
|
|
598
582
|
Layout/EndOfLine:
|
@@ -624,56 +608,11 @@ Layout/ExtraSpacing:
|
|
624
608
|
# When true, forces the alignment of `=` in assignments on consecutive lines.
|
625
609
|
ForceEqualSignAlignment: false
|
626
610
|
|
627
|
-
Layout/
|
628
|
-
Description: >-
|
629
|
-
Checks for a line break before the first element in a
|
630
|
-
multi-line array.
|
631
|
-
Enabled: false
|
632
|
-
VersionAdded: '0.49'
|
633
|
-
|
634
|
-
Layout/FirstHashElementLineBreak:
|
635
|
-
Description: >-
|
636
|
-
Checks for a line break before the first element in a
|
637
|
-
multi-line hash.
|
638
|
-
Enabled: false
|
639
|
-
VersionAdded: '0.49'
|
640
|
-
|
641
|
-
Layout/FirstMethodArgumentLineBreak:
|
642
|
-
Description: >-
|
643
|
-
Checks for a line break before the first argument in a
|
644
|
-
multi-line method call.
|
645
|
-
Enabled: false
|
646
|
-
VersionAdded: '0.49'
|
647
|
-
|
648
|
-
Layout/FirstMethodParameterLineBreak:
|
649
|
-
Description: >-
|
650
|
-
Checks for a line break before the first parameter in a
|
651
|
-
multi-line method parameter definition.
|
652
|
-
Enabled: false
|
653
|
-
VersionAdded: '0.49'
|
654
|
-
|
655
|
-
Layout/HeredocArgumentClosingParenthesis:
|
656
|
-
Description: >-
|
657
|
-
Checks for the placement of the closing parenthesis in a
|
658
|
-
method call that passes a HEREDOC string as an argument.
|
659
|
-
Enabled: false
|
660
|
-
StyleGuide: '#heredoc-argument-closing-parentheses'
|
661
|
-
VersionAdded: '0.68'
|
662
|
-
|
663
|
-
Layout/IndentAssignment:
|
664
|
-
Description: >-
|
665
|
-
Checks the indentation of the first line of the
|
666
|
-
right-hand-side of a multi-line assignment.
|
667
|
-
Enabled: true
|
668
|
-
VersionAdded: '0.49'
|
669
|
-
# By default, the indentation width from `Layout/IndentationWidth` is used
|
670
|
-
# But it can be overridden by setting this parameter
|
671
|
-
IndentationWidth: ~
|
672
|
-
|
673
|
-
Layout/IndentFirstArgument:
|
611
|
+
Layout/FirstArgumentIndentation:
|
674
612
|
Description: 'Checks the indentation of the first argument in a method call.'
|
675
613
|
Enabled: true
|
676
614
|
VersionAdded: '0.68'
|
615
|
+
VersionChanged: '0.77'
|
677
616
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
678
617
|
SupportedStyles:
|
679
618
|
# The first parameter should always be indented one step more than the
|
@@ -694,12 +633,13 @@ Layout/IndentFirstArgument:
|
|
694
633
|
# But it can be overridden by setting this parameter
|
695
634
|
IndentationWidth: ~
|
696
635
|
|
697
|
-
Layout/
|
636
|
+
Layout/FirstArrayElementIndentation:
|
698
637
|
Description: >-
|
699
638
|
Checks the indentation of the first element in an array
|
700
639
|
literal.
|
701
640
|
Enabled: true
|
702
641
|
VersionAdded: '0.68'
|
642
|
+
VersionChanged: '0.77'
|
703
643
|
# The value `special_inside_parentheses` means that array literals with
|
704
644
|
# brackets that have their opening bracket on the same line as a surrounding
|
705
645
|
# opening round parenthesis, shall have their first element indented relative
|
@@ -720,10 +660,18 @@ Layout/IndentFirstArrayElement:
|
|
720
660
|
# But it can be overridden by setting this parameter
|
721
661
|
IndentationWidth: ~
|
722
662
|
|
723
|
-
Layout/
|
663
|
+
Layout/FirstArrayElementLineBreak:
|
664
|
+
Description: >-
|
665
|
+
Checks for a line break before the first element in a
|
666
|
+
multi-line array.
|
667
|
+
Enabled: false
|
668
|
+
VersionAdded: '0.49'
|
669
|
+
|
670
|
+
Layout/FirstHashElementIndentation:
|
724
671
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
725
672
|
Enabled: true
|
726
673
|
VersionAdded: '0.68'
|
674
|
+
VersionChanged: '0.77'
|
727
675
|
# The value `special_inside_parentheses` means that hash literals with braces
|
728
676
|
# that have their opening brace on the same line as a surrounding opening
|
729
677
|
# round parenthesis, shall have their first key indented relative to the
|
@@ -744,13 +692,34 @@ Layout/IndentFirstHashElement:
|
|
744
692
|
# But it can be overridden by setting this parameter
|
745
693
|
IndentationWidth: ~
|
746
694
|
|
747
|
-
Layout/
|
695
|
+
Layout/FirstHashElementLineBreak:
|
696
|
+
Description: >-
|
697
|
+
Checks for a line break before the first element in a
|
698
|
+
multi-line hash.
|
699
|
+
Enabled: false
|
700
|
+
VersionAdded: '0.49'
|
701
|
+
|
702
|
+
Layout/FirstMethodArgumentLineBreak:
|
703
|
+
Description: >-
|
704
|
+
Checks for a line break before the first argument in a
|
705
|
+
multi-line method call.
|
706
|
+
Enabled: false
|
707
|
+
VersionAdded: '0.49'
|
708
|
+
|
709
|
+
Layout/FirstMethodParameterLineBreak:
|
710
|
+
Description: >-
|
711
|
+
Checks for a line break before the first parameter in a
|
712
|
+
multi-line method parameter definition.
|
713
|
+
Enabled: false
|
714
|
+
VersionAdded: '0.49'
|
715
|
+
|
716
|
+
Layout/FirstParameterIndentation:
|
748
717
|
Description: >-
|
749
718
|
Checks the indentation of the first parameter in a
|
750
719
|
method definition.
|
751
720
|
Enabled: true
|
752
721
|
VersionAdded: '0.49'
|
753
|
-
VersionChanged: '0.
|
722
|
+
VersionChanged: '0.77'
|
754
723
|
EnforcedStyle: consistent
|
755
724
|
SupportedStyles:
|
756
725
|
- consistent
|
@@ -759,18 +728,98 @@ Layout/IndentFirstParameter:
|
|
759
728
|
# But it can be overridden by setting this parameter
|
760
729
|
IndentationWidth: ~
|
761
730
|
|
762
|
-
Layout/
|
731
|
+
Layout/HashAlignment:
|
732
|
+
Description: >-
|
733
|
+
Align the elements of a hash literal if they span more than
|
734
|
+
one line.
|
735
|
+
Enabled: true
|
736
|
+
AllowMultipleStyles: true
|
737
|
+
VersionAdded: '0.49'
|
738
|
+
VersionChanged: '0.77'
|
739
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
740
|
+
#
|
741
|
+
# key - left alignment of keys
|
742
|
+
# 'a' => 2
|
743
|
+
# 'bb' => 3
|
744
|
+
# separator - alignment of hash rockets, keys are right aligned
|
745
|
+
# 'a' => 2
|
746
|
+
# 'bb' => 3
|
747
|
+
# table - left alignment of keys, hash rockets, and values
|
748
|
+
# 'a' => 2
|
749
|
+
# 'bb' => 3
|
750
|
+
EnforcedHashRocketStyle: key
|
751
|
+
SupportedHashRocketStyles:
|
752
|
+
- key
|
753
|
+
- separator
|
754
|
+
- table
|
755
|
+
# Alignment of entries using colon as separator. Valid values are:
|
756
|
+
#
|
757
|
+
# key - left alignment of keys
|
758
|
+
# a: 0
|
759
|
+
# bb: 1
|
760
|
+
# separator - alignment of colons, keys are right aligned
|
761
|
+
# a: 0
|
762
|
+
# bb: 1
|
763
|
+
# table - left alignment of keys and values
|
764
|
+
# a: 0
|
765
|
+
# bb: 1
|
766
|
+
EnforcedColonStyle: key
|
767
|
+
SupportedColonStyles:
|
768
|
+
- key
|
769
|
+
- separator
|
770
|
+
- table
|
771
|
+
# Select whether hashes that are the last argument in a method call should be
|
772
|
+
# inspected? Valid values are:
|
773
|
+
#
|
774
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
775
|
+
# Registers an offense for:
|
776
|
+
# function(a: 1,
|
777
|
+
# b: 2)
|
778
|
+
# Registers an offense for:
|
779
|
+
# function({a: 1,
|
780
|
+
# b: 2})
|
781
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
782
|
+
# Accepts:
|
783
|
+
# function(a: 1,
|
784
|
+
# b: 2)
|
785
|
+
# Accepts:
|
786
|
+
# function({a: 1,
|
787
|
+
# b: 2})
|
788
|
+
# ignore_implicit - Ignore only implicit hashes.
|
789
|
+
# Accepts:
|
790
|
+
# function(a: 1,
|
791
|
+
# b: 2)
|
792
|
+
# Registers an offense for:
|
793
|
+
# function({a: 1,
|
794
|
+
# b: 2})
|
795
|
+
# ignore_explicit - Ignore only explicit hashes.
|
796
|
+
# Accepts:
|
797
|
+
# function({a: 1,
|
798
|
+
# b: 2})
|
799
|
+
# Registers an offense for:
|
800
|
+
# function(a: 1,
|
801
|
+
# b: 2)
|
802
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
803
|
+
SupportedLastArgumentHashStyles:
|
804
|
+
- always_inspect
|
805
|
+
- always_ignore
|
806
|
+
- ignore_implicit
|
807
|
+
- ignore_explicit
|
808
|
+
|
809
|
+
Layout/HeredocArgumentClosingParenthesis:
|
810
|
+
Description: >-
|
811
|
+
Checks for the placement of the closing parenthesis in a
|
812
|
+
method call that passes a HEREDOC string as an argument.
|
813
|
+
Enabled: false
|
814
|
+
StyleGuide: '#heredoc-argument-closing-parentheses'
|
815
|
+
VersionAdded: '0.68'
|
816
|
+
|
817
|
+
Layout/HeredocIndentation:
|
763
818
|
Description: 'This cop checks the indentation of the here document bodies.'
|
764
819
|
StyleGuide: '#squiggly-heredocs'
|
765
820
|
Enabled: true
|
766
821
|
VersionAdded: '0.49'
|
767
|
-
VersionChanged: '0.
|
768
|
-
EnforcedStyle: squiggly
|
769
|
-
SupportedStyles:
|
770
|
-
- squiggly
|
771
|
-
- active_support
|
772
|
-
- powerpack
|
773
|
-
- unindent
|
822
|
+
VersionChanged: '0.85'
|
774
823
|
|
775
824
|
Layout/IndentationConsistency:
|
776
825
|
Description: 'Keep indentation straight.'
|
@@ -791,6 +840,22 @@ Layout/IndentationConsistency:
|
|
791
840
|
# A reference to `EnforcedStyle: indented_internal_methods`.
|
792
841
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
793
842
|
|
843
|
+
Layout/IndentationStyle:
|
844
|
+
Description: 'Consistent indentation either with tabs only or spaces only.'
|
845
|
+
StyleGuide: '#spaces-indentation'
|
846
|
+
Enabled: true
|
847
|
+
VersionAdded: '0.49'
|
848
|
+
VersionChanged: '0.82'
|
849
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
850
|
+
# But it can be overridden by setting this parameter
|
851
|
+
# It is used during auto-correction to determine how many spaces should
|
852
|
+
# replace each tab.
|
853
|
+
IndentationWidth: ~
|
854
|
+
EnforcedStyle: spaces
|
855
|
+
SupportedStyles:
|
856
|
+
- spaces
|
857
|
+
- tabs
|
858
|
+
|
794
859
|
Layout/IndentationWidth:
|
795
860
|
Description: 'Use 2 spaces for indentation.'
|
796
861
|
StyleGuide: '#spaces-indentation'
|
@@ -806,11 +871,6 @@ Layout/InitialIndentation:
|
|
806
871
|
Enabled: true
|
807
872
|
VersionAdded: '0.49'
|
808
873
|
|
809
|
-
Layout/LeadingBlankLines:
|
810
|
-
Description: Check for unnecessary blank lines at the beginning of a file.
|
811
|
-
Enabled: true
|
812
|
-
VersionAdded: '0.57'
|
813
|
-
|
814
874
|
Layout/LeadingCommentSpace:
|
815
875
|
Description: 'Comments should start with a space.'
|
816
876
|
StyleGuide: '#hash-space'
|
@@ -818,6 +878,36 @@ Layout/LeadingCommentSpace:
|
|
818
878
|
VersionAdded: '0.49'
|
819
879
|
VersionChanged: '0.73'
|
820
880
|
AllowDoxygenCommentStyle: false
|
881
|
+
AllowGemfileRubyComment: false
|
882
|
+
|
883
|
+
Layout/LeadingEmptyLines:
|
884
|
+
Description: Check for unnecessary blank lines at the beginning of a file.
|
885
|
+
Enabled: true
|
886
|
+
VersionAdded: '0.57'
|
887
|
+
VersionChanged: '0.77'
|
888
|
+
|
889
|
+
Layout/LineLength:
|
890
|
+
Description: 'Checks that line length does not exceed the configured limit.'
|
891
|
+
StyleGuide: '#max-line-length'
|
892
|
+
Enabled: true
|
893
|
+
VersionAdded: '0.25'
|
894
|
+
VersionChanged: '0.84'
|
895
|
+
AutoCorrect: false
|
896
|
+
Max: 120
|
897
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
898
|
+
# containing a URI to be longer than Max.
|
899
|
+
AllowHeredoc: true
|
900
|
+
AllowURI: true
|
901
|
+
URISchemes:
|
902
|
+
- http
|
903
|
+
- https
|
904
|
+
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
905
|
+
# directives like '# rubocop: enable ...' when calculating a line's length.
|
906
|
+
IgnoreCopDirectives: true
|
907
|
+
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
|
908
|
+
# elements. Strings will be converted to Regexp objects. A line that matches
|
909
|
+
# any regular expression listed in this option will be ignored by LineLength.
|
910
|
+
IgnoredPatterns: []
|
821
911
|
|
822
912
|
Layout/MultilineArrayBraceLayout:
|
823
913
|
Description: >-
|
@@ -960,6 +1050,35 @@ Layout/MultilineOperationIndentation:
|
|
960
1050
|
# But it can be overridden by setting this parameter
|
961
1051
|
IndentationWidth: ~
|
962
1052
|
|
1053
|
+
Layout/ParameterAlignment:
|
1054
|
+
Description: >-
|
1055
|
+
Align the parameters of a method definition if they span more
|
1056
|
+
than one line.
|
1057
|
+
StyleGuide: '#no-double-indent'
|
1058
|
+
Enabled: true
|
1059
|
+
VersionAdded: '0.49'
|
1060
|
+
VersionChanged: '0.77'
|
1061
|
+
# Alignment of parameters in multi-line method calls.
|
1062
|
+
#
|
1063
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
1064
|
+
# column as the first parameter.
|
1065
|
+
#
|
1066
|
+
# def method_foo(a,
|
1067
|
+
# b)
|
1068
|
+
#
|
1069
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
1070
|
+
# level of indentation relative to the start of the line with the method call.
|
1071
|
+
#
|
1072
|
+
# def method_foo(a,
|
1073
|
+
# b)
|
1074
|
+
EnforcedStyle: with_first_parameter
|
1075
|
+
SupportedStyles:
|
1076
|
+
- with_first_parameter
|
1077
|
+
- with_fixed_indentation
|
1078
|
+
# By default, the indentation width from Layout/IndentationWidth is used
|
1079
|
+
# But it can be overridden by setting this parameter
|
1080
|
+
IndentationWidth: ~
|
1081
|
+
|
963
1082
|
Layout/RescueEnsureAlignment:
|
964
1083
|
Description: 'Align rescues and ensures correctly.'
|
965
1084
|
Enabled: true
|
@@ -1024,6 +1143,11 @@ Layout/SpaceAroundKeyword:
|
|
1024
1143
|
Enabled: true
|
1025
1144
|
VersionAdded: '0.49'
|
1026
1145
|
|
1146
|
+
Layout/SpaceAroundMethodCallOperator:
|
1147
|
+
Description: 'Checks method call operators to not have spaces around them.'
|
1148
|
+
Enabled: pending
|
1149
|
+
VersionAdded: '0.82'
|
1150
|
+
|
1027
1151
|
Layout/SpaceAroundOperators:
|
1028
1152
|
Description: 'Use a single space around operators.'
|
1029
1153
|
StyleGuide: '#spaces-operators'
|
@@ -1033,6 +1157,10 @@ Layout/SpaceAroundOperators:
|
|
1033
1157
|
# with an operator on the previous or next line, not counting empty lines
|
1034
1158
|
# or comment lines.
|
1035
1159
|
AllowForAlignment: true
|
1160
|
+
EnforcedStyleForExponentOperator: no_space
|
1161
|
+
SupportedStylesForExponentOperator:
|
1162
|
+
- space
|
1163
|
+
- no_space
|
1036
1164
|
|
1037
1165
|
Layout/SpaceBeforeBlockBraces:
|
1038
1166
|
Description: >-
|
@@ -1128,7 +1256,7 @@ Layout/SpaceInsideBlockBraces:
|
|
1128
1256
|
|
1129
1257
|
Layout/SpaceInsideHashLiteralBraces:
|
1130
1258
|
Description: "Use spaces inside hash literal braces - or don't."
|
1131
|
-
StyleGuide: '#spaces-
|
1259
|
+
StyleGuide: '#spaces-braces'
|
1132
1260
|
Enabled: true
|
1133
1261
|
VersionAdded: '0.49'
|
1134
1262
|
EnforcedStyle: space
|
@@ -1190,23 +1318,12 @@ Layout/SpaceInsideStringInterpolation:
|
|
1190
1318
|
- space
|
1191
1319
|
- no_space
|
1192
1320
|
|
1193
|
-
Layout/
|
1194
|
-
Description: 'No hard tabs.'
|
1195
|
-
StyleGuide: '#spaces-indentation'
|
1196
|
-
Enabled: true
|
1197
|
-
VersionAdded: '0.49'
|
1198
|
-
VersionChanged: '0.51'
|
1199
|
-
# By default, the indentation width from Layout/IndentationWidth is used
|
1200
|
-
# But it can be overridden by setting this parameter
|
1201
|
-
# It is used during auto-correction to determine how many spaces should
|
1202
|
-
# replace each tab.
|
1203
|
-
IndentationWidth: ~
|
1204
|
-
|
1205
|
-
Layout/TrailingBlankLines:
|
1321
|
+
Layout/TrailingEmptyLines:
|
1206
1322
|
Description: 'Checks trailing blank lines and final newline.'
|
1207
1323
|
StyleGuide: '#newline-eof'
|
1208
1324
|
Enabled: true
|
1209
1325
|
VersionAdded: '0.49'
|
1326
|
+
VersionChanged: '0.77'
|
1210
1327
|
EnforcedStyle: final_newline
|
1211
1328
|
SupportedStyles:
|
1212
1329
|
- final_newline
|
@@ -1217,8 +1334,8 @@ Layout/TrailingWhitespace:
|
|
1217
1334
|
StyleGuide: '#no-trailing-whitespace'
|
1218
1335
|
Enabled: true
|
1219
1336
|
VersionAdded: '0.49'
|
1220
|
-
VersionChanged: '0.
|
1221
|
-
AllowInHeredoc:
|
1337
|
+
VersionChanged: '0.83'
|
1338
|
+
AllowInHeredoc: true
|
1222
1339
|
|
1223
1340
|
#################### Lint ##################################
|
1224
1341
|
### Warnings
|
@@ -1238,6 +1355,7 @@ Lint/AmbiguousOperator:
|
|
1238
1355
|
StyleGuide: '#method-invocation-parens'
|
1239
1356
|
Enabled: true
|
1240
1357
|
VersionAdded: '0.17'
|
1358
|
+
VersionChanged: '0.83'
|
1241
1359
|
|
1242
1360
|
Lint/AmbiguousRegexpLiteral:
|
1243
1361
|
Description: >-
|
@@ -1245,6 +1363,7 @@ Lint/AmbiguousRegexpLiteral:
|
|
1245
1363
|
a method invocation without parentheses.
|
1246
1364
|
Enabled: true
|
1247
1365
|
VersionAdded: '0.17'
|
1366
|
+
VersionChanged: '0.83'
|
1248
1367
|
|
1249
1368
|
Lint/AssignmentInCondition:
|
1250
1369
|
Description: "Don't use assignment in conditions."
|
@@ -1258,16 +1377,39 @@ Lint/BigDecimalNew:
|
|
1258
1377
|
Enabled: true
|
1259
1378
|
VersionAdded: '0.53'
|
1260
1379
|
|
1380
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
1381
|
+
Description: 'This cop checks for places where binary operator has identical operands.'
|
1382
|
+
Enabled: pending
|
1383
|
+
Safe: false
|
1384
|
+
VersionAdded: '0.89'
|
1385
|
+
|
1261
1386
|
Lint/BooleanSymbol:
|
1262
1387
|
Description: 'Check for `:true` and `:false` symbols.'
|
1263
1388
|
Enabled: true
|
1389
|
+
Safe: false
|
1264
1390
|
VersionAdded: '0.50'
|
1391
|
+
VersionChanged: '0.83'
|
1265
1392
|
|
1266
1393
|
Lint/CircularArgumentReference:
|
1267
1394
|
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
1268
1395
|
Enabled: true
|
1269
1396
|
VersionAdded: '0.33'
|
1270
1397
|
|
1398
|
+
Lint/ConstantDefinitionInBlock:
|
1399
|
+
Description: 'Do not define constants within a block.'
|
1400
|
+
StyleGuide: '#no-constant-definition-in-block'
|
1401
|
+
Enabled: pending
|
1402
|
+
VersionAdded: '0.91'
|
1403
|
+
|
1404
|
+
Lint/ConstantResolution:
|
1405
|
+
Description: 'Check that constants are fully qualified with `::`.'
|
1406
|
+
Enabled: false
|
1407
|
+
VersionAdded: '0.86'
|
1408
|
+
# Restrict this cop to only looking at certain names
|
1409
|
+
Only: []
|
1410
|
+
# Restrict this cop from only looking at certain names
|
1411
|
+
Ignore: []
|
1412
|
+
|
1271
1413
|
Lint/Debugger:
|
1272
1414
|
Description: 'Check for debugger calls.'
|
1273
1415
|
Enabled: true
|
@@ -1279,26 +1421,48 @@ Lint/DeprecatedClassMethods:
|
|
1279
1421
|
Enabled: true
|
1280
1422
|
VersionAdded: '0.19'
|
1281
1423
|
|
1424
|
+
Lint/DeprecatedOpenSSLConstant:
|
1425
|
+
Description: "Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`."
|
1426
|
+
Enabled: pending
|
1427
|
+
VersionAdded: '0.84'
|
1428
|
+
|
1282
1429
|
Lint/DisjunctiveAssignmentInConstructor:
|
1283
1430
|
Description: 'In constructor, plain assignment is preferred over disjunctive.'
|
1284
1431
|
Enabled: true
|
1285
1432
|
Safe: false
|
1286
1433
|
VersionAdded: '0.62'
|
1434
|
+
VersionChanged: '0.88'
|
1287
1435
|
|
1288
1436
|
Lint/DuplicateCaseCondition:
|
1289
1437
|
Description: 'Do not repeat values in case conditionals.'
|
1290
1438
|
Enabled: true
|
1291
1439
|
VersionAdded: '0.45'
|
1292
1440
|
|
1441
|
+
Lint/DuplicateElsifCondition:
|
1442
|
+
Description: 'Do not repeat conditions used in if `elsif`.'
|
1443
|
+
Enabled: 'pending'
|
1444
|
+
VersionAdded: '0.88'
|
1445
|
+
|
1446
|
+
Lint/DuplicateHashKey:
|
1447
|
+
Description: 'Check for duplicate keys in hash literals.'
|
1448
|
+
Enabled: true
|
1449
|
+
VersionAdded: '0.34'
|
1450
|
+
VersionChanged: '0.77'
|
1451
|
+
|
1293
1452
|
Lint/DuplicateMethods:
|
1294
1453
|
Description: 'Check for duplicate method definitions.'
|
1295
1454
|
Enabled: true
|
1296
1455
|
VersionAdded: '0.29'
|
1297
1456
|
|
1298
|
-
Lint/
|
1299
|
-
Description: 'Check for duplicate
|
1300
|
-
Enabled:
|
1301
|
-
VersionAdded: '0.
|
1457
|
+
Lint/DuplicateRequire:
|
1458
|
+
Description: 'Check for duplicate `require`s and `require_relative`s.'
|
1459
|
+
Enabled: pending
|
1460
|
+
VersionAdded: '0.90'
|
1461
|
+
|
1462
|
+
Lint/DuplicateRescueException:
|
1463
|
+
Description: 'Checks that there are no repeated exceptions used in `rescue` expressions.'
|
1464
|
+
Enabled: pending
|
1465
|
+
VersionAdded: '0.89'
|
1302
1466
|
|
1303
1467
|
Lint/EachWithObjectArgument:
|
1304
1468
|
Description: 'Check for immutable argument given to each_with_object.'
|
@@ -1310,18 +1474,29 @@ Lint/ElseLayout:
|
|
1310
1474
|
Enabled: true
|
1311
1475
|
VersionAdded: '0.17'
|
1312
1476
|
|
1477
|
+
Lint/EmptyConditionalBody:
|
1478
|
+
Description: 'This cop checks for the presence of `if`, `elsif` and `unless` branches without a body.'
|
1479
|
+
Enabled: 'pending'
|
1480
|
+
AllowComments: true
|
1481
|
+
VersionAdded: '0.89'
|
1482
|
+
|
1313
1483
|
Lint/EmptyEnsure:
|
1314
1484
|
Description: 'Checks for empty ensure block.'
|
1315
1485
|
Enabled: true
|
1316
1486
|
VersionAdded: '0.10'
|
1317
1487
|
VersionChanged: '0.48'
|
1318
|
-
AutoCorrect: false
|
1319
1488
|
|
1320
1489
|
Lint/EmptyExpression:
|
1321
1490
|
Description: 'Checks for empty expressions.'
|
1322
1491
|
Enabled: true
|
1323
1492
|
VersionAdded: '0.45'
|
1324
1493
|
|
1494
|
+
Lint/EmptyFile:
|
1495
|
+
Description: 'Enforces that Ruby source files are not empty.'
|
1496
|
+
Enabled: pending
|
1497
|
+
AllowComments: true
|
1498
|
+
VersionAdded: '0.90'
|
1499
|
+
|
1325
1500
|
Lint/EmptyInterpolation:
|
1326
1501
|
Description: 'Checks for empty string interpolation.'
|
1327
1502
|
Enabled: true
|
@@ -1331,18 +1506,16 @@ Lint/EmptyInterpolation:
|
|
1331
1506
|
Lint/EmptyWhen:
|
1332
1507
|
Description: 'Checks for `when` branches with empty bodies.'
|
1333
1508
|
Enabled: true
|
1509
|
+
AllowComments: true
|
1334
1510
|
VersionAdded: '0.45'
|
1335
|
-
|
1336
|
-
Lint/EndInMethod:
|
1337
|
-
Description: 'END blocks should not be placed inside method definitions.'
|
1338
|
-
Enabled: true
|
1339
|
-
VersionAdded: '0.9'
|
1511
|
+
VersionChanged: '0.83'
|
1340
1512
|
|
1341
1513
|
Lint/EnsureReturn:
|
1342
1514
|
Description: 'Do not use return in an ensure block.'
|
1343
1515
|
StyleGuide: '#no-return-ensure'
|
1344
1516
|
Enabled: true
|
1345
1517
|
VersionAdded: '0.9'
|
1518
|
+
VersionChanged: '0.83'
|
1346
1519
|
|
1347
1520
|
Lint/ErbNewArguments:
|
1348
1521
|
Description: 'Use `:trim_mode` and `:eoutvar` keyword arguments to `ERB.new`.'
|
@@ -1355,6 +1528,12 @@ Lint/FlipFlop:
|
|
1355
1528
|
Enabled: true
|
1356
1529
|
VersionAdded: '0.16'
|
1357
1530
|
|
1531
|
+
Lint/FloatComparison:
|
1532
|
+
Description: 'Checks for the presence of precise comparison of floating point numbers.'
|
1533
|
+
StyleGuide: '#float-comparison'
|
1534
|
+
Enabled: pending
|
1535
|
+
VersionAdded: '0.89'
|
1536
|
+
|
1358
1537
|
Lint/FloatOutOfRange:
|
1359
1538
|
Description: >-
|
1360
1539
|
Catches floating-point literals too large or small for Ruby to
|
@@ -1367,13 +1546,12 @@ Lint/FormatParameterMismatch:
|
|
1367
1546
|
Enabled: true
|
1368
1547
|
VersionAdded: '0.33'
|
1369
1548
|
|
1370
|
-
Lint/
|
1371
|
-
Description:
|
1372
|
-
StyleGuide: '#
|
1373
|
-
Enabled:
|
1374
|
-
|
1375
|
-
VersionAdded: '0.
|
1376
|
-
VersionChanged: '0.70'
|
1549
|
+
Lint/HashCompareByIdentity:
|
1550
|
+
Description: 'Prefer using `Hash#compare_by_identity` than using `object_id` for keys.'
|
1551
|
+
StyleGuide: '#identity-comparison'
|
1552
|
+
Enabled: pending
|
1553
|
+
Safe: false
|
1554
|
+
VersionAdded: '0.93'
|
1377
1555
|
|
1378
1556
|
Lint/HeredocMethodCallPosition:
|
1379
1557
|
Description: >-
|
@@ -1383,6 +1561,12 @@ Lint/HeredocMethodCallPosition:
|
|
1383
1561
|
StyleGuide: '#heredoc-method-calls'
|
1384
1562
|
VersionAdded: '0.68'
|
1385
1563
|
|
1564
|
+
Lint/IdentityComparison:
|
1565
|
+
Description: 'Prefer `equal?` over `==` when comparing `object_id`.'
|
1566
|
+
Enabled: pending
|
1567
|
+
StyleGuide: '#identity-comparison'
|
1568
|
+
VersionAdded: '0.91'
|
1569
|
+
|
1386
1570
|
Lint/ImplicitStringConcatenation:
|
1387
1571
|
Description: >-
|
1388
1572
|
Checks for adjacent string literals on the same line, which
|
@@ -1410,7 +1594,9 @@ Lint/InheritException:
|
|
1410
1594
|
Lint/InterpolationCheck:
|
1411
1595
|
Description: 'Raise warning for interpolation in single q strs.'
|
1412
1596
|
Enabled: true
|
1597
|
+
Safe: false
|
1413
1598
|
VersionAdded: '0.50'
|
1599
|
+
VersionChanged: '0.87'
|
1414
1600
|
|
1415
1601
|
Lint/LiteralAsCondition:
|
1416
1602
|
Description: 'Checks of literals used in conditions.'
|
@@ -1430,6 +1616,7 @@ Lint/Loop:
|
|
1430
1616
|
StyleGuide: '#loop-with-break'
|
1431
1617
|
Enabled: true
|
1432
1618
|
VersionAdded: '0.9'
|
1619
|
+
VersionChanged: '0.89'
|
1433
1620
|
|
1434
1621
|
Lint/MissingCopEnableDirective:
|
1435
1622
|
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
@@ -1444,10 +1631,23 @@ Lint/MissingCopEnableDirective:
|
|
1444
1631
|
# .inf for any size
|
1445
1632
|
MaximumRangeSize: .inf
|
1446
1633
|
|
1447
|
-
Lint/
|
1448
|
-
Description:
|
1634
|
+
Lint/MissingSuper:
|
1635
|
+
Description: >-
|
1636
|
+
This cop checks for the presence of constructors and lifecycle callbacks
|
1637
|
+
without calls to `super`'.
|
1638
|
+
Enabled: pending
|
1639
|
+
VersionAdded: '0.89'
|
1640
|
+
|
1641
|
+
Lint/MixedRegexpCaptureTypes:
|
1642
|
+
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
|
1643
|
+
Enabled: pending
|
1644
|
+
VersionAdded: '0.85'
|
1645
|
+
|
1646
|
+
Lint/MultipleComparison:
|
1647
|
+
Description: "Use `&&` operator to compare multiple values."
|
1449
1648
|
Enabled: true
|
1450
1649
|
VersionAdded: '0.47'
|
1650
|
+
VersionChanged: '0.77'
|
1451
1651
|
|
1452
1652
|
Lint/NestedMethodDefinition:
|
1453
1653
|
Description: 'Do not use nested method definitions.'
|
@@ -1467,6 +1667,12 @@ Lint/NextWithoutAccumulator:
|
|
1467
1667
|
Enabled: true
|
1468
1668
|
VersionAdded: '0.36'
|
1469
1669
|
|
1670
|
+
Lint/NonDeterministicRequireOrder:
|
1671
|
+
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
1672
|
+
Enabled: true
|
1673
|
+
VersionAdded: '0.78'
|
1674
|
+
Safe: false
|
1675
|
+
|
1470
1676
|
Lint/NonLocalExitFromIterator:
|
1471
1677
|
Description: 'Do not use return in iterator to cause non-local exit.'
|
1472
1678
|
Enabled: true
|
@@ -1484,6 +1690,12 @@ Lint/OrderedMagicComments:
|
|
1484
1690
|
Enabled: true
|
1485
1691
|
VersionAdded: '0.53'
|
1486
1692
|
|
1693
|
+
Lint/OutOfRangeRegexpRef:
|
1694
|
+
Description: 'Checks for out of range reference for Regexp because it always returns nil.'
|
1695
|
+
Enabled: pending
|
1696
|
+
Safe: false
|
1697
|
+
VersionAdded: '0.89'
|
1698
|
+
|
1487
1699
|
Lint/ParenthesesAsGroupedExpression:
|
1488
1700
|
Description: >-
|
1489
1701
|
Checks for method calls with a space before the opening
|
@@ -1491,6 +1703,7 @@ Lint/ParenthesesAsGroupedExpression:
|
|
1491
1703
|
StyleGuide: '#parens-no-spaces'
|
1492
1704
|
Enabled: true
|
1493
1705
|
VersionAdded: '0.12'
|
1706
|
+
VersionChanged: '0.83'
|
1494
1707
|
|
1495
1708
|
Lint/PercentStringArray:
|
1496
1709
|
Description: >-
|
@@ -1505,6 +1718,16 @@ Lint/PercentSymbolArray:
|
|
1505
1718
|
Enabled: true
|
1506
1719
|
VersionAdded: '0.41'
|
1507
1720
|
|
1721
|
+
Lint/RaiseException:
|
1722
|
+
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
1723
|
+
StyleGuide: '#raise-exception'
|
1724
|
+
Enabled: pending
|
1725
|
+
Safe: false
|
1726
|
+
VersionAdded: '0.81'
|
1727
|
+
VersionChanged: '0.86'
|
1728
|
+
AllowedImplicitNamespaces:
|
1729
|
+
- 'Gem'
|
1730
|
+
|
1508
1731
|
Lint/RandOne:
|
1509
1732
|
Description: >-
|
1510
1733
|
Checks for `rand(1)` calls. Such calls always return `0`
|
@@ -1512,6 +1735,49 @@ Lint/RandOne:
|
|
1512
1735
|
Enabled: true
|
1513
1736
|
VersionAdded: '0.36'
|
1514
1737
|
|
1738
|
+
Lint/RedundantCopDisableDirective:
|
1739
|
+
Description: >-
|
1740
|
+
Checks for rubocop:disable comments that can be removed.
|
1741
|
+
Note: this cop is not disabled when disabling all cops.
|
1742
|
+
It must be explicitly disabled.
|
1743
|
+
Enabled: true
|
1744
|
+
VersionAdded: '0.76'
|
1745
|
+
|
1746
|
+
Lint/RedundantCopEnableDirective:
|
1747
|
+
Description: Checks for rubocop:enable comments that can be removed.
|
1748
|
+
Enabled: true
|
1749
|
+
VersionAdded: '0.76'
|
1750
|
+
|
1751
|
+
Lint/RedundantRequireStatement:
|
1752
|
+
Description: 'Checks for unnecessary `require` statement.'
|
1753
|
+
Enabled: true
|
1754
|
+
VersionAdded: '0.76'
|
1755
|
+
|
1756
|
+
Lint/RedundantSafeNavigation:
|
1757
|
+
Description: 'Checks for redundant safe navigation calls.'
|
1758
|
+
Enabled: pending
|
1759
|
+
VersionAdded: '0.93'
|
1760
|
+
AllowedMethods:
|
1761
|
+
- instance_of?
|
1762
|
+
- kind_of?
|
1763
|
+
- is_a?
|
1764
|
+
- eql?
|
1765
|
+
- respond_to?
|
1766
|
+
- equal?
|
1767
|
+
Safe: false
|
1768
|
+
|
1769
|
+
Lint/RedundantSplatExpansion:
|
1770
|
+
Description: 'Checks for splat unnecessarily being called on literals.'
|
1771
|
+
Enabled: true
|
1772
|
+
VersionAdded: '0.76'
|
1773
|
+
|
1774
|
+
Lint/RedundantStringCoercion:
|
1775
|
+
Description: 'Checks for Object#to_s usage in string interpolation.'
|
1776
|
+
StyleGuide: '#no-to-s'
|
1777
|
+
Enabled: true
|
1778
|
+
VersionAdded: '0.19'
|
1779
|
+
VersionChanged: '0.77'
|
1780
|
+
|
1515
1781
|
Lint/RedundantWithIndex:
|
1516
1782
|
Description: 'Checks for redundant `with_index`.'
|
1517
1783
|
Enabled: true
|
@@ -1528,6 +1794,7 @@ Lint/RegexpAsCondition:
|
|
1528
1794
|
The regexp literal matches `$_` implicitly.
|
1529
1795
|
Enabled: true
|
1530
1796
|
VersionAdded: '0.51'
|
1797
|
+
VersionChanged: '0.86'
|
1531
1798
|
|
1532
1799
|
Lint/RequireParentheses:
|
1533
1800
|
Description: >-
|
@@ -1557,13 +1824,14 @@ Lint/SafeNavigationChain:
|
|
1557
1824
|
Description: 'Do not chain ordinary method call after safe navigation operator.'
|
1558
1825
|
Enabled: true
|
1559
1826
|
VersionAdded: '0.47'
|
1560
|
-
VersionChanged: '0.
|
1561
|
-
|
1827
|
+
VersionChanged: '0.77'
|
1828
|
+
AllowedMethods:
|
1562
1829
|
- present?
|
1563
1830
|
- blank?
|
1564
1831
|
- presence
|
1565
1832
|
- try
|
1566
1833
|
- try!
|
1834
|
+
- in?
|
1567
1835
|
|
1568
1836
|
Lint/SafeNavigationConsistency:
|
1569
1837
|
Description: >-
|
@@ -1572,18 +1840,19 @@ Lint/SafeNavigationConsistency:
|
|
1572
1840
|
for all method calls on that same object.
|
1573
1841
|
Enabled: true
|
1574
1842
|
VersionAdded: '0.55'
|
1575
|
-
|
1843
|
+
VersionChanged: '0.77'
|
1844
|
+
AllowedMethods:
|
1576
1845
|
- present?
|
1577
1846
|
- blank?
|
1578
1847
|
- presence
|
1579
1848
|
- try
|
1580
1849
|
- try!
|
1581
1850
|
|
1582
|
-
|
1583
1851
|
Lint/SafeNavigationWithEmpty:
|
1584
1852
|
Description: 'Avoid `foo&.empty?` in conditionals.'
|
1585
1853
|
Enabled: true
|
1586
1854
|
VersionAdded: '0.62'
|
1855
|
+
VersionChanged: '0.87'
|
1587
1856
|
|
1588
1857
|
Lint/ScriptPermission:
|
1589
1858
|
Description: 'Grant script file execute permission.'
|
@@ -1591,6 +1860,11 @@ Lint/ScriptPermission:
|
|
1591
1860
|
VersionAdded: '0.49'
|
1592
1861
|
VersionChanged: '0.50'
|
1593
1862
|
|
1863
|
+
Lint/SelfAssignment:
|
1864
|
+
Description: 'Checks for self-assignments.'
|
1865
|
+
Enabled: pending
|
1866
|
+
VersionAdded: '0.89'
|
1867
|
+
|
1594
1868
|
Lint/SendWithMixinArgument:
|
1595
1869
|
Description: 'Checks for `send` method when using mixin.'
|
1596
1870
|
Enabled: true
|
@@ -1617,12 +1891,18 @@ Lint/ShadowingOuterLocalVariable:
|
|
1617
1891
|
Enabled: true
|
1618
1892
|
VersionAdded: '0.9'
|
1619
1893
|
|
1620
|
-
Lint/
|
1621
|
-
Description: '
|
1622
|
-
|
1894
|
+
Lint/StructNewOverride:
|
1895
|
+
Description: 'Disallow overriding the `Struct` built-in methods via `Struct.new`.'
|
1896
|
+
Enabled: pending
|
1897
|
+
VersionAdded: '0.81'
|
1898
|
+
|
1899
|
+
Lint/SuppressedException:
|
1900
|
+
Description: "Don't suppress exceptions."
|
1901
|
+
StyleGuide: '#dont-hide-exceptions'
|
1623
1902
|
Enabled: true
|
1624
|
-
|
1625
|
-
|
1903
|
+
AllowComments: true
|
1904
|
+
VersionAdded: '0.9'
|
1905
|
+
VersionChanged: '0.81'
|
1626
1906
|
|
1627
1907
|
Lint/Syntax:
|
1628
1908
|
Description: 'Checks syntax error.'
|
@@ -1633,47 +1913,39 @@ Lint/Syntax:
|
|
1633
1913
|
Lint/ToJSON:
|
1634
1914
|
Description: 'Ensure #to_json includes an optional argument.'
|
1635
1915
|
Enabled: true
|
1916
|
+
VersionAdded: '0.66'
|
1636
1917
|
|
1637
|
-
Lint/
|
1638
|
-
Description: '
|
1639
|
-
Enabled:
|
1640
|
-
VersionAdded: '0.
|
1641
|
-
AllowKeywordBlockArguments: false
|
1642
|
-
|
1643
|
-
Lint/UnifiedInteger:
|
1644
|
-
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1645
|
-
Enabled: true
|
1646
|
-
VersionAdded: '0.43'
|
1647
|
-
|
1648
|
-
Lint/UnneededCopDisableDirective:
|
1649
|
-
Description: >-
|
1650
|
-
Checks for rubocop:disable comments that can be removed.
|
1651
|
-
Note: this cop is not disabled when disabling all cops.
|
1652
|
-
It must be explicitly disabled.
|
1653
|
-
Enabled: true
|
1654
|
-
VersionAdded: '0.53'
|
1655
|
-
|
1656
|
-
Lint/UnneededCopEnableDirective:
|
1657
|
-
Description: Checks for rubocop:enable comments that can be removed.
|
1658
|
-
Enabled: true
|
1659
|
-
VersionAdded: '0.53'
|
1918
|
+
Lint/TopLevelReturnWithArgument:
|
1919
|
+
Description: 'This cop detects top level return statements with argument.'
|
1920
|
+
Enabled: 'pending'
|
1921
|
+
VersionAdded: '0.89'
|
1660
1922
|
|
1661
|
-
Lint/
|
1662
|
-
Description: '
|
1923
|
+
Lint/TrailingCommaInAttributeDeclaration:
|
1924
|
+
Description: 'This cop checks for trailing commas in attribute declarations.'
|
1925
|
+
Enabled: pending
|
1926
|
+
VersionAdded: '0.90'
|
1927
|
+
|
1928
|
+
Lint/UnderscorePrefixedVariableName:
|
1929
|
+
Description: 'Do not use prefix `_` for a variable that is used.'
|
1663
1930
|
Enabled: true
|
1664
|
-
VersionAdded: '0.
|
1931
|
+
VersionAdded: '0.21'
|
1932
|
+
AllowKeywordBlockArguments: false
|
1665
1933
|
|
1666
|
-
Lint/
|
1667
|
-
Description: '
|
1934
|
+
Lint/UnifiedInteger:
|
1935
|
+
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1668
1936
|
Enabled: true
|
1669
1937
|
VersionAdded: '0.43'
|
1670
|
-
VersionChanged: '0.74'
|
1671
1938
|
|
1672
1939
|
Lint/UnreachableCode:
|
1673
1940
|
Description: 'Unreachable code.'
|
1674
1941
|
Enabled: true
|
1675
1942
|
VersionAdded: '0.9'
|
1676
1943
|
|
1944
|
+
Lint/UnreachableLoop:
|
1945
|
+
Description: 'This cop checks for loops that will have at most one iteration.'
|
1946
|
+
Enabled: pending
|
1947
|
+
VersionAdded: '0.89'
|
1948
|
+
|
1677
1949
|
Lint/UnusedBlockArgument:
|
1678
1950
|
Description: 'Checks for unused block arguments.'
|
1679
1951
|
StyleGuide: '#underscore-unused-vars'
|
@@ -1688,9 +1960,10 @@ Lint/UnusedMethodArgument:
|
|
1688
1960
|
StyleGuide: '#underscore-unused-vars'
|
1689
1961
|
Enabled: true
|
1690
1962
|
VersionAdded: '0.21'
|
1691
|
-
VersionChanged: '0.
|
1963
|
+
VersionChanged: '0.81'
|
1692
1964
|
AllowUnusedKeywordArguments: false
|
1693
1965
|
IgnoreEmptyMethods: true
|
1966
|
+
IgnoreNotImplementedMethods: true
|
1694
1967
|
|
1695
1968
|
Lint/UriEscapeUnescape:
|
1696
1969
|
Description: >-
|
@@ -1712,7 +1985,7 @@ Lint/UselessAccessModifier:
|
|
1712
1985
|
Description: 'Checks for useless access modifiers.'
|
1713
1986
|
Enabled: true
|
1714
1987
|
VersionAdded: '0.20'
|
1715
|
-
VersionChanged: '0.
|
1988
|
+
VersionChanged: '0.83'
|
1716
1989
|
ContextCreatingMethods: []
|
1717
1990
|
MethodCreatingMethods: []
|
1718
1991
|
|
@@ -1722,20 +1995,30 @@ Lint/UselessAssignment:
|
|
1722
1995
|
Enabled: true
|
1723
1996
|
VersionAdded: '0.11'
|
1724
1997
|
|
1725
|
-
Lint/UselessComparison:
|
1726
|
-
Description: 'Checks for comparison of something with itself.'
|
1727
|
-
Enabled: true
|
1728
|
-
VersionAdded: '0.11'
|
1729
|
-
|
1730
1998
|
Lint/UselessElseWithoutRescue:
|
1731
1999
|
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
1732
2000
|
Enabled: true
|
1733
2001
|
VersionAdded: '0.17'
|
1734
2002
|
|
2003
|
+
Lint/UselessMethodDefinition:
|
2004
|
+
Description: 'Checks for useless method definitions.'
|
2005
|
+
Enabled: pending
|
2006
|
+
VersionAdded: '0.90'
|
2007
|
+
Safe: false
|
2008
|
+
AllowComments: true
|
2009
|
+
|
1735
2010
|
Lint/UselessSetterCall:
|
1736
2011
|
Description: 'Checks for useless setter call to a local variable.'
|
1737
2012
|
Enabled: true
|
1738
2013
|
VersionAdded: '0.13'
|
2014
|
+
VersionChanged: '0.80'
|
2015
|
+
Safe: false
|
2016
|
+
|
2017
|
+
Lint/UselessTimes:
|
2018
|
+
Description: 'Checks for useless `Integer#times` calls.'
|
2019
|
+
Enabled: pending
|
2020
|
+
VersionAdded: '0.91'
|
2021
|
+
Safe: false
|
1739
2022
|
|
1740
2023
|
Lint/Void:
|
1741
2024
|
Description: 'Possible use of operator/literal/variable in void context.'
|
@@ -1754,18 +2037,20 @@ Metrics/AbcSize:
|
|
1754
2037
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
1755
2038
|
Enabled: true
|
1756
2039
|
VersionAdded: '0.27'
|
1757
|
-
VersionChanged: '0.
|
2040
|
+
VersionChanged: '0.81'
|
1758
2041
|
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1759
2042
|
# a Float.
|
1760
|
-
|
2043
|
+
IgnoredMethods: []
|
2044
|
+
Max: 17
|
1761
2045
|
|
1762
2046
|
Metrics/BlockLength:
|
1763
2047
|
Description: 'Avoid long blocks with many lines.'
|
1764
2048
|
Enabled: true
|
1765
2049
|
VersionAdded: '0.44'
|
1766
|
-
VersionChanged: '0.
|
2050
|
+
VersionChanged: '0.87'
|
1767
2051
|
CountComments: false # count full line comments?
|
1768
2052
|
Max: 25
|
2053
|
+
CountAsOne: []
|
1769
2054
|
ExcludedMethods:
|
1770
2055
|
# By default, exclude the `#refine` method, as it tends to have larger
|
1771
2056
|
# associated blocks.
|
@@ -1786,8 +2071,10 @@ Metrics/ClassLength:
|
|
1786
2071
|
Description: 'Avoid classes longer than 100 lines of code.'
|
1787
2072
|
Enabled: true
|
1788
2073
|
VersionAdded: '0.25'
|
2074
|
+
VersionChanged: '0.87'
|
1789
2075
|
CountComments: false # count full line comments?
|
1790
2076
|
Max: 100
|
2077
|
+
CountAsOne: []
|
1791
2078
|
|
1792
2079
|
# Avoid complex methods.
|
1793
2080
|
Metrics/CyclomaticComplexity:
|
@@ -1796,47 +2083,29 @@ Metrics/CyclomaticComplexity:
|
|
1796
2083
|
of test cases needed to validate a method.
|
1797
2084
|
Enabled: true
|
1798
2085
|
VersionAdded: '0.25'
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
Description: 'Limit lines to 80 characters.'
|
1803
|
-
StyleGuide: '#80-character-limits'
|
1804
|
-
Enabled: true
|
1805
|
-
VersionAdded: '0.25'
|
1806
|
-
VersionChanged: '0.68'
|
1807
|
-
AutoCorrect: false
|
1808
|
-
Max: 80
|
1809
|
-
# To make it possible to copy or click on URIs in the code, we allow lines
|
1810
|
-
# containing a URI to be longer than Max.
|
1811
|
-
AllowHeredoc: true
|
1812
|
-
AllowURI: true
|
1813
|
-
URISchemes:
|
1814
|
-
- http
|
1815
|
-
- https
|
1816
|
-
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
1817
|
-
# directives like '# rubocop: enable ...' when calculating a line's length.
|
1818
|
-
IgnoreCopDirectives: true
|
1819
|
-
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
|
1820
|
-
# elements. Strings will be converted to Regexp objects. A line that matches
|
1821
|
-
# any regular expression listed in this option will be ignored by LineLength.
|
1822
|
-
IgnoredPatterns: []
|
2086
|
+
VersionChanged: '0.81'
|
2087
|
+
IgnoredMethods: []
|
2088
|
+
Max: 7
|
1823
2089
|
|
1824
2090
|
Metrics/MethodLength:
|
1825
2091
|
Description: 'Avoid methods longer than 10 lines of code.'
|
1826
2092
|
StyleGuide: '#short-methods'
|
1827
2093
|
Enabled: true
|
1828
2094
|
VersionAdded: '0.25'
|
1829
|
-
VersionChanged: '0.
|
2095
|
+
VersionChanged: '0.87'
|
1830
2096
|
CountComments: false # count full line comments?
|
1831
2097
|
Max: 10
|
2098
|
+
CountAsOne: []
|
1832
2099
|
ExcludedMethods: []
|
1833
2100
|
|
1834
2101
|
Metrics/ModuleLength:
|
1835
2102
|
Description: 'Avoid modules longer than 100 lines of code.'
|
1836
2103
|
Enabled: true
|
1837
2104
|
VersionAdded: '0.31'
|
2105
|
+
VersionChanged: '0.87'
|
1838
2106
|
CountComments: false # count full line comments?
|
1839
2107
|
Max: 100
|
2108
|
+
CountAsOne: []
|
1840
2109
|
|
1841
2110
|
Metrics/ParameterLists:
|
1842
2111
|
Description: 'Avoid parameter lists longer than three or four parameters.'
|
@@ -1852,7 +2121,9 @@ Metrics/PerceivedComplexity:
|
|
1852
2121
|
human reader.
|
1853
2122
|
Enabled: true
|
1854
2123
|
VersionAdded: '0.25'
|
1855
|
-
|
2124
|
+
VersionChanged: '0.81'
|
2125
|
+
IgnoredMethods: []
|
2126
|
+
Max: 8
|
1856
2127
|
|
1857
2128
|
################## Migration #############################
|
1858
2129
|
|
@@ -1860,7 +2131,8 @@ Migration/DepartmentName:
|
|
1860
2131
|
Description: >-
|
1861
2132
|
Check that cop names in rubocop:disable (etc) comments are
|
1862
2133
|
given with department name.
|
1863
|
-
Enabled:
|
2134
|
+
Enabled: true
|
2135
|
+
VersionAdded: '0.75'
|
1864
2136
|
|
1865
2137
|
#################### Naming ##############################
|
1866
2138
|
|
@@ -1871,10 +2143,12 @@ Naming/AccessorMethodName:
|
|
1871
2143
|
VersionAdded: '0.50'
|
1872
2144
|
|
1873
2145
|
Naming/AsciiIdentifiers:
|
1874
|
-
Description: 'Use only ascii symbols in identifiers.'
|
2146
|
+
Description: 'Use only ascii symbols in identifiers and constants.'
|
1875
2147
|
StyleGuide: '#english-identifiers'
|
1876
2148
|
Enabled: true
|
1877
2149
|
VersionAdded: '0.50'
|
2150
|
+
VersionChanged: '0.87'
|
2151
|
+
AsciiConstants: true
|
1878
2152
|
|
1879
2153
|
Naming/BinaryOperatorParameterName:
|
1880
2154
|
Description: 'When defining binary operators, name the argument other.'
|
@@ -1882,11 +2156,31 @@ Naming/BinaryOperatorParameterName:
|
|
1882
2156
|
Enabled: true
|
1883
2157
|
VersionAdded: '0.50'
|
1884
2158
|
|
2159
|
+
Naming/BlockParameterName:
|
2160
|
+
Description: >-
|
2161
|
+
Checks for block parameter names that contain capital letters,
|
2162
|
+
end in numbers, or do not meet a minimal length.
|
2163
|
+
Enabled: true
|
2164
|
+
VersionAdded: '0.53'
|
2165
|
+
VersionChanged: '0.77'
|
2166
|
+
# Parameter names may be equal to or greater than this value
|
2167
|
+
MinNameLength: 1
|
2168
|
+
AllowNamesEndingInNumbers: true
|
2169
|
+
# Allowed names that will not register an offense
|
2170
|
+
AllowedNames: []
|
2171
|
+
# Forbidden names that will register an offense
|
2172
|
+
ForbiddenNames: []
|
2173
|
+
|
1885
2174
|
Naming/ClassAndModuleCamelCase:
|
1886
2175
|
Description: 'Use CamelCase for classes and modules.'
|
1887
2176
|
StyleGuide: '#camelcase-classes'
|
1888
2177
|
Enabled: true
|
1889
2178
|
VersionAdded: '0.50'
|
2179
|
+
VersionChanged: '0.85'
|
2180
|
+
# Allowed class/module names can be specified here.
|
2181
|
+
# These can be full or part of the name.
|
2182
|
+
AllowedNames:
|
2183
|
+
- module_parent
|
1890
2184
|
|
1891
2185
|
Naming/ConstantName:
|
1892
2186
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
@@ -1907,6 +2201,10 @@ Naming/FileName:
|
|
1907
2201
|
# It further expects it to be nested inside modules which match the names
|
1908
2202
|
# of subdirectories in its path.
|
1909
2203
|
ExpectMatchingDefinition: false
|
2204
|
+
# When `false`, changes the behavior of ExpectMatchingDefinition to match only
|
2205
|
+
# whether each source file's class or module name matches the file name --
|
2206
|
+
# not whether the nested module hierarchy matches the subdirectory path.
|
2207
|
+
CheckDefinitionPathHierarchy: true
|
1910
2208
|
# If non-`nil`, expect all source file names to match the following regex.
|
1911
2209
|
# Only the file name itself is matched, not the entire file path.
|
1912
2210
|
# Use anchors as necessary if you want to match the entire name rather than
|
@@ -1973,7 +2271,7 @@ Naming/HeredocDelimiterNaming:
|
|
1973
2271
|
StyleGuide: '#heredoc-delimiters'
|
1974
2272
|
Enabled: true
|
1975
2273
|
VersionAdded: '0.50'
|
1976
|
-
|
2274
|
+
ForbiddenDelimiters:
|
1977
2275
|
- !ruby/regexp '/(^|\s)(EO[A-Z]{1}|END)(\s|$)/'
|
1978
2276
|
|
1979
2277
|
Naming/MemoizedInstanceVariableName:
|
@@ -2005,25 +2303,52 @@ Naming/MethodName:
|
|
2005
2303
|
#
|
2006
2304
|
IgnoredPatterns: []
|
2007
2305
|
|
2306
|
+
Naming/MethodParameterName:
|
2307
|
+
Description: >-
|
2308
|
+
Checks for method parameter names that contain capital letters,
|
2309
|
+
end in numbers, or do not meet a minimal length.
|
2310
|
+
Enabled: true
|
2311
|
+
VersionAdded: '0.53'
|
2312
|
+
VersionChanged: '0.77'
|
2313
|
+
# Parameter names may be equal to or greater than this value
|
2314
|
+
MinNameLength: 3
|
2315
|
+
AllowNamesEndingInNumbers: true
|
2316
|
+
# Allowed names that will not register an offense
|
2317
|
+
AllowedNames:
|
2318
|
+
- at
|
2319
|
+
- by
|
2320
|
+
- db
|
2321
|
+
- id
|
2322
|
+
- in
|
2323
|
+
- io
|
2324
|
+
- ip
|
2325
|
+
- of
|
2326
|
+
- 'on'
|
2327
|
+
- os
|
2328
|
+
- pp
|
2329
|
+
- to
|
2330
|
+
# Forbidden names that will register an offense
|
2331
|
+
ForbiddenNames: []
|
2332
|
+
|
2008
2333
|
Naming/PredicateName:
|
2009
2334
|
Description: 'Check the names of predicate methods.'
|
2010
2335
|
StyleGuide: '#bool-methods-qmark'
|
2011
2336
|
Enabled: true
|
2012
2337
|
VersionAdded: '0.50'
|
2013
|
-
VersionChanged: '0.
|
2338
|
+
VersionChanged: '0.77'
|
2014
2339
|
# Predicate name prefixes.
|
2015
2340
|
NamePrefix:
|
2016
2341
|
- is_
|
2017
2342
|
- has_
|
2018
2343
|
- have_
|
2019
2344
|
# Predicate name prefixes that should be removed.
|
2020
|
-
|
2345
|
+
ForbiddenPrefixes:
|
2021
2346
|
- is_
|
2022
2347
|
- has_
|
2023
2348
|
- have_
|
2024
|
-
# Predicate names which, despite having a
|
2349
|
+
# Predicate names which, despite having a forbidden prefix, or no `?`,
|
2025
2350
|
# should still be accepted
|
2026
|
-
|
2351
|
+
AllowedMethods:
|
2027
2352
|
- is_a?
|
2028
2353
|
# Method definition macros for dynamically generated methods.
|
2029
2354
|
MethodDefinitionMacros:
|
@@ -2041,45 +2366,6 @@ Naming/RescuedExceptionsVariableName:
|
|
2041
2366
|
VersionChanged: '0.68'
|
2042
2367
|
PreferredName: e
|
2043
2368
|
|
2044
|
-
Naming/UncommunicativeBlockParamName:
|
2045
|
-
Description: >-
|
2046
|
-
Checks for block parameter names that contain capital letters,
|
2047
|
-
end in numbers, or do not meet a minimal length.
|
2048
|
-
Enabled: true
|
2049
|
-
VersionAdded: '0.53'
|
2050
|
-
# Parameter names may be equal to or greater than this value
|
2051
|
-
MinNameLength: 1
|
2052
|
-
AllowNamesEndingInNumbers: true
|
2053
|
-
# Whitelisted names that will not register an offense
|
2054
|
-
AllowedNames: []
|
2055
|
-
# Blacklisted names that will register an offense
|
2056
|
-
ForbiddenNames: []
|
2057
|
-
|
2058
|
-
Naming/UncommunicativeMethodParamName:
|
2059
|
-
Description: >-
|
2060
|
-
Checks for method parameter names that contain capital letters,
|
2061
|
-
end in numbers, or do not meet a minimal length.
|
2062
|
-
Enabled: true
|
2063
|
-
VersionAdded: '0.53'
|
2064
|
-
VersionChanged: '0.59'
|
2065
|
-
# Parameter names may be equal to or greater than this value
|
2066
|
-
MinNameLength: 3
|
2067
|
-
AllowNamesEndingInNumbers: true
|
2068
|
-
# Whitelisted names that will not register an offense
|
2069
|
-
AllowedNames:
|
2070
|
-
- io
|
2071
|
-
- id
|
2072
|
-
- to
|
2073
|
-
- by
|
2074
|
-
- 'on'
|
2075
|
-
- in
|
2076
|
-
- at
|
2077
|
-
- ip
|
2078
|
-
- db
|
2079
|
-
# Blacklisted names that will register an offense
|
2080
|
-
ForbiddenNames: []
|
2081
|
-
|
2082
|
-
|
2083
2369
|
Naming/VariableName:
|
2084
2370
|
Description: 'Use the configured style when naming variables.'
|
2085
2371
|
StyleGuide: '#snake-case-symbols-methods-vars'
|
@@ -2111,7 +2397,7 @@ Security/JSONLoad:
|
|
2111
2397
|
Description: >-
|
2112
2398
|
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
2113
2399
|
security issues. See reference for more information.
|
2114
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2400
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
2115
2401
|
Enabled: true
|
2116
2402
|
VersionAdded: '0.43'
|
2117
2403
|
VersionChanged: '0.44'
|
@@ -2124,7 +2410,7 @@ Security/MarshalLoad:
|
|
2124
2410
|
Description: >-
|
2125
2411
|
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
2126
2412
|
security issues. See reference for more information.
|
2127
|
-
Reference: 'https://ruby-doc.org/core-2.
|
2413
|
+
Reference: 'https://ruby-doc.org/core-2.7.0/Marshal.html#module-Marshal-label-Security+considerations'
|
2128
2414
|
Enabled: true
|
2129
2415
|
VersionAdded: '0.47'
|
2130
2416
|
|
@@ -2138,7 +2424,7 @@ Security/YAMLLoad:
|
|
2138
2424
|
Description: >-
|
2139
2425
|
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
2140
2426
|
security issues. See reference for more information.
|
2141
|
-
Reference: 'https://ruby-doc.org/stdlib-2.
|
2427
|
+
Reference: 'https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
2142
2428
|
Enabled: true
|
2143
2429
|
VersionAdded: '0.47'
|
2144
2430
|
SafeAutoCorrect: false
|
@@ -2149,10 +2435,23 @@ Style/AccessModifierDeclarations:
|
|
2149
2435
|
Description: 'Checks style of how access modifiers are used.'
|
2150
2436
|
Enabled: true
|
2151
2437
|
VersionAdded: '0.57'
|
2438
|
+
VersionChanged: '0.81'
|
2152
2439
|
EnforcedStyle: group
|
2153
2440
|
SupportedStyles:
|
2154
2441
|
- inline
|
2155
2442
|
- group
|
2443
|
+
AllowModifiersOnSymbols: true
|
2444
|
+
|
2445
|
+
Style/AccessorGrouping:
|
2446
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
2447
|
+
Enabled: 'pending'
|
2448
|
+
VersionAdded: '0.87'
|
2449
|
+
EnforcedStyle: grouped
|
2450
|
+
SupportedStyles:
|
2451
|
+
# separated: each accessor goes in a separate statement.
|
2452
|
+
# grouped: accessors are grouped into a single statement.
|
2453
|
+
- separated
|
2454
|
+
- grouped
|
2156
2455
|
|
2157
2456
|
Style/Alias:
|
2158
2457
|
Description: 'Use alias instead of alias_method.'
|
@@ -2173,11 +2472,20 @@ Style/AndOr:
|
|
2173
2472
|
VersionChanged: '0.25'
|
2174
2473
|
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
2175
2474
|
# or completely (always).
|
2176
|
-
EnforcedStyle:
|
2475
|
+
EnforcedStyle: conditionals
|
2177
2476
|
SupportedStyles:
|
2178
2477
|
- always
|
2179
2478
|
- conditionals
|
2180
2479
|
|
2480
|
+
Style/ArrayCoercion:
|
2481
|
+
Description: >-
|
2482
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
2483
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
2484
|
+
StyleGuide: '#array-coercion'
|
2485
|
+
Safe: false
|
2486
|
+
Enabled: false
|
2487
|
+
VersionAdded: '0.88'
|
2488
|
+
|
2181
2489
|
Style/ArrayJoin:
|
2182
2490
|
Description: 'Use Array#join instead of Array#*.'
|
2183
2491
|
StyleGuide: '#array-join'
|
@@ -2221,6 +2529,13 @@ Style/BeginBlock:
|
|
2221
2529
|
Enabled: true
|
2222
2530
|
VersionAdded: '0.9'
|
2223
2531
|
|
2532
|
+
Style/BisectedAttrAccessor:
|
2533
|
+
Description: >-
|
2534
|
+
Checks for places where `attr_reader` and `attr_writer`
|
2535
|
+
for the same method can be combined into single `attr_accessor`.
|
2536
|
+
Enabled: 'pending'
|
2537
|
+
VersionAdded: '0.87'
|
2538
|
+
|
2224
2539
|
Style/BlockComments:
|
2225
2540
|
Description: 'Do not use block comments.'
|
2226
2541
|
StyleGuide: '#no-block-comments'
|
@@ -2331,30 +2646,35 @@ Style/BlockDelimiters:
|
|
2331
2646
|
# # also good
|
2332
2647
|
# collection.each do |element| puts element end
|
2333
2648
|
AllowBracesOnProceduralOneLiners: false
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
EnforcedStyle: no_braces
|
2341
|
-
SupportedStyles:
|
2342
|
-
# The `braces` style enforces braces around all method parameters that are
|
2343
|
-
# hashes.
|
2344
|
-
- braces
|
2345
|
-
# The `no_braces` style checks that the last parameter doesn't have braces
|
2346
|
-
# around it.
|
2347
|
-
- no_braces
|
2348
|
-
# The `context_dependent` style checks that the last parameter doesn't have
|
2349
|
-
# braces around it, but requires braces if the second to last parameter is
|
2350
|
-
# also a hash literal.
|
2351
|
-
- context_dependent
|
2649
|
+
# The BracesRequiredMethods overrides all other configurations except
|
2650
|
+
# IgnoredMethods. It can be used to enforce that all blocks for specific
|
2651
|
+
# methods use braces. For example, you can use this to enforce Sorbet
|
2652
|
+
# signatures use braces even when the rest of your codebase enforces
|
2653
|
+
# the `line_count_based` style.
|
2654
|
+
BracesRequiredMethods: []
|
2352
2655
|
|
2353
2656
|
Style/CaseEquality:
|
2354
2657
|
Description: 'Avoid explicit use of the case equality operator(===).'
|
2355
2658
|
StyleGuide: '#no-case-equality'
|
2356
2659
|
Enabled: true
|
2357
2660
|
VersionAdded: '0.9'
|
2661
|
+
VersionChanged: '0.89'
|
2662
|
+
# If AllowOnConstant is enabled, the cop will ignore violations when the receiver of
|
2663
|
+
# the case equality operator is a constant.
|
2664
|
+
#
|
2665
|
+
# # bad
|
2666
|
+
# /string/ === "string"
|
2667
|
+
#
|
2668
|
+
# # good
|
2669
|
+
# String === "string"
|
2670
|
+
AllowOnConstant: false
|
2671
|
+
|
2672
|
+
Style/CaseLikeIf:
|
2673
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
2674
|
+
StyleGuide: '#case-vs-if-else'
|
2675
|
+
Enabled: 'pending'
|
2676
|
+
Safe: false
|
2677
|
+
VersionAdded: '0.88'
|
2358
2678
|
|
2359
2679
|
Style/CharacterLiteral:
|
2360
2680
|
Description: 'Checks for uses of character literals.'
|
@@ -2371,7 +2691,6 @@ Style/ClassAndModuleChildren:
|
|
2371
2691
|
# have the knowledge to perform either operation safely and thus requires
|
2372
2692
|
# manual oversight.
|
2373
2693
|
SafeAutoCorrect: false
|
2374
|
-
AutoCorrect: false
|
2375
2694
|
Enabled: true
|
2376
2695
|
VersionAdded: '0.19'
|
2377
2696
|
#
|
@@ -2395,6 +2714,7 @@ Style/ClassAndModuleChildren:
|
|
2395
2714
|
|
2396
2715
|
Style/ClassCheck:
|
2397
2716
|
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
2717
|
+
StyleGuide: '#is-a-vs-kind-of'
|
2398
2718
|
Enabled: true
|
2399
2719
|
VersionAdded: '0.24'
|
2400
2720
|
EnforcedStyle: is_a?
|
@@ -2402,6 +2722,16 @@ Style/ClassCheck:
|
|
2402
2722
|
- is_a?
|
2403
2723
|
- kind_of?
|
2404
2724
|
|
2725
|
+
Style/ClassEqualityComparison:
|
2726
|
+
Description: 'Enforces the use of `Object#instance_of?` instead of class comparison for equality.'
|
2727
|
+
StyleGuide: '#instance-of-vs-class-comparison'
|
2728
|
+
Enabled: pending
|
2729
|
+
VersionAdded: '0.93'
|
2730
|
+
IgnoredMethods:
|
2731
|
+
- ==
|
2732
|
+
- equal?
|
2733
|
+
- eql?
|
2734
|
+
|
2405
2735
|
Style/ClassMethods:
|
2406
2736
|
Description: 'Use self when defining module/class methods.'
|
2407
2737
|
StyleGuide: '#def-self-class-methods'
|
@@ -2409,6 +2739,16 @@ Style/ClassMethods:
|
|
2409
2739
|
VersionAdded: '0.9'
|
2410
2740
|
VersionChanged: '0.20'
|
2411
2741
|
|
2742
|
+
Style/ClassMethodsDefinitions:
|
2743
|
+
Description: 'Enforces using `def self.method_name` or `class << self` to define class methods.'
|
2744
|
+
StyleGuide: '#def-self-class-methods'
|
2745
|
+
Enabled: false
|
2746
|
+
VersionAdded: '0.89'
|
2747
|
+
EnforcedStyle: def_self
|
2748
|
+
SupportedStyles:
|
2749
|
+
- def_self
|
2750
|
+
- self_class
|
2751
|
+
|
2412
2752
|
Style/ClassVars:
|
2413
2753
|
Description: 'Avoid the use of class variables.'
|
2414
2754
|
StyleGuide: '#no-class-vars'
|
@@ -2418,7 +2758,7 @@ Style/ClassVars:
|
|
2418
2758
|
# Align with the style guide.
|
2419
2759
|
Style/CollectionMethods:
|
2420
2760
|
Description: 'Preferred collection methods.'
|
2421
|
-
StyleGuide: '#map-find-select-reduce-size'
|
2761
|
+
StyleGuide: '#map-find-select-reduce-include-size'
|
2422
2762
|
Enabled: false
|
2423
2763
|
VersionAdded: '0.9'
|
2424
2764
|
VersionChanged: '0.27'
|
@@ -2435,6 +2775,7 @@ Style/CollectionMethods:
|
|
2435
2775
|
inject: 'reduce'
|
2436
2776
|
detect: 'find'
|
2437
2777
|
find_all: 'select'
|
2778
|
+
member?: 'include?'
|
2438
2779
|
|
2439
2780
|
Style/ColonMethodCall:
|
2440
2781
|
Description: 'Do not use :: for method call.'
|
@@ -2448,6 +2789,14 @@ Style/ColonMethodDefinition:
|
|
2448
2789
|
Enabled: true
|
2449
2790
|
VersionAdded: '0.52'
|
2450
2791
|
|
2792
|
+
Style/CombinableLoops:
|
2793
|
+
Description: >-
|
2794
|
+
Checks for places where multiple consecutive loops over the same data
|
2795
|
+
can be combined into a single loop.
|
2796
|
+
Enabled: pending
|
2797
|
+
Safe: false
|
2798
|
+
VersionAdded: '0.90'
|
2799
|
+
|
2451
2800
|
Style/CommandLiteral:
|
2452
2801
|
Description: 'Use `` or %x around command literals.'
|
2453
2802
|
StyleGuide: '#percent-x'
|
@@ -2544,7 +2893,8 @@ Style/DateTime:
|
|
2544
2893
|
StyleGuide: '#date--time'
|
2545
2894
|
Enabled: false
|
2546
2895
|
VersionAdded: '0.51'
|
2547
|
-
VersionChanged: '0.
|
2896
|
+
VersionChanged: '0.92'
|
2897
|
+
SafeAutoCorrect: false
|
2548
2898
|
AllowCoercion: false
|
2549
2899
|
|
2550
2900
|
Style/DefWithParentheses:
|
@@ -2561,6 +2911,12 @@ Style/Dir:
|
|
2561
2911
|
Enabled: true
|
2562
2912
|
VersionAdded: '0.50'
|
2563
2913
|
|
2914
|
+
Style/DisableCopsWithinSourceCodeDirective:
|
2915
|
+
Description: >-
|
2916
|
+
Forbids disabling/enabling cops within source code.
|
2917
|
+
Enabled: false
|
2918
|
+
VersionAdded: '0.82'
|
2919
|
+
|
2564
2920
|
Style/Documentation:
|
2565
2921
|
Description: 'Document classes and non-namespace modules.'
|
2566
2922
|
Enabled: true
|
@@ -2588,6 +2944,12 @@ Style/DoubleNegation:
|
|
2588
2944
|
StyleGuide: '#no-bang-bang'
|
2589
2945
|
Enabled: true
|
2590
2946
|
VersionAdded: '0.19'
|
2947
|
+
VersionChanged: '0.84'
|
2948
|
+
EnforcedStyle: allowed_in_returns
|
2949
|
+
SafeAutoCorrect: false
|
2950
|
+
SupportedStyles:
|
2951
|
+
- allowed_in_returns
|
2952
|
+
- forbidden
|
2591
2953
|
|
2592
2954
|
Style/EachForSimpleLoop:
|
2593
2955
|
Description: >-
|
@@ -2660,6 +3022,7 @@ Style/EndBlock:
|
|
2660
3022
|
StyleGuide: '#no-END-blocks'
|
2661
3023
|
Enabled: true
|
2662
3024
|
VersionAdded: '0.9'
|
3025
|
+
VersionChanged: '0.81'
|
2663
3026
|
|
2664
3027
|
Style/EvalWithLocation:
|
2665
3028
|
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
@@ -2678,6 +3041,27 @@ Style/ExpandPathArguments:
|
|
2678
3041
|
Enabled: true
|
2679
3042
|
VersionAdded: '0.53'
|
2680
3043
|
|
3044
|
+
Style/ExplicitBlockArgument:
|
3045
|
+
Description: >-
|
3046
|
+
Consider using explicit block argument to avoid writing block literal
|
3047
|
+
that just passes its arguments to another block.
|
3048
|
+
StyleGuide: '#block-argument'
|
3049
|
+
Enabled: pending
|
3050
|
+
# May change the yielding arity.
|
3051
|
+
Safe: false
|
3052
|
+
VersionAdded: '0.89'
|
3053
|
+
|
3054
|
+
Style/ExponentialNotation:
|
3055
|
+
Description: 'When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).'
|
3056
|
+
StyleGuide: '#exponential-notation'
|
3057
|
+
Enabled: pending
|
3058
|
+
VersionAdded: '0.82'
|
3059
|
+
EnforcedStyle: scientific
|
3060
|
+
SupportedStyles:
|
3061
|
+
- scientific
|
3062
|
+
- engineering
|
3063
|
+
- integral
|
3064
|
+
|
2681
3065
|
Style/FloatDivision:
|
2682
3066
|
Description: 'For performing float division, coerce one side only.'
|
2683
3067
|
StyleGuide: '#float-division'
|
@@ -2734,17 +3118,28 @@ Style/FrozenStringLiteralComment:
|
|
2734
3118
|
to help transition to frozen string literals by default.
|
2735
3119
|
Enabled: true
|
2736
3120
|
VersionAdded: '0.36'
|
2737
|
-
VersionChanged: '0.
|
3121
|
+
VersionChanged: '0.79'
|
2738
3122
|
EnforcedStyle: always
|
2739
3123
|
SupportedStyles:
|
2740
3124
|
# `always` will always add the frozen string literal comment to a file
|
2741
3125
|
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
2742
|
-
# string literal.
|
2743
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
3126
|
+
# string literal. It is possible that this will create errors.
|
2744
3127
|
- always
|
3128
|
+
# `always_true` will add the frozen string literal comment to a file,
|
3129
|
+
# similarly to the `always` style, but will also change any disabled
|
3130
|
+
# comments (e.g. `# frozen_string_literal: false`) to be enabled.
|
3131
|
+
- always_true
|
2745
3132
|
# `never` will enforce that the frozen string literal comment does not
|
2746
3133
|
# exist in a file.
|
2747
3134
|
- never
|
3135
|
+
SafeAutoCorrect: false
|
3136
|
+
|
3137
|
+
Style/GlobalStdStream:
|
3138
|
+
Description: 'Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.'
|
3139
|
+
StyleGuide: '#global-stdout'
|
3140
|
+
Enabled: pending
|
3141
|
+
VersionAdded: '0.89'
|
3142
|
+
SafeAutoCorrect: false
|
2748
3143
|
|
2749
3144
|
Style/GlobalVars:
|
2750
3145
|
Description: 'Do not introduce global variables.'
|
@@ -2765,6 +3160,35 @@ Style/GuardClause:
|
|
2765
3160
|
# needs to have to trigger this cop
|
2766
3161
|
MinBodyLength: 1
|
2767
3162
|
|
3163
|
+
Style/HashAsLastArrayItem:
|
3164
|
+
Description: >-
|
3165
|
+
Checks for presence or absence of braces around hash literal as a last
|
3166
|
+
array item depending on configuration.
|
3167
|
+
StyleGuide: '#hash-literal-as-last-array-item'
|
3168
|
+
Enabled: 'pending'
|
3169
|
+
VersionAdded: '0.88'
|
3170
|
+
EnforcedStyle: braces
|
3171
|
+
SupportedStyles:
|
3172
|
+
- braces
|
3173
|
+
- no_braces
|
3174
|
+
|
3175
|
+
Style/HashEachMethods:
|
3176
|
+
Description: 'Use Hash#each_key and Hash#each_value.'
|
3177
|
+
StyleGuide: '#hash-each'
|
3178
|
+
Enabled: pending
|
3179
|
+
VersionAdded: '0.80'
|
3180
|
+
Safe: false
|
3181
|
+
|
3182
|
+
Style/HashLikeCase:
|
3183
|
+
Description: >-
|
3184
|
+
Checks for places where `case-when` represents a simple 1:1
|
3185
|
+
mapping and can be replaced with a hash lookup.
|
3186
|
+
Enabled: 'pending'
|
3187
|
+
VersionAdded: '0.88'
|
3188
|
+
# `MinBranchesCount` defines the number of branches `case` needs to have
|
3189
|
+
# to trigger this cop
|
3190
|
+
MinBranchesCount: 3
|
3191
|
+
|
2768
3192
|
Style/HashSyntax:
|
2769
3193
|
Description: >-
|
2770
3194
|
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
@@ -2788,6 +3212,20 @@ Style/HashSyntax:
|
|
2788
3212
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
2789
3213
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
2790
3214
|
|
3215
|
+
Style/HashTransformKeys:
|
3216
|
+
Description: 'Prefer `transform_keys` over `each_with_object`, `map`, or `to_h`.'
|
3217
|
+
Enabled: 'pending'
|
3218
|
+
VersionAdded: '0.80'
|
3219
|
+
VersionChanged: '0.90'
|
3220
|
+
Safe: false
|
3221
|
+
|
3222
|
+
Style/HashTransformValues:
|
3223
|
+
Description: 'Prefer `transform_values` over `each_with_object`, `map`, or `to_h`.'
|
3224
|
+
Enabled: 'pending'
|
3225
|
+
VersionAdded: '0.80'
|
3226
|
+
VersionChanged: '0.90'
|
3227
|
+
Safe: false
|
3228
|
+
|
2791
3229
|
Style/IdenticalConditionalBranches:
|
2792
3230
|
Description: >-
|
2793
3231
|
Checks that conditional statements do not have an identical
|
@@ -2816,12 +3254,14 @@ Style/IfUnlessModifierOfIfUnless:
|
|
2816
3254
|
Avoid modifier if/unless usage on conditionals.
|
2817
3255
|
Enabled: true
|
2818
3256
|
VersionAdded: '0.39'
|
3257
|
+
VersionChanged: '0.87'
|
2819
3258
|
|
2820
3259
|
Style/IfWithSemicolon:
|
2821
3260
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
2822
3261
|
StyleGuide: '#no-semicolon-ifs'
|
2823
3262
|
Enabled: true
|
2824
3263
|
VersionAdded: '0.9'
|
3264
|
+
VersionChanged: '0.83'
|
2825
3265
|
|
2826
3266
|
Style/ImplicitRuntimeError:
|
2827
3267
|
Description: >-
|
@@ -2874,10 +3314,22 @@ Style/IpAddresses:
|
|
2874
3314
|
Description: "Don't include literal IP addresses in code."
|
2875
3315
|
Enabled: false
|
2876
3316
|
VersionAdded: '0.58'
|
2877
|
-
|
2878
|
-
|
3317
|
+
VersionChanged: '0.91'
|
3318
|
+
# Allow addresses to be permitted
|
3319
|
+
AllowedAddresses:
|
2879
3320
|
- "::"
|
2880
3321
|
# :: is a valid IPv6 address, but could potentially be legitimately in code
|
3322
|
+
Exclude:
|
3323
|
+
- '**/*.gemfile'
|
3324
|
+
- '**/Gemfile'
|
3325
|
+
- '**/gems.rb'
|
3326
|
+
- '**/*.gemspec'
|
3327
|
+
|
3328
|
+
Style/KeywordParametersOrder:
|
3329
|
+
Description: 'Enforces that optional keyword parameters are placed at the end of the parameters list.'
|
3330
|
+
StyleGuide: '#keyword-parameters-order'
|
3331
|
+
Enabled: pending
|
3332
|
+
VersionAdded: '0.90'
|
2881
3333
|
|
2882
3334
|
Style/Lambda:
|
2883
3335
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -2895,7 +3347,7 @@ Style/LambdaCall:
|
|
2895
3347
|
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
2896
3348
|
StyleGuide: '#proc-call'
|
2897
3349
|
Enabled: true
|
2898
|
-
VersionAdded: '0.13
|
3350
|
+
VersionAdded: '0.13'
|
2899
3351
|
VersionChanged: '0.14'
|
2900
3352
|
EnforcedStyle: call
|
2901
3353
|
SupportedStyles:
|
@@ -2957,12 +3409,6 @@ Style/MethodDefParentheses:
|
|
2957
3409
|
- require_no_parentheses
|
2958
3410
|
- require_no_parentheses_except_multiline
|
2959
3411
|
|
2960
|
-
Style/MethodMissingSuper:
|
2961
|
-
Description: Checks for `method_missing` to call `super`.
|
2962
|
-
StyleGuide: '#no-method-missing'
|
2963
|
-
Enabled: true
|
2964
|
-
VersionAdded: '0.56'
|
2965
|
-
|
2966
3412
|
Style/MinMax:
|
2967
3413
|
Description: >-
|
2968
3414
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
@@ -3025,6 +3471,7 @@ Style/ModuleFunction:
|
|
3025
3471
|
SupportedStyles:
|
3026
3472
|
- module_function
|
3027
3473
|
- extend_self
|
3474
|
+
- forbidden
|
3028
3475
|
Autocorrect: false
|
3029
3476
|
SafeAutoCorrect: false
|
3030
3477
|
|
@@ -3069,6 +3516,7 @@ Style/MultilineTernaryOperator:
|
|
3069
3516
|
StyleGuide: '#no-multiline-ternary'
|
3070
3517
|
Enabled: true
|
3071
3518
|
VersionAdded: '0.9'
|
3519
|
+
VersionChanged: '0.86'
|
3072
3520
|
|
3073
3521
|
Style/MultilineWhenThen:
|
3074
3522
|
Description: 'Do not use then for multi-line when statement.'
|
@@ -3148,8 +3596,8 @@ Style/NestedParenthesizedCalls:
|
|
3148
3596
|
argument list of another parenthesized method call.
|
3149
3597
|
Enabled: true
|
3150
3598
|
VersionAdded: '0.36'
|
3151
|
-
VersionChanged: '0.
|
3152
|
-
|
3599
|
+
VersionChanged: '0.77'
|
3600
|
+
AllowedMethods:
|
3153
3601
|
- be
|
3154
3602
|
- be_a
|
3155
3603
|
- be_an
|
@@ -3173,6 +3621,7 @@ Style/NestedTernaryOperator:
|
|
3173
3621
|
StyleGuide: '#no-nested-ternary'
|
3174
3622
|
Enabled: true
|
3175
3623
|
VersionAdded: '0.9'
|
3624
|
+
VersionChanged: '0.86'
|
3176
3625
|
|
3177
3626
|
Style/Next:
|
3178
3627
|
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
@@ -3255,7 +3704,6 @@ Style/NumericPredicate:
|
|
3255
3704
|
# object. Switching these methods has to be done with knowledge of the types
|
3256
3705
|
# of the variables which rubocop doesn't have.
|
3257
3706
|
SafeAutoCorrect: false
|
3258
|
-
AutoCorrect: false
|
3259
3707
|
Enabled: true
|
3260
3708
|
VersionAdded: '0.42'
|
3261
3709
|
VersionChanged: '0.59'
|
@@ -3271,12 +3719,13 @@ Style/NumericPredicate:
|
|
3271
3719
|
|
3272
3720
|
Style/OneLineConditional:
|
3273
3721
|
Description: >-
|
3274
|
-
Favor the ternary operator(?:) over
|
3275
|
-
if/then/else/end constructs.
|
3722
|
+
Favor the ternary operator (?:) or multi-line constructs over
|
3723
|
+
single-line if/then/else/end constructs.
|
3276
3724
|
StyleGuide: '#ternary-operator'
|
3277
3725
|
Enabled: true
|
3726
|
+
AlwaysCorrectToMultiline: false
|
3278
3727
|
VersionAdded: '0.9'
|
3279
|
-
VersionChanged: '0.
|
3728
|
+
VersionChanged: '0.90'
|
3280
3729
|
|
3281
3730
|
Style/OptionHash:
|
3282
3731
|
Description: "Don't use option hashes when you can use keyword arguments."
|
@@ -3297,7 +3746,18 @@ Style/OptionalArguments:
|
|
3297
3746
|
of the argument list.
|
3298
3747
|
StyleGuide: '#optional-arguments'
|
3299
3748
|
Enabled: true
|
3749
|
+
Safe: false
|
3300
3750
|
VersionAdded: '0.33'
|
3751
|
+
VersionChanged: '0.83'
|
3752
|
+
|
3753
|
+
Style/OptionalBooleanParameter:
|
3754
|
+
Description: 'Use keyword arguments when defining method with boolean argument.'
|
3755
|
+
StyleGuide: '#boolean-keyword-arguments'
|
3756
|
+
Enabled: pending
|
3757
|
+
Safe: false
|
3758
|
+
VersionAdded: '0.89'
|
3759
|
+
AllowedMethods:
|
3760
|
+
- respond_to_missing?
|
3301
3761
|
|
3302
3762
|
Style/OrAssignment:
|
3303
3763
|
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
@@ -3395,6 +3855,11 @@ Style/RandomWithOffset:
|
|
3395
3855
|
Enabled: true
|
3396
3856
|
VersionAdded: '0.52'
|
3397
3857
|
|
3858
|
+
Style/RedundantAssignment:
|
3859
|
+
Description: 'Checks for redundant assignment before returning.'
|
3860
|
+
Enabled: 'pending'
|
3861
|
+
VersionAdded: '0.87'
|
3862
|
+
|
3398
3863
|
Style/RedundantBegin:
|
3399
3864
|
Description: "Don't use begin blocks when they are not needed."
|
3400
3865
|
StyleGuide: '#begin-implicit'
|
@@ -3402,6 +3867,16 @@ Style/RedundantBegin:
|
|
3402
3867
|
VersionAdded: '0.10'
|
3403
3868
|
VersionChanged: '0.21'
|
3404
3869
|
|
3870
|
+
Style/RedundantCapitalW:
|
3871
|
+
Description: 'Checks for %W when interpolation is not needed.'
|
3872
|
+
Enabled: true
|
3873
|
+
VersionAdded: '0.76'
|
3874
|
+
|
3875
|
+
Style/RedundantCondition:
|
3876
|
+
Description: 'Checks for unnecessary conditional expressions.'
|
3877
|
+
Enabled: true
|
3878
|
+
VersionAdded: '0.76'
|
3879
|
+
|
3405
3880
|
Style/RedundantConditional:
|
3406
3881
|
Description: "Don't return true/false from a conditional."
|
3407
3882
|
Enabled: true
|
@@ -3414,17 +3889,59 @@ Style/RedundantException:
|
|
3414
3889
|
VersionAdded: '0.14'
|
3415
3890
|
VersionChanged: '0.29'
|
3416
3891
|
|
3892
|
+
Style/RedundantFetchBlock:
|
3893
|
+
Description: >-
|
3894
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
3895
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
3896
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code'
|
3897
|
+
Enabled: 'pending'
|
3898
|
+
Safe: false
|
3899
|
+
# If enabled, this cop will autocorrect usages of
|
3900
|
+
# `fetch` being called with block returning a constant.
|
3901
|
+
# This can be dangerous since constants will not be defined at that moment.
|
3902
|
+
SafeForConstants: false
|
3903
|
+
VersionAdded: '0.86'
|
3904
|
+
|
3905
|
+
Style/RedundantFileExtensionInRequire:
|
3906
|
+
Description: >-
|
3907
|
+
Checks for the presence of superfluous `.rb` extension in
|
3908
|
+
the filename provided to `require` and `require_relative`.
|
3909
|
+
StyleGuide: '#no-explicit-rb-to-require'
|
3910
|
+
Enabled: 'pending'
|
3911
|
+
VersionAdded: '0.88'
|
3912
|
+
|
3417
3913
|
Style/RedundantFreeze:
|
3418
3914
|
Description: "Checks usages of Object#freeze on immutable objects."
|
3419
3915
|
Enabled: true
|
3420
3916
|
VersionAdded: '0.34'
|
3421
3917
|
VersionChanged: '0.66'
|
3422
3918
|
|
3919
|
+
Style/RedundantInterpolation:
|
3920
|
+
Description: 'Checks for strings that are just an interpolated expression.'
|
3921
|
+
Enabled: true
|
3922
|
+
VersionAdded: '0.76'
|
3923
|
+
|
3423
3924
|
Style/RedundantParentheses:
|
3424
3925
|
Description: "Checks for parentheses that seem not to serve any purpose."
|
3425
3926
|
Enabled: true
|
3426
3927
|
VersionAdded: '0.36'
|
3427
3928
|
|
3929
|
+
Style/RedundantPercentQ:
|
3930
|
+
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
3931
|
+
StyleGuide: '#percent-q'
|
3932
|
+
Enabled: true
|
3933
|
+
VersionAdded: '0.76'
|
3934
|
+
|
3935
|
+
Style/RedundantRegexpCharacterClass:
|
3936
|
+
Description: 'Checks for unnecessary single-element Regexp character classes.'
|
3937
|
+
Enabled: pending
|
3938
|
+
VersionAdded: '0.85'
|
3939
|
+
|
3940
|
+
Style/RedundantRegexpEscape:
|
3941
|
+
Description: 'Checks for redundant escapes in Regexps.'
|
3942
|
+
Enabled: pending
|
3943
|
+
VersionAdded: '0.85'
|
3944
|
+
|
3428
3945
|
Style/RedundantReturn:
|
3429
3946
|
Description: "Don't use return where it's not required."
|
3430
3947
|
StyleGuide: '#no-explicit-return'
|
@@ -3441,6 +3958,19 @@ Style/RedundantSelf:
|
|
3441
3958
|
VersionAdded: '0.10'
|
3442
3959
|
VersionChanged: '0.13'
|
3443
3960
|
|
3961
|
+
Style/RedundantSelfAssignment:
|
3962
|
+
Description: 'Checks for places where redundant assignments are made for in place modification methods.'
|
3963
|
+
Enabled: pending
|
3964
|
+
Safe: false
|
3965
|
+
VersionAdded: '0.90'
|
3966
|
+
|
3967
|
+
Style/RedundantSort:
|
3968
|
+
Description: >-
|
3969
|
+
Use `min` instead of `sort.first`,
|
3970
|
+
`max_by` instead of `sort_by...last`, etc.
|
3971
|
+
Enabled: true
|
3972
|
+
VersionAdded: '0.76'
|
3973
|
+
|
3444
3974
|
Style/RedundantSortBy:
|
3445
3975
|
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
3446
3976
|
Enabled: true
|
@@ -3496,18 +4026,21 @@ Style/SafeNavigation:
|
|
3496
4026
|
This cop transforms usages of a method call safeguarded by
|
3497
4027
|
a check for the existence of the object to
|
3498
4028
|
safe navigation (`&.`).
|
4029
|
+
Auto-correction is unsafe as it assumes the object will
|
4030
|
+
be `nil` or truthy, but never `false`.
|
3499
4031
|
Enabled: true
|
3500
4032
|
VersionAdded: '0.43'
|
3501
|
-
VersionChanged: '0.
|
4033
|
+
VersionChanged: '0.77'
|
3502
4034
|
# Safe navigation may cause a statement to start returning `nil` in addition
|
3503
4035
|
# to whatever it used to return.
|
3504
4036
|
ConvertCodeThatCanStartToReturnNil: false
|
3505
|
-
|
4037
|
+
AllowedMethods:
|
3506
4038
|
- present?
|
3507
4039
|
- blank?
|
3508
4040
|
- presence
|
3509
4041
|
- try
|
3510
4042
|
- try!
|
4043
|
+
SafeAutoCorrect: false
|
3511
4044
|
|
3512
4045
|
Style/Sample:
|
3513
4046
|
Description: >-
|
@@ -3553,6 +4086,12 @@ Style/SignalException:
|
|
3553
4086
|
- only_fail
|
3554
4087
|
- semantic
|
3555
4088
|
|
4089
|
+
Style/SingleArgumentDig:
|
4090
|
+
Description: 'Avoid using single argument dig method.'
|
4091
|
+
Enabled: pending
|
4092
|
+
VersionAdded: '0.89'
|
4093
|
+
Safe: false
|
4094
|
+
|
3556
4095
|
Style/SingleLineBlockParams:
|
3557
4096
|
Description: 'Enforces the names of some block params.'
|
3558
4097
|
Enabled: false
|
@@ -3574,6 +4113,20 @@ Style/SingleLineMethods:
|
|
3574
4113
|
VersionChanged: '0.19'
|
3575
4114
|
AllowIfMethodIsEmpty: true
|
3576
4115
|
|
4116
|
+
Style/SlicingWithRange:
|
4117
|
+
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
4118
|
+
Enabled: pending
|
4119
|
+
VersionAdded: '0.83'
|
4120
|
+
Safe: false
|
4121
|
+
|
4122
|
+
Style/SoleNestedConditional:
|
4123
|
+
Description: >-
|
4124
|
+
Finds sole nested conditional nodes
|
4125
|
+
which can be merged into outer conditional node.
|
4126
|
+
Enabled: pending
|
4127
|
+
VersionAdded: '0.89'
|
4128
|
+
AllowModifier: false
|
4129
|
+
|
3577
4130
|
Style/SpecialGlobalVars:
|
3578
4131
|
Description: 'Avoid Perl-style global variables.'
|
3579
4132
|
StyleGuide: '#no-cryptic-perlisms'
|
@@ -3602,6 +4155,13 @@ Style/StderrPuts:
|
|
3602
4155
|
Enabled: true
|
3603
4156
|
VersionAdded: '0.51'
|
3604
4157
|
|
4158
|
+
Style/StringConcatenation:
|
4159
|
+
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4160
|
+
StyleGuide: '#string-interpolation'
|
4161
|
+
Enabled: pending
|
4162
|
+
Safe: false
|
4163
|
+
VersionAdded: '0.89'
|
4164
|
+
|
3605
4165
|
Style/StringHashKeys:
|
3606
4166
|
Description: 'Prefer symbols instead of strings as hash keys.'
|
3607
4167
|
StyleGuide: '#symbols-as-keys'
|
@@ -3659,6 +4219,7 @@ Style/StructInheritance:
|
|
3659
4219
|
StyleGuide: '#no-extend-struct-new'
|
3660
4220
|
Enabled: true
|
3661
4221
|
VersionAdded: '0.29'
|
4222
|
+
VersionChanged: '0.86'
|
3662
4223
|
|
3663
4224
|
Style/SymbolArray:
|
3664
4225
|
Description: 'Use %i or %I for arrays of symbols.'
|
@@ -3680,7 +4241,7 @@ Style/SymbolLiteral:
|
|
3680
4241
|
Style/SymbolProc:
|
3681
4242
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
3682
4243
|
Enabled: true
|
3683
|
-
|
4244
|
+
Safe: false
|
3684
4245
|
VersionAdded: '0.26'
|
3685
4246
|
VersionChanged: '0.64'
|
3686
4247
|
# A list of method names to be ignored by the check.
|
@@ -3736,22 +4297,29 @@ Style/TrailingCommaInArrayLiteral:
|
|
3736
4297
|
StyleGuide: '#no-trailing-array-commas'
|
3737
4298
|
Enabled: true
|
3738
4299
|
VersionAdded: '0.53'
|
4300
|
+
# If `comma`, the cop requires a comma after the last item in an array,
|
3739
4301
|
# but only when each item is on its own line.
|
3740
4302
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
3741
|
-
# non-empty array literals.
|
4303
|
+
# non-empty, multiline array literals.
|
3742
4304
|
EnforcedStyleForMultiline: no_comma
|
3743
4305
|
SupportedStylesForMultiline:
|
3744
4306
|
- comma
|
3745
4307
|
- consistent_comma
|
3746
4308
|
- no_comma
|
3747
4309
|
|
4310
|
+
Style/TrailingCommaInBlockArgs:
|
4311
|
+
Description: 'Checks for useless trailing commas in block arguments.'
|
4312
|
+
Enabled: false
|
4313
|
+
Safe: false
|
4314
|
+
VersionAdded: '0.81'
|
4315
|
+
|
3748
4316
|
Style/TrailingCommaInHashLiteral:
|
3749
4317
|
Description: 'Checks for trailing comma in hash literals.'
|
3750
4318
|
Enabled: true
|
3751
4319
|
# If `comma`, the cop requires a comma after the last item in a hash,
|
3752
4320
|
# but only when each item is on its own line.
|
3753
4321
|
# If `consistent_comma`, the cop requires a comma after the last item of all
|
3754
|
-
# non-empty hash literals.
|
4322
|
+
# non-empty, multiline hash literals.
|
3755
4323
|
EnforcedStyleForMultiline: no_comma
|
3756
4324
|
SupportedStylesForMultiline:
|
3757
4325
|
- comma
|
@@ -3780,7 +4348,7 @@ Style/TrivialAccessors:
|
|
3780
4348
|
StyleGuide: '#attr_family'
|
3781
4349
|
Enabled: true
|
3782
4350
|
VersionAdded: '0.9'
|
3783
|
-
VersionChanged: '0.
|
4351
|
+
VersionChanged: '0.77'
|
3784
4352
|
# When set to `false` the cop will suggest the use of accessor methods
|
3785
4353
|
# in situations like:
|
3786
4354
|
#
|
@@ -3801,7 +4369,7 @@ Style/TrivialAccessors:
|
|
3801
4369
|
# Commonly used in DSLs
|
3802
4370
|
AllowDSLWriters: false
|
3803
4371
|
IgnoreClassMethods: false
|
3804
|
-
|
4372
|
+
AllowedMethods:
|
3805
4373
|
- to_ary
|
3806
4374
|
- to_a
|
3807
4375
|
- to_c
|
@@ -3828,35 +4396,6 @@ Style/UnlessElse:
|
|
3828
4396
|
Enabled: true
|
3829
4397
|
VersionAdded: '0.9'
|
3830
4398
|
|
3831
|
-
Style/UnneededCapitalW:
|
3832
|
-
Description: 'Checks for %W when interpolation is not needed.'
|
3833
|
-
Enabled: true
|
3834
|
-
VersionAdded: '0.21'
|
3835
|
-
VersionChanged: '0.24'
|
3836
|
-
|
3837
|
-
Style/UnneededCondition:
|
3838
|
-
Description: 'Checks for unnecessary conditional expressions.'
|
3839
|
-
Enabled: true
|
3840
|
-
VersionAdded: '0.57'
|
3841
|
-
|
3842
|
-
Style/UnneededInterpolation:
|
3843
|
-
Description: 'Checks for strings that are just an interpolated expression.'
|
3844
|
-
Enabled: true
|
3845
|
-
VersionAdded: '0.36'
|
3846
|
-
|
3847
|
-
Style/UnneededPercentQ:
|
3848
|
-
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
3849
|
-
StyleGuide: '#percent-q'
|
3850
|
-
Enabled: true
|
3851
|
-
VersionAdded: '0.24'
|
3852
|
-
|
3853
|
-
Style/UnneededSort:
|
3854
|
-
Description: >-
|
3855
|
-
Use `min` instead of `sort.first`,
|
3856
|
-
`max_by` instead of `sort_by...last`, etc.
|
3857
|
-
Enabled: true
|
3858
|
-
VersionAdded: '0.55'
|
3859
|
-
|
3860
4399
|
Style/UnpackFirst:
|
3861
4400
|
Description: >-
|
3862
4401
|
Checks for accessing the first element of `String#unpack`
|