Skip to content

Commit

Permalink
[BUGFIX] Relax rst validation rules for Feature and Important
Browse files Browse the repository at this point in the history
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 <noreply@typo3.com>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Jürgen Venne <venne@schaffrath-digital.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Jürgen Venne <venne@schaffrath-digital.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
  • Loading branch information
Anja Leichsenring authored and maddy2101 committed Mar 1, 2019
1 parent f31b5f8 commit 8e64eda
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Build/Scripts/validateRstFiles.php
Expand Up @@ -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();
Expand All @@ -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));
Expand Down Expand Up @@ -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 least one valid keyword and either FullyScanned, PartiallyScanned or NotScanned>\' at last line of the file. See Build/Scripts/validateRstFiles.php for allowed keywords',
'message' => 'insert \'.. index:: <at least one valid keyword and either FullyScanned, PartiallyScanned or NotScanned>\' 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) {
Expand Down

0 comments on commit 8e64eda

Please sign in to comment.