From 7fb3676957fa8e489a49dc446c356fef888b4d60 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 27 Oct 2013 17:14:20 +0100 Subject: [PATCH 1/5] [task/code-sniffer] Move code sniffer below build folder. PHPBB3-11980 --- .../code_sniffer}/phpbb/Sniffs/Commenting/FileCommentSniff.php | 0 .../code_sniffer}/phpbb/Tests/Commenting/FileCommentUnitTest.inc | 0 .../code_sniffer}/phpbb/Tests/Commenting/FileCommentUnitTest.php | 0 {code_sniffer => build/code_sniffer}/phpbb/build.xml | 0 .../code_sniffer}/phpbb/phpbbCodingStandard.php | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {code_sniffer => build/code_sniffer}/phpbb/Sniffs/Commenting/FileCommentSniff.php (100%) rename {code_sniffer => build/code_sniffer}/phpbb/Tests/Commenting/FileCommentUnitTest.inc (100%) rename {code_sniffer => build/code_sniffer}/phpbb/Tests/Commenting/FileCommentUnitTest.php (100%) rename {code_sniffer => build/code_sniffer}/phpbb/build.xml (100%) rename {code_sniffer => build/code_sniffer}/phpbb/phpbbCodingStandard.php (100%) diff --git a/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php similarity index 100% rename from code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php rename to build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php diff --git a/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc similarity index 100% rename from code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc rename to build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc diff --git a/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php similarity index 100% rename from code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php rename to build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php diff --git a/code_sniffer/phpbb/build.xml b/build/code_sniffer/phpbb/build.xml similarity index 100% rename from code_sniffer/phpbb/build.xml rename to build/code_sniffer/phpbb/build.xml diff --git a/code_sniffer/phpbb/phpbbCodingStandard.php b/build/code_sniffer/phpbb/phpbbCodingStandard.php similarity index 100% rename from code_sniffer/phpbb/phpbbCodingStandard.php rename to build/code_sniffer/phpbb/phpbbCodingStandard.php From c82979a4728195ddeb938e2d4e3252fc139f3525 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 27 Oct 2013 17:23:27 +0100 Subject: [PATCH 2/5] [task/code-sniffer] Add PHP CodeSniffer dependency to composer. PHPBB3-11980 --- phpBB/composer.json | 3 +- phpBB/composer.lock | 74 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/phpBB/composer.json b/phpBB/composer.json index 455ad49aac..ddb264de17 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -14,6 +14,7 @@ "fabpot/goutte": "1.0.*", "phpunit/dbunit": "1.2.*", "phpunit/phpunit": "3.7.*", - "phing/phing": "2.4.*" + "phing/phing": "2.4.*", + "squizlabs/php_codesniffer": "1.*" } } diff --git a/phpBB/composer.lock b/phpBB/composer.lock index eb57ddb4d9..5d1ba4efe1 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "0bc0fd0d784720629ae0ba6d4be6a577", + "hash": "7bcfe8f8ce4fa46cb53c276cf93dcd3e", "packages": [ { "name": "lusitanian/oauth", @@ -302,7 +302,7 @@ "Symfony\\Component\\EventDispatcher\\": "" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -1375,6 +1375,76 @@ ], "time": "2013-01-13 10:24:48" }, + { + "name": "squizlabs/php_codesniffer", + "version": "1.5.0RC4", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "146a9b54e4adeaca0a3ae073e0a8a03570d6cc43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/146a9b54e4adeaca0a3ae073e0a8a03570d6cc43", + "reference": "146a9b54e4adeaca0a3ae073e0a8a03570d6cc43", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.1.2" + }, + "suggest": { + "phpunit/php-timer": "dev-master" + }, + "bin": [ + "scripts/phpcs" + ], + "type": "library", + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/CommentParser/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2013-09-26 00:14:02" + }, { "name": "symfony/browser-kit", "version": "v2.3.4", From e660d1bac1781e8d1506e6f5502008793a067bab Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 27 Oct 2013 17:36:18 +0100 Subject: [PATCH 3/5] [task/code-sniffer] Phing target for sniffing. PHPBB3-11980 --- build/build.xml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/build/build.xml b/build/build.xml index 82bb979a02..9376f95143 100644 --- a/build/build.xml +++ b/build/build.xml @@ -74,6 +74,30 @@ passthru="true" /> + + + + + + + + + + + diff --git a/build/code_sniffer/ruleset-php-legacy.xml b/build/code_sniffer/ruleset-php-legacy.xml new file mode 100644 index 0000000000..ebc85c4fef --- /dev/null +++ b/build/code_sniffer/ruleset-php-legacy.xml @@ -0,0 +1,25 @@ + + + + phpBB legacy coding standard for PHP files + + + + + + + + + + + + + + + + + + + + + diff --git a/build/code_sniffer/ruleset-php-strict.xml b/build/code_sniffer/ruleset-php-strict.xml new file mode 100644 index 0000000000..8580090c69 --- /dev/null +++ b/build/code_sniffer/ruleset-php-strict.xml @@ -0,0 +1,42 @@ + + + + phpBB coding standard for PHP files + + + + + + + + + + + + + + + + + + + + + + + + + + + +