Skip to content

Commit

Permalink
[xmlreport] when a filepath is in multiple source dirs, choose the hi…
Browse files Browse the repository at this point in the history
…ghest one

fixes #578
  • Loading branch information
alex committed Nov 9, 2021
1 parent 2afc907 commit 331086f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion coverage/xmlreport.py
Expand Up @@ -148,7 +148,7 @@ def xml_file(self, fr, analysis, has_arcs):
# Create the 'lines' and 'package' XML elements, which
# are populated later. Note that a package == a directory.
filename = fr.filename.replace("\\", "/")
for source_path in self.source_paths:
for source_path in sorted(self.source_paths, key=len):
source_path = files.canonical_filename(source_path)
if filename.startswith(source_path.replace("\\", "/") + "/"):
rel_name = filename[len(source_path)+1:]
Expand Down

0 comments on commit 331086f

Please sign in to comment.