Skip to content

Commit

Permalink
Merge pull request #26 from mixalturek/master
Browse files Browse the repository at this point in the history
[JENKINS-23247] Display trends graph last 10/20 sucessful/fail builds in...
  • Loading branch information
mixalturek committed Sep 27, 2014
2 parents 1e72202 + 090d7ac commit b3ce469
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 8 deletions.
Expand Up @@ -192,6 +192,7 @@ private Object readResolve() {
org.jenkinsci.plugins.cppcheck.config.CppcheckConfigGraph configGraph = new org.jenkinsci.plugins.cppcheck.config.CppcheckConfigGraph(
cppcheckConfig.getConfigGraph().getXSize(),
cppcheckConfig.getConfigGraph().getYSize(),
0,
cppcheckConfig.getConfigGraph().isDiplayAllError(),
cppcheckConfig.getConfigGraph().isDisplaySeverityError(),
cppcheckConfig.getConfigGraph().isDisplaySeverityPossibleError(),
Expand Down
Expand Up @@ -68,6 +68,7 @@ private Object readResolve() {
org.jenkinsci.plugins.cppcheck.config.CppcheckConfigGraph configGraph = new org.jenkinsci.plugins.cppcheck.config.CppcheckConfigGraph(
cppcheckConfig.getConfigGraph().getXSize(),
cppcheckConfig.getConfigGraph().getYSize(),
0,
cppcheckConfig.getConfigGraph().isDiplayAllError(),
cppcheckConfig.getConfigGraph().isDisplaySeverityError(),
cppcheckConfig.getConfigGraph().isDisplaySeverityPossibleError(),
Expand Down
Expand Up @@ -127,7 +127,13 @@ private DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> getDataSetBuilder
AbstractBuild<?,?> lastBuild = getLastFinishedBuild();
CppcheckBuildAction lastAction = lastBuild.getAction(CppcheckBuildAction.class);

for (CppcheckBuildAction a = lastAction; a != null; a = a.getPreviousResult()) {
int numBuilds = 0;

// numBuildsInGraph <= 1 means unlimited
for (CppcheckBuildAction a = lastAction;
a != null && (configGraph.getNumBuildsInGraph() <= 1 || numBuilds < configGraph.getNumBuildsInGraph());
a = a.getPreviousResult(), ++numBuilds) {

ChartUtil.NumberOnlyBuildLabel label = new ChartUtil.NumberOnlyBuildLabel(a.getOwner());
CppcheckStatistics statistics = a.getResult().getStatistics();

Expand Down
Expand Up @@ -52,6 +52,7 @@ public CppcheckPublisher(String pattern,
boolean severityNoCategory,
boolean severityPortability,
int xSize, int ySize,
int numBuildsInGraph,
boolean displayAllErrors,
boolean displayErrorSeverity,
boolean displayWarningSeverity,
Expand All @@ -77,7 +78,7 @@ public CppcheckPublisher(String pattern,
severityPortability);
cppcheckConfig.setConfigSeverityEvaluation(configSeverityEvaluation);
CppcheckConfigGraph configGraph = new CppcheckConfigGraph(
xSize, ySize,
xSize, ySize, numBuildsInGraph,
displayAllErrors,
displayErrorSeverity,
displayWarningSeverity,
Expand Down
Expand Up @@ -14,6 +14,7 @@ public class CppcheckConfigGraph implements Serializable {

private int xSize = DEFAULT_CHART_WIDTH;
private int ySize = DEFAULT_CHART_HEIGHT;
private int numBuildsInGraph = 0; // numBuildsInGraph <= 1 means unlimited
private boolean displayAllErrors = true;
private boolean displayErrorSeverity;
private boolean displayWarningSeverity;
Expand All @@ -26,13 +27,15 @@ public class CppcheckConfigGraph implements Serializable {
public CppcheckConfigGraph() {
}

public CppcheckConfigGraph(int xSize, int ySize, boolean displayAllErrors,
public CppcheckConfigGraph(int xSize, int ySize, int numBuildsInGraph,
boolean displayAllErrors,
boolean displayErrorSeverity, boolean displayWarningSeverity,
boolean displayStyleSeverity, boolean displayPerformanceSeverity,
boolean displayInformationSeverity, boolean displayNoCategorySeverity,
boolean displayPortabilitySeverity) {
this.xSize = xSize;
this.ySize = ySize;
this.numBuildsInGraph = numBuildsInGraph;
this.displayAllErrors = displayAllErrors;
this.displayErrorSeverity = displayErrorSeverity;
this.displayWarningSeverity = displayWarningSeverity;
Expand All @@ -51,6 +54,10 @@ public int getYSize() {
return ySize;
}

public int getNumBuildsInGraph() {
return numBuildsInGraph;
}

public boolean isDisplayAllErrors() {
return displayAllErrors;
}
Expand Down
Expand Up @@ -11,12 +11,12 @@

<f:entry>
<f:checkbox name="cppcheck.ignoreBlankFiles" checked="${config.ignoreBlankFiles}"/>
<label>${%Ignore blank files}</label>
<label class="attach-previous">${%Ignore blank files}</label>
</f:entry>

<f:entry>
<f:checkbox name="cppcheck.allowNoReport" checked="${config.allowNoReport}"/>
<label>${%Do not fail the build if the Cppcheck report is not found}</label>
<label class="attach-previous">${%Do not fail the build if the Cppcheck report is not found}</label>
</f:entry>

<f:advanced>
Expand Down
13 changes: 10 additions & 3 deletions src/main/resources/util/thresholds.jelly
Expand Up @@ -142,12 +142,19 @@
id="configGraph.xSize"/>
</td>
<td>
<label for="configGraph.xSize">${%Chart Height}</label>
<label for="configGraph.ySize">${%Chart Height}</label>
<f:textbox name="${id}.config.configGraph.ySize"
value="${config.configGraph.ySize}"
id="configGraph.ySize"/>
</td>
<td colspan="2">
<td>
<label for="configGraph.numBuildsInGraph"
title="${%description.numBuildsInGraph}">${%Builds in graph}</label>
<f:textbox name="${id}.config.configGraph.numBuildsInGraph"
value="${config.configGraph.numBuildsInGraph}"
id="configGraph.numBuildsInGraph"/>
</td>
<td colspan="1">
<st:nbsp/>
</td>
</tr>
Expand All @@ -173,7 +180,7 @@
<td>
<f:checkbox name="${id}.config.configGraph.displayWarningSeverity"
checked="${config.configGraph.displayWarningSeverity}"
id="configGrah.displayWarningSeverity"/>
id="configGraph.displayWarningSeverity"/>
<st:nbsp/>
<label for="configGraph.displayWarningSeverity">${%Display warnings}</label>
<st:nbsp/>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/util/thresholds.properties
Expand Up @@ -16,3 +16,5 @@ description.unhealthy=Report health as 0% when the number of issues is greater t
severity.evaluation=Severity evaluation

graph.configuration=Graph configuration

description.numBuildsInGraph=Maximal number of the latest builds that are displayed in the trend graph. Use 1 or less for unlimited.

0 comments on commit b3ce469

Please sign in to comment.