[clug] CVS commitinfo check php syntax
Joel Pearson
pearj at writeme.com
Thu Jun 3 14:17:10 GMT 2004
I tested the phpsyntax script a bit and found that it didn't work properly,
but it didn't fix the problem, I can still commit broken php code.
phpsyntax.sh changed script:
#/bin/bash
while test "$1" != ""
do
FILENAME=$1
/usr/bin/php -l $FILENAME 2&> /dev/null
if [ $? -ne 0 ]; then
return 1
fi
shift
done
return 0
When this runs on the command line, it generates errors when it gets to the
return bit:
/usr/local/sbin/phpsyntax.sh: line 9: return: can only `return' from a
function or sourced script
I assume that wouldn't be a problem because when commitinfo calls the script
it would be ok?
Either way it still looks like the script isn't being run at all
-Joel
"Joel Pearson" <pearj at writeme.com> wrote in
message news:c9na3r$29c$1 at sea.gmane.org...
> Hi,
>
> On a phpcruise I went on earlier in the year someone mentioned that the
> syntax of php could be checked on a cvs commit, so that obviously broken
php
> code doesn't make it into cvs. I fiddled for quite a while but I can't
make
> it work.
>
> Here is my commitinfo:
> ^.*\.php$ /usr/local/sbin/phpsyntax
>
> and /usr/local/sbin/phpsyntax:
> #/bin/bash
> shift
> while test "$1" != ""
> do
> FILENAME=$1
> /usr/bin/php -l $1 2&> /dev/null
> if [ $? -ne 0]; then
> return 1
> shift
> fi
> done
> return 0
>
> But for whatever reason the script doesn't run or doesn't work, I'm not
sure
> which one, caus I have no idea if there is a log that is hiding somewhere
> that would explain why it doesn't work. But I have a sneaking suspicion
> that the phpsyntax script isn't running, or even if it is, it's written
> badly. I'm happy to accept either :-).
>
> So can anyone offer me some tips ?
>
> Thanks
>
> -Joel
>
>
>
>
More information about the linux
mailing list