Skip to content

lenstringzero (22nd custom linter) is registered in the driver but undocumented — sync doc.go, README, and spec_test to 22 analy [Content truncated due to length] #37740

Closed

Description

@github-actions

Summary

The new lenstringzero analyzer (ADR-37618, flags len(s) == 0 / len(s) != 0 on string values) was added to the live analyzer driver but the documentation and spec-test surface were not updated alongside it. The driver now runs 22 analyzers while every documentation/spec artifact still says 21, so the new linter is invisible to the README, the package doc, and — critically — has no spec-test coverage.

  • Driver analyzer count (cmd/linters/main.go): 22 ✅ (includes lenstringzero)
  • pkg/linters/doc.go: 21 ❌
  • pkg/linters/README.md: 21 ❌ (missing from bullet list, table, and import list)
  • pkg/linters/spec_test.go documentedAnalyzers(): 21 ❌ (does not validate lenstringzero.Analyzer)
  • Status: ⚠️ self-consistency gap

Evidence

lenstringzero is imported and registered in the multichecker:

  • cmd/linters/main.go:29 — "github.com/github/gh-aw/pkg/linters/lenstringzero"
  • cmd/linters/main.go:64 — lenstringzero.Analyzer,

But it is absent everywhere the linter set is documented/asserted:

Per-artifact breakdown

pkg/linters/doc.go

Line 3 states // The actual analyzers are implemented in subpackages. All 21 active analyzers: followed by a 21-item bullet list that does not include lenstringzero.

pkg/linters/README.md

lenstringzero does not appear anywhere (grep → not found). The three places that enumerate analyzers all stop at 21:

  • the Subpackages bullet list (~line 28, ends at tolowerequalfold / uncheckedtypeassertion)
  • the Public API > Subpackages table (~line 57)
  • the import list (~line 122)

pkg/linters/spec_test.go

documentedAnalyzers() (lines 62–86) returns 21 entries and the doc comment (lines 49–61) explicitly says "The README documents 21 analyzer subpackages". Because TestSpec_PublicAPI_SubpackageAnalyzers, TestSpec_UsageExample_AnalyzersUsable, and TestSpec_DesignDecision_UniqueAnalyzerNames all iterate over this list, none of them exercise lenstringzero.Analyzer — its Name/Run wiring and name-uniqueness are currently unverified by the spec suite.

Impact

  • The newest linter has zero spec-test coverage: a regression that nil'd lenstringzero.Analyzer, dropped its Run, or collided its Name with another analyzer would not be caught by spec_test.go.
  • Contributors reading doc.go / README.md cannot discover the linter or its rule, and the documented count ("All 21") is now stale/incorrect.
  • Breaks the established one-package-per-linter self-consistency invariant that prior Sergo runs have relied on (every shipped analyzer is documented + spec-tested).

Recommendation

Sync all three artifacts to 22 analyzers, matching the pattern used for the previous additions:

  1. pkg/linters/doc.go — change All 21 active analyzers → All 22 active analyzers and add the bullet:
    // - lenstringzero — flags len(s) == 0 / len(s) != 0 on string values that should use s == \"\" / s != \"\"
  2. pkg/linters/README.md — add lenstringzero to the Subpackages bullet list, the Public API table row, and the import list (alphabetical position: after largefunc, before manualmutexunlock).
  3. pkg/linters/spec_test.go — add the import and the {\"lenstringzero\", lenstringzero.Analyzer} entry to documentedAnalyzers(), and update the count/comment from 21 → 22 (lines 49–61).

Validation checklist

  • go test ./pkg/linters/... passes with lenstringzero added to documentedAnalyzers()
  • grep -c of analyzer rows in README equals the count in cmd/linters/main.go
  • doc.go count and bullet list both read 22
  • TestSpec_PublicAPI_SubpackageAnalyzers/lenstringzero subtest runs and passes

Effort: Low (documentation + one test-table entry; no analyzer logic changes).

References

  • ADR: docs/adr/37618-add-lenstringzero-linter.md
  • Driver: cmd/linters/main.go:29, cmd/linters/main.go:64

Generated by 🤖 Sergo - Serena Go Expert · 236 AIC · ⌖ 15.2 AIC · ⊞ 6.5K · ◷

  • expires on Jun 14, 2026, 9:25 PM UTC-08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

cookiesergo

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions