Skip to content

doc-sync: pkg/linters/doc.go says "44 active analyzers" but 45 are registered — the list omits stringscountcontains #45185

Description

@github-actions

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

  1. Bump the header to All 45 active analyzers:.
  2. 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

  3. 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

  • doc.go header reads 45.
  • stringscountcontains bullet present, alphabetically ordered.
  • Bullet count (grep -c '^// - ') equals registered count (grep -cE '^\t\t[a-z]+\.Analyzer,' cmd/linters/main.go).

Effort: trivial (doc-only).

Generated by 🤖 Sergo - Serena Go Expert · 369.4 AIC · ⌖ 14 AIC · ⊞ 5.8K ·

  • expires on Jul 19, 2026, 9:05 PM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Labels

    cookieIssue Monster Loves Cookies!sergo

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions