rubocop-rails 2.29.0 → 2.31.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/README.md +9 -7
- data/config/default.yml +18 -2
- data/lib/rubocop/cop/mixin/active_record_helper.rb +2 -2
- data/lib/rubocop/cop/mixin/active_record_migrations_helper.rb +2 -2
- data/lib/rubocop/cop/mixin/database_type_resolvable.rb +2 -2
- data/lib/rubocop/cop/mixin/enforce_superclass.rb +6 -1
- data/lib/rubocop/cop/mixin/index_method.rb +66 -65
- data/lib/rubocop/cop/rails/arel_star.rb +5 -5
- data/lib/rubocop/cop/rails/belongs_to.rb +1 -1
- data/lib/rubocop/cop/rails/blank.rb +1 -1
- data/lib/rubocop/cop/rails/content_tag.rb +1 -1
- data/lib/rubocop/cop/rails/delegate.rb +53 -7
- data/lib/rubocop/cop/rails/duplicate_association.rb +8 -4
- data/lib/rubocop/cop/rails/eager_evaluation_log_message.rb +1 -3
- data/lib/rubocop/cop/rails/file_path.rb +58 -9
- data/lib/rubocop/cop/rails/index_by.rb +9 -0
- data/lib/rubocop/cop/rails/index_with.rb +9 -0
- data/lib/rubocop/cop/rails/inquiry.rb +1 -1
- data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +11 -1
- data/lib/rubocop/cop/rails/output.rb +1 -2
- data/lib/rubocop/cop/rails/pluck.rb +11 -5
- data/lib/rubocop/cop/rails/pluralization_grammar.rb +1 -1
- data/lib/rubocop/cop/rails/presence.rb +1 -1
- data/lib/rubocop/cop/rails/present.rb +1 -1
- data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +6 -1
- data/lib/rubocop/cop/rails/reflection_class_name.rb +2 -2
- data/lib/rubocop/cop/rails/relative_date_constant.rb +1 -1
- data/lib/rubocop/cop/rails/reversible_migration.rb +2 -1
- data/lib/rubocop/cop/rails/root_pathname_methods.rb +6 -1
- data/lib/rubocop/cop/rails/save_bang.rb +7 -6
- data/lib/rubocop/cop/rails/schema_comment.rb +1 -1
- data/lib/rubocop/cop/rails/skips_model_validations.rb +1 -1
- data/lib/rubocop/cop/rails/strip_heredoc.rb +1 -1
- data/lib/rubocop/cop/rails/strong_parameters_expect.rb +2 -2
- data/lib/rubocop/cop/rails/transaction_exit_statement.rb +2 -2
- data/lib/rubocop/cop/rails/uniq_before_pluck.rb +10 -33
- data/lib/rubocop/cop/rails/unique_validation_without_index.rb +1 -1
- data/lib/rubocop/rails/plugin.rb +48 -0
- data/lib/rubocop/rails/version.rb +1 -1
- data/lib/rubocop/rails.rb +1 -7
- data/lib/rubocop-rails.rb +1 -5
- metadata +23 -8
- data/lib/rubocop/rails/inject.rb +0 -18
@@ -40,6 +40,9 @@ module RuboCop
|
|
40
40
|
(numblock
|
41
41
|
(call _ :to_h) $1
|
42
42
|
(array (lvar :_1) $_))
|
43
|
+
(itblock
|
44
|
+
(call _ :to_h) $:it
|
45
|
+
(array (lvar :it) $_))
|
43
46
|
}
|
44
47
|
PATTERN
|
45
48
|
|
@@ -53,6 +56,9 @@ module RuboCop
|
|
53
56
|
(numblock
|
54
57
|
(call _ {:map :collect}) $1
|
55
58
|
(array (lvar :_1) $_))
|
59
|
+
(itblock
|
60
|
+
(call _ {:map :collect}) $:it
|
61
|
+
(array (lvar :it) $_))
|
56
62
|
}
|
57
63
|
:to_h)
|
58
64
|
PATTERN
|
@@ -69,6 +75,9 @@ module RuboCop
|
|
69
75
|
(numblock
|
70
76
|
(call _ {:map :collect}) $1
|
71
77
|
(array (lvar :_1) $_))
|
78
|
+
(itblock
|
79
|
+
(call _ {:map :collect}) $:it
|
80
|
+
(array (lvar :it) $_))
|
72
81
|
}
|
73
82
|
)
|
74
83
|
PATTERN
|
@@ -29,7 +29,7 @@ module RuboCop
|
|
29
29
|
def on_send(node)
|
30
30
|
return unless node.arguments.empty?
|
31
31
|
return unless (receiver = node.receiver)
|
32
|
-
return
|
32
|
+
return unless receiver.type?(:str, :array)
|
33
33
|
|
34
34
|
add_offense(node.loc.selector)
|
35
35
|
end
|
@@ -115,6 +115,10 @@ module RuboCop
|
|
115
115
|
$_)))
|
116
116
|
PATTERN
|
117
117
|
|
118
|
+
def_node_matcher :delegated_methods, <<~PATTERN
|
119
|
+
(send nil? :delegate (sym $_)+ (hash <(pair (sym :to) _) ...>))
|
120
|
+
PATTERN
|
121
|
+
|
118
122
|
def on_send(node)
|
119
123
|
methods_node = only_or_except_filter_methods(node)
|
120
124
|
return unless methods_node
|
@@ -139,7 +143,13 @@ module RuboCop
|
|
139
143
|
return [] unless block
|
140
144
|
|
141
145
|
defined_methods = block.each_child_node(:def).map(&:method_name)
|
142
|
-
defined_methods + aliased_action_methods(block, defined_methods)
|
146
|
+
defined_methods + delegated_action_methods(block) + aliased_action_methods(block, defined_methods)
|
147
|
+
end
|
148
|
+
|
149
|
+
def delegated_action_methods(node)
|
150
|
+
node.each_child_node(:send).flat_map do |child_node|
|
151
|
+
delegated_methods(child_node) || []
|
152
|
+
end
|
143
153
|
end
|
144
154
|
|
145
155
|
def aliased_action_methods(node, defined_methods)
|
@@ -23,7 +23,6 @@ module RuboCop
|
|
23
23
|
|
24
24
|
MSG = "Do not write to stdout. Use Rails's logger if you want to log."
|
25
25
|
RESTRICT_ON_SEND = %i[ap p pp pretty_print print puts binwrite syswrite write write_nonblock].freeze
|
26
|
-
ALLOWED_TYPES = %i[send csend block numblock].freeze
|
27
26
|
|
28
27
|
def_node_matcher :output?, <<~PATTERN
|
29
28
|
(send nil? {:ap :p :pp :pretty_print :print :puts} ...)
|
@@ -40,7 +39,7 @@ module RuboCop
|
|
40
39
|
PATTERN
|
41
40
|
|
42
41
|
def on_send(node)
|
43
|
-
return if
|
42
|
+
return if node.parent&.call_type? || node.block_node
|
44
43
|
return if !output?(node) && !io_output?(node)
|
45
44
|
|
46
45
|
range = offense_range(node)
|
@@ -56,11 +56,12 @@ module RuboCop
|
|
56
56
|
minimum_target_rails_version 5.0
|
57
57
|
|
58
58
|
def_node_matcher :pluck_candidate?, <<~PATTERN
|
59
|
-
(
|
59
|
+
(any_block (call _ {:map :collect}) $_argument (send lvar :[] $_key))
|
60
60
|
PATTERN
|
61
61
|
|
62
|
+
# rubocop:disable Metrics/AbcSize
|
62
63
|
def on_block(node)
|
63
|
-
return if node.each_ancestor(:
|
64
|
+
return if node.each_ancestor(:any_block).any?
|
64
65
|
|
65
66
|
pluck_candidate?(node) do |argument, key|
|
66
67
|
next if key.regexp_type? || !use_one_block_argument?(argument)
|
@@ -68,20 +69,25 @@ module RuboCop
|
|
68
69
|
match = if node.block_type?
|
69
70
|
block_argument = argument.children.first.source
|
70
71
|
use_block_argument_in_key?(block_argument, key)
|
71
|
-
|
72
|
-
|
72
|
+
elsif node.numblock_type?
|
73
|
+
use_block_argument_in_key?('_1', key)
|
74
|
+
else # itblock
|
75
|
+
use_block_argument_in_key?('it', key)
|
73
76
|
end
|
74
77
|
next unless match
|
75
78
|
|
76
79
|
register_offense(node, key)
|
77
80
|
end
|
78
81
|
end
|
82
|
+
# rubocop:enable Metrics/AbcSize
|
79
83
|
alias on_numblock on_block
|
84
|
+
alias on_itblock on_block
|
80
85
|
|
81
86
|
private
|
82
87
|
|
83
88
|
def use_one_block_argument?(argument)
|
84
|
-
|
89
|
+
# Checks for numbered argument `_1` or `it block parameter.
|
90
|
+
return true if [1, :it].include?(argument)
|
85
91
|
|
86
92
|
argument.respond_to?(:one?) && argument.one?
|
87
93
|
end
|
@@ -110,7 +110,7 @@ module RuboCop
|
|
110
110
|
def on_if(node)
|
111
111
|
return unless cop_config['UnlessBlank']
|
112
112
|
return unless node.unless?
|
113
|
-
return if node.else? && config.
|
113
|
+
return if node.else? && config.cop_enabled?('Style/UnlessElse')
|
114
114
|
|
115
115
|
unless_blank?(node) do |method_call, receiver|
|
116
116
|
range = unless_condition(node, method_call)
|
@@ -85,18 +85,22 @@ module RuboCop
|
|
85
85
|
end
|
86
86
|
|
87
87
|
alias on_numblock on_block
|
88
|
+
alias on_itblock on_block
|
88
89
|
|
89
90
|
private
|
90
91
|
|
91
92
|
def autocorrect(corrector, send_node, node)
|
92
93
|
corrector.remove(send_node.receiver)
|
93
94
|
corrector.remove(send_node.loc.dot)
|
94
|
-
corrector.remove(block_argument_range(send_node))
|
95
|
+
corrector.remove(block_argument_range(send_node)) if node.block_type?
|
95
96
|
end
|
96
97
|
|
98
|
+
# rubocop:disable Metrics/AbcSize
|
97
99
|
def redundant_receiver?(send_nodes, node)
|
98
100
|
proc = if node.numblock_type?
|
99
101
|
->(n) { n.receiver.lvar_type? && n.receiver.source == '_1' }
|
102
|
+
elsif node.itblock_type?
|
103
|
+
->(n) { n.receiver.lvar_type? && n.receiver.source == 'it' }
|
100
104
|
else
|
101
105
|
return false if node.arguments.empty?
|
102
106
|
|
@@ -106,6 +110,7 @@ module RuboCop
|
|
106
110
|
|
107
111
|
send_nodes.all?(&proc)
|
108
112
|
end
|
113
|
+
# rubocop:enable Metrics/AbcSize
|
109
114
|
|
110
115
|
def block_argument_range(node)
|
111
116
|
block_node = node.each_ancestor(:block).first
|
@@ -40,7 +40,7 @@ module RuboCop
|
|
40
40
|
|
41
41
|
def on_send(node)
|
42
42
|
association_with_reflection(node) do |reflection_class_name|
|
43
|
-
return if reflection_class_name.value.send_type? && reflection_class_name.value.receiver
|
43
|
+
return if reflection_class_name.value.send_type? && !reflection_class_name.value.receiver&.const_type?
|
44
44
|
return if reflection_class_name.value.lvar_type? && str_assigned?(reflection_class_name)
|
45
45
|
|
46
46
|
add_offense(reflection_class_name) do |corrector|
|
@@ -76,7 +76,7 @@ module RuboCop
|
|
76
76
|
def autocorrect(corrector, class_config)
|
77
77
|
class_value = class_config.value
|
78
78
|
replacement = const_or_string(class_value)
|
79
|
-
return unless replacement
|
79
|
+
return unless replacement
|
80
80
|
|
81
81
|
corrector.replace(class_value, replacement.source.inspect)
|
82
82
|
end
|
@@ -205,6 +205,7 @@ module RuboCop
|
|
205
205
|
end
|
206
206
|
|
207
207
|
alias on_numblock on_block
|
208
|
+
alias on_itblock on_block
|
208
209
|
|
209
210
|
private
|
210
211
|
|
@@ -218,7 +219,7 @@ module RuboCop
|
|
218
219
|
return unless (last_argument = node.last_argument)
|
219
220
|
|
220
221
|
drop_table_call(node) do
|
221
|
-
unless node.parent.
|
222
|
+
unless node.parent.any_block_type? || last_argument.block_pass_type?
|
222
223
|
add_offense(node, message: format(MSG, action: 'drop_table(without block)'))
|
223
224
|
end
|
224
225
|
end
|
@@ -237,7 +237,12 @@ module RuboCop
|
|
237
237
|
end
|
238
238
|
|
239
239
|
replacement = "#{path_replacement}.#{method}"
|
240
|
-
|
240
|
+
|
241
|
+
if args.any?
|
242
|
+
formatted_args = args.map { |arg| arg.array_type? ? "*#{arg.source}" : arg.source }
|
243
|
+
replacement += "(#{formatted_args.join(', ')})"
|
244
|
+
end
|
245
|
+
|
241
246
|
replacement
|
242
247
|
end
|
243
248
|
|
@@ -182,7 +182,7 @@ module RuboCop
|
|
182
182
|
def right_assignment_node(assignment)
|
183
183
|
node = assignment.node.child_nodes.first
|
184
184
|
|
185
|
-
return node unless node&.
|
185
|
+
return node unless node&.any_block_type?
|
186
186
|
|
187
187
|
node.send_node
|
188
188
|
end
|
@@ -248,7 +248,7 @@ module RuboCop
|
|
248
248
|
end
|
249
249
|
|
250
250
|
def conditional?(parent)
|
251
|
-
parent.
|
251
|
+
parent.type?(:if, :case)
|
252
252
|
end
|
253
253
|
|
254
254
|
def deparenthesize(node)
|
@@ -305,7 +305,7 @@ module RuboCop
|
|
305
305
|
|
306
306
|
node = assignable_node(node)
|
307
307
|
method, sibling_index = find_method_with_sibling_index(node.parent)
|
308
|
-
return false unless method
|
308
|
+
return false unless method&.type?(:def, :any_block)
|
309
309
|
|
310
310
|
method.children.size == node.sibling_index + sibling_index
|
311
311
|
end
|
@@ -324,12 +324,13 @@ module RuboCop
|
|
324
324
|
|
325
325
|
def explicit_return?(node)
|
326
326
|
ret = assignable_node(node).parent
|
327
|
-
ret
|
327
|
+
ret&.type?(:return, :next)
|
328
328
|
end
|
329
329
|
|
330
330
|
def return_value_assigned?(node)
|
331
|
-
assignment = assignable_node(node).parent
|
332
|
-
|
331
|
+
return false unless (assignment = assignable_node(node).parent)
|
332
|
+
|
333
|
+
assignment.assignment?
|
333
334
|
end
|
334
335
|
|
335
336
|
def persist_method?(node, methods = RESTRICT_ON_SEND)
|
@@ -39,7 +39,7 @@ module RuboCop
|
|
39
39
|
|
40
40
|
# @!method comment_present?(node)
|
41
41
|
def_node_matcher :comment_present?, <<~PATTERN
|
42
|
-
(hash <(pair {(sym :comment) (str "comment")} (_
|
42
|
+
(hash <(pair {(sym :comment) (str "comment")} (_ !blank?)) ...>)
|
43
43
|
PATTERN
|
44
44
|
|
45
45
|
# @!method add_column?(node)
|
@@ -33,7 +33,7 @@ module RuboCop
|
|
33
33
|
|
34
34
|
def on_send(node)
|
35
35
|
return unless (receiver = node.receiver)
|
36
|
-
return unless receiver.
|
36
|
+
return unless receiver.type?(:str, :dstr)
|
37
37
|
return unless receiver.respond_to?(:heredoc?) && receiver.heredoc?
|
38
38
|
|
39
39
|
register_offense(node, receiver)
|
@@ -32,7 +32,7 @@ module RuboCop
|
|
32
32
|
def_node_matcher :params_require_permit, <<~PATTERN
|
33
33
|
$(call
|
34
34
|
$(call
|
35
|
-
(send nil? :params) :require _) :permit
|
35
|
+
(send nil? :params) :require _) :permit _+)
|
36
36
|
PATTERN
|
37
37
|
|
38
38
|
def_node_matcher :params_permit_require, <<~PATTERN
|
@@ -59,7 +59,7 @@ module RuboCop
|
|
59
59
|
end
|
60
60
|
|
61
61
|
add_offense(range, message: format(MSG, prefer: prefer)) do |corrector|
|
62
|
-
corrector.remove(require_method.
|
62
|
+
corrector.remove(require_method.receiver.source_range.end.join(require_method.source_range.end))
|
63
63
|
corrector.replace(permit_method.loc.selector, 'expect')
|
64
64
|
if replace_argument
|
65
65
|
corrector.insert_before(permit_method.first_argument, "#{require_key(require_method)}[")
|
@@ -99,7 +99,7 @@ module RuboCop
|
|
99
99
|
return false unless transaction_method_name?(node.method_name)
|
100
100
|
return false unless (parent = node.parent)
|
101
101
|
|
102
|
-
parent.
|
102
|
+
parent.any_block_type? && parent.body
|
103
103
|
end
|
104
104
|
|
105
105
|
def statement(statement_node)
|
@@ -113,7 +113,7 @@ module RuboCop
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def nested_block?(statement_node)
|
116
|
-
name = statement_node.ancestors.find(&:
|
116
|
+
name = statement_node.ancestors.find(&:any_block_type?).children.first.method_name
|
117
117
|
!transaction_method_name?(name)
|
118
118
|
end
|
119
119
|
|
@@ -51,51 +51,28 @@ module RuboCop
|
|
51
51
|
|
52
52
|
MSG = 'Use `distinct` before `pluck`.'
|
53
53
|
RESTRICT_ON_SEND = %i[uniq].freeze
|
54
|
-
NEWLINE = "\n"
|
55
|
-
PATTERN = '[!^block (send (send %<type>s :pluck ...) :uniq ...)]'
|
56
54
|
|
57
|
-
def_node_matcher :
|
58
|
-
|
59
|
-
def_node_matcher :aggressive_node_match, format(PATTERN, type: '_')
|
55
|
+
def_node_matcher :uniq_before_pluck, '[!^any_block $(send $(send _ :pluck ...) :uniq ...)]'
|
60
56
|
|
61
57
|
def on_send(node)
|
62
|
-
|
63
|
-
|
64
|
-
else
|
65
|
-
aggressive_node_match(node)
|
66
|
-
end
|
67
|
-
|
68
|
-
return unless uniq
|
58
|
+
uniq_before_pluck(node) do |uniq_node, pluck_node|
|
59
|
+
next if style == :conservative && !pluck_node.receiver&.const_type?
|
69
60
|
|
70
|
-
|
71
|
-
|
61
|
+
add_offense(uniq_node.loc.selector) do |corrector|
|
62
|
+
autocorrect(corrector, uniq_node, pluck_node)
|
63
|
+
end
|
72
64
|
end
|
73
65
|
end
|
74
66
|
|
75
67
|
private
|
76
68
|
|
77
|
-
def autocorrect(corrector,
|
78
|
-
|
69
|
+
def autocorrect(corrector, uniq_node, pluck_node)
|
70
|
+
corrector.remove(range_between(pluck_node.loc.end.end_pos, uniq_node.loc.selector.end_pos))
|
79
71
|
|
80
|
-
|
81
|
-
if (dot = node.receiver.loc.dot)
|
72
|
+
if (dot = pluck_node.loc.dot)
|
82
73
|
corrector.insert_before(dot.begin, '.distinct')
|
83
74
|
else
|
84
|
-
corrector.insert_before(
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def dot_method_with_whitespace(method, node)
|
89
|
-
range_between(dot_method_begin_pos(method, node), node.loc.selector.end_pos)
|
90
|
-
end
|
91
|
-
|
92
|
-
def dot_method_begin_pos(method, node)
|
93
|
-
lines = node.source.split(NEWLINE)
|
94
|
-
|
95
|
-
if lines.last.strip == ".#{method}"
|
96
|
-
node.source.rindex(NEWLINE)
|
97
|
-
else
|
98
|
-
node.loc.dot.begin_pos
|
75
|
+
corrector.insert_before(pluck_node, 'distinct.')
|
99
76
|
end
|
100
77
|
end
|
101
78
|
end
|
@@ -73,7 +73,7 @@ module RuboCop
|
|
73
73
|
|
74
74
|
def column_names(node, uniqueness_part)
|
75
75
|
arg = node.first_argument
|
76
|
-
return unless arg.
|
76
|
+
return unless arg.type?(:str, :sym)
|
77
77
|
|
78
78
|
ret = [arg.value]
|
79
79
|
names_from_scope = column_names_from_scope(uniqueness_part)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Rails
|
7
|
+
# A plugin that integrates RuboCop Rails with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
def about
|
10
|
+
LintRoller::About.new(
|
11
|
+
name: 'rubocop-rails',
|
12
|
+
version: Version::STRING,
|
13
|
+
homepage: 'https://github.com/rubocop/rubocop-rails',
|
14
|
+
description: 'A RuboCop extension focused on enforcing Rails best practices and coding conventions.'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def supported?(context)
|
19
|
+
context.engine == :rubocop
|
20
|
+
end
|
21
|
+
|
22
|
+
def rules(_context)
|
23
|
+
project_root = Pathname.new(__dir__).join('../../..')
|
24
|
+
|
25
|
+
ConfigObsoletion.files << project_root.join('config', 'obsoletion.yml')
|
26
|
+
|
27
|
+
# FIXME: This is a dirty hack relying on a private constant to prevent
|
28
|
+
# "Warning: AllCops does not support TargetRailsVersion parameter".
|
29
|
+
# It should be updated to a better design in the future.
|
30
|
+
without_warnings do
|
31
|
+
ConfigValidator.const_set(:COMMON_PARAMS, ConfigValidator::COMMON_PARAMS.dup << 'TargetRailsVersion')
|
32
|
+
end
|
33
|
+
|
34
|
+
LintRoller::Rules.new(type: :path, config_format: :rubocop, value: project_root.join('config', 'default.yml'))
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def without_warnings
|
40
|
+
original_verbose = $VERBOSE
|
41
|
+
$VERBOSE = nil
|
42
|
+
yield
|
43
|
+
ensure
|
44
|
+
$VERBOSE = original_verbose
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/rubocop/rails.rb
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RuboCop
|
4
|
-
# RuboCop Rails project namespace
|
4
|
+
# RuboCop Rails project namespace.
|
5
5
|
module Rails
|
6
|
-
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
7
|
-
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
8
|
-
|
9
|
-
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
10
|
-
|
11
|
-
::RuboCop::ConfigObsoletion.files << PROJECT_ROOT.join('config', 'obsoletion.yml')
|
12
6
|
end
|
13
7
|
end
|
data/lib/rubocop-rails.rb
CHANGED
@@ -3,16 +3,12 @@
|
|
3
3
|
require 'rubocop'
|
4
4
|
require 'rack/utils'
|
5
5
|
require 'active_support/inflector'
|
6
|
-
require 'active_support/core_ext/object/blank'
|
7
6
|
|
8
7
|
require_relative 'rubocop/rails'
|
9
8
|
require_relative 'rubocop/rails/version'
|
10
|
-
require_relative 'rubocop/rails/inject'
|
11
9
|
require_relative 'rubocop/rails/schema_loader'
|
12
10
|
require_relative 'rubocop/rails/schema_loader/schema'
|
13
|
-
|
14
|
-
RuboCop::Rails::Inject.defaults!
|
15
|
-
|
11
|
+
require_relative 'rubocop/rails/plugin'
|
16
12
|
require_relative 'rubocop/cop/rails_cops'
|
17
13
|
|
18
14
|
require_relative 'rubocop/rails/migration_file_skippable'
|
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.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
- Yuji Nakayama
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-01
|
12
|
+
date: 2025-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 4.2.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: lint_roller
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.1'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.1'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: rack
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,7 +59,7 @@ dependencies:
|
|
45
59
|
requirements:
|
46
60
|
- - ">="
|
47
61
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.
|
62
|
+
version: 1.75.0
|
49
63
|
- - "<"
|
50
64
|
- !ruby/object:Gem::Version
|
51
65
|
version: '2.0'
|
@@ -55,7 +69,7 @@ dependencies:
|
|
55
69
|
requirements:
|
56
70
|
- - ">="
|
57
71
|
- !ruby/object:Gem::Version
|
58
|
-
version: 1.
|
72
|
+
version: 1.75.0
|
59
73
|
- - "<"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '2.0'
|
@@ -65,7 +79,7 @@ dependencies:
|
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
82
|
+
version: 1.38.0
|
69
83
|
- - "<"
|
70
84
|
- !ruby/object:Gem::Version
|
71
85
|
version: '2.0'
|
@@ -75,7 +89,7 @@ dependencies:
|
|
75
89
|
requirements:
|
76
90
|
- - ">="
|
77
91
|
- !ruby/object:Gem::Version
|
78
|
-
version: 1.
|
92
|
+
version: 1.38.0
|
79
93
|
- - "<"
|
80
94
|
- !ruby/object:Gem::Version
|
81
95
|
version: '2.0'
|
@@ -238,8 +252,8 @@ files:
|
|
238
252
|
- lib/rubocop/cop/rails/where_range.rb
|
239
253
|
- lib/rubocop/cop/rails_cops.rb
|
240
254
|
- lib/rubocop/rails.rb
|
241
|
-
- lib/rubocop/rails/inject.rb
|
242
255
|
- lib/rubocop/rails/migration_file_skippable.rb
|
256
|
+
- lib/rubocop/rails/plugin.rb
|
243
257
|
- lib/rubocop/rails/schema_loader.rb
|
244
258
|
- lib/rubocop/rails/schema_loader/schema.rb
|
245
259
|
- lib/rubocop/rails/version.rb
|
@@ -250,9 +264,10 @@ metadata:
|
|
250
264
|
homepage_uri: https://docs.rubocop.org/rubocop-rails/
|
251
265
|
changelog_uri: https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md
|
252
266
|
source_code_uri: https://github.com/rubocop/rubocop-rails/
|
253
|
-
documentation_uri: https://docs.rubocop.org/rubocop-rails/2.
|
267
|
+
documentation_uri: https://docs.rubocop.org/rubocop-rails/2.31/
|
254
268
|
bug_tracker_uri: https://github.com/rubocop/rubocop-rails/issues
|
255
269
|
rubygems_mfa_required: 'true'
|
270
|
+
default_lint_roller_plugin: RuboCop::Rails::Plugin
|
256
271
|
rdoc_options: []
|
257
272
|
require_paths:
|
258
273
|
- lib
|
data/lib/rubocop/rails/inject.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Rails
|
5
|
-
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
6
|
-
# bit of our configuration.
|
7
|
-
module Inject
|
8
|
-
def self.defaults!
|
9
|
-
path = CONFIG_DEFAULT.to_s
|
10
|
-
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
11
|
-
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
12
|
-
puts "configuration from #{path}" if ConfigLoader.debug?
|
13
|
-
config = ConfigLoader.merge_with_default(config, path, unset_nil: false)
|
14
|
-
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|