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

[Feature] Support excludedPackages and excludedFiles for scala3 #485

Open
rolandtritsch opened this issue Jul 4, 2022 · 5 comments
Open

Comments

@rolandtritsch
Copy link
Member

Hi All,

right now scala3 does not support to exclude any files and/or packages when instrumenting the code.

The scala2 implementation supports this.

To make migrating to scala3 painless/possible, we need to find a way to support this in scala3 (somehow).

I see two options ...

  1. Add a/the ability to exclude files and packages to the scala3 implementation. That would be a/the preferred approach, but might take a while.
  2. Add a coverageExlude task to sbt-scoverage that will read the coverage from the data-dir and (re)writes it again without the excluded files and packages. That is obviously a hack. And should only be considered a workaround until the exclude functionality becomes abvailable in dotty. But this can be implemented fast and easy.
@ckipp01
Copy link
Member

ckipp01 commented Jul 4, 2022

Add a/the ability to exclude files and packages to the scala3 implementation. That would be a/the preferred approach, but might take a while.

So this is my preferred way. If there isn't a feature request for this yet in the Dotty repo I'd suggest creating one there outlining the need for this.

Add a coverageExlude task to sbt-scoverage that will read the coverage from the data-dir and (re)writes it again without the excluded files and packages. That is obviously a hack. And should only be considered a workaround until the exclude functionality becomes abvailable in dotty. But this can be implemented fast and easy.

Honestly, since I'm not really actively working on scoverage I really don't want to add a hack like this in. I know this may sort of hinder people for the time being, but then hopefully that will spur on someone to add it into the compiler. So for now I'd say I don't have any intention to add that hack into the sbt plugin.

@jtjeferreira
Copy link

Hi!

I was upgrading some scala2 projects to scala3 and noticed some differences in coverage results, because // $COVERAGE-OFF$ comments are not respected.

So this is my preferred way. If there isn't a feature request for this yet in the Dotty repo I'd suggest creating one there outlining the need for this.

I don't see any ticket in the scala3 repo linked. Shall I create one?

@jtjeferreira
Copy link

Ofc, I now found scala/scala3#17684 which was converted into a discussion

@gzoller
Copy link

gzoller commented May 21, 2024

So--question... I get that these two excludes don't work yet for Scala 3, but what about '''$COVERAGE-OFF$''' and '''$COVERAGE-ON$'''? Should these be expected to work for Scala 3? So far they don't appear to do anything for me--toggled code still gets covered/reported.

@jozic
Copy link
Contributor

jozic commented May 21, 2024

Files and packages exclusion works starting Scala 3.4.2, comment exclusion is not supported yet in Scala 3, afaik

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

No branches or pull requests

5 participants