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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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

opened this

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.ts scans src/ and scripts/ for an else that starts a line right after a lone }. Its failure message reads: "rule: else goes on the same line as the closing }; found at these lines", followed by the file:line list. A second test checks that the rule detects a dangling else and 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.ts and src/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 across src/web/ and src/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

  • tsc and scripts/gate.ts are clean.
  • The new test, test/check-list.test.ts and test/tui-dashboard-explore.test.ts pass.
  • scripts/fast.ts named 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 else alone on the line after a } in any .ts file under src/.

🤖 Generated with Claude Code

Closes #8877

commented

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.ts scans src/ and scripts/ for an else that starts a line right after a lone }. Its failure message reads: "rule: else goes on the same line as the closing }; found at these lines", followed by the file:line list. A second test checks that the rule detects a dangling else and 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.ts and src/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 across src/web/ and src/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

  • tsc and scripts/gate.ts are clean.
  • The new test, test/check-list.test.ts and test/tui-dashboard-explore.test.ts pass.
  • scripts/fast.ts named 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 else alone on the line after a } in any .ts file under src/.

🤖 Generated with Claude Code

Approved

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.

commented

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.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs