You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
doc-sync: pkg/linters/doc.go says "44 active analyzers" but 45 are registered — the list omits stringscountcontains #45185
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
The doc header count (44) is wrong; the true count is 45.
stringscountcontains — which emits diagnostics and autofixes against production code — is undiscoverable from the package overview, unlike its sibling stringsindexcontains which is documented.
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).
Activity