Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark inconclusive messages in cppcheck V2 #429

Merged
merged 1 commit into from
Apr 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException {
SMInputCursor errorCursor = errorsCursor.childElementCursor("error");
while (errorCursor.getNext() != null) {
String id = errorCursor.getAttrValue("id");
String msg = errorCursor.getAttrValue("msg");
String msg = createMsg(
errorCursor.getAttrValue("inconclusive"),
errorCursor.getAttrValue("msg")
);
String file = null;
String line = null;

Expand All @@ -99,6 +102,15 @@ public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException {
}
}

private String createMsg(String inconclusive, String msg) {
if (!StringUtils.isEmpty(msg)) {
if (!StringUtils.isEmpty(inconclusive) && "true".equals(inconclusive)) {
return "[inconclusive] " + msg;
}
}
return msg;
}

private boolean isInputValid(String file, String line, String id, String msg) {
return !StringUtils.isEmpty(id) && !StringUtils.isEmpty(msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void setUp() {
@Test
public void shouldReportCorrectViolations() {
sensor.analyse(project, context);
verify(issuable, times(5)).addIssue(any(Issue.class));
verify(issuable, times(7)).addIssue(any(Issue.class));
}

@Test
Expand Down