With an empty cache, the first run of the clang-tidy scan in the CI will
fail. While the instinctive reaction "press the rerun button" will eventually
lead to the situation where enough files are cached that the entire scan fits
within the time window, this creates friction for e.g. new contributors.

By allowing timeouts to be non-fatal events, we reduce scanning to a "best
effort" approach, that might miss newly introduced regressions.

Signed-off-by: Tim Wiederhake <twied...@redhat.com>
---
 scripts/run-clang-tidy.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/run-clang-tidy.py b/scripts/run-clang-tidy.py
index 19b8640982..54eb0ea584 100755
--- a/scripts/run-clang-tidy.py
+++ b/scripts/run-clang-tidy.py
@@ -56,6 +56,11 @@ def parse_args():
         dest="timeout",
         type=int,
         help="Timeout in minutes")
+    parser.add_argument(
+        "--allow-timeout",
+        dest="allow_timeout",
+        action="store_true",
+        help="Do not treat timeout as failure if set")
 
     return parser.parse_args()
 
@@ -138,7 +143,8 @@ def worker():
     while True:
         item = items.get()
         if args.timeout and args.timeout < time.time():
-            findings.append("%s (timeout)" % item["file"])
+            if not args.allow_timeout:
+                findings.append("%s (timeout)" % item["file"])
             items.task_done()
             continue
 
-- 
2.26.2

Reply via email to