summaryrefslogtreecommitdiff
path: root/mach
diff options
context:
space:
mode:
authorBastien Abadie <bastien@mozilla.com>2019-07-25 20:42:49 +0000
committerBastien Abadie <bastien@mozilla.com>2019-07-25 20:42:49 +0000
commit7d6c933fedd8caa15ddebaf2223857f62eb6ee07 (patch)
tree8153a93832cb6005dede1cc187c01a4de7876f95 /mach
parent334b44c616a58a20c04f827b8d2fe3aa1068616a (diff)
downloadnss-hg-7d6c933fedd8caa15ddebaf2223857f62eb6ee07.tar.gz
Bug 1568776 - Output paths relative to repository in coverity, r=andi,jcj
Differential Revision: https://phabricator.services.mozilla.com/D39311
Diffstat (limited to 'mach')
-rwxr-xr-xmach10
1 files changed, 9 insertions, 1 deletions
diff --git a/mach b/mach
index 7167906a3..01165e6ff 100755
--- a/mach
+++ b/mach
@@ -197,6 +197,13 @@ class coverityAction(argparse.Action):
def dump_cov_artifact(self, cov_results, source, output):
import json
+
+ def relpath(path):
+ '''Build path relative to repository root'''
+ if path.startswith(cwd):
+ return os.path.relpath(path, cwd)
+ return path
+
# Parse Coverity json into structured issues
with open(cov_results) as f:
result = json.load(f)
@@ -223,7 +230,7 @@ class coverityAction(argparse.Action):
# Embed all events into extra message
for event in issue['events']:
- dict_issue['extra']['stack'].append({'file_path': event['strippedFilePathname'],
+ dict_issue['extra']['stack'].append({'file_path': relpath(event['strippedFilePathname']),
'line_number': event['lineNumber'],
'path_type': event['eventTag'],
'description': event['eventDescription']})
@@ -237,6 +244,7 @@ class coverityAction(argparse.Action):
print('Skipping CID: {0} from file: {1} since it\'s not related with the current patch.'.format(
issue['stateOnServer']['cid'], issue['strippedMainEventFilePathname']))
continue
+ path = relpath(path)
if path in files_list:
files_list[path]['warnings'].append(build_element(issue))
else: