trainUs/scripts/code-stats.sh
David 13f3b305bd
Some checks failed
CI / Lint & Format (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Tests (${{ matrix.browser }}) (chromium) (push) Has been cancelled
CI / Tests (${{ matrix.browser }}) (firefox) (push) Has been cancelled
Add some stats + plan after code review
2026-07-07 16:20:16 +02:00

37 lines
991 B
Bash
Executable file

#!/usr/bin/env bash
# TrainUs code statistics — lines of code by area, via cloc.
# Excludes generated output, dependencies, and the Hugo theme.
# Usage: ./scripts/code-stats.sh
set -euo pipefail
cd "$(dirname "$0")/.."
if ! command -v cloc >/dev/null 2>&1; then
echo "cloc is required (e.g. 'apt install cloc' or 'brew install cloc')" >&2
exit 1
fi
echo "=== Overall (src/, tests/, website/, docs/) ==="
cloc . \
--exclude-dir=node_modules,dist,.git,dev-dist,tmp,.venv \
--fullpath --not-match-d='(^|/)(public|resources|themes)(/|$)' \
--exclude-ext=json,lock
echo
echo "=== src/ (application code) ==="
cloc src/ --exclude-ext=json
echo
echo "=== tests/ (Playwright, excluding venv) ==="
cloc tests/ --exclude-dir=.venv --exclude-ext=json
echo
echo "=== website/ (docs site, excluding generated/theme/deps) ==="
cloc website/ \
--fullpath --not-match-d='(^|/)(public|resources|themes|node_modules)(/|$)' \
--exclude-ext=json,lock
echo
echo "=== docs/ ==="
cloc docs/