Skip to content

Files

Latest commit

 

History

History
34 lines (25 loc) · 702 Bytes

Rake-ClassDefinitionInTask.md

File metadata and controls

34 lines (25 loc) · 702 Bytes

Pattern: Class definition in rake task

Issue: -

Description

Detects class or module definition in a task or namespace, because it is defined to the top level. It is confusing because the scope looks in the task or namespace, but actually it is defined to the top level.

Examples

# bad
task :foo do
  class C
  end
end

# bad
namespace :foo do
  module M
  end
end

# good - It is also defined to the top level,
#        but it looks expected behavior.
class C
end
task :foo do
end

Further Reading