#!/bin/sh
fail=0

/bin/sh "${top_srcdir}"/check-whitespace.sh "$@" || fail=$?

if grep -n '^ *GError *\*[[:alpha:]_][[:alnum:]_]* *;' "$@"
then
  echo "^^^ The above files contain uninitialized GError*s - they should be"
  echo "    initialized to NULL"
  fail=1
fi

# The first regex finds function calls like foo() (as opposed to foo ()).
#   It attempts to ignore string constants (may cause false negatives).
# The second and third ignore block comments (gtkdoc uses foo() as markup).
# The fourth ignores cpp so you can
#   #define foo(bar) (_real_foo (__FUNC__, bar)) (cpp insists on foo() style).
if grep -n '^[^"]*[[:lower:]](' "$@" \
  | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*:  *\*' \
  | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*:  */\*' \
  | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*: *#'
then
  echo "^^^ Our coding style is to use function calls like foo (), not foo()"
  fail=1
fi

if test -n "$CHECK_FOR_LONG_LINES"
then
  if egrep -n '.{80,}' "$@"
  then
    echo "^^^ The above files contain long lines"
    fail=1
  fi
fi

exit $fail

#!/bin/sh
fail=0

/bin/sh "${top_srcdir}"/check-whitespace.sh "$@" || fail=$?

if grep -n '^ *GError *\*[[:alpha:]_][[:alnum:]_]* *;' "$@"
then
  echo "^^^ The above files contain uninitialized GError*s - they should be"
  echo "    initialized to NULL"
  fail=1
fi

# The first regex finds function calls like foo() (as opposed to foo ()).
#   It attempts to ignore string constants (may cause false negatives).
# The second and third ignore block comments (gtkdoc uses foo() as markup).
# The fourth ignores cpp so you can
#   #define foo(bar) (_real_foo (__FUNC__, bar)) (cpp insists on foo() style).
if grep -n '^[^"]*[[:lower:]](' "$@" \
  | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*: *\*' \
  | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*: */\*' \
  | grep -v '^[-[:alnum:]_./]*:[[:digit:]]*: *#'
then
  echo "^^^ Our coding style is to use function calls like foo (), not foo()"
  fail=1
fi

if test -n "$CHECK_FOR_LONG_LINES"
then
  if egrep -n '.{80,}' "$@"
  then
    echo "^^^ The above files contain long lines"
    fail=1
  fi
fi

exit $fail

Fix detection of comments when deciding whether a bad_coding_style() report is a false positive
Fix detection of comments when deciding whether a bad_coding_style() report is a false positive


20070912165353-53eee-9b929d147516fdfc8b8d5564bf4b585feae5bcc2.gz
