Add //nolint suppression support to seenmapbool and tolowerequalfold#37255
Merged
Conversation
5 tasks
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add nolint.BuildLineIndex support to enforce-candidate linters
Add Jun 6, 2026
//nolint suppression support to seenmapbool and tolowerequalfold
Contributor
There was a problem hiding this comment.
Pull request overview
This PR brings //nolint suppression parity to two analyzers (seenmapbool and tolowerequalfold) by integrating the shared pkg/linters/internal/nolint helpers and adding suppressed test fixtures, aligning them with the project’s CI-blocking analyzer invariant.
Changes:
- Add
nolint.BuildLineIndex(...)+nolint.HasDirective(...)checks totolowerequalfoldandseenmapboolso diagnostics can be suppressed via//nolint:<linter>. - Thread the computed nolint line index into
seenmapbool’sinspectBodyhelper to suppress diagnostics at the declaration reporting site. - Add new suppressed fixtures in both linters’
analysistesttestdata to validate suppression behavior.
Show a summary per file
| File | Description |
|---|---|
| pkg/linters/tolowerequalfold/tolowerequalfold.go | Build nolint line index once and skip reporting when the comparison expression line is suppressed. |
| pkg/linters/tolowerequalfold/testdata/src/tolowerequalfold/tolowerequalfold.go | Add a //nolint:tolowerequalfold fixture that should not emit diagnostics. |
| pkg/linters/seenmapbool/seenmapbool.go | Build nolint line index once and skip reporting when the declaration site is suppressed. |
| pkg/linters/seenmapbool/testdata/src/seenmapbool/seenmapbool.go | Add a //nolint:seenmapbool fixture that should not emit diagnostics. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The linter set currently relies on an enforcement invariant: CI-blocking analyzers support
//nolintsuppression.seenmapboolandtolowerequalfoldwere missing this integration, blockingseenmapboolenforcement readiness and creating parity drift for another enforcement candidate.Analyzer parity:
seenmapboolpkg/linters/internal/nolintinrun.nolint.BuildLineIndex(pass, "seenmapbool").nolint.HasDirective(...)matches the declaration site.Analyzer parity:
tolowerequalfoldpkg/linters/internal/nolintinrun.nolint.BuildLineIndex(pass, "tolowerequalfold").nolint.HasDirective(...)matches the comparison expression.Suppression fixtures
//nolint:seenmapboolcase inpkg/linters/seenmapbool/testdata/....//nolint:tolowerequalfoldcase inpkg/linters/tolowerequalfold/testdata/....