aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRadon Rosborough <radon.neon@gmail.com>2022-01-03 20:07:29 -0800
committerRadon Rosborough <radon.neon@gmail.com>2022-01-03 20:07:29 -0800
commita606d59c2dbe3b7fc70950c989ca02e6a0a15095 (patch)
tree498c1103a7894c24bd6450213b8942035d0256f8 /scripts
parente1dbc1b1c04eca33749d7e931c5bb17ea6f9379e (diff)
Port longlines checker from CTRLF
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-line-length.bash26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/check-line-length.bash b/scripts/check-line-length.bash
new file mode 100755
index 0000000..c6a040d
--- /dev/null
+++ b/scripts/check-line-length.bash
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+find=(
+ find .
+ -name .git -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 .)