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

Strange issue when making ScoverageReport for bleep #324

Open
markehammons opened this issue Jun 4, 2023 · 3 comments
Open

Strange issue when making ScoverageReport for bleep #324

markehammons opened this issue Jun 4, 2023 · 3 comments

Comments

@markehammons
Copy link

(In my implementation of Scoverage Reporting)[https://gist.github.com/markehammons/ab20ae70aa74c1391008c99f1a49a8eb] for bleep, I ran into an odd issue I had to hack around. The hack occurs at lines 42-59 of the ScoverageReport.scala file in that gist.

The essence of the problem is that the -coverage-out: flag is generating scoverage data with paths that look like ../home/mhammons/Documents/slinc/core/src/scala/the/rest/of/the/absolute/path instead of the core/src/scala/the/rest/of/the/relative/path scoverage needs to generate the reports. The solution I've hacked in is to read the file, look for lines starting with ../ and replace them with a path that strips out the .. at the beginning and relativizes the path with the buildDir.

Any thoughts on why this could be happening?

@oyvindberg
Copy link
Owner

Hopefully what I suggested in #320 will help you out here?

@markehammons
Copy link
Author

Hi @oyvindberg. Sorry for the very late reply, I halted use of bleep in my currently existing library, and started using it in a new one. With regards to that, I have tested my scoverage script/plugin on this new library, and sadly it doesn't solve the issue. Here's the current version of my code: https://github.com/markehammons/bleep-plugins

The scoverage modification code is on lines 42-68 of ScoverageReport.scala. I have it warn and show the original lines if it detects a malformed path (absolute path that starts with "../"). Here's the output on a recent run:

📙 BSP / [script ScoverageReport]: /home/mhammons/Documents/xperimenta/.bleep/builds/add-coverage/.bloop/core/scoverage-report/scoverage.coverage@22 is malformed!!
📗 BSP / [script ScoverageReport]: original line: ../home/mhammons/Documents/xperimenta/core/src/scala/fr/hammons/xperimenta/core/Structural.scala
📙 BSP / [script ScoverageReport]: /home/mhammons/Documents/xperimenta/.bleep/builds/add-coverage/.bloop/core/scoverage-report/scoverage.coverage@39 is malformed!!
📗 BSP / [script ScoverageReport]: original line: ../home/mhammons/Documents/xperimenta/core/src/scala/fr/hammons/xperimenta/core/Structural.scala
📙 BSP / [script ScoverageReport]: /home/mhammons/Documents/xperimenta/.bleep/builds/add-coverage/.bloop/core/scoverage-report/scoverage.coverage@56 is malformed!!
📗 BSP / [script ScoverageReport]: original line: ../home/mhammons/Documents/xperimenta/core/src/scala/fr/hammons/xperimenta/core/Structural.scala
📙 BSP / [script ScoverageReport]: /home/mhammons/Documents/xperimenta/.bleep/builds/add-coverage/.bloop/core/scoverage-report/scoverage.coverage@73 is malformed!!
📗 BSP / [script ScoverageReport]: original line: ../home/mhammons/Documents/xperimenta/core/src/scala/fr/hammons/xperimenta/core/Structural.scala

The proper format is something like: core/src/scala/fr/hammons/xperimenta/core/Structural.scala. I'm not really sure why this is happening, and it may be more of a compiler bug than a bug with bleep, but I was wondering if you had any insight into this.

@oyvindberg
Copy link
Owner

I don't really know.

Here are what I would look into:

  • You can manually inspect the generated bloop files inside /home/mhammons/Documents/xperimenta/.bleep/builds/add-coverage/.bloop to see that the path in the scalacOption is generated like you want
  • You can debug scripts in your IDE, so if the error is in your code it should be easy to find that way
  • If both of those look ok it's likely your usage of the coverage plugin which differs from how it should be used, or some assumption it was written with which no longer holds in this world.

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

No branches or pull requests

2 participants