Re: PHPCodeSniffer - Disable sniffs temporary for unit testing

From: Date: Thu, 26 Nov 2009 05:49:57 +0000
Subject: Re: PHPCodeSniffer - Disable sniffs temporary for unit testing
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30173@lists.php.net to get a copy of this message
On 26/11/2009, at 5:37 AM, Christian Kaps wrote: > > I have two sniffs. The first sniff checks for valid class names. The > second sniff warns about multiple class definitions in one file. For > testing the first sniff, I have a unit test that defines multiple > classes in one file. The seconds sniff prints now warnings. Can I > disable the second sniff temporary for testing the first sniff? If you use the built-in unit testing system for PHP_CodeSniffer then it will do this for you automatically. If you are running phpcs manually, you will need to use the --sniffs command line argument to limit it to using 1 or more sniffs. See the docs for an example: http://pear.php.net/manual/en/package.php.php-codesniffer.advanced-usage.php#package.php.php-codesniffer.advanced-usage.sniffs If you are calling PHP_CodeSniffer methods to simulate testing, you need to pass the sniff IDs (described in the docs above) to the process method. Check out CodeSniffer/CLI.php for an example of how to do it. Contact me directly if you need any more help. Greg

« previous php.pear.general (#30173) next »