From b8f6d254f6993946931a751649874df74fbb4adc Mon Sep 17 00:00:00 2001 From: Raphael Defosseux <raphael.defosseux@eurecom.fr> Date: Wed, 26 Sep 2018 14:19:33 +0200 Subject: [PATCH] CI: proper notifications on the formatting rules Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr> --- ci-scripts/checkCodingFormattingRules.sh | 15 ++++++++++++++- ci-scripts/reportBuildLocally.sh | 14 +++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ci-scripts/checkCodingFormattingRules.sh b/ci-scripts/checkCodingFormattingRules.sh index a18fc67c75c..61cbf125601 100755 --- a/ci-scripts/checkCodingFormattingRules.sh +++ b/ci-scripts/checkCodingFormattingRules.sh @@ -120,21 +120,34 @@ echo "Source Branch is : $SOURCE_BRANCH" echo "Target Branch is : $TARGET_BRANCH" echo "Merged Commit is : $MERGE_COMMMIT" echo "Target Init is : $TARGET_INIT_COMMIT" +echo "" +echo " ----------------------------------------------------------" +echo "" # Retrieve the list of modified files since the latest develop commit MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq` NB_TO_FORMAT=0 +if [ -f oai_rules_result_list.txt ] +then + rm -f oai_rules_result_list.txt +fi for FULLFILE in $MODIFIED_FILES do - echo $FULLFILE filename=$(basename -- "$FULLFILE") EXT="${filename##*.}" if [ $EXT = "c" ] || [ $EXT = "h" ] || [ $EXT = "cpp" ] || [ $EXT = "hpp" ] then TO_FORMAT=`astyle --dry-run --options=ci-scripts/astyle-options.txt $FULLFILE | grep -c Formatted ` NB_TO_FORMAT=$((NB_TO_FORMAT + TO_FORMAT)) + if [ $TO_FORMAT -ne 0 ] + then + echo $FULLFILE + echo $FULLFILE >> ./oai_rules_result_list.txt + fi fi done +echo "" +echo " ----------------------------------------------------------" echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT" echo $NB_TO_FORMAT > ./oai_rules_result.txt diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 609af5f166b..ea2cc5e44f6 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -260,7 +260,7 @@ function sca_summary_table_footer { echo " </tr>" >> ./build_results.html echo " </table>" >> ./build_results.html echo " <p>Full details in zipped artifact (cppcheck/cppcheck.xml) </p>" >> ./build_results.html - echo " <p>Graphical Interface tool : <code>cppcheck-gui -l cppcheck/cppcheck.xml</code> </p>" >> ./build_results.html + echo " <p style=\"margin-left: 30px\">Graphical Interface tool : <strong><code>cppcheck-gui -l cppcheck/cppcheck.xml</code></strong></p>" >> ./build_results.html } jb_checker=0 @@ -490,12 +490,20 @@ then then if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All files in repository follow OAI rules. </td>" >> ./build_results.html; fi if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"green\">All modified files in Merge-Request follow OAI rules.</td>" >> ./build_results.html; fi + echo " </tr>" >> ./build_results.html + echo " </table>" >> ./build_results.html else if [ $PU_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES files in repository DO NOT follow OAI rules. </td>" >> ./build_results.html; fi if [ $MR_TRIG -eq 1 ]; then echo " <td bgcolor = \"orange\">$NB_FILES modified files in Merge-Request DO NOT follow OAI rules.</td>" >> ./build_results.html; fi + echo " </tr>" >> ./build_results.html + if [ -f ./oai_rules_result_list.txt ] + then + awk '{print " <tr><td></td><td>"$1"</td></tr>"}' ./oai_rules_result_list.txt >> ./build_results.html + fi + echo " </table>" >> ./build_results.html + echo " <p>Please apply the following command to this(ese) file(s): </p>" >> ./build_results.html + echo " <p style=\"margin-left: 30px\"><strong><code>astyle --options=ci-scripts/astyle-options.txt filename(s)</code></strong></p>" >> ./build_results.html fi - echo " </tr>" >> ./build_results.html - echo " </table>" >> ./build_results.html fi echo " <h2>Ubuntu 16.04 LTS -- Summary</h2>" >> ./build_results.html -- GitLab