Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: sbt-coveralls: Issue 199: Use relative paths in cobertura.xml file #497

Merged
merged 3 commits into from Sep 10, 2022

Conversation

rolandtritsch
Copy link
Member

@rolandtritsch rolandtritsch commented Sep 7, 2022

Hi @ckipp01. Here is the proposed bug-fix for issue 199 on sbt-coveralls.

One way to fix this is to make sure that Location.source is NOT using the canonical path, but I do not know what else relies on it.

Means the less risky fix was to use relativeSource from the BaseReportWriter. This is what the other report writers are doing.

I also tested this with by rebuilding sbt-scoverage with a local build of the fixed scala-scoverage-plugin.

Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Means the less risky fix was to use relativeSource from the BaseReportWriter. This is what the other report writers are doing.

Yea I think this is a good approach.

Thanks for the fix!

@ckipp01 ckipp01 merged commit 7204f97 into scoverage:main Sep 10, 2022
@rolandtritsch rolandtritsch deleted the roland/199/make-paths-relative branch December 10, 2022 07:38
@Falmarri
Copy link

This is a bad change. Now there's no way to determine the actual source to the class in question. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants