Skip to content

Commit

Permalink
Merge pull request #16 from mixalturek/master
Browse files Browse the repository at this point in the history
[JENKINS-22965] Cppcheck plugin shall display the inconclusive messages
  • Loading branch information
mixalturek committed May 18, 2014
2 parents 45459b5 + 689323a commit 0f3a26e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 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,8 @@ private CppcheckReport getReportVersion2(Results results) {
cppcheckFile.setCppCheckId(error.getId());
cppcheckFile.setSeverity(error.getSeverity());
cppcheckFile.setMessage(error.getMsg());
cppcheckFile.setInconclusive((error.getInconclusive() != null)
? error.getInconclusive() : false);

if ("warning".equals(cppcheckFile.getSeverity())) {
warningSeverityList.add(cppcheckFile);
Expand Down
Expand Up @@ -11,6 +11,7 @@
#cppcheckDetails .new { background-color: #FFC8C8; }
#cppcheckDetails .solved { background-color: #C8FFC8; }
#cppcheckDetails .unchanged { }
#cppcheckDetails .inconclusive { color: #555555; }
</style>

<p><a href="source.all?before=5&amp;after=5">
Expand All @@ -25,14 +26,20 @@
<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>
<tbody>
<j:forEach var="elt" items="${cachedContainer}">
<j:set var="cppcheckFile" value="${elt.cppcheckFile}"/>

<j:set var="inconclusiveCss" value=""/>
<j:if test="${cppcheckFile.inconclusive}">
<j:set var="inconclusiveCss" value="inconclusive"/>
</j:if>

<tr class="${elt.diffState.css}">
<tr class="${elt.diffState.css} ${inconclusiveCss}">
<td class="pane">${elt.diffState.text}</td>
<td class="pane">
<j:if test="${elt.isSourceIgnored()}">
Expand All @@ -52,6 +59,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 @@ -10,40 +10,51 @@
.newCppcheck { background-color: #FFC8C8; }
.solvedCppcheck { background-color: #C8FFC8; }
.unchangedCppcheck { }
.inconclusiveCppcheck { color: #555555; }

.cppcheck h2 { margin-top: 0; }
.cppcheck code { display: block; margin: 1em 0em 1em 0em; }
.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>

<j:forEach var="file" items="${it.files}">
<div class="cppcheck ${file.diffState.css}Cppcheck">
<j:set var="inconclusiveCss" value=""/>
<j:if test="${file.cppcheckFile.inconclusive}">
<j:set var="inconclusiveCss" value="inconclusiveCppcheck"/>
</j:if>

<div class="cppcheck ${file.diffState.css}Cppcheck ${inconclusiveCss}">
<h2>${file.cppcheckFile.messageHtml}</h2>

<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
Expand Up @@ -19,6 +19,7 @@
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="severity" type="xs:string" use="required"/>
<xs:attribute name="msg" type="xs:string" use="required"/>
<xs:attribute name="inconclusive" type="xs:boolean" use="optional"/>
</xs:complexType>
</xs:element>

Expand Down

0 comments on commit 0f3a26e

Please sign in to comment.