Skip to content

Update support for function matching in Ruleguard #2285

Closed
@timkral

Description

@timkral

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions