Is there any way to get dotCover to ignore a line of unreachable code

If I have code that can not be reached such as the exception below: 

enum ScriptType {
     None,     NewDBWithVersionTable,     PreScript,
     PostScript }

switch (scriptType)
{
  case ScriptType.None:
  case ScriptType.NewDBWithVersionTable:
    // do something
    break;

  case ScriptType.PreScript:
    // do something else
    break;

case ScriptType.PostScript:
    // do something different
    break;

default:
   // this wont run unless someone adds an enum
   throw new Exception ("Unhandled ScriptType - Someone added a new enum update required!!");

}  


Is there any way to make dotcover exclude the last line from its analysis?

I would like to be able to do something like:


//DotCoverIgnore
 default:
   // this wont run unless someone adds an enum
   throw new Exception ("Unhandled ScriptType - Someone added a new enum update required!!");
//EndDotCoverIgnore

Thanks
John

                      
 
4 comments

Hello John
      At the moment, there's no way to ignore a line of code. We're planning to provide a way to filter out certain types of statements (such as statements in catch block): http://youtrack.jetbrains.net/issue/DCVR-138. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with  pleasure!"

0

Hello Andrey

I don't think that feature is what I am asking for.

When I look again it is more like the following:

http://devnet.jetbrains.net/message/5266602#5266602

http://youtrack.jetbrains.net/issue/DCVR-145

Can you tell me what happened with DCVR-145?

It looks like it was marked as a duplicate but there is no link to the active request.

John

0

Hello John,
Thank you for the feedback.
DCVR-145 is in our backlog, but it wasn't scheduled for the upcoming releases yet.
You're welcome to track its status.

0

Please sign in to leave a comment.