Skip to content

Commit

Permalink
Add invalid suppression to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Jonsey committed Nov 26, 2024
1 parent a203a21 commit 9986637
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,19 @@ void handleBrokenPathsInFileURIschemeFormat(final String fileName) {
void shouldIgnoreSuppressedIssues() {
var report = parse("suppressed-sarif.json");
try (var softly = new SoftAssertions()) {
softly.assertThat(report).hasSize(1);
softly.assertThat(report).hasSize(2);
softly.assertThat(report.get(0))
.hasFileName("/whatever/path.c")
.hasLineStart(123)
.hasType("Cyclomatic complexity")
.hasSeverity(Severity.WARNING_HIGH);
softly.assertThat(report.get(0).getMessage()).matches("asdasd");
softly.assertThat(report.get(1))
.hasFileName("/whatever/path.c")
.hasLineStart(123)
.hasType("abcdef")
.hasSeverity(Severity.WARNING_LOW);
softly.assertThat(report.get(1).getMessage()).matches("asdasd");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,56 @@
"fixes": [],
"taxa": []
},
{
"ruleId": "abcdef",
"ruleIndex": -1,
"kind": "FAIL",
"level": "note",
"message": {
"text": "asdasd",
"arguments": []
},
"locations": [
{
"id": -1,
"physicalLocation": {
"artifactLocation": {
"uri": "/whatever/path.c",
"index": -1
},
"region": {
"startLine": 123,
"endLine": 123,
"charOffset": -1,
"byteOffset": -1,
"message": {
"text": "asdasd",
"arguments": []
}
}
},
"logicalLocations": [],
"annotations": [],
"relationships": []
}
],
"stacks": [],
"codeFlows": [],
"graphs": [],
"graphTraversals": [],
"relatedLocations": [],
"suppressions": [
{
"state": "rejected",
"justification": "bla"
}
],
"rank": -1.0,
"attachments": [],
"workItemUris": [],
"fixes": [],
"taxa": []
},
{
"ruleId": "Cyclomatic complexity",
"ruleIndex": -1,
Expand Down

0 comments on commit 9986637

Please sign in to comment.