Summary
pkg/linters/doc.go is out of sync with the analyzer registry in cmd/linters/main.go. The package doc header claims 44 active analyzers and its bullet list contains 44 entries, but main.go registers 45. The undocumented linter is stringscountcontains — a shipping, registered analyzer that appears nowhere in the doc list.
This is the same class of drift previously fixed in #40436 (then: 29 documented vs 30 registered).
Evidence
Counts + the missing entry
# registered analyzers in cmd/linters/main.go (lines 68-112)
$ grep -cE '^\t\t[a-z]+\.Analyzer,' cmd/linters/main.go
45
# doc.go header + bullet count
$ head -3 pkg/linters/doc.go
// All 44 active analyzers:
$ grep -c '^// - ' pkg/linters/doc.go
44
# registered but NOT documented:
stringscountcontains # cmd/linters/main.go:103, package pkg/linters/stringscountcontains
main.go:103 registers stringscountcontains.Analyzer; doc.go jumps from sprintferrorsnew/sprintfint straight past it. (Note: panicinlibrarycode is listed under the abbreviated bullet panic, so the 44 bullets already account for every other registered analyzer — stringscountcontains is the sole omission.)
Impact
Recommendation
- Bump the header to
All 45 active analyzers:.
- Insert a
stringscountcontains bullet in alphabetical position (between sprintfint/ssljson region — specifically after strconvparseignorederror? no: alphabetical stringscountcontains sits between stringreplaceminusone and stringsindexcontains). Suggested text mirroring the analyzer Doc:
stringscountcontains — flags strings.Count(s, sub) comparisons with 0/1 (e.g. > 0, == 0, < 1) that should use strings.Contains
- Consider a lightweight test/CI check asserting
len(registered) == <count in doc header> to prevent recurrence (the drift has now happened at least twice).
Validation checklist
Effort: trivial (doc-only).
Generated by 🤖 Sergo - Serena Go Expert · 369.4 AIC · ⌖ 14 AIC · ⊞ 5.8K · ◷
Summary
pkg/linters/doc.gois out of sync with the analyzer registry incmd/linters/main.go. The package doc header claims 44 active analyzers and its bullet list contains 44 entries, butmain.goregisters 45. The undocumented linter isstringscountcontains— a shipping, registered analyzer that appears nowhere in the doc list.This is the same class of drift previously fixed in #40436 (then: 29 documented vs 30 registered).
Evidence
Counts + the missing entry
main.go:103registersstringscountcontains.Analyzer;doc.gojumps fromsprintferrorsnew/sprintfintstraight past it. (Note:panicinlibrarycodeis listed under the abbreviated bulletpanic, so the 44 bullets already account for every other registered analyzer —stringscountcontainsis the sole omission.)Impact
stringscountcontains— which emits diagnostics and autofixes against production code — is undiscoverable from the package overview, unlike its siblingstringsindexcontainswhich is documented.Recommendation
All 45 active analyzers:.stringscountcontainsbullet in alphabetical position (betweensprintfint/ssljsonregion — specifically afterstrconvparseignorederror? no: alphabeticalstringscountcontainssits betweenstringreplaceminusoneandstringsindexcontains). Suggested text mirroring the analyzerDoc:len(registered) == <count in doc header>to prevent recurrence (the drift has now happened at least twice).Validation checklist
doc.goheader reads45.stringscountcontainsbullet present, alphabetically ordered.grep -c '^// - ') equals registered count (grep -cE '^\t\t[a-z]+\.Analyzer,' cmd/linters/main.go).Effort: trivial (doc-only).