scoverage / scalac-scoverage-plugin

Scoverage Scala Code Coverage Core Libs
https://github.com/scoverage
Apache License 2.0
423 stars 126 forks source link

No way to determine source file location of class in cobertura report #582

Open Falmarri opened 9 months ago

Falmarri commented 9 months ago

There's no way to determine the actual source to the class in the cobertura report. For example, a project can have multiple definitions:

        <source>/home/user/project/subproject/src/main/scala</source>
        <source>/home/user/project/subproject/target/scala-2.12/src_managed/main</source>

and then an example class

<class name="com.org.package.ClassName" filename="com/org/package/ClassName.scala" line-rate="0.00" branch-rate="0.00" complexity="0">

This is especially difficult when using sbt-scoverage to aggregate the subprojects. That just concats all the sources into 1, making the aggregated report basically useless.

How do I determine where that class is from? I can likely figure it out because of requirements of scala, that there can't be multiple class names in the same package. But the information provided does not tell me where to find the class. I could have a file in each of those 2 source directories called com/org/package/ClassName.scala, but they provide different class names. I'd have to open the file and try to parse it to determine which file is the actual source of this class.

Originally posted by @Falmarri in https://github.com/scoverage/scalac-scoverage-plugin/issues/497#issuecomment-1722301809