Skip to content

Proposal: check for unused //nolint comments #832

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

Closed
vearutop opened this issue Oct 21, 2019 · 5 comments
Closed

Proposal: check for unused //nolint comments #832

vearutop opened this issue Oct 21, 2019 · 5 comments
Labels
area: nolint Related to nolint directive and nolintlint enhancement New feature or improvement

Comments

@vearutop
Copy link
Contributor

vearutop commented Oct 21, 2019

Sometimes the code needs a//nolint suppressor to disable check(s), but as the code evolves the //nolintmay become redundant.

For example such comment may become obsolete when the symbol is actually used:

// MyConst is something special.
// nolint:unused // To be used in subsequent PR.
const MyConst = "my-const"

I would like to check that //nolint comment was relevant to at least one linting issue and emit lint error otherwise.

@tpounds tpounds added linter: new Support new linter help wanted Issue that needs help from a contributor labels Oct 21, 2019
@tpounds
Copy link
Contributor

tpounds commented Oct 21, 2019

@vearutop There was pr #740 that was recently closed to implement similar functionality.

@tpounds
Copy link
Contributor

tpounds commented Oct 21, 2019

cc @ashanbrown @jirfag

@jirfag
Copy link
Contributor

jirfag commented Oct 22, 2019

I like this idea and it's not difficult to implement in nolint filter

@stale
Copy link

stale bot commented Apr 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No recent correspondence or work activity label Apr 19, 2020
@stale stale bot closed this as completed May 19, 2020
@ernado ernado reopened this May 19, 2020
@stale stale bot removed the stale No recent correspondence or work activity label May 19, 2020
@ldez ldez removed help wanted Issue that needs help from a contributor linter: new Support new linter labels Feb 13, 2021
@ldez
Copy link
Member

ldez commented Feb 13, 2021

nolintlint handle this case now:

  nolintlint:
    # Enable to ensure that nolint directives are all used. Default is true.
    allow-unused: false

@ldez ldez closed this as completed Feb 13, 2021
@ldez ldez added enhancement New feature or improvement area: nolint Related to nolint directive and nolintlint labels Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: nolint Related to nolint directive and nolintlint enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

5 participants