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

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-18290] Improved regexp of CPPLint parser.
Now old and new formats could be parsed.
  • Loading branch information
uhafner committed Jun 28, 2013
1 parent 66073a0 commit 1248c6e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Expand Up @@ -14,7 +14,7 @@
@Extension
public class CppLintParser extends RegexpLineParser {
private static final long serialVersionUID = 1737791073711198075L;
private static final String PATTERN = "^\\s*(.*)\\s*\\((\\d*)\\):\\s*(.*)\\s*\\[(.*)\\] \\[(.*)\\]$";
private static final String PATTERN = "^\\s*(.*)\\s*[(:](\\d*)\\)?:\\s*(.*)\\s*\\[(.*)\\] \\[(.*)\\]$";

/**
* Creates a new instance of {@link CppLintParser}.
Expand Down
Expand Up @@ -49,5 +49,28 @@ public void testParser() throws IOException {
"c:/Workspace/Trunk/Project/P1/class.cpp",
"whitespace/tab", Priority.LOW);
}

/**
* Parses a file with CPP Lint warnings in the new format.
*
* @throws IOException
* if the file could not be read
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-18290">Issue 18290</a>
*/
@Test
public void issue18290() throws IOException {
Collection<FileAnnotation> warnings = new CppLintParser().parse(openFile("issue18290.txt"));

assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 2, warnings.size());
Iterator<FileAnnotation> iterator = warnings.iterator();
FileAnnotation annotation = iterator.next();
checkWarning(annotation, 399, "Missing space before {",
"/opt/ros/fuerte/stacks/Mule/Mapping/Local_map/src/LocalCostMap.cpp",
"whitespace/braces", Priority.HIGH);
annotation = iterator.next();
checkWarning(annotation, 400, "Tab found; better to use spaces",
"/opt/ros/fuerte/stacks/Mule/Mapping/Local_map/src/LocalCostMap.cpp",
"whitespace/tab", Priority.LOW);
}
}

@@ -0,0 +1,3 @@
/opt/ros/fuerte/stacks/Mule/Mapping/Local_map/src/LocalCostMap.cpp:399: Missing space before { [whitespace/braces] [5]
/opt/ros/fuerte/stacks/Mule/Mapping/Local_map/src/LocalCostMap.cpp:400: Tab found; better to use spaces [whitespace/tab] [1]

0 comments on commit 1248c6e

Please sign in to comment.