rubocop 0.71.0 → 0.75.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -8
- data/bin/console +1 -0
- data/config/default.yml +84 -488
- data/lib/rubocop.rb +16 -54
- data/lib/rubocop/ast/builder.rb +2 -0
- data/lib/rubocop/ast/node.rb +9 -15
- data/lib/rubocop/ast/node/float_node.rb +12 -0
- data/lib/rubocop/ast/node/int_node.rb +12 -0
- data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +4 -4
- data/lib/rubocop/ast/node/mixin/numeric_node.rb +21 -0
- data/lib/rubocop/ast/node/resbody_node.rb +1 -6
- data/lib/rubocop/ast/traversal.rb +3 -3
- data/lib/rubocop/cached_data.rb +1 -1
- data/lib/rubocop/comment_config.rb +3 -2
- data/lib/rubocop/config.rb +21 -508
- data/lib/rubocop/config_loader.rb +22 -8
- data/lib/rubocop/config_loader_resolver.rb +2 -16
- data/lib/rubocop/config_obsoletion.rb +213 -0
- data/lib/rubocop/config_validator.rb +239 -0
- data/lib/rubocop/cop/autocorrect_logic.rb +71 -1
- data/lib/rubocop/cop/bundler/insecure_protocol_source.rb +1 -1
- data/lib/rubocop/cop/bundler/ordered_gems.rb +1 -1
- data/lib/rubocop/cop/commissioner.rb +3 -9
- data/lib/rubocop/cop/cop.rb +39 -12
- data/lib/rubocop/cop/corrector.rb +2 -3
- data/lib/rubocop/cop/correctors/alignment_corrector.rb +43 -17
- data/lib/rubocop/cop/correctors/empty_line_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/percent_literal_corrector.rb +1 -1
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +2 -2
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
- data/lib/rubocop/cop/gemspec/required_ruby_version.rb +1 -1
- data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +55 -0
- data/lib/rubocop/cop/generator.rb +4 -4
- data/lib/rubocop/cop/generator/configuration_injector.rb +9 -4
- data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_destructuring.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/node_type_predicate.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/offense_location_keyword.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +2 -2
- data/lib/rubocop/cop/internal_affairs/useless_message_assertion.rb +2 -2
- data/lib/rubocop/cop/layout/block_alignment.rb +3 -3
- data/lib/rubocop/cop/layout/class_structure.rb +2 -2
- data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/empty_line_after_guard_clause.rb +22 -7
- data/lib/rubocop/cop/layout/empty_line_after_magic_comment.rb +2 -2
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +2 -2
- data/lib/rubocop/cop/layout/extra_spacing.rb +14 -59
- data/lib/rubocop/cop/layout/indent_assignment.rb +10 -1
- data/lib/rubocop/cop/layout/indent_first_argument.rb +7 -3
- data/lib/rubocop/cop/layout/indent_first_parameter.rb +7 -3
- data/lib/rubocop/cop/layout/indent_heredoc.rb +4 -4
- data/lib/rubocop/cop/layout/indentation_consistency.rb +13 -12
- data/lib/rubocop/cop/layout/indentation_width.rb +28 -10
- data/lib/rubocop/cop/layout/leading_comment_space.rb +28 -0
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +24 -2
- data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +18 -4
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +5 -1
- data/lib/rubocop/cop/layout/space_around_operators.rb +42 -23
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +21 -2
- data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +24 -40
- data/lib/rubocop/cop/layout/tab.rb +10 -22
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +17 -4
- data/lib/rubocop/cop/lint/big_decimal_new.rb +1 -1
- data/lib/rubocop/cop/lint/debugger.rb +4 -6
- data/lib/rubocop/cop/lint/duplicate_methods.rb +3 -3
- data/lib/rubocop/cop/lint/each_with_object_argument.rb +1 -1
- data/lib/rubocop/cop/lint/empty_interpolation.rb +4 -4
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +57 -1
- data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +11 -37
- data/lib/rubocop/cop/lint/ineffective_access_modifier.rb +1 -1
- data/lib/rubocop/cop/lint/inherit_exception.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +7 -8
- data/lib/rubocop/cop/lint/multiple_compare.rb +1 -1
- data/lib/rubocop/cop/lint/nested_method_definition.rb +3 -3
- data/lib/rubocop/cop/lint/next_without_accumulator.rb +1 -1
- data/lib/rubocop/cop/lint/non_local_exit_from_iterator.rb +1 -1
- data/lib/rubocop/cop/lint/number_conversion.rb +4 -4
- data/lib/rubocop/cop/lint/rand_one.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_with_index.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_with_object.rb +1 -1
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +5 -5
- data/lib/rubocop/cop/lint/safe_navigation_with_empty.rb +1 -1
- data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +91 -0
- data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +6 -6
- data/lib/rubocop/cop/lint/unified_integer.rb +1 -1
- data/lib/rubocop/cop/lint/unneeded_cop_disable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/unneeded_require_statement.rb +1 -1
- data/lib/rubocop/cop/lint/unneeded_splat_expansion.rb +7 -2
- data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
- data/lib/rubocop/cop/lint/unused_block_argument.rb +22 -6
- data/lib/rubocop/cop/lint/unused_method_argument.rb +23 -5
- data/lib/rubocop/cop/lint/uri_escape_unescape.rb +1 -1
- data/lib/rubocop/cop/lint/uri_regexp.rb +2 -2
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +6 -6
- data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
- data/lib/rubocop/cop/lint/void.rb +3 -22
- data/lib/rubocop/cop/message_annotator.rb +16 -7
- data/lib/rubocop/cop/metrics/class_length.rb +1 -1
- data/lib/rubocop/cop/metrics/line_length.rb +6 -0
- data/lib/rubocop/cop/metrics/module_length.rb +1 -1
- data/lib/rubocop/cop/metrics/parameter_lists.rb +1 -1
- data/lib/rubocop/cop/migration/department_name.rb +44 -0
- data/lib/rubocop/cop/mixin/alignment.rb +1 -1
- data/lib/rubocop/cop/mixin/def_node.rb +1 -1
- data/lib/rubocop/cop/mixin/documentation_comment.rb +0 -2
- data/lib/rubocop/cop/mixin/empty_parameter.rb +1 -1
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +4 -4
- data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -1
- data/lib/rubocop/cop/mixin/interpolation.rb +27 -0
- data/lib/rubocop/cop/mixin/method_complexity.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_expression_indentation.rb +3 -3
- data/lib/rubocop/cop/mixin/preceding_following_alignment.rb +87 -0
- data/lib/rubocop/cop/mixin/safe_mode.rb +2 -0
- data/lib/rubocop/cop/mixin/surrounding_space.rb +7 -5
- data/lib/rubocop/cop/naming/binary_operator_parameter_name.rb +1 -1
- data/lib/rubocop/cop/naming/constant_name.rb +2 -2
- data/lib/rubocop/cop/naming/method_name.rb +12 -1
- data/lib/rubocop/cop/naming/predicate_name.rb +1 -1
- data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +21 -20
- data/lib/rubocop/cop/naming/variable_name.rb +1 -0
- data/lib/rubocop/cop/offense.rb +18 -7
- data/lib/rubocop/cop/registry.rb +22 -1
- data/lib/rubocop/cop/security/eval.rb +1 -1
- data/lib/rubocop/cop/security/json_load.rb +1 -1
- data/lib/rubocop/cop/security/marshal_load.rb +1 -1
- data/lib/rubocop/cop/security/open.rb +1 -1
- data/lib/rubocop/cop/security/yaml_load.rb +1 -1
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +1 -0
- data/lib/rubocop/cop/style/alias.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +2 -1
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +29 -10
- data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
- data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
- data/lib/rubocop/cop/style/commented_keyword.rb +16 -30
- data/lib/rubocop/cop/style/conditional_assignment.rb +8 -9
- data/lib/rubocop/cop/style/constant_visibility.rb +14 -3
- data/lib/rubocop/cop/style/date_time.rb +3 -3
- data/lib/rubocop/cop/style/dir.rb +1 -1
- data/lib/rubocop/cop/style/documentation_method.rb +45 -1
- data/lib/rubocop/cop/style/double_cop_disable_directive.rb +55 -0
- data/lib/rubocop/cop/style/each_for_simple_loop.rb +1 -1
- data/lib/rubocop/cop/style/each_with_object.rb +1 -1
- data/lib/rubocop/cop/style/eval_with_location.rb +2 -2
- data/lib/rubocop/cop/style/even_odd.rb +1 -1
- data/lib/rubocop/cop/style/expand_path_arguments.rb +4 -4
- data/lib/rubocop/cop/style/float_division.rb +94 -0
- data/lib/rubocop/cop/style/format_string.rb +13 -9
- data/lib/rubocop/cop/style/format_string_token.rb +18 -69
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +18 -33
- data/lib/rubocop/cop/style/guard_clause.rb +39 -10
- data/lib/rubocop/cop/style/hash_syntax.rb +2 -2
- data/lib/rubocop/cop/style/if_inside_else.rb +42 -0
- data/lib/rubocop/cop/style/if_unless_modifier.rb +51 -15
- data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
- data/lib/rubocop/cop/style/inverse_methods.rb +2 -2
- data/lib/rubocop/cop/style/lambda.rb +0 -2
- data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +32 -26
- data/lib/rubocop/cop/style/min_max.rb +1 -1
- data/lib/rubocop/cop/style/mixin_usage.rb +12 -2
- data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
- data/lib/rubocop/cop/style/multiline_when_then.rb +55 -0
- data/lib/rubocop/cop/style/multiple_comparison.rb +1 -1
- data/lib/rubocop/cop/style/mutable_constant.rb +3 -3
- data/lib/rubocop/cop/style/nested_modifier.rb +18 -2
- data/lib/rubocop/cop/style/numeric_predicate.rb +3 -3
- data/lib/rubocop/cop/style/option_hash.rb +1 -1
- data/lib/rubocop/cop/style/or_assignment.rb +8 -3
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +15 -1
- data/lib/rubocop/cop/style/random_with_offset.rb +6 -6
- data/lib/rubocop/cop/style/redundant_conditional.rb +2 -2
- data/lib/rubocop/cop/style/redundant_exception.rb +2 -2
- data/lib/rubocop/cop/style/redundant_freeze.rb +1 -1
- data/lib/rubocop/cop/style/redundant_parentheses.rb +15 -6
- data/lib/rubocop/cop/style/redundant_return.rb +12 -0
- data/lib/rubocop/cop/style/redundant_self.rb +18 -1
- data/lib/rubocop/cop/style/redundant_sort_by.rb +1 -1
- data/lib/rubocop/cop/style/rescue_modifier.rb +24 -0
- data/lib/rubocop/cop/style/rescue_standard_error.rb +2 -2
- data/lib/rubocop/cop/style/return_nil.rb +1 -1
- data/lib/rubocop/cop/style/safe_navigation.rb +19 -2
- data/lib/rubocop/cop/style/sample.rb +1 -1
- data/lib/rubocop/cop/style/semicolon.rb +11 -0
- data/lib/rubocop/cop/style/single_line_methods.rb +8 -1
- data/lib/rubocop/cop/style/stderr_puts.rb +1 -1
- data/lib/rubocop/cop/style/string_hash_keys.rb +2 -2
- data/lib/rubocop/cop/style/strip.rb +1 -1
- data/lib/rubocop/cop/style/struct_inheritance.rb +3 -3
- data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
- data/lib/rubocop/cop/style/ternary_parentheses.rb +32 -3
- data/lib/rubocop/cop/style/trailing_method_end_statement.rb +4 -6
- data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
- data/lib/rubocop/cop/style/unneeded_sort.rb +1 -1
- data/lib/rubocop/cop/style/unpack_first.rb +1 -1
- data/lib/rubocop/cop/style/variable_interpolation.rb +6 -16
- data/lib/rubocop/cop/style/word_array.rb +2 -2
- data/lib/rubocop/cop/style/zero_length_predicate.rb +6 -6
- data/lib/rubocop/cop/team.rb +15 -14
- data/lib/rubocop/cop/utils/format_string.rb +128 -0
- data/lib/rubocop/cop/variable_force/variable.rb +15 -2
- data/lib/rubocop/core_ext/string.rb +0 -24
- data/lib/rubocop/error.rb +23 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +8 -3
- data/lib/rubocop/formatter/emacs_style_formatter.rb +22 -9
- data/lib/rubocop/formatter/file_list_formatter.rb +1 -1
- data/lib/rubocop/formatter/formatter_set.rb +16 -15
- data/lib/rubocop/formatter/pacman_formatter.rb +80 -0
- data/lib/rubocop/formatter/simple_text_formatter.rb +16 -4
- data/lib/rubocop/formatter/tap_formatter.rb +17 -4
- data/lib/rubocop/magic_comment.rb +4 -0
- data/lib/rubocop/node_pattern.rb +2 -2
- data/lib/rubocop/options.rb +21 -17
- data/lib/rubocop/path_util.rb +1 -1
- data/lib/rubocop/processed_source.rb +6 -1
- data/lib/rubocop/rspec/cop_helper.rb +0 -1
- data/lib/rubocop/rspec/expect_offense.rb +4 -1
- data/lib/rubocop/rspec/shared_contexts.rb +12 -17
- data/lib/rubocop/rspec/support.rb +0 -1
- data/lib/rubocop/runner.rb +14 -25
- data/lib/rubocop/target_finder.rb +6 -4
- data/lib/rubocop/version.rb +1 -1
- data/lib/rubocop/yaml_duplication_checker.rb +8 -2
- metadata +17 -92
- data/lib/rubocop/cop/mixin/ignored_method_patterns.rb +0 -19
- data/lib/rubocop/cop/mixin/target_rails_version.rb +0 -16
- data/lib/rubocop/cop/rails/action_filter.rb +0 -117
- data/lib/rubocop/cop/rails/active_record_aliases.rb +0 -48
- data/lib/rubocop/cop/rails/active_record_override.rb +0 -82
- data/lib/rubocop/cop/rails/active_support_aliases.rb +0 -69
- data/lib/rubocop/cop/rails/application_job.rb +0 -40
- data/lib/rubocop/cop/rails/application_record.rb +0 -40
- data/lib/rubocop/cop/rails/assert_not.rb +0 -44
- data/lib/rubocop/cop/rails/belongs_to.rb +0 -102
- data/lib/rubocop/cop/rails/blank.rb +0 -164
- data/lib/rubocop/cop/rails/bulk_change_table.rb +0 -289
- data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +0 -91
- data/lib/rubocop/cop/rails/date.rb +0 -161
- data/lib/rubocop/cop/rails/delegate.rb +0 -132
- data/lib/rubocop/cop/rails/delegate_allow_blank.rb +0 -37
- data/lib/rubocop/cop/rails/dynamic_find_by.rb +0 -91
- data/lib/rubocop/cop/rails/enum_uniqueness.rb +0 -45
- data/lib/rubocop/cop/rails/environment_comparison.rb +0 -68
- data/lib/rubocop/cop/rails/exit.rb +0 -67
- data/lib/rubocop/cop/rails/file_path.rb +0 -108
- data/lib/rubocop/cop/rails/find_by.rb +0 -55
- data/lib/rubocop/cop/rails/find_each.rb +0 -51
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +0 -25
- data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +0 -106
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +0 -117
- data/lib/rubocop/cop/rails/http_status.rb +0 -179
- data/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +0 -94
- data/lib/rubocop/cop/rails/inverse_of.rb +0 -246
- data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +0 -175
- data/lib/rubocop/cop/rails/link_to_blank.rb +0 -98
- data/lib/rubocop/cop/rails/not_null_column.rb +0 -67
- data/lib/rubocop/cop/rails/output.rb +0 -49
- data/lib/rubocop/cop/rails/output_safety.rb +0 -99
- data/lib/rubocop/cop/rails/pluralization_grammar.rb +0 -107
- data/lib/rubocop/cop/rails/presence.rb +0 -124
- data/lib/rubocop/cop/rails/present.rb +0 -153
- data/lib/rubocop/cop/rails/read_write_attribute.rb +0 -74
- data/lib/rubocop/cop/rails/redundant_allow_nil.rb +0 -111
- data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +0 -136
- data/lib/rubocop/cop/rails/reflection_class_name.rb +0 -37
- data/lib/rubocop/cop/rails/refute_methods.rb +0 -76
- data/lib/rubocop/cop/rails/relative_date_constant.rb +0 -93
- data/lib/rubocop/cop/rails/request_referer.rb +0 -56
- data/lib/rubocop/cop/rails/reversible_migration.rb +0 -286
- data/lib/rubocop/cop/rails/safe_navigation.rb +0 -87
- data/lib/rubocop/cop/rails/save_bang.rb +0 -316
- data/lib/rubocop/cop/rails/scope_args.rb +0 -29
- data/lib/rubocop/cop/rails/skips_model_validations.rb +0 -87
- data/lib/rubocop/cop/rails/time_zone.rb +0 -238
- data/lib/rubocop/cop/rails/uniq_before_pluck.rb +0 -105
- data/lib/rubocop/cop/rails/unknown_env.rb +0 -63
- data/lib/rubocop/cop/rails/validation.rb +0 -109
- data/lib/rubocop/rspec/shared_examples.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 354a14aa737b4743d04d65393e8caae409513d2302b31aca36090441100f1bdb
|
4
|
+
data.tar.gz: 7bdbb625ae97e5e0f1a5ca6bfe0d93c71ac4a86a566ba13b987a293949486e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf54a562c567c28f118f5bf6bf0a9fb9e5987351559a001f80de025cb08793cd546731e80d3690dcce3ce8e0eda96381563ae307a5b0df303322c75331b8f14b
|
7
|
+
data.tar.gz: 76fb85901be4d90de0697874bf0bea52c2a23e2b39fa9607ec797d6768465c4f903bc2645ebf41a504f526064aee2e0000f7bbd2701735787425770682b79ec8
|
data/README.md
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
[](https://www.patreon.com/bbatsov)
|
10
10
|
[](#open-collective-backers)
|
11
11
|
[](#open-collective-sponsors)
|
12
|
+
[](https://tidelift.com/subscription/pkg/rubygems-rubocop?utm_source=rubygems-rubocop&utm_medium=referral&utm_campaign=readme)
|
12
13
|
|
13
14
|
<p align="center">
|
14
15
|
<img src="https://raw.githubusercontent.com/rubocop-hq/rubocop/master/logo/rubo-logo-horizontal.png" alt="RuboCop Logo"/>
|
@@ -20,7 +21,7 @@
|
|
20
21
|
**RuboCop** is a Ruby static code analyzer and code formatter. Out of
|
21
22
|
the box it will enforce many of the guidelines outlined in the
|
22
23
|
community [Ruby Style
|
23
|
-
Guide](https://
|
24
|
+
Guide](https://rubystyle.guide).
|
24
25
|
|
25
26
|
RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various
|
26
27
|
[configuration options](https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml).
|
@@ -52,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
|
|
52
53
|
might want to use a conservative version lock in your `Gemfile`:
|
53
54
|
|
54
55
|
```rb
|
55
|
-
gem 'rubocop', '~> 0.
|
56
|
+
gem 'rubocop', '~> 0.75.1', require: false
|
56
57
|
```
|
57
58
|
|
58
59
|
## Quickstart
|
@@ -64,9 +65,9 @@ $ cd my/cool/ruby/project
|
|
64
65
|
$ rubocop
|
65
66
|
```
|
66
67
|
|
67
|
-
##
|
68
|
+
## Documentation
|
68
69
|
|
69
|
-
You can read a
|
70
|
+
You can read a lot more about RuboCop in its [official docs](https://docs.rubocop.org).
|
70
71
|
|
71
72
|
## Compatibility
|
72
73
|
|
@@ -75,10 +76,6 @@ RuboCop supports the following Ruby implementations:
|
|
75
76
|
* MRI 2.3+
|
76
77
|
* JRuby 9.1+
|
77
78
|
|
78
|
-
The Rails cops support the following versions:
|
79
|
-
|
80
|
-
* Rails 4.0+
|
81
|
-
|
82
79
|
## Team
|
83
80
|
|
84
81
|
Here's a list of RuboCop's core developers:
|
data/bin/console
CHANGED
data/config/default.yml
CHANGED
@@ -73,7 +73,7 @@ AllCops:
|
|
73
73
|
DisplayStyleGuide: false
|
74
74
|
# When specifying style guide URLs, any paths and/or fragments will be
|
75
75
|
# evaluated relative to the base URL.
|
76
|
-
StyleGuideBaseURL: https://
|
76
|
+
StyleGuideBaseURL: https://rubystyle.guide
|
77
77
|
# Extra details are not displayed in offense messages by default. Change
|
78
78
|
# behavior by overriding ExtraDetails, or by giving the
|
79
79
|
# `-E/--extra-details` option.
|
@@ -125,14 +125,6 @@ AllCops:
|
|
125
125
|
# from the lock file.) If the Ruby version is still unresolved, RuboCop will
|
126
126
|
# use the oldest officially supported Ruby version (currently Ruby 2.3).
|
127
127
|
TargetRubyVersion: ~
|
128
|
-
# What version of Rails is the inspected code using? If a value is specified
|
129
|
-
# for TargetRailsVersion then it is used. Acceptable values are specificed
|
130
|
-
# as a float (i.e. 5.1); the patch version of Rails should not be included.
|
131
|
-
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
|
132
|
-
# gems.locked file to find the version of Rails that has been bound to the
|
133
|
-
# application. If neither of those files exist, RuboCop will use Rails 5.0
|
134
|
-
# as the default.
|
135
|
-
TargetRailsVersion: ~
|
136
128
|
|
137
129
|
#################### Bundler ###############################
|
138
130
|
|
@@ -203,6 +195,13 @@ Gemspec/RequiredRubyVersion:
|
|
203
195
|
VersionAdded: '0.52'
|
204
196
|
Include:
|
205
197
|
- '**/*.gemspec'
|
198
|
+
-
|
199
|
+
Gemspec/RubyVersionGlobalsUsage:
|
200
|
+
Description: Checks usage of RUBY_VERSION in gemspec.
|
201
|
+
Enabled: true
|
202
|
+
VersionAdded: '0.72'
|
203
|
+
Include:
|
204
|
+
- '**/*.gemspec'
|
206
205
|
|
207
206
|
#################### Layout ###########################
|
208
207
|
|
@@ -778,8 +777,8 @@ Layout/IndentationConsistency:
|
|
778
777
|
StyleGuide: '#spaces-indentation'
|
779
778
|
Enabled: true
|
780
779
|
VersionAdded: '0.49'
|
781
|
-
# The difference between `
|
782
|
-
# prescribes that in classes and modules the `protected` and `private`
|
780
|
+
# The difference between `indented` and `normal` is that the `indented_internal_methods`
|
781
|
+
# style prescribes that in classes and modules the `protected` and `private`
|
783
782
|
# modifier keywords shall be indented the same as public methods and that
|
784
783
|
# protected and private members shall be indented one step more than the
|
785
784
|
# modifiers. Other than that, both styles mean that entities on the same
|
@@ -787,9 +786,9 @@ Layout/IndentationConsistency:
|
|
787
786
|
EnforcedStyle: normal
|
788
787
|
SupportedStyles:
|
789
788
|
- normal
|
790
|
-
-
|
789
|
+
- indented_internal_methods
|
791
790
|
Reference:
|
792
|
-
# A reference to `EnforcedStyle:
|
791
|
+
# A reference to `EnforcedStyle: indented_internal_methods`.
|
793
792
|
- https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions
|
794
793
|
|
795
794
|
Layout/IndentationWidth:
|
@@ -817,6 +816,8 @@ Layout/LeadingCommentSpace:
|
|
817
816
|
StyleGuide: '#hash-space'
|
818
817
|
Enabled: true
|
819
818
|
VersionAdded: '0.49'
|
819
|
+
VersionChanged: '0.73'
|
820
|
+
AllowDoxygenCommentStyle: false
|
820
821
|
|
821
822
|
Layout/MultilineArrayBraceLayout:
|
822
823
|
Description: >-
|
@@ -1349,7 +1350,7 @@ Lint/ErbNewArguments:
|
|
1349
1350
|
VersionAdded: '0.56'
|
1350
1351
|
|
1351
1352
|
Lint/FlipFlop:
|
1352
|
-
Description: 'Checks for flip-flops'
|
1353
|
+
Description: 'Checks for flip-flops.'
|
1353
1354
|
StyleGuide: '#no-flip-flops'
|
1354
1355
|
Enabled: true
|
1355
1356
|
VersionAdded: '0.16'
|
@@ -1407,7 +1408,7 @@ Lint/InheritException:
|
|
1407
1408
|
- standard_error
|
1408
1409
|
|
1409
1410
|
Lint/InterpolationCheck:
|
1410
|
-
Description: 'Raise warning for interpolation in single q strs'
|
1411
|
+
Description: 'Raise warning for interpolation in single q strs.'
|
1411
1412
|
Enabled: true
|
1412
1413
|
VersionAdded: '0.50'
|
1413
1414
|
|
@@ -1431,7 +1432,7 @@ Lint/Loop:
|
|
1431
1432
|
VersionAdded: '0.9'
|
1432
1433
|
|
1433
1434
|
Lint/MissingCopEnableDirective:
|
1434
|
-
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable
|
1435
|
+
Description: 'Checks for a `# rubocop:enable` after `# rubocop:disable`.'
|
1435
1436
|
Enabled: true
|
1436
1437
|
VersionAdded: '0.52'
|
1437
1438
|
# Maximum number of consecutive lines the cop can be disabled for.
|
@@ -1590,6 +1591,11 @@ Lint/ScriptPermission:
|
|
1590
1591
|
VersionAdded: '0.49'
|
1591
1592
|
VersionChanged: '0.50'
|
1592
1593
|
|
1594
|
+
Lint/SendWithMixinArgument:
|
1595
|
+
Description: 'Checks for `send` method when using mixin.'
|
1596
|
+
Enabled: true
|
1597
|
+
VersionAdded: '0.75'
|
1598
|
+
|
1593
1599
|
Lint/ShadowedArgument:
|
1594
1600
|
Description: 'Avoid reassigning arguments before they were used.'
|
1595
1601
|
Enabled: true
|
@@ -1619,7 +1625,7 @@ Lint/StringConversionInInterpolation:
|
|
1619
1625
|
VersionChanged: '0.20'
|
1620
1626
|
|
1621
1627
|
Lint/Syntax:
|
1622
|
-
Description: 'Checks syntax error'
|
1628
|
+
Description: 'Checks syntax error.'
|
1623
1629
|
Enabled: true
|
1624
1630
|
VersionAdded: '0.9'
|
1625
1631
|
|
@@ -1635,7 +1641,7 @@ Lint/UnderscorePrefixedVariableName:
|
|
1635
1641
|
AllowKeywordBlockArguments: false
|
1636
1642
|
|
1637
1643
|
Lint/UnifiedInteger:
|
1638
|
-
Description: 'Use Integer instead of Fixnum or Bignum'
|
1644
|
+
Description: 'Use Integer instead of Fixnum or Bignum.'
|
1639
1645
|
Enabled: true
|
1640
1646
|
VersionAdded: '0.43'
|
1641
1647
|
|
@@ -1658,9 +1664,10 @@ Lint/UnneededRequireStatement:
|
|
1658
1664
|
VersionAdded: '0.51'
|
1659
1665
|
|
1660
1666
|
Lint/UnneededSplatExpansion:
|
1661
|
-
Description: 'Checks for splat unnecessarily being called on literals'
|
1667
|
+
Description: 'Checks for splat unnecessarily being called on literals.'
|
1662
1668
|
Enabled: true
|
1663
1669
|
VersionAdded: '0.43'
|
1670
|
+
VersionChanged: '0.74'
|
1664
1671
|
|
1665
1672
|
Lint/UnreachableCode:
|
1666
1673
|
Description: 'Unreachable code.'
|
@@ -1744,7 +1751,7 @@ Metrics/AbcSize:
|
|
1744
1751
|
branches, and conditions.
|
1745
1752
|
Reference:
|
1746
1753
|
- http://c2.com/cgi/wiki?AbcMetric
|
1747
|
-
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
1754
|
+
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
1748
1755
|
Enabled: true
|
1749
1756
|
VersionAdded: '0.27'
|
1750
1757
|
VersionChanged: '0.66'
|
@@ -1767,7 +1774,7 @@ Metrics/BlockLength:
|
|
1767
1774
|
- '**/*.gemspec'
|
1768
1775
|
|
1769
1776
|
Metrics/BlockNesting:
|
1770
|
-
Description: 'Avoid excessive block nesting'
|
1777
|
+
Description: 'Avoid excessive block nesting.'
|
1771
1778
|
StyleGuide: '#three-is-the-number-thou-shalt-count'
|
1772
1779
|
Enabled: true
|
1773
1780
|
VersionAdded: '0.25'
|
@@ -1808,7 +1815,7 @@ Metrics/LineLength:
|
|
1808
1815
|
- https
|
1809
1816
|
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
|
1810
1817
|
# directives like '# rubocop: enable ...' when calculating a line's length.
|
1811
|
-
IgnoreCopDirectives:
|
1818
|
+
IgnoreCopDirectives: true
|
1812
1819
|
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
|
1813
1820
|
# elements. Strings will be converted to Regexp objects. A line that matches
|
1814
1821
|
# any regular expression listed in this option will be ignored by LineLength.
|
@@ -1847,6 +1854,14 @@ Metrics/PerceivedComplexity:
|
|
1847
1854
|
VersionAdded: '0.25'
|
1848
1855
|
Max: 7
|
1849
1856
|
|
1857
|
+
################## Migration #############################
|
1858
|
+
|
1859
|
+
Migration/DepartmentName:
|
1860
|
+
Description: >-
|
1861
|
+
Check that cop names in rubocop:disable (etc) comments are
|
1862
|
+
given with department name.
|
1863
|
+
Enabled: false
|
1864
|
+
|
1850
1865
|
#################### Naming ##############################
|
1851
1866
|
|
1852
1867
|
Naming/AccessorMethodName:
|
@@ -1982,6 +1997,13 @@ Naming/MethodName:
|
|
1982
1997
|
SupportedStyles:
|
1983
1998
|
- snake_case
|
1984
1999
|
- camelCase
|
2000
|
+
# Method names matching patterns are always allowed.
|
2001
|
+
#
|
2002
|
+
# IgnoredPatterns:
|
2003
|
+
# - '\A\s*onSelectionBulkChange\s*'
|
2004
|
+
# - '\A\s*onSelectionCleared\s*'
|
2005
|
+
#
|
2006
|
+
IgnoredPatterns: []
|
1985
2007
|
|
1986
2008
|
Naming/PredicateName:
|
1987
2009
|
Description: 'Check the names of predicate methods.'
|
@@ -2078,461 +2100,6 @@ Naming/VariableNumber:
|
|
2078
2100
|
- normalcase
|
2079
2101
|
- non_integer
|
2080
2102
|
|
2081
|
-
#################### Rails #################################
|
2082
|
-
|
2083
|
-
# By default, the rails cops are not run. Override in project or home
|
2084
|
-
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
2085
|
-
Rails:
|
2086
|
-
Enabled: false
|
2087
|
-
|
2088
|
-
Rails/ActionFilter:
|
2089
|
-
Description: 'Enforces consistent use of action filter methods.'
|
2090
|
-
Enabled: true
|
2091
|
-
VersionAdded: '0.19'
|
2092
|
-
EnforcedStyle: action
|
2093
|
-
SupportedStyles:
|
2094
|
-
- action
|
2095
|
-
- filter
|
2096
|
-
Include:
|
2097
|
-
- app/controllers/**/*.rb
|
2098
|
-
|
2099
|
-
Rails/ActiveRecordAliases:
|
2100
|
-
Description: >-
|
2101
|
-
Avoid Active Record aliases:
|
2102
|
-
Use `update` instead of `update_attributes`.
|
2103
|
-
Use `update!` instead of `update_attributes!`.
|
2104
|
-
Enabled: true
|
2105
|
-
VersionAdded: '0.53'
|
2106
|
-
|
2107
|
-
Rails/ActiveRecordOverride:
|
2108
|
-
Description: >-
|
2109
|
-
Check for overriding Active Record methods instead of using
|
2110
|
-
callbacks.
|
2111
|
-
Enabled: true
|
2112
|
-
VersionAdded: '0.67'
|
2113
|
-
Include:
|
2114
|
-
- app/models/**/*.rb
|
2115
|
-
|
2116
|
-
Rails/ActiveSupportAliases:
|
2117
|
-
Description: >-
|
2118
|
-
Avoid ActiveSupport aliases of standard ruby methods:
|
2119
|
-
`String#starts_with?`, `String#ends_with?`,
|
2120
|
-
`Array#append`, `Array#prepend`.
|
2121
|
-
Enabled: true
|
2122
|
-
VersionAdded: '0.48'
|
2123
|
-
|
2124
|
-
Rails/ApplicationJob:
|
2125
|
-
Description: 'Check that jobs subclass ApplicationJob.'
|
2126
|
-
Enabled: true
|
2127
|
-
VersionAdded: '0.49'
|
2128
|
-
|
2129
|
-
Rails/ApplicationRecord:
|
2130
|
-
Description: 'Check that models subclass ApplicationRecord.'
|
2131
|
-
Enabled: true
|
2132
|
-
VersionAdded: '0.49'
|
2133
|
-
|
2134
|
-
Rails/AssertNot:
|
2135
|
-
Description: 'Use `assert_not` instead of `assert !`.'
|
2136
|
-
Enabled: true
|
2137
|
-
VersionAdded: '0.56'
|
2138
|
-
Include:
|
2139
|
-
- '**/test/**/*'
|
2140
|
-
|
2141
|
-
Rails/BelongsTo:
|
2142
|
-
Description: >-
|
2143
|
-
Use `optional: true` instead of `required: false` for
|
2144
|
-
`belongs_to` relations'
|
2145
|
-
Enabled: true
|
2146
|
-
VersionAdded: '0.62'
|
2147
|
-
|
2148
|
-
Rails/Blank:
|
2149
|
-
Description: 'Enforces use of `blank?`.'
|
2150
|
-
Enabled: true
|
2151
|
-
VersionAdded: '0.48'
|
2152
|
-
VersionChanged: '0.67'
|
2153
|
-
# Convert usages of `nil? || empty?` to `blank?`
|
2154
|
-
NilOrEmpty: true
|
2155
|
-
# Convert usages of `!present?` to `blank?`
|
2156
|
-
NotPresent: true
|
2157
|
-
# Convert usages of `unless present?` to `if blank?`
|
2158
|
-
UnlessPresent: true
|
2159
|
-
|
2160
|
-
Rails/BulkChangeTable:
|
2161
|
-
Description: 'Check whether alter queries are combinable.'
|
2162
|
-
Enabled: true
|
2163
|
-
VersionAdded: '0.57'
|
2164
|
-
Database: null
|
2165
|
-
SupportedDatabases:
|
2166
|
-
- mysql
|
2167
|
-
- postgresql
|
2168
|
-
Include:
|
2169
|
-
- db/migrate/*.rb
|
2170
|
-
|
2171
|
-
Rails/CreateTableWithTimestamps:
|
2172
|
-
Description: >-
|
2173
|
-
Checks the migration for which timestamps are not included
|
2174
|
-
when creating a new table.
|
2175
|
-
Enabled: true
|
2176
|
-
VersionAdded: '0.52'
|
2177
|
-
Include:
|
2178
|
-
- db/migrate/*.rb
|
2179
|
-
|
2180
|
-
Rails/Date:
|
2181
|
-
Description: >-
|
2182
|
-
Checks the correct usage of date aware methods,
|
2183
|
-
such as Date.today, Date.current etc.
|
2184
|
-
Enabled: true
|
2185
|
-
VersionAdded: '0.30'
|
2186
|
-
VersionChanged: '0.33'
|
2187
|
-
# The value `strict` disallows usage of `Date.today`, `Date.current`,
|
2188
|
-
# `Date#to_time` etc.
|
2189
|
-
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
|
2190
|
-
# (but not `Date.today`) which are overridden by ActiveSupport to handle current
|
2191
|
-
# time zone.
|
2192
|
-
EnforcedStyle: flexible
|
2193
|
-
SupportedStyles:
|
2194
|
-
- strict
|
2195
|
-
- flexible
|
2196
|
-
|
2197
|
-
Rails/Delegate:
|
2198
|
-
Description: 'Prefer delegate method for delegations.'
|
2199
|
-
Enabled: true
|
2200
|
-
VersionAdded: '0.21'
|
2201
|
-
VersionChanged: '0.50'
|
2202
|
-
# When set to true, using the target object as a prefix of the
|
2203
|
-
# method name without using the `delegate` method will be a
|
2204
|
-
# violation. When set to false, this case is legal.
|
2205
|
-
EnforceForPrefixed: true
|
2206
|
-
|
2207
|
-
Rails/DelegateAllowBlank:
|
2208
|
-
Description: 'Do not use allow_blank as an option to delegate.'
|
2209
|
-
Enabled: true
|
2210
|
-
VersionAdded: '0.44'
|
2211
|
-
|
2212
|
-
Rails/DynamicFindBy:
|
2213
|
-
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
|
2214
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2215
|
-
Enabled: true
|
2216
|
-
VersionAdded: '0.44'
|
2217
|
-
Whitelist:
|
2218
|
-
- find_by_sql
|
2219
|
-
|
2220
|
-
Rails/EnumUniqueness:
|
2221
|
-
Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
|
2222
|
-
Enabled: true
|
2223
|
-
VersionAdded: '0.46'
|
2224
|
-
Include:
|
2225
|
-
- app/models/**/*.rb
|
2226
|
-
|
2227
|
-
Rails/EnvironmentComparison:
|
2228
|
-
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`"
|
2229
|
-
Enabled: true
|
2230
|
-
VersionAdded: '0.52'
|
2231
|
-
|
2232
|
-
Rails/Exit:
|
2233
|
-
Description: >-
|
2234
|
-
Favor `fail`, `break`, `return`, etc. over `exit` in
|
2235
|
-
application or library code outside of Rake files to avoid
|
2236
|
-
exits during unit testing or running in production.
|
2237
|
-
Enabled: true
|
2238
|
-
VersionAdded: '0.41'
|
2239
|
-
Include:
|
2240
|
-
- app/**/*.rb
|
2241
|
-
- config/**/*.rb
|
2242
|
-
- lib/**/*.rb
|
2243
|
-
Exclude:
|
2244
|
-
- lib/**/*.rake
|
2245
|
-
|
2246
|
-
Rails/FilePath:
|
2247
|
-
Description: 'Use `Rails.root.join` for file path joining.'
|
2248
|
-
Enabled: true
|
2249
|
-
VersionAdded: '0.47'
|
2250
|
-
VersionChanged: '0.57'
|
2251
|
-
EnforcedStyle: arguments
|
2252
|
-
SupportedStyles:
|
2253
|
-
- slashes
|
2254
|
-
- arguments
|
2255
|
-
|
2256
|
-
Rails/FindBy:
|
2257
|
-
Description: 'Prefer find_by over where.first.'
|
2258
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
|
2259
|
-
Enabled: true
|
2260
|
-
VersionAdded: '0.30'
|
2261
|
-
Include:
|
2262
|
-
- app/models/**/*.rb
|
2263
|
-
|
2264
|
-
Rails/FindEach:
|
2265
|
-
Description: 'Prefer all.find_each over all.find.'
|
2266
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
|
2267
|
-
Enabled: true
|
2268
|
-
VersionAdded: '0.30'
|
2269
|
-
Include:
|
2270
|
-
- app/models/**/*.rb
|
2271
|
-
|
2272
|
-
Rails/HasAndBelongsToMany:
|
2273
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
2274
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
|
2275
|
-
Enabled: true
|
2276
|
-
VersionAdded: '0.12'
|
2277
|
-
Include:
|
2278
|
-
- app/models/**/*.rb
|
2279
|
-
|
2280
|
-
Rails/HasManyOrHasOneDependent:
|
2281
|
-
Description: 'Define the dependent option to the has_many and has_one associations.'
|
2282
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
|
2283
|
-
Enabled: true
|
2284
|
-
VersionAdded: '0.50'
|
2285
|
-
Include:
|
2286
|
-
- app/models/**/*.rb
|
2287
|
-
|
2288
|
-
Rails/HttpPositionalArguments:
|
2289
|
-
Description: 'Use keyword arguments instead of positional arguments in http method calls.'
|
2290
|
-
Enabled: true
|
2291
|
-
VersionAdded: '0.44'
|
2292
|
-
Include:
|
2293
|
-
- 'spec/**/*'
|
2294
|
-
- 'test/**/*'
|
2295
|
-
|
2296
|
-
Rails/HttpStatus:
|
2297
|
-
Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
|
2298
|
-
Enabled: true
|
2299
|
-
VersionAdded: '0.54'
|
2300
|
-
EnforcedStyle: symbolic
|
2301
|
-
SupportedStyles:
|
2302
|
-
- numeric
|
2303
|
-
- symbolic
|
2304
|
-
|
2305
|
-
Rails/IgnoredSkipActionFilterOption:
|
2306
|
-
Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
|
2307
|
-
Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
|
2308
|
-
Enabled: true
|
2309
|
-
VersionAdded: '0.63'
|
2310
|
-
Include:
|
2311
|
-
- app/controllers/**/*.rb
|
2312
|
-
|
2313
|
-
Rails/InverseOf:
|
2314
|
-
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
2315
|
-
Enabled: true
|
2316
|
-
VersionAdded: '0.52'
|
2317
|
-
Include:
|
2318
|
-
- app/models/**/*.rb
|
2319
|
-
|
2320
|
-
Rails/LexicallyScopedActionFilter:
|
2321
|
-
Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
|
2322
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
|
2323
|
-
Enabled: true
|
2324
|
-
Safe: false
|
2325
|
-
VersionAdded: '0.52'
|
2326
|
-
Include:
|
2327
|
-
- app/controllers/**/*.rb
|
2328
|
-
|
2329
|
-
Rails/LinkToBlank:
|
2330
|
-
Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
|
2331
|
-
Reference:
|
2332
|
-
- https://mathiasbynens.github.io/rel-noopener/
|
2333
|
-
- https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
|
2334
|
-
- https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
|
2335
|
-
Enabled: true
|
2336
|
-
VersionAdded: '0.62'
|
2337
|
-
|
2338
|
-
Rails/NotNullColumn:
|
2339
|
-
Description: 'Do not add a NOT NULL column without a default value'
|
2340
|
-
Enabled: true
|
2341
|
-
VersionAdded: '0.43'
|
2342
|
-
Include:
|
2343
|
-
- db/migrate/*.rb
|
2344
|
-
|
2345
|
-
Rails/Output:
|
2346
|
-
Description: 'Checks for calls to puts, print, etc.'
|
2347
|
-
Enabled: true
|
2348
|
-
VersionAdded: '0.15'
|
2349
|
-
VersionChanged: '0.19'
|
2350
|
-
Include:
|
2351
|
-
- app/**/*.rb
|
2352
|
-
- config/**/*.rb
|
2353
|
-
- db/**/*.rb
|
2354
|
-
- lib/**/*.rb
|
2355
|
-
|
2356
|
-
Rails/OutputSafety:
|
2357
|
-
Description: 'The use of `html_safe` or `raw` may be a security risk.'
|
2358
|
-
Enabled: true
|
2359
|
-
VersionAdded: '0.41'
|
2360
|
-
|
2361
|
-
Rails/PluralizationGrammar:
|
2362
|
-
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
|
2363
|
-
Enabled: true
|
2364
|
-
VersionAdded: '0.35'
|
2365
|
-
|
2366
|
-
Rails/Presence:
|
2367
|
-
Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
|
2368
|
-
Enabled: true
|
2369
|
-
VersionAdded: '0.52'
|
2370
|
-
|
2371
|
-
Rails/Present:
|
2372
|
-
Description: 'Enforces use of `present?`.'
|
2373
|
-
Enabled: true
|
2374
|
-
VersionAdded: '0.48'
|
2375
|
-
VersionChanged: '0.67'
|
2376
|
-
# Convert usages of `!nil? && !empty?` to `present?`
|
2377
|
-
NotNilAndNotEmpty: true
|
2378
|
-
# Convert usages of `!blank?` to `present?`
|
2379
|
-
NotBlank: true
|
2380
|
-
# Convert usages of `unless blank?` to `if present?`
|
2381
|
-
UnlessBlank: true
|
2382
|
-
|
2383
|
-
Rails/ReadWriteAttribute:
|
2384
|
-
Description: >-
|
2385
|
-
Checks for read_attribute(:attr) and
|
2386
|
-
write_attribute(:attr, val).
|
2387
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
|
2388
|
-
Enabled: true
|
2389
|
-
VersionAdded: '0.20'
|
2390
|
-
VersionChanged: '0.29'
|
2391
|
-
Include:
|
2392
|
-
- app/models/**/*.rb
|
2393
|
-
|
2394
|
-
Rails/RedundantAllowNil:
|
2395
|
-
Description: >-
|
2396
|
-
Finds redundant use of `allow_nil` when `allow_blank` is set to
|
2397
|
-
certain values in model validations.
|
2398
|
-
Enabled: true
|
2399
|
-
VersionAdded: '0.67'
|
2400
|
-
Include:
|
2401
|
-
- app/models/**/*.rb
|
2402
|
-
|
2403
|
-
Rails/RedundantReceiverInWithOptions:
|
2404
|
-
Description: 'Checks for redundant receiver in `with_options`.'
|
2405
|
-
Enabled: true
|
2406
|
-
VersionAdded: '0.52'
|
2407
|
-
|
2408
|
-
Rails/ReflectionClassName:
|
2409
|
-
Description: 'Use a string for `class_name` option value in the definition of a reflection.'
|
2410
|
-
Enabled: true
|
2411
|
-
VersionAdded: '0.64'
|
2412
|
-
|
2413
|
-
Rails/RefuteMethods:
|
2414
|
-
Description: 'Use `assert_not` methods instead of `refute` methods.'
|
2415
|
-
Enabled: true
|
2416
|
-
VersionAdded: '0.56'
|
2417
|
-
Include:
|
2418
|
-
- '**/test/**/*'
|
2419
|
-
|
2420
|
-
Rails/RelativeDateConstant:
|
2421
|
-
Description: 'Do not assign relative date to constants.'
|
2422
|
-
Enabled: true
|
2423
|
-
VersionAdded: '0.48'
|
2424
|
-
VersionChanged: '0.59'
|
2425
|
-
AutoCorrect: false
|
2426
|
-
|
2427
|
-
Rails/RequestReferer:
|
2428
|
-
Description: 'Use consistent syntax for request.referer.'
|
2429
|
-
Enabled: true
|
2430
|
-
VersionAdded: '0.41'
|
2431
|
-
EnforcedStyle: referer
|
2432
|
-
SupportedStyles:
|
2433
|
-
- referer
|
2434
|
-
- referrer
|
2435
|
-
|
2436
|
-
Rails/ReversibleMigration:
|
2437
|
-
Description: 'Checks whether the change method of the migration file is reversible.'
|
2438
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
|
2439
|
-
Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
|
2440
|
-
Enabled: true
|
2441
|
-
VersionAdded: '0.47'
|
2442
|
-
Include:
|
2443
|
-
- db/migrate/*.rb
|
2444
|
-
|
2445
|
-
Rails/SafeNavigation:
|
2446
|
-
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`"
|
2447
|
-
Enabled: true
|
2448
|
-
VersionAdded: '0.43'
|
2449
|
-
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
2450
|
-
# `try` and `try!` work slightly differently. `try!` and safe navigation will
|
2451
|
-
# both raise a `NoMethodError` if the receiver of the method call does not
|
2452
|
-
# implement the intended method. `try` will not raise an exception for this.
|
2453
|
-
ConvertTry: false
|
2454
|
-
|
2455
|
-
Rails/SaveBang:
|
2456
|
-
Description: 'Identifies possible cases where Active Record save! or related should be used.'
|
2457
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
|
2458
|
-
Enabled: false
|
2459
|
-
VersionAdded: '0.42'
|
2460
|
-
VersionChanged: '0.59'
|
2461
|
-
AllowImplicitReturn: true
|
2462
|
-
AllowedReceivers: []
|
2463
|
-
|
2464
|
-
Rails/ScopeArgs:
|
2465
|
-
Description: 'Checks the arguments of ActiveRecord scopes.'
|
2466
|
-
Enabled: true
|
2467
|
-
VersionAdded: '0.19'
|
2468
|
-
Include:
|
2469
|
-
- app/models/**/*.rb
|
2470
|
-
|
2471
|
-
Rails/SkipsModelValidations:
|
2472
|
-
Description: >-
|
2473
|
-
Use methods that skips model validations with caution.
|
2474
|
-
See reference for more information.
|
2475
|
-
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
2476
|
-
Enabled: true
|
2477
|
-
VersionAdded: '0.47'
|
2478
|
-
VersionChanged: '0.60'
|
2479
|
-
Blacklist:
|
2480
|
-
- decrement!
|
2481
|
-
- decrement_counter
|
2482
|
-
- increment!
|
2483
|
-
- increment_counter
|
2484
|
-
- toggle!
|
2485
|
-
- touch
|
2486
|
-
- update_all
|
2487
|
-
- update_attribute
|
2488
|
-
- update_column
|
2489
|
-
- update_columns
|
2490
|
-
- update_counters
|
2491
|
-
Whitelist: []
|
2492
|
-
|
2493
|
-
Rails/TimeZone:
|
2494
|
-
Description: 'Checks the correct usage of time zone aware methods.'
|
2495
|
-
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
|
2496
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
2497
|
-
Enabled: true
|
2498
|
-
Safe: false
|
2499
|
-
VersionAdded: '0.30'
|
2500
|
-
VersionChanged: '0.68'
|
2501
|
-
# The value `strict` means that `Time` should be used with `zone`.
|
2502
|
-
# The value `flexible` allows usage of `in_time_zone` instead of `zone`.
|
2503
|
-
EnforcedStyle: flexible
|
2504
|
-
SupportedStyles:
|
2505
|
-
- strict
|
2506
|
-
- flexible
|
2507
|
-
|
2508
|
-
Rails/UniqBeforePluck:
|
2509
|
-
Description: 'Prefer the use of uniq or distinct before pluck.'
|
2510
|
-
Enabled: true
|
2511
|
-
VersionAdded: '0.40'
|
2512
|
-
VersionChanged: '0.47'
|
2513
|
-
EnforcedStyle: conservative
|
2514
|
-
SupportedStyles:
|
2515
|
-
- conservative
|
2516
|
-
- aggressive
|
2517
|
-
AutoCorrect: false
|
2518
|
-
|
2519
|
-
Rails/UnknownEnv:
|
2520
|
-
Description: 'Use correct environment name.'
|
2521
|
-
Enabled: true
|
2522
|
-
VersionAdded: '0.51'
|
2523
|
-
Environments:
|
2524
|
-
- development
|
2525
|
-
- test
|
2526
|
-
- production
|
2527
|
-
|
2528
|
-
Rails/Validation:
|
2529
|
-
Description: 'Use validates :attribute, hash of validations.'
|
2530
|
-
Enabled: true
|
2531
|
-
VersionAdded: '0.9'
|
2532
|
-
VersionChanged: '0.41'
|
2533
|
-
Include:
|
2534
|
-
- app/models/**/*.rb
|
2535
|
-
|
2536
2103
|
#################### Security ##############################
|
2537
2104
|
|
2538
2105
|
Security/Eval:
|
@@ -2589,7 +2156,7 @@ Style/AccessModifierDeclarations:
|
|
2589
2156
|
|
2590
2157
|
Style/Alias:
|
2591
2158
|
Description: 'Use alias instead of alias_method.'
|
2592
|
-
StyleGuide: '#alias-method'
|
2159
|
+
StyleGuide: '#alias-method-lexically'
|
2593
2160
|
Enabled: true
|
2594
2161
|
VersionAdded: '0.9'
|
2595
2162
|
VersionChanged: '0.36'
|
@@ -3011,6 +2578,11 @@ Style/DocumentationMethod:
|
|
3011
2578
|
- 'test/**/*'
|
3012
2579
|
RequireForNonPublicMethods: false
|
3013
2580
|
|
2581
|
+
Style/DoubleCopDisableDirective:
|
2582
|
+
Description: 'Checks for double rubocop:disable comments on a single line.'
|
2583
|
+
Enabled: true
|
2584
|
+
VersionAdded: '0.73'
|
2585
|
+
|
3014
2586
|
Style/DoubleNegation:
|
3015
2587
|
Description: 'Checks for uses of double negation (!!).'
|
3016
2588
|
StyleGuide: '#no-bang-bang'
|
@@ -3095,7 +2667,7 @@ Style/EvalWithLocation:
|
|
3095
2667
|
VersionAdded: '0.52'
|
3096
2668
|
|
3097
2669
|
Style/EvenOdd:
|
3098
|
-
Description: 'Favor the use of Integer#even
|
2670
|
+
Description: 'Favor the use of `Integer#even?` && `Integer#odd?`.'
|
3099
2671
|
StyleGuide: '#predicate-methods'
|
3100
2672
|
Enabled: true
|
3101
2673
|
VersionAdded: '0.12'
|
@@ -3106,6 +2678,19 @@ Style/ExpandPathArguments:
|
|
3106
2678
|
Enabled: true
|
3107
2679
|
VersionAdded: '0.53'
|
3108
2680
|
|
2681
|
+
Style/FloatDivision:
|
2682
|
+
Description: 'For performing float division, coerce one side only.'
|
2683
|
+
StyleGuide: '#float-division'
|
2684
|
+
Reference: 'https://github.com/rubocop-hq/ruby-style-guide/issues/628'
|
2685
|
+
Enabled: true
|
2686
|
+
VersionAdded: '0.72'
|
2687
|
+
EnforcedStyle: single_coerce
|
2688
|
+
SupportedStyles:
|
2689
|
+
- left_coerce
|
2690
|
+
- right_coerce
|
2691
|
+
- single_coerce
|
2692
|
+
- fdiv
|
2693
|
+
|
3109
2694
|
Style/For:
|
3110
2695
|
Description: 'Checks use of for or each in multiline loops.'
|
3111
2696
|
StyleGuide: '#no-for-loops'
|
@@ -3141,7 +2726,7 @@ Style/FormatStringToken:
|
|
3141
2726
|
- template
|
3142
2727
|
- unannotated
|
3143
2728
|
VersionAdded: '0.49'
|
3144
|
-
VersionChanged: '0.
|
2729
|
+
VersionChanged: '0.75'
|
3145
2730
|
|
3146
2731
|
Style/FrozenStringLiteralComment:
|
3147
2732
|
Description: >-
|
@@ -3171,7 +2756,7 @@ Style/GlobalVars:
|
|
3171
2756
|
AllowedVariables: []
|
3172
2757
|
|
3173
2758
|
Style/GuardClause:
|
3174
|
-
Description: 'Check for conditionals that can be replaced with guard clauses'
|
2759
|
+
Description: 'Check for conditionals that can be replaced with guard clauses.'
|
3175
2760
|
StyleGuide: '#no-nested-conditionals'
|
3176
2761
|
Enabled: true
|
3177
2762
|
VersionAdded: '0.20'
|
@@ -3214,6 +2799,7 @@ Style/IdenticalConditionalBranches:
|
|
3214
2799
|
Style/IfInsideElse:
|
3215
2800
|
Description: 'Finds if nodes inside else, which can be converted to elsif.'
|
3216
2801
|
Enabled: true
|
2802
|
+
AllowIfModifier: false
|
3217
2803
|
VersionAdded: '0.36'
|
3218
2804
|
|
3219
2805
|
Style/IfUnlessModifier:
|
@@ -3333,6 +2919,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3333
2919
|
VersionChanged: '0.61'
|
3334
2920
|
IgnoreMacros: true
|
3335
2921
|
IgnoredMethods: []
|
2922
|
+
IgnoredPatterns: []
|
3336
2923
|
IncludedMacros: []
|
3337
2924
|
AllowParenthesesInMultilineCall: false
|
3338
2925
|
AllowParenthesesInChaining: false
|
@@ -3379,7 +2966,7 @@ Style/MethodMissingSuper:
|
|
3379
2966
|
Style/MinMax:
|
3380
2967
|
Description: >-
|
3381
2968
|
Use `Enumerable#minmax` instead of `Enumerable#min`
|
3382
|
-
and `Enumerable#max` in conjunction.
|
2969
|
+
and `Enumerable#max` in conjunction.
|
3383
2970
|
Enabled: true
|
3384
2971
|
VersionAdded: '0.50'
|
3385
2972
|
|
@@ -3389,7 +2976,7 @@ Style/MissingElse:
|
|
3389
2976
|
If enabled, it is recommended that
|
3390
2977
|
Style/UnlessElse and Style/EmptyElse be enabled.
|
3391
2978
|
This will conflict with Style/EmptyElse if
|
3392
|
-
Style/EmptyElse is configured to style "both"
|
2979
|
+
Style/EmptyElse is configured to style "both".
|
3393
2980
|
Enabled: false
|
3394
2981
|
VersionAdded: '0.30'
|
3395
2982
|
VersionChanged: '0.38'
|
@@ -3483,6 +3070,12 @@ Style/MultilineTernaryOperator:
|
|
3483
3070
|
Enabled: true
|
3484
3071
|
VersionAdded: '0.9'
|
3485
3072
|
|
3073
|
+
Style/MultilineWhenThen:
|
3074
|
+
Description: 'Do not use then for multi-line when statement.'
|
3075
|
+
StyleGuide: '#no-then'
|
3076
|
+
Enabled: true
|
3077
|
+
VersionAdded: '0.73'
|
3078
|
+
|
3486
3079
|
Style/MultipleComparison:
|
3487
3080
|
Description: >-
|
3488
3081
|
Avoid comparing a variable with multiple items in a conditional,
|
@@ -3701,7 +3294,7 @@ Style/OptionHash:
|
|
3701
3294
|
Style/OptionalArguments:
|
3702
3295
|
Description: >-
|
3703
3296
|
Checks for optional arguments that do not appear at the end
|
3704
|
-
of the argument list
|
3297
|
+
of the argument list.
|
3705
3298
|
StyleGuide: '#optional-arguments'
|
3706
3299
|
Enabled: true
|
3707
3300
|
VersionAdded: '0.33'
|
@@ -3733,7 +3326,7 @@ Style/ParenthesesAroundCondition:
|
|
3733
3326
|
AllowInMultilineConditions: false
|
3734
3327
|
|
3735
3328
|
Style/PercentLiteralDelimiters:
|
3736
|
-
Description: 'Use `%`-literal delimiters consistently'
|
3329
|
+
Description: 'Use `%`-literal delimiters consistently.'
|
3737
3330
|
StyleGuide: '#percent-literal-braces'
|
3738
3331
|
Enabled: true
|
3739
3332
|
VersionAdded: '0.19'
|
@@ -4014,6 +3607,8 @@ Style/StringHashKeys:
|
|
4014
3607
|
StyleGuide: '#symbols-as-keys'
|
4015
3608
|
Enabled: false
|
4016
3609
|
VersionAdded: '0.52'
|
3610
|
+
VersionChanged: '0.75'
|
3611
|
+
Safe: false
|
4017
3612
|
|
4018
3613
|
Style/StringLiterals:
|
4019
3614
|
Description: 'Checks if uses of quotes match the configured preference.'
|
@@ -4265,7 +3860,7 @@ Style/UnneededSort:
|
|
4265
3860
|
Style/UnpackFirst:
|
4266
3861
|
Description: >-
|
4267
3862
|
Checks for accessing the first element of `String#unpack`
|
4268
|
-
instead of using `unpack1
|
3863
|
+
instead of using `unpack1`.
|
4269
3864
|
Enabled: true
|
4270
3865
|
VersionAdded: '0.54'
|
4271
3866
|
|
@@ -4316,7 +3911,7 @@ Style/WordArray:
|
|
4316
3911
|
# whose element count is greater than or equal to `MinSize`.
|
4317
3912
|
MinSize: 2
|
4318
3913
|
# The regular expression `WordRegex` decides what is considered a word.
|
4319
|
-
WordRegex: !ruby/regexp '/\A
|
3914
|
+
WordRegex: !ruby/regexp '/\A(?:\p{Word}|\p{Word}-\p{Word}|\n|\t)+\z/'
|
4320
3915
|
|
4321
3916
|
Style/YodaCondition:
|
4322
3917
|
Description: 'Forbid or enforce yoda conditions.'
|
@@ -4332,8 +3927,9 @@ Style/YodaCondition:
|
|
4332
3927
|
- require_for_all_comparison_operators
|
4333
3928
|
# enforce yoda only for equality operators: `!=` and `==`
|
4334
3929
|
- require_for_equality_operators_only
|
3930
|
+
Safe: false
|
4335
3931
|
VersionAdded: '0.49'
|
4336
|
-
VersionChanged: '0.
|
3932
|
+
VersionChanged: '0.75'
|
4337
3933
|
|
4338
3934
|
Style/ZeroLengthPredicate:
|
4339
3935
|
Description: 'Use #empty? when testing for objects of length 0.'
|