reek: UtilityFunction triggered on modules with 'extend self'
I’m defining a set of methods inside a module via
module Foo
module Bar
extend self
def do_stuff
# things
end
end
end
Reek triggers the UtilityFunction smell on those methods even though the behaviour should be the same as for:
module Foo
module Bar
class << self
def do_stuff
# things
end
end
end
end
The latter won’t trigger UtilityFunction as per https://github.com/troessner/reek/issues/112. Should ‘extend self’ also be supported here?
Thanks!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (7 by maintainers)
It’s not the same. The second version will not define any instance methods on the class that includes the module, the first one will as you can quickly see for yourself in pry 😉 That’s why the latter one doesn’t report the smell but the first one does.