reek icon indicating copy to clipboard operation
reek copied to clipboard

False positive of UtilityFunction for class methods

Open VladYermakov opened this issue 4 years ago • 3 comments

Hi there

I've observed a false positive for UtilityFunction when class methods are defined under class_methods block of ActiveSupport::Concern

For instance

module SomeModule
  extend ActiveSupport::Concern

  class_methods do
    def some_method(arg1, arg2)
      return 1 if arg1.something?
      return 2 if arg2.something_else?

      3
    end
  end
end

So here I'm getting UtilityFunction warning, but it makes no sense, and by definition it wouldn't warn this method was defined using self.

Thanks in advance

VladYermakov avatar May 15 '20 20:05 VladYermakov

Reproduced in version 'reek', '~> 6.0' and the warning still occurs.

Can I open a PR to fix the issue?

mateusluizfb avatar Mar 29 '21 15:03 mateusluizfb

@mateusluizfb yes, please. Let me know if you need any pointers.

mvz avatar Mar 29 '21 16:03 mvz

@mvz PR here https://github.com/troessner/reek/pull/1596 :)

mateusluizfb avatar Mar 29 '21 23:03 mateusluizfb