File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 22
33## master (unreleased)
44
5+ ### Bug fixes
6+
7+ * [ #184 ] ( https://github.com/rubocop-hq/rubocop-rails/issues/184 ) : Fix ` Rake/Environment ` to allow task with no block. ([ @hanachin ] [ ] )
8+
59## 2.4.1 (2019-12-25)
610
711### Bug fixes
122126[ @ngouy ] : https://github.com/ngouy
123127[ @mvz ] : https://github.com/mvz
124128[ @fidalgo ] : https://github.com/fidalgo
129+ [ @hanachin ] : https://github.com/hanachin
Original file line number Diff line number Diff line change @@ -29,15 +29,16 @@ class RakeEnvironment < Cop
2929 MSG = 'Include `:environment` task as a dependency for all Rake tasks.'
3030
3131 def_node_matcher :task_definition? , <<~PATTERN
32- (send nil? :task ...)
32+ (block $( send nil? :task ...) ...)
3333 PATTERN
3434
35- def on_send ( node )
36- return unless task_definition? ( node )
37- return if task_name ( node ) == :default
38- return if with_dependencies? ( node )
35+ def on_block ( node )
36+ task_definition? ( node ) do | task_method |
37+ return if task_name ( task_method ) == :default
38+ return if with_dependencies? ( task_method )
3939
40- add_offense ( node )
40+ add_offense ( task_method )
41+ end
4142 end
4243
4344 private
Original file line number Diff line number Diff line change 8383 task default: :spec
8484 RUBY
8585 end
86+
87+ it 'does not register an offense to task with no block' do
88+ expect_no_offenses ( <<~RUBY )
89+ task(:foo).do_something
90+ RUBY
91+ end
8692end
You can’t perform that action at this time.
0 commit comments