Browse Source

Add a sanity check for coding style errors.

tags/v0.99.beta17
Sam Hocevar sam 15 years ago
parent
commit
e304d5a314
3 changed files with 39 additions and 4 deletions
  1. +1
    -1
      Makefile.am
  2. +1
    -0
      examples/.gitignore
  3. +37
    -3
      tests/check-build

+ 1
- 1
Makefile.am View File

@@ -1,6 +1,6 @@
# $Id$

SUBDIRS = kernel caca src examples tests tools caca-sharp cxx python ruby doc
SUBDIRS = kernel caca src examples tools caca-sharp cxx python ruby doc tests
DIST_SUBDIRS = $(SUBDIRS) win32

EXTRA_DIST = NOTES COPYING.GPL COPYING.ISC COPYING.LGPL bootstrap build-dos build-kernel build-win32 caca-config.in libcaca.spec libcaca.sln


+ 1
- 0
examples/.gitignore View File

@@ -23,5 +23,6 @@ swallow
term
text
transform
trifiller
truecolor
unicode

+ 37
- 3
tests/check-build View File

@@ -1,10 +1,15 @@
#!/bin/sh

failure=0
ret=0

#
# Check that the Win32 config.h is in sync with config.h.in
#

config_h_in=$(dirname "$0")/../config.h.in
win32_config_h=$(dirname "$0")/../win32/config.h

failure=0
for key in $(sed -ne 's/.*#undef *\([A-Za-z0-9_]*\).*/\1/p' "$config_h_in");
do
if ! grep '[ef] \<'"$key"'\>' "$win32_config_h" >/dev/null 2>&1; then
@@ -12,12 +17,41 @@ do
failure=1
fi
done

if test "$failure" != "0"; then
exit 1
ret=1
else
echo "0 errors in Win32 config.h"
fi

#
# Check that we have no tabs or trailing spaces in the source code
#
failure=0
for dir in caca cxx examples ruby tools; do
pushd ../$dir >/dev/null
# Dirty hack to print the $(SOURCES) variable
for x in $(make -s ID SHELL='echo @@$(SOURCES)@@' | tr -d '\n' | sed 's/.*@@\([^@]*\)@@.*/\1/');
do
if grep '[[:space:]]$' "$x" >/dev/null 2>&1; then
echo "error: $dir/$x contains trailing spaces"
failure=1
fi
if grep ' ' "$x" >/dev/null 2>&1; then
echo "error: $dir/$x contains tabs"
failure=1
fi
done
popd >/dev/null
done
if test "$failure" != "0"; then
ret=1
else
echo "0 errors in source code"
fi

if test "$ret" != "0"; then
exit 1
fi

exit 0


Loading…
Cancel
Save