rubocop 0.51.0 → 0.52.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/config/default.yml +86 -10
- data/config/disabled.yml +9 -4
- data/config/enabled.yml +1105 -1006
- data/lib/rubocop.rb +30 -3
- data/lib/rubocop/ast/builder.rb +2 -0
- data/lib/rubocop/ast/node.rb +24 -2
- data/lib/rubocop/ast/node/args_node.rb +17 -0
- data/lib/rubocop/ast/node/array_node.rb +1 -1
- data/lib/rubocop/ast/node/mixin/basic_literal_node.rb +16 -0
- data/lib/rubocop/ast/node/send_node.rb +20 -0
- data/lib/rubocop/ast/node/str_node.rb +14 -0
- data/lib/rubocop/ast/node/symbol_node.rb +20 -0
- data/lib/rubocop/ast/traversal.rb +4 -4
- data/lib/rubocop/cli.rb +45 -4
- data/lib/rubocop/comment_config.rb +2 -5
- data/lib/rubocop/config.rb +42 -8
- data/lib/rubocop/config_loader.rb +39 -100
- data/lib/rubocop/config_loader_resolver.rb +99 -2
- data/lib/rubocop/cop/autocorrect_logic.rb +1 -1
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +7 -7
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +4 -3
- data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -2
- data/lib/rubocop/cop/cop.rb +16 -46
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +102 -0
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +3 -2
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +87 -0
- data/lib/rubocop/cop/generator.rb +23 -4
- data/lib/rubocop/cop/internal_affairs.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +46 -0
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +9 -8
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
- data/lib/rubocop/cop/layout/access_modifier_indentation.rb +4 -7
- data/lib/rubocop/cop/layout/align_hash.rb +16 -16
- data/lib/rubocop/cop/layout/align_parameters.rb +6 -12
- data/lib/rubocop/cop/layout/block_end_newline.rb +19 -5
- data/lib/rubocop/cop/layout/case_indentation.rb +14 -17
- data/lib/rubocop/cop/layout/class_structure.rb +306 -0
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -0
- data/lib/rubocop/cop/layout/comment_indentation.rb +39 -2
- data/lib/rubocop/cop/layout/dot_position.rb +22 -13
- data/lib/rubocop/cop/layout/else_alignment.rb +6 -6
- data/lib/rubocop/cop/layout/empty_line_between_defs.rb +17 -17
- data/lib/rubocop/cop/layout/empty_lines.rb +15 -1
- data/lib/rubocop/cop/layout/empty_lines_around_access_modifier.rb +3 -2
- data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +89 -0
- data/lib/rubocop/cop/layout/empty_lines_around_begin_body.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +4 -8
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +30 -5
- data/lib/rubocop/cop/layout/empty_lines_around_exception_handling_keywords.rb +7 -3
- data/lib/rubocop/cop/layout/empty_lines_around_method_body.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +22 -7
- data/lib/rubocop/cop/layout/end_of_line.rb +1 -1
- data/lib/rubocop/cop/layout/extra_spacing.rb +21 -24
- data/lib/rubocop/cop/layout/first_parameter_indentation.rb +4 -1
- data/lib/rubocop/cop/layout/indent_array.rb +67 -20
- data/lib/rubocop/cop/layout/indent_hash.rb +70 -25
- data/lib/rubocop/cop/layout/indent_heredoc.rb +51 -11
- data/lib/rubocop/cop/layout/indentation_width.rb +24 -17
- data/lib/rubocop/cop/layout/initial_indentation.rb +7 -5
- data/lib/rubocop/cop/layout/leading_comment_space.rb +2 -2
- data/lib/rubocop/cop/layout/multiline_array_brace_layout.rb +47 -14
- data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +10 -9
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +19 -16
- data/lib/rubocop/cop/layout/multiline_hash_brace_layout.rb +46 -13
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +9 -10
- data/lib/rubocop/cop/layout/multiline_method_definition_brace_layout.rb +4 -0
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +9 -3
- data/lib/rubocop/cop/layout/space_after_colon.rb +4 -4
- data/lib/rubocop/cop/layout/space_after_comma.rb +3 -3
- data/lib/rubocop/cop/layout/space_after_method_name.rb +4 -4
- data/lib/rubocop/cop/layout/space_after_semicolon.rb +8 -1
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +16 -19
- data/lib/rubocop/cop/layout/space_around_equals_in_parameter_default.rb +27 -16
- data/lib/rubocop/cop/layout/space_around_keyword.rb +13 -11
- data/lib/rubocop/cop/layout/space_around_operators.rb +26 -13
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +10 -10
- data/lib/rubocop/cop/layout/space_before_comma.rb +12 -1
- data/lib/rubocop/cop/layout/space_before_comment.rb +2 -4
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +4 -3
- data/lib/rubocop/cop/layout/space_before_semicolon.rb +1 -1
- data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +6 -12
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +235 -0
- data/lib/rubocop/cop/layout/space_inside_array_percent_literal.rb +3 -3
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +87 -16
- data/lib/rubocop/cop/layout/space_inside_hash_literal_braces.rb +57 -34
- data/lib/rubocop/cop/layout/space_inside_parens.rb +31 -3
- data/lib/rubocop/cop/layout/space_inside_range_literal.rb +15 -15
- data/lib/rubocop/cop/layout/space_inside_reference_brackets.rb +81 -0
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +24 -13
- data/lib/rubocop/cop/layout/tab.rb +2 -2
- data/lib/rubocop/cop/layout/trailing_blank_lines.rb +7 -7
- data/lib/rubocop/cop/lint/ambiguous_block_association.rb +11 -20
- data/lib/rubocop/cop/lint/block_alignment.rb +26 -23
- data/lib/rubocop/cop/lint/boolean_symbol.rb +1 -1
- data/lib/rubocop/cop/lint/def_end_alignment.rb +5 -10
- data/lib/rubocop/cop/lint/else_layout.rb +2 -2
- data/lib/rubocop/cop/lint/end_alignment.rb +13 -14
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +3 -4
- data/lib/rubocop/cop/lint/inherit_exception.rb +10 -14
- data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +81 -0
- data/lib/rubocop/cop/lint/nested_percent_literal.rb +58 -0
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +2 -2
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
- data/lib/rubocop/cop/lint/percent_string_array.rb +14 -14
- data/lib/rubocop/cop/lint/percent_symbol_array.rb +11 -11
- data/lib/rubocop/cop/lint/redundant_with_index.rb +6 -3
- data/lib/rubocop/cop/lint/redundant_with_object.rb +1 -1
- data/lib/rubocop/cop/lint/require_parentheses.rb +3 -1
- data/lib/rubocop/cop/lint/rescue_type.rb +3 -3
- data/lib/rubocop/cop/lint/script_permission.rb +1 -0
- data/lib/rubocop/cop/lint/shadowed_argument.rb +146 -0
- data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +6 -6
- data/lib/rubocop/cop/lint/unneeded_disable.rb +29 -11
- data/lib/rubocop/cop/lint/unneeded_require_statement.rb +2 -1
- data/lib/rubocop/cop/lint/unneeded_splat_expansion.rb +43 -17
- data/lib/rubocop/cop/message_annotator.rb +4 -2
- data/lib/rubocop/cop/metrics/abc_size.rb +2 -2
- data/lib/rubocop/cop/metrics/class_length.rb +3 -1
- data/lib/rubocop/cop/metrics/cyclomatic_complexity.rb +2 -1
- data/lib/rubocop/cop/metrics/line_length.rb +2 -2
- data/lib/rubocop/cop/metrics/module_length.rb +3 -1
- data/lib/rubocop/cop/metrics/parameter_lists.rb +9 -2
- data/lib/rubocop/cop/metrics/perceived_complexity.rb +2 -1
- data/lib/rubocop/cop/mixin/documentation_comment.rb +1 -1
- data/lib/rubocop/cop/mixin/empty_lines_around_body.rb +7 -5
- data/lib/rubocop/cop/mixin/empty_parameter.rb +23 -0
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +7 -3
- data/lib/rubocop/cop/mixin/heredoc.rb +19 -19
- data/lib/rubocop/cop/mixin/method_complexity.rb +32 -8
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +7 -3
- data/lib/rubocop/cop/mixin/multiline_literal_brace_layout.rb +6 -4
- data/lib/rubocop/cop/mixin/negative_conditional.rb +3 -0
- data/lib/rubocop/cop/mixin/ordered_gem_node.rb +16 -12
- data/lib/rubocop/cop/mixin/parentheses.rb +12 -0
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +8 -8
- data/lib/rubocop/cop/mixin/space_before_punctuation.rb +10 -10
- data/lib/rubocop/cop/mixin/statement_modifier.rb +7 -17
- data/lib/rubocop/cop/mixin/surrounding_space.rb +95 -8
- data/lib/rubocop/cop/mixin/too_many_lines.rb +2 -2
- data/lib/rubocop/cop/mixin/trailing_comma.rb +22 -14
- data/lib/rubocop/cop/mixin/unused_argument.rb +3 -40
- data/lib/rubocop/cop/naming/accessor_method_name.rb +20 -10
- data/lib/rubocop/cop/naming/ascii_identifiers.rb +33 -0
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +5 -4
- data/lib/rubocop/cop/naming/class_and_module_camel_case.rb +16 -12
- data/lib/rubocop/cop/naming/constant_name.rb +32 -3
- data/lib/rubocop/cop/naming/file_name.rb +19 -8
- data/lib/rubocop/cop/naming/heredoc_delimiter_case.rb +10 -16
- data/lib/rubocop/cop/naming/method_name.rb +20 -14
- data/lib/rubocop/cop/naming/predicate_name.rb +7 -3
- data/lib/rubocop/cop/naming/variable_name.rb +17 -2
- data/lib/rubocop/cop/naming/variable_number.rb +10 -27
- data/lib/rubocop/cop/offense.rb +6 -1
- data/lib/rubocop/cop/performance/case_when_splat.rb +2 -6
- data/lib/rubocop/cop/performance/casecmp.rb +5 -4
- data/lib/rubocop/cop/performance/compare_with_block.rb +13 -7
- data/lib/rubocop/cop/performance/count.rb +5 -4
- data/lib/rubocop/cop/performance/detect.rb +7 -4
- data/lib/rubocop/cop/performance/double_start_end_with.rb +2 -7
- data/lib/rubocop/cop/performance/end_with.rb +2 -2
- data/lib/rubocop/cop/performance/flat_map.rb +3 -2
- data/lib/rubocop/cop/performance/hash_each_methods.rb +41 -40
- data/lib/rubocop/cop/performance/lstrip_rstrip.rb +5 -4
- data/lib/rubocop/cop/performance/redundant_block_call.rb +22 -22
- data/lib/rubocop/cop/performance/redundant_match.rb +2 -2
- data/lib/rubocop/cop/performance/redundant_merge.rb +6 -4
- data/lib/rubocop/cop/performance/redundant_sort_by.rb +4 -4
- data/lib/rubocop/cop/performance/regexp_match.rb +3 -2
- data/lib/rubocop/cop/performance/size.rb +2 -2
- data/lib/rubocop/cop/performance/start_with.rb +2 -2
- data/lib/rubocop/cop/performance/string_replacement.rb +4 -4
- data/lib/rubocop/cop/performance/times_map.rb +14 -15
- data/lib/rubocop/cop/performance/uri_default_parser.rb +3 -3
- data/lib/rubocop/cop/rails/action_filter.rb +22 -0
- data/lib/rubocop/cop/rails/active_support_aliases.rb +2 -2
- data/lib/rubocop/cop/rails/application_job.rb +4 -2
- data/lib/rubocop/cop/rails/application_record.rb +4 -2
- data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +82 -0
- data/lib/rubocop/cop/rails/delegate.rb +20 -25
- data/lib/rubocop/cop/rails/delegate_allow_blank.rb +2 -2
- data/lib/rubocop/cop/rails/environment_comparison.rb +66 -0
- data/lib/rubocop/cop/rails/exit.rb +7 -0
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +7 -0
- data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +6 -2
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +36 -41
- data/lib/rubocop/cop/rails/inverse_of.rb +96 -0
- data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +112 -0
- data/lib/rubocop/cop/rails/output.rb +9 -0
- data/lib/rubocop/cop/rails/output_safety.rb +14 -20
- data/lib/rubocop/cop/rails/pluralization_grammar.rb +8 -8
- data/lib/rubocop/cop/rails/presence.rb +105 -0
- data/lib/rubocop/cop/rails/read_write_attribute.rb +10 -10
- data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +91 -0
- data/lib/rubocop/cop/rails/relative_date_constant.rb +9 -9
- data/lib/rubocop/cop/rails/reversible_migration.rb +3 -4
- data/lib/rubocop/cop/rails/safe_navigation.rb +5 -6
- data/lib/rubocop/cop/rails/save_bang.rb +2 -2
- data/lib/rubocop/cop/rails/uniq_before_pluck.rb +1 -1
- data/lib/rubocop/cop/rails/validation.rb +7 -7
- data/lib/rubocop/cop/security/json_load.rb +4 -2
- data/lib/rubocop/cop/security/marshal_load.rb +4 -2
- data/lib/rubocop/cop/style/alias.rb +24 -26
- data/lib/rubocop/cop/style/and_or.rb +34 -28
- data/lib/rubocop/cop/style/array_join.rb +9 -0
- data/lib/rubocop/cop/style/ascii_comments.rb +24 -4
- data/lib/rubocop/cop/style/attr.rb +14 -4
- data/lib/rubocop/cop/style/auto_resource_cleanup.rb +5 -3
- data/lib/rubocop/cop/style/bare_percent_literals.rb +31 -10
- data/lib/rubocop/cop/style/block_comments.rb +14 -2
- data/lib/rubocop/cop/style/block_delimiters.rb +80 -15
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +81 -48
- data/lib/rubocop/cop/style/case_equality.rb +12 -0
- data/lib/rubocop/cop/style/character_literal.rb +10 -0
- data/lib/rubocop/cop/style/class_and_module_children.rb +6 -2
- data/lib/rubocop/cop/style/class_check.rb +28 -9
- data/lib/rubocop/cop/style/class_methods.rb +8 -8
- data/lib/rubocop/cop/style/class_vars.rb +4 -3
- data/lib/rubocop/cop/style/collection_methods.rb +4 -2
- data/lib/rubocop/cop/style/colon_method_call.rb +16 -0
- data/lib/rubocop/cop/style/colon_method_definition.rb +36 -0
- data/lib/rubocop/cop/style/command_literal.rb +70 -21
- data/lib/rubocop/cop/style/comment_annotation.rb +35 -10
- data/lib/rubocop/cop/style/commented_keyword.rb +12 -9
- data/lib/rubocop/cop/style/conditional_assignment.rb +10 -12
- data/lib/rubocop/cop/style/copyright.rb +19 -20
- data/lib/rubocop/cop/style/date_time.rb +2 -2
- data/lib/rubocop/cop/style/def_with_parentheses.rb +27 -2
- data/lib/rubocop/cop/style/dir.rb +2 -2
- data/lib/rubocop/cop/style/documentation.rb +17 -2
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +7 -7
- data/lib/rubocop/cop/style/each_with_object.rb +5 -5
- data/lib/rubocop/cop/style/empty_block_parameter.rb +47 -0
- data/lib/rubocop/cop/style/empty_case_condition.rb +2 -2
- data/lib/rubocop/cop/style/empty_else.rb +52 -22
- data/lib/rubocop/cop/style/empty_lambda_parameter.rb +43 -0
- data/lib/rubocop/cop/style/empty_literal.rb +17 -5
- data/lib/rubocop/cop/style/empty_method.rb +4 -10
- data/lib/rubocop/cop/style/encoding.rb +2 -1
- data/lib/rubocop/cop/style/eval_with_location.rb +146 -0
- data/lib/rubocop/cop/style/even_odd.rb +4 -2
- data/lib/rubocop/cop/style/extend_self.rb +92 -0
- data/lib/rubocop/cop/style/flip_flop.rb +11 -0
- data/lib/rubocop/cop/style/format_string.rb +29 -2
- data/lib/rubocop/cop/style/format_string_token.rb +15 -14
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +4 -3
- data/lib/rubocop/cop/style/global_vars.rb +11 -1
- data/lib/rubocop/cop/style/hash_syntax.rb +44 -43
- data/lib/rubocop/cop/style/identical_conditional_branches.rb +8 -8
- data/lib/rubocop/cop/style/if_inside_else.rb +10 -10
- data/lib/rubocop/cop/style/if_unless_modifier.rb +7 -7
- data/lib/rubocop/cop/style/if_unless_modifier_of_if_unless.rb +2 -2
- data/lib/rubocop/cop/style/if_with_semicolon.rb +9 -0
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +5 -5
- data/lib/rubocop/cop/style/infinite_loop.rb +2 -2
- data/lib/rubocop/cop/style/lambda.rb +23 -31
- data/lib/rubocop/cop/style/lambda_call.rb +15 -9
- data/lib/rubocop/cop/style/line_end_concatenation.rb +4 -4
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/method_def_parentheses.rb +4 -3
- data/lib/rubocop/cop/style/method_missing.rb +8 -8
- data/lib/rubocop/cop/style/min_max.rb +12 -12
- data/lib/rubocop/cop/style/missing_else.rb +5 -4
- data/lib/rubocop/cop/style/mixin_grouping.rb +29 -19
- data/lib/rubocop/cop/style/mixin_usage.rb +8 -10
- data/lib/rubocop/cop/style/module_function.rb +17 -5
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +4 -4
- data/lib/rubocop/cop/style/multiline_if_then.rb +14 -13
- data/lib/rubocop/cop/style/multiline_memoization.rb +8 -14
- data/lib/rubocop/cop/style/mutable_constant.rb +12 -12
- data/lib/rubocop/cop/style/negated_if.rb +22 -30
- data/lib/rubocop/cop/style/negated_while.rb +1 -5
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +18 -17
- data/lib/rubocop/cop/style/next.rb +39 -11
- data/lib/rubocop/cop/style/nil_comparison.rb +6 -6
- data/lib/rubocop/cop/style/non_nil_check.rb +25 -22
- data/lib/rubocop/cop/style/not.rb +14 -4
- data/lib/rubocop/cop/style/numeric_literal_prefix.rb +6 -6
- data/lib/rubocop/cop/style/numeric_literals.rb +7 -7
- data/lib/rubocop/cop/style/numeric_predicate.rb +14 -18
- data/lib/rubocop/cop/style/one_line_conditional.rb +4 -4
- data/lib/rubocop/cop/style/option_hash.rb +11 -14
- data/lib/rubocop/cop/style/or_assignment.rb +2 -2
- data/lib/rubocop/cop/style/parallel_assignment.rb +13 -13
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +19 -3
- data/lib/rubocop/cop/style/percent_literal_delimiters.rb +24 -3
- data/lib/rubocop/cop/style/percent_q_literals.rb +27 -6
- data/lib/rubocop/cop/style/perl_backrefs.rb +7 -0
- data/lib/rubocop/cop/style/preferred_hash_methods.rb +6 -10
- data/lib/rubocop/cop/style/proc.rb +8 -0
- data/lib/rubocop/cop/style/raise_args.rb +8 -14
- data/lib/rubocop/cop/style/random_with_offset.rb +160 -0
- data/lib/rubocop/cop/style/redundant_begin.rb +14 -4
- data/lib/rubocop/cop/style/redundant_conditional.rb +9 -8
- data/lib/rubocop/cop/style/redundant_return.rb +5 -4
- data/lib/rubocop/cop/style/redundant_self.rb +25 -26
- data/lib/rubocop/cop/style/regexp_literal.rb +74 -21
- data/lib/rubocop/cop/style/rescue_modifier.rb +11 -0
- data/lib/rubocop/cop/style/rescue_standard_error.rb +122 -0
- data/lib/rubocop/cop/style/return_nil.rb +4 -8
- data/lib/rubocop/cop/style/safe_navigation.rb +20 -2
- data/lib/rubocop/cop/style/self_assignment.rb +13 -13
- data/lib/rubocop/cop/style/semicolon.rb +18 -8
- data/lib/rubocop/cop/style/send.rb +9 -0
- data/lib/rubocop/cop/style/signal_exception.rb +100 -0
- data/lib/rubocop/cop/style/single_line_block_params.rb +2 -2
- data/lib/rubocop/cop/style/single_line_methods.rb +20 -8
- data/lib/rubocop/cop/style/special_global_vars.rb +16 -11
- data/lib/rubocop/cop/style/stabby_lambda_parentheses.rb +7 -12
- data/lib/rubocop/cop/style/stderr_puts.rb +5 -3
- data/lib/rubocop/cop/style/string_hash_keys.rb +36 -0
- data/lib/rubocop/cop/style/string_literals.rb +22 -0
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +2 -8
- data/lib/rubocop/cop/style/string_methods.rb +18 -7
- data/lib/rubocop/cop/style/symbol_array.rb +5 -9
- data/lib/rubocop/cop/style/symbol_proc.rb +5 -4
- data/lib/rubocop/cop/style/ternary_parentheses.rb +31 -40
- data/lib/rubocop/cop/style/trailing_body_on_method_definition.rb +101 -0
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +20 -6
- data/lib/rubocop/cop/style/trailing_comma_in_literal.rb +22 -7
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +95 -0
- data/lib/rubocop/cop/style/trailing_underscore_variable.rb +8 -4
- data/lib/rubocop/cop/style/trivial_accessors.rb +32 -10
- data/lib/rubocop/cop/style/unless_else.rb +15 -0
- data/lib/rubocop/cop/style/unneeded_capital_w.rb +17 -7
- data/lib/rubocop/cop/style/unneeded_interpolation.rb +14 -18
- data/lib/rubocop/cop/style/unneeded_percent_q.rb +13 -12
- data/lib/rubocop/cop/style/variable_interpolation.rb +20 -9
- data/lib/rubocop/cop/style/when_then.rb +13 -0
- data/lib/rubocop/cop/style/while_until_do.rb +26 -4
- data/lib/rubocop/cop/style/while_until_modifier.rb +25 -6
- data/lib/rubocop/cop/style/word_array.rb +4 -8
- data/lib/rubocop/cop/style/yoda_condition.rb +10 -16
- data/lib/rubocop/cop/style/zero_length_predicate.rb +23 -15
- data/lib/rubocop/cop/util.rb +42 -33
- data/lib/rubocop/cop/variable_force.rb +1 -1
- data/lib/rubocop/cop/variable_force/assignment.rb +4 -2
- data/lib/rubocop/cop/variable_force/scope.rb +1 -5
- data/lib/rubocop/cop/variable_force/variable.rb +1 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +2 -3
- data/lib/rubocop/formatter/formatter_set.rb +2 -1
- data/lib/rubocop/formatter/json_formatter.rb +9 -3
- data/lib/rubocop/formatter/quiet_formatter.rb +13 -0
- data/lib/rubocop/node_pattern.rb +2 -3
- data/lib/rubocop/options.rb +8 -8
- data/lib/rubocop/path_util.rb +15 -3
- data/lib/rubocop/processed_source.rb +5 -2
- data/lib/rubocop/rspec/shared_contexts.rb +4 -0
- data/lib/rubocop/runner.rb +1 -1
- data/lib/rubocop/token.rb +74 -0
- data/lib/rubocop/version.rb +1 -1
- metadata +37 -10
- data/lib/rubocop/cop/internal_affairs/deprecated_positional_arguments.rb +0 -81
- data/lib/rubocop/cop/layout/space_inside_brackets.rb +0 -20
- data/lib/rubocop/cop/lint/rescue_without_error_class.rb +0 -41
- data/lib/rubocop/cop/mixin/space_inside.rb +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbbe943a5ed0fd35d07ba728c5569d279eaffbb8
|
4
|
+
data.tar.gz: 0fd2d58d865e457479f1d6ce0d8f12c7cda1dba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4253ebe0cf732ca876078c01852f99cbfb9cc44f8bdb053bc368f6d18839c90152b87322738c052e15b8b128fa4a2e7f85902d8445d961b21df232a3b4fbb184
|
7
|
+
data.tar.gz: 9deb27503042d598d22d3f748a72fea9900b37a4fb95400180fada165e4ee393631d1b53456230d1a0aa1a69b8d26899c2b2e6253363912f2813de1eb6ac9f7b
|
data/README.md
CHANGED
@@ -51,7 +51,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
51
51
|
might want to use a conservative version locking in your `Gemfile`:
|
52
52
|
|
53
53
|
```rb
|
54
|
-
gem 'rubocop', '~> 0.
|
54
|
+
gem 'rubocop', '~> 0.52.0', require: false
|
55
55
|
```
|
56
56
|
|
57
57
|
## Quickstart
|
@@ -73,7 +73,6 @@ RuboCop supports the following Ruby implementations:
|
|
73
73
|
|
74
74
|
* MRI 2.1+
|
75
75
|
* JRuby 9.0+
|
76
|
-
* Rubinius 2.0+
|
77
76
|
|
78
77
|
## Team
|
79
78
|
|
data/config/default.yml
CHANGED
@@ -59,10 +59,10 @@ AllCops:
|
|
59
59
|
- 'vendor/**/*'
|
60
60
|
# Default formatter will be used if no `-f/--format` option is given.
|
61
61
|
DefaultFormatter: progress
|
62
|
-
# Cop names are
|
63
|
-
# by overriding DisplayCopNames, or by giving the
|
62
|
+
# Cop names are displayed in offense messages by default. Change behavior
|
63
|
+
# by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
|
64
64
|
# option.
|
65
|
-
DisplayCopNames:
|
65
|
+
DisplayCopNames: true
|
66
66
|
# Style guide URLs are not displayed in offense messages by default. Change
|
67
67
|
# behavior by overriding `DisplayStyleGuide`, or by giving the
|
68
68
|
# `-S/--display-style-guide` option.
|
@@ -490,6 +490,7 @@ Layout/SpaceBeforeBlockBraces:
|
|
490
490
|
SupportedStyles:
|
491
491
|
- space
|
492
492
|
- no_space
|
493
|
+
EnforcedStyleForEmptyBraces: no_space
|
493
494
|
SupportedStylesForEmptyBraces:
|
494
495
|
- space
|
495
496
|
- no_space
|
@@ -500,6 +501,19 @@ Layout/SpaceBeforeFirstArg:
|
|
500
501
|
# lines.
|
501
502
|
AllowForAlignment: true
|
502
503
|
|
504
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
505
|
+
EnforcedStyle: no_space
|
506
|
+
SupportedStyles:
|
507
|
+
- space
|
508
|
+
- no_space
|
509
|
+
# 'compact' normally requires a space inside the brackets, with the exception
|
510
|
+
# that successive left brackets or right brackets are collapsed together
|
511
|
+
- compact
|
512
|
+
EnforcedStyleForEmptyBrackets: no_space
|
513
|
+
SupportedStylesForEmptyBrackets:
|
514
|
+
- space
|
515
|
+
- no_space
|
516
|
+
|
503
517
|
Layout/SpaceInsideBlockBraces:
|
504
518
|
EnforcedStyle: space
|
505
519
|
SupportedStyles:
|
@@ -525,12 +539,36 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
525
539
|
- space
|
526
540
|
- no_space
|
527
541
|
|
542
|
+
Layout/SpaceInsideReferenceBrackets:
|
543
|
+
EnforcedStyle: no_space
|
544
|
+
SupportedStyles:
|
545
|
+
- space
|
546
|
+
- no_space
|
547
|
+
|
528
548
|
Layout/SpaceInsideStringInterpolation:
|
529
549
|
EnforcedStyle: no_space
|
530
550
|
SupportedStyles:
|
531
551
|
- space
|
532
552
|
- no_space
|
533
553
|
|
554
|
+
Layout/ClassStructure:
|
555
|
+
Description: 'Enforces a configured order of definitions within a class body.'
|
556
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-classes'
|
557
|
+
Enabled: false
|
558
|
+
Categories:
|
559
|
+
module_inclusion:
|
560
|
+
- include
|
561
|
+
- prepend
|
562
|
+
- extend
|
563
|
+
ExpectedOrder:
|
564
|
+
- module_inclusion
|
565
|
+
- constants
|
566
|
+
- public_class_methods
|
567
|
+
- initializer
|
568
|
+
- public_methods
|
569
|
+
- protected_methods
|
570
|
+
- private_methods
|
571
|
+
|
534
572
|
Layout/Tab:
|
535
573
|
# By default, the indentation width from Layout/IndentationWidth is used
|
536
574
|
# But it can be overridden by setting this parameter
|
@@ -676,6 +714,9 @@ Style/AndOr:
|
|
676
714
|
- always
|
677
715
|
- conditionals
|
678
716
|
|
717
|
+
Style/AsciiComments:
|
718
|
+
AllowedChars: []
|
719
|
+
|
679
720
|
# Checks if usage of `%()` or `%Q()` matches configuration.
|
680
721
|
Style/BarePercentLiterals:
|
681
722
|
EnforcedStyle: bare_percent
|
@@ -889,6 +930,12 @@ Style/EmptyMethod:
|
|
889
930
|
- compact
|
890
931
|
- expanded
|
891
932
|
|
933
|
+
Style/ExtendSelf:
|
934
|
+
EnforcedStyle: module_function
|
935
|
+
SupportedStyles:
|
936
|
+
- module_function
|
937
|
+
- extend_self
|
938
|
+
|
892
939
|
# Checks use of for or each in multiline loops.
|
893
940
|
Style/For:
|
894
941
|
EnforcedStyle: each
|
@@ -913,6 +960,7 @@ Style/FormatStringToken:
|
|
913
960
|
- annotated
|
914
961
|
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
915
962
|
- template
|
963
|
+
- unannotated
|
916
964
|
|
917
965
|
Style/FrozenStringLiteralComment:
|
918
966
|
EnforcedStyle: when_needed
|
@@ -954,9 +1002,6 @@ Style/HashSyntax:
|
|
954
1002
|
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
955
1003
|
PreferHashRocketsForNonAlnumEndingSymbols: false
|
956
1004
|
|
957
|
-
Style/IfUnlessModifier:
|
958
|
-
MaxLineLength: 80
|
959
|
-
|
960
1005
|
Style/InverseMethods:
|
961
1006
|
Enabled: true
|
962
1007
|
# `InverseMethods` are methods that can be inverted by a not (`not` or `!`)
|
@@ -1157,6 +1202,14 @@ Style/RegexpLiteral:
|
|
1157
1202
|
# are found in the regexp string.
|
1158
1203
|
AllowInnerSlashes: false
|
1159
1204
|
|
1205
|
+
Style/RescueStandardError:
|
1206
|
+
EnforcedStyle: explicit
|
1207
|
+
# implicit: Do not include the error class, `rescue`
|
1208
|
+
# explicit: Require an error class `rescue StandardError`
|
1209
|
+
SupportedStyles:
|
1210
|
+
- implicit
|
1211
|
+
- explicit
|
1212
|
+
|
1160
1213
|
Style/ReturnNil:
|
1161
1214
|
EnforcedStyle: return
|
1162
1215
|
SupportedStyles:
|
@@ -1314,9 +1367,6 @@ Style/TrivialAccessors:
|
|
1314
1367
|
- to_s
|
1315
1368
|
- to_sym
|
1316
1369
|
|
1317
|
-
Style/WhileUntilModifier:
|
1318
|
-
MaxLineLength: 80
|
1319
|
-
|
1320
1370
|
# `WordArray` enforces how array literals of word-like strings should be expressed.
|
1321
1371
|
Style/WordArray:
|
1322
1372
|
EnforcedStyle: percent
|
@@ -1449,6 +1499,16 @@ Lint/InheritException:
|
|
1449
1499
|
- runtime_error
|
1450
1500
|
- standard_error
|
1451
1501
|
|
1502
|
+
Lint/MissingCopEnableDirective:
|
1503
|
+
# Maximum number of consecutive lines the cop can be disabled for.
|
1504
|
+
# 0 allows only single-line disables
|
1505
|
+
# 1 would mean the maximum allowed is the following:
|
1506
|
+
# # rubocop:disable SomeCop
|
1507
|
+
# a = 1
|
1508
|
+
# # rubocop:enable SomeCop
|
1509
|
+
# .inf for any size
|
1510
|
+
MaximumRangeSize: .inf
|
1511
|
+
|
1452
1512
|
Lint/SafeNavigationChain:
|
1453
1513
|
Whitelist:
|
1454
1514
|
- present?
|
@@ -1456,6 +1516,10 @@ Lint/SafeNavigationChain:
|
|
1456
1516
|
- presence
|
1457
1517
|
- try
|
1458
1518
|
|
1519
|
+
# Checks for shadowed arguments
|
1520
|
+
Lint/ShadowedArgument:
|
1521
|
+
IgnoreImplicitReferences: false
|
1522
|
+
|
1459
1523
|
# Checks for unused block arguments
|
1460
1524
|
Lint/UnusedBlockArgument:
|
1461
1525
|
IgnoreEmptyBlocks: true
|
@@ -1487,6 +1551,10 @@ Rails/ActionFilter:
|
|
1487
1551
|
Include:
|
1488
1552
|
- app/controllers/**/*.rb
|
1489
1553
|
|
1554
|
+
Rails/CreateTableWithTimestamps:
|
1555
|
+
Include:
|
1556
|
+
- db/migrate/*.rb
|
1557
|
+
|
1490
1558
|
Rails/Date:
|
1491
1559
|
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
1492
1560
|
# `Date#to_time` etc.
|
@@ -1536,6 +1604,14 @@ Rails/HasManyOrHasOneDependent:
|
|
1536
1604
|
Include:
|
1537
1605
|
- app/models/**/*.rb
|
1538
1606
|
|
1607
|
+
Rails/InverseOf:
|
1608
|
+
Include:
|
1609
|
+
- app/models/**/*.rb
|
1610
|
+
|
1611
|
+
Rails/LexicallyScopedActionFilter:
|
1612
|
+
Include:
|
1613
|
+
- app/controllers/**/*.rb
|
1614
|
+
|
1539
1615
|
Rails/NotNullColumn:
|
1540
1616
|
Include:
|
1541
1617
|
- db/migrate/*.rb
|
@@ -1563,7 +1639,7 @@ Rails/ReversibleMigration:
|
|
1563
1639
|
|
1564
1640
|
Rails/SafeNavigation:
|
1565
1641
|
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
1566
|
-
# `try` and `try!` work
|
1642
|
+
# `try` and `try!` work slightly differently. `try!` and safe navigation will
|
1567
1643
|
# both raise a `NoMethodError` if the receiver of the method call does not
|
1568
1644
|
# implement the intended method. `try` will not raise an exception for this.
|
1569
1645
|
ConvertTry: false
|
data/config/disabled.yml
CHANGED
@@ -109,10 +109,15 @@ Style/Send:
|
|
109
109
|
StyleGuide: '#prefer-public-send'
|
110
110
|
Enabled: false
|
111
111
|
|
112
|
-
Style/StringMethods:
|
113
|
-
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
114
|
-
Enabled: false
|
115
|
-
|
116
112
|
Style/SingleLineBlockParams:
|
117
113
|
Description: 'Enforces the names of some block params.'
|
118
114
|
Enabled: false
|
115
|
+
|
116
|
+
Style/StringHashKeys:
|
117
|
+
Description: 'Prefer symbols instead of strings as hash keys.'
|
118
|
+
StyleGuide: '#symbols-as-keys'
|
119
|
+
Enabled: false
|
120
|
+
|
121
|
+
Style/StringMethods:
|
122
|
+
Description: 'Checks if configured preferred methods are used over non-preferred.'
|
123
|
+
Enabled: false
|
data/config/enabled.yml
CHANGED
@@ -1,5 +1,53 @@
|
|
1
1
|
# These are all the cops that are enabled in the default configuration.
|
2
2
|
|
3
|
+
#################### Bundler ###############################
|
4
|
+
|
5
|
+
Bundler/DuplicatedGem:
|
6
|
+
Description: 'Checks for duplicate gem entries in Gemfile.'
|
7
|
+
Enabled: true
|
8
|
+
Include:
|
9
|
+
- '**/Gemfile'
|
10
|
+
- '**/gems.rb'
|
11
|
+
|
12
|
+
Bundler/InsecureProtocolSource:
|
13
|
+
Description: >-
|
14
|
+
The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
|
15
|
+
because HTTP requests are insecure. Please change your source to
|
16
|
+
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
|
17
|
+
Enabled: true
|
18
|
+
Include:
|
19
|
+
- '**/Gemfile'
|
20
|
+
- '**/gems.rb'
|
21
|
+
|
22
|
+
Bundler/OrderedGems:
|
23
|
+
Description: >-
|
24
|
+
Gems within groups in the Gemfile should be alphabetically sorted.
|
25
|
+
Enabled: true
|
26
|
+
Include:
|
27
|
+
- '**/Gemfile'
|
28
|
+
- '**/gems.rb'
|
29
|
+
|
30
|
+
#################### Gemspec ###############################
|
31
|
+
|
32
|
+
Gemspec/DuplicatedAssignment:
|
33
|
+
Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
|
34
|
+
Enabled: true
|
35
|
+
Include:
|
36
|
+
- '**/*.gemspec'
|
37
|
+
|
38
|
+
Gemspec/OrderedDependencies:
|
39
|
+
Description: >-
|
40
|
+
Dependencies in the gemspec should be alphabetically sorted.
|
41
|
+
Enabled: true
|
42
|
+
Include:
|
43
|
+
- '**/*.gemspec'
|
44
|
+
|
45
|
+
Gemspec/RequiredRubyVersion:
|
46
|
+
Description: 'Checks that `required_ruby_version` of gemspec and `TargetRubyVersion` of .rubocop.yml are equal.'
|
47
|
+
Enabled: true
|
48
|
+
Include:
|
49
|
+
- '**/*.gemspec'
|
50
|
+
|
3
51
|
#################### Layout ###############################
|
4
52
|
|
5
53
|
Layout/AccessModifierIndentation:
|
@@ -53,6 +101,11 @@ Layout/ElseAlignment:
|
|
53
101
|
Description: 'Align elses and elsifs correctly.'
|
54
102
|
Enabled: true
|
55
103
|
|
104
|
+
Layout/EmptyLineAfterMagicComment:
|
105
|
+
Description: 'Add an empty line after magic comments to separate them from code.'
|
106
|
+
StyleGuide: '#separate-magic-comments-from-code'
|
107
|
+
Enabled: true
|
108
|
+
|
56
109
|
Layout/EmptyLineBetweenDefs:
|
57
110
|
Description: 'Use empty lines between defs.'
|
58
111
|
StyleGuide: '#empty-lines-between-methods'
|
@@ -68,6 +121,10 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
68
121
|
StyleGuide: '#empty-lines-around-access-modifier'
|
69
122
|
Enabled: true
|
70
123
|
|
124
|
+
Layout/EmptyLinesAroundArguments:
|
125
|
+
Description: "Keeps track of empty lines around method arguments."
|
126
|
+
Enabled: true
|
127
|
+
|
71
128
|
Layout/EmptyLinesAroundBeginBody:
|
72
129
|
Description: "Keeps track of empty lines around begin-end bodies."
|
73
130
|
StyleGuide: '#empty-lines-around-bodies'
|
@@ -88,13 +145,13 @@ Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
|
88
145
|
StyleGuide: '#empty-lines-around-bodies'
|
89
146
|
Enabled: true
|
90
147
|
|
91
|
-
Layout/
|
92
|
-
Description: "Keeps track of empty lines around
|
148
|
+
Layout/EmptyLinesAroundMethodBody:
|
149
|
+
Description: "Keeps track of empty lines around method bodies."
|
93
150
|
StyleGuide: '#empty-lines-around-bodies'
|
94
151
|
Enabled: true
|
95
152
|
|
96
|
-
Layout/
|
97
|
-
Description: "Keeps track of empty lines around
|
153
|
+
Layout/EmptyLinesAroundModuleBody:
|
154
|
+
Description: "Keeps track of empty lines around module bodies."
|
98
155
|
StyleGuide: '#empty-lines-around-bodies'
|
99
156
|
Enabled: true
|
100
157
|
|
@@ -107,25 +164,10 @@ Layout/ExtraSpacing:
|
|
107
164
|
Description: 'Do not use unnecessary spacing.'
|
108
165
|
Enabled: true
|
109
166
|
|
110
|
-
Layout/InitialIndentation:
|
111
|
-
Description: >-
|
112
|
-
Checks the indentation of the first non-blank non-comment line in a file.
|
113
|
-
Enabled: true
|
114
|
-
|
115
167
|
Layout/FirstParameterIndentation:
|
116
168
|
Description: 'Checks the indentation of the first parameter in a method call.'
|
117
169
|
Enabled: true
|
118
170
|
|
119
|
-
Layout/IndentationConsistency:
|
120
|
-
Description: 'Keep indentation straight.'
|
121
|
-
StyleGuide: '#spaces-indentation'
|
122
|
-
Enabled: true
|
123
|
-
|
124
|
-
Layout/IndentationWidth:
|
125
|
-
Description: 'Use 2 spaces for indentation.'
|
126
|
-
StyleGuide: '#spaces-indentation'
|
127
|
-
Enabled: true
|
128
|
-
|
129
171
|
Layout/IndentArray:
|
130
172
|
Description: >-
|
131
173
|
Checks the indentation of the first element in an array
|
@@ -147,8 +189,19 @@ Layout/IndentHeredoc:
|
|
147
189
|
StyleGuide: '#squiggly-heredocs'
|
148
190
|
Enabled: true
|
149
191
|
|
150
|
-
Layout/
|
151
|
-
Description: '
|
192
|
+
Layout/IndentationConsistency:
|
193
|
+
Description: 'Keep indentation straight.'
|
194
|
+
StyleGuide: '#spaces-indentation'
|
195
|
+
Enabled: true
|
196
|
+
|
197
|
+
Layout/IndentationWidth:
|
198
|
+
Description: 'Use 2 spaces for indentation.'
|
199
|
+
StyleGuide: '#spaces-indentation'
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
Layout/InitialIndentation:
|
203
|
+
Description: >-
|
204
|
+
Checks the indentation of the first non-blank non-comment line in a file.
|
152
205
|
Enabled: true
|
153
206
|
|
154
207
|
Layout/LeadingCommentSpace:
|
@@ -200,21 +253,10 @@ Layout/MultilineOperationIndentation:
|
|
200
253
|
one line.
|
201
254
|
Enabled: true
|
202
255
|
|
203
|
-
Layout/EmptyLineAfterMagicComment:
|
204
|
-
Description: 'Add an empty line after magic comments to separate them from code.'
|
205
|
-
StyleGuide: '#separate-magic-comments-from-code'
|
206
|
-
Enabled: true
|
207
|
-
|
208
256
|
Layout/RescueEnsureAlignment:
|
209
257
|
Description: 'Align rescues and ensures correctly.'
|
210
258
|
Enabled: true
|
211
259
|
|
212
|
-
Layout/SpaceBeforeFirstArg:
|
213
|
-
Description: >-
|
214
|
-
Checks that exactly one space is used between a method name
|
215
|
-
and the first argument for method calls without parentheses.
|
216
|
-
Enabled: true
|
217
|
-
|
218
260
|
Layout/SpaceAfterColon:
|
219
261
|
Description: 'Use spaces after colons.'
|
220
262
|
StyleGuide: '#spaces-operators'
|
@@ -242,6 +284,27 @@ Layout/SpaceAfterSemicolon:
|
|
242
284
|
StyleGuide: '#spaces-operators'
|
243
285
|
Enabled: true
|
244
286
|
|
287
|
+
Layout/SpaceAroundBlockParameters:
|
288
|
+
Description: 'Checks the spacing inside and after block parameters pipes.'
|
289
|
+
Enabled: true
|
290
|
+
|
291
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
292
|
+
Description: >-
|
293
|
+
Checks that the equals signs in parameter default assignments
|
294
|
+
have or don't have surrounding space depending on
|
295
|
+
configuration.
|
296
|
+
StyleGuide: '#spaces-around-equals'
|
297
|
+
Enabled: true
|
298
|
+
|
299
|
+
Layout/SpaceAroundKeyword:
|
300
|
+
Description: 'Use a space around keywords if appropriate.'
|
301
|
+
Enabled: true
|
302
|
+
|
303
|
+
Layout/SpaceAroundOperators:
|
304
|
+
Description: 'Use a single space around operators.'
|
305
|
+
StyleGuide: '#spaces-operators'
|
306
|
+
Enabled: true
|
307
|
+
|
245
308
|
Layout/SpaceBeforeBlockBraces:
|
246
309
|
Description: >-
|
247
310
|
Checks that the left block brace has or doesn't have space
|
@@ -258,49 +321,33 @@ Layout/SpaceBeforeComment:
|
|
258
321
|
same line.
|
259
322
|
Enabled: true
|
260
323
|
|
261
|
-
Layout/
|
262
|
-
Description: 'No spaces before semicolons.'
|
263
|
-
Enabled: true
|
264
|
-
|
265
|
-
Layout/SpaceInsideBlockBraces:
|
324
|
+
Layout/SpaceBeforeFirstArg:
|
266
325
|
Description: >-
|
267
|
-
Checks that
|
268
|
-
|
269
|
-
or doesn't have trailing space.
|
270
|
-
Enabled: true
|
271
|
-
|
272
|
-
Layout/SpaceAroundBlockParameters:
|
273
|
-
Description: 'Checks the spacing inside and after block parameters pipes.'
|
326
|
+
Checks that exactly one space is used between a method name
|
327
|
+
and the first argument for method calls without parentheses.
|
274
328
|
Enabled: true
|
275
329
|
|
276
|
-
Layout/
|
277
|
-
Description:
|
278
|
-
Checks that the equals signs in parameter default assignments
|
279
|
-
have or don't have surrounding space depending on
|
280
|
-
configuration.
|
281
|
-
StyleGuide: '#spaces-around-equals'
|
330
|
+
Layout/SpaceBeforeSemicolon:
|
331
|
+
Description: 'No spaces before semicolons.'
|
282
332
|
Enabled: true
|
283
333
|
|
284
|
-
Layout/
|
285
|
-
Description: '
|
334
|
+
Layout/SpaceInLambdaLiteral:
|
335
|
+
Description: 'Checks for spaces in lambda literals.'
|
286
336
|
Enabled: true
|
287
337
|
|
288
|
-
Layout/
|
289
|
-
Description: '
|
290
|
-
StyleGuide: '#spaces-operators'
|
338
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
339
|
+
Description: 'Checks the spacing inside array literal brackets.'
|
291
340
|
Enabled: true
|
292
341
|
|
293
342
|
Layout/SpaceInsideArrayPercentLiteral:
|
294
343
|
Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
|
295
344
|
Enabled: true
|
296
345
|
|
297
|
-
Layout/
|
298
|
-
Description:
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
Description: 'No spaces after [ or before ].'
|
303
|
-
StyleGuide: '#no-spaces-braces'
|
346
|
+
Layout/SpaceInsideBlockBraces:
|
347
|
+
Description: >-
|
348
|
+
Checks that block braces have or don't have surrounding space.
|
349
|
+
For blocks taking parameters, checks that the left brace has
|
350
|
+
or doesn't have trailing space.
|
304
351
|
Enabled: true
|
305
352
|
|
306
353
|
Layout/SpaceInsideHashLiteralBraces:
|
@@ -310,7 +357,11 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
310
357
|
|
311
358
|
Layout/SpaceInsideParens:
|
312
359
|
Description: 'No spaces after ( or before ).'
|
313
|
-
StyleGuide: '#
|
360
|
+
StyleGuide: '#spaces-braces'
|
361
|
+
Enabled: true
|
362
|
+
|
363
|
+
Layout/SpaceInsidePercentLiteralDelimiters:
|
364
|
+
Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
|
314
365
|
Enabled: true
|
315
366
|
|
316
367
|
Layout/SpaceInsideRangeLiteral:
|
@@ -318,6 +369,10 @@ Layout/SpaceInsideRangeLiteral:
|
|
318
369
|
StyleGuide: '#no-space-inside-range-literals'
|
319
370
|
Enabled: true
|
320
371
|
|
372
|
+
Layout/SpaceInsideReferenceBrackets:
|
373
|
+
Description: 'Checks the spacing inside referential brackets.'
|
374
|
+
Enabled: true
|
375
|
+
|
321
376
|
Layout/SpaceInsideStringInterpolation:
|
322
377
|
Description: 'Checks for padding/surrounding spaces inside string interpolation.'
|
323
378
|
StyleGuide: '#string-interpolation'
|
@@ -338,1555 +393,1599 @@ Layout/TrailingWhitespace:
|
|
338
393
|
StyleGuide: '#no-trailing-whitespace'
|
339
394
|
Enabled: true
|
340
395
|
|
341
|
-
####################
|
396
|
+
#################### Lint ##################################
|
397
|
+
### Warnings
|
342
398
|
|
343
|
-
|
344
|
-
Description:
|
345
|
-
|
399
|
+
Lint/AmbiguousBlockAssociation:
|
400
|
+
Description: >-
|
401
|
+
Checks for ambiguous block association with method when param passed without
|
402
|
+
parentheses.
|
403
|
+
StyleGuide: '#syntax'
|
346
404
|
Enabled: true
|
347
405
|
|
348
|
-
|
349
|
-
Description:
|
350
|
-
|
406
|
+
Lint/AmbiguousOperator:
|
407
|
+
Description: >-
|
408
|
+
Checks for ambiguous operators in the first argument of a
|
409
|
+
method invocation without parentheses.
|
410
|
+
StyleGuide: '#method-invocation-parens'
|
351
411
|
Enabled: true
|
352
412
|
|
353
|
-
|
354
|
-
Description:
|
355
|
-
|
413
|
+
Lint/AmbiguousRegexpLiteral:
|
414
|
+
Description: >-
|
415
|
+
Checks for ambiguous regexp literals in the first argument of
|
416
|
+
a method invocation without parentheses.
|
356
417
|
Enabled: true
|
357
418
|
|
358
|
-
|
359
|
-
Description: '
|
360
|
-
StyleGuide: '#
|
419
|
+
Lint/AssignmentInCondition:
|
420
|
+
Description: "Don't use assignment in conditions."
|
421
|
+
StyleGuide: '#safe-assignment-in-condition'
|
361
422
|
Enabled: true
|
362
423
|
|
363
|
-
|
364
|
-
Description: '
|
365
|
-
StyleGuide: '#snake-case-files'
|
424
|
+
Lint/BlockAlignment:
|
425
|
+
Description: 'Align block ends correctly.'
|
366
426
|
Enabled: true
|
367
427
|
|
368
|
-
|
369
|
-
Description: '
|
370
|
-
StyleGuide: '#heredoc-delimiters'
|
428
|
+
Lint/BooleanSymbol:
|
429
|
+
Description: 'Check for `:true` and `:false` symbols.'
|
371
430
|
Enabled: true
|
372
431
|
|
373
|
-
|
374
|
-
Description:
|
375
|
-
StyleGuide: '#heredoc-delimiters'
|
432
|
+
Lint/CircularArgumentReference:
|
433
|
+
Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument."
|
376
434
|
Enabled: true
|
377
435
|
|
378
|
-
|
379
|
-
Description:
|
380
|
-
|
436
|
+
Lint/ConditionPosition:
|
437
|
+
Description: >-
|
438
|
+
Checks for condition placed in a confusing position relative to
|
439
|
+
the keyword.
|
440
|
+
StyleGuide: '#same-line-condition'
|
381
441
|
Enabled: true
|
382
442
|
|
383
|
-
|
384
|
-
Description: 'Check
|
385
|
-
StyleGuide: '#bool-methods-qmark'
|
443
|
+
Lint/Debugger:
|
444
|
+
Description: 'Check for debugger calls.'
|
386
445
|
Enabled: true
|
387
446
|
|
388
|
-
|
389
|
-
Description: '
|
390
|
-
StyleGuide: '#other-arg'
|
447
|
+
Lint/DefEndAlignment:
|
448
|
+
Description: 'Align ends corresponding to defs correctly.'
|
391
449
|
Enabled: true
|
392
450
|
|
393
|
-
|
394
|
-
Description: '
|
395
|
-
StyleGuide: '#snake-case-symbols-methods-vars'
|
451
|
+
Lint/DeprecatedClassMethods:
|
452
|
+
Description: 'Check for deprecated class method calls.'
|
396
453
|
Enabled: true
|
397
454
|
|
398
|
-
|
399
|
-
Description: '
|
455
|
+
Lint/DuplicateCaseCondition:
|
456
|
+
Description: 'Do not repeat values in case conditionals.'
|
400
457
|
Enabled: true
|
401
458
|
|
402
|
-
|
403
|
-
|
404
|
-
Style/Alias:
|
405
|
-
Description: 'Use alias instead of alias_method.'
|
406
|
-
StyleGuide: '#alias-method'
|
459
|
+
Lint/DuplicateMethods:
|
460
|
+
Description: 'Check for duplicate method definitions.'
|
407
461
|
Enabled: true
|
408
462
|
|
409
|
-
|
410
|
-
Description: '
|
411
|
-
StyleGuide: '#no-and-or-or'
|
463
|
+
Lint/DuplicatedKey:
|
464
|
+
Description: 'Check for duplicate keys in hash literals.'
|
412
465
|
Enabled: true
|
413
466
|
|
414
|
-
|
415
|
-
Description: '
|
416
|
-
StyleGuide: '#array-join'
|
467
|
+
Lint/EachWithObjectArgument:
|
468
|
+
Description: 'Check for immutable argument given to each_with_object.'
|
417
469
|
Enabled: true
|
418
470
|
|
419
|
-
|
420
|
-
Description: '
|
421
|
-
StyleGuide: '#english-comments'
|
471
|
+
Lint/ElseLayout:
|
472
|
+
Description: 'Check for odd code arrangement in an else block.'
|
422
473
|
Enabled: true
|
423
474
|
|
424
|
-
|
425
|
-
Description: 'Checks for
|
426
|
-
StyleGuide: '#attr'
|
475
|
+
Lint/EmptyEnsure:
|
476
|
+
Description: 'Checks for empty ensure block.'
|
427
477
|
Enabled: true
|
478
|
+
AutoCorrect: false
|
428
479
|
|
429
|
-
|
430
|
-
Description: '
|
431
|
-
StyleGuide: '#no-BEGIN-blocks'
|
480
|
+
Lint/EmptyExpression:
|
481
|
+
Description: 'Checks for empty expressions.'
|
432
482
|
Enabled: true
|
433
483
|
|
434
|
-
|
435
|
-
Description: 'Checks
|
436
|
-
StyleGuide: '#percent-q-shorthand'
|
484
|
+
Lint/EmptyInterpolation:
|
485
|
+
Description: 'Checks for empty string interpolation.'
|
437
486
|
Enabled: true
|
438
487
|
|
439
|
-
|
440
|
-
Description: '
|
441
|
-
StyleGuide: '#no-block-comments'
|
488
|
+
Lint/EmptyWhen:
|
489
|
+
Description: 'Checks for `when` branches with empty bodies.'
|
442
490
|
Enabled: true
|
443
491
|
|
444
|
-
|
445
|
-
Description:
|
446
|
-
Avoid using {...} for multi-line blocks (multiline chaining is
|
447
|
-
always ugly).
|
448
|
-
Prefer {...} over do...end for single-line blocks.
|
449
|
-
StyleGuide: '#single-line-blocks'
|
492
|
+
Lint/EndAlignment:
|
493
|
+
Description: 'Align ends correctly.'
|
450
494
|
Enabled: true
|
451
495
|
|
452
|
-
|
453
|
-
Description: '
|
496
|
+
Lint/EndInMethod:
|
497
|
+
Description: 'END blocks should not be placed inside method definitions.'
|
454
498
|
Enabled: true
|
455
499
|
|
456
|
-
|
457
|
-
Description: '
|
458
|
-
StyleGuide: '#no-
|
500
|
+
Lint/EnsureReturn:
|
501
|
+
Description: 'Do not use return in an ensure block.'
|
502
|
+
StyleGuide: '#no-return-ensure'
|
459
503
|
Enabled: true
|
460
504
|
|
461
|
-
|
462
|
-
Description:
|
463
|
-
|
505
|
+
Lint/FloatOutOfRange:
|
506
|
+
Description: >-
|
507
|
+
Catches floating-point literals too large or small for Ruby to
|
508
|
+
represent.
|
464
509
|
Enabled: true
|
465
510
|
|
466
|
-
|
467
|
-
Description: '
|
468
|
-
StyleGuide: '#namespace-definition'
|
511
|
+
Lint/FormatParameterMismatch:
|
512
|
+
Description: 'The number of parameters to format/sprint must match the fields.'
|
469
513
|
Enabled: true
|
470
514
|
|
471
|
-
|
472
|
-
Description: '
|
515
|
+
Lint/HandleExceptions:
|
516
|
+
Description: "Don't suppress exception."
|
517
|
+
StyleGuide: '#dont-hide-exceptions'
|
473
518
|
Enabled: true
|
474
519
|
|
475
|
-
|
476
|
-
Description:
|
477
|
-
|
520
|
+
Lint/ImplicitStringConcatenation:
|
521
|
+
Description: >-
|
522
|
+
Checks for adjacent string literals on the same line, which
|
523
|
+
could better be represented as a single string literal.
|
478
524
|
Enabled: true
|
479
525
|
|
480
|
-
|
481
|
-
Description:
|
482
|
-
|
526
|
+
Lint/IneffectiveAccessModifier:
|
527
|
+
Description: >-
|
528
|
+
Checks for attempts to use `private` or `protected` to set
|
529
|
+
the visibility of a class method, which does not work.
|
483
530
|
Enabled: true
|
484
531
|
|
485
|
-
|
486
|
-
Description: '
|
487
|
-
StyleGuide: '#double-colons'
|
532
|
+
Lint/InheritException:
|
533
|
+
Description: 'Avoid inheriting from the `Exception` class.'
|
488
534
|
Enabled: true
|
489
535
|
|
490
|
-
|
491
|
-
Description: '
|
492
|
-
StyleGuide: '#percent-x'
|
536
|
+
Lint/InterpolationCheck:
|
537
|
+
Description: 'Raise warning for interpolation in single q strs'
|
493
538
|
Enabled: true
|
494
539
|
|
495
|
-
|
496
|
-
Description:
|
497
|
-
Checks formatting of special comments
|
498
|
-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
499
|
-
StyleGuide: '#annotate-keywords'
|
540
|
+
Lint/LiteralAsCondition:
|
541
|
+
Description: 'Checks of literals used in conditions.'
|
500
542
|
Enabled: true
|
501
543
|
|
502
|
-
|
503
|
-
Description: '
|
544
|
+
Lint/LiteralInInterpolation:
|
545
|
+
Description: 'Checks for literals used in interpolation.'
|
504
546
|
Enabled: true
|
505
547
|
|
506
|
-
|
548
|
+
Lint/Loop:
|
507
549
|
Description: >-
|
508
|
-
Use
|
509
|
-
|
510
|
-
|
511
|
-
Enabled: true
|
512
|
-
|
513
|
-
Style/DateTime:
|
514
|
-
Description: 'Use Date or Time over DateTime.'
|
515
|
-
StyleGuide: '#date--time'
|
550
|
+
Use Kernel#loop with break rather than begin/end/until or
|
551
|
+
begin/end/while for post-loop tests.
|
552
|
+
StyleGuide: '#loop-with-break'
|
516
553
|
Enabled: true
|
517
554
|
|
518
|
-
|
519
|
-
Description: '
|
520
|
-
StyleGuide: '#method-parens'
|
555
|
+
Lint/MissingCopEnableDirective:
|
556
|
+
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`'
|
521
557
|
Enabled: true
|
522
558
|
|
523
|
-
|
524
|
-
Description:
|
525
|
-
Use the `__dir__` method to retrieve the canonicalized
|
526
|
-
absolute path to the current file.
|
559
|
+
Lint/MultipleCompare:
|
560
|
+
Description: "Use `&&` operator to compare multiple value."
|
527
561
|
Enabled: true
|
528
562
|
|
529
|
-
|
530
|
-
Description: '
|
563
|
+
Lint/NestedMethodDefinition:
|
564
|
+
Description: 'Do not use nested method definitions.'
|
565
|
+
StyleGuide: '#no-nested-methods'
|
531
566
|
Enabled: true
|
532
|
-
Exclude:
|
533
|
-
- 'spec/**/*'
|
534
|
-
- 'test/**/*'
|
535
567
|
|
536
|
-
|
537
|
-
Description: 'Checks for
|
538
|
-
StyleGuide: '#no-bang-bang'
|
568
|
+
Lint/NestedPercentLiteral:
|
569
|
+
Description: 'Checks for nested percent literals.'
|
539
570
|
Enabled: true
|
540
571
|
|
541
|
-
|
542
|
-
Description:
|
543
|
-
|
544
|
-
|
572
|
+
Lint/NextWithoutAccumulator:
|
573
|
+
Description: >-
|
574
|
+
Do not omit the accumulator when calling `next`
|
575
|
+
in a `reduce`/`inject` block.
|
545
576
|
Enabled: true
|
546
577
|
|
547
|
-
|
548
|
-
Description: '
|
578
|
+
Lint/NonLocalExitFromIterator:
|
579
|
+
Description: 'Do not use return in iterator to cause non-local exit.'
|
549
580
|
Enabled: true
|
550
581
|
|
551
|
-
|
552
|
-
Description:
|
582
|
+
Lint/ParenthesesAsGroupedExpression:
|
583
|
+
Description: >-
|
584
|
+
Checks for method calls with a space before the opening
|
585
|
+
parenthesis.
|
586
|
+
StyleGuide: '#parens-no-spaces'
|
553
587
|
Enabled: true
|
554
588
|
|
555
|
-
|
556
|
-
Description:
|
589
|
+
Lint/PercentStringArray:
|
590
|
+
Description: >-
|
591
|
+
Checks for unwanted commas and quotes in %w/%W literals.
|
557
592
|
Enabled: true
|
558
593
|
|
559
|
-
|
560
|
-
Description:
|
561
|
-
|
594
|
+
Lint/PercentSymbolArray:
|
595
|
+
Description: >-
|
596
|
+
Checks for unwanted commas and colons in %i/%I literals.
|
562
597
|
Enabled: true
|
563
598
|
|
564
|
-
|
565
|
-
Description:
|
566
|
-
|
599
|
+
Lint/RandOne:
|
600
|
+
Description: >-
|
601
|
+
Checks for `rand(1)` calls. Such calls always return `0`
|
602
|
+
and most likely a mistake.
|
567
603
|
Enabled: true
|
568
604
|
|
569
|
-
|
570
|
-
Description: '
|
571
|
-
StyleGuide: '#no-END-blocks'
|
605
|
+
Lint/RedundantWithIndex:
|
606
|
+
Description: 'Checks for redundant `with_index`.'
|
572
607
|
Enabled: true
|
573
608
|
|
574
|
-
|
575
|
-
Description: '
|
576
|
-
StyleGuide: '#utf-8'
|
609
|
+
Lint/RedundantWithObject:
|
610
|
+
Description: 'Checks for redundant `with_object`.'
|
577
611
|
Enabled: true
|
578
612
|
|
579
|
-
|
580
|
-
Description:
|
581
|
-
|
613
|
+
Lint/RegexpAsCondition:
|
614
|
+
Description: >-
|
615
|
+
Do not use regexp literal as a condition.
|
616
|
+
The regexp literal matches `$_` implicitly.
|
582
617
|
Enabled: true
|
583
618
|
|
584
|
-
|
619
|
+
Lint/RequireParentheses:
|
585
620
|
Description: >-
|
586
|
-
|
587
|
-
|
621
|
+
Use parentheses in the method call to avoid confusion
|
622
|
+
about precedence.
|
588
623
|
Enabled: true
|
589
624
|
|
590
|
-
|
591
|
-
Description: '
|
592
|
-
StyleGuide: '#no-
|
625
|
+
Lint/RescueException:
|
626
|
+
Description: 'Avoid rescuing the Exception class.'
|
627
|
+
StyleGuide: '#no-blind-rescues'
|
593
628
|
Enabled: true
|
594
629
|
|
595
|
-
|
596
|
-
Description: '
|
597
|
-
StyleGuide: '#no-for-loops'
|
630
|
+
Lint/RescueType:
|
631
|
+
Description: 'Avoid rescuing from non constants that could result in a `TypeError`.'
|
598
632
|
Enabled: true
|
599
633
|
|
600
|
-
|
601
|
-
Description: '
|
602
|
-
StyleGuide: '#sprintf'
|
634
|
+
Lint/ReturnInVoidContext:
|
635
|
+
Description: 'Checks for return in void context.'
|
603
636
|
Enabled: true
|
604
637
|
|
605
|
-
|
606
|
-
Description: '
|
638
|
+
Lint/SafeNavigationChain:
|
639
|
+
Description: 'Do not chain ordinary method call after safe navigation operator.'
|
607
640
|
Enabled: true
|
608
641
|
|
609
|
-
|
610
|
-
Description: '
|
611
|
-
StyleGuide: '#instance-vars'
|
612
|
-
Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
|
642
|
+
Lint/ScriptPermission:
|
643
|
+
Description: 'Grant script file execute permission.'
|
613
644
|
Enabled: true
|
614
645
|
|
615
|
-
|
616
|
-
Description: '
|
617
|
-
StyleGuide: '#no-nested-conditionals'
|
646
|
+
Lint/ShadowedArgument:
|
647
|
+
Description: 'Avoid reassigning arguments before they were used.'
|
618
648
|
Enabled: true
|
619
649
|
|
620
|
-
|
650
|
+
Lint/ShadowedException:
|
621
651
|
Description: >-
|
622
|
-
|
623
|
-
|
624
|
-
StyleGuide: '#hash-literals'
|
652
|
+
Avoid rescuing a higher level exception
|
653
|
+
before a lower level exception.
|
625
654
|
Enabled: true
|
626
655
|
|
627
|
-
|
628
|
-
Description:
|
656
|
+
Lint/ShadowingOuterLocalVariable:
|
657
|
+
Description: >-
|
658
|
+
Do not use the same name as outer local variable
|
659
|
+
for block arguments or block local variables.
|
629
660
|
Enabled: true
|
630
661
|
|
631
|
-
|
632
|
-
Description:
|
633
|
-
|
634
|
-
single-line body.
|
635
|
-
StyleGuide: '#if-as-a-modifier'
|
662
|
+
Lint/StringConversionInInterpolation:
|
663
|
+
Description: 'Checks for Object#to_s usage in string interpolation.'
|
664
|
+
StyleGuide: '#no-to-s'
|
636
665
|
Enabled: true
|
637
666
|
|
638
|
-
|
639
|
-
Description:
|
640
|
-
Avoid modifier if/unless usage on conditionals.
|
667
|
+
Lint/Syntax:
|
668
|
+
Description: 'Checks syntax error'
|
641
669
|
Enabled: true
|
642
670
|
|
643
|
-
|
644
|
-
Description: 'Do not use
|
645
|
-
StyleGuide: '#no-semicolon-ifs'
|
671
|
+
Lint/UnderscorePrefixedVariableName:
|
672
|
+
Description: 'Do not use prefix `_` for a variable that is used.'
|
646
673
|
Enabled: true
|
647
674
|
|
648
|
-
|
649
|
-
Description:
|
650
|
-
Checks that conditional statements do not have an identical
|
651
|
-
line at the end of each branch, which can validly be moved
|
652
|
-
out of the conditional.
|
675
|
+
Lint/UnifiedInteger:
|
676
|
+
Description: 'Use Integer instead of Fixnum or Bignum'
|
653
677
|
Enabled: true
|
654
678
|
|
655
|
-
|
656
|
-
Description:
|
657
|
-
|
679
|
+
Lint/UnneededDisable:
|
680
|
+
Description: >-
|
681
|
+
Checks for rubocop:disable comments that can be removed.
|
682
|
+
Note: this cop is not disabled when disabling all cops.
|
683
|
+
It must be explicitly disabled.
|
658
684
|
Enabled: true
|
659
685
|
|
660
|
-
|
661
|
-
Description:
|
662
|
-
Use the inverse method instead of `!.method`
|
663
|
-
if an inverse method is defined.
|
686
|
+
Lint/UnneededRequireStatement:
|
687
|
+
Description: 'Checks for unnecessary `require` statement.'
|
664
688
|
Enabled: true
|
665
689
|
|
666
|
-
|
667
|
-
Description: '
|
668
|
-
StyleGuide: '#lambda-multi-line'
|
690
|
+
Lint/UnneededSplatExpansion:
|
691
|
+
Description: 'Checks for splat unnecessarily being called on literals'
|
669
692
|
Enabled: true
|
670
693
|
|
671
|
-
|
672
|
-
Description: '
|
673
|
-
StyleGuide: '#proc-call'
|
694
|
+
Lint/UnreachableCode:
|
695
|
+
Description: 'Unreachable code.'
|
674
696
|
Enabled: true
|
675
697
|
|
676
|
-
|
677
|
-
Description:
|
678
|
-
|
679
|
-
line end.
|
698
|
+
Lint/UnusedBlockArgument:
|
699
|
+
Description: 'Checks for unused block arguments.'
|
700
|
+
StyleGuide: '#underscore-unused-vars'
|
680
701
|
Enabled: true
|
681
702
|
|
682
|
-
|
683
|
-
Description: '
|
684
|
-
StyleGuide: '#
|
703
|
+
Lint/UnusedMethodArgument:
|
704
|
+
Description: 'Checks for unused method arguments.'
|
705
|
+
StyleGuide: '#underscore-unused-vars'
|
685
706
|
Enabled: true
|
686
707
|
|
687
|
-
|
708
|
+
Lint/UriEscapeUnescape:
|
688
709
|
Description: >-
|
689
|
-
|
690
|
-
|
691
|
-
|
710
|
+
`URI.escape` method is obsolete and should not be used. Instead, use
|
711
|
+
`CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
|
712
|
+
depending on your specific use case.
|
713
|
+
Also `URI.unescape` method is obsolete and should not be used. Instead, use
|
714
|
+
`CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
|
715
|
+
depending on your specific use case.
|
692
716
|
Enabled: true
|
693
717
|
|
694
|
-
|
695
|
-
Description: '
|
696
|
-
StyleGuide: '#no-method-missing'
|
718
|
+
Lint/UriRegexp:
|
719
|
+
Description: 'Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.'
|
697
720
|
Enabled: true
|
698
721
|
|
699
|
-
|
700
|
-
Description:
|
701
|
-
Use `Enumerable#minmax` instead of `Enumerable#min`
|
702
|
-
and `Enumerable#max` in conjunction.'
|
722
|
+
Lint/UselessAccessModifier:
|
723
|
+
Description: 'Checks for useless access modifiers.'
|
703
724
|
Enabled: true
|
725
|
+
ContextCreatingMethods: []
|
726
|
+
MethodCreatingMethods: []
|
704
727
|
|
705
|
-
|
706
|
-
Description: 'Checks for
|
707
|
-
StyleGuide: '#
|
728
|
+
Lint/UselessAssignment:
|
729
|
+
Description: 'Checks for useless assignment to a local variable.'
|
730
|
+
StyleGuide: '#underscore-unused-vars'
|
708
731
|
Enabled: true
|
709
732
|
|
710
|
-
|
711
|
-
Description: 'Checks for
|
712
|
-
StyleGuide: '#module-function'
|
733
|
+
Lint/UselessComparison:
|
734
|
+
Description: 'Checks for comparison of something with itself.'
|
713
735
|
Enabled: true
|
714
736
|
|
715
|
-
|
716
|
-
Description: '
|
717
|
-
StyleGuide: '#single-line-blocks'
|
737
|
+
Lint/UselessElseWithoutRescue:
|
738
|
+
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
718
739
|
Enabled: true
|
719
740
|
|
720
|
-
|
721
|
-
Description: '
|
722
|
-
StyleGuide: '#no-then'
|
741
|
+
Lint/UselessSetterCall:
|
742
|
+
Description: 'Checks for useless setter call to a local variable.'
|
723
743
|
Enabled: true
|
724
744
|
|
725
|
-
|
726
|
-
Description: '
|
727
|
-
StyleGuide: '#no-multiline-if-modifiers'
|
745
|
+
Lint/Void:
|
746
|
+
Description: 'Possible use of operator/literal/variable in void context.'
|
728
747
|
Enabled: true
|
729
748
|
|
730
|
-
|
731
|
-
Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
|
732
|
-
Enabled: true
|
749
|
+
#################### Metrics ###############################
|
733
750
|
|
734
|
-
|
751
|
+
Metrics/AbcSize:
|
735
752
|
Description: >-
|
736
|
-
|
737
|
-
|
738
|
-
|
753
|
+
A calculated magnitude based on number of assignments,
|
754
|
+
branches, and conditions.
|
755
|
+
Reference: 'http://c2.com/cgi/wiki?AbcMetric'
|
739
756
|
Enabled: true
|
740
757
|
|
741
|
-
|
742
|
-
Description:
|
743
|
-
Avoid comparing a variable with multiple items in a conditional,
|
744
|
-
use Array#include? instead.
|
758
|
+
Metrics/BlockLength:
|
759
|
+
Description: 'Avoid long blocks with many lines.'
|
745
760
|
Enabled: true
|
746
761
|
|
747
|
-
|
748
|
-
Description: '
|
762
|
+
Metrics/BlockNesting:
|
763
|
+
Description: 'Avoid excessive block nesting'
|
764
|
+
StyleGuide: '#three-is-the-number-thou-shalt-count'
|
749
765
|
Enabled: true
|
750
766
|
|
751
|
-
|
767
|
+
Metrics/ClassLength:
|
768
|
+
Description: 'Avoid classes longer than 100 lines of code.'
|
769
|
+
Enabled: true
|
770
|
+
|
771
|
+
Metrics/CyclomaticComplexity:
|
752
772
|
Description: >-
|
753
|
-
|
754
|
-
|
755
|
-
StyleGuide: '#unless-for-negatives'
|
773
|
+
A complexity metric that is strongly correlated to the number
|
774
|
+
of test cases needed to validate a method.
|
756
775
|
Enabled: true
|
757
776
|
|
758
|
-
|
759
|
-
Description: '
|
760
|
-
StyleGuide: '#
|
777
|
+
Metrics/LineLength:
|
778
|
+
Description: 'Limit lines to 80 characters.'
|
779
|
+
StyleGuide: '#80-character-limits'
|
761
780
|
Enabled: true
|
762
781
|
|
763
|
-
|
764
|
-
Description: 'Avoid
|
765
|
-
StyleGuide: '#
|
782
|
+
Metrics/MethodLength:
|
783
|
+
Description: 'Avoid methods longer than 10 lines of code.'
|
784
|
+
StyleGuide: '#short-methods'
|
766
785
|
Enabled: true
|
767
786
|
|
768
|
-
|
787
|
+
Metrics/ModuleLength:
|
788
|
+
Description: 'Avoid modules longer than 100 lines of code.'
|
789
|
+
Enabled: true
|
790
|
+
|
791
|
+
Metrics/ParameterLists:
|
792
|
+
Description: 'Avoid parameter lists longer than three or four parameters.'
|
793
|
+
StyleGuide: '#too-many-params'
|
794
|
+
Enabled: true
|
795
|
+
|
796
|
+
Metrics/PerceivedComplexity:
|
769
797
|
Description: >-
|
770
|
-
|
771
|
-
|
798
|
+
A complexity metric geared towards measuring complexity for a
|
799
|
+
human reader.
|
772
800
|
Enabled: true
|
773
801
|
|
774
|
-
|
775
|
-
|
776
|
-
|
802
|
+
#################### Naming ##############################
|
803
|
+
|
804
|
+
Naming/AccessorMethodName:
|
805
|
+
Description: Check the naming of accessor methods for get_/set_.
|
806
|
+
StyleGuide: '#accessor_mutator_method_names'
|
777
807
|
Enabled: true
|
778
808
|
|
779
|
-
|
780
|
-
Description: 'Use
|
781
|
-
StyleGuide: '#
|
809
|
+
Naming/AsciiIdentifiers:
|
810
|
+
Description: 'Use only ascii symbols in identifiers.'
|
811
|
+
StyleGuide: '#english-identifiers'
|
782
812
|
Enabled: true
|
783
813
|
|
784
|
-
|
785
|
-
Description: '
|
786
|
-
StyleGuide: '#
|
814
|
+
Naming/BinaryOperatorParameterName:
|
815
|
+
Description: 'When defining binary operators, name the argument other.'
|
816
|
+
StyleGuide: '#other-arg'
|
787
817
|
Enabled: true
|
788
818
|
|
789
|
-
|
790
|
-
Description: '
|
791
|
-
StyleGuide: '#
|
819
|
+
Naming/ClassAndModuleCamelCase:
|
820
|
+
Description: 'Use CamelCase for classes and modules.'
|
821
|
+
StyleGuide: '#camelcase-classes'
|
792
822
|
Enabled: true
|
793
823
|
|
794
|
-
|
795
|
-
Description: '
|
796
|
-
StyleGuide: '#
|
824
|
+
Naming/ConstantName:
|
825
|
+
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
826
|
+
StyleGuide: '#screaming-snake-case'
|
797
827
|
Enabled: true
|
798
828
|
|
799
|
-
|
800
|
-
Description:
|
801
|
-
|
802
|
-
readability.
|
803
|
-
StyleGuide: '#underscores-in-numerics'
|
829
|
+
Naming/FileName:
|
830
|
+
Description: 'Use snake_case for source file names.'
|
831
|
+
StyleGuide: '#snake-case-files'
|
804
832
|
Enabled: true
|
805
833
|
|
806
|
-
|
807
|
-
Description: 'Use
|
808
|
-
StyleGuide: '#
|
834
|
+
Naming/HeredocDelimiterCase:
|
835
|
+
Description: 'Use configured case for heredoc delimiters.'
|
836
|
+
StyleGuide: '#heredoc-delimiters'
|
809
837
|
Enabled: true
|
810
838
|
|
811
|
-
|
839
|
+
Naming/HeredocDelimiterNaming:
|
840
|
+
Description: 'Use descriptive heredoc delimiters.'
|
841
|
+
StyleGuide: '#heredoc-delimiters'
|
842
|
+
Enabled: true
|
843
|
+
|
844
|
+
Naming/MethodName:
|
845
|
+
Description: 'Use the configured style when naming methods.'
|
846
|
+
StyleGuide: '#snake-case-symbols-methods-vars'
|
847
|
+
Enabled: true
|
848
|
+
|
849
|
+
Naming/PredicateName:
|
850
|
+
Description: 'Check the names of predicate methods.'
|
851
|
+
StyleGuide: '#bool-methods-qmark'
|
852
|
+
Enabled: true
|
853
|
+
|
854
|
+
Naming/VariableName:
|
855
|
+
Description: 'Use the configured style when naming variables.'
|
856
|
+
StyleGuide: '#snake-case-symbols-methods-vars'
|
857
|
+
Enabled: true
|
858
|
+
|
859
|
+
Naming/VariableNumber:
|
860
|
+
Description: 'Use the configured style when numbering variables.'
|
861
|
+
Enabled: true
|
862
|
+
|
863
|
+
#################### Performance ###########################
|
864
|
+
|
865
|
+
Performance/Caller:
|
812
866
|
Description: >-
|
813
|
-
|
814
|
-
numeric comparisons.
|
815
|
-
StyleGuide: '#predicate-methods'
|
816
|
-
# This will change to a new method call which isn't guaranteed to be on the
|
817
|
-
# object. Switching these methods has to be done with knowledge of the types
|
818
|
-
# of the variables which rubocop doesn't have.
|
819
|
-
AutoCorrect: false
|
867
|
+
Use `caller(n..n)` instead of `caller`.
|
820
868
|
Enabled: true
|
821
869
|
|
822
|
-
|
870
|
+
Performance/CaseWhenSplat:
|
823
871
|
Description: >-
|
824
|
-
|
825
|
-
|
826
|
-
StyleGuide: '#ternary-operator'
|
872
|
+
Place `when` conditions that use splat at the end
|
873
|
+
of the list of `when` branches.
|
827
874
|
Enabled: true
|
828
875
|
|
829
|
-
|
876
|
+
Performance/Casecmp:
|
830
877
|
Description: >-
|
831
|
-
|
832
|
-
|
833
|
-
StyleGuide: '#optional-arguments'
|
878
|
+
Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`..
|
879
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
|
834
880
|
Enabled: true
|
835
881
|
|
836
|
-
|
837
|
-
Description: '
|
838
|
-
StyleGuide: '#double-pipe-for-uninit'
|
882
|
+
Performance/CompareWithBlock:
|
883
|
+
Description: 'Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.'
|
839
884
|
Enabled: true
|
840
885
|
|
841
|
-
|
886
|
+
Performance/Count:
|
842
887
|
Description: >-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
888
|
+
Use `count` instead of `select...size`, `reject...size`,
|
889
|
+
`select...count`, `reject...count`, `select...length`,
|
890
|
+
and `reject...length`.
|
891
|
+
# This cop has known compatibility issues with `ActiveRecord` and other
|
892
|
+
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
893
|
+
# For more information, see the documentation in the cop itself.
|
894
|
+
# If you understand the known risk, you can disable `SafeMode`.
|
895
|
+
SafeMode: true
|
847
896
|
Enabled: true
|
848
897
|
|
849
|
-
|
898
|
+
Performance/Detect:
|
850
899
|
Description: >-
|
851
|
-
|
852
|
-
|
853
|
-
|
900
|
+
Use `detect` instead of `select.first`, `find_all.first`,
|
901
|
+
`select.last`, and `find_all.last`.
|
902
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
903
|
+
# This cop has known compatibility issues with `ActiveRecord` and other
|
904
|
+
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
905
|
+
# has its own meaning. Correcting `ActiveRecord` methods with this cop
|
906
|
+
# should be considered unsafe.
|
907
|
+
SafeMode: true
|
854
908
|
Enabled: true
|
855
909
|
|
856
|
-
|
857
|
-
Description:
|
858
|
-
|
910
|
+
Performance/DoubleStartEndWith:
|
911
|
+
Description: >-
|
912
|
+
Use `str.{start,end}_with?(x, ..., y, ...)`
|
913
|
+
instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
859
914
|
Enabled: true
|
860
915
|
|
861
|
-
|
862
|
-
Description: '
|
916
|
+
Performance/EndWith:
|
917
|
+
Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
|
918
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
919
|
+
# This will change to a new method call which isn't guaranteed to be on the
|
920
|
+
# object. Switching these methods has to be done with knowledge of the types
|
921
|
+
# of the variables which rubocop doesn't have.
|
922
|
+
AutoCorrect: false
|
863
923
|
Enabled: true
|
864
924
|
|
865
|
-
|
866
|
-
Description: '
|
867
|
-
StyleGuide: '#no-perl-regexp-last-matchers'
|
925
|
+
Performance/FixedSize:
|
926
|
+
Description: 'Do not compute the size of statically sized objects except in constants'
|
868
927
|
Enabled: true
|
869
928
|
|
870
|
-
|
871
|
-
Description:
|
872
|
-
|
929
|
+
Performance/FlatMap:
|
930
|
+
Description: >-
|
931
|
+
Use `Enumerable#flat_map`
|
932
|
+
instead of `Enumerable#map...Array#flatten(1)`
|
933
|
+
or `Enumberable#collect..Array#flatten(1)`
|
934
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
873
935
|
Enabled: true
|
936
|
+
EnabledForFlattenWithoutParams: false
|
937
|
+
# If enabled, this cop will warn about usages of
|
938
|
+
# `flatten` being called without any parameters.
|
939
|
+
# This can be dangerous since `flat_map` will only flatten 1 level, and
|
940
|
+
# `flatten` without any parameters can flatten multiple levels.
|
874
941
|
|
875
|
-
|
876
|
-
Description:
|
877
|
-
|
942
|
+
Performance/HashEachMethods:
|
943
|
+
Description: >-
|
944
|
+
Use `Hash#each_key` and `Hash#each_value` instead of
|
945
|
+
`Hash#keys.each` and `Hash#values.each`.
|
946
|
+
StyleGuide: '#hash-each'
|
878
947
|
Enabled: true
|
948
|
+
AutoCorrect: false
|
879
949
|
|
880
|
-
|
881
|
-
Description: '
|
882
|
-
StyleGuide: '#exception-class-messages'
|
950
|
+
Performance/LstripRstrip:
|
951
|
+
Description: 'Use `strip` instead of `lstrip.rstrip`.'
|
883
952
|
Enabled: true
|
884
953
|
|
885
|
-
|
886
|
-
Description:
|
887
|
-
|
954
|
+
Performance/RangeInclude:
|
955
|
+
Description: 'Use `Range#cover?` instead of `Range#include?`.'
|
956
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
|
888
957
|
Enabled: true
|
889
958
|
|
890
|
-
|
891
|
-
Description:
|
959
|
+
Performance/RedundantBlockCall:
|
960
|
+
Description: 'Use `yield` instead of `block.call`.'
|
961
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-and-block-arguments-vs-yieldcode'
|
892
962
|
Enabled: true
|
893
963
|
|
894
|
-
|
895
|
-
Description:
|
896
|
-
|
964
|
+
Performance/RedundantMatch:
|
965
|
+
Description: >-
|
966
|
+
Use `=~` instead of `String#match` or `Regexp#match` in a context where the
|
967
|
+
returned `MatchData` is not needed.
|
897
968
|
Enabled: true
|
898
969
|
|
899
|
-
|
900
|
-
Description:
|
970
|
+
Performance/RedundantMerge:
|
971
|
+
Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.'
|
972
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
|
901
973
|
Enabled: true
|
902
974
|
|
903
|
-
|
904
|
-
Description:
|
975
|
+
Performance/RedundantSortBy:
|
976
|
+
Description: 'Use `sort` instead of `sort_by { |x| x }`.'
|
905
977
|
Enabled: true
|
906
978
|
|
907
|
-
|
908
|
-
Description:
|
909
|
-
|
979
|
+
Performance/RegexpMatch:
|
980
|
+
Description: >-
|
981
|
+
Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
|
982
|
+
`Regexp#===`, or `=~` when `MatchData` is not used.
|
910
983
|
Enabled: true
|
911
984
|
|
912
|
-
|
913
|
-
Description:
|
914
|
-
|
985
|
+
Performance/ReverseEach:
|
986
|
+
Description: 'Use `reverse_each` instead of `reverse.each`.'
|
987
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
|
915
988
|
Enabled: true
|
916
989
|
|
917
|
-
|
918
|
-
Description:
|
919
|
-
|
990
|
+
Performance/Sample:
|
991
|
+
Description: >-
|
992
|
+
Use `sample` instead of `shuffle.first`,
|
993
|
+
`shuffle.last`, and `shuffle[Integer]`.
|
994
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
|
920
995
|
Enabled: true
|
921
996
|
|
922
|
-
|
923
|
-
Description:
|
924
|
-
|
997
|
+
Performance/Size:
|
998
|
+
Description: >-
|
999
|
+
Use `size` instead of `count` for counting
|
1000
|
+
the number of elements in `Array` and `Hash`.
|
1001
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraylength-vs-arraysize-vs-arraycount-code'
|
925
1002
|
Enabled: true
|
926
1003
|
|
927
|
-
|
928
|
-
Description:
|
929
|
-
|
930
|
-
|
931
|
-
|
1004
|
+
Performance/StartWith:
|
1005
|
+
Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
|
1006
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
|
1007
|
+
# This will change to a new method call which isn't guaranteed to be on the
|
1008
|
+
# object. Switching these methods has to be done with knowledge of the types
|
1009
|
+
# of the variables which rubocop doesn't have.
|
1010
|
+
AutoCorrect: false
|
932
1011
|
Enabled: true
|
933
1012
|
|
934
|
-
|
1013
|
+
Performance/StringReplacement:
|
935
1014
|
Description: >-
|
936
|
-
|
937
|
-
|
938
|
-
|
1015
|
+
Use `tr` instead of `gsub` when you are replacing the same
|
1016
|
+
number of characters. Use `delete` instead of `gsub` when
|
1017
|
+
you are deleting characters.
|
1018
|
+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
939
1019
|
Enabled: true
|
940
1020
|
|
941
|
-
|
942
|
-
Description:
|
943
|
-
|
1021
|
+
Performance/TimesMap:
|
1022
|
+
Description: 'Checks for .times.map calls.'
|
1023
|
+
AutoCorrect: false
|
944
1024
|
Enabled: true
|
945
1025
|
|
946
|
-
|
947
|
-
Description: '
|
948
|
-
StyleGuide: '#prefer-raise-over-fail'
|
1026
|
+
Performance/UnfreezeString:
|
1027
|
+
Description: 'Use unary plus to get an unfrozen string literal.'
|
949
1028
|
Enabled: true
|
950
1029
|
|
951
|
-
|
952
|
-
Description: '
|
953
|
-
StyleGuide: '#no-single-line-methods'
|
1030
|
+
Performance/UriDefaultParser:
|
1031
|
+
Description: 'Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.'
|
954
1032
|
Enabled: true
|
955
1033
|
|
956
|
-
|
957
|
-
|
958
|
-
|
1034
|
+
#################### Rails #################################
|
1035
|
+
|
1036
|
+
Rails/ActionFilter:
|
1037
|
+
Description: 'Enforces consistent use of action filter methods.'
|
959
1038
|
Enabled: true
|
960
1039
|
|
961
|
-
|
962
|
-
Description:
|
963
|
-
|
1040
|
+
Rails/ActiveSupportAliases:
|
1041
|
+
Description: >-
|
1042
|
+
Avoid ActiveSupport aliases of standard ruby methods:
|
1043
|
+
`String#starts_with?`, `String#ends_with?`,
|
1044
|
+
`Array#append`, `Array#prepend`.
|
964
1045
|
Enabled: true
|
965
1046
|
|
966
|
-
|
967
|
-
Description: '
|
968
|
-
StyleGuide: '#warn'
|
1047
|
+
Rails/ApplicationJob:
|
1048
|
+
Description: 'Check that jobs subclass ApplicationJob.'
|
969
1049
|
Enabled: true
|
970
1050
|
|
971
|
-
|
972
|
-
Description: '
|
973
|
-
StyleGuide: '#consistent-string-literals'
|
1051
|
+
Rails/ApplicationRecord:
|
1052
|
+
Description: 'Check that models subclass ApplicationRecord.'
|
974
1053
|
Enabled: true
|
975
1054
|
|
976
|
-
|
1055
|
+
Rails/Blank:
|
1056
|
+
Description: 'Enforce using `blank?` and `present?`.'
|
1057
|
+
Enabled: true
|
1058
|
+
# Convert checks for `nil` or `empty?` to `blank?`
|
1059
|
+
NilOrEmpty: true
|
1060
|
+
# Convert usages of not `present?` to `blank?`
|
1061
|
+
NotPresent: true
|
1062
|
+
# Convert usages of `unless` `present?` to `if` `blank?`
|
1063
|
+
UnlessPresent: true
|
1064
|
+
|
1065
|
+
Rails/CreateTableWithTimestamps:
|
977
1066
|
Description: >-
|
978
|
-
|
979
|
-
|
1067
|
+
Checks the migration for which timestamps are not included
|
1068
|
+
when creating a new table.
|
980
1069
|
Enabled: true
|
981
1070
|
|
982
|
-
|
983
|
-
Description:
|
984
|
-
|
1071
|
+
Rails/Date:
|
1072
|
+
Description: >-
|
1073
|
+
Checks the correct usage of date aware methods,
|
1074
|
+
such as Date.today, Date.current etc.
|
985
1075
|
Enabled: true
|
986
1076
|
|
987
|
-
|
988
|
-
Description: '
|
989
|
-
StyleGuide: '#percent-i'
|
1077
|
+
Rails/Delegate:
|
1078
|
+
Description: 'Prefer delegate method for delegations.'
|
990
1079
|
Enabled: true
|
991
1080
|
|
992
|
-
|
993
|
-
Description: '
|
1081
|
+
Rails/DelegateAllowBlank:
|
1082
|
+
Description: 'Do not use allow_blank as an option to delegate.'
|
994
1083
|
Enabled: true
|
995
1084
|
|
996
|
-
|
997
|
-
Description: 'Use
|
1085
|
+
Rails/DynamicFindBy:
|
1086
|
+
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
|
1087
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
|
998
1088
|
Enabled: true
|
999
1089
|
|
1000
|
-
|
1001
|
-
Description: '
|
1090
|
+
Rails/EnumUniqueness:
|
1091
|
+
Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
|
1002
1092
|
Enabled: true
|
1003
1093
|
|
1004
|
-
|
1005
|
-
Description:
|
1094
|
+
Rails/EnvironmentComparison:
|
1095
|
+
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
|
1006
1096
|
Enabled: true
|
1007
1097
|
|
1008
|
-
|
1009
|
-
Description:
|
1010
|
-
|
1098
|
+
Rails/Exit:
|
1099
|
+
Description: >-
|
1100
|
+
Favor `fail`, `break`, `return`, etc. over `exit` in
|
1101
|
+
application or library code outside of Rake files to avoid
|
1102
|
+
exits during unit testing or running in production.
|
1011
1103
|
Enabled: true
|
1012
1104
|
|
1013
|
-
|
1014
|
-
Description: '
|
1015
|
-
StyleGuide: '#no-trailing-array-commas'
|
1105
|
+
Rails/FilePath:
|
1106
|
+
Description: 'Use `Rails.root.join` for file path joining.'
|
1016
1107
|
Enabled: true
|
1017
1108
|
|
1018
|
-
|
1019
|
-
Description: 'Prefer
|
1020
|
-
StyleGuide: '#
|
1109
|
+
Rails/FindBy:
|
1110
|
+
Description: 'Prefer find_by over where.first.'
|
1111
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
|
1112
|
+
Enabled: true
|
1113
|
+
|
1114
|
+
Rails/FindEach:
|
1115
|
+
Description: 'Prefer all.find_each over all.find.'
|
1116
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find-each'
|
1117
|
+
Enabled: true
|
1118
|
+
|
1119
|
+
Rails/HasAndBelongsToMany:
|
1120
|
+
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
1121
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
|
1021
1122
|
Enabled: true
|
1022
1123
|
|
1023
|
-
|
1024
|
-
Description:
|
1025
|
-
|
1026
|
-
case first.
|
1027
|
-
StyleGuide: '#no-else-with-unless'
|
1124
|
+
Rails/HasManyOrHasOneDependent:
|
1125
|
+
Description: 'Define the dependent option to the has_many and has_one associations.'
|
1126
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has_many-has_one-dependent-option'
|
1028
1127
|
Enabled: true
|
1029
1128
|
|
1030
|
-
|
1031
|
-
Description: '
|
1129
|
+
Rails/HttpPositionalArguments:
|
1130
|
+
Description: 'Use keyword arguments instead of positional arguments in http method calls.'
|
1032
1131
|
Enabled: true
|
1132
|
+
Include:
|
1133
|
+
- 'spec/**/*'
|
1134
|
+
- 'test/**/*'
|
1033
1135
|
|
1034
|
-
|
1035
|
-
Description: 'Checks for
|
1136
|
+
Rails/InverseOf:
|
1137
|
+
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
1036
1138
|
Enabled: true
|
1037
1139
|
|
1038
|
-
|
1039
|
-
Description:
|
1040
|
-
StyleGuide: '#
|
1140
|
+
Rails/LexicallyScopedActionFilter:
|
1141
|
+
Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
|
1142
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#lexically-scoped-action-filter'
|
1041
1143
|
Enabled: true
|
1042
1144
|
|
1043
|
-
|
1044
|
-
Description:
|
1045
|
-
Checks for the usage of unneeded trailing underscores at the
|
1046
|
-
end of parallel variable assignment.
|
1047
|
-
AllowNamedUnderscoreVariables: true
|
1145
|
+
Rails/NotNullColumn:
|
1146
|
+
Description: 'Do not add a NOT NULL column without a default value'
|
1048
1147
|
Enabled: true
|
1049
1148
|
|
1050
|
-
|
1051
|
-
Description:
|
1052
|
-
Don't interpolate global, instance and class variables
|
1053
|
-
directly in strings.
|
1054
|
-
StyleGuide: '#curlies-interpolate'
|
1149
|
+
Rails/Output:
|
1150
|
+
Description: 'Checks for calls to puts, print, etc.'
|
1055
1151
|
Enabled: true
|
1056
1152
|
|
1057
|
-
|
1058
|
-
Description: '
|
1059
|
-
StyleGuide: '#one-line-cases'
|
1153
|
+
Rails/OutputSafety:
|
1154
|
+
Description: 'The use of `html_safe` or `raw` may be a security risk.'
|
1060
1155
|
Enabled: true
|
1061
1156
|
|
1062
|
-
|
1063
|
-
Description: 'Checks for
|
1064
|
-
StyleGuide: '#no-multiline-while-do'
|
1157
|
+
Rails/PluralizationGrammar:
|
1158
|
+
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
|
1065
1159
|
Enabled: true
|
1066
1160
|
|
1067
|
-
|
1068
|
-
Description:
|
1069
|
-
Favor modifier while/until usage when you have a
|
1070
|
-
single-line body.
|
1071
|
-
StyleGuide: '#while-as-a-modifier'
|
1161
|
+
Rails/Presence:
|
1162
|
+
Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
|
1072
1163
|
Enabled: true
|
1073
1164
|
|
1074
|
-
|
1075
|
-
Description: '
|
1076
|
-
StyleGuide: '#percent-w'
|
1165
|
+
Rails/Present:
|
1166
|
+
Description: 'Enforce using `blank?` and `present?`.'
|
1077
1167
|
Enabled: true
|
1168
|
+
NotNilAndNotEmpty: true
|
1169
|
+
# Convert checks for not `nil` and not `empty?` to `present?`
|
1170
|
+
NotBlank: true
|
1171
|
+
# Convert usages of not `blank?` to `present?`
|
1172
|
+
UnlessBlank: true
|
1173
|
+
# Convert usages of `unless` `blank?` to `if` `present?`
|
1078
1174
|
|
1079
|
-
|
1080
|
-
Description:
|
1081
|
-
|
1175
|
+
Rails/ReadWriteAttribute:
|
1176
|
+
Description: >-
|
1177
|
+
Checks for read_attribute(:attr) and
|
1178
|
+
write_attribute(:attr, val).
|
1179
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#read-attribute'
|
1082
1180
|
Enabled: true
|
1083
1181
|
|
1084
|
-
|
1085
|
-
Description: '
|
1182
|
+
Rails/RedundantReceiverInWithOptions:
|
1183
|
+
Description: 'Checks for redundant receiver in `with_options`.'
|
1086
1184
|
Enabled: true
|
1087
1185
|
|
1088
|
-
|
1186
|
+
Rails/RelativeDateConstant:
|
1187
|
+
Description: 'Do not assign relative date to constants.'
|
1188
|
+
Enabled: true
|
1089
1189
|
|
1090
|
-
|
1091
|
-
Description:
|
1092
|
-
A calculated magnitude based on number of assignments,
|
1093
|
-
branches, and conditions.
|
1094
|
-
Reference: 'http://c2.com/cgi/wiki?AbcMetric'
|
1190
|
+
Rails/RequestReferer:
|
1191
|
+
Description: 'Use consistent syntax for request.referer.'
|
1095
1192
|
Enabled: true
|
1096
1193
|
|
1097
|
-
|
1098
|
-
Description: '
|
1099
|
-
StyleGuide: '
|
1194
|
+
Rails/ReversibleMigration:
|
1195
|
+
Description: 'Checks whether the change method of the migration file is reversible.'
|
1196
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#reversible-migration'
|
1197
|
+
Reference: 'http://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
|
1100
1198
|
Enabled: true
|
1101
1199
|
|
1102
|
-
|
1103
|
-
Description: '
|
1200
|
+
Rails/SafeNavigation:
|
1201
|
+
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
|
1104
1202
|
Enabled: true
|
1105
1203
|
|
1106
|
-
|
1107
|
-
Description: '
|
1204
|
+
Rails/ScopeArgs:
|
1205
|
+
Description: 'Checks the arguments of ActiveRecord scopes.'
|
1108
1206
|
Enabled: true
|
1109
1207
|
|
1110
|
-
|
1208
|
+
Rails/SkipsModelValidations:
|
1111
1209
|
Description: >-
|
1112
|
-
|
1113
|
-
|
1210
|
+
Use methods that skips model validations with caution.
|
1211
|
+
See reference for more information.
|
1212
|
+
Reference: 'http://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
1114
1213
|
Enabled: true
|
1115
1214
|
|
1116
|
-
|
1117
|
-
Description: '
|
1118
|
-
StyleGuide: '
|
1215
|
+
Rails/TimeZone:
|
1216
|
+
Description: 'Checks the correct usage of time zone aware methods.'
|
1217
|
+
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
|
1218
|
+
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
1119
1219
|
Enabled: true
|
1120
1220
|
|
1121
|
-
|
1122
|
-
Description: '
|
1123
|
-
StyleGuide: '#short-methods'
|
1221
|
+
Rails/UniqBeforePluck:
|
1222
|
+
Description: 'Prefer the use of uniq or distinct before pluck.'
|
1124
1223
|
Enabled: true
|
1125
1224
|
|
1126
|
-
|
1127
|
-
Description: '
|
1225
|
+
Rails/UnknownEnv:
|
1226
|
+
Description: 'Use correct environment name.'
|
1128
1227
|
Enabled: true
|
1129
1228
|
|
1130
|
-
|
1131
|
-
Description: '
|
1132
|
-
StyleGuide: '#too-many-params'
|
1229
|
+
Rails/Validation:
|
1230
|
+
Description: 'Use validates :attribute, hash of validations.'
|
1133
1231
|
Enabled: true
|
1134
1232
|
|
1135
|
-
|
1136
|
-
Description: >-
|
1137
|
-
A complexity metric geared towards measuring complexity for a
|
1138
|
-
human reader.
|
1139
|
-
Enabled: true
|
1233
|
+
#################### Security ##############################
|
1140
1234
|
|
1141
|
-
|
1142
|
-
|
1235
|
+
Security/Eval:
|
1236
|
+
Description: 'The use of eval represents a serious security risk.'
|
1237
|
+
Enabled: true
|
1143
1238
|
|
1144
|
-
|
1239
|
+
Security/JSONLoad:
|
1145
1240
|
Description: >-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1241
|
+
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
1242
|
+
security issues. See reference for more information.
|
1243
|
+
Reference: 'http://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
1149
1244
|
Enabled: true
|
1245
|
+
# Autocorrect here will change to a method that may cause crashes depending
|
1246
|
+
# on the value of the argument.
|
1247
|
+
AutoCorrect: false
|
1150
1248
|
|
1151
|
-
|
1249
|
+
Security/MarshalLoad:
|
1152
1250
|
Description: >-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1251
|
+
Avoid using of `Marshal.load` or `Marshal.restore` due to potential
|
1252
|
+
security issues. See reference for more information.
|
1253
|
+
Reference: 'http://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
|
1156
1254
|
Enabled: true
|
1157
1255
|
|
1158
|
-
|
1256
|
+
Security/YAMLLoad:
|
1159
1257
|
Description: >-
|
1160
|
-
|
1161
|
-
|
1258
|
+
Prefer usage of `YAML.safe_load` over `YAML.load` due to potential
|
1259
|
+
security issues. See reference for more information.
|
1260
|
+
Reference: 'https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security'
|
1162
1261
|
Enabled: true
|
1163
1262
|
|
1164
|
-
|
1165
|
-
Description: "Don't use assignment in conditions."
|
1166
|
-
StyleGuide: '#safe-assignment-in-condition'
|
1167
|
-
Enabled: true
|
1263
|
+
#################### Style ###############################
|
1168
1264
|
|
1169
|
-
|
1170
|
-
Description: '
|
1265
|
+
Style/Alias:
|
1266
|
+
Description: 'Use alias instead of alias_method.'
|
1267
|
+
StyleGuide: '#alias-method'
|
1171
1268
|
Enabled: true
|
1172
1269
|
|
1173
|
-
|
1174
|
-
Description: '
|
1270
|
+
Style/AndOr:
|
1271
|
+
Description: 'Use &&/|| instead of and/or.'
|
1272
|
+
StyleGuide: '#no-and-or-or'
|
1175
1273
|
Enabled: true
|
1176
1274
|
|
1177
|
-
|
1178
|
-
Description:
|
1275
|
+
Style/ArrayJoin:
|
1276
|
+
Description: 'Use Array#join instead of Array#*.'
|
1277
|
+
StyleGuide: '#array-join'
|
1179
1278
|
Enabled: true
|
1180
1279
|
|
1181
|
-
|
1182
|
-
Description:
|
1183
|
-
|
1184
|
-
the keyword.
|
1185
|
-
StyleGuide: '#same-line-condition'
|
1280
|
+
Style/AsciiComments:
|
1281
|
+
Description: 'Use only ascii symbols in comments.'
|
1282
|
+
StyleGuide: '#english-comments'
|
1186
1283
|
Enabled: true
|
1187
1284
|
|
1188
|
-
|
1189
|
-
Description: '
|
1285
|
+
Style/Attr:
|
1286
|
+
Description: 'Checks for uses of Module#attr.'
|
1287
|
+
StyleGuide: '#attr'
|
1190
1288
|
Enabled: true
|
1191
1289
|
|
1192
|
-
|
1193
|
-
Description: '
|
1290
|
+
Style/BarePercentLiterals:
|
1291
|
+
Description: 'Checks if usage of %() or %Q() matches configuration.'
|
1292
|
+
StyleGuide: '#percent-q-shorthand'
|
1194
1293
|
Enabled: true
|
1195
1294
|
|
1196
|
-
|
1197
|
-
Description: '
|
1295
|
+
Style/BeginBlock:
|
1296
|
+
Description: 'Avoid the use of BEGIN blocks.'
|
1297
|
+
StyleGuide: '#no-BEGIN-blocks'
|
1198
1298
|
Enabled: true
|
1199
1299
|
|
1200
|
-
|
1201
|
-
Description: 'Do not
|
1300
|
+
Style/BlockComments:
|
1301
|
+
Description: 'Do not use block comments.'
|
1302
|
+
StyleGuide: '#no-block-comments'
|
1202
1303
|
Enabled: true
|
1203
1304
|
|
1204
|
-
|
1205
|
-
Description:
|
1305
|
+
Style/BlockDelimiters:
|
1306
|
+
Description: >-
|
1307
|
+
Avoid using {...} for multi-line blocks (multiline chaining is
|
1308
|
+
always ugly).
|
1309
|
+
Prefer {...} over do...end for single-line blocks.
|
1310
|
+
StyleGuide: '#single-line-blocks'
|
1206
1311
|
Enabled: true
|
1207
1312
|
|
1208
|
-
|
1209
|
-
Description: '
|
1313
|
+
Style/BracesAroundHashParameters:
|
1314
|
+
Description: 'Enforce braces style around hash parameters.'
|
1210
1315
|
Enabled: true
|
1211
1316
|
|
1212
|
-
|
1213
|
-
Description: '
|
1317
|
+
Style/CaseEquality:
|
1318
|
+
Description: 'Avoid explicit use of the case equality operator(===).'
|
1319
|
+
StyleGuide: '#no-case-equality'
|
1214
1320
|
Enabled: true
|
1215
1321
|
|
1216
|
-
|
1217
|
-
Description: '
|
1322
|
+
Style/CharacterLiteral:
|
1323
|
+
Description: 'Checks for uses of character literals.'
|
1324
|
+
StyleGuide: '#no-character-literals'
|
1218
1325
|
Enabled: true
|
1219
1326
|
|
1220
|
-
|
1221
|
-
Description: 'Checks
|
1327
|
+
Style/ClassAndModuleChildren:
|
1328
|
+
Description: 'Checks style of children classes and modules.'
|
1329
|
+
StyleGuide: '#namespace-definition'
|
1222
1330
|
Enabled: true
|
1223
|
-
AutoCorrect: false
|
1224
1331
|
|
1225
|
-
|
1226
|
-
Description: '
|
1332
|
+
Style/ClassCheck:
|
1333
|
+
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
1227
1334
|
Enabled: true
|
1228
1335
|
|
1229
|
-
|
1230
|
-
Description: '
|
1336
|
+
Style/ClassMethods:
|
1337
|
+
Description: 'Use self when defining module/class methods.'
|
1338
|
+
StyleGuide: '#def-self-class-methods'
|
1231
1339
|
Enabled: true
|
1232
1340
|
|
1233
|
-
|
1234
|
-
Description: '
|
1341
|
+
Style/ClassVars:
|
1342
|
+
Description: 'Avoid the use of class variables.'
|
1343
|
+
StyleGuide: '#no-class-vars'
|
1235
1344
|
Enabled: true
|
1236
1345
|
|
1237
|
-
|
1238
|
-
Description: '
|
1346
|
+
Style/ColonMethodCall:
|
1347
|
+
Description: 'Do not use :: for method call.'
|
1348
|
+
StyleGuide: '#double-colons'
|
1239
1349
|
Enabled: true
|
1240
1350
|
|
1241
|
-
|
1242
|
-
Description: '
|
1351
|
+
Style/ColonMethodDefinition:
|
1352
|
+
Description: 'Do not use :: for defining class methods.'
|
1353
|
+
StyleGuide: '#colon-method-definition'
|
1243
1354
|
Enabled: true
|
1244
1355
|
|
1245
|
-
|
1246
|
-
Description: '
|
1247
|
-
StyleGuide: '#
|
1356
|
+
Style/CommandLiteral:
|
1357
|
+
Description: 'Use `` or %x around command literals.'
|
1358
|
+
StyleGuide: '#percent-x'
|
1248
1359
|
Enabled: true
|
1249
1360
|
|
1250
|
-
|
1361
|
+
Style/CommentAnnotation:
|
1251
1362
|
Description: >-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
Lint/FormatParameterMismatch:
|
1257
|
-
Description: 'The number of parameters to format/sprint must match the fields.'
|
1363
|
+
Checks formatting of special comments
|
1364
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
1365
|
+
StyleGuide: '#annotate-keywords'
|
1258
1366
|
Enabled: true
|
1259
1367
|
|
1260
|
-
|
1261
|
-
Description:
|
1262
|
-
StyleGuide: '#dont-hide-exceptions'
|
1368
|
+
Style/CommentedKeyword:
|
1369
|
+
Description: 'Do not place comments on the same line as certain keywords.'
|
1263
1370
|
Enabled: true
|
1264
1371
|
|
1265
|
-
|
1372
|
+
Style/ConditionalAssignment:
|
1266
1373
|
Description: >-
|
1267
|
-
|
1268
|
-
|
1374
|
+
Use the return value of `if` and `case` statements for
|
1375
|
+
assignment to a variable and variable comparison instead
|
1376
|
+
of assigning that variable inside of each branch.
|
1269
1377
|
Enabled: true
|
1270
1378
|
|
1271
|
-
|
1272
|
-
Description:
|
1273
|
-
|
1274
|
-
the visibility of a class method, which does not work.
|
1379
|
+
Style/DateTime:
|
1380
|
+
Description: 'Use Date or Time over DateTime.'
|
1381
|
+
StyleGuide: '#date--time'
|
1275
1382
|
Enabled: true
|
1276
1383
|
|
1277
|
-
|
1278
|
-
Description: '
|
1384
|
+
Style/DefWithParentheses:
|
1385
|
+
Description: 'Use def with parentheses when there are arguments.'
|
1386
|
+
StyleGuide: '#method-parens'
|
1279
1387
|
Enabled: true
|
1280
1388
|
|
1281
|
-
|
1282
|
-
Description:
|
1389
|
+
Style/Dir:
|
1390
|
+
Description: >-
|
1391
|
+
Use the `__dir__` method to retrieve the canonicalized
|
1392
|
+
absolute path to the current file.
|
1283
1393
|
Enabled: true
|
1284
1394
|
|
1285
|
-
|
1286
|
-
Description: '
|
1395
|
+
Style/Documentation:
|
1396
|
+
Description: 'Document classes and non-namespace modules.'
|
1287
1397
|
Enabled: true
|
1398
|
+
Exclude:
|
1399
|
+
- 'spec/**/*'
|
1400
|
+
- 'test/**/*'
|
1288
1401
|
|
1289
|
-
|
1290
|
-
Description: 'Checks for
|
1402
|
+
Style/DoubleNegation:
|
1403
|
+
Description: 'Checks for uses of double negation (!!).'
|
1404
|
+
StyleGuide: '#no-bang-bang'
|
1291
1405
|
Enabled: true
|
1292
1406
|
|
1293
|
-
|
1407
|
+
Style/EachForSimpleLoop:
|
1294
1408
|
Description: >-
|
1295
|
-
Use
|
1296
|
-
|
1297
|
-
StyleGuide: '#loop-with-break'
|
1298
|
-
Enabled: true
|
1299
|
-
|
1300
|
-
Lint/MultipleCompare:
|
1301
|
-
Description: "Use `&&` operator to compare multiple value."
|
1409
|
+
Use `Integer#times` for a simple loop which iterates a fixed
|
1410
|
+
number of times.
|
1302
1411
|
Enabled: true
|
1303
1412
|
|
1304
|
-
|
1305
|
-
Description: '
|
1306
|
-
StyleGuide: '#no-nested-methods'
|
1413
|
+
Style/EachWithObject:
|
1414
|
+
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
1307
1415
|
Enabled: true
|
1308
1416
|
|
1309
|
-
|
1310
|
-
Description:
|
1311
|
-
Do not omit the accumulator when calling `next`
|
1312
|
-
in a `reduce`/`inject` block.
|
1417
|
+
Style/EmptyBlockParameter:
|
1418
|
+
Description: 'Omit pipes for empty block parameters.'
|
1313
1419
|
Enabled: true
|
1314
1420
|
|
1315
|
-
|
1316
|
-
Description: '
|
1421
|
+
Style/EmptyCaseCondition:
|
1422
|
+
Description: 'Avoid empty condition in case statements.'
|
1317
1423
|
Enabled: true
|
1318
1424
|
|
1319
|
-
|
1320
|
-
Description:
|
1321
|
-
Checks for method calls with a space before the opening
|
1322
|
-
parenthesis.
|
1323
|
-
StyleGuide: '#parens-no-spaces'
|
1425
|
+
Style/EmptyElse:
|
1426
|
+
Description: 'Avoid empty else-clauses.'
|
1324
1427
|
Enabled: true
|
1325
1428
|
|
1326
|
-
|
1327
|
-
Description:
|
1328
|
-
Checks for unwanted commas and quotes in %w/%W literals.
|
1429
|
+
Style/EmptyLambdaParameter:
|
1430
|
+
Description: 'Omit parens for empty lambda parameters.'
|
1329
1431
|
Enabled: true
|
1330
1432
|
|
1331
|
-
|
1332
|
-
Description:
|
1333
|
-
|
1433
|
+
Style/EmptyLiteral:
|
1434
|
+
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
1435
|
+
StyleGuide: '#literal-array-hash'
|
1334
1436
|
Enabled: true
|
1335
1437
|
|
1336
|
-
|
1337
|
-
Description:
|
1338
|
-
|
1339
|
-
and most likely a mistake.
|
1438
|
+
Style/EmptyMethod:
|
1439
|
+
Description: 'Checks the formatting of empty method definitions.'
|
1440
|
+
StyleGuide: '#no-single-line-methods'
|
1340
1441
|
Enabled: true
|
1341
1442
|
|
1342
|
-
|
1343
|
-
Description: '
|
1443
|
+
Style/Encoding:
|
1444
|
+
Description: 'Use UTF-8 as the source file encoding.'
|
1445
|
+
StyleGuide: '#utf-8'
|
1344
1446
|
Enabled: true
|
1345
1447
|
|
1346
|
-
|
1347
|
-
Description: '
|
1448
|
+
Style/EndBlock:
|
1449
|
+
Description: 'Avoid the use of END blocks.'
|
1450
|
+
StyleGuide: '#no-END-blocks'
|
1348
1451
|
Enabled: true
|
1349
1452
|
|
1350
|
-
|
1351
|
-
Description:
|
1352
|
-
Do not use regexp literal as a condition.
|
1353
|
-
The regexp literal matches `$_` implicitly.
|
1453
|
+
Style/EvalWithLocation:
|
1454
|
+
Description: 'Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.'
|
1354
1455
|
Enabled: true
|
1355
1456
|
|
1356
|
-
|
1357
|
-
Description:
|
1358
|
-
|
1359
|
-
about precedence.
|
1457
|
+
Style/EvenOdd:
|
1458
|
+
Description: 'Favor the use of Integer#even? && Integer#odd?'
|
1459
|
+
StyleGuide: '#predicate-methods'
|
1360
1460
|
Enabled: true
|
1361
1461
|
|
1362
|
-
|
1363
|
-
Description: '
|
1364
|
-
StyleGuide: '#
|
1462
|
+
Style/ExtendSelf:
|
1463
|
+
Description: 'Checks for uses of extend self.'
|
1464
|
+
StyleGuide: '#module-function'
|
1365
1465
|
Enabled: true
|
1466
|
+
# Using `module_function` results in private visibility scope when the
|
1467
|
+
# module is included, so auto-correction is unsafe.
|
1468
|
+
Autocorrect: false
|
1366
1469
|
|
1367
|
-
|
1368
|
-
Description: '
|
1470
|
+
Style/FlipFlop:
|
1471
|
+
Description: 'Checks for flip flops'
|
1472
|
+
StyleGuide: '#no-flip-flops'
|
1369
1473
|
Enabled: true
|
1370
1474
|
|
1371
|
-
|
1372
|
-
Description: '
|
1373
|
-
StyleGuide: '#no-
|
1475
|
+
Style/For:
|
1476
|
+
Description: 'Checks use of for or each in multiline loops.'
|
1477
|
+
StyleGuide: '#no-for-loops'
|
1374
1478
|
Enabled: true
|
1375
1479
|
|
1376
|
-
|
1377
|
-
Description: '
|
1480
|
+
Style/FormatString:
|
1481
|
+
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
1482
|
+
StyleGuide: '#sprintf'
|
1378
1483
|
Enabled: true
|
1379
1484
|
|
1380
|
-
|
1381
|
-
Description: '
|
1485
|
+
Style/FormatStringToken:
|
1486
|
+
Description: 'Use a consistent style for format string tokens.'
|
1382
1487
|
Enabled: true
|
1383
1488
|
|
1384
|
-
|
1489
|
+
Style/FrozenStringLiteralComment:
|
1385
1490
|
Description: >-
|
1386
|
-
|
1387
|
-
|
1491
|
+
Add the frozen_string_literal comment to the top of files
|
1492
|
+
to help transition from Ruby 2.3.0 to Ruby 3.0.
|
1388
1493
|
Enabled: true
|
1389
1494
|
|
1390
|
-
|
1391
|
-
Description:
|
1392
|
-
|
1393
|
-
|
1495
|
+
Style/GlobalVars:
|
1496
|
+
Description: 'Do not introduce global variables.'
|
1497
|
+
StyleGuide: '#instance-vars'
|
1498
|
+
Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
|
1394
1499
|
Enabled: true
|
1395
1500
|
|
1396
|
-
|
1397
|
-
Description: '
|
1398
|
-
StyleGuide: '#no-
|
1501
|
+
Style/GuardClause:
|
1502
|
+
Description: 'Check for conditionals that can be replaced with guard clauses'
|
1503
|
+
StyleGuide: '#no-nested-conditionals'
|
1399
1504
|
Enabled: true
|
1400
1505
|
|
1401
|
-
|
1402
|
-
Description:
|
1506
|
+
Style/HashSyntax:
|
1507
|
+
Description: >-
|
1508
|
+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
1509
|
+
{ :a => 1, :b => 2 }.
|
1510
|
+
StyleGuide: '#hash-literals'
|
1403
1511
|
Enabled: true
|
1404
1512
|
|
1405
|
-
|
1406
|
-
Description:
|
1513
|
+
Style/IdenticalConditionalBranches:
|
1514
|
+
Description: >-
|
1515
|
+
Checks that conditional statements do not have an identical
|
1516
|
+
line at the end of each branch, which can validly be moved
|
1517
|
+
out of the conditional.
|
1407
1518
|
Enabled: true
|
1408
1519
|
|
1409
|
-
|
1410
|
-
Description: '
|
1520
|
+
Style/IfInsideElse:
|
1521
|
+
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
1411
1522
|
Enabled: true
|
1412
1523
|
|
1413
|
-
|
1524
|
+
Style/IfUnlessModifier:
|
1414
1525
|
Description: >-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1526
|
+
Favor modifier if/unless usage when you have a
|
1527
|
+
single-line body.
|
1528
|
+
StyleGuide: '#if-as-a-modifier'
|
1418
1529
|
Enabled: true
|
1419
1530
|
|
1420
|
-
|
1421
|
-
Description:
|
1531
|
+
Style/IfUnlessModifierOfIfUnless:
|
1532
|
+
Description: >-
|
1533
|
+
Avoid modifier if/unless usage on conditionals.
|
1422
1534
|
Enabled: true
|
1423
1535
|
|
1424
|
-
|
1425
|
-
Description: '
|
1536
|
+
Style/IfWithSemicolon:
|
1537
|
+
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
1538
|
+
StyleGuide: '#no-semicolon-ifs'
|
1426
1539
|
Enabled: true
|
1427
1540
|
|
1428
|
-
|
1429
|
-
Description: '
|
1430
|
-
StyleGuide: '#
|
1541
|
+
Style/InfiniteLoop:
|
1542
|
+
Description: 'Use Kernel#loop for infinite loops.'
|
1543
|
+
StyleGuide: '#infinite-loop'
|
1431
1544
|
Enabled: true
|
1432
1545
|
|
1433
|
-
|
1434
|
-
Description:
|
1435
|
-
|
1546
|
+
Style/InverseMethods:
|
1547
|
+
Description: >-
|
1548
|
+
Use the inverse method instead of `!.method`
|
1549
|
+
if an inverse method is defined.
|
1436
1550
|
Enabled: true
|
1437
1551
|
|
1438
|
-
|
1439
|
-
Description: '
|
1552
|
+
Style/Lambda:
|
1553
|
+
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
1554
|
+
StyleGuide: '#lambda-multi-line'
|
1440
1555
|
Enabled: true
|
1441
1556
|
|
1442
|
-
|
1443
|
-
Description:
|
1444
|
-
|
1445
|
-
`CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component`
|
1446
|
-
depending on your specific use case.
|
1447
|
-
Also `URI.unescape` method is obsolete and should not be used. Instead, use
|
1448
|
-
`CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
|
1449
|
-
depending on your specific use case.
|
1557
|
+
Style/LambdaCall:
|
1558
|
+
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
1559
|
+
StyleGuide: '#proc-call'
|
1450
1560
|
Enabled: true
|
1451
1561
|
|
1452
|
-
|
1453
|
-
Description:
|
1562
|
+
Style/LineEndConcatenation:
|
1563
|
+
Description: >-
|
1564
|
+
Use \ instead of + or << to concatenate two string literals at
|
1565
|
+
line end.
|
1454
1566
|
Enabled: true
|
1455
1567
|
|
1456
|
-
|
1457
|
-
Description: '
|
1568
|
+
Style/MethodCallWithoutArgsParentheses:
|
1569
|
+
Description: 'Do not use parentheses for method calls with no arguments.'
|
1570
|
+
StyleGuide: '#method-invocation-parens'
|
1458
1571
|
Enabled: true
|
1459
|
-
ContextCreatingMethods: []
|
1460
|
-
MethodCreatingMethods: []
|
1461
1572
|
|
1462
|
-
|
1463
|
-
Description:
|
1464
|
-
|
1573
|
+
Style/MethodDefParentheses:
|
1574
|
+
Description: >-
|
1575
|
+
Checks if the method definitions have or don't have
|
1576
|
+
parentheses.
|
1577
|
+
StyleGuide: '#method-parens'
|
1465
1578
|
Enabled: true
|
1466
1579
|
|
1467
|
-
|
1468
|
-
Description: '
|
1580
|
+
Style/MethodMissing:
|
1581
|
+
Description: 'Avoid using `method_missing`.'
|
1582
|
+
StyleGuide: '#no-method-missing'
|
1469
1583
|
Enabled: true
|
1470
1584
|
|
1471
|
-
|
1472
|
-
Description:
|
1585
|
+
Style/MinMax:
|
1586
|
+
Description: >-
|
1587
|
+
Use `Enumerable#minmax` instead of `Enumerable#min`
|
1588
|
+
and `Enumerable#max` in conjunction.'
|
1473
1589
|
Enabled: true
|
1474
1590
|
|
1475
|
-
|
1476
|
-
Description: 'Checks for
|
1591
|
+
Style/MixinGrouping:
|
1592
|
+
Description: 'Checks for grouping of mixins in `class` and `module` bodies.'
|
1593
|
+
StyleGuide: '#mixin-grouping'
|
1477
1594
|
Enabled: true
|
1478
1595
|
|
1479
|
-
|
1480
|
-
Description: 'Checks
|
1596
|
+
Style/MixinUsage:
|
1597
|
+
Description: 'Checks that `include`, `extend` and `prepend` exists at the top level.'
|
1481
1598
|
Enabled: true
|
1482
1599
|
|
1483
|
-
|
1484
|
-
Description: '
|
1600
|
+
Style/ModuleFunction:
|
1601
|
+
Description: 'Checks for usage of `extend self` in modules.'
|
1602
|
+
StyleGuide: '#module-function'
|
1485
1603
|
Enabled: true
|
1486
1604
|
|
1487
|
-
|
1605
|
+
Style/MultilineBlockChain:
|
1606
|
+
Description: 'Avoid multi-line chains of blocks.'
|
1607
|
+
StyleGuide: '#single-line-blocks'
|
1608
|
+
Enabled: true
|
1488
1609
|
|
1489
|
-
|
1490
|
-
Description:
|
1491
|
-
|
1610
|
+
Style/MultilineIfModifier:
|
1611
|
+
Description: 'Only use if/unless modifiers on single line statements.'
|
1612
|
+
StyleGuide: '#no-multiline-if-modifiers'
|
1492
1613
|
Enabled: true
|
1493
1614
|
|
1494
|
-
|
1495
|
-
Description:
|
1496
|
-
|
1497
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
|
1615
|
+
Style/MultilineIfThen:
|
1616
|
+
Description: 'Do not use then for multi-line if/unless.'
|
1617
|
+
StyleGuide: '#no-then'
|
1498
1618
|
Enabled: true
|
1499
1619
|
|
1500
|
-
|
1501
|
-
Description:
|
1502
|
-
Place `when` conditions that use splat at the end
|
1503
|
-
of the list of `when` branches.
|
1620
|
+
Style/MultilineMemoization:
|
1621
|
+
Description: 'Wrap multiline memoizations in a `begin` and `end` block.'
|
1504
1622
|
Enabled: true
|
1505
1623
|
|
1506
|
-
|
1624
|
+
Style/MultilineTernaryOperator:
|
1507
1625
|
Description: >-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
1512
|
-
# frameworks. ActiveRecord's `count` ignores the block that is passed to it.
|
1513
|
-
# For more information, see the documentation in the cop itself.
|
1514
|
-
# If you understand the known risk, you can disable `SafeMode`.
|
1515
|
-
SafeMode: true
|
1626
|
+
Avoid multi-line ?: (the ternary operator);
|
1627
|
+
use if/unless instead.
|
1628
|
+
StyleGuide: '#no-multiline-ternary'
|
1516
1629
|
Enabled: true
|
1517
1630
|
|
1518
|
-
|
1631
|
+
Style/MultipleComparison:
|
1519
1632
|
Description: >-
|
1520
|
-
|
1521
|
-
|
1522
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
|
1523
|
-
# This cop has known compatibility issues with `ActiveRecord` and other
|
1524
|
-
# frameworks. `ActiveRecord` does not implement a `detect` method and `find`
|
1525
|
-
# has its own meaning. Correcting `ActiveRecord` methods with this cop
|
1526
|
-
# should be considered unsafe.
|
1527
|
-
SafeMode: true
|
1633
|
+
Avoid comparing a variable with multiple items in a conditional,
|
1634
|
+
use Array#include? instead.
|
1528
1635
|
Enabled: true
|
1529
1636
|
|
1530
|
-
|
1531
|
-
Description:
|
1532
|
-
Use `str.{start,end}_with?(x, ..., y, ...)`
|
1533
|
-
instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
|
1637
|
+
Style/MutableConstant:
|
1638
|
+
Description: 'Do not assign mutable objects to constants.'
|
1534
1639
|
Enabled: true
|
1535
1640
|
|
1536
|
-
|
1537
|
-
Description:
|
1538
|
-
|
1539
|
-
|
1540
|
-
#
|
1541
|
-
# of the variables which rubocop doesn't have.
|
1542
|
-
AutoCorrect: false
|
1641
|
+
Style/NegatedIf:
|
1642
|
+
Description: >-
|
1643
|
+
Favor unless over if for negative conditions
|
1644
|
+
(or control flow or).
|
1645
|
+
StyleGuide: '#unless-for-negatives'
|
1543
1646
|
Enabled: true
|
1544
1647
|
|
1545
|
-
|
1546
|
-
Description: '
|
1648
|
+
Style/NegatedWhile:
|
1649
|
+
Description: 'Favor until over while for negative conditions.'
|
1650
|
+
StyleGuide: '#until-for-negatives'
|
1547
1651
|
Enabled: true
|
1548
1652
|
|
1549
|
-
|
1550
|
-
Description:
|
1551
|
-
|
1552
|
-
instead of `Enumerable#map...Array#flatten(1)`
|
1553
|
-
or `Enumberable#collect..Array#flatten(1)`
|
1554
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
|
1653
|
+
Style/NestedModifier:
|
1654
|
+
Description: 'Avoid using nested modifiers.'
|
1655
|
+
StyleGuide: '#no-nested-modifiers'
|
1555
1656
|
Enabled: true
|
1556
|
-
EnabledForFlattenWithoutParams: false
|
1557
|
-
# If enabled, this cop will warn about usages of
|
1558
|
-
# `flatten` being called without any parameters.
|
1559
|
-
# This can be dangerous since `flat_map` will only flatten 1 level, and
|
1560
|
-
# `flatten` without any parameters can flatten multiple levels.
|
1561
1657
|
|
1562
|
-
|
1658
|
+
Style/NestedParenthesizedCalls:
|
1563
1659
|
Description: >-
|
1564
|
-
|
1565
|
-
|
1566
|
-
StyleGuide: '#hash-each'
|
1660
|
+
Parenthesize method calls which are nested inside the
|
1661
|
+
argument list of another parenthesized method call.
|
1567
1662
|
Enabled: true
|
1568
|
-
AutoCorrect: false
|
1569
1663
|
|
1570
|
-
|
1571
|
-
Description: 'Use
|
1664
|
+
Style/NestedTernaryOperator:
|
1665
|
+
Description: 'Use one expression per branch in a ternary operator.'
|
1666
|
+
StyleGuide: '#no-nested-ternary'
|
1572
1667
|
Enabled: true
|
1573
1668
|
|
1574
|
-
|
1575
|
-
Description: 'Use `
|
1576
|
-
|
1669
|
+
Style/Next:
|
1670
|
+
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
1671
|
+
StyleGuide: '#no-nested-conditionals'
|
1577
1672
|
Enabled: true
|
1578
1673
|
|
1579
|
-
|
1580
|
-
Description: '
|
1581
|
-
|
1674
|
+
Style/NilComparison:
|
1675
|
+
Description: 'Prefer x.nil? to x == nil.'
|
1676
|
+
StyleGuide: '#predicate-methods'
|
1582
1677
|
Enabled: true
|
1583
1678
|
|
1584
|
-
|
1585
|
-
Description:
|
1586
|
-
|
1587
|
-
returned `MatchData` is not needed.
|
1679
|
+
Style/NonNilCheck:
|
1680
|
+
Description: 'Checks for redundant nil checks.'
|
1681
|
+
StyleGuide: '#no-non-nil-checks'
|
1588
1682
|
Enabled: true
|
1589
1683
|
|
1590
|
-
|
1591
|
-
Description: 'Use
|
1592
|
-
|
1684
|
+
Style/Not:
|
1685
|
+
Description: 'Use ! instead of not.'
|
1686
|
+
StyleGuide: '#bang-not-not'
|
1593
1687
|
Enabled: true
|
1594
1688
|
|
1595
|
-
|
1596
|
-
Description: 'Use
|
1689
|
+
Style/NumericLiteralPrefix:
|
1690
|
+
Description: 'Use smallcase prefixes for numeric literals.'
|
1691
|
+
StyleGuide: '#numeric-literal-prefixes'
|
1597
1692
|
Enabled: true
|
1598
1693
|
|
1599
|
-
|
1694
|
+
Style/NumericLiterals:
|
1600
1695
|
Description: >-
|
1601
|
-
|
1602
|
-
|
1696
|
+
Add underscores to large numeric literals to improve their
|
1697
|
+
readability.
|
1698
|
+
StyleGuide: '#underscores-in-numerics'
|
1603
1699
|
Enabled: true
|
1604
1700
|
|
1605
|
-
|
1606
|
-
Description:
|
1607
|
-
|
1701
|
+
Style/NumericPredicate:
|
1702
|
+
Description: >-
|
1703
|
+
Checks for the use of predicate- or comparison methods for
|
1704
|
+
numeric comparisons.
|
1705
|
+
StyleGuide: '#predicate-methods'
|
1706
|
+
# This will change to a new method call which isn't guaranteed to be on the
|
1707
|
+
# object. Switching these methods has to be done with knowledge of the types
|
1708
|
+
# of the variables which rubocop doesn't have.
|
1709
|
+
AutoCorrect: false
|
1608
1710
|
Enabled: true
|
1609
1711
|
|
1610
|
-
|
1712
|
+
Style/OneLineConditional:
|
1611
1713
|
Description: >-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1714
|
+
Favor the ternary operator(?:) over
|
1715
|
+
if/then/else/end constructs.
|
1716
|
+
StyleGuide: '#ternary-operator'
|
1615
1717
|
Enabled: true
|
1616
1718
|
|
1617
|
-
|
1719
|
+
Style/OptionalArguments:
|
1618
1720
|
Description: >-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1721
|
+
Checks for optional arguments that do not appear at the end
|
1722
|
+
of the argument list
|
1723
|
+
StyleGuide: '#optional-arguments'
|
1622
1724
|
Enabled: true
|
1623
1725
|
|
1624
|
-
|
1625
|
-
Description: '
|
1726
|
+
Style/OrAssignment:
|
1727
|
+
Description: 'Recommend usage of double pipe equals (||=) where applicable.'
|
1728
|
+
StyleGuide: '#double-pipe-for-uninit'
|
1626
1729
|
Enabled: true
|
1627
1730
|
|
1628
|
-
|
1629
|
-
Description:
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
AutoCorrect: false
|
1731
|
+
Style/ParallelAssignment:
|
1732
|
+
Description: >-
|
1733
|
+
Check for simple usages of parallel assignment.
|
1734
|
+
It will only warn when the number of variables
|
1735
|
+
matches on both sides of the assignment.
|
1736
|
+
StyleGuide: '#parallel-assignment'
|
1635
1737
|
Enabled: true
|
1636
1738
|
|
1637
|
-
|
1739
|
+
Style/ParenthesesAroundCondition:
|
1638
1740
|
Description: >-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
|
1741
|
+
Don't use parentheses around the condition of an
|
1742
|
+
if/unless/while.
|
1743
|
+
StyleGuide: '#no-parens-around-condition'
|
1643
1744
|
Enabled: true
|
1644
1745
|
|
1645
|
-
|
1646
|
-
Description: '
|
1647
|
-
|
1746
|
+
Style/PercentLiteralDelimiters:
|
1747
|
+
Description: 'Use `%`-literal delimiters consistently'
|
1748
|
+
StyleGuide: '#percent-literal-braces'
|
1648
1749
|
Enabled: true
|
1649
1750
|
|
1650
|
-
|
1651
|
-
Description: '
|
1751
|
+
Style/PercentQLiterals:
|
1752
|
+
Description: 'Checks if uses of %Q/%q match the configured preference.'
|
1652
1753
|
Enabled: true
|
1653
1754
|
|
1654
|
-
|
1655
|
-
Description: '
|
1755
|
+
Style/PerlBackrefs:
|
1756
|
+
Description: 'Avoid Perl-style regex back references.'
|
1757
|
+
StyleGuide: '#no-perl-regexp-last-matchers'
|
1656
1758
|
Enabled: true
|
1657
1759
|
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
Description: 'Enforces consistent use of action filter methods.'
|
1760
|
+
Style/PreferredHashMethods:
|
1761
|
+
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
1762
|
+
StyleGuide: '#hash-key'
|
1662
1763
|
Enabled: true
|
1663
1764
|
|
1664
|
-
|
1665
|
-
Description: '
|
1765
|
+
Style/Proc:
|
1766
|
+
Description: 'Use proc instead of Proc.new.'
|
1767
|
+
StyleGuide: '#proc'
|
1666
1768
|
Enabled: true
|
1667
1769
|
|
1668
|
-
|
1669
|
-
Description: '
|
1770
|
+
Style/RaiseArgs:
|
1771
|
+
Description: 'Checks the arguments passed to raise/fail.'
|
1772
|
+
StyleGuide: '#exception-class-messages'
|
1670
1773
|
Enabled: true
|
1671
1774
|
|
1672
|
-
|
1775
|
+
Style/RandomWithOffset:
|
1673
1776
|
Description: >-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1777
|
+
Prefer to use ranges when generating random numbers instead of
|
1778
|
+
integers with offsets.
|
1779
|
+
StyleGuide: '#random-numbers'
|
1780
|
+
Enabled: true
|
1781
|
+
|
1782
|
+
Style/RedundantBegin:
|
1783
|
+
Description: "Don't use begin blocks when they are not needed."
|
1784
|
+
StyleGuide: '#begin-implicit'
|
1677
1785
|
Enabled: true
|
1678
1786
|
|
1679
|
-
|
1680
|
-
Description: '
|
1787
|
+
Style/RedundantConditional:
|
1788
|
+
Description: "Don't return true/false from a conditional."
|
1681
1789
|
Enabled: true
|
1682
|
-
# Convert checks for `nil` or `empty?` to `blank?`
|
1683
|
-
NilOrEmpty: true
|
1684
|
-
# Convert usages of not `present?` to `blank?`
|
1685
|
-
NotPresent: true
|
1686
|
-
# Convert usages of `unless` `present?` to `if` `blank?`
|
1687
|
-
UnlessPresent: true
|
1688
1790
|
|
1689
|
-
|
1690
|
-
Description:
|
1691
|
-
|
1692
|
-
such as Date.today, Date.current etc.
|
1791
|
+
Style/RedundantException:
|
1792
|
+
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
1793
|
+
StyleGuide: '#no-explicit-runtimeerror'
|
1693
1794
|
Enabled: true
|
1694
1795
|
|
1695
|
-
|
1696
|
-
Description:
|
1796
|
+
Style/RedundantFreeze:
|
1797
|
+
Description: "Checks usages of Object#freeze on immutable objects."
|
1697
1798
|
Enabled: true
|
1698
1799
|
|
1699
|
-
|
1700
|
-
Description:
|
1800
|
+
Style/RedundantParentheses:
|
1801
|
+
Description: "Checks for parentheses that seem not to serve any purpose."
|
1701
1802
|
Enabled: true
|
1702
1803
|
|
1703
|
-
|
1704
|
-
Description: '
|
1705
|
-
StyleGuide: '
|
1804
|
+
Style/RedundantReturn:
|
1805
|
+
Description: "Don't use return where it's not required."
|
1806
|
+
StyleGuide: '#no-explicit-return'
|
1706
1807
|
Enabled: true
|
1707
1808
|
|
1708
|
-
|
1709
|
-
Description: '
|
1809
|
+
Style/RedundantSelf:
|
1810
|
+
Description: "Don't use self where it's not needed."
|
1811
|
+
StyleGuide: '#no-self-unless-required'
|
1710
1812
|
Enabled: true
|
1711
1813
|
|
1712
|
-
|
1713
|
-
Description:
|
1714
|
-
|
1715
|
-
application or library code outside of Rake files to avoid
|
1716
|
-
exits during unit testing or running in production.
|
1814
|
+
Style/RegexpLiteral:
|
1815
|
+
Description: 'Use / or %r around regular expressions.'
|
1816
|
+
StyleGuide: '#percent-r'
|
1717
1817
|
Enabled: true
|
1718
1818
|
|
1719
|
-
|
1720
|
-
Description: '
|
1819
|
+
Style/RescueModifier:
|
1820
|
+
Description: 'Avoid using rescue in its modifier form.'
|
1821
|
+
StyleGuide: '#no-rescue-modifiers'
|
1721
1822
|
Enabled: true
|
1722
1823
|
|
1723
|
-
|
1724
|
-
Description: '
|
1725
|
-
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
|
1824
|
+
Style/RescueStandardError:
|
1825
|
+
Description: 'Avoid rescuing without specifying an error class.'
|
1726
1826
|
Enabled: true
|
1727
1827
|
|
1728
|
-
|
1729
|
-
Description:
|
1730
|
-
|
1828
|
+
Style/SafeNavigation:
|
1829
|
+
Description: >-
|
1830
|
+
This cop transforms usages of a method call safeguarded by
|
1831
|
+
a check for the existence of the object to
|
1832
|
+
safe navigation (`&.`).
|
1731
1833
|
Enabled: true
|
1732
1834
|
|
1733
|
-
|
1734
|
-
Description:
|
1735
|
-
|
1835
|
+
Style/SelfAssignment:
|
1836
|
+
Description: >-
|
1837
|
+
Checks for places where self-assignment shorthand should have
|
1838
|
+
been used.
|
1839
|
+
StyleGuide: '#self-assignment'
|
1736
1840
|
Enabled: true
|
1737
1841
|
|
1738
|
-
|
1739
|
-
Description: '
|
1740
|
-
StyleGuide: '
|
1842
|
+
Style/Semicolon:
|
1843
|
+
Description: "Don't use semicolons to terminate expressions."
|
1844
|
+
StyleGuide: '#no-semicolon'
|
1741
1845
|
Enabled: true
|
1742
1846
|
|
1743
|
-
|
1744
|
-
Description: '
|
1847
|
+
Style/SignalException:
|
1848
|
+
Description: 'Checks for proper usage of fail and raise.'
|
1849
|
+
StyleGuide: '#prefer-raise-over-fail'
|
1745
1850
|
Enabled: true
|
1746
|
-
Include:
|
1747
|
-
- 'spec/**/*'
|
1748
|
-
- 'test/**/*'
|
1749
1851
|
|
1750
|
-
|
1751
|
-
Description: '
|
1852
|
+
Style/SingleLineMethods:
|
1853
|
+
Description: 'Avoid single-line methods.'
|
1854
|
+
StyleGuide: '#no-single-line-methods'
|
1752
1855
|
Enabled: true
|
1753
1856
|
|
1754
|
-
|
1755
|
-
Description: '
|
1857
|
+
Style/SpecialGlobalVars:
|
1858
|
+
Description: 'Avoid Perl-style global variables.'
|
1859
|
+
StyleGuide: '#no-cryptic-perlisms'
|
1756
1860
|
Enabled: true
|
1757
1861
|
|
1758
|
-
|
1759
|
-
Description: '
|
1862
|
+
Style/StabbyLambdaParentheses:
|
1863
|
+
Description: 'Check for the usage of parentheses around stabby lambda arguments.'
|
1864
|
+
StyleGuide: '#stabby-lambda-with-args'
|
1760
1865
|
Enabled: true
|
1761
1866
|
|
1762
|
-
|
1763
|
-
Description: '
|
1867
|
+
Style/StderrPuts:
|
1868
|
+
Description: 'Use `warn` instead of `$stderr.puts`.'
|
1869
|
+
StyleGuide: '#warn'
|
1764
1870
|
Enabled: true
|
1765
1871
|
|
1766
|
-
|
1767
|
-
Description: '
|
1872
|
+
Style/StringLiterals:
|
1873
|
+
Description: 'Checks if uses of quotes match the configured preference.'
|
1874
|
+
StyleGuide: '#consistent-string-literals'
|
1768
1875
|
Enabled: true
|
1769
|
-
NotNilAndNotEmpty: true
|
1770
|
-
# Convert checks for not `nil` and not `empty?` to `present?`
|
1771
|
-
NotBlank: true
|
1772
|
-
# Convert usages of not `blank?` to `present?`
|
1773
|
-
UnlessBlank: true
|
1774
|
-
# Convert usages of `unless` `blank?` to `if` `present?`
|
1775
1876
|
|
1776
|
-
|
1877
|
+
Style/StringLiteralsInInterpolation:
|
1777
1878
|
Description: >-
|
1778
|
-
Checks
|
1779
|
-
|
1780
|
-
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#read-attribute'
|
1879
|
+
Checks if uses of quotes inside expressions in interpolated
|
1880
|
+
strings match the configured preference.
|
1781
1881
|
Enabled: true
|
1782
1882
|
|
1783
|
-
|
1784
|
-
Description: '
|
1883
|
+
Style/StructInheritance:
|
1884
|
+
Description: 'Checks for inheritance from Struct.new.'
|
1885
|
+
StyleGuide: '#no-extend-struct-new'
|
1785
1886
|
Enabled: true
|
1786
1887
|
|
1787
|
-
|
1788
|
-
Description: 'Use
|
1888
|
+
Style/SymbolArray:
|
1889
|
+
Description: 'Use %i or %I for arrays of symbols.'
|
1890
|
+
StyleGuide: '#percent-i'
|
1789
1891
|
Enabled: true
|
1790
1892
|
|
1791
|
-
|
1792
|
-
Description: '
|
1793
|
-
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#reversible-migration'
|
1794
|
-
Reference: 'http://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
|
1893
|
+
Style/SymbolLiteral:
|
1894
|
+
Description: 'Use plain symbols instead of string symbols when possible.'
|
1795
1895
|
Enabled: true
|
1796
1896
|
|
1797
|
-
|
1798
|
-
Description:
|
1897
|
+
Style/SymbolProc:
|
1898
|
+
Description: 'Use symbols as procs instead of blocks when possible.'
|
1799
1899
|
Enabled: true
|
1800
1900
|
|
1801
|
-
|
1802
|
-
Description: 'Checks
|
1901
|
+
Style/TernaryParentheses:
|
1902
|
+
Description: 'Checks for use of parentheses around ternary conditions.'
|
1803
1903
|
Enabled: true
|
1804
1904
|
|
1805
|
-
|
1806
|
-
Description: '
|
1807
|
-
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
|
1808
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
1905
|
+
Style/TrailingBodyOnMethodDefinition:
|
1906
|
+
Description: 'Method body goes below definition.'
|
1809
1907
|
Enabled: true
|
1810
1908
|
|
1811
|
-
|
1812
|
-
Description: '
|
1909
|
+
Style/TrailingCommaInArguments:
|
1910
|
+
Description: 'Checks for trailing comma in argument lists.'
|
1911
|
+
StyleGuide: '#no-trailing-params-comma'
|
1813
1912
|
Enabled: true
|
1814
1913
|
|
1815
|
-
|
1816
|
-
Description: '
|
1914
|
+
Style/TrailingCommaInLiteral:
|
1915
|
+
Description: 'Checks for trailing comma in array and hash literals.'
|
1916
|
+
StyleGuide: '#no-trailing-array-commas'
|
1817
1917
|
Enabled: true
|
1818
1918
|
|
1819
|
-
|
1919
|
+
Style/TrailingMethodEndStatement:
|
1920
|
+
Description: 'Checks for trailing end statement on line of method body.'
|
1921
|
+
Enabled: true
|
1922
|
+
|
1923
|
+
Style/TrailingUnderscoreVariable:
|
1820
1924
|
Description: >-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1925
|
+
Checks for the usage of unneeded trailing underscores at the
|
1926
|
+
end of parallel variable assignment.
|
1927
|
+
AllowNamedUnderscoreVariables: true
|
1824
1928
|
Enabled: true
|
1825
1929
|
|
1826
|
-
|
1827
|
-
Description: '
|
1930
|
+
Style/TrivialAccessors:
|
1931
|
+
Description: 'Prefer attr_* methods to trivial readers/writers.'
|
1932
|
+
StyleGuide: '#attr_family'
|
1828
1933
|
Enabled: true
|
1829
1934
|
|
1830
|
-
|
1935
|
+
Style/UnlessElse:
|
1936
|
+
Description: >-
|
1937
|
+
Do not use unless with else. Rewrite these with the positive
|
1938
|
+
case first.
|
1939
|
+
StyleGuide: '#no-else-with-unless'
|
1940
|
+
Enabled: true
|
1831
1941
|
|
1832
|
-
|
1833
|
-
Description: '
|
1942
|
+
Style/UnneededCapitalW:
|
1943
|
+
Description: 'Checks for %W when interpolation is not needed.'
|
1834
1944
|
Enabled: true
|
1835
1945
|
|
1836
|
-
|
1837
|
-
Description:
|
1838
|
-
Prefer usage of `JSON.parse` over `JSON.load` due to potential
|
1839
|
-
security issues. See reference for more information.
|
1840
|
-
Reference: 'http://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load'
|
1946
|
+
Style/UnneededInterpolation:
|
1947
|
+
Description: 'Checks for strings that are just an interpolated expression.'
|
1841
1948
|
Enabled: true
|
1842
|
-
# Autocorrect here will change to a method that may cause crashes depending
|
1843
|
-
# on the value of the argument.
|
1844
|
-
AutoCorrect: false
|
1845
1949
|
|
1846
|
-
|
1847
|
-
Description:
|
1848
|
-
|
1849
|
-
security issues. See reference for more information.
|
1850
|
-
Reference: 'http://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations'
|
1950
|
+
Style/UnneededPercentQ:
|
1951
|
+
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
1952
|
+
StyleGuide: '#percent-q'
|
1851
1953
|
Enabled: true
|
1852
1954
|
|
1853
|
-
|
1955
|
+
Style/VariableInterpolation:
|
1854
1956
|
Description: >-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1957
|
+
Don't interpolate global, instance and class variables
|
1958
|
+
directly in strings.
|
1959
|
+
StyleGuide: '#curlies-interpolate'
|
1858
1960
|
Enabled: true
|
1859
1961
|
|
1860
|
-
|
1962
|
+
Style/WhenThen:
|
1963
|
+
Description: 'Use when x then ... for one-line cases.'
|
1964
|
+
StyleGuide: '#one-line-cases'
|
1965
|
+
Enabled: true
|
1861
1966
|
|
1862
|
-
|
1863
|
-
Description: 'Checks for
|
1967
|
+
Style/WhileUntilDo:
|
1968
|
+
Description: 'Checks for redundant do after while or until.'
|
1969
|
+
StyleGuide: '#no-multiline-while-do'
|
1864
1970
|
Enabled: true
|
1865
|
-
Include:
|
1866
|
-
- '**/Gemfile'
|
1867
|
-
- '**/gems.rb'
|
1868
1971
|
|
1869
|
-
|
1972
|
+
Style/WhileUntilModifier:
|
1870
1973
|
Description: >-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1974
|
+
Favor modifier while/until usage when you have a
|
1975
|
+
single-line body.
|
1976
|
+
StyleGuide: '#while-as-a-modifier'
|
1874
1977
|
Enabled: true
|
1875
|
-
Include:
|
1876
|
-
- '**/Gemfile'
|
1877
|
-
- '**/gems.rb'
|
1878
1978
|
|
1879
|
-
|
1880
|
-
Description:
|
1881
|
-
|
1979
|
+
Style/WordArray:
|
1980
|
+
Description: 'Use %w or %W for arrays of words.'
|
1981
|
+
StyleGuide: '#percent-w'
|
1882
1982
|
Enabled: true
|
1883
|
-
Include:
|
1884
|
-
- '**/Gemfile'
|
1885
|
-
- '**/gems.rb'
|
1886
1983
|
|
1887
|
-
|
1888
|
-
Description:
|
1889
|
-
|
1984
|
+
Style/YodaCondition:
|
1985
|
+
Description: 'Do not use literals as the first operand of a comparison.'
|
1986
|
+
Reference: 'https://en.wikipedia.org/wiki/Yoda_conditions'
|
1987
|
+
Enabled: true
|
1988
|
+
|
1989
|
+
Style/ZeroLengthPredicate:
|
1990
|
+
Description: 'Use #empty? when testing for objects of length 0.'
|
1890
1991
|
Enabled: true
|
1891
|
-
Include:
|
1892
|
-
- '**/*.gemspec'
|