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

Linter changes working directory, breaking config rules #149

Open
@arielj

Description

@arielj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions