4

I saw one problem during project upgrade.

Before upgrade setup:

  • Java - 1.8

  • Scala - 2.12

  • sbt - 1.5.0

  • sbt-jacoco - 3.1.0

Overall test coverage in SonarQube: ~72%

After upgrade:

  • Java - 17

  • Scala - 2.13

  • sbt - 1.10.11

  • sbt-jacoco - 3.4.0

Overall test coverage in SonarQube: ~62%

With upgrade of sbt-jacoco our overall test coverage decreased by ~10%.

After some investigation we found that sbt-jacoco 3.4.0 now counting branches of synthetic methods (e.g. copy$ methods for case classes).

I checked source code of sbt-jacoco and I could see there is appropriate filter (scala synthetic methods) implemented, but looks like it doesn't work, or maybe I should enable it somehow during launching jacoco command.

In addition it also counting plain getters starting from sbt-jacoco 3.4.0, but per jacoco it shouldn't.

UPD

@aled, @Gaël J, you are right, I should add some example. And the question is "how to exclude synthetic methods from SBT Jacoco report"

Here is before upgrade (should be launched with Java 1.8): https://github.com/ppllaxxa/sbt-jacoco-test

After upgrade (should be launched with Java 17): https://github.com/ppllaxxa/sbt-jacoco-test-upgrade

To generate jacoco report just execute in sbt shell: clean coverageOn jacoco coverageReport coverageOff

Report will be located here: sbt-jacoco-test\target\scala-2.12\jacoco\report\html Before upgrade

sbt-jacoco-test-upgrade\target\scala-2.13\jacoco\report\html After upgrade

4
  • 1
    Please provide an minimal reproducible example in the question. But more importantly, what is the question actually? The post only states some facts. Commented Jan 5 at 14:25
  • 2
    I guess the question is "how to exclude synthetic methods from SBT Jacoco". I feel it's a bit harsh to close the question. That being said, a concrete code example would help @ppllaxxa. Commented Jan 5 at 18:14
  • I added example with sbt-jacoco report results. There are 2 repos, first one before the upgrade, second one ofter upgrade Commented Jan 8 at 12:58
  • 3
    Please vote to reopen the question. I added detailed exmaples for both cases (before upgrade and after upgrate), also added appropriate results which demonstrates the problem. Commented Jan 12 at 11:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.