m6web/coke v2.1.1

PHP Code Sniffer configurator

Homepage: http://tech.m6web.fr/coke-pour-bien-sniffer-son-code

Platform: Packagist

Language: Shell

License: MIT

Repository: https://github.com/M6Web/Coke

View on registry: https://packagist.org/packages/m6web/coke#v2.1.1

Coke - Enjoy sniffing your code

Coke is a Shell/Bash command using PHP Code Sniffer allowing rules management per project.

Configuration file

Create a .coke file at your project root :

# Command used to launch PHP CodeSniffer (optional - default: phpcs)

# Path used to load Standards (optional)

# Standard used by PHP CodeSniffer (required)

# Verbose mode (optional - default: false)

# White list of files and directories (optional)

# Black list of files and directories (optional)

and just launch the command :

$ coke

Run the command with arguments

You can override .coke settings by passing directly configuration as arguments to the command :

$ coke src test.php --standard=Symfony2 --ignore=Tests,src/OldFile.php -v

The order of arguments is not important

src test.php Files/Directories to include in the check
--standard=Symfony2 Standard to use for check
--ignore=Tests,src/OldFile.php URL patterns to ignore in the check
-v Use verbose mode

Additional arguments

You can use any phpcs arguments (documentation)

For example if you want to generate a report with your favorite CI tools you can run

$ coke --report-checkstyle=checkstyle.xml

Installation via composer

Add coke in the require-dev section of your composer.json :

"require-dev": {
    "m6web/coke" : "~2.0"

By default composer will add a symlink to coke in vendor/bin/coke.

If you want to change it, add this in your composer.json (more information about this in the composer documentation) :

"config": {
    "bin-dir": "bin"

Then you can call coke via :


Git pre-commit hook

You can use a dedicated pre-commit hook :

$ wget --output-document=.git/hooks/pre-commit https://gist.githubusercontent.com/JJK801/5867810/raw/f26ec4778273b3f7140428252ab31951de2faba4/pre-commit.sh


$ curl -L https://gist.githubusercontent.com/JJK801/5867810/raw/f26ec4778273b3f7140428252ab31951de2faba4/pre-commit.sh > .git/hooks/pre-commit


$ chmod +x .git/hooks/pre-commit


Developped by the Cytron Team of M6 Web.


Coke is licensed under the MIT license.


v2.1.1 August 02, 2016
v2.1.0 July 27, 2015
v2.0.0 April 28, 2015
v1.2.2 November 02, 2014
v1.2.1 June 11, 2014
v1.2.0 May 19, 2014
v1.1.1 May 16, 2014
v1.1.0 May 13, 2014
v1.0.0 December 09, 2013

Project Statistics

SourceRank 17
Dependencies 1
Dependent projects 51
Dependent repositories 98
Total releases 9
Latest release
First release
Stars 58
Forks 10
Watchers 19
Contributors 13
Repo Size: 23.4 KB

Top Contributors See all

Denis Roussel Mikael RANDY Adrien Gallou Jérémy JOURDIN Pierre Guinoiseau Nicolas Chaulet Florent Dubost Olivier Mansour Romain Prignon Bryan Folliot Adrien Samson Bruno CHALOPIN Renaud LITTOLFF

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2017-03-27 18:05:51 UTC

Login to resync this project