0

I'm using sbt-scoverage plugin for measure the code (statement) coverage in our project. Because of months of not worriying about the coverage and our tests we decided to set a threshold for having a minimum coverage percentage: if you are writing code at least try to leave the project with the same coverage percentage as when you've find it. e.g. if you've started your feature branch with a project having 63% of coverage you have, after finishing your feature, to leave the same coverage value.

With this we want to ensure a gradual adoption of better practices instead of setting a fixed coverage value (something like coverageMinimum := XX).

Having said that, I'm considering the possibility of storing the last value of the analysis in a file and then compare that with a new execution, triggered by the developer.

Another option that I'm considering is to retrieve this value from our SonarQube server based on the data stored there.

My question is: Is there a way to do a thing like this with sbt-scoverage? I've dug into the docs and their Google Groups forum but I can't find something about it.

Thanks in advance!

Alejandro Echeverri
  • 1,328
  • 2
  • 19
  • 32

1 Answers1

0

coverageMinimum setting value doesn't have to be constant, you can write any function dynamically returning it, eg:

coverageMinimum := { val tmp = 2 + 4 10 * tmp // returns 60 :) }