The sourcefilename field in xml is used to add together all the covered/missed lines, but if there happen to be two (or more) files with that name, Shroud will pull all line coverage from each file, leading to a larger denominator than expected.
Instead, Shroud should use the fully qualified class name as the key, which would keep each file as a distinct record when aggregating coverage counts.
I ran into this on a large multi-module project, where a team was orchestrating a code migration across modules and had some temporarily duplicated file names (though with different packages).
Any two files with identical names will make
Danger
/Shroud
output bogus numbers for the coverage percentage.It's not too strange on a large project (perhaps with many modules) to have a couple files in different packages, but the same name. Eg,
When
Shroud
parses the jacoco reportxml
, it only looks at the file name, not the fully qualified path. https://github.com/livefront/danger-shroud/blob/54fe4c62d182be18250c3b6ff73a9afb6ac5b84a/lib/shroud/plugin.rb#L147The
sourcefilename
field in xml is used to add together all the covered/missed lines, but if there happen to be two (or more) files with that name,Shroud
will pull all line coverage from each file, leading to a larger denominator than expected.Instead,
Shroud
should use the fully qualified class name as the key, which would keep each file as a distinct record when aggregating coverage counts.