-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Syntax errors in gocritic ruleguard file are silently ignored #1565
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
Comments
When
produces the following output:
After some troubleshooting, it appears the root cause is in the gocritic source code: |
This should be fixed by PR go-critic/go-critic#1015 in go-critic. This issue can be closed when a new version of go-critic is released and the go-critic version is bumped in golangci-lint. |
The issue was "fixed" in go-critic/go-critic#1015, however, the solution does not work when invoked from golangci-lint. The problem is that all go-critic output seems to be redirected to /dev/null by golangci-lint. What is the idiomatic way in golangci-lint to exit with error status when a linter (go-critic + ruleguard) is unable to initialize itself? Specifically in the case of go-critic, the user can write their own ruleguard static analysis rules which are parsed by go-critic + ruleguard. Since the user may inadvertently include syntax errors in the ruleguard files, it would be good to exit with non-zero status. Update: Never mind, the fix is not part of [email protected]. |
golangci-run silently ignores the following gocritic configuration issues:
ruleguard/rules
setting is an inexistent path or the file is not readable. For example, the value isruleguard/rules.go
, but that file does not existThis is unlike the gocritic and ruleguard behavior which print an error message and exit with error status.
For example, below in the ruleguard
Where
clause, it should bem["x"]
, notm[x]
, but any syntax error will be silently ignored.The workaround is to test the ruleguard file with gocritic and ruleguard, but there can be subtle problems such as when the version of gocritic and ruleguard included with golangci does not match the standalone version of gocritic and ruleguard.
Please include the following information:
Version of golangci-lint
Also tried golangci-lint built from local workspace with master branch as of 12/17/2020:
Config file
Go environment
Verbose output of running
The text was updated successfully, but these errors were encountered: