From 9f3be7bcb00ab56d03070dc3948bbaae384f7974 Mon Sep 17 00:00:00 2001 From: Michael Hohn Date: Tue, 16 Nov 2021 21:45:54 -0800 Subject: [PATCH] Log missing files, but try to continue execution --- sarif_cli/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sarif_cli/__init__.py b/sarif_cli/__init__.py index 9ba930a..5352e3b 100644 --- a/sarif_cli/__init__.py +++ b/sarif_cli/__init__.py @@ -52,6 +52,9 @@ def load_lines(root, path, line_from, line_to): Newlines are dropped. """ fname = os.path.join(root, path) + if not os.path.exists(fname): + dbg("Missing file: %s" % fname) + return [] with open(fname, 'r') as file: lines = file.readlines() return [line.rstrip("\n\r").replace("\t", " ")