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

Report useless entry in exclude-rules #3953

Open
arxeiss opened this issue Jul 13, 2023 · 1 comment
Open

Report useless entry in exclude-rules #3953

arxeiss opened this issue Jul 13, 2023 · 1 comment
Labels
area: config Related to .golangci.yml and/or cli options breaking enhancement New feature or improvement
Milestone

Comments

@arxeiss
Copy link

arxeiss commented Jul 13, 2023

Your feature request related to a problem? Please describe.

From time to time I need to add something to exclude-rules. For example I'm introducing new rule to old codebase so I exclude the rule in some files/folders and iteratively fixing it.

But sometimes I get to the point, that I fix all issues, but forgot to remove that entry in exclude-rules section.

Describe the solution you'd like.

It would be nice, if golangci-lint would complain that I have some rule to exclude, which is not applied at all.

I see that similar thing is now done by nolintlint when I have //nolint:xxx in the code. But not in the .golangci.yml file.

Describe alternatives you've considered.

No alternative considered. I saw it in linters for different languages than Go.

Additional context.

No response

@arxeiss arxeiss added the enhancement New feature or improvement label Jul 13, 2023
@ldez ldez added the area: config Related to .golangci.yml and/or cli options label Jul 13, 2023
@ldez ldez modified the milestone: v2.0.0 Jul 13, 2023
@ldez
Copy link
Member

ldez commented Jul 13, 2023

Hello,

currently, it's not possible to do that because golangci-lint comes with default exclusion rules.
Those default rules are merged with the user's defined rules.
So golangci-lint will report a kind of false positive unused rules.

Also in some cases, exclusions should be kept even if they are not currently used:

  • exclusions related to specific OS and/or build tags
  • exclusions related to shared company rules

The solution to detect and report unused exclusions is more complex than just reporting those exclusions.

FYI, internally, it's completely independent of the processing of nolint directives.

@ldez ldez added the breaking label Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: config Related to .golangci.yml and/or cli options breaking enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

2 participants