sgr: route table/list/calendar SGR wrap-helpers through Ansi (§3.3)#879
Merged
Conversation
Replace seven private "wrap text in SGR codes" helpers that hand-built
"\x1b[{$codes}m{$content}\x1b[0m" with Ansi::CSI . $codes . 'm' . $content
. Ansi::reset(). Byte-identical (Ansi::CSI === "\x1b[", Ansi::reset() ===
"\x1b[0m"); the canonical SGR home is SugarCraft\Core\Util\Ansi. Surrounding
empty-codes guards preserved verbatim. All four libs already require
sugarcraft/candy-core.
Sites: sugar-table StyledCell/Column/Table, sugar-stickers Table/FlexBox,
sugar-calendar DatePicker, candy-lister Model.
## Test plan
- sugar-table: 129 tests, 271 assertions — OK
- sugar-calendar: 70 tests, 141 assertions — OK
- candy-lister: 39 tests, 83 assertions — OK
- sugar-stickers: Table+Flex tests 28/28 OK (full suite has 27 pre-existing
errors: missing SugarCraft\Bits\Viewport\Viewport autoload, unrelated to
this change — confirmed identical with changes stashed).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 1 minor |
🟢 Metrics 0 duplication
Metric Results Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Routes seven private "wrap text in SGR codes" helpers through the canonical
SugarCraft\Core\Util\Ansi, replacing hand-built"\x1b[{$codes}m{$content}\x1b[0m"withAnsi::CSI . $codes . 'm' . $content . Ansi::reset().Ansi::CSI === "\x1b["andAnsi::reset() === "\x1b[0m"; codes are never parsed, surrounding empty-codes guards preserved verbatim.sugar-table(StyledCell/Column/Table),sugar-stickers(Table/FlexBox),sugar-calendar(DatePicker),candy-lister(Model).require sugarcraft/candy-core— no new deps. Per §3.3 ofimprovements.md(note appended).src/trees: no other trivial SGR wrap/reset literals found.Test plan
sugar-table— 129 tests, 271 assertions — OKsugar-calendar— 70 tests, 141 assertions — OKcandy-lister— 39 tests, 83 assertions — OKsugar-stickers— Table+Flex tests 28/28 OK. Full suite has 27 pre-existing errors (Class "SugarCraft\Bits\Viewport\Viewport" not found— a missing autoload dep insrc/Viewport.php, unrelated to this change; confirmed identical count with these edits stashed).…mliterals remain in any touched method.