Ignore lines with comments inside the files, expected misses

Summary/Description

So I’m making a Swift framework and there are some lines that I can’t cover with tests, like the ones behind version number checks for old iOS versions that GitHub doesn’t have preinstalled simulators for.

It would be nice if these lines could be either marked as “ignore” or “expected miss” inside the code.

Examples

if #available(iOS 12.0) {
  doTheNewStuff()
} else {
  // codecov:miss:next -- marks the next line as expected miss
  doTheOldStuff()
  // codecov:ignore:start -- ignores everything between this and the end line
  doTheOldStuff()
  // codecov:ignore:end
  doTheOldStuff() // codecov:ignore:this -- ignores this line
  // codecov:ignore:next ios -- ignores the next line for the "ios" flag
  doTheOldStuff()
}

Versions

I’m using Swift and running the tests via GitHub Actions.

Hi @Cyberbeni thanks for the request. I’ll forward to the product team.