Commit b3d0411
refactor: address PR review on ls/directories commands
Resolve the Codacy quality-gate findings and Gemini review feedback on
PR #26:
- Extract shared presentation into src/commands/tree-view.ts (metric cells,
JSON projections, glyphs) and split each command's action handler into small
helpers, bringing both under the Lizard complexity/length thresholds and
removing the ls/directories duplication.
- Replace the non-literal `new RegExp(String.fromCharCode(27)...)` in the test
files with a shared `consoleOutput()` helper (src/test-support.ts, excluded
from the build) that uses a plain regex literal — fixes the Opengrep
non-literal-regexp finding and the duplicated helper.
- Handle null (not just undefined) in formatCountCell/formatCoverageCell, since
the API may return null for an uncomputed metric.
- Normalize `.`/`./` paths to the repository root in normalizeRepoPath.
- Bound the --plus-children children fetches with a concurrency cap
(mapWithConcurrency) instead of an unbounded Promise.all.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 529f6ad commit b3d0411
11 files changed
Lines changed: 519 additions & 385 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 26 | | |
35 | 27 | | |
36 | 28 | | |
| |||
66 | 58 | | |
67 | 59 | | |
68 | 60 | | |
69 | | - | |
| 61 | + | |
70 | 62 | | |
71 | 63 | | |
72 | 64 | | |
| |||
101 | 93 | | |
102 | 94 | | |
103 | 95 | | |
104 | | - | |
| 96 | + | |
105 | 97 | | |
106 | 98 | | |
107 | 99 | | |
| |||
131 | 123 | | |
132 | 124 | | |
133 | 125 | | |
134 | | - | |
| 126 | + | |
135 | 127 | | |
136 | 128 | | |
137 | 129 | | |
| |||
206 | 198 | | |
207 | 199 | | |
208 | 200 | | |
209 | | - | |
| 201 | + | |
210 | 202 | | |
211 | 203 | | |
212 | 204 | | |
| |||
226 | 218 | | |
227 | 219 | | |
228 | 220 | | |
229 | | - | |
| 221 | + | |
230 | 222 | | |
231 | 223 | | |
232 | 224 | | |
| |||
0 commit comments