oxidecomputer / oxidecomputer/prettier-plugin-asciidoc
Three copies of a blank-set strip become one shared function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
What this is
Three copies of one loop strip a string by a set of blank characters: rubyStrip (src/parse/lines/table-reader.ts:273-283) and cellStrip (src/print/table-layout.ts:988-1000) have byte-identical bodies over a RUBY_WHITESPACE set declared twice, and trimBlank (src/parse/attrlist.ts:160-170) is the same loop over a narrower set. The comment at table-layout.ts:975-978 justifies the copy by the old rule that print reads parse at exactly three addresses; the shared layer that #240 landed (src/whitespace-runs.ts, which src/print already imports at four sites) is where a value both sides need lives now, and that comment is out of date.
The change
One stripBy(text, blanks) in src/whitespace-runs.ts replaces all three; the two RUBY_WHITESPACE declarations become one; the obsolete justification comment goes. About 32 lines deleted (22 code, 10 comment). No behaviour change: the three call sites keep their own blank sets.
Gate
The three callers read the shared function; bun run parse-print-addresses still pins 4 (the shared module is not an address); bun run test, check, lint, citation-check, internal-citations green; the crossings registry rows for the deleted symbols removed and the new one added. Found by the Sep 7 subtraction map (the only remaining second implementation of a live predicate in src).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/whitespace-runs.ts and the three callers in src/parse/lines/table-reader.ts, src/print/table-layout.ts, and src/parse/attrlist.ts; compare their blank sets and the existing shared imports. Run bun run parse-print-addresses first, then the test, check, lint, citation-check, and internal-citations commands. Done means one shared stripBy, one RUBY_WHITESPACE declaration, updated crossings registry rows, and all gates green.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, typescript
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100