2017-25 © Pedro Peláez
 

library commithook

PHP Commit Hooks

image

andkirby/commithook

PHP Commit Hooks

  • Friday, October 13, 2017
  • by andkirby
  • Repository
  • 3 Watchers
  • 8 Stars
  • 144 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 47 Open issues
  • 73 Versions
  • 0 % Grown

The README.md

CmHook

CmHook is GIT commit hook the code validator for PHP (Code Sniffer), CSS (base only), JS (JsHint) code and commit message formatter/filler with the issue tracker integration (JIRA, GitHub)., (*1)

Gitter, (*2)

The main purpose of this project is - checking coding standards before commit (by using PHP CodeSniffer, JSHint, RuboCop, or any lint tool) - filling up commit messages automatically to proper format (details), (*3)

Supported file types: php, phtml, js, coffee, css, scss, xml, sh, scss, css, json, less, html, htm., (*4)

The simplest commit message you could ever make

Target commit message:, (*5)

Implemented #33: Make smth good now
 - Added my file.

This commit message will be generated automatically, we need to type only commit description:, (*6)

$ git add myfile.php
$ git commit -m 'Added my file.'

See more details about short commit messages., (*7)

Installation

Latest release is v2.0.0-beta.47

Install globally

To get last beta version please define your minimum-stability., (*8)

{
  "minimum-stability": "beta",
  "prefer-stable": true
}

Due to reason the package requires one package which still in "dev", please fetch it first:, (*9)

$ composer global require chobie/jira-api-restclient ^2.0@dev

Now fetch the package:, (*10)

$ composer global require andkirby/commithook ~2.0@beta

Enable hooks in a project (with predefined configuration)

If a project already have base configuration files all what you need to: - define interpreters (PHP for PHPCS, Ruby for Rubocop, NodeJs for JSHint) - PHP example: shell $ commithook config --xpath code/interpreter/php d:/s/php-7.0.14/php.exe --project-self (You may try to use PHP Windows Binaries Downloader (gist)) - Install extra code validators: - PHPCS shell $ composer global require squizlabs/php_codesniffer:~2.0@stable - JSHint (original). - Rubocop installation. - (optional) Perhaps, you have to define binaries for extra code validators in case they are not allow to use globally. (e.g. JSHint, any see how to install any "linter" in this example.) - Install GIT hook files $ commithook install - Enable your tracker integration: $ commithook tracker:wizard, (*11)

Sample .bashrc

Here is an example of .bashrc file for global using., (*12)

Separate installation

If global way doesn't work you may use installation via create-project., (*13)

Documentation references

Installation

Initialize configuration wizard
GIT integration: hook files installation
, (*14)

Password tracker update

Password update
, (*15)

Code validation

Ignore validation
Protect code
Enable JsHint validation (Javascript)
, (*16)

Commit message

Commit message format
Ignore commit message validation
Active task in commit message
Auto-explode commit message into the list
, (*17)

Problems

Bugs

Issue bugs list., (*18)

Code validators doesn't work with GIT cache

The code validation works with GIT but it doesn't support git cache. It means if you added a file (git add file.php), changed it, and trying to commit (without adding it into GIT cache). In commit, of course, you will get code from cache but validators will validate your real file. (#113), (*19)

Minor bugs in short commit message

#92, #91, #32, (*20)

Tips & tricks

Redundant gaps in code

You may quickly find gaps/trailing spaces in your code by the regular expression:, (*21)

(\n\s*\n\s*\})|(\n\s*\n\s*\n)|(\{\n\s*\n)| +\n

Just use it in your IDE., (*22)

OS environment

Tested on Windows in GIT Bash v2.9., (*23)

Feel free to create your faced issue., (*24)

Release notes

The Versions

02/11 2015

v2.0.0-beta.4

2.0.0.0-beta4

PHP Commit Hooks

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Andrew Roslik

23/10 2015

v2.0.0-beta.3

2.0.0.0-beta3

PHP Commit Hooks

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Andrew Roslik

16/10 2015

v2.0.0-beta.2

2.0.0.0-beta2

PHP Commit Hooks

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Andrew Roslik

13/10 2015

v2.0.0-beta.1

2.0.0.0-beta1

PHP Commit Hooks

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Andrew Roslik

13/10 2015

v2.0.0-beta.0

2.0.0.0-beta0

PHP Commit Hooks

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Andrew Roslik

13/10 2015

v2.0.0-beta+2015-10-13

2.0.0.0-beta

PHP Commit Hooks

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Andrew Roslik

23/06 2015

v1.8.0-p3

1.8.0.0-patch3

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

10/06 2015

v1.7.0b.2

1.7.0.0-beta2

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

03/05 2015

v1.7.0b.1

1.7.0.0-beta1

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

27/04 2015

v1.7.0b

1.7.0.0-beta

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

23/04 2015

v1.7.0a

1.7.0.0-alpha

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

15/04 2015

v1.6.10-alpha.12

1.6.10.0-alpha12

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

14/04 2015

v1.6.10-alpha.11

1.6.10.0-alpha11

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

26/03 2015

v1.6.10-alpha.10

1.6.10.0-alpha10

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

26/03 2015

v1.6.10-alpha.9

1.6.10.0-alpha9

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

19/03 2015

v1.6.10-alpha.8

1.6.10.0-alpha8

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

19/03 2015

v1.6.10-alpha.7

1.6.10.0-alpha7

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

12/03 2015

v1.6.10-alpha.6

1.6.10.0-alpha6

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

11/03 2015

v1.6.10-alpha.5

1.6.10.0-alpha5

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

03/03 2015

v1.6.10-alpha.4

1.6.10.0-alpha4

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

03/03 2015

v1.6.10-alpha.3

1.6.10.0-alpha3

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

26/02 2015

v1.6.10-alpha.2

1.6.10.0-alpha2

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

26/02 2015

v1.6.10-alpha.1

1.6.10.0-alpha1

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

26/02 2015

v1.6.10-alpha

1.6.10.0-alpha

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

18/02 2015

v1.6.9

1.6.9.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

18/02 2015

v1.6.8

1.6.8.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

11/02 2015

v1.6.7

1.6.7.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

20/01 2015

v1.6.6

1.6.6.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

19/01 2015

v1.6.3

1.6.3.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

by Andrew Roslik

19/01 2015

v1.6.4

1.6.4.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

19/01 2015

v1.6.5

1.6.5.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Andrew Roslik

18/01 2015

v1.6.1

1.6.1.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

by Andrew Roslik

18/01 2015

dev-stable

dev-stable

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

by Andrew Roslik

18/01 2015

v1.6.0

1.6.0.0

PHP Commit Hooks

  Sources   Download

proprietary

The Requires

 

by Andrew Roslik

05/01 2015

v1.5.1

1.5.1.0

PHP Commit Hooks

  Sources   Download

proprietary

by Andrew Roslik