refactor(service): extract getDesignName helper#62
Open
valentinozegna wants to merge 1 commit into
Open
Conversation
The expression path.basename(design, path.extname(design)) was repeated across 5 service tool files (8 call sites). Add a getDesignName() helper to src/paths.ts and use it everywhere, dropping the now-unused path imports. No behavior change. Per request, the three search functions in search-components.ts were left structurally intact (only the design-name expression was swapped).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
path.basename(design, path.extname(design))was duplicated across 5 service tool files (8 call sites). Add agetDesignName()helper tosrc/paths.tsand use it everywhere, dropping the now-unusedpathimports.Touched files:
src/paths.ts— newgetDesignName(design)helpersrc/service/tools/query-component.tssrc/service/tools/list-components.tssrc/service/tools/query-xnet.ts(2 sites)src/service/tools/search-nets.tssrc/service/tools/search-components.ts(3 sites)cadence-export.tskeeps itspathimport (usespath.join/dirnamefor real path work — out of scope).Scope note
Per request, the three search functions in
search-components.tswere left structurally intact — only the design-name expression was swapped, no collapsing/merging of those functions.Verification
npm run type-check✅npm run lint✅npm test✅ (404/404)Context
Found during a codebase audit. No behavior change.
https://claude.ai/code/session_01LGUEJTmg3MJDiCSZqzL5ED
Generated by Claude Code