golangci-lint
golangci-lint copied to clipboard
Use path exclude rules on absolute paths instead of relative paths
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/
.
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.
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"
],
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
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.
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.