b449da897c0f | atagen | 2026-05-27 15:49 UTC | 1 | #!/usr/bin/env bash |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 2 | set -euo pipefail |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 3 | |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 4 | threshold="${1:-1000}" |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 5 | |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 6 | allowed=' |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 7 | crates/headroom-core/src/pw/registry.rs |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 8 | crates/headroom-gui/src/app.rs |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 9 | crates/headroom-core/src/profile_store.rs |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 10 | crates/headroom-cli/src/tui.rs |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 11 | crates/headroom-core/src/ipc/ops.rs |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 12 | crates/headroom-dsp/src/limiter.rs |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 13 | crates/headroom-core/src/app_level.rs |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 14 | ' |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 15 | |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 16 | is_allowed() { |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 17 | local file="$1" |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 18 | grep -qxF "$file" <<<"$allowed" |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 19 | } |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 20 | |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 21 | status=0 |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 22 | while IFS= read -r -d '' file; do |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 23 | lines="$(wc -l <"$file")" |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 24 | if (( lines <= threshold )); then |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 25 | continue |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 26 | fi |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 27 | if is_allowed "$file"; then |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 28 | printf 'warn: %s has %s lines allowed over %s\n' "$file" "$lines" "$threshold" |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 29 | else |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 30 | printf 'error: %s has %s lines over %s\n' "$file" "$lines" "$threshold" >&2 |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 31 | status=1 |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 32 | fi |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 33 | done < <(find crates -type f -name '*.rs' -print0 | sort -z) |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 34 | |
b449da897c0f | atagen | 2026-05-27 15:49 UTC | 35 | exit "$status" |