2017 © Pedro Peláez
 

scripts phpcs-git-pre-commit

PHPCS check before commit

image

smgladkovskiy/phpcs-git-pre-commit

PHPCS check before commit

  • Sunday, November 19, 2017
  • by smgladkovskiy
  • Repository
  • 1 Watchers
  • 12 Stars
  • 1,210 Installations
  • Shell
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 1 Versions
  • 23 % Grown

The README.md

PHPCS git pre-commit hook

About

Auto installed git pre-commit hook for running PHP Code Sniffer code checking to PSR2 coding standard compliance. It checks only files that are to be committed., (*1)

Inspired by Enforce code standards with composer, git hooks, and phpcs, (*2)

Installation

Install smgladkovskiy/phpcs-git-pre-commit with composer require command:, (*3)

composer require --dev "smgladkovskiy/phpcs-git-pre-commit"

Or alternatively, include a dependency for smgladkovskiy/phpcs-git-pre-commit in your composer.json file manually:, (*4)

{
    "require-dev": {
        "smgladkovskiy/phpcs-git-pre-commit": "dev-master"
    }
}

To enable code sniff, аdd to post-install-cmd and post-update-cmd in composer.json installation script:, (*5)

"scripts": {
    "install-hooks": ["sh ./vendor/smgladkovskiy/phpcs-git-pre-commit/src/setup.sh"],
    "post-install-cmd": ["@install-hooks"],
    "post-update-cmd": ["@install-hooks"]
}

Then run composer install or composer update. pre-commit hook will be installed or updated if it already exists., (*6)

Usage

Run git commit and pre-commit hook will check your committed files like if you run, (*7)

php phpcs.phar --standard=PSR2 --encoding=utf-8 -n -p /path/to/file.php

Contributing

Feel free to make pull requests!, (*8)

The Versions

19/11 2017

dev-master

9999999-dev

PHPCS check before commit

  Sources   Download

MIT

The Requires

 

by Sergey Gladkovskiy