Commit 8e64eda6 authored by Anja Leichsenring's avatar Anja Leichsenring Committed by Anja Leichsenring
Browse files

[BUGFIX] Relax rst validation rules for Feature and Important

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: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Tested-by: Jürgen Venne's avatarJürgen Venne <venne@schaffrath-digital.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Reviewed-by: Jürgen Venne's avatarJürgen Venne <venne@schaffrath-digital.de>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent f31b5f86
......@@ -58,7 +58,7 @@ class validateRstFiles
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 @@ class validateRstFiles
$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 @@ class validateRstFiles
}
}
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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment