Skip to content

Commit

Permalink
Merge pull request #874 from elupus/patch-1
Browse files Browse the repository at this point in the history
Add UNSPECIFIED and STYLE as a output from CodeChecker
  • Loading branch information
uhafner authored Jan 18, 2023
2 parents 5293be3 + a025410 commit 4499ce7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class CodeCheckerParser extends LookaheadParser {
private static final long serialVersionUID = -3015592762345283582L;
private static final String CODE_CHECKER_DEFECT_PATTERN =
"^\\[(?<severity>CRITICAL|HIGH|MEDIUM|LOW)\\] (?<path>.+):(?<line>\\d+):(?<column>\\d+): (?<message>.*?) \\[(?<category>[^\\s]*?)\\]$";
"^\\[(?<severity>CRITICAL|HIGH|MEDIUM|LOW|UNSPECIFIED|STYLE)\\] (?<path>.+):(?<line>\\d+):(?<column>\\d+): (?<message>.*?) \\[(?<category>[^\\s]*?)\\]$";

/**
* Creates a new instance of {@link CodeCheckerParser}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected CodeCheckerParser createParser() {

@Override
protected void assertThatIssuesArePresent(final Report report, final SoftAssertions softly) {
assertThat(report).hasSize(3);
assertThat(report).hasSize(5);

softly.assertThat(report.get(0))
.hasLineStart(17)
Expand All @@ -48,6 +48,22 @@ protected void assertThatIssuesArePresent(final Report report, final SoftAsserti
.hasCategory("bugprone-signed-char-misuse")
.hasSeverity(Severity.WARNING_NORMAL);

softly.assertThat(report.get(3))
.hasLineStart(1778)
.hasColumnStart(7)
.hasFileName("/path/to/projrct/extern/lib/dem.c")
.hasMessage("misra violation (use --rule-texts=<file> to get proper output)")
.hasCategory("cppcheck-misra-c2012-15.5")
.hasSeverity(Severity.WARNING_LOW);

softly.assertThat(report.get(4))
.hasLineStart(96)
.hasColumnStart(25)
.hasFileName("/path/to/projrct/extern/lib/control.c")
.hasMessage("misra violation (use --rule-texts=<file> to get proper output)")
.hasCategory("cppcheck-misra-c2012-11.3")
.hasSeverity(Severity.WARNING_LOW);

}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ Found 1 defect(s) in workbook.cpp

Found 1 defect(s) in HPSF.cpp

[UNSPECIFIED] /path/to/projrct/extern/lib/dem.c:1778:7: misra violation (use --rule-texts=<file> to get proper output) [cppcheck-misra-c2012-15.5]
return E_NOT_OK;
^

[STYLE] /path/to/projrct/extern/lib/control.c:96:25: misra violation (use --rule-texts=<file> to get proper output) [cppcheck-misra-c2012-11.3]
"CommunicationControl: %s (%d) is not supported\n",

Found 2 defect(s) in dem.c


Found 485 defect(s) in formula.cpp


Expand Down

0 comments on commit 4499ce7

Please sign in to comment.