We use the sbt-scoverage plugin for generating coverage measurements
before sending them to codecov.io for display. It looks like this does
have a way exclude packages and sections of code:

https://github.com/scoverage/sbt-scoverage#exclude-classes-and-packages

So we could maybe do something like:

  foo match {
    case real1 => ...
    case real2 => ... r
    // $COVERAGE-OFF
    case thingy =>  {
      Assert.invariantFailed(".....msg...")
    }
    // $COVERAGE-ON
  }

To exclude the entire case that should never be hit?


On 4/27/21 10:29 AM, Beckerle, Mike wrote:
> We have assertions like:
> 
> foo match {
> ... real cases ....
> case thingy =>  Assert.invariantFailed(".....msg...")
> }
> 
> The same thing can happen with if-then-else logic obviously where you make a 
> decision, and some paths
> through the logic can't occur.
> 
> These always get marked as non-covered, because by nature they're never 
> supposed 
> to happen.
> 
> Is there a structured comment or some way to tell codecov that this is ok, 
> and 
> not to issue a warning about this line?
> 
> Mike Beckerle | Principal Engineer
> 
> mbecke...@owlcyberdefense.com <mailto:bhum...@owlcyberdefense.com>
> 
> P +1-781-330-0412
> 

Reply via email to