golangci-lint icon indicating copy to clipboard operation
golangci-lint copied to clipboard

nolint by linter rule

Open peakle opened this issue 3 years ago • 5 comments
trafficstars

Your feature request related to a problem? Please describe.

is some case i don't want to disable all linter checks for expression by nolint:gocritic but only one rule hugeParam for example

Describe the solution you'd like.

add feature to write nolint directive for specific rule i propose the following syntax: nolint:linter_name:check_name as example nolint:gocritic:hugeParam

Describe alternatives you've considered.

~

Additional context.

No response

peakle avatar Mar 30 '22 19:03 peakle

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

boring-cyborg[bot] avatar Mar 30 '22 19:03 boring-cyborg[bot]

I'm also interested in this one, especially for revive.

ubiuser avatar Nov 15 '22 13:11 ubiuser

For the gocritic example, there are three possible levels: gocritic:ruleguard:ruleguard-rule-name. Ruleguard is a powerful checker under gocritic, and within ruleguard it's possible to have hundreds of checks.

sebastien-rosset avatar Nov 15 '22 20:11 sebastien-rosset

As for revive, it actually supports Its own ignore comments, but there're not parsed by golangci-lint. I'm wondering if we can have an API (or a convention) for the linters to support so that they can themselves ignore according to the ignore rule from golangci-lint.

I can volunteer the PR, but before starting with it we need to have a clear vision on how we want to achieve it.

denisvmedia avatar Aug 31 '23 09:08 denisvmedia

Related to #1658

ldez avatar Aug 31 '23 12:08 ldez

Duplicate of #1165

ldez avatar Mar 21 '24 22:03 ldez