Guard your codebase from bad code!
...',,,,,',:
,,.',okxc,,,Oc
.,.',;0OOx,,,;K'
:.',,;XoxK,,,,cK.
';.',,,l00d,,,,,oO
c''',,,oWWo,,,,,,O:
,:.',,,,;NX,,,,,,,:0
,;.',,,,,K0,,,,,,,,k;
;,',,,,:OMWx;,,,,,,l.
.odxxox0NNWNNXkooxOXW.
okKWNNX0NNXKkNNWWWWN.
'dOWNWNKNWNX0MXNWWWo
,oONWX0KWN0OKNWWNo.
....;c;...cl',',lo;'...
.......';odOKXNKc'..'',,,'.
...;ldxlxWWWWWWWWXW0doc;,,,,.
.'oKNWWWWN0kOKXXX00NWNWWN0xc,,.
'xNWWWWWN0o'..,:c,'',kNWWWWWWKo,
,XWWNX0Odc,',oxxxxc.,,':xXNNNWWWK;
.0WXOdl:,..''ldolodx;',,,,;lkKXXNWN.
.:xxc;'. ..,'ldddooxc',,,,,,,.',:;:
.... ...,,,oxxxOd,,,,,,,,,....
... ..',,,'lokd,,,,,,,,,,...
.....,,,'oxKd,,,,,,,,,..
...,,,'o0Wd,,,,;;:c:
:oxdxxcoNWkxkkkO0KKx
.';;;;,OXW0...,,,,,'
...',,,'lKKW0...,,,,,,.
..',,,,.dWO0k,..,,,,,,,
..',,,,,.cNdOk:..,,,,,,,'
..',,,,,,..Ookkc..',,,,,,,
'.,,,,,,'. lkdx:...,,,,,,,.
..,,,,,'.. 'xox....',,,,,,.
..,,,,,.. :o:' ...,,,,,'
..,,,,. c.. .,,,,.
....... .. .......
You need to copy the required git-hook to your project's .git/hooks directory And put the src directory in somewhere (eg. /usr/share/muhafiz/src)
$ sudo mkdir -p /usr/share/muhafiz
$ git clone git://github.com/sonsuzdongu/muhafiz.git /usr/share/muhafiz
$ cp /usr/share/muhafiz/git-hooks/* /your/project/.git/hooks
You have to set your 'muhafiz.bootstrap-file' git config seting to show your muhafiz bootstrap file
$ git config muhafiz.bootstrap-file /usr/share/muhafiz/src/bootstrap.php
Or better you set it sytem wide or global
$ sudo git config --global muhafiz.bootstrap-file /usr/share/muhafiz/src/bootstrap.php
$ sudo git config --system muhafiz.bootstrap-file /usr/share/muhafiz/src/bootstrap.php
Then you have to set the comma separated list of code checkers(aka runners) using 'muhafiz.active-runners' git config paramter
$ git config muhafiz.active-runners 'phpcs, jshint'
After this, 'all your commits are belongs to us'. All your commits will be checked by given runners and commit will be prevented if are there any errors
- bom Check files for byte order mark
- php Check php files for syntax errors using 'php -l' command line tool
- phpcs (PhpCodeSniffer)
- config parameters :
- 'muhafiz.runners.phpcs.standard' : set coding standard (see reference doc) | defaults to "PEAR"
- 'muhafiz.runners.phpcs.report' : set reporting type (see reference doc) | defaults to "emacs"
- config parameters :
- php-cs-fixer (Php CS Fixer)
- config parameters :
- 'muhafiz.runners.php-cs-fixer.standard' : set coding standard (see reference doc) | defaults to "psr2"
- config parameters :
- jshint (JSHint Node.js Command Line Tool)
- config parameters :
- 'muhafiz.runners.jshint.config' : jshint config file (see reference doc) | defaults to ".jshintrc"
- config parameters :
- lineend Check files' line endings
- config parameters :
- 'muhafiz.runners.lineend.allowed' : should be 'unix' or 'windows'
- config parameters :
- Define "exclude paths" in git config that runners should not work on
- verbose options