Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Linter changes working directory, breaking config rules #149

Open
arielj opened this issue Sep 25, 2020 · 0 comments
Open

Linter changes working directory, breaking config rules #149

arielj opened this issue Sep 25, 2020 · 0 comments

Comments

@arielj
Copy link

arielj commented Sep 25, 2020

Reek configuration allows us to configure reek depending on the files' directory. They suggest for example this config for projects using Rails https://github.com/troessner/reek#working-with-rails

directories:
  "app/controllers":
    IrresponsibleModule:
      enabled: false
    NestedIterators:
      max_allowed_nesting: 2
    UnusedPrivateMethod:
      enabled: false
    InstanceVariableAssumption:
      enabled: false

This is not working because the linter is changing the working directory for the reek command to the current file's directory instead of the root of the project here https://github.com/AtomLinter/linter-reek/blob/master/lib/linter-reek.js#L116

        const execOpts = {
          cwd: path.dirname(filePath),
          ignoreExitCode: true,
        };

Changing that to:

        const execOpts = {
          cwd: atom.project.getPaths()[0],
          ignoreExitCode: true,
        };

fixes the issue (setting the working directory as the root of the project.

I can create a PR, but I'm not sure if that there's for a specific reason.

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

No branches or pull requests

1 participant