You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.
jlleblanc edited this page Sep 13, 2012
·
1 revision
PHP Codesniffer can be used to automatically check your code for style issues. This can be done through a Git pre-commit hook. The hook will prevent you from committing code that does not conform to the Joomla Platform coding standards.
To add this hook, first install PHP Codesniffer. Once PHP Codesniffer is installed, you will need to know where the phpcs binary is located. This can typically be found by entering which phpcs on the command line.
Finally, you will need to add the hook itself. This project has a PHP Codesniffer Git hook ready to configure. Once you've copied the config and pre-commit files into the .git/hooks folder, make sure that pre-commit is executable. Then edit the config file, supplying values for these variables:
PHPCS_BIN - use the full path to your phpcs binary
PHPCS_CODING_STANDARD - set this to build/phpcs/Joomla
Now, whenever you commit code, it will be checked against the Joomla Platform coding standards. If there are any issues in files you have changed, it will stop the commit and display a report.