31,003
edits
Tag: 2017 source edit |
Tag: 2017 source edit |
||
| Line 77: | Line 77: | ||
You can use git hooks to check the syntax of the file you commit and cancel (or better autofix) the commit if something is wrong. You need '''phpcs''' command line tool for this (sudo apt-get -y install php-codesniffer). If you have '''phpcbf''' installed, you can also fix the files automatically. This is how to: | You can use git hooks to check the syntax of the file you commit and cancel (or better autofix) the commit if something is wrong. You need '''phpcs''' command line tool for this (sudo apt-get -y install php-codesniffer). If you have '''phpcbf''' installed, you can also fix the files automatically. This is how to: | ||
Into your GIT repository, copy the file '''./dev/setup/git/hooks/pre-commit''' into your '''.git/hooks''' folder of the local git repository and make it executable. | |||
Next, you need to edit pre-commit file in .git/hooks to modify the DIRPHPCS variable to set the path of your phpcs and phpcbf tool (you can keep it empty if tools are available into your PATH). | Next, you need to edit pre-commit file in .git/hooks to modify the DIRPHPCS variable to set the path of your phpcs and phpcbf tool (you can keep it empty if tools are available into your PATH). | ||