gerardroche / php-cs-fixer-pre-commit-hook

PHP-CS-Fixer pre-commit hook

Home Page:https://blog.gerardroche.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP-CS-Fixer Pre-Commit Hook

This script runs PHP-CS-Fixer before committing code.

The fixer is run quietly to avoid any output. If there are violations, it is run again in verbose mode to provide information about the violations.

Only changed files since the last commit are checked, unless configuration files that might impact all files are changed, in which case a full check is done.

This hook is invoked by git commit, and can be bypassed using the --no-verify option.

git commit --no-verify

Environment variables

  • PHP_CS_FIXER_IGNORE_ENV=1
  • XDEBUG_MODE=off

Installation

Create the hooks directory:

mkdir ~/.githooks

Download or copy the pre-commit script to:

~/.githooks/pre-commit

Ensure the file is executable:

chmod 744 ~/.githooks/pre-commit

Configure the Git hooks path:

git config --global core.hooksPath ~/.githooks

License

Released under the GPL-3.0-or-later License.

About

PHP-CS-Fixer pre-commit hook

https://blog.gerardroche.com

License:GNU General Public License v3.0


Languages

Language:Shell 100.0%