Skip to content

Commit

Permalink
Adjust order of severity and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
elupus committed Jan 18, 2023
1 parent c3a4e4f commit 82d4c70
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
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>UNSPECIFIED|STYLE|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 @@ -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-15.5")
.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 82d4c70

Please sign in to comment.