diff options
| author | Radon Rosborough <radon.neon@gmail.com> | 2022-01-03 20:07:29 -0800 |
|---|---|---|
| committer | Radon Rosborough <radon.neon@gmail.com> | 2022-01-03 20:07:29 -0800 |
| commit | a606d59c2dbe3b7fc70950c989ca02e6a0a15095 (patch) | |
| tree | 498c1103a7894c24bd6450213b8942035d0256f8 /scripts | |
| parent | e1dbc1b1c04eca33749d7e931c5bb17ea6f9379e (diff) | |
Port longlines checker from CTRLF
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check-line-length.bash | 26 |
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 .) |
