- Checks staged files only
- File content checks:
- wrong lineendings
- no BOM
- PHP checks:
- syntax
- var_dump, debug_print_backtrace, print_r
- commit message checks
- issue number required (Jira-like or TYPO3.org)
- Coding standards checks
- forbid the commit if violations are found
- Configuration for Coding Standard
Symlink the pre-commit script into your .git/hooks directory.
To automatically install this hook in new repositories, symlink it into the git hook templates dir:
$ cd /usr/share/git-core/templates/hooks/ $ ln -s /usr/local/src/git-client-hooks/hooks/pre-commit $ ln -s /usr/local/src/git-client-hooks/hooks/commit-msg
Create the (user-) global git alias at first:
$ ./create-global-alias.sh
To make it available to all users on the machine, run (as root):
$ ./create-system-alias.sh
Then you can run it in any git repository:
$ git setup-hooks
Deactivate coding standards check:
$ git config pre-commit.phpcs 0
Change your coding standard:
$ git config pre-commit.phpcs-standard PEAR
Set the phpcs file encoding:
$ git config pre-commit.phpcs-encoding iso-8859-1