scripts/check-file-sizes.sh

ac8dfd22fd3c7a6dbb719b8c46ec0a8c19608444
orgstar/scripts/check-file-sizes.sh

12 lines · 650 bytes · executable

 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."
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form