* src/sanity/style.test: New file.
* src/sanity/Makefile.am (check-local): Run it. * src/ltlvisit/nenoform.cc, src/ltlvisit/tostring.cc, src/tgba/bdddict.cc, src/tgba/bddprint.cc, src/tgba/tgba.cc, src/tgba/tgbaproduct.cc, src/tgbaalgos/lbtt.cc, src/tgbaalgos/magic.cc, src/tgbaalgos/powerset.cc, src/tgbaalgos/reachiter.cc, src/tgbaalgos/gtec/ce.cc, src/tgbaalgos/gtec/gtec.cc, src/tgbatest/ltl2tgba.cc: Fix style issues reported by style.test.
This commit is contained in:
parent
69169970a2
commit
c4a5b325a2
16 changed files with 135 additions and 36 deletions
|
|
@ -32,6 +32,8 @@ check-local:
|
|||
$(SHELL) $(srcdir)/includes.test $(TESTHEADER)
|
||||
INCDIR='$(top_srcdir)/src' \
|
||||
$(SHELL) $(srcdir)/80columns.test $(TESTHEADER)
|
||||
INCDIR='$(top_srcdir)/src' \
|
||||
$(SHELL) $(srcdir)/style.test $(TESTHEADER)
|
||||
|
||||
# Ensure we have not forgotten to include an header.
|
||||
installcheck-local:
|
||||
|
|
|
|||
86
src/sanity/style.test
Executable file
86
src/sanity/style.test
Executable file
|
|
@ -0,0 +1,86 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Ensure consistent style by catching common improper constructs.
|
||||
|
||||
set -e
|
||||
|
||||
diag()
|
||||
{
|
||||
fail=:
|
||||
echo "$file:" "$@"
|
||||
echo ============================================================
|
||||
}
|
||||
|
||||
rm -f failures
|
||||
|
||||
# Get some help from GNU grep.
|
||||
GREP_OPTIONS='--color=auto -n'
|
||||
GREP_COLOR='1;31'
|
||||
export GREP_OPTIONS
|
||||
export GREP_COLOR
|
||||
|
||||
tmp=incltest.tmp
|
||||
|
||||
find "${INCDIR-..}" \( -name "${1-*}.hh" -o -name "${1-*}.cc" \) \
|
||||
-a -type f -a -print |
|
||||
while read file; do
|
||||
if grep 'GNU Bison' "$file" >/dev/null ||
|
||||
grep 'generated by flex' "$file" >/dev/null ; then
|
||||
continue
|
||||
fi
|
||||
|
||||
fail=false
|
||||
|
||||
sed 's,//.*,,' < $file > $tmp
|
||||
|
||||
grep ' if(' $tmp &&
|
||||
diag 'Missing space after "if"'
|
||||
|
||||
grep ' if (.*).*{' $tmp &&
|
||||
diag 'Opening { should be on its own line.'
|
||||
|
||||
grep ' while(' $tmp &&
|
||||
diag 'Missing space after "while"'
|
||||
|
||||
grep ' while (.*).*{' $tmp &&
|
||||
diag 'Opening { should be on its own line.'
|
||||
|
||||
grep ' for(' $tmp &&
|
||||
diag 'Missing space after "for"'
|
||||
|
||||
grep ' for (.*).*{' $tmp &&
|
||||
diag 'Opening { should be on its own line.'
|
||||
|
||||
grep ' switch(' $tmp &&
|
||||
diag 'Missing space after "for"'
|
||||
|
||||
grep ' switch (.*).*{' $tmp &&
|
||||
diag 'Opening { should be on its own line.'
|
||||
|
||||
grep '( ' $tmp &&
|
||||
diag 'No space after opening (.'
|
||||
|
||||
grep ' )' $tmp &&
|
||||
diag 'No space before closing ).'
|
||||
|
||||
grep '! ' $tmp &&
|
||||
diag 'No space after unary operators (!).'
|
||||
|
||||
grep ',[(a-zA-Z+=_!]' $tmp &&
|
||||
diag 'Space after coma.'
|
||||
|
||||
grep '[^ \t\n]&&[^ \t\n]' $tmp &&
|
||||
diag 'Space arround binary operators.'
|
||||
|
||||
grep '[^ \t\n]||[^ \t\n]' $tmp &&
|
||||
diag 'Space arround binary operators.'
|
||||
|
||||
$fail && echo "$file" >>failures
|
||||
done
|
||||
|
||||
if test -f failures; then
|
||||
echo "The following files contain style errors:"
|
||||
cat failures
|
||||
rm failures
|
||||
exit 1;
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue