GitHub - morozov/diff-sniffer-pre-commit: Git pre-commit hook for Diff Sniffer
source link: https://github.com/morozov/diff-sniffer-pre-commit
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Diff Sniffer Pre-Commit Hook
This tool allows you using PHP_CodeSniffer as a pre-commit hook. The main difference from existing solutions that this one validates only changed lines of code but not the whole source tree.
Installation
Diff Sniffer is already built as a PHAR package. All you need is download it and install as a pre-commit hook.
$ wget https://github.com/morozov/diff-sniffer-pre-commit/releases/download/3.1.1/pre-commit.phar
$ chmod +x pre-commit.phar
$ mv pre-commit.phar /path/to/repo/.git/hooks/pre-commit
Alternatively, you can install the hook globally for a user (see man githooks
):
$ git config --global core.hooksPath '~/.git/hooks' # choose a path if you already haven't
$ chmod +x pre-commit.phar
$ mv pre-commit.phar ~/.git/hooks/pre-commit
You can also install Diff Sniffer manually:
$ git clone [email protected]:morozov/diff-sniffer-pre-commit.git
$ cd diff-sniffer-pre-commit
$ composer install
$ bin/pre-commit --version
Configuration
By default, the PHAR distribution uses the PSR2 coding standard. The configuration may be overridden by creating configuration file file in the project root.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK