Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/rubocop/cop/rake/method_definition_in_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ module Rake
# task :foo do
# end
#
# # good - A lambda assigned to a local variable is scoped to the
# # block, so it is not defined at the top level.
# task :foo do
# helper = -> { do_something }
# helper.call
# end
#
class MethodDefinitionInTask < Base
MSG = 'Do not define a method in rake task, because it will be defined to the top level.'

Expand Down
Loading