spot/src/sanity/80columns.test
Alexandre Duret-Lutz 7eb5f3d81a * src/sanity/style.test: Catch {.*{ and }.*}.
* src/sanity/80columns.test: Untabify files.
* iface/gspn/ltlgspn.cc, src/ltlvisit/basereduc.cc: Fix long lines.
2004-05-25 11:05:07 +00:00

43 lines
1 KiB
Bash
Executable file

#! /bin/sh
# Check that all files use at most 80 columns.
set -e
untabify()
{
perl -pe 's/^((.{8})*)\t/$1 /g;
s/^(.(.{8})*)\t/$1 /g;
s/^(..(.{8})*)\t/$1 /g;
s/^(...(.{8})*)\t/$1 /g;
s/^(....(.{8})*)\t/$1 /g;
s/^(.....(.{8})*)\t/$1 /g;
s/^(......(.{8})*)\t/$1 /g;
s/^(.......(.{8})*)\t/$1 /g;' $1
}
rm -f failures
for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
find "$dir" \( -name "${1-*}.hh" -o -name "${1-*}.cc" \
-o -name "${1-*}.test" \) -a -type f -a -print |
while read file; do
x='........................................'
if (untabify $file | grep -q $x.$x) 2>/dev/null; then
if grep 'GNU Bison' "$file" >/dev/null ||
grep 'generated by flex' "$file" >/dev/null ; then
:
else
echo "$file" >>failures
fi
fi
done
done
if test -f failures; then
echo "The following files contain lines with more than 80 characters:"
cat failures
rm failures
exit 1;
fi