GoEddie/SQLCover

Report statement counting

MironAtHome opened this issue · 2 comments

Do you want to request a feature or report a bug?
Up to Ed and team

What is the current behavior?
Report states 20 statements executed out of 22 accounted for

**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via http://sqlfiddle.com/
Create procedure with goto statement and define label. The label is counted towards as a valid statement, but it never gets executed. Hence, reporting is off.

What is the expected behavior?
Reporting needs to count all executed statements.
So, if procedure has label(s) that do not get drawn into the set of executed statements, the label statement would be very nice to be placed on the "IsIgnoredType" list, so that statements, available and executed tallied up for report correctly and completely

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
SQL Server 2016 please. I didn't check earlier, but I'd assume those will behave identically.

The change is very simple, add lines

        if (statement is LabelStatement)
            return true;

to the IsIgnoredType statement.
Please consider change.

Hey @MironAtHome,

A goto label in a stored proc? what madness is this!

I will include this in the next release, thanks for reporting it and sorry for the delay :)

Yey!