Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-22965] Cppcheck plugin shall display the inconclusive messages
- Inconclusive flag present in cppcheck report is parsed, stored and displayed in results.
- Headers are highlighted (bold) in the listing of all issues.
  • Loading branch information
mixalturek committed May 18, 2014
1 parent ea782dc commit f1cf428
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
Expand Up @@ -34,7 +34,7 @@
@ExportedBean(defaultVisibility = 999)
public class CppcheckFile implements ModelObject, Serializable {

private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 2L;

private Integer key;

Expand All @@ -48,6 +48,9 @@ public class CppcheckFile implements ModelObject, Serializable {

private String message;

/** The issue may be false positive. */
private boolean inconclusive;

@Exported
public String getFileName() {
return fileName;
Expand Down Expand Up @@ -133,6 +136,15 @@ public void setKey(Integer key) {
this.key = key;
}

@Exported
public boolean isInconclusive() {
return inconclusive;
}

public void setInconclusive(boolean inconclusive) {
this.inconclusive = inconclusive;
}

public String getDisplayName() {
return "cppcheckFile";
}
Expand Down
Expand Up @@ -143,6 +143,7 @@ private CppcheckReport getReportVersion2(Results results) {
cppcheckFile.setCppCheckId(error.getId());
cppcheckFile.setSeverity(error.getSeverity());
cppcheckFile.setMessage(error.getMsg());
cppcheckFile.setInconclusive(Boolean.parseBoolean(error.getInconclusive()));

if ("warning".equals(cppcheckFile.getSeverity())) {
warningSeverityList.add(cppcheckFile);
Expand Down
Expand Up @@ -25,6 +25,7 @@
<td class="pane-header">${%Line}</td>
<td class="pane-header">${%Severity}</td>
<td class="pane-header">${%Type}</td>
<td class="pane-header">${%Inconclusive}</td>
<td class="pane-header">${%Message}</td>
</tr>
</thead>
Expand Down Expand Up @@ -52,6 +53,7 @@
</td>
<td class="pane">${cppcheckFile.severity}</td>
<td class="pane">${cppcheckFile.cppCheckId}</td>
<td class="pane">${cppcheckFile.inconclusive}</td>
<td class="pane">${cppcheckFile.messageHtml}</td>
</tr>
</j:forEach>
Expand Down
Expand Up @@ -16,6 +16,7 @@
.cppcheck .line { white-space: pre-wrap; }
.cppcheck .lineNumber { color: gray; }
.cppcheck .highlighted { line-height: 2.1em; background-color: #FCAF3E; font-weight: bold; }
.cppcheck .header { font-weight: bold; }
</style>

<h1>${%Cppcheck Results}</h1>
Expand All @@ -27,23 +28,27 @@
<j:if test="${file.cppcheckFile.fileName != null}">
<j:if test="${file.sourceIgnored}">
<div>
${%Location:}
<span class="header">${%Location:}&amp;nbsp;</span>
${file.cppcheckFile.fileName}:${file.cppcheckFile.lineNumber}
</div>
</j:if>
<j:if test="${not file.sourceIgnored}">
<div>
${%Location:}
<span class="header">${%Location:}&amp;nbsp;</span>
<a href="../source.${file.cppcheckFile.key}#${file.cppcheckFile.linkLineNumber}">
${file.cppcheckFile.fileName}:${file.cppcheckFile.lineNumber}
</a>
</div>
</j:if>
</j:if>

<div>${%State:} ${file.diffState.text}</div>
<div>${%Severity:} ${file.cppcheckFile.severity}</div>
<div>${%Type:} ${file.cppcheckFile.cppCheckId}</div>
<div><span class="header">${%State:}&amp;nbsp;</span>${file.diffState.text}</div>
<div><span class="header">${%Severity:}&amp;nbsp;</span>${file.cppcheckFile.severity}</div>
<div><span class="header">${%Type:}&amp;nbsp;</span>${file.cppcheckFile.cppCheckId}</div>

<j:if test="${file.cppcheckFile.inconclusive}">
<div><span class="header">${%Inconclusive:}&amp;nbsp;</span>${file.cppcheckFile.inconclusive}</div>
</j:if>

<j:if test="${not file.sourceIgnored}">
<code>
Expand Down

0 comments on commit f1cf428

Please sign in to comment.