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

Treat "Found unknown linters" warning as an error #1450

Closed
jmdacruz opened this issue Oct 13, 2020 · 3 comments · Fixed by #1497
Closed

Treat "Found unknown linters" warning as an error #1450

jmdacruz opened this issue Oct 13, 2020 · 3 comments · Fixed by #1497
Assignees
Labels
bug Something isn't working

Comments

@jmdacruz
Copy link

Is your feature request related to a problem? Please describe.
Currently, if I use a nolint directive with an unknown linter (regardless on whether the line has any linter errors or not), the result is a warning that looks like this:

WARN [runner/nolint] Found unknown linters in //nolint directives: foobar

The problem is that if such a directive is added by mistake (e.g., a typo on the linter name), this will masquerade the actual linter error (since the exit status of golangci-lint is 0 with this warning). I couldn't find an obvious configuration parameter to handle these scenarios properly.

Describe the solution you'd like
I would expect the output of golangci-lint to be non-zero for these scenarios, or somehow configure warnings to be treated as errors. Another alternative would be for the nolintlint linter to catch these (I tried playing with allow-unused, but did not get what I expected)

Describe alternatives you've considered
N/A

Additional context
N/A

@jmdacruz jmdacruz added the enhancement New feature or improvement label Oct 13, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 13, 2020

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

@iwankgb
Copy link
Contributor

iwankgb commented Nov 1, 2020

The problem seems to be a bit more nuanced: Nolint.shouldPassIssue() applies ignored ranges to all the linters instead of Nolitn only.

@iwankgb iwankgb self-assigned this Nov 6, 2020
@iwankgb iwankgb added bug Something isn't working and removed enhancement New feature or improvement labels Nov 6, 2020
@iwankgb
Copy link
Contributor

iwankgb commented Nov 6, 2020

I have a fix for your problem but I'm struggling with testing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants