[gjs: 1/4] CI: Don't fail linter jobs if errors were only removed



commit 182e0f595e35bfb2a316695d5f2084328c45c59f
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Mar 18 18:28:29 2018 -0700

    CI: Don't fail linter jobs if errors were only removed
    
    Previously, we failed the job if the diff of the linter output was
    different between the branch and master. With this change, we only fail
    if lines were added, not removed.
    
    Closes #133.

 test/test-ci.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/test/test-ci.sh b/test/test-ci.sh
index d17d4df..87a020b 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -64,14 +64,17 @@ function do_Compare_With_Upstream_Master(){
     echo '--------------------------------'
     echo 'Compare the working code with upstream master'
 
-    if ! diff --brief /cwd/master-report.txt /cwd/current-report.txt > /dev/null; then
-        echo '----------------------------------------'
-        echo "###  New warnings found by $1  ###"
-        echo '----------------------------------------'
-        diff -u /cwd/master-report.txt /cwd/current-report.txt || true
-        echo '----------------------------------------'
+    NEW_WARNINGS=$(comm -13 <(sort < /cwd/master-report.txt) <(sort < /cwd/current-report.txt) | wc -l)
+    REMOVED_WARNINGS=$(comm -23 <(sort < /cwd/master-report.txt) <(sort < /cwd/current-report.txt) | wc -l)
+    if test "$NEW_WARNINGS" -ne 0; then
+        echo '-----------------------------------------'
+        echo "### $NEW_WARNINGS new warning(s) found by $1 ###"
+        echo '-----------------------------------------'
+        diff -u0 /cwd/master-report.txt /cwd/current-report.txt || true
+        echo '-----------------------------------------'
         exit 3
     else
+        echo "$REMOVED_WARNINGS warning(s) were fixed."
         echo "=> $1 Ok"
     fi
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]