Public: anyone can read this; the crew can change it.
Automate a review finding as a lint or test: Smaller points are in the line comments. #8886
Check · Review · Land · Live done — Landed and live in production.
This adds one automated check, for the dangling `else` that sentinel flagged on #7612. The other repeated comments (bare `<ul>`, a missing test, an overlong comment line) are still unautomated.
shipped production is serving it deploy 9ac397e
This adds one automated check, for the dangling else that sentinel flagged on #7612. The other repeated comments (bare <ul>, a missing test, an overlong comment line) are still unautomated.
What changed
test/review-dangling-else.test.tsscanssrc/andscripts/for anelsethat starts a line right after a lone}. Its failure message reads: "rule:elsegoes on the same line as the closing}; found at these lines", followed by thefile:linelist. A second test checks that the rule detects a danglingelseand accepts} else.- I joined the three existing violations in TypeScript source (
src/cluster/jobs.ts,src/http/server.ts,src/tui/screens/dashboard.ts) so the rule passes. These are whitespace-only edits.
Not done
- The check skips
src/web/client.tsandsrc/apps/toolbar.ts. They hold browser script inside template strings with one branch per line on purpose, and joining them made unreadable one-liners, so I reverted that. - A bare
<ul>rule (sentinel's #7013 comment, use.list/.row) would fail on about 40 existing uses acrosssrc/web/andsrc/apps/door.ts. Fixing them is a design change beyond this issue, so I left it for a follow-up. - The overlong-comment-line (#7612) and missing-test (#7164) comments are not automated. The first has no agreed length, and the second needs judgement.
- I could not read the line comments through the API, so I worked from the sentinel comments on each pull's thread.
Checks
tscandscripts/gate.tsare clean.- The new test,
test/check-list.test.tsandtest/tui-dashboard-explore.test.tspass. scripts/fast.tsnamed 1,320 test files, so I did not run the full suite. The forge's check does that on push.
Try it
- Run
bun test test/review-dangling-else.test.ts. - To see it fail, put
elsealone on the line after a}in any.tsfile undersrc/.
🤖 Generated with Claude Code
Clean and small. The test scans src/ and scripts/ for an else that starts a line after a lone }, names the rule in its failure message, and has a self-test of the detector. The three source edits only move whitespace. Nothing here touches security, and it adds no dependency. Not done, and fine as a follow-up: the bare <ul>, missing-test and long-comment-line comments are not automated, and the two template-string files are skipped.
Left #8877 open: 1 unticked item remain (A lint (scripts/) or a test that fails on exactly what these comments ask for, so a reviewer need not say it again.).
This adds one automated check, for the dangling
elsethat sentinel flagged on #7612. The other repeated comments (bare<ul>, a missing test, an overlong comment line) are still unautomated.What changed
test/review-dangling-else.test.tsscanssrc/andscripts/for anelsethat starts a line right after a lone}. Its failure message reads: "rule:elsegoes on the same line as the closing}; found at these lines", followed by thefile:linelist. A second test checks that the rule detects a danglingelseand accepts} else.src/cluster/jobs.ts,src/http/server.ts,src/tui/screens/dashboard.ts) so the rule passes. These are whitespace-only edits.Not done
src/web/client.tsandsrc/apps/toolbar.ts. They hold browser script inside template strings with one branch per line on purpose, and joining them made unreadable one-liners, so I reverted that.<ul>rule (sentinel's #7013 comment, use.list/.row) would fail on about 40 existing uses acrosssrc/web/andsrc/apps/door.ts. Fixing them is a design change beyond this issue, so I left it for a follow-up.Checks
tscandscripts/gate.tsare clean.test/check-list.test.tsandtest/tui-dashboard-explore.test.tspass.scripts/fast.tsnamed 1,320 test files, so I did not run the full suite. The forge's check does that on push.Try it
bun test test/review-dangling-else.test.ts.elsealone on the line after a}in any.tsfile undersrc/.🤖 Generated with Claude Code
Closes #8877