Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #92 from Hansvdsteen/#90
Browse files Browse the repository at this point in the history
Fixes issue #90: added support for CPPcheck result containing file "n…
  • Loading branch information
kwin committed Dec 5, 2018
2 parents b5ffbf7 + 9435690 commit 0da3574
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -40,6 +40,10 @@ public void testParseResultLines() throws Exception {
String line3 = ";;information;missingInclude;Cppcheck cannot find all the include files (use --check-config for details)";
Problem problem3 = CppcheckCommand.parseResult(line3, null);
assertProblem(problem3, null, -1, "information", "missingInclude", "Cppcheck cannot find all the include files (use --check-config for details)");

String line4="nofile;0;information;missingInclude;Cppcheck cannot find all the include files (use --check-config for details)";
Problem problem4 = CppcheckCommand.parseResult(line4, null);
assertProblem(problem4, null, -1, "information", "missingInclude", "Cppcheck cannot find all the include files (use --check-config for details)");
}

private void assertProblem(Problem problem, File file, int line, String category, String id, String message) {
Expand Down
Expand Up @@ -297,14 +297,14 @@ public static Problem parseResult(String line, IProject project) {
try {

File filename;
if (Strings.isNullOrEmpty(lineParts[0])) {
if (Strings.isNullOrEmpty(lineParts[0]) || "nofile".equals(lineParts[0])) {
filename = null;
} else {
filename = new File(lineParts[0]);
}
// if line is empty set it to -1
int lineNumber;
if (Strings.isNullOrEmpty(lineParts[1])) {
if (Strings.isNullOrEmpty(lineParts[1]) || "0".equals(lineParts[1])) {
lineNumber = -1;
} else {
lineNumber = Integer.parseInt(lineParts[1]);
Expand Down

0 comments on commit 0da3574

Please sign in to comment.