File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change
1
+ * [ #1337 ] ( https://github.com/rubocop/rubocop-rails/pull/1337 ) : Fix an error for ` Rails/Validation ` when passing no arguments. ([ @earlopain ] [ ] )
Original file line number Diff line number Diff line change @@ -59,11 +59,11 @@ class Validation < Base
59
59
60
60
def on_send ( node )
61
61
return if node . receiver
62
+ return unless ( last_argument = node . last_argument )
62
63
63
64
range = node . loc . selector
64
65
65
66
add_offense ( range , message : message ( node ) ) do |corrector |
66
- last_argument = node . last_argument
67
67
return if !last_argument . literal? && !last_argument . splat_type? && !frozen_array_argument? ( last_argument )
68
68
69
69
corrector . replace ( range , 'validates' )
Original file line number Diff line number Diff line change 171
171
validates_numericality_of :a, b
172
172
RUBY
173
173
end
174
+
175
+ it 'registers no offense when no arguments are passed' do
176
+ expect_no_offenses ( <<~RUBY )
177
+ validates_numericality_of
178
+ RUBY
179
+ end
174
180
end
You can’t perform that action at this time.
0 commit comments