-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: allow running only a specific linter without modifying the file configuration #4438
Conversation
32be3cf
to
852a237
Compare
I like this, but at the same time I also think it feels like a workaround. I know how the precedence of flags and config works but I think I'd still expect this behavior when I run Is this approach because you don't want to introduce a breaking change or do you think the current requirement of using Since this feels by far like the most common use of |
It's not a workaround or something to avoid breaking changes: during the refactor I spend time thinking about the behavior of the flags. I will share my notes. For people that use
For people that use
For people that only use
For people that only use
For people that use
What about interaction with As you can see, I didn't evaluate all the cases, because I think that users expected consistency between flags behavior: if |
Yeah really good point, that makes a lot of sense! I agree that having only one of I'm not sure if not using I think your notes are really good and I'm probably biased. I've never used |
This PR is a proposal for a new flag (not a file configuration).
This new flag will allow running only one specific linter without modifying the file configuration.
I named this flag
--only
but I'm not sure about this name.I think
--force
can be ambiguous 🤔.This flag will override all the options of the
linters
section from the file configuration (enable
,disable
,enable-all
,disable-all
,fast
, andpresets
).So you can run a linter with the right
linters-settings
section from the file without modifying the file configuration.Before:
After:
golangci-lint run --enable-only=yourlintername # OR golangci-lint run --no-config --enable-only=yourlintername
Related to #3453, #1188, #1972, #1272, #715