2017 © Pedro Peláez
 

library coke

PHP Code Sniffer configurator

image

m6web/coke

PHP Code Sniffer configurator

  • Tuesday, May 16, 2017
  • by M6Web
  • Repository
  • 22 Watchers
  • 68 Stars
  • 191,126 Installations
  • Shell
  • 67 Dependents
  • 3 Suggesters
  • 13 Forks
  • 3 Open issues
  • 11 Versions
  • 4 % Grown

The README.md

Coke - Enjoy sniffing your code

Coke is a Shell/Bash command using PHP Code Sniffer allowing rules management per project., (*1)

Configuration file

Create a .coke file at your project root :, (*2)

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

# Path used to load Standards (optional)
standard-path=path/to/PHPCS/Standards/

# Standard used by PHP CodeSniffer (required)
standard=Symfony2

# Verbose mode (optional - default: false)
verbose=true

# Only Git changed mode (optional - default: false)
only-git-changed=true

# White list of files and directories (optional)
src/
test.php

# Black list of files and directories (optional)
!Tests
!src/OldFile.php

and just launch the command :, (*3)

$ coke

Run the command with arguments

You can override .coke settings by passing directly configuration as arguments to the command :, (*4)

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

The order of arguments is not important, (*5)

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
--only-git-changed Check only changed files
-v Use verbose mode, (*6)

Additional arguments

You can use any phpcs arguments (documentation), (*7)

For example if you want to generate a report with your favorite CI tools you can run, (*8)

$ coke --report-checkstyle=checkstyle.xml

Installation via composer

Add coke in the require-dev section of your composer.json :, (*9)

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

By default composer will add a symlink to coke in vendor/bin/coke., (*10)

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

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

Then you can call coke via :, (*12)

./bin/coke

Git pre-commit hook

You can use a dedicated pre-commit hook :, (*13)

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

Or, (*14)

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

Then, (*15)

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

Credits

Developped by the Cytron Team of M6 Web., (*16)

License

Coke is licensed under the MIT license., (*17)

The Versions

16/05 2017

dev-master

9999999-dev

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

16/05 2017

v2.2.0

2.2.0.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

02/08 2016

v2.1.1

2.1.1.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

27/07 2015

v2.1.0

2.1.0.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

28/04 2015

v2.0.0

2.0.0.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

02/11 2014

v1.2.2

1.2.2.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

11/06 2014

v1.2.1

1.2.1.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

19/05 2014

v1.2.0

1.2.0.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

16/05 2014

v1.1.1

1.1.1.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

13/05 2014

v1.1.0

1.1.0.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires

 

09/12 2013

v1.0.0

1.0.0.0

PHP Code Sniffer configurator

  Sources   Download

MIT

The Requires