apheleia/scripts/check-line-length.bash
Radon Rosborough 53f243b111
Add formatter tests (#72)
Closes #24
Builds on #25 by @PrimaryCanary
2022-01-05 15:35:12 -08:00

28 lines
476 B
Bash
Executable file

#!/usr/bin/env bash
set -e
set -o pipefail
find=(
find .
-name .git -prune -o
-name .log -prune -o
-path ./test/formatters -prune -o
-name "*.elc" -o
-type f -print
)
readarray -t files < <("${find[@]}" | sed 's#./##' | sort)
code="$(cat <<"EOF"
(length($0) >= 80 && $0 !~ /https?:\/\//) \
{ printf "%s:%d: %s\n", FILENAME, NR, $0 }
EOF
)"
for file in "${files[@]}"; do
echo "[longlines] $file" >&2
awk "$code" "$file"
done | (! grep .)