Last active
December 14, 2016 19:09
-
-
Save NewEraCracker/7495c0b5b9264f4760ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This is a little script that will use PHP's lint functionality to | |
# check if syntax of PHP files is correct, ensuring less likelihood | |
# of bad code making it's way into the project. | |
# | |
# For best results, execute this in an environment with PHP version | |
# matching the one being used on the pfSense branch to be checked. | |
# | |
PHP_EXECUTABLE=`which php` | |
#PHP_EXECUTABLE="/c/Program Files (x86)/NuSphere/PhpEd/php55/php.exe" | |
if [ -x "${PHP_EXECUTABLE}" ]; then | |
"${PHP_EXECUTABLE}" -v | |
find . \( -name "*.class" \ | |
-or -name "*.inc" \ | |
-or -name "*.php" \ | |
-or -name "rc.*" \) \ | |
-type f -exec "${PHP_EXECUTABLE}" -n -l "{}" \; | grep -v "No syntax errors detected" 2>&1 | |
else | |
echo "PHP executable not found!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment