Skip to content

Commit

Permalink
Fixed conditions in comments passing bug - conditions no longer pass …
Browse files Browse the repository at this point in the history
…if there are only matches in comments (#155)
  • Loading branch information
fawazd authored Apr 29, 2020
1 parent 510d30b commit ba6e74c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions DevSkim-DotNet/Microsoft.DevSkim/TextContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,19 @@ public bool MatchPattern(SearchPattern pattern, Boundary boundary, SearchConditi

string text = _content.Substring(scope.Index, scope.Length);
List<Boundary> matches = MatchPattern(pattern, text);
if (matches.Count > 0)
result = true;

foreach (Boundary match in matches)
{
Boundary translatedBoundary = new Boundary()
{
Length = match.Length,
Index = match.Index + scope.Index
};
if (ScopeMatch(pattern, translatedBoundary))
{
result = true;
}
}

return result;
}
Expand Down

0 comments on commit ba6e74c

Please sign in to comment.