2016-10-02 21:46:57 +08:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
## vim:set ts=4 sw=4 et:
|
|
|
|
set -e; set -o pipefail
|
|
|
|
|
|
|
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
|
|
|
[[ -z $1 ]] || cd "$1" || exit 1
|
|
|
|
|
|
|
|
find . \
|
|
|
|
-type d -name '.git' -prune -o \
|
|
|
|
-type d -name '.hg' -prune -o \
|
|
|
|
-type d -name 'build*' -prune -o \
|
|
|
|
-type d -name 'tmp*' -prune -o \
|
2022-08-17 21:05:56 +08:00
|
|
|
-type d -name 'vendor' -prune -o \
|
2016-10-02 21:46:57 +08:00
|
|
|
-type f -iname '*.bat' -prune -o \
|
|
|
|
-type f -iname '*.exe' -prune -o \
|
2017-07-23 08:22:42 +08:00
|
|
|
-type f -iname '*.o' -prune -o \
|
|
|
|
-type f -iname '*.obj' -prune -o \
|
|
|
|
-type f -iname '*.out' -prune -o \
|
2016-10-02 21:46:57 +08:00
|
|
|
-type f -iname '*.pdf' -prune -o \
|
2016-10-03 07:32:03 +08:00
|
|
|
-type f -iname '*.swp' -prune -o \
|
2016-10-03 19:13:13 +08:00
|
|
|
-type f -print0 | \
|
|
|
|
LC_ALL=C sort -z | xargs -0r perl -n -e '
|
2016-10-03 07:32:03 +08:00
|
|
|
#print("$ARGV\n");
|
2017-07-23 08:22:42 +08:00
|
|
|
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
2016-10-02 21:46:57 +08:00
|
|
|
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
|
|
|
if (m,([ \t]+)$,) {
|
|
|
|
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
|
|
|
|
if ($1 ne " " || $ARGV !~ m,\.md$,) {
|
|
|
|
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (m,\t,) {
|
2023-10-05 09:51:27 +08:00
|
|
|
if ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
|
|
|
elsif ($ARGV =~ m,\.mk$,) { }
|
|
|
|
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
|
|
|
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
|
|
|
else { print "ERROR: hard TAB detected $ARGV: $_"; exit(1); }
|
2016-10-02 21:46:57 +08:00
|
|
|
}
|
|
|
|
' || exit 1
|