Anyone in touch with codecov team ? We need assert(0); and assert(false); lines to be ignored
thecybershadow.lists at gmail.com
Thu Feb 11 12:30:36 UTC 2021
On Thursday, 11 February 2021 at 11:17:29 UTC, Basile B. wrote:
> Just like exposed in the title, every assert(false); and
> assert(0); line is counted as not covered by CodeCov reports.
> But given D semantics, this is really not supposed to be
> covered. If at some point this is covered this mean that your
> program has crashed and that you will fix something and finally
> you see that the objective here is really that those special
> assertions must not be covered.
> If anyone is in touch with codecov or has been, it's been nice
> to suggest those two statements in their ignore rules (just
> like curly braces).
> I see criticism comming, such as "they cannot handle
> assert(/*yeah*/false/**/)", but I think that this does not
> matter. The regexes for the two most common cases would be
> great to get more accurate reports.
I think the appropriate place to fix this would be in the
compiler. This is where the information of whether a line is
eligible for coverage originates. (In DMD listings, it's the
difference between a line starting with " |" and
I think you also ideally want this to apply to basic blocks which
are guaranteed to end with an assert(0), e.g.:
logFatal("This should never happen!");
as well as functions which do this or otherwise never return.
More information about the Digitalmars-d