[TASK] Improve problem reporting of validateRstFiles.sh 85/50385/2
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 26 Oct 2016 14:12:45 +0000 (16:12 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 26 Oct 2016 14:54:17 +0000 (16:54 +0200)
Script gives now detailed advice of how to solve any
detected problem.

Resolves: #78449
Releases: master
Change-Id: I7e5cf9e74fca09bd978fdfa620cabaab2a817bcc
Reviewed-on: https://review.typo3.org/50385
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Build/Scripts/validateRstFiles.sh

index b85fe0d..64c9649 100755 (executable)
@@ -23,6 +23,7 @@ for i in `find typo3/sysext/core/Documentation/Changelog -name "*.rst" -type f`;
 # The regex itself is correct, bash doesn't like it
         if ! [[ "$fileContent" =~ ^[[:space:]]*'.. include:: ../../Includes.txt' ]]; then
             INCLUDE="no include"
+            include_message="insert '.. include:: ../../Includes.txt' in first line of the file"
             outputFileToStream=1;
         else
             INCLUDE=""
@@ -32,6 +33,7 @@ for i in `find typo3/sysext/core/Documentation/Changelog -name "*.rst" -type f`;
 # Maybe this is because it somehow interprets them from the variable $fileContent
         if ! [[ "$fileContent" =~ 'See :issue:'\`([0-9]{4,6})\` ]]; then
             REFERENCE="no reference"
+            reference_message="insert 'See :issue:\`<issuenumber>\`' after headline"
             outputFileToStream=1;
         else
             REFERENCE=""
@@ -41,6 +43,7 @@ for i in `find typo3/sysext/core/Documentation/Changelog -name "*.rst" -type f`;
 # the last line in the checked file
         if ! [[ "$fileContent" =~ '.. index:: '((TypoScript|TSConfig|TCA|FlexForm|LocalConfiguration|Fluid|FAL|Database|JavaScript|PHP-API|Frontend|Backend|CLI|RTE|ext:([a-z|A-Z|_|0-9]*))([,|[:space:]]{2})?)+$ ]]; then
             INDEX="no or wrong index"
+            index_message="insert '.. index:: <at least one keyword>' at last line of the file"
             outputFileToStream=1;
         else
             INDEX=""
@@ -50,6 +53,15 @@ for i in `find typo3/sysext/core/Documentation/Changelog -name "*.rst" -type f`;
             FILE=${i/#typo3\/sysext\/core\/Documentation\/Changelog\//}
             let COUNT++
             printf "%-10s | %-12s | %-17s | %s \n" "$INCLUDE" "$REFERENCE" "$INDEX" "$FILE";
+            if ! [[ -z ${include_message} ]] ; then
+            echo ${include_message};
+            fi
+            if ! [[ -z ${reference_message} ]] ; then
+            echo ${reference_message};
+            fi
+            if ! [[ -z ${index_message} ]] ; then
+            echo ${index_message};
+            fi
         fi
     fi
 
@@ -59,4 +71,4 @@ if [[ $COUNT > 0 ]]; then
      exit 1;
    else
      exit 0;
-fi
\ No newline at end of file
+fi