Re: PHP-Codesniffer ruleset configuration options
| From: | Greg Sherwood | Date: | Mon, 29 Oct 2012 21:23:00 +0000 |
| Subject: | Re: PHP-Codesniffer ruleset configuration options | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-31660@lists.php.net to get a copy of this message | ||
Hi Nico,
It is not currently possible in the stable version, but I did add this a
couple of weeks ago in the development version. These are the docs:
<!--
You can also change the type of a message from error to
warning and vice versa.
-->
<rule ref="Generic.Commenting.Todo.CommentFound">
<type>error</type>
</rule>
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
<type>warning</type>
</rule>
I'm hoping that the next version will be out this week. If you can't wait,
you can try out the new version from github:
git clone git://github.com/squizlabs/PHP_CodeSniffer.git
cd PHP_CodeSniffer
php scripts/phpcs ...
Greg
On Tue, Oct 30, 2012 at 12:31 AM, Nicolai Scheer
<nicolai.scheer@gmail.com>wrote:
> Hi!
>
> We are currently using PHP-Codesniffer very successfully... There's
> only one single "issue" that bothers me right now.
>
> I built my own ruleset.xml referencing various sniffs from other
> shipped standards, e.g.:
>
> <rule ref="Generic.Formatting.NoSpaceAfterCast"/>
>
> From reading the docs I can conclude that it is possible to adjust (or
> override) the default severity for this sniff.
> Is it possible to override the warning/error behaviour of a sniff?
> I.e. specify which referenced sniff should produce a warning or an
> error?
>
> We check coding styles during a subversion pre-commit hook. There are
> some referenced sniffs that I'd like to emit a warning rather than an
> error. Of course I could just copy the sniff's code into my own
> standard and adjust it, but I'd rather not duplicate code that way
> (mainly to benefit from updates without manually interfering all the
> time).
>
> Any suggestions?
>
> Thanks and greetings
>
> Nico
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Greg Sherwood
Chief of Engineering
gsherwood@squiz.com.au
Squiz Labs Pty. Ltd. Suite 4, 7 Parkes St Parramatta NSW 2150
P +61 2 9045 2800 W www.squizlabs.com