Skip to content
Snippets Groups Projects
Commit a06fa611 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Add a script that checks the syntax for all PHP and JSON files.

parent 7e9f3c1e
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
PHP='/usr/bin/env php'
RETURN=0
# check PHP files
for FILE in `find attributemap bin lib modules www -name "*.php"`; do
$PHP -l $FILE > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Syntax check failed for ${FILE}"
RETURN=`expr ${RETURN} + 1`
fi
done
# check JSON files
for FILE in `find dictionaries modules -name "*.json"`; do
$PHP -r "exit((json_decode(file_get_contents('$FILE')) === null) ? 1 : 0);"
if [ $? -ne 0 ]; then
echo "Syntax check failed for ${FILE}"
RETURN=`expr ${RETURN} + 1`
fi
done
exit $RETURN
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment