Commit 6c5ed63fe9

6c5ed63fe91fb80c3dbaf76368eb6ddefcab06bb

parent: 1777d5c05f

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-11 04:11 UTC

check-file-sizes.sh

Layout: unified · split

docs/design.md +1
@@ -329,6 +329,7 @@ Fidelity is checked against Emacs itself, using the same oracle pattern as orgo'
329329- Encoding fixtures (BOM, CRLF, mixed endings, invalid UTF-8, non-BMP, combining characters) are public, in the repo.
330330- Save fault-injection tests replace the file on disk at each step of the save sequence.
331331- Personal org files are a second, private corpus run locally; phase gates use the public corpus.
332- `scripts/check-file-sizes.sh` fails when a hand-written Swift file is over 1,000 lines; run it beside `swift test`. The generated `CharFold.swift` and `Queries.swift` are exempt.
332333
333334## Phases
334335
scripts/check-file-sizes.sh added +12
@@ -0,0 +1,12 @@
1#!/bin/sh
2# Lists hand-written Swift files over 1,000 lines and exits 1 when there are any.
3# Generated files (scripts/update-char-fold.sh, scripts/update-highlight-queries.sh) are exempt.
4# Usage: scripts/check-file-sizes.sh
5set -eu
6cd "$(dirname "$0")/.."
7limit=1000
8over="$(find Sources -name '*.swift' \
9 ! -path 'Sources/OrgCore/Keymap/CharFold.swift' ! -path 'Sources/OrgHighlight/Queries.swift' \
10 -exec wc -l {} + | awk -v limit="$limit" '$2 != "total" && $1 > limit { printf "%6d %s\n", $1, $2 }')"
11[ -z "$over" ] || { echo "Swift files over $limit lines:"; echo "$over"; exit 1; }
12echo "No hand-written Swift file over $limit lines."