Skip to content

Commit

Permalink
dbg: solves false positive if there is a ''//'' in the comment (for e…
Browse files Browse the repository at this point in the history
…xample a URL)
  • Loading branch information
rkblackfire committed Jan 9, 2017
1 parent 1b9a731 commit eaa2ecf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions TwStyleGuide/DiagnosticAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ private void AnalyzeEncapsulatingIfs(SyntaxNodeAnalysisContext context)

if (upperLeft.ToString() != descendingLeft.ToString())
onlySwitching = false;
//if (descendingRight.ToString().Contains("typeof"))
//onlySwitching = false;
if (descendingRight.ToString().Contains("typeof"))
onlySwitching = false;
}
else
onlySwitching = false;
Expand Down Expand Up @@ -214,7 +214,7 @@ private void AnalyzeSingleLineCommentSyntaxNode(SyntaxTreeAnalysisContext contex
var root = context.Tree.GetCompilationUnitRoot(context.CancellationToken);
var commentNodes = from node in root.DescendantTrivia() where node.IsKind(SyntaxKind.SingleLineCommentTrivia) select node; // one could also select ''node.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia)''
foreach (var node in commentNodes)
if (Regex.IsMatch(node.ToString(), @"/{2,}\w+"))
if (Regex.IsMatch(node.ToString(), @"^/{2,}\w+"))
{
var diagnostic = Diagnostic.Create(Rule3, node.GetLocation());
context.ReportDiagnostic(diagnostic);
Expand Down

0 comments on commit eaa2ecf

Please sign in to comment.