diff --git a/RoboFile.php b/RoboFile.php index 20077bf3a9..d576ed45f6 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -235,14 +235,23 @@ class RoboFile extends \Robo\Tasks { } else { $severityFlag = '-n'; } - return $this->_exec( - './vendor/bin/phpcs '. - '--standard=./tasks/code_sniffer/MailPoet '. - '--ignore=./lib/Util/Sudzy/*,./lib/Util/CSS.php,./lib/Util/XLSXWriter.php,'. - './lib/Util/pQuery/*,./lib/Config/PopulatorData/Templates/* '. - 'lib/ '. - $severityFlag - ); + return $this->collectionBuilder() + ->taskExec( + './vendor/bin/phpcs '. + '--standard=./tasks/code_sniffer/MailPoet '. + '--ignore=./lib/Util/Sudzy/*,./lib/Util/CSS.php,./lib/Util/XLSXWriter.php,'. + './lib/Util/pQuery/*,./lib/Config/PopulatorData/Templates/* '. + 'lib/ '. + $severityFlag + ) + ->taskExec( + './vendor/bin/phpcs '. + '--standard=./tasks/code_sniffer/MailPoetTests '. + '--ignore=./tests/unit/_bootstrap.php '. + 'tests/unit/ '. + $severityFlag + ) + ->run(); } function svnCheckout() { diff --git a/tasks/code_sniffer/MailPoetTests/Sniffs/ControlStructures/ControlSignatureSniff.php b/tasks/code_sniffer/MailPoetTests/Sniffs/ControlStructures/ControlSignatureSniff.php new file mode 100644 index 0000000000..dc8056e896 --- /dev/null +++ b/tasks/code_sniffer/MailPoetTests/Sniffs/ControlStructures/ControlSignatureSniff.php @@ -0,0 +1,59 @@ + + * @author Marc McIntyre + * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) + * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +if (class_exists('PHP_CodeSniffer_Standards_AbstractPatternSniff', true) === false) { + throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_Standards_AbstractPatternSniff not found'); +} + +/** + * Verifies spacing of control statements. + * + * @category PHP + * @package PHP_CodeSniffer + * @author Greg Sherwood + * @author Marc McIntyre + * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) + * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + * @version Release: @package_version@ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ +class MailPoetTests_Sniffs_ControlStructures_ControlSignatureSniff extends PHP_CodeSniffer_Standards_AbstractPatternSniff { + + /** + * If true, comments will be ignored if they are found in the code. + * + * @var boolean + */ + public $ignoreComments = true; + + /** + * Returns the patterns that this test wishes to verify. + * + * @return string[] + */ + protected function getPatterns() { + return array( + 'do {EOL...} while(...);EOL', + 'while(...) {EOL', + 'for(...) {EOL', + 'if(...) {EOL', + 'foreach(...) {EOL', + '} else if(...) {EOL', + '} elseif(...) {EOL', + '} else {EOL', + 'do {EOL', + ); + } +} diff --git a/tasks/code_sniffer/MailPoetTests/ruleset.xml b/tasks/code_sniffer/MailPoetTests/ruleset.xml new file mode 100644 index 0000000000..a9c6d5d6bb --- /dev/null +++ b/tasks/code_sniffer/MailPoetTests/ruleset.xml @@ -0,0 +1,126 @@ + + + MailPoet specific rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +