diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/build.xml | 14 | ||||
-rw-r--r-- | build/build_helper.php | 6 | ||||
-rw-r--r-- | build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php | 60 | ||||
-rw-r--r-- | build/code_sniffer/ruleset-php-legacy.xml | 3 | ||||
-rw-r--r-- | build/sami-all.conf.php | 1 |
5 files changed, 74 insertions, 10 deletions
diff --git a/build/build.xml b/build/build.xml index 59170ab75f..2d1a6eb51a 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ <project name="phpBB" description="The phpBB forum software" default="all" basedir="../"> <!-- a few settings for the build --> - <property name="newversion" value="3.1.5-dev" /> - <property name="prevversion" value="3.1.4" /> - <property name="olderversions" value="3.0.12, 3.0.13, 3.0.13-PL1, 3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3" /> + <property name="newversion" value="3.1.7-dev" /> + <property name="prevversion" value="3.1.6" /> + <property name="olderversions" value="3.0.12, 3.0.13, 3.0.13-PL1, 3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5" /> <!-- no configuration should be needed beyond this point --> <property name="oldversions" value="${olderversions}, ${prevversion}" /> @@ -149,7 +149,7 @@ <property name="dir" value="build/old_versions/release-${version}" /> </phingcall> - <exec dir="build/old_versions" command="LC_ALL=C diff -crNEBwd release-${version} release-${newversion} > + <exec dir="build/old_versions" command="LC_ALL=C diff -crNEBZbd release-${version} release-${newversion} > ../new_version/patches/phpBB-${version}_to_${newversion}.patch" escape="false" /> <exec dir="build/old_versions" command="LC_ALL=C diff -qr release-${version} release-${newversion} | grep 'Only in release-${version}' > ../new_version/patches/phpBB-${version}_to_${newversion}.deleted" escape="false" /> </target> @@ -177,13 +177,13 @@ <target name="package" depends="clean,prepare,prepare-new-version,old-version-diffs"> <exec dir="build" command="php -f package.php '${versions}' > logs/package.log" escape="false" /> <exec dir="build" escape="false" - command="diff -crNEBwd old_versions/release-${prevversion}/language new_version/phpBB3/language > + command="LC_ALL=C diff -crNEBZbd old_versions/release-${prevversion}/language new_version/phpBB3/language > save/phpbb-${prevversion}_to_${newversion}_language.patch" /> <exec dir="build" escape="false" - command="diff -crNEBwd old_versions/release-${prevversion}/styles/prosilver new_version/phpBB3/styles/prosilver > + command="LC_ALL=C diff -crNEBZbd old_versions/release-${prevversion}/styles/prosilver new_version/phpBB3/styles/prosilver > save/phpbb-${prevversion}_to_${newversion}_prosilver.patch" /> <exec dir="build" escape="false" - command="diff -crNEBwd old_versions/release-${prevversion}/styles/subsilver2 new_version/phpBB3/styles/subsilver2 > + command="LC_ALL=C diff -crNEBZbd old_versions/release-${prevversion}/styles/subsilver2 new_version/phpBB3/styles/subsilver2 > save/phpbb-${prevversion}_to_${newversion}_subsilver2.patch" /> <exec dir="build" escape="false" diff --git a/build/build_helper.php b/build/build_helper.php index 35e8cd744b..3ff1b89eab 100644 --- a/build/build_helper.php +++ b/build/build_helper.php @@ -22,11 +22,11 @@ class build_package // -r - compare recursive // -N - Treat missing files as empty // -E - Ignore tab expansions - // not used: -b - Ignore space changes. - // -w - Ignore all whitespace + // -Z - Ignore white space at line end. + // -b - Ignore changes in the amount of white space. // -B - Ignore blank lines // -d - Try to find smaller set of changes - var $diff_options = '-crNEBwd'; + var $diff_options = '-crNEBZbd'; var $diff_options_long = '-x images -crNEB'; // -x fonts -x imageset //imageset not used here, because it includes the imageset.cfg file. ;) var $verbose = false; diff --git a/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php new file mode 100644 index 0000000000..349bccbb02 --- /dev/null +++ b/build/code_sniffer/phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php @@ -0,0 +1,60 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * Checks that there is exactly one space between the keyword and the opening + * parenthesis of a control structures. + */ +class phpbb_Sniffs_ControlStructures_OpeningParenthesisSniff implements PHP_CodeSniffer_Sniff +{ + /** + * Registers the tokens that this sniff wants to listen for. + */ + public function register() + { + return array( + T_IF, + T_FOREACH, + T_WHILE, + T_FOR, + T_SWITCH, + T_ELSEIF, + T_CATCH, + ); + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the + * stack passed in $tokens. + * + * @return void + */ + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + + if ($tokens[$stackPtr + 1]['content'] === '(') + { + $error = 'There should be exactly one space between the keyword and opening parenthesis'; + $phpcsFile->addError($error, $stackPtr, 'NoSpaceBeforeOpeningParenthesis'); + } + else if ($tokens[$stackPtr + 1]['content'] !== ' ') + { + $error = 'There should be exactly one space between the keyword and opening parenthesis'; + $phpcsFile->addError($error, $stackPtr, 'IncorrectSpaceBeforeOpeningParenthesis'); + } + } +} diff --git a/build/code_sniffer/ruleset-php-legacy.xml b/build/code_sniffer/ruleset-php-legacy.xml index b0110e8b12..c740c6080f 100644 --- a/build/code_sniffer/ruleset-php-legacy.xml +++ b/build/code_sniffer/ruleset-php-legacy.xml @@ -86,4 +86,7 @@ <!-- The ?> closing tag MUST be omitted from files containing only PHP. --> <rule ref="Zend.Files.ClosingTag" /> + <!-- There MUST be one space between control structure and opening parenthesis --> + <rule ref="./phpbb/Sniffs/ControlStructures/OpeningParenthesisSniff.php" /> + </ruleset> diff --git a/build/sami-all.conf.php b/build/sami-all.conf.php index fb1a269206..9c10209e8b 100644 --- a/build/sami-all.conf.php +++ b/build/sami-all.conf.php @@ -25,6 +25,7 @@ $config['versions'] = Sami\Version\GitVersionCollection::create(__DIR__ . '/../' */ ->add('3.0.x') ->add('3.1.x') + ->add('master') ; return new Sami\Sami($iterator, $config); |