class RuboCop::Cop::Rake::ClassDefinitionInTask


end
task :foo do
end
class C
# but it looks expected behavior.
# good - It is also defined to the top level,
end
end
module M
namespace :foo do
# bad
end
end
class C
task :foo do
# bad
@example
but actually it is defined to the top level.
It is confusing because the scope looks in the task or namespace,
because it is defined to the top level.
Detects class or module definition in a task or namespace,

def on_class(node)

def on_class(node)
  return if Helper::ClassDefinition.in_class_definition?(node)
  return unless Helper::TaskDefinition.in_task_or_namespace?(node)
  add_offense(node, message: format(MSG, type: node.type))
end