Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

directories in config relative to cwd, not to configuration file itself. #1486

Open
leonelgalan opened this issue Jul 23, 2019 · 1 comment

Comments

@leonelgalan
Copy link
Contributor

Setup

Rails app, where helpers smell of UtilityFunction

.reek.yml

directories:
  "app/helpers":
    UtilityFunction:
      enabled: false

app/helpers/foo_helper.rb

module FooHelper
  def smelly_method(bar)
    bar.presence
  end
end

Happy Path

reek --show-configuration-path app/helpers/foo_helper.rb
Using '.reek.yml' as configuration file.
Inspecting 1 file(s):
.

Possible Bug

When linting through atom-linter, the current working directory (cwd) is set to the one the file being linted exists, in this case: app/helpers. Reek will still find the correct .reek.yml from it's ancestors, first in app and ultimately on the project's root. But, it won't match the directory "app/helpers", because it's looking for "app/helpers" relative to the cwd instead of relative to the configuration file.

cd app/helpers
reek --show-configuration-path foo_helper.rb
Using '../../.reek.yml' as configuration file.
Inspecting 1 file(s):
S

foo_helper.rb -- 1 warning:
  [5]:UtilityFunction: FooHelper#smelly_method doesn't depend on instance state (maybe move it to another class?) [https://github.com/troessner/reek/blob/v5.4.0/docs/Utility-Function.md]

I'm on reek 5.4.0

@Mozart2234
Copy link

Hi, you can try in.

.reek.yml

directories:
  "./app/helpers":
    UtilityFunction:
      enabled: false

This solution it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants