[code-simplifier] Simplify purity_scan.go by extracting resolveObj and ensureDir helpers - #53036
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. No test files were added or modified in this PR. Test Quality Sentinel skipped.
|
|
✅ Ponytail Reviewer completed successfully! Reviewed PR #53036 per ponytail-review skill: pure DRY refactor extracting resolveObj() and ensureDir() to replace duplicated inline blocks (net -13 lines). No speculative abstractions, no reinvented stdlib, no dead flexibility introduced. Lean already. Ship.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
There was a problem hiding this comment.
Pull request overview
This PR performs a behavior-preserving refactor of the PureLock scanner.
Changes:
- Centralizes Go object lookup in
resolveObj. - Centralizes parent-directory creation in
ensureDir.
Show a summary per file
| File | Description |
|---|---|
.github/scripts/purelock/purity_scan.go |
Replaces duplicated lookup and directory-creation logic with shared helpers. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
There was a problem hiding this comment.
Verdict
No blocking issues found in the changed lines.
Review notes
This patch is a narrow refactor that extracts duplicated identifier resolution and parent-directory creation into helpers without changing control flow or error handling. I checked the modified call sites for semantic drift and did not find an actionable correctness, performance, or testability regression in the diff.🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 2.33 AIC · ⌖ 5.3 AIC · ⊞ 6.9K
Comment /review to run again
There was a problem hiding this comment.
The refactoring is clean and correct. Both resolveObj and ensureDir are faithful extractions of the inlined patterns they replace, with no behavioural changes. No issues found.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 12.3 AIC · ⌖ 7.88 AIC · ⊞ 5.6K
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design — the extractions are clean and the PR is approvable with one naming observation.
📋 Key Themes & Highlights
Key Themes
resolveObj: well-named, correctly consolidates 3 identical inline patterns into a single helper.ensureDir: reduces duplication acrosswriteJSON/writeSummary; name is slightly ambiguous (it ensures the parent dir exists for a file path, not a directory itself) —ensureParentDir(path)would be more precise.
Positive Highlights
- ✅ Behavior-preserving: each call site is a drop-in replacement
- ✅ Helper signatures are minimal and match existing code style
- ✅ No change to observable behavior or error paths
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 15.3 AIC · ⌖ 8.31 AIC · ⊞ 7.7K
Comment /matt to run again
|
@copilot Please review the remaining feedback on this PR, refresh the branch if GitHub does not do it automatically, and run the
|
|
🎉 This pull request is included in a new release. Release: |
This PR applies a behavior-preserving simplification to
.github/scripts/purelock/purity_scan.go, a protected file flagged by the code-simplifier pass. It removes duplicated logic by extracting two local helpers used in multiple call sites.Object lookup deduplication (
resolveObj)TypesInfo.Uses→TypesInfo.Defsfallback pattern intoresolveObj(pkg, ident).isLocalValueescapingTargetescapingWriteThroughBaseDirectory creation deduplication (
ensureDir)filepath.Dir+os.MkdirAll) intoensureDir(path).writeJSONwriteSummaryScope and behavior