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
gocritic/ruleguard: MatchComment breaks ruleguard #1923
Comments
Hello, when I display the full go-critic output for your rule: $ golangci-lint run
WARN [runner] Can't run linter gocritic: gocritic: ruleguard init error: ./rules.go:10: unexpected MatchComment method
ERRO Running error: gocritic: ruleguard init error: ./rules.go:10: unexpected MatchComment method linters:
disable-all: true
enable:
- "gocritic"
linters-settings:
gocritic:
enabled-tags:
- experimental
- diagnostic
- opinionated
- performance
- style
settings:
ruleguard:
rules: "./rules.go"
failOnError: true For now, I don't know if it's expected or not. |
I found the problem it's because go-critic@v0.5.5 uses go-ruleguard@v0.3.1: But with the good version of $ ./golangci-lint run
rules.go:14:2: ruleguard: call (gocritic)
m.Match(`m.Match`).Report(`call`)
^
rules.go:7:1: ruleguard: foobar (gocritic)
// foobar
^ |
@pierrre you can open a PR on https://github.com/go-critic/go-critic to update this dependency. |
Thank you, I didn't know that this feature was introduced recently. |
It's required for `MatchComment`. Related to golangci/golangci-lint#1923
You can ping/CC me if you have some ruleguard or go-critic related problems by the way. |
https://github.com/go-critic/go-critic/releases/tag/v0.5.6 is released, I will try to update it in golangci-lint |
Here is the PR to update go-critic to v0.5.6 |
Ooops
What should I do ? Ignore it ? |
And after ignoring it 😆
|
I wouldn't ignore it as the fix is quite simple. |
Description of the problem
I'm trying to use the ruleguard integration in gocritic.
When I try to use
MatchComment
, all other ruleguard rules stop working.In the provided code, the
call
rule should report something, but it doesn't.If you remove the
comment
rule, thecall
rule will work.If I run the
ruleguard
command manually, it's working as expected.I've also tried to run gocritic standalone linter, and it's working as expected:
Version of golangci-lint
Config file
Go environment
Verbose output of running
Code example or link to a public repository
The text was updated successfully, but these errors were encountered: