From 8e64eda606d40580a3909640d5147d42f06733e6 Mon Sep 17 00:00:00 2001 From: Anja Leichsenring Date: Sat, 23 Feb 2019 18:39:04 +0100 Subject: [PATCH] [BUGFIX] Relax rst validation rules for Feature and Important MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When looking for FullyScanned|PartiallyScanned|NotScanned ignore Feature and Important rst files from any version as well as all rst files from 7.x and 8.x Resolves: #87772 Releases: master, 9.5, 8.7 Change-Id: I7bf2a6068f95603a8ac3e6df4cb336d66963f145 Reviewed-on: https://review.typo3.org/c/59790 Tested-by: TYPO3com Tested-by: Susanne Moog Tested-by: Jürgen Venne Tested-by: Anja Leichsenring Reviewed-by: Susanne Moog Reviewed-by: Jürgen Venne Reviewed-by: Anja Leichsenring --- Build/Scripts/validateRstFiles.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Build/Scripts/validateRstFiles.php b/Build/Scripts/validateRstFiles.php index c5932e8f8ee8..81784e1cf1d8 100755 --- a/Build/Scripts/validateRstFiles.php +++ b/Build/Scripts/validateRstFiles.php @@ -58,7 +58,7 @@ public function __construct(string $dir = '') public function validate() { - printf('Searching for rst snippets in' . $this->baseDir . chr(10)); + printf('Searching for rst snippets in ' . $this->baseDir . chr(10)); $count = 0; $finder = $this->findFiles(); @@ -70,7 +70,7 @@ public function validate() $a = explode(chr(10), trim($fileContent)); $lastLine = array_pop($a); $this->validateLastLine($lastLine); - $this->validateLastLineForFilename($filename, $lastLine); + $this->validateLastLineByFilename($filename, $lastLine); if ($this->isError) { $shortPath = substr($filename, strlen($this->baseDir)); @@ -181,27 +181,27 @@ protected function validateLastLine(string $line) } } - protected function validateLastLineForFilename(string $path, string $lastLine) + protected function validateLastLineByFilename(string $path, string $lastLine) { $checkFor = [ [ 'type' => 'index', - 'regexNotFilename' => '# - Changelog[\\\\/]8\\.[0-9]+[\\\\/]| - Changelog[\\\\/]8\\.7\\.x[\\\\/]| - Changelog[\\\\/]7\\.[0-9]+[\\\\/]| - Changelog[\\\\/]7\\.6\\.x[\\\\/]| - Changelog[\\\\/](?:master|[0-9]+\\.[0-9]+)[\\\\/]Feature-| - Changelog[\\\\/](?:master|[0-9]+\\.[0-9]+)[\\\\/]Important- - #x', + 'regexIgnoreFilename' => '#' + . 'Changelog[\\\\/]' // Ignore all Changelog files + . '(?:' // which are either + . '.+[\\\\/](?:Feature|Important)' // from any version but of type "Feature" or "Important" + . '|' // or + . '[78]' // from 7.x and 8.x (as there was no extension scanner back then) + . ')' + . '#', 'regex' => '#^\.\. index:: .*(?:FullyScanned|PartiallyScanned|NotScanned).*#', 'title' => 'missing FullyScanned / PartiallyScanned / NotScanned tag', - 'message' => 'insert \'.. index:: \' at last line of the file. See Build/Scripts/validateRstFiles.php for allowed keywords', + 'message' => 'insert \'.. index:: \' at the last line of the file. See Build/Scripts/validateRstFiles.php for allowed keywords', ], ]; foreach ($checkFor as $values) { - if (preg_match($values['regexNotFilename'], $path) === 1) { + if (preg_match($values['regexIgnoreFilename'], $path) === 1) { continue; } if (preg_match($values['regex'], $lastLine) !== 1) {