scripts: fix tidy excepting on no lints

If no lints are present from an invocation of clang tidy, no Yaml file
is produced which triggered exceptions. This CL fixes this by checking
if there is an error message before raising exceptions.

BUG=b:232986996
TEST=tricium_clang_tidy_unittest and manual testing

Change-Id: Ie66a71da1a073a632b2f531785b572f07c2e041f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3653216
Commit-Queue: Greg Edelston <gredelston@google.com>
Auto-Submit: Ryan Beltran <ryanbeltran@chromium.org>
Reviewed-by: Conor McNamara <ctmcnamara@chromium.org>
Tested-by: Ryan Beltran <ryanbeltran@chromium.org>
Commit-Queue: Ryan Beltran <ryanbeltran@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Greg Edelston <gredelston@google.com>
diff --git a/scripts/tricium_clang_tidy.py b/scripts/tricium_clang_tidy.py
index 312137c..39f017c 100644
--- a/scripts/tricium_clang_tidy.py
+++ b/scripts/tricium_clang_tidy.py
@@ -362,11 +362,13 @@
 """)
 
     yaml_file = json_file.with_suffix('.yaml')
-    # If this happened, clang-tidy was probably killed. Dump output as part of
-    # the exception so it's easier to reason about what happened.
+    # If there is no yaml file, clang-tidy was either killed or found no lints.
     if not yaml_file.exists():
-      raise RuntimeError("clang-tidy didn't produce an output file for "
-                         f'{json_file}. Output:\n{meta.stdstreams}')
+      if meta.exit_code:
+        raise RuntimeError("clang-tidy didn't produce an output file for "
+                           f'{json_file}. Output:\n{meta.stdstreams}')
+      else:
+        return meta, []
 
     with yaml_file.open('rb') as f:
       yaml_data = yaml.safe_load(f)