Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Workaround for StyleCop SA1650 catching URL as misspelled word without warning suppression

I'm trying to include a URL in my remarks as shown in the example below. This causes StyleCop to report a warning based on rule SA1650 (misspelled word in remarks), which for our purposes can't be suppressed (by policy). This warning is no surprise because URL syntax doesn't demand proper English spelling.

...

/// <remarks>
/// <para>... some remarks ...</para>
/// <para>http://www.foo.wtvr.com</para>
/// <para>... some other remarks ...</para>
/// </remarks>

...

First off, is it considered bad practice to include URLs in summary/remarks? I'd guess not since Visual Studio recognizes links and makes them clickable. I'll remove it if necessary but I'd like to leave the reference there for others.

If this isn't considered bad practice, is there a way to get StyleCop to ignore URL text without suppressing the warning (or adding the entire URL or each part of it to the list of recognized words)? I have tried the following (four forward slashes on URL's line) but that results instead in a warning from rule SA1644 (no blank lines allowed in documentation headers):

...

/// <remarks>
/// <para>... some remarks ...</para>
//// <para>http://www.foo.wtvr.com</para>
/// <para>... some other remarks ...</para>
/// </remarks>

...

My current solution is to use the comment-in-comment tags, as shown below, which yields no warnings, but I don't know if this is best practice:

...

/// <remarks>
/// <para>... some remarks ...</para>
/// <para><!--http://www.foo.wtvr.com--></para>
/// <para>... some other remarks ...</para>
/// </remarks>

...

Help me document my code better.

like image 360
Steverino Avatar asked Oct 07 '15 23:10

Steverino


1 Answers

I believe using http links in comments is a good practice.

Use

<see href="http://myurl.com/"/> 

when inserting a URL in your comments as answered here.

like image 168
Yanal-Yves Fargialla Avatar answered Nov 16 '22 03:11

Yanal-Yves Fargialla