This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

greenrabbit lint config

dev-master 2017-02-27 13:43 UTC

This package is not auto-updated.

Last update: 2021-10-16 11:54:05 UTC


PHP-Lint is simplified linter solution for php, based on PHP_CodeSniffer.

Currently it's support only as HG hook, GIT hook will come soon.

Current rule set is in progress. It consist of PSR1, PSR2, PEAR, PHPCompatibility, Yii2 Coding Standard, some of Squiz and Generic rules.


Installation is realized by Composer.

In the console write:

composer require --dev grnrbt/php-lint "*"

or add following line in require-dev section of composer.json file.

"grnrbt/php-lint": "*"


HG hook
Checks only staged files in repository so it can be added in present repositories without problems with old files.

Add following code into .hg/hgrc file or HG-client settings:

pretxncommit.hglint = vendor/bin/lint

or on Windows:

pretxncommit.hglint = vendor\bin\lint.bat

To skip checking run commit from console with ENV param NO_VERIFY=1:

NO_VERIFY=1 hg ci -u <user> -m <message> 

Manual run
You can run linter with ruleset manually from console

$ ./vendor/bin/lint

It will check staged files or run CodeSniffer itself

$ ./vendor/bin/phpcs --extensions=php --standard=/vendor/grnrbt/php-lint/ruleset.xml <dir>

For checking choosen directory <dir>

If you're using PhpStorm you can configure it to use CodeSniffer using Settings → Languages & Frameworks → PHP → Code Sniffer.

Custom rules

You can override standard rules by placing file ruleset.xml in root directory of your project. In that file you can include original file and add your own rules or disable rules, that was added in common ruleset.

<?xml version="1.0"?>
<ruleset name="Custom Standard">
    <description>A custom coding standard</description>

    <rule ref="/vendor/grnrbt/php-lint/ruleset.xml"/>
    <!-- custom rules, overrides -->