Repository navigation
Unify JSON decoder EOF checks - #78268
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
✅ 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.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ 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.
|
|
✅ 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.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the changes tying EOF checks to the errors returned by Token or Decode.
No open issues 🎉
What changed in this PR
This PR makes EOF detection consistent in gh-aw’s JSON trailing-data linter, requiring checks to reference the actual error returned by Token or Decode.
Changes:
- Shares one EOF-check predicate across both walkers and supports single- and multi-result assignments.
- Replaces specialized containment scans with a nil-safe generic AST helper.
- Adds regression fixtures for unrelated EOF comparisons and conditions without an initializer.
| File | Description |
|---|---|
pkg/linters/jsondecodertrailingdataunchecked/testdata/src/jsondecodertrailingdataunchecked/jsondecodertrailingdataunchecked.go |
Adds fixtures covering unrelated EOF checks and initializer-free conditions. |
pkg/linters/jsondecodertrailingdataunchecked/jsondecodertrailingdataunchecked.go |
Unifies EOF predicates, tracks returned errors, and introduces nil-safe AST containment. |
Review effort: Balanced (dynamic)
|
🎉 This pull request is included in a new release. Release: |
The token and decode walkers used different rules to recognize
io.EOFchecks, allowing unrelated EOF comparisons to count as checks for token calls. This unifies them around the call’s actual error result.ifcheck across both walkers; recognize the error result in single- and multi-result assignments.ifconditions without an initializer.