Skip to content

Commit 0da3574

Browse files
authored
Merge pull request #92 from Hansvdsteen/#90
Fixes issue #90: added support for CPPcheck result containing file "n…
2 parents b5ffbf7 + 9435690 commit 0da3574

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

com.googlecode.cppcheclipse.core.tests/src/com/googlecode/cppcheclipse/core/command/TestCppcheckCommand.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public void testParseResultLines() throws Exception {
4040
String line3 = ";;information;missingInclude;Cppcheck cannot find all the include files (use --check-config for details)";
4141
Problem problem3 = CppcheckCommand.parseResult(line3, null);
4242
assertProblem(problem3, null, -1, "information", "missingInclude", "Cppcheck cannot find all the include files (use --check-config for details)");
43+
44+
String line4="nofile;0;information;missingInclude;Cppcheck cannot find all the include files (use --check-config for details)";
45+
Problem problem4 = CppcheckCommand.parseResult(line4, null);
46+
assertProblem(problem4, null, -1, "information", "missingInclude", "Cppcheck cannot find all the include files (use --check-config for details)");
4347
}
4448

4549
private void assertProblem(Problem problem, File file, int line, String category, String id, String message) {

com.googlecode.cppcheclipse.core/src/com/googlecode/cppcheclipse/core/command/CppcheckCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,14 @@ public static Problem parseResult(String line, IProject project) {
297297
try {
298298

299299
File filename;
300-
if (Strings.isNullOrEmpty(lineParts[0])) {
300+
if (Strings.isNullOrEmpty(lineParts[0]) || "nofile".equals(lineParts[0])) {
301301
filename = null;
302302
} else {
303303
filename = new File(lineParts[0]);
304304
}
305305
// if line is empty set it to -1
306306
int lineNumber;
307-
if (Strings.isNullOrEmpty(lineParts[1])) {
307+
if (Strings.isNullOrEmpty(lineParts[1]) || "0".equals(lineParts[1])) {
308308
lineNumber = -1;
309309
} else {
310310
lineNumber = Integer.parseInt(lineParts[1]);

0 commit comments

Comments
 (0)