Repository navigation
fix(linters): see through parens, aliases and dot-imports in osexitinlibrary, rawloginlib, logfatallibrary, fprintferrorunchecke - #76123
Conversation
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Ponytail Reviewer completed successfully!
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported, although tests and formatting checks were not run and CI validation remains pending.
No open issues 🎉
What changed in this PR
Continues the linter call-matching improvements in gh-aw, making five analyzers handle equivalent Go syntax more consistently and reducing missed diagnostics and false positives.
Changes:
- Uses shared, type-aware helpers to recognize parenthesized, dot-imported, and aliased calls in four linters.
- Preserves the
blankassigncommahash-writing exemption for parenthesized calls. - Adds regression fixtures for alternate call forms, suppression directives, console output, and shadowed identifiers.
The PR reports that tests and formatting checks were not run; CI validation remains pending.
| File | Description |
|---|---|
pkg/linters/rawloginlib/testdata/src/rawloginlib/parenthesized.go |
Tests parenthesized calls, dot imports, and suppression. |
pkg/linters/rawloginlib/rawloginlib.go |
Resolves logging calls with PackageCall. |
pkg/linters/osexitinlibrary/testdata/src/osexitinlibrary/parenthesized.go |
Tests parenthesized exit calls and suppression. |
pkg/linters/osexitinlibrary/testdata/src/osexitinlibrary/dot_import.go |
Tests dot-imported Exit. |
pkg/linters/osexitinlibrary/osexitinlibrary.go |
Matches exit calls with CalledOSFunc. |
pkg/linters/logfatallibrary/testdata/src/logfatallibrary/parenthesized.go |
Tests parenthesized fatal calls, dot imports, and suppression. |
pkg/linters/logfatallibrary/logfatallibrary.go |
Resolves fatal logging calls with PackageCall. |
pkg/linters/fprintferrorunchecked/testdata/src/fprintferrorunchecked/parenthesized.go |
Tests parentheses, import aliases, console exemptions, and shadowing. |
pkg/linters/fprintferrorunchecked/fprintferrorunchecked.go |
Adds type-aware call matching and consolidates blank-assignment handling. |
pkg/linters/blankassigncomma/testdata/src/blankassigncomma/blankassigncomma.go |
Tests parenthesized hash and non-hash writer calls. |
pkg/linters/blankassigncomma/blankassigncomma.go |
Unwraps parentheses when checking the hash-writing exemption. |
Review effort: Balanced (auto)
|
🎉 This pull request is included in a new release. Release: |
Summary
Continues the Sergo "callee shape" audit (R120–R123 merged: #75085, #75294, #75295, #75599, #75816). Five more linters matched
call.Funwith a bare*ast.SelectorExprassertion or a literal identifier name instead of resolving the callee through the type checker.Evidence and fixes
osexitinlibrary(os.Exit)(1)and dot-importedExit(1)not reportedastutil.CalledOSFunc(pass, call, "Exit")rawloginlib(log.Printf)(...), dot-importedPrintln(...)not reportedastutil.PackageCall(pkglog)logfatallibrary(log.Fatal)(...), dot-importedFatalln(...)not reportedastutil.PackageCall(pkglog)fprintferroruncheckedfmt:import f "fmt"calls were missed, and a local namedfmtwith aFprintfmethod returning(int, error)was false-flagged; also(fmt.Fprintf)(...),(fmt.Fprintf(...))statements/RHS and(os.Stderr)console argumentsmatchFprintCallhelper (unwrap parens +PackageCall+fmtpath); removedextractFunctionName;isConsoleOutputunwraps parens; the two duplicated assign patterns collapsed into oneblankassigncommahash.Hashio.WriteStringexemption did not see through_, _ = (io.WriteString)(h, ...)/(io.WriteString(h, ...)), so these were false-flaggedastutil.UnwrapParenExpron RHS andFunPackageCalladditionally resolves un-reassigned local function aliases, and is shadow-safe because it goes throughTypesInfo.Tests added (analysistest fixtures)
osexitinlibrary:parenthesized.go(incl. nested parens +nolint),dot_import.gorawloginlib,logfatallibrary:parenthesized.go(parens, dot-import,nolint)fprintferrorunchecked:parenthesized.go(parenthesized callee/call, aliased import, parenthesized console arg, nolint, shadowingfmtnegative)blankassigncomma: parenthesized hash exemption (negative) and parenthesized non-hash writer (positive)Validation
get_diagnostics_for_fileon all 5 edited linter files and the new fixtures: no errors (only pre-existingunusedfunchints on fixtures).go test/gofmt/makewere denied in this sandbox, so the analysistest suites were NOT executed here andmake fmtwas not run (comment alignment in the fixtures was done by hand). Please rely on CI (go test ./pkg/linters/...) and runmake fmtif CI flags formatting.🤖 Generated with [Claude Code]((claude.com/redacted)