fix: ZC1075 skips width-pad and typeset arrays#1423
Merged
Conversation
Two more elision refinements:
- A width modifier `${(l:n:)x}` / `${(r:n:)x}` pads to a fixed width, so
the result is never an empty word. The kata flagged it because the
`l`/`r` flag is not a word-splitting flag. It now skips width flags,
distinguished from `(r)` (reverse, can still be empty) by the `:n:`
argument.
- `typeset arr=(a b)` declares an array, but the parser does not model
its value as an ArrayLiteral here, so the harvest missed it and a bare
`$arr` was flagged. The harvest now also reads a value that renders
with a leading `(`; a quoted scalar `q="(literal)"` keeps its opening
quote and is not mistaken for an array.
Removes 2 findings from the violation baseline (gitstatus width-pad,
spaceship typeset array). Regression and helper tests added.
redteamx
approved these changes
Jun 25, 2026
redteamx
left a comment
Collaborator
There was a problem hiding this comment.
Approved on review. Width-pad + typeset-array skips verified against zsh; 2 baseline removals, helpers 100% covered.
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.
What
Two ZC1075 elision refinements.
${(l:n:)x}/${(r:n:)x}pads to a fixed width — never an empty word. Thel/rflag is not a word-splitting flag, so it slipped past the existing skip. Now skipped, distinguished from(r)(reverse, can be empty) by the:n:width argument.typeset arr=(a b)declares an array, but the parser does not model its value as anArrayLiteralhere. The harvest now also reads a value that renders with a leading(; a quoted scalarq="(literal)"keeps its opening quote and is not mistaken for an array.Verification
${(l:5:)x}confirmed against real zsh: an unset value yields five spaces, never empty.${(l:20:)pgid}, spaceshiptypeset -U sections=(...));(r)reverse and quoted scalars still fire.go test ./...passes,golangci-lint0 issues, new helpers 100% covered, sweeps clean.