[libvirt PATCH 03/10] clang-tidy: Filter output

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

 



GitLab's CI output is capped at a certain size. Filter out all status
messages that do not add value.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 scripts/run-clang-tidy.py | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py
index 79d9fb38b2..dc5880878b 100755
--- a/scripts/run-clang-tidy.py
+++ b/scripts/run-clang-tidy.py
@@ -5,11 +5,32 @@ import json
 import multiprocessing
 import os
 import queue
+import re
 import subprocess
 import sys
 import threading
 
 
+spam = [
+    re.compile("^[0-9]+ (warning|error)[s]? .*generated"),
+    re.compile("^[0-9]+ warning[s]? treated as error"),
+    re.compile("^Suppressed [0-9]+ warning[s]?"),
+    re.compile("^Use .* to display errors from all non-system headers"),
+    re.compile("Error while processing "),
+    re.compile("Found compiler error"),
+]
+
+
+def remove_spam(output):
+    retval = list()
+    for line in output.split("\n"):
+        if any([s.match(line) for s in spam]):
+            continue
+        retval.append(line)
+
+    return "\n".join(retval)
+
+
 def parse_args():
     parser = argparse.ArgumentParser(description="caching clang-tidy runner")
     parser.add_argument(
@@ -41,8 +62,8 @@ def run_clang_tidy(item):
         universal_newlines=True)
     return {
         "returncode": result.returncode,
-        "stdout": result.stdout.strip(),
-        "stderr": result.stderr.strip(),
+        "stdout": remove_spam(result.stdout.strip()),
+        "stderr": remove_spam(result.stderr.strip()),
     }
 
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux