Skip to content

Commit b8486e9

Browse files
committed
Fix for using SuppressedOnly switch - this switch was non-functional due to a bug in the Engine
1 parent 9f74bb2 commit b8486e9

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

Engine/Helper.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -934,22 +934,15 @@ public Tuple<List<SuppressedRecord>, List<DiagnosticRecord>> SuppressRule(string
934934
break;
935935
}
936936

937-
if (string.IsNullOrWhiteSpace(ruleSuppression.RuleSuppressionID))
937+
// we suppress if there is no suppression id or if there is suppression id and it matches
938+
if (string.IsNullOrWhiteSpace(ruleSuppression.RuleSuppressionID)
939+
|| (!String.IsNullOrWhiteSpace(record.RuleSuppressionID) &&
940+
string.Equals(ruleSuppression.RuleSuppressionID, record.RuleSuppressionID, StringComparison.OrdinalIgnoreCase)))
938941
{
939942
suppressed[recordIndex] = true;
943+
suppressedRecords.Add(new SuppressedRecord(record, ruleSuppression));
940944
suppressionCount += 1;
941945
}
942-
else
943-
{
944-
//if there is a rule suppression id, we only suppressed if it matches
945-
if (!String.IsNullOrWhiteSpace(record.RuleSuppressionID) &&
946-
string.Equals(ruleSuppression.RuleSuppressionID, record.RuleSuppressionID, StringComparison.OrdinalIgnoreCase))
947-
{
948-
suppressed[recordIndex] = true;
949-
suppressedRecords.Add(new SuppressedRecord(record, ruleSuppression));
950-
suppressionCount += 1;
951-
}
952-
}
953946

954947
recordIndex += 1;
955948
}

0 commit comments

Comments
 (0)