Repository navigation
linters: unwrap parenthesized call.Fun in trimleftright, httpnoctx, stringreplaceminusone - #74382
Conversation
|
✅ 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.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail 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. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality 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.
|
There was a problem hiding this comment.
Review: no blocking findings
The parenthesis unwrapping changes are consistent across the three linters, and the added fixtures cover the intended missed forms. No actionable correctness or maintainability issues were identified in the changed lines. Tests were not run as this was a static review.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed linter updates and accompanying fixtures consistently cover parenthesized call forms, with no actionable defects identified.
No open issues 🎉
What changed in this PR
Updates three Go linters to recognize function calls whose function expressions are wrapped in parentheses, ensuring diagnostics and suggested fixes apply consistently to equivalent call forms.
Changes:
- Unwrap parenthesized
call.Funexpressions intrimleftright,httpnoctx, andstringreplaceminusone. - Add parenthesized-call fixtures for each linter.
- Update the
stringreplaceminusonesuggested-fix golden output.
No actionable defects were identified in the reviewed changes.
| File | Description |
|---|---|
| pkg/linters/trimleftright/trimleftright.go | Updated as part of this pull request. |
| pkg/linters/trimleftright/testdata/src/trimleftright/trimleftright.go | Updated as part of this pull request. |
| pkg/linters/stringreplaceminusone/testdata/src/stringreplaceminusone/stringreplaceminusone.go.golden | Updated as part of this pull request. |
| pkg/linters/stringreplaceminusone/testdata/src/stringreplaceminusone/stringreplaceminusone.go | Updated as part of this pull request. |
| pkg/linters/stringreplaceminusone/stringreplaceminusone.go | Updated as part of this pull request. |
| pkg/linters/httpnoctx/testdata/src/httpnoctx/httpnoctx.go | Updated as part of this pull request. |
| pkg/linters/httpnoctx/httpnoctx.go | Updated as part of this pull request. |
Review effort: Lite (auto)
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The triage response was not machine-readable, so skill selection used the fallback bug-fix heuristic.
No actionable issues found in the changed lines. The shared astutil.UnwrapParenExpr helper is applied at each affected call.Fun check, and fixtures cover detection plus the suggested-fix golden output.
Validation: go test ./pkg/linters/trimleftright/ ./pkg/linters/httpnoctx/ ./pkg/linters/stringreplaceminusone/ passed.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: gpt56 max · ~6 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
|
🎉 This pull request is included in a new release. Release: |
Summary
Three linters that CI runs (
cgo.ymllines 1674 and 1701, native and wasm) checkcall.Fun.(*ast.SelectorExpr)without unwrapping parentheses. Because of that, they miss the same call when the function is wrapped in parentheses:trimleftrighttrimleftright.go:59(strings.TrimRight)(s, "txt")httpnoctxhttpnoctx.go:70(http.Get)(rawURL)stringreplaceminusonestringreplaceminusone.go:68,94(strings.Replace)(s, "o", "0", -1)This is the per-linter follow-up to the shared-helper fix from the previous Sergo run. That fix (
astutil.go:269) is merged. Many linters already use this pattern, includingsortslice,lenstringsplit,consolestderrandfileclosenotdeferred.On the new fixture, gopls/staticcheck
QF1004already reports(strings.Replace)(..., -1). The repo's ownstringreplaceminusonelinter did not.Changes
call.Funwithastutil.UnwrapParenExprat all 4 places listed above.stringreplaceminusone.go.golden, because that test usesRunWithSuggestedFixes. The fix text is rebuilt fromsel.X, so the parentheses go away.Validation
get_diagnostics_for_file: no diagnostics on all 3 linter source files. The fixture files only show the existingunusedfuncnotes plus the expectedQF1004hint.find_referencing_symbols:isStringsReplaceCallhas a single caller (run), so nothing else is affected.go testin this sandbox (the command was denied). A maintainer or CI needs to run:go test ./pkg/linters/trimleftright/ ./pkg/linters/httpnoctx/ ./pkg/linters/stringreplaceminusone/Remaining work
Grepfor[^(]\.Fun\.\(\*ast\.still finds about 45 barecall.Funchecks in other linters, for exampletimesleepnocontext,ctxbackground,sprintfint,execcommandwithoutcontextandtimenowsub. These are left for later small PRs.🤖 Generated with [Claude Code]((claude.com/redacted)