2017 © Pedro Peláez
 

library git-hooks

Git Hooks

image

juizmill/git-hooks

Git Hooks

  • Wednesday, December 7, 2016
  • by juizmill
  • Repository
  • 4 Watchers
  • 27 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 2 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Git Hooks

Checks list, (*1)

  • Syntax check with php lint (“php -l”): We check every committed file has a valid PHP syntax.
  • Sync check of composer.json and composer.lock files: We check these two files are committed together in order to avoid committing the json but not the lock and generate some issue to another developers.
  • PHP CS Fixer check: With the –dry-run parameter it does not fix, just say what the problems are. With the –fixers parameter you can control what fixers you want to execute.
  • PHP Code Sniffer check: Same as before, but another rule that checks another rules.
  • PHPMD: We have enabled the controversial rules.
  • Unit Testing check: We run around 3.000 tests right now.

PHPCsFix, (*2)

PHPLint, (*3)

PHPUnit, (*4)

INSTALLATION:, (*5)

The recommended way to install this library is through Composer:, (*6)

add juizmill/git-hooks as a composer dependency., (*7)

composer.json, (*8)

"require-dev": {
    ...
    "juizmill/git-hooks": "dev-master"
}

php composer.phar update juizmill/git-hooks, (*9)

USAGE:, (*10)

When a developer clones the project, it just needs to:, (*11)

Edit composer.json and add:, (*12)

    "scripts": {
        "pre-update-cmd": "GitHooks\\Composer\\Script\\Hooks::preHooks",
        "pre-install-cmd": "GitHooks\\Composer\\Script\\Hooks::preHooks",
        "post-update-cmd": "GitHooks\\Composer\\Script\\Hooks::postHooks",
        "post-install-cmd": "GitHooks\\Composer\\Script\\Hooks::postHooks"
    }

Remembering to set up the hooks, (*13)

Custom config

Copy arquives vendor/juizmill/git-hooks/config/* to [project], (*14)

Reference

Write your git hooks in PHP and keep them under git control, (*15)

PHP_CodeSniffer, (*16)

PHP-CS-FIX, (*17)

PHPMD, (*18)

Custom PHPCS and PHPMD, (*19)

The Versions