Strip source dir from file comments

Some programs like sphinx emit absolute paths in error messages. Those
cannot be processed by zuul so filter them if they're part of
zuul.project.

Change-Id: Ie8af91017c26f39c3aa9ca098d4230f0688351ce
This commit is contained in:
Tobias Henkel 2020-03-31 13:23:05 +02:00
parent ecb2c55640
commit 7df5e55ebc
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2

View File

@ -105,6 +105,12 @@ def extract_file_comments(tox_output, tox_envlist):
# Don't report if the file path isn't valid
if not os.path.isfile(file_path):
continue
# Strip current working dir to make absolute paths relative
cwd = os.getcwd() + '/'
if file_path.startswith(cwd):
file_path = file_path[len(cwd):]
ret.setdefault(file_path, [])
if tox_envlist:
message = "{envlist}: {message}".format(