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

Update support for function matching in Ruleguard #2285

Closed
timkral opened this issue Oct 8, 2021 · 7 comments
Closed

Update support for function matching in Ruleguard #2285

timkral opened this issue Oct 8, 2021 · 7 comments
Labels
enhancement New feature or improvement

Comments

@timkral
Copy link
Contributor

timkral commented Oct 8, 2021

Your feature request related to a problem? Please describe.

I'm trying to write the following rule via Ruleguard in the go-critic linter:

m.Match("func ($_ $_) $methodName($*args) $*_ { $*_; }").Where(m["methodName"].Text.Matches("^test"))

I've tested this rule natively with the latest version of the ruleguard client and it works as expected. However, when using it with the latest version of golangci-lint, the rule does not work.

Describe the solution you'd like.

I believe this just requires an upgrade of the go-critic dependency within golangci-lint.

Ruleguard updated it function matching logic in v0.3.5 - quasilyte/go-ruleguard#225

The latest version of go-critic, v0.5.7, uses Ruleguard v0.3.7 which includes the above fix.

As of this writing, golangci-lint uses go-critic v0.5.6.

Describe alternatives you've considered.

None.

Additional context.

No response

@timkral timkral added the enhancement New feature or improvement label Oct 8, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Oct 8, 2021

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

@ldez
Copy link
Member

ldez commented Oct 8, 2021

Related to #2041

@quasilyte
Copy link
Contributor

#2041 should be fixed by go-critic/go-critic#1072
We'll do a new go-critic release in a few days, so we can include some more changes into the train.

@timkral
Copy link
Contributor Author

timkral commented Oct 15, 2021

Awesome, thanks for the update @quasilyte !

@sebastien-rosset
Copy link
Contributor

PR #2041 was merged into golangci-lint master, it has has go-critic 0.6.1 (from 0.5.6) and ruleguard 0.3.13 (from 0.3.4)

@ldez ldez closed this as completed Oct 23, 2021
@timkral
Copy link
Contributor Author

timkral commented Oct 25, 2021

@sebastien-rosset Thank you for the update. Are there plans to release a new version of golangci-lint anytime soon?

@sebastien-rosset
Copy link
Contributor

Looking at the release history, there is a release roughly once a month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

4 participants