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

Use path exclude rules on absolute paths instead of relative paths #1178

Open
xtonyjiang opened this issue Jun 6, 2020 · 5 comments
Open
Labels
enhancement New feature or improvement

Comments

@xtonyjiang
Copy link

Is your feature request related to a problem? Please describe.
Using path exclude rules is difficult because the issue path depends on which directory I run golangci-lint from.

Describe the solution you'd like
I'd like path exclude rules to be evaluated on the absolute path of the issue, not the relative path that is output.

Describe alternatives you've considered
Can't think of a great alternative here.

Additional context
Example: If I have an exclude rule on a file a/b/c.go, this rule will not apply if I run golangci-lint from directory a/b/.

@xtonyjiang xtonyjiang added the enhancement New feature or improvement label Jun 6, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 6, 2020

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@majodev
Copy link

majodev commented Sep 21, 2020

Note that this feature would be especially important for editor integrations like VSCode's vscode-go.

Users have no option to control the cwd from which golangci-lint will be executed there (lint of save), it's always going to be the path were the file lives.

Typically, the only configuration that happens there is something like:

"go.lintTool": "golangci-lint",
"go.lintFlags": [
  "--fast",
  "--timeout",
  "5m"
],

@gganley
Copy link

gganley commented Feb 8, 2021

Are there any efforts related to this? It seems like a common enough issue. I can take a crack at it if it's a feature that would be accepted by the golangci team

@stale
Copy link

stale bot commented Mar 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No recent correspondence or work activity label Mar 30, 2022
@ldez ldez removed the stale No recent correspondence or work activity label Mar 30, 2022
@serbrech
Copy link

This is really painful to enable a monorepo global ruleset.
we can't run golangci-lint from the root of the monorepo, so you have to pushd into the module directory, but that means you can't have path based exclude rules in the root config file.

given

/monorepo
    /module1
    /module2
/.golangci.yml

I can't have any path based rules in golangci.yml, because they have to be relative to where the golangci-lint command is being run, which has to be from module1 or module2 folder.

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

No branches or pull requests

5 participants