rubocop-rails 2.7.1 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +18 -2
- data/config/default.yml +144 -6
- data/config/obsoletion.yml +7 -0
- data/lib/rubocop/cop/mixin/active_record_helper.rb +16 -3
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +40 -0
- data/lib/rubocop/cop/mixin/index_method.rb +25 -11
- data/lib/rubocop/cop/rails/action_filter.rb +10 -14
- data/lib/rubocop/cop/rails/active_record_aliases.rb +13 -17
- data/lib/rubocop/cop/rails/active_record_callbacks_order.rb +19 -16
- data/lib/rubocop/cop/rails/active_record_override.rb +1 -1
- data/lib/rubocop/cop/rails/active_support_aliases.rb +12 -21
- data/lib/rubocop/cop/rails/after_commit_override.rb +91 -0
- data/lib/rubocop/cop/rails/application_controller.rb +3 -7
- data/lib/rubocop/cop/rails/application_job.rb +2 -1
- data/lib/rubocop/cop/rails/application_mailer.rb +2 -7
- data/lib/rubocop/cop/rails/application_record.rb +2 -7
- data/lib/rubocop/cop/rails/arel_star.rb +41 -0
- data/lib/rubocop/cop/rails/assert_not.rb +8 -10
- data/lib/rubocop/cop/rails/attribute_default_block_value.rb +90 -0
- data/lib/rubocop/cop/rails/belongs_to.rb +10 -19
- data/lib/rubocop/cop/rails/blank.rb +31 -27
- data/lib/rubocop/cop/rails/bulk_change_table.rb +1 -1
- data/lib/rubocop/cop/rails/content_tag.rb +34 -19
- data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +2 -1
- data/lib/rubocop/cop/rails/date.rb +10 -11
- data/lib/rubocop/cop/rails/default_scope.rb +11 -4
- data/lib/rubocop/cop/rails/delegate.rb +9 -9
- data/lib/rubocop/cop/rails/delegate_allow_blank.rb +7 -8
- data/lib/rubocop/cop/rails/dynamic_find_by.rb +15 -12
- data/lib/rubocop/cop/rails/enum_hash.rb +11 -10
- data/lib/rubocop/cop/rails/enum_uniqueness.rb +2 -1
- data/lib/rubocop/cop/rails/environment_comparison.rb +18 -14
- data/lib/rubocop/cop/rails/environment_variable_access.rb +67 -0
- data/lib/rubocop/cop/rails/exit.rb +4 -10
- data/lib/rubocop/cop/rails/file_path.rb +7 -8
- data/lib/rubocop/cop/rails/find_by.rb +13 -13
- data/lib/rubocop/cop/rails/find_by_id.rb +12 -21
- data/lib/rubocop/cop/rails/find_each.rb +19 -18
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +3 -2
- data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +37 -10
- data/lib/rubocop/cop/rails/helper_instance_variable.rb +30 -2
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +32 -21
- data/lib/rubocop/cop/rails/http_status.rb +7 -9
- data/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +8 -6
- data/lib/rubocop/cop/rails/index_by.rb +11 -2
- data/lib/rubocop/cop/rails/index_with.rb +11 -2
- data/lib/rubocop/cop/rails/inquiry.rb +7 -2
- data/lib/rubocop/cop/rails/inverse_of.rb +3 -2
- data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +17 -15
- data/lib/rubocop/cop/rails/link_to_blank.rb +25 -23
- data/lib/rubocop/cop/rails/mailer_name.rb +19 -13
- data/lib/rubocop/cop/rails/match_route.rb +14 -13
- data/lib/rubocop/cop/rails/negate_include.rb +10 -8
- data/lib/rubocop/cop/rails/not_null_column.rb +2 -1
- data/lib/rubocop/cop/rails/order_by_id.rb +52 -0
- data/lib/rubocop/cop/rails/output.rb +5 -2
- data/lib/rubocop/cop/rails/output_safety.rb +3 -2
- data/lib/rubocop/cop/rails/pick.rb +14 -12
- data/lib/rubocop/cop/rails/pluck.rb +6 -9
- data/lib/rubocop/cop/rails/pluck_id.rb +4 -6
- data/lib/rubocop/cop/rails/pluck_in_where.rb +39 -5
- data/lib/rubocop/cop/rails/pluralization_grammar.rb +10 -14
- data/lib/rubocop/cop/rails/presence.rb +12 -13
- data/lib/rubocop/cop/rails/present.rb +30 -24
- data/lib/rubocop/cop/rails/rake_environment.rb +8 -10
- data/lib/rubocop/cop/rails/read_write_attribute.rb +12 -11
- data/lib/rubocop/cop/rails/redundant_allow_nil.rb +29 -31
- data/lib/rubocop/cop/rails/redundant_foreign_key.rb +9 -12
- data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +11 -10
- data/lib/rubocop/cop/rails/reflection_class_name.rb +18 -4
- data/lib/rubocop/cop/rails/refute_methods.rb +9 -10
- data/lib/rubocop/cop/rails/relative_date_constant.rb +34 -22
- data/lib/rubocop/cop/rails/render_inline.rb +2 -1
- data/lib/rubocop/cop/rails/render_plain_text.rb +9 -14
- data/lib/rubocop/cop/rails/request_referer.rb +7 -7
- data/lib/rubocop/cop/rails/require_dependency.rb +38 -0
- data/lib/rubocop/cop/rails/reversible_migration.rb +83 -8
- data/lib/rubocop/cop/rails/reversible_migration_method_definition.rb +75 -0
- data/lib/rubocop/cop/rails/safe_navigation.rb +30 -11
- data/lib/rubocop/cop/rails/safe_navigation_with_blank.rb +5 -10
- data/lib/rubocop/cop/rails/save_bang.rb +19 -22
- data/lib/rubocop/cop/rails/scope_args.rb +2 -1
- data/lib/rubocop/cop/rails/short_i18n.rb +7 -9
- data/lib/rubocop/cop/rails/skips_model_validations.rb +4 -4
- data/lib/rubocop/cop/rails/squished_sql_heredocs.rb +82 -0
- data/lib/rubocop/cop/rails/time_zone.rb +35 -25
- data/lib/rubocop/cop/rails/time_zone_assignment.rb +37 -0
- data/lib/rubocop/cop/rails/uniq_before_pluck.rb +6 -6
- data/lib/rubocop/cop/rails/unique_validation_without_index.rb +18 -8
- data/lib/rubocop/cop/rails/unknown_env.rb +3 -3
- data/lib/rubocop/cop/rails/validation.rb +15 -14
- data/lib/rubocop/cop/rails/where_equals.rb +98 -0
- data/lib/rubocop/cop/rails/where_exists.rb +85 -16
- data/lib/rubocop/cop/rails/where_not.rb +101 -0
- data/lib/rubocop/cop/rails_cops.rb +12 -0
- data/lib/rubocop/rails.rb +2 -0
- data/lib/rubocop/rails/schema_loader.rb +4 -4
- data/lib/rubocop/rails/schema_loader/schema.rb +4 -8
- data/lib/rubocop/rails/version.rb +5 -1
- metadata +33 -14
data/lib/rubocop/rails.rb
CHANGED
@@ -13,15 +13,15 @@ module RuboCop
|
|
13
13
|
#
|
14
14
|
# @return [Schema, nil]
|
15
15
|
def load(target_ruby_version)
|
16
|
-
return @
|
16
|
+
return @load if defined?(@load)
|
17
17
|
|
18
|
-
@
|
18
|
+
@load = load!(target_ruby_version)
|
19
19
|
end
|
20
20
|
|
21
21
|
def reset!
|
22
|
-
return unless instance_variable_defined?(:@
|
22
|
+
return unless instance_variable_defined?(:@load)
|
23
23
|
|
24
|
-
remove_instance_variable(:@
|
24
|
+
remove_instance_variable(:@load)
|
25
25
|
end
|
26
26
|
|
27
27
|
def db_schema_path
|
@@ -97,14 +97,12 @@ module RuboCop
|
|
97
97
|
end.compact
|
98
98
|
end
|
99
99
|
|
100
|
-
def each_content(node)
|
101
|
-
return enum_for(__method__, node) unless
|
100
|
+
def each_content(node, &block)
|
101
|
+
return enum_for(__method__, node) unless block
|
102
102
|
|
103
103
|
case node.body&.type
|
104
104
|
when :begin
|
105
|
-
node.body.children.each
|
106
|
-
yield(child)
|
107
|
-
end
|
105
|
+
node.body.children.each(&block)
|
108
106
|
else
|
109
107
|
yield(node.body)
|
110
108
|
end
|
@@ -130,9 +128,7 @@ module RuboCop
|
|
130
128
|
return unless pairs.hash_type?
|
131
129
|
|
132
130
|
pairs.each_pair do |k, v|
|
133
|
-
if k.value == :null
|
134
|
-
@not_null = v.true_type? ? false : true
|
135
|
-
end
|
131
|
+
@not_null = !v.true_type? if k.value == :null
|
136
132
|
end
|
137
133
|
end
|
138
134
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
8
8
|
- Jonas Arvidsson
|
9
9
|
- Yuji Nakayama
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -46,14 +46,20 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 1.7.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '2.0'
|
50
53
|
type: :runtime
|
51
54
|
prerelease: false
|
52
55
|
version_requirements: !ruby/object:Gem::Requirement
|
53
56
|
requirements:
|
54
57
|
- - ">="
|
55
58
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
59
|
+
version: 1.7.0
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.0'
|
57
63
|
description: |
|
58
64
|
Automatic Rails code style checking tool.
|
59
65
|
A RuboCop extension focused on enforcing Rails best practices and coding conventions.
|
@@ -68,8 +74,10 @@ files:
|
|
68
74
|
- README.md
|
69
75
|
- bin/setup
|
70
76
|
- config/default.yml
|
77
|
+
- config/obsoletion.yml
|
71
78
|
- lib/rubocop-rails.rb
|
72
79
|
- lib/rubocop/cop/mixin/active_record_helper.rb
|
80
|
+
- lib/rubocop/cop/mixin/enforce_superclass.rb
|
73
81
|
- lib/rubocop/cop/mixin/index_method.rb
|
74
82
|
- lib/rubocop/cop/mixin/target_rails_version.rb
|
75
83
|
- lib/rubocop/cop/rails/action_filter.rb
|
@@ -77,11 +85,14 @@ files:
|
|
77
85
|
- lib/rubocop/cop/rails/active_record_callbacks_order.rb
|
78
86
|
- lib/rubocop/cop/rails/active_record_override.rb
|
79
87
|
- lib/rubocop/cop/rails/active_support_aliases.rb
|
88
|
+
- lib/rubocop/cop/rails/after_commit_override.rb
|
80
89
|
- lib/rubocop/cop/rails/application_controller.rb
|
81
90
|
- lib/rubocop/cop/rails/application_job.rb
|
82
91
|
- lib/rubocop/cop/rails/application_mailer.rb
|
83
92
|
- lib/rubocop/cop/rails/application_record.rb
|
93
|
+
- lib/rubocop/cop/rails/arel_star.rb
|
84
94
|
- lib/rubocop/cop/rails/assert_not.rb
|
95
|
+
- lib/rubocop/cop/rails/attribute_default_block_value.rb
|
85
96
|
- lib/rubocop/cop/rails/belongs_to.rb
|
86
97
|
- lib/rubocop/cop/rails/blank.rb
|
87
98
|
- lib/rubocop/cop/rails/bulk_change_table.rb
|
@@ -95,6 +106,7 @@ files:
|
|
95
106
|
- lib/rubocop/cop/rails/enum_hash.rb
|
96
107
|
- lib/rubocop/cop/rails/enum_uniqueness.rb
|
97
108
|
- lib/rubocop/cop/rails/environment_comparison.rb
|
109
|
+
- lib/rubocop/cop/rails/environment_variable_access.rb
|
98
110
|
- lib/rubocop/cop/rails/exit.rb
|
99
111
|
- lib/rubocop/cop/rails/file_path.rb
|
100
112
|
- lib/rubocop/cop/rails/find_by.rb
|
@@ -116,6 +128,7 @@ files:
|
|
116
128
|
- lib/rubocop/cop/rails/match_route.rb
|
117
129
|
- lib/rubocop/cop/rails/negate_include.rb
|
118
130
|
- lib/rubocop/cop/rails/not_null_column.rb
|
131
|
+
- lib/rubocop/cop/rails/order_by_id.rb
|
119
132
|
- lib/rubocop/cop/rails/output.rb
|
120
133
|
- lib/rubocop/cop/rails/output_safety.rb
|
121
134
|
- lib/rubocop/cop/rails/pick.rb
|
@@ -136,35 +149,41 @@ files:
|
|
136
149
|
- lib/rubocop/cop/rails/render_inline.rb
|
137
150
|
- lib/rubocop/cop/rails/render_plain_text.rb
|
138
151
|
- lib/rubocop/cop/rails/request_referer.rb
|
152
|
+
- lib/rubocop/cop/rails/require_dependency.rb
|
139
153
|
- lib/rubocop/cop/rails/reversible_migration.rb
|
154
|
+
- lib/rubocop/cop/rails/reversible_migration_method_definition.rb
|
140
155
|
- lib/rubocop/cop/rails/safe_navigation.rb
|
141
156
|
- lib/rubocop/cop/rails/safe_navigation_with_blank.rb
|
142
157
|
- lib/rubocop/cop/rails/save_bang.rb
|
143
158
|
- lib/rubocop/cop/rails/scope_args.rb
|
144
159
|
- lib/rubocop/cop/rails/short_i18n.rb
|
145
160
|
- lib/rubocop/cop/rails/skips_model_validations.rb
|
161
|
+
- lib/rubocop/cop/rails/squished_sql_heredocs.rb
|
146
162
|
- lib/rubocop/cop/rails/time_zone.rb
|
163
|
+
- lib/rubocop/cop/rails/time_zone_assignment.rb
|
147
164
|
- lib/rubocop/cop/rails/uniq_before_pluck.rb
|
148
165
|
- lib/rubocop/cop/rails/unique_validation_without_index.rb
|
149
166
|
- lib/rubocop/cop/rails/unknown_env.rb
|
150
167
|
- lib/rubocop/cop/rails/validation.rb
|
168
|
+
- lib/rubocop/cop/rails/where_equals.rb
|
151
169
|
- lib/rubocop/cop/rails/where_exists.rb
|
170
|
+
- lib/rubocop/cop/rails/where_not.rb
|
152
171
|
- lib/rubocop/cop/rails_cops.rb
|
153
172
|
- lib/rubocop/rails.rb
|
154
173
|
- lib/rubocop/rails/inject.rb
|
155
174
|
- lib/rubocop/rails/schema_loader.rb
|
156
175
|
- lib/rubocop/rails/schema_loader/schema.rb
|
157
176
|
- lib/rubocop/rails/version.rb
|
158
|
-
homepage: https://github.com/rubocop
|
177
|
+
homepage: https://github.com/rubocop/rubocop-rails
|
159
178
|
licenses:
|
160
179
|
- MIT
|
161
180
|
metadata:
|
162
181
|
homepage_uri: https://docs.rubocop.org/rubocop-rails/
|
163
|
-
changelog_uri: https://github.com/rubocop
|
164
|
-
source_code_uri: https://github.com/rubocop
|
165
|
-
documentation_uri: https://docs.rubocop.org/rubocop-rails/
|
166
|
-
bug_tracker_uri: https://github.com/rubocop
|
167
|
-
post_install_message:
|
182
|
+
changelog_uri: https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md
|
183
|
+
source_code_uri: https://github.com/rubocop/rubocop-rails/
|
184
|
+
documentation_uri: https://docs.rubocop.org/rubocop-rails/2.10/
|
185
|
+
bug_tracker_uri: https://github.com/rubocop/rubocop-rails/issues
|
186
|
+
post_install_message:
|
168
187
|
rdoc_options: []
|
169
188
|
require_paths:
|
170
189
|
- lib
|
@@ -172,15 +191,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
191
|
requirements:
|
173
192
|
- - ">="
|
174
193
|
- !ruby/object:Gem::Version
|
175
|
-
version: 2.
|
194
|
+
version: 2.5.0
|
176
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
196
|
requirements:
|
178
197
|
- - ">="
|
179
198
|
- !ruby/object:Gem::Version
|
180
199
|
version: '0'
|
181
200
|
requirements: []
|
182
|
-
rubygems_version: 3.
|
183
|
-
signing_key:
|
201
|
+
rubygems_version: 3.2.16
|
202
|
+
signing_key:
|
184
203
|
specification_version: 4
|
185
204
|
summary: Automatic Rails code style checking tool.
|
186
205
|
test_files: []
|