Syntax checking PHP, JavaScript, Python automatically with Git
When reviewing code, a simple first step in checking that it doesn’t include any errors is to run a syntax check. In this post, I outline how to set up tools to scan all the code in a directory for syntax errors, and how to run this scan automatically when committing your code to git. For simplicity’s sake I am assuming that you are running Ubuntu, but the principles apply to any development environment.
PHP
The command line version of PHP (package php7.x-cli
) allows you to syntax check a single file: