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

revive: forward Exclude rule config #4364

Closed
sapphire-janrain opened this issue Feb 8, 2024 · 2 comments · Fixed by #4365
Closed

revive: forward Exclude rule config #4364

sapphire-janrain opened this issue Feb 8, 2024 · 2 comments · Fixed by #4365
Labels
dependencies Relates to an upstream dependency enhancement New feature or improvement

Comments

@sapphire-janrain
Copy link

Your feature request related to a problem? Please describe.

Right now I'm using issues.exclude-rules to achieve what I want to do, but it would be nice if there was a way to just provide the exclusion to revive directly via the Exclude config option

Describe the solution you'd like.

linters-settings:
  revive:
    rules:
      - name: unused-parameter
        exclude: ["TEST"]
        # TEST is a magic word in revive to filter out test files,
        # no special handling needed in golangci-lint

Describe alternatives you've considered.

issues.exclude-rules

Additional context.

No response

@sapphire-janrain sapphire-janrain added the enhancement New feature or improvement label Feb 8, 2024
Copy link

boring-cyborg bot commented Feb 8, 2024

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

@ldez ldez added the dependencies Relates to an upstream dependency label Feb 8, 2024
@ldez
Copy link
Member

ldez commented Feb 9, 2024

Hello,

The test files are filtered before the analysis by the linter with the option run.test:
https://golangci-lint.run/usage/configuration/#run-configuration

I will implement this option even if I think this will lead to unexpected situations and comprehension problems.

I understand you already use issues.exclude-rules but I recommend using something like this:

issues:
  exclude-rules:
    - path: (.+)_test.go
      linters:
        - revive
      text: "^(unused-parameter|add-constant)"

@ldez ldez changed the title forward Exclude rule config to revive revive: forward Exclude rule config Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Relates to an upstream dependency enhancement New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants