diff options
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | build/build.xml | 24 | ||||
-rw-r--r-- | build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php (renamed from code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php) | 0 | ||||
-rw-r--r-- | build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc (renamed from code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc) | 0 | ||||
-rw-r--r-- | build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php (renamed from code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php) | 0 | ||||
-rw-r--r-- | build/code_sniffer/phpbb/build.xml (renamed from code_sniffer/phpbb/build.xml) | 0 | ||||
-rw-r--r-- | build/code_sniffer/phpbb/phpbbCodingStandard.php (renamed from code_sniffer/phpbb/phpbbCodingStandard.php) | 0 | ||||
-rw-r--r-- | build/code_sniffer/ruleset-minimum.xml | 12 | ||||
-rw-r--r-- | build/code_sniffer/ruleset-php-legacy.xml | 25 | ||||
-rw-r--r-- | build/code_sniffer/ruleset-php-strict.xml | 42 | ||||
-rw-r--r-- | phpBB/composer.json | 3 | ||||
-rw-r--r-- | phpBB/composer.lock | 74 |
12 files changed, 180 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml index a5c27632b4..dd947a72e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,9 @@ before_script: - php ../composer.phar install --dev --no-interaction --prefer-source - cd .. - sh -c "if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.3.19', '>=');"` = "1" ]; then travis/setup-webserver.sh; fi" + - cd build + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then ../phpBB/vendor/bin/phing sniff; fi" + - cd .. script: - phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml 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" /> </target> + <target name="sniff"> + <exec command="phpBB/vendor/bin/phpcs + -s + --extensions=php + --standard=build/code_sniffer/ruleset-php-legacy.xml + --ignore=phpBB/cache/* + --ignore=phpBB/develop/* + --ignore=phpBB/includes/diff/*.php + --ignore=phpBB/includes/sphinxapi.php + --ignore=phpBB/includes/utf/data/* + --ignore=phpBB/install/data/* + --ignore=phpBB/phpbb/* + --ignore=phpBB/vendor/* + phpBB" + dir="." passthru="true" /> + <exec command="phpBB/vendor/bin/phpcs + -s + --extensions=php + --standard=build/code_sniffer/ruleset-php-strict.xml + --ignore=phpBB/phpbb/db/migration/data/v30x/* + phpBB/phpbb" + dir="." passthru="true" /> + </target> + <target name="docs"> <!-- only works if you setup phpdoctor: git clone https://github.com/peej/phpdoctor.git diff --git a/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php b/build/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php index 68e9e6bb86..68e9e6bb86 100644 --- a/code_sniffer/phpbb/Sniffs/Commenting/FileCommentSniff.php +++ b/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 index 0ace1c1bda..0ace1c1bda 100644 --- a/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.inc +++ b/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 index affa27b56c..affa27b56c 100644 --- a/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php +++ b/build/code_sniffer/phpbb/Tests/Commenting/FileCommentUnitTest.php diff --git a/code_sniffer/phpbb/build.xml b/build/code_sniffer/phpbb/build.xml index b6d3bf6451..b6d3bf6451 100644 --- a/code_sniffer/phpbb/build.xml +++ b/build/code_sniffer/phpbb/build.xml diff --git a/code_sniffer/phpbb/phpbbCodingStandard.php b/build/code_sniffer/phpbb/phpbbCodingStandard.php index adbba9d915..adbba9d915 100644 --- a/code_sniffer/phpbb/phpbbCodingStandard.php +++ b/build/code_sniffer/phpbb/phpbbCodingStandard.php diff --git a/build/code_sniffer/ruleset-minimum.xml b/build/code_sniffer/ruleset-minimum.xml new file mode 100644 index 0000000000..2de1fb4be4 --- /dev/null +++ b/build/code_sniffer/ruleset-minimum.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<ruleset name="phpBB Minimum Standard"> + + <description>phpBB minimum coding standard</description> + + <!-- All code files MUST use only UTF-8 without BOM. --> + <rule ref="Generic.Files.ByteOrderMark" /> + + <!-- All code files MUST use the Unix LF (linefeed) line ending. --> + <rule ref="Generic.Files.LineEndings" /> + +</ruleset> 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 @@ +<?xml version="1.0"?> +<ruleset name="phpBB PHP Legacy Standard"> + + <description>phpBB legacy coding standard for PHP files</description> + + <rule ref="./ruleset-minimum.xml" /> + + <!-- The body of each structure MUST be enclosed by braces. --> + <rule ref="Generic.ControlStructures.InlineControlStructure" /> + + <!-- All PHP files MUST end with a single blank line. --> + + <!-- Class constants MUST be declared in all upper case with underscore separators. --> + <rule ref="Generic.NamingConventions.UpperCaseConstantName" /> + + <!-- Only <?php, no short tags. --> + <rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound" /> + + <!-- Method arguments with default values MUST go at the end of the argument list. --> + <rule ref="PEAR.Functions.ValidDefaultValue" /> + + <!-- The ?> closing tag MUST be omitted from files containing only PHP. --> + <rule ref="Zend.Files.ClosingTag" /> + +</ruleset> 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 @@ +<?xml version="1.0"?> +<ruleset name="phpBB PHP Strict Standard"> + + <description>phpBB coding standard for PHP files</description> + + <rule ref="./ruleset-php-legacy.xml" /> + + <!-- There SHOULD NOT be more than 80 characters per line + There MUST NOT be more than 120 characters per line --> + <!-- + <rule ref="Generic.Files.LineLength"> + <properties> + <property name="lineLimit" value="80"/> + <property name="absoluteLineLimit" value="120"/> + </properties> + </rule> + --> + + <!-- The PHP constants true, false, and null MUST be in lower case. --> + <rule ref="Generic.PHP.LowerCaseConstant" /> + + <!-- PHP keywords MUST be in lower case. --> + <rule ref="Generic.PHP.LowerCaseKeyword" /> + + <!-- There MUST NOT be trailing whitespace at the end of lines. --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" /> + + <!-- There MUST NOT be whitespace before the first content of a file --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile" /> + + <!-- There MUST NOT be whitespace after the last content of a file --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" /> + + <!-- Functions MUST NOT contain multiple empty lines in a row --> + <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" /> + + <!-- When present, all use declarations MUST go after the namespace declaration. + There MUST be one use keyword per declaration. + There MUST be one blank line after the use block. --> + <rule ref="PSR2.Namespaces.UseDeclaration" /> + +</ruleset> 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" ], @@ -1376,6 +1376,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", "target-dir": "Symfony/Component/BrowserKit", |