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

how to switch between statement or branch coverage as default #221

Open
rajeshpg opened this issue Jun 7, 2017 · 8 comments
Open

how to switch between statement or branch coverage as default #221

rajeshpg opened this issue Jun 7, 2017 · 8 comments

Comments

@rajeshpg
Copy link

rajeshpg commented Jun 7, 2017

I would like to use branch coverage as the default coverage strategy.
So is there a way to switch the coverage strategy.

@gslowikowski
Copy link
Member

What do you mean by switching coverage strategy?

@rajeshpg
Copy link
Author

rajeshpg commented Jun 7, 2017

I guess scoverage considers statement coverage percentage as default to check against minimum coverage. I would like to use branch coverage percentage instead.

@gslowikowski
Copy link
Member

I was thinking about new setting, something like that:

  lazy val coverageBranchMinimum = settingKey[Double]("minimum branch coverage")

This would be independent of coverageMinimum setting, with zero as default value for backward compatibility.
To switch the strategy (as you named it), you would have to set coverageMinimum value to zero, and coverageBranchMinimum to value greater than zero. WDYT?

Anyway, I'm blocked with development by this issue. Waiting for the project owner to react. I want this problem to be fixed first.

@rajeshpg
Copy link
Author

rajeshpg commented Jun 7, 2017

that'a a great idea. i will try to implement and do PR if you are ok with.

@ches
Copy link

ches commented Dec 24, 2017

I'd like to have this as well.

Alternatively there could be a new setting like coverageMinimumCheck := Branch with a default of Statement for backward compatibility, so there are not two different keys for setting the threshold (unless some people actually want to check/enforce both, then maybe it's beneficial to have two).

To switch the strategy (as you named it), you would have to set coverageMinimum value to zero, and coverageBranchMinimum to value greater than zero. WDYT?

coverageMinimum already defaults to 0 so you wouldn't need any extra boilerplate to only enable coverageBranchMinimum, so that approach sounds good to me too. 👍

@kitbellew
Copy link

We have a need for a fine-grained control for coverage minima (similar to various levels supported by JaCoCo for java http://www.jacoco.org/jacoco/trunk/doc/check-mojo.html#rules).

Here's a proposed solution: #253

@Bongani
Copy link

Bongani commented Jul 12, 2019

I'd also like to have branch coverage. Is there any update on this ticket?

@alexmsmartins
Copy link

alexmsmartins commented Aug 8, 2019

The branch coverage is already part of?PR #253 . Thanks for that @kitbellew

Is there anything stopping it from getting merged?

It would really be great to be able to use it in the next release.

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

6 participants