Skip to content

star lint go-style's section checks are substring tests, so a doc comment that merely mentions Parameters: satisfies them #998

Open

Description

@David-Noble-at-work

star lint go-style's section checks are substring tests, so a doc comment that merely mentions
Parameters: or Returns: satisfies them. No section is required.

// cmd/star/provider/goast/source_file.go, CheckCompliance
if len(d.Params) > 0 && !sf.isTestEntryPoint(d.Name) && !strings.Contains(text, "Parameters:") {
...
if d.Returns != "" && !strings.Contains(text, "Returns:") {

How it was found

While reconciling a nine-violation delta on fix/994-go-style-fix-corrupts-headers, makeHeaderParagraph
was reported as missing its Returns section but not its Parameters section, though it has a
parameter. Its doc comment was:

// makeHeaderParagraph creates a paragraph containing just a section header (e.g., "Parameters:").

The prose mention satisfied the check. The function had no Parameters: section and never would have been
asked for one.

Magnitude: small, and measured

Twelve comment lines in the repository mention Parameters: or Returns: outside a section header. Not all
of them mask a violation, but several plainly do:

Line Why it passes What it is
// Returns: The expanded path with ~ prefix replaced by the home directory contains Returns: a Returns section written inline on one line, not the required header-plus-list
// Returns: true if the path is ignored, false if the path is not ignored. contains Returns: the same
// Type Parameters: contains Parameters: a generic's type-parameter section, satisfying the ordinary parameter check
// makeHeaderParagraph ... (e.g., "Parameters:") contains Parameters: a prose mention, nothing more

So 3,850 is a small undercount, not a wrong number. This is filed for correctness of the gate rather
than for the size of the debt.

Why it matters anyway

Ruled 2026-09-30: "What I want: 100% of all lint issues found and fixed." A check satisfiable by a
substring cannot make that claim -- it is not a statement about the count, it is a statement about whether
the gate can be relied on at all. Worse, the inline // Returns: the expanded path form is the one a person
writes when they do not know the house style, which is exactly the case the linter exists to catch.

It is the same class of defect as
#997 -- a substring where a structure is meant --
and the same fix shape: check what the styler would produce, not whether a marker appears somewhere.

Not folded into the #994 branch, deliberately

Fixing this raises the violation count, and
the #994 plan
requires Phase 2 to leave the count where it found it, so that the fixer's change is provably not a change of
subject. Raising the count there would destroy that check.

Evidence of completion

Related documents

Document What it is
devlore-cli#994 Where this was found; its Phase 2 must not move the count, which is why this is separate
devlore-cli#997 The same substring-instead-of-structure defect in star lint copyright
devlore-cli#938 The unfinished styler port; whether --fix may emit a section without descriptions is decided with this
devlore-cli#964 The go-style sweep whose count this changes
go-style-guidelines.md The house form these checks are meant to enforce

Activity

  1. David-Noble-at-work commented on Nov 9, 2026

    @David-Noble-at-work
    ContributorAuthor

    star github triage sweep added this issue to Triage: devlore, for the rule it breaks:

    • severity: a Bug whose Severity is blank; a bug is Critical, High, Medium or Low
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions