Correct filtering by file in v1 parsing
The filter uses a field, "file", which is not found on the root
occurrence. This causes the following traceback:
Traceback (most recent call last):
File "script/coverity_parser.py", line 267, in <module>
for issue in sorted(issue_cls, key=lambda i: make_key(i)):
File "script/coverity_parser.py", line 222, in __iter__
yield from self.gen
File "script/coverity_parser.py", line 183, in iter_issues_v1
for issue_group in filter(self.filter_groups_v1, report["issueInfo"]):
File "script/coverity_parser.py", line 173, in filter_groups_v1
if group["file"].lstrip("/").startswith(skip_dir):
KeyError: 'file'
Instead, we should check the first occurence for it's file member. At
the very least, this will prevent further exceptions.
Change-Id: Ib48406278627a81a35693a83a679e52b6f45db15
Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
diff --git a/script/coverity_parser.py b/script/coverity_parser.py
index a458da5..cac89a6 100644
--- a/script/coverity_parser.py
+++ b/script/coverity_parser.py
@@ -170,7 +170,7 @@
if group["occurrences"][0]["checker"] in _rule_exclusions:
return False
for skip_dir in IGNORED_DIRS:
- if group["file"].lstrip("/").startswith(skip_dir):
+ if group["occurrences"][0]["file"].lstrip("/").startswith(skip_dir):
return False
# unless we're showing all groups, remove the groups that are in both
# golden and branch