rubocop-rails 2.36.0 → 2.37.0
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/lib/rubocop/cop/mixin.rb +17 -0
- data/lib/rubocop/cop/rails/application_controller.rb +1 -2
- data/lib/rubocop/cop/rails/application_job.rb +1 -2
- data/lib/rubocop/cop/rails/application_mailer.rb +1 -2
- data/lib/rubocop/cop/rails/application_record.rb +1 -2
- data/lib/rubocop/cop/rails/attribute_default_block_value.rb +9 -0
- data/lib/rubocop/cop/rails/dangerous_column_names.rb +1 -2
- data/lib/rubocop/cop/rails/http_positional_arguments.rb +9 -3
- data/lib/rubocop/cop/rails/inverse_of.rb +1 -2
- data/lib/rubocop/cop/rails/output.rb +1 -2
- data/lib/rubocop/cop/rails/pluck.rb +1 -2
- data/lib/rubocop/cop/rails/redirect_back_or_to.rb +1 -2
- data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +1 -2
- data/lib/rubocop/cop/rails/save_bang.rb +2 -4
- data/lib/rubocop/cop/rails/select_map.rb +1 -2
- data/lib/rubocop/cop/rails/strong_parameters_expect.rb +2 -4
- data/lib/rubocop/cop/rails/where_equals.rb +1 -2
- data/lib/rubocop/cop/rails/where_missing.rb +1 -2
- data/lib/rubocop/cop/rails/where_not.rb +1 -2
- data/lib/rubocop/cop/rails/where_range.rb +1 -2
- data/lib/rubocop/cop/rails.rb +152 -0
- data/lib/rubocop/cop/rails_cops.rb +4 -148
- data/lib/rubocop/rails/version.rb +1 -1
- data/lib/rubocop-rails.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9258d56d31fc4adeef0526b551dbe652abe70dd4599debc25ee39be54b743330
|
|
4
|
+
data.tar.gz: ab2d60fe9b2a61ac47f8f15f8753fb60dd26e278d5452d23501f59a398fd7b0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ba4c487f87fdbd58130ba06fc0184c9c5b5dabe5ee3934aa03930c27467072a7f89ac77ba423fe89f69ad9739c2dfcbeac1bb947e64804757e6efbdb47b47a5
|
|
7
|
+
data.tar.gz: 223e0693edfd7de08b9d6a770fbdd7ced5c6422cab60d5074657ef65dd7b4ce538c8f61c37cc15156d63824e1d4060a654bca1fef7830d1b587e7ca84d516f62
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
# Autoloads mixin modules included by cops. Mixins are autoloaded to reduce the number of requires
|
|
6
|
+
# because they're used only when the relevant cop class is loaded.
|
|
7
|
+
autoload :ActiveRecordHelper, "#{__dir__}/mixin/active_record_helper"
|
|
8
|
+
autoload :ActiveRecordMigrationsHelper, "#{__dir__}/mixin/active_record_migrations_helper"
|
|
9
|
+
autoload :ClassSendNodeHelper, "#{__dir__}/mixin/class_send_node_helper"
|
|
10
|
+
autoload :DatabaseTypeResolvable, "#{__dir__}/mixin/database_type_resolvable"
|
|
11
|
+
autoload :EnforceSuperclass, "#{__dir__}/mixin/enforce_superclass"
|
|
12
|
+
autoload :IndexMethod, "#{__dir__}/mixin/index_method"
|
|
13
|
+
autoload :MigrationsHelper, "#{__dir__}/mixin/migrations_helper"
|
|
14
|
+
autoload :RoutesHelper, "#{__dir__}/mixin/routes_helper"
|
|
15
|
+
autoload :TargetRailsVersion, "#{__dir__}/mixin/target_rails_version"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -27,9 +27,8 @@ module RuboCop
|
|
|
27
27
|
SUPERCLASS = 'ApplicationController'
|
|
28
28
|
BASE_PATTERN = '(const (const {nil? cbase} :ActionController) :Base)'
|
|
29
29
|
|
|
30
|
-
# rubocop:disable Layout/ClassStructure
|
|
30
|
+
# rubocop:disable-next Layout/ClassStructure
|
|
31
31
|
include RuboCop::Cop::EnforceSuperclass
|
|
32
|
-
# rubocop:enable Layout/ClassStructure
|
|
33
32
|
end
|
|
34
33
|
end
|
|
35
34
|
end
|
|
@@ -30,9 +30,8 @@ module RuboCop
|
|
|
30
30
|
SUPERCLASS = 'ApplicationJob'
|
|
31
31
|
BASE_PATTERN = '(const (const {nil? cbase} :ActiveJob) :Base)'
|
|
32
32
|
|
|
33
|
-
# rubocop:disable Layout/ClassStructure
|
|
33
|
+
# rubocop:disable-next Layout/ClassStructure
|
|
34
34
|
include RuboCop::Cop::EnforceSuperclass
|
|
35
|
-
# rubocop:enable Layout/ClassStructure
|
|
36
35
|
|
|
37
36
|
def autocorrect(node)
|
|
38
37
|
lambda do |corrector|
|
|
@@ -30,9 +30,8 @@ module RuboCop
|
|
|
30
30
|
SUPERCLASS = 'ApplicationMailer'
|
|
31
31
|
BASE_PATTERN = '(const (const {nil? cbase} :ActionMailer) :Base)'
|
|
32
32
|
|
|
33
|
-
# rubocop:disable Layout/ClassStructure
|
|
33
|
+
# rubocop:disable-next Layout/ClassStructure
|
|
34
34
|
include RuboCop::Cop::EnforceSuperclass
|
|
35
|
-
# rubocop:enable Layout/ClassStructure
|
|
36
35
|
end
|
|
37
36
|
end
|
|
38
37
|
end
|
|
@@ -35,9 +35,8 @@ module RuboCop
|
|
|
35
35
|
SUPERCLASS = 'ApplicationRecord'
|
|
36
36
|
BASE_PATTERN = '(const (const {nil? cbase} :ActiveRecord) :Base)'
|
|
37
37
|
|
|
38
|
-
# rubocop:disable Layout/ClassStructure
|
|
38
|
+
# rubocop:disable-next Layout/ClassStructure
|
|
39
39
|
include RuboCop::Cop::EnforceSuperclass
|
|
40
|
-
# rubocop:enable Layout/ClassStructure
|
|
41
40
|
end
|
|
42
41
|
end
|
|
43
42
|
end
|
|
@@ -29,6 +29,11 @@ module RuboCop
|
|
|
29
29
|
# attribute :roles, :string, array: true, default: -> { [] }
|
|
30
30
|
# end
|
|
31
31
|
#
|
|
32
|
+
# # good
|
|
33
|
+
# class User < ApplicationRecord
|
|
34
|
+
# attribute :roles, :string, array: true, default: [].freeze
|
|
35
|
+
# end
|
|
36
|
+
#
|
|
32
37
|
# # bad
|
|
33
38
|
# class User < ApplicationRecord
|
|
34
39
|
# attribute :configuration, default: {}
|
|
@@ -71,10 +76,14 @@ module RuboCop
|
|
|
71
76
|
PATTERN
|
|
72
77
|
|
|
73
78
|
def_node_matcher :attribute, '(pair (sym :default) $_)'
|
|
79
|
+
def_node_matcher :frozen_literal_default?, <<~PATTERN
|
|
80
|
+
(send {(array) (hash)} :freeze)
|
|
81
|
+
PATTERN
|
|
74
82
|
|
|
75
83
|
def on_send(node)
|
|
76
84
|
default_attribute(node) do |attribute|
|
|
77
85
|
value = attribute.children.last
|
|
86
|
+
return if frozen_literal_default?(value)
|
|
78
87
|
return unless TYPE_OFFENDERS.any?(value.type)
|
|
79
88
|
|
|
80
89
|
add_offense(value) do |corrector|
|
|
@@ -34,7 +34,7 @@ module RuboCop
|
|
|
34
34
|
].to_set.freeze
|
|
35
35
|
|
|
36
36
|
# Generated from `ActiveRecord::AttributeMethods.dangerous_attribute_methods` on activerecord 7.1.3.
|
|
37
|
-
# rubocop:disable Metrics/CollectionLiteralLength
|
|
37
|
+
# rubocop:disable-next Metrics/CollectionLiteralLength
|
|
38
38
|
DANGEROUS_COLUMN_NAMES = %w[
|
|
39
39
|
__callbacks
|
|
40
40
|
__id__
|
|
@@ -406,7 +406,6 @@ module RuboCop
|
|
|
406
406
|
write_attribute
|
|
407
407
|
write_store_attribute
|
|
408
408
|
].freeze
|
|
409
|
-
# rubocop:enable Metrics/CollectionLiteralLength
|
|
410
409
|
|
|
411
410
|
MSG = 'Avoid dangerous column names.'
|
|
412
411
|
|
|
@@ -51,6 +51,10 @@ module RuboCop
|
|
|
51
51
|
(const {nil? cbase} :Rack) :Test) :Methods))
|
|
52
52
|
PATTERN
|
|
53
53
|
|
|
54
|
+
def on_new_investigation
|
|
55
|
+
@use_rack_test_methods = nil
|
|
56
|
+
end
|
|
57
|
+
|
|
54
58
|
def on_send(node)
|
|
55
59
|
return if in_routing_block?(node) || use_rack_test_methods?
|
|
56
60
|
|
|
@@ -81,13 +85,16 @@ module RuboCop
|
|
|
81
85
|
!!node.each_ancestor(:block).detect { |block| ROUTING_METHODS.include?(block.method_name) }
|
|
82
86
|
end
|
|
83
87
|
|
|
88
|
+
# The result is the same for every node in a file, so scan the AST only once.
|
|
84
89
|
def use_rack_test_methods?
|
|
85
|
-
|
|
90
|
+
return @use_rack_test_methods unless @use_rack_test_methods.nil?
|
|
91
|
+
|
|
92
|
+
@use_rack_test_methods = processed_source.ast.each_descendant(:send).any? do |node|
|
|
86
93
|
include_rack_test_methods?(node)
|
|
87
94
|
end
|
|
88
95
|
end
|
|
89
96
|
|
|
90
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
|
97
|
+
# rubocop:disable-next Metrics/CyclomaticComplexity
|
|
91
98
|
def needs_conversion?(data)
|
|
92
99
|
return false if data.forwarded_args_type? || forwarded_kwrestarg?(data)
|
|
93
100
|
return true unless data.hash_type?
|
|
@@ -97,7 +104,6 @@ module RuboCop
|
|
|
97
104
|
special_keyword_arg?(pair.key) || (format_arg?(pair.key) && data.pairs.one?)
|
|
98
105
|
end
|
|
99
106
|
end
|
|
100
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
101
107
|
|
|
102
108
|
def special_keyword_arg?(node)
|
|
103
109
|
node.sym_type? && KEYWORD_ARGS.include?(node.value)
|
|
@@ -178,7 +178,7 @@ module RuboCop
|
|
|
178
178
|
(pair (sym :inverse_of) nil)
|
|
179
179
|
PATTERN
|
|
180
180
|
|
|
181
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
181
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
182
182
|
def on_send(node)
|
|
183
183
|
recv, arguments = association_recv_arguments(node)
|
|
184
184
|
return unless arguments
|
|
@@ -197,7 +197,6 @@ module RuboCop
|
|
|
197
197
|
|
|
198
198
|
add_offense(node.loc.selector, message: message(options))
|
|
199
199
|
end
|
|
200
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
201
200
|
|
|
202
201
|
def scope?(arguments)
|
|
203
202
|
!ignore_scopes? && arguments.any?(&:block_type?)
|
|
@@ -38,7 +38,7 @@ module RuboCop
|
|
|
38
38
|
...)
|
|
39
39
|
PATTERN
|
|
40
40
|
|
|
41
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
|
41
|
+
# rubocop:disable-next Metrics/CyclomaticComplexity
|
|
42
42
|
def on_send(node)
|
|
43
43
|
return if node.parent&.call_type? || node.block_node
|
|
44
44
|
return if !output?(node) && !io_output?(node)
|
|
@@ -50,7 +50,6 @@ module RuboCop
|
|
|
50
50
|
corrector.replace(range, 'Rails.logger.debug')
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
54
53
|
|
|
55
54
|
private
|
|
56
55
|
|
|
@@ -62,7 +62,7 @@ module RuboCop
|
|
|
62
62
|
(any_block (call _ {:map :collect}) $_argument (send lvar :[] $_key))
|
|
63
63
|
PATTERN
|
|
64
64
|
|
|
65
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
65
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
66
66
|
def on_block(node)
|
|
67
67
|
return if node.each_ancestor(:any_block).first&.receiver
|
|
68
68
|
|
|
@@ -82,7 +82,6 @@ module RuboCop
|
|
|
82
82
|
register_offense(node, key)
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
86
85
|
alias on_numblock on_block
|
|
87
86
|
alias on_itblock on_block
|
|
88
87
|
|
|
@@ -47,7 +47,7 @@ module RuboCop
|
|
|
47
47
|
|
|
48
48
|
private
|
|
49
49
|
|
|
50
|
-
# rubocop:disable Metrics/AbcSize
|
|
50
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
51
51
|
def correct_redirect_back(corrector, node, fallback_pair, fallback_value, options)
|
|
52
52
|
corrector.replace(node.loc.selector, 'redirect_back_or_to')
|
|
53
53
|
|
|
@@ -64,7 +64,6 @@ module RuboCop
|
|
|
64
64
|
|
|
65
65
|
wrap_with_parentheses(node, corrector) unless node.parenthesized?
|
|
66
66
|
end
|
|
67
|
-
# rubocop:enable Metrics/AbcSize
|
|
68
67
|
|
|
69
68
|
def remove_fallback_location_pair(corrector, hash_node, fallback_pair)
|
|
70
69
|
pairs = hash_node.pairs
|
|
@@ -95,7 +95,7 @@ module RuboCop
|
|
|
95
95
|
corrector.remove(block_argument_range(send_node)) if node.block_type?
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
-
# rubocop:disable Metrics/AbcSize
|
|
98
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
99
99
|
def redundant_receiver?(send_nodes, node)
|
|
100
100
|
proc = if node.numblock_type?
|
|
101
101
|
->(n) { n.receiver.lvar_type? && n.receiver.source == '_1' }
|
|
@@ -110,7 +110,6 @@ module RuboCop
|
|
|
110
110
|
|
|
111
111
|
send_nodes.all?(&proc)
|
|
112
112
|
end
|
|
113
|
-
# rubocop:enable Metrics/AbcSize
|
|
114
113
|
|
|
115
114
|
def block_argument_range(node)
|
|
116
115
|
block_node = node.each_ancestor(:block).first
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# rubocop:disable Metrics/ClassLength
|
|
3
|
+
# rubocop:disable-next Metrics/ClassLength
|
|
4
4
|
module RuboCop
|
|
5
5
|
module Cop
|
|
6
6
|
module Rails
|
|
@@ -152,7 +152,7 @@ module RuboCop
|
|
|
152
152
|
register_offense(node, CREATE_MSG)
|
|
153
153
|
end
|
|
154
154
|
|
|
155
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
|
155
|
+
# rubocop:disable-next Metrics/CyclomaticComplexity
|
|
156
156
|
def on_send(node)
|
|
157
157
|
return unless persist_method?(node)
|
|
158
158
|
return if return_value_assigned?(node)
|
|
@@ -164,7 +164,6 @@ module RuboCop
|
|
|
164
164
|
|
|
165
165
|
register_offense(node, MSG)
|
|
166
166
|
end
|
|
167
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
|
168
167
|
alias on_csend on_send
|
|
169
168
|
|
|
170
169
|
private
|
|
@@ -356,4 +355,3 @@ module RuboCop
|
|
|
356
355
|
end
|
|
357
356
|
end
|
|
358
357
|
end
|
|
359
|
-
# rubocop:enable Metrics/ClassLength
|
|
@@ -58,7 +58,7 @@ module RuboCop
|
|
|
58
58
|
receiver_chain?(node, select_node) ? select_node : nil
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
# rubocop:disable Metrics/AbcSize
|
|
61
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
62
62
|
def autocorrect(corrector, select_node, node, preferred_method)
|
|
63
63
|
if (parent = select_node.parent).loc?(:dot)
|
|
64
64
|
corrector.remove(parent.loc.dot)
|
|
@@ -68,7 +68,6 @@ module RuboCop
|
|
|
68
68
|
corrector.replace(node, "#{select_node.receiver.source}.#{preferred_method}")
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
|
-
# rubocop:enable Metrics/AbcSize
|
|
72
71
|
|
|
73
72
|
def match_column_name?(select_candidate, column_name)
|
|
74
73
|
return false unless select_candidate.arguments.one?
|
|
@@ -109,7 +109,7 @@ module RuboCop
|
|
|
109
109
|
:require _require_param_name)
|
|
110
110
|
PATTERN
|
|
111
111
|
|
|
112
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
112
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/MethodLength
|
|
113
113
|
def on_send(node)
|
|
114
114
|
return if part_of_ignored_node?(node)
|
|
115
115
|
|
|
@@ -141,7 +141,6 @@ module RuboCop
|
|
|
141
141
|
|
|
142
142
|
ignore_node(node)
|
|
143
143
|
end
|
|
144
|
-
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
145
144
|
alias on_csend on_send
|
|
146
145
|
|
|
147
146
|
private
|
|
@@ -157,7 +156,7 @@ module RuboCop
|
|
|
157
156
|
end
|
|
158
157
|
end
|
|
159
158
|
|
|
160
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
159
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
161
160
|
def offensive_bracket_access?(node)
|
|
162
161
|
return false unless (parent = node.parent)
|
|
163
162
|
return false if parent.or_type?
|
|
@@ -174,7 +173,6 @@ module RuboCop
|
|
|
174
173
|
raising_finder_method?(parent)
|
|
175
174
|
end
|
|
176
175
|
end
|
|
177
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
178
176
|
|
|
179
177
|
def raising_finder_method?(node)
|
|
180
178
|
RAISING_FINDER_METHODS.include?(node.method_name)
|
|
@@ -74,7 +74,7 @@ module RuboCop
|
|
|
74
74
|
range_between(node.loc.selector.begin_pos, node.source_range.end_pos)
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
77
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
78
78
|
def extract_column_and_value(template_node, value_node)
|
|
79
79
|
value =
|
|
80
80
|
case template_node.value
|
|
@@ -96,7 +96,6 @@ module RuboCop
|
|
|
96
96
|
|
|
97
97
|
[column_qualifier, value]
|
|
98
98
|
end
|
|
99
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
100
99
|
|
|
101
100
|
def build_good_method(method_name, column, value)
|
|
102
101
|
if column.include?('.')
|
|
@@ -89,7 +89,7 @@ module RuboCop
|
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
# rubocop:disable Metrics/AbcSize
|
|
92
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
93
93
|
def remove_where_method(corrector, node, where_node)
|
|
94
94
|
range = range_between(where_node.loc.selector.begin_pos, where_node.loc.end.end_pos)
|
|
95
95
|
if node.multiline? && !same_line?(node, where_node)
|
|
@@ -102,7 +102,6 @@ module RuboCop
|
|
|
102
102
|
|
|
103
103
|
corrector.remove(range)
|
|
104
104
|
end
|
|
105
|
-
# rubocop:enable Metrics/AbcSize
|
|
106
105
|
|
|
107
106
|
def same_line?(left_joins_node, where_node)
|
|
108
107
|
left_joins_node.loc.selector.line == where_node.loc.selector.line
|
|
@@ -68,7 +68,7 @@ module RuboCop
|
|
|
68
68
|
range_between(node.loc.selector.begin_pos, node.source_range.end_pos)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
71
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
72
72
|
def extract_column_and_value(template_node, value_node)
|
|
73
73
|
value =
|
|
74
74
|
case template_node.value
|
|
@@ -90,7 +90,6 @@ module RuboCop
|
|
|
90
90
|
|
|
91
91
|
[column_qualifier, value]
|
|
92
92
|
end
|
|
93
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
|
94
93
|
|
|
95
94
|
def build_good_method(dot, column, value)
|
|
96
95
|
dot ||= '.'
|
|
@@ -92,7 +92,7 @@ module RuboCop
|
|
|
92
92
|
receiver&.send_type? && receiver.method?(:where)
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
# rubocop:disable Metrics
|
|
95
|
+
# rubocop:disable-next Metrics
|
|
96
96
|
def extract_column_and_value(template_node, values_node)
|
|
97
97
|
case template_node.value
|
|
98
98
|
when GTEQ_ANONYMOUS_RE
|
|
@@ -157,7 +157,6 @@ module RuboCop
|
|
|
157
157
|
|
|
158
158
|
[column_qualifier, "#{lhs_source}#{operator}#{rhs_source}"] if operator
|
|
159
159
|
end
|
|
160
|
-
# rubocop:enable Metrics
|
|
161
160
|
|
|
162
161
|
def range_operator(comparison_operator)
|
|
163
162
|
comparison_operator == '<' ? '...' : '..'
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'mixin'
|
|
4
|
+
|
|
5
|
+
module RuboCop
|
|
6
|
+
module Cop
|
|
7
|
+
# Cops for the `Rails` department. The department's cops are registered for lazy loading
|
|
8
|
+
# and their files are loaded on demand.
|
|
9
|
+
module Rails
|
|
10
|
+
extend LazyLoader
|
|
11
|
+
|
|
12
|
+
register_cop :ActionControllerFlashBeforeRender, "#{__dir__}/rails/action_controller_flash_before_render"
|
|
13
|
+
register_cop :StrongParametersExpect, "#{__dir__}/rails/strong_parameters_expect"
|
|
14
|
+
register_cop :ActionControllerTestCase, "#{__dir__}/rails/action_controller_test_case"
|
|
15
|
+
register_cop :ActionFilter, "#{__dir__}/rails/action_filter"
|
|
16
|
+
register_cop :ActionOrder, "#{__dir__}/rails/action_order"
|
|
17
|
+
register_cop :ActiveRecordAliases, "#{__dir__}/rails/active_record_aliases"
|
|
18
|
+
register_cop :ActiveRecordCallbacksOrder, "#{__dir__}/rails/active_record_callbacks_order"
|
|
19
|
+
register_cop :ActiveRecordOverride, "#{__dir__}/rails/active_record_override"
|
|
20
|
+
register_cop :ActiveSupportAliases, "#{__dir__}/rails/active_support_aliases"
|
|
21
|
+
register_cop :ActiveSupportOnLoad, "#{__dir__}/rails/active_support_on_load"
|
|
22
|
+
register_cop :AddColumnIndex, "#{__dir__}/rails/add_column_index"
|
|
23
|
+
register_cop :AfterCommitOverride, "#{__dir__}/rails/after_commit_override"
|
|
24
|
+
register_cop :ApplicationController, "#{__dir__}/rails/application_controller"
|
|
25
|
+
register_cop :ApplicationJob, "#{__dir__}/rails/application_job"
|
|
26
|
+
register_cop :ApplicationMailer, "#{__dir__}/rails/application_mailer"
|
|
27
|
+
register_cop :ApplicationRecord, "#{__dir__}/rails/application_record"
|
|
28
|
+
register_cop :ArelStar, "#{__dir__}/rails/arel_star"
|
|
29
|
+
register_cop :AssertNot, "#{__dir__}/rails/assert_not"
|
|
30
|
+
register_cop :AttributeDefaultBlockValue, "#{__dir__}/rails/attribute_default_block_value"
|
|
31
|
+
register_cop :BelongsTo, "#{__dir__}/rails/belongs_to"
|
|
32
|
+
register_cop :Blank, "#{__dir__}/rails/blank"
|
|
33
|
+
register_cop :BulkChangeTable, "#{__dir__}/rails/bulk_change_table"
|
|
34
|
+
register_cop :CompactBlank, "#{__dir__}/rails/compact_blank"
|
|
35
|
+
register_cop :ContentTag, "#{__dir__}/rails/content_tag"
|
|
36
|
+
register_cop :CreateTableWithTimestamps, "#{__dir__}/rails/create_table_with_timestamps"
|
|
37
|
+
register_cop :DangerousColumnNames, "#{__dir__}/rails/dangerous_column_names"
|
|
38
|
+
register_cop :Date, "#{__dir__}/rails/date"
|
|
39
|
+
register_cop :DefaultScope, "#{__dir__}/rails/default_scope"
|
|
40
|
+
register_cop :Delegate, "#{__dir__}/rails/delegate"
|
|
41
|
+
register_cop :DelegateAllowBlank, "#{__dir__}/rails/delegate_allow_blank"
|
|
42
|
+
register_cop :DeprecatedActiveModelErrorsMethods, "#{__dir__}/rails/deprecated_active_model_errors_methods"
|
|
43
|
+
register_cop :DotSeparatedKeys, "#{__dir__}/rails/dot_separated_keys"
|
|
44
|
+
register_cop :DuplicateAssociation, "#{__dir__}/rails/duplicate_association"
|
|
45
|
+
register_cop :DuplicateScope, "#{__dir__}/rails/duplicate_scope"
|
|
46
|
+
register_cop :DurationArithmetic, "#{__dir__}/rails/duration_arithmetic"
|
|
47
|
+
register_cop :DynamicFindBy, "#{__dir__}/rails/dynamic_find_by"
|
|
48
|
+
register_cop :EagerEvaluationLogMessage, "#{__dir__}/rails/eager_evaluation_log_message"
|
|
49
|
+
register_cop :EnumHash, "#{__dir__}/rails/enum_hash"
|
|
50
|
+
register_cop :EnumSyntax, "#{__dir__}/rails/enum_syntax"
|
|
51
|
+
register_cop :EnumUniqueness, "#{__dir__}/rails/enum_uniqueness"
|
|
52
|
+
register_cop :Env, "#{__dir__}/rails/env"
|
|
53
|
+
register_cop :EnvLocal, "#{__dir__}/rails/env_local"
|
|
54
|
+
register_cop :EnvironmentComparison, "#{__dir__}/rails/environment_comparison"
|
|
55
|
+
register_cop :EnvironmentVariableAccess, "#{__dir__}/rails/environment_variable_access"
|
|
56
|
+
register_cop :Exit, "#{__dir__}/rails/exit"
|
|
57
|
+
register_cop :ExpandedDateRange, "#{__dir__}/rails/expanded_date_range"
|
|
58
|
+
register_cop :FilePath, "#{__dir__}/rails/file_path"
|
|
59
|
+
register_cop :FindBy, "#{__dir__}/rails/find_by"
|
|
60
|
+
register_cop :FindById, "#{__dir__}/rails/find_by_id"
|
|
61
|
+
register_cop :FindByOrAssignmentMemoization, "#{__dir__}/rails/find_by_or_assignment_memoization"
|
|
62
|
+
register_cop :FindEach, "#{__dir__}/rails/find_each"
|
|
63
|
+
register_cop :FreezeTime, "#{__dir__}/rails/freeze_time"
|
|
64
|
+
register_cop :HasAndBelongsToMany, "#{__dir__}/rails/has_and_belongs_to_many"
|
|
65
|
+
register_cop :HasManyOrHasOneDependent, "#{__dir__}/rails/has_many_or_has_one_dependent"
|
|
66
|
+
register_cop :HelperInstanceVariable, "#{__dir__}/rails/helper_instance_variable"
|
|
67
|
+
register_cop :HttpPositionalArguments, "#{__dir__}/rails/http_positional_arguments"
|
|
68
|
+
register_cop :HttpStatus, "#{__dir__}/rails/http_status"
|
|
69
|
+
register_cop :HttpStatusNameConsistency, "#{__dir__}/rails/http_status_name_consistency"
|
|
70
|
+
register_cop :I18nLazyLookup, "#{__dir__}/rails/i18n_lazy_lookup"
|
|
71
|
+
register_cop :I18nLocaleAssignment, "#{__dir__}/rails/i18n_locale_assignment"
|
|
72
|
+
register_cop :I18nLocaleTexts, "#{__dir__}/rails/i18n_locale_texts"
|
|
73
|
+
register_cop :IgnoredColumnsAssignment, "#{__dir__}/rails/ignored_columns_assignment"
|
|
74
|
+
register_cop :IgnoredSkipActionFilterOption, "#{__dir__}/rails/ignored_skip_action_filter_option"
|
|
75
|
+
register_cop :IndexBy, "#{__dir__}/rails/index_by"
|
|
76
|
+
register_cop :IndexWith, "#{__dir__}/rails/index_with"
|
|
77
|
+
register_cop :Inquiry, "#{__dir__}/rails/inquiry"
|
|
78
|
+
register_cop :InverseOf, "#{__dir__}/rails/inverse_of"
|
|
79
|
+
register_cop :LexicallyScopedActionFilter, "#{__dir__}/rails/lexically_scoped_action_filter"
|
|
80
|
+
register_cop :LinkToBlank, "#{__dir__}/rails/link_to_blank"
|
|
81
|
+
register_cop :MailerName, "#{__dir__}/rails/mailer_name"
|
|
82
|
+
register_cop :MatchRoute, "#{__dir__}/rails/match_route"
|
|
83
|
+
register_cop :MigrationClassName, "#{__dir__}/rails/migration_class_name"
|
|
84
|
+
register_cop :MultipleRoutePaths, "#{__dir__}/rails/multiple_route_paths"
|
|
85
|
+
register_cop :NegateInclude, "#{__dir__}/rails/negate_include"
|
|
86
|
+
register_cop :NotNullColumn, "#{__dir__}/rails/not_null_column"
|
|
87
|
+
register_cop :OrderArguments, "#{__dir__}/rails/order_arguments"
|
|
88
|
+
register_cop :OrderById, "#{__dir__}/rails/order_by_id"
|
|
89
|
+
register_cop :Output, "#{__dir__}/rails/output"
|
|
90
|
+
register_cop :OutputSafety, "#{__dir__}/rails/output_safety"
|
|
91
|
+
register_cop :Pick, "#{__dir__}/rails/pick"
|
|
92
|
+
register_cop :Pluck, "#{__dir__}/rails/pluck"
|
|
93
|
+
register_cop :PluckId, "#{__dir__}/rails/pluck_id"
|
|
94
|
+
register_cop :PluckInWhere, "#{__dir__}/rails/pluck_in_where"
|
|
95
|
+
register_cop :PluralizationGrammar, "#{__dir__}/rails/pluralization_grammar"
|
|
96
|
+
register_cop :Presence, "#{__dir__}/rails/presence"
|
|
97
|
+
register_cop :Present, "#{__dir__}/rails/present"
|
|
98
|
+
register_cop :RakeEnvironment, "#{__dir__}/rails/rake_environment"
|
|
99
|
+
register_cop :ReadWriteAttribute, "#{__dir__}/rails/read_write_attribute"
|
|
100
|
+
register_cop :RedundantActiveRecordAllMethod, "#{__dir__}/rails/redundant_active_record_all_method"
|
|
101
|
+
register_cop :RedundantAllowNil, "#{__dir__}/rails/redundant_allow_nil"
|
|
102
|
+
register_cop :RedundantForeignKey, "#{__dir__}/rails/redundant_foreign_key"
|
|
103
|
+
register_cop :RedundantPresenceValidationOnBelongsTo, "#{__dir__}/rails/redundant_presence_validation_on_belongs_to"
|
|
104
|
+
register_cop :RedundantReceiverInWithOptions, "#{__dir__}/rails/redundant_receiver_in_with_options"
|
|
105
|
+
register_cop :RedundantTravelBack, "#{__dir__}/rails/redundant_travel_back"
|
|
106
|
+
register_cop :RedirectBackOrTo, "#{__dir__}/rails/redirect_back_or_to"
|
|
107
|
+
register_cop :ReflectionClassName, "#{__dir__}/rails/reflection_class_name"
|
|
108
|
+
register_cop :RefuteMethods, "#{__dir__}/rails/refute_methods"
|
|
109
|
+
register_cop :RelativeDateConstant, "#{__dir__}/rails/relative_date_constant"
|
|
110
|
+
register_cop :RenderInline, "#{__dir__}/rails/render_inline"
|
|
111
|
+
register_cop :RenderPlainText, "#{__dir__}/rails/render_plain_text"
|
|
112
|
+
register_cop :RequestReferer, "#{__dir__}/rails/request_referer"
|
|
113
|
+
register_cop :RequireDependency, "#{__dir__}/rails/require_dependency"
|
|
114
|
+
register_cop :ResponseParsedBody, "#{__dir__}/rails/response_parsed_body"
|
|
115
|
+
register_cop :ReversibleMigration, "#{__dir__}/rails/reversible_migration"
|
|
116
|
+
register_cop :ReversibleMigrationMethodDefinition, "#{__dir__}/rails/reversible_migration_method_definition"
|
|
117
|
+
register_cop :RootJoinChain, "#{__dir__}/rails/root_join_chain"
|
|
118
|
+
register_cop :RootPathnameMethods, "#{__dir__}/rails/root_pathname_methods"
|
|
119
|
+
register_cop :RootPublicPath, "#{__dir__}/rails/root_public_path"
|
|
120
|
+
register_cop :SafeNavigation, "#{__dir__}/rails/safe_navigation"
|
|
121
|
+
register_cop :SafeNavigationWithBlank, "#{__dir__}/rails/safe_navigation_with_blank"
|
|
122
|
+
register_cop :SaveBang, "#{__dir__}/rails/save_bang"
|
|
123
|
+
register_cop :SchemaComment, "#{__dir__}/rails/schema_comment"
|
|
124
|
+
register_cop :ScopeArgs, "#{__dir__}/rails/scope_args"
|
|
125
|
+
register_cop :SelectMap, "#{__dir__}/rails/select_map"
|
|
126
|
+
register_cop :ShortI18n, "#{__dir__}/rails/short_i18n"
|
|
127
|
+
register_cop :SkipsModelValidations, "#{__dir__}/rails/skips_model_validations"
|
|
128
|
+
register_cop :SquishedSQLHeredocs, "#{__dir__}/rails/squished_sql_heredocs"
|
|
129
|
+
register_cop :StripHeredoc, "#{__dir__}/rails/strip_heredoc"
|
|
130
|
+
register_cop :TableNameAssignment, "#{__dir__}/rails/table_name_assignment"
|
|
131
|
+
register_cop :ThreeStateBooleanColumn, "#{__dir__}/rails/three_state_boolean_column"
|
|
132
|
+
register_cop :TimeZone, "#{__dir__}/rails/time_zone"
|
|
133
|
+
register_cop :TimeZoneAssignment, "#{__dir__}/rails/time_zone_assignment"
|
|
134
|
+
register_cop :ToFormattedS, "#{__dir__}/rails/to_formatted_s"
|
|
135
|
+
register_cop :ToSWithArgument, "#{__dir__}/rails/to_s_with_argument"
|
|
136
|
+
register_cop :TopLevelHashWithIndifferentAccess, "#{__dir__}/rails/top_level_hash_with_indifferent_access"
|
|
137
|
+
register_cop :TransactionExitStatement, "#{__dir__}/rails/transaction_exit_statement"
|
|
138
|
+
register_cop :UniqBeforePluck, "#{__dir__}/rails/uniq_before_pluck"
|
|
139
|
+
register_cop :UniqueValidationWithoutIndex, "#{__dir__}/rails/unique_validation_without_index"
|
|
140
|
+
register_cop :UnknownEnv, "#{__dir__}/rails/unknown_env"
|
|
141
|
+
register_cop :UnusedIgnoredColumns, "#{__dir__}/rails/unused_ignored_columns"
|
|
142
|
+
register_cop :UnusedRenderContent, "#{__dir__}/rails/unused_render_content"
|
|
143
|
+
register_cop :Validation, "#{__dir__}/rails/validation"
|
|
144
|
+
register_cop :WhereEquals, "#{__dir__}/rails/where_equals"
|
|
145
|
+
register_cop :WhereExists, "#{__dir__}/rails/where_exists"
|
|
146
|
+
register_cop :WhereMissing, "#{__dir__}/rails/where_missing"
|
|
147
|
+
register_cop :WhereNot, "#{__dir__}/rails/where_not"
|
|
148
|
+
register_cop :WhereNotWithMultipleConditions, "#{__dir__}/rails/where_not_with_multiple_conditions"
|
|
149
|
+
register_cop :WhereRange, "#{__dir__}/rails/where_range"
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
@@ -1,150 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
require_relative '
|
|
7
|
-
require_relative 'mixin/enforce_superclass'
|
|
8
|
-
require_relative 'mixin/index_method'
|
|
9
|
-
require_relative 'mixin/migrations_helper'
|
|
10
|
-
require_relative 'mixin/routes_helper'
|
|
11
|
-
require_relative 'mixin/target_rails_version'
|
|
12
|
-
|
|
13
|
-
require_relative 'rails/action_controller_flash_before_render'
|
|
14
|
-
require_relative 'rails/strong_parameters_expect'
|
|
15
|
-
require_relative 'rails/action_controller_test_case'
|
|
16
|
-
require_relative 'rails/action_filter'
|
|
17
|
-
require_relative 'rails/action_order'
|
|
18
|
-
require_relative 'rails/active_record_aliases'
|
|
19
|
-
require_relative 'rails/active_record_callbacks_order'
|
|
20
|
-
require_relative 'rails/active_record_override'
|
|
21
|
-
require_relative 'rails/active_support_aliases'
|
|
22
|
-
require_relative 'rails/active_support_on_load'
|
|
23
|
-
require_relative 'rails/add_column_index'
|
|
24
|
-
require_relative 'rails/after_commit_override'
|
|
25
|
-
require_relative 'rails/application_controller'
|
|
26
|
-
require_relative 'rails/application_job'
|
|
27
|
-
require_relative 'rails/application_mailer'
|
|
28
|
-
require_relative 'rails/application_record'
|
|
29
|
-
require_relative 'rails/arel_star'
|
|
30
|
-
require_relative 'rails/assert_not'
|
|
31
|
-
require_relative 'rails/attribute_default_block_value'
|
|
32
|
-
require_relative 'rails/belongs_to'
|
|
33
|
-
require_relative 'rails/blank'
|
|
34
|
-
require_relative 'rails/bulk_change_table'
|
|
35
|
-
require_relative 'rails/compact_blank'
|
|
36
|
-
require_relative 'rails/content_tag'
|
|
37
|
-
require_relative 'rails/create_table_with_timestamps'
|
|
38
|
-
require_relative 'rails/dangerous_column_names'
|
|
39
|
-
require_relative 'rails/date'
|
|
40
|
-
require_relative 'rails/default_scope'
|
|
41
|
-
require_relative 'rails/delegate'
|
|
42
|
-
require_relative 'rails/delegate_allow_blank'
|
|
43
|
-
require_relative 'rails/deprecated_active_model_errors_methods'
|
|
44
|
-
require_relative 'rails/dot_separated_keys'
|
|
45
|
-
require_relative 'rails/duplicate_association'
|
|
46
|
-
require_relative 'rails/duplicate_scope'
|
|
47
|
-
require_relative 'rails/duration_arithmetic'
|
|
48
|
-
require_relative 'rails/dynamic_find_by'
|
|
49
|
-
require_relative 'rails/eager_evaluation_log_message'
|
|
50
|
-
require_relative 'rails/enum_hash'
|
|
51
|
-
require_relative 'rails/enum_syntax'
|
|
52
|
-
require_relative 'rails/enum_uniqueness'
|
|
53
|
-
require_relative 'rails/env'
|
|
54
|
-
require_relative 'rails/env_local'
|
|
55
|
-
require_relative 'rails/environment_comparison'
|
|
56
|
-
require_relative 'rails/environment_variable_access'
|
|
57
|
-
require_relative 'rails/exit'
|
|
58
|
-
require_relative 'rails/expanded_date_range'
|
|
59
|
-
require_relative 'rails/file_path'
|
|
60
|
-
require_relative 'rails/find_by'
|
|
61
|
-
require_relative 'rails/find_by_id'
|
|
62
|
-
require_relative 'rails/find_by_or_assignment_memoization'
|
|
63
|
-
require_relative 'rails/find_each'
|
|
64
|
-
require_relative 'rails/freeze_time'
|
|
65
|
-
require_relative 'rails/has_and_belongs_to_many'
|
|
66
|
-
require_relative 'rails/has_many_or_has_one_dependent'
|
|
67
|
-
require_relative 'rails/helper_instance_variable'
|
|
68
|
-
require_relative 'rails/http_positional_arguments'
|
|
69
|
-
require_relative 'rails/http_status'
|
|
70
|
-
require_relative 'rails/http_status_name_consistency'
|
|
71
|
-
require_relative 'rails/i18n_lazy_lookup'
|
|
72
|
-
require_relative 'rails/i18n_locale_assignment'
|
|
73
|
-
require_relative 'rails/i18n_locale_texts'
|
|
74
|
-
require_relative 'rails/ignored_columns_assignment'
|
|
75
|
-
require_relative 'rails/ignored_skip_action_filter_option'
|
|
76
|
-
require_relative 'rails/index_by'
|
|
77
|
-
require_relative 'rails/index_with'
|
|
78
|
-
require_relative 'rails/inquiry'
|
|
79
|
-
require_relative 'rails/inverse_of'
|
|
80
|
-
require_relative 'rails/lexically_scoped_action_filter'
|
|
81
|
-
require_relative 'rails/link_to_blank'
|
|
82
|
-
require_relative 'rails/mailer_name'
|
|
83
|
-
require_relative 'rails/match_route'
|
|
84
|
-
require_relative 'rails/migration_class_name'
|
|
85
|
-
require_relative 'rails/multiple_route_paths'
|
|
86
|
-
require_relative 'rails/negate_include'
|
|
87
|
-
require_relative 'rails/not_null_column'
|
|
88
|
-
require_relative 'rails/order_arguments'
|
|
89
|
-
require_relative 'rails/order_by_id'
|
|
90
|
-
require_relative 'rails/output'
|
|
91
|
-
require_relative 'rails/output_safety'
|
|
92
|
-
require_relative 'rails/pick'
|
|
93
|
-
require_relative 'rails/pluck'
|
|
94
|
-
require_relative 'rails/pluck_id'
|
|
95
|
-
require_relative 'rails/pluck_in_where'
|
|
96
|
-
require_relative 'rails/pluralization_grammar'
|
|
97
|
-
require_relative 'rails/presence'
|
|
98
|
-
require_relative 'rails/present'
|
|
99
|
-
require_relative 'rails/rake_environment'
|
|
100
|
-
require_relative 'rails/read_write_attribute'
|
|
101
|
-
require_relative 'rails/redundant_active_record_all_method'
|
|
102
|
-
require_relative 'rails/redundant_allow_nil'
|
|
103
|
-
require_relative 'rails/redundant_foreign_key'
|
|
104
|
-
require_relative 'rails/redundant_presence_validation_on_belongs_to'
|
|
105
|
-
require_relative 'rails/redundant_receiver_in_with_options'
|
|
106
|
-
require_relative 'rails/redundant_travel_back'
|
|
107
|
-
require_relative 'rails/redirect_back_or_to'
|
|
108
|
-
require_relative 'rails/reflection_class_name'
|
|
109
|
-
require_relative 'rails/refute_methods'
|
|
110
|
-
require_relative 'rails/relative_date_constant'
|
|
111
|
-
require_relative 'rails/render_inline'
|
|
112
|
-
require_relative 'rails/render_plain_text'
|
|
113
|
-
require_relative 'rails/request_referer'
|
|
114
|
-
require_relative 'rails/require_dependency'
|
|
115
|
-
require_relative 'rails/response_parsed_body'
|
|
116
|
-
require_relative 'rails/reversible_migration'
|
|
117
|
-
require_relative 'rails/reversible_migration_method_definition'
|
|
118
|
-
require_relative 'rails/root_join_chain'
|
|
119
|
-
require_relative 'rails/root_pathname_methods'
|
|
120
|
-
require_relative 'rails/root_public_path'
|
|
121
|
-
require_relative 'rails/safe_navigation'
|
|
122
|
-
require_relative 'rails/safe_navigation_with_blank'
|
|
123
|
-
require_relative 'rails/save_bang'
|
|
124
|
-
require_relative 'rails/schema_comment'
|
|
125
|
-
require_relative 'rails/scope_args'
|
|
126
|
-
require_relative 'rails/select_map'
|
|
127
|
-
require_relative 'rails/short_i18n'
|
|
128
|
-
require_relative 'rails/skips_model_validations'
|
|
129
|
-
require_relative 'rails/squished_sql_heredocs'
|
|
130
|
-
require_relative 'rails/strip_heredoc'
|
|
131
|
-
require_relative 'rails/table_name_assignment'
|
|
132
|
-
require_relative 'rails/three_state_boolean_column'
|
|
133
|
-
require_relative 'rails/time_zone'
|
|
134
|
-
require_relative 'rails/time_zone_assignment'
|
|
135
|
-
require_relative 'rails/to_formatted_s'
|
|
136
|
-
require_relative 'rails/to_s_with_argument'
|
|
137
|
-
require_relative 'rails/top_level_hash_with_indifferent_access'
|
|
138
|
-
require_relative 'rails/transaction_exit_statement'
|
|
139
|
-
require_relative 'rails/uniq_before_pluck'
|
|
140
|
-
require_relative 'rails/unique_validation_without_index'
|
|
141
|
-
require_relative 'rails/unknown_env'
|
|
142
|
-
require_relative 'rails/unused_ignored_columns'
|
|
143
|
-
require_relative 'rails/unused_render_content'
|
|
144
|
-
require_relative 'rails/validation'
|
|
145
|
-
require_relative 'rails/where_equals'
|
|
146
|
-
require_relative 'rails/where_exists'
|
|
147
|
-
require_relative 'rails/where_missing'
|
|
148
|
-
require_relative 'rails/where_not'
|
|
149
|
-
require_relative 'rails/where_not_with_multiple_conditions'
|
|
150
|
-
require_relative 'rails/where_range'
|
|
3
|
+
# @deprecated This file is deprecated. Cops are registered for lazy loading in
|
|
4
|
+
# `rubocop/cop/rails`; this file is kept for compatibility with code that
|
|
5
|
+
# requires it directly.
|
|
6
|
+
require_relative 'rails'
|
data/lib/rubocop-rails.rb
CHANGED
|
@@ -9,7 +9,7 @@ require_relative 'rubocop/rails/version'
|
|
|
9
9
|
require_relative 'rubocop/rails/schema_loader'
|
|
10
10
|
require_relative 'rubocop/rails/schema_loader/schema'
|
|
11
11
|
require_relative 'rubocop/rails/plugin'
|
|
12
|
-
require_relative 'rubocop/cop/
|
|
12
|
+
require_relative 'rubocop/cop/rails'
|
|
13
13
|
|
|
14
14
|
require_relative 'rubocop/rails/migration_file_skippable'
|
|
15
15
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubocop-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.37.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bozhidar Batsov
|
|
@@ -59,7 +59,7 @@ dependencies:
|
|
|
59
59
|
requirements:
|
|
60
60
|
- - ">="
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: 1.
|
|
62
|
+
version: 1.89.0
|
|
63
63
|
- - "<"
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
65
|
version: '2.0'
|
|
@@ -69,7 +69,7 @@ dependencies:
|
|
|
69
69
|
requirements:
|
|
70
70
|
- - ">="
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: 1.
|
|
72
|
+
version: 1.89.0
|
|
73
73
|
- - "<"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: '2.0'
|
|
@@ -108,6 +108,7 @@ files:
|
|
|
108
108
|
- config/default.yml
|
|
109
109
|
- config/obsoletion.yml
|
|
110
110
|
- lib/rubocop-rails.rb
|
|
111
|
+
- lib/rubocop/cop/mixin.rb
|
|
111
112
|
- lib/rubocop/cop/mixin/active_record_helper.rb
|
|
112
113
|
- lib/rubocop/cop/mixin/active_record_migrations_helper.rb
|
|
113
114
|
- lib/rubocop/cop/mixin/class_send_node_helper.rb
|
|
@@ -117,6 +118,7 @@ files:
|
|
|
117
118
|
- lib/rubocop/cop/mixin/migrations_helper.rb
|
|
118
119
|
- lib/rubocop/cop/mixin/routes_helper.rb
|
|
119
120
|
- lib/rubocop/cop/mixin/target_rails_version.rb
|
|
121
|
+
- lib/rubocop/cop/rails.rb
|
|
120
122
|
- lib/rubocop/cop/rails/action_controller_flash_before_render.rb
|
|
121
123
|
- lib/rubocop/cop/rails/action_controller_test_case.rb
|
|
122
124
|
- lib/rubocop/cop/rails/action_filter.rb
|
|
@@ -269,7 +271,7 @@ metadata:
|
|
|
269
271
|
homepage_uri: https://docs.rubocop.org/rubocop-rails/
|
|
270
272
|
changelog_uri: https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md
|
|
271
273
|
source_code_uri: https://github.com/rubocop/rubocop-rails/
|
|
272
|
-
documentation_uri: https://docs.rubocop.org/rubocop-rails/2.
|
|
274
|
+
documentation_uri: https://docs.rubocop.org/rubocop-rails/2.37/
|
|
273
275
|
bug_tracker_uri: https://github.com/rubocop/rubocop-rails/issues
|
|
274
276
|
rubygems_mfa_required: 'true'
|
|
275
277
|
default_lint_roller_plugin: RuboCop::Rails::Plugin
|