This repository has been archived by the owner on Apr 6, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-31421] Added a new graph that shows the number of dupl…
…icated lines.
- Loading branch information
Showing
5 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/hudson/plugins/dry/DuplicatedLinesGraph.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package hudson.plugins.dry; | ||
|
||
import java.awt.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.jfree.chart.JFreeChart; | ||
import org.jfree.chart.renderer.category.CategoryItemRenderer; | ||
import org.jfree.data.category.CategoryDataset; | ||
|
||
import hudson.plugins.analysis.core.BuildResult; | ||
import hudson.plugins.analysis.graph.CategoryBuildResultGraph; | ||
import hudson.plugins.analysis.graph.ColorPalette; | ||
import hudson.plugins.analysis.graph.GraphConfiguration; | ||
import hudson.plugins.analysis.util.ToolTipProvider; | ||
|
||
/** | ||
* Builds a graph showing the total number of duplicated lines in a line graph. | ||
* | ||
* @author Ulli Hafner | ||
*/ | ||
public class DuplicatedLinesGraph extends CategoryBuildResultGraph { | ||
@Override | ||
public String getId() { | ||
return "DUPLINES"; | ||
} | ||
|
||
@Override | ||
public String getLabel() { | ||
return Messages.Trend_type_duplicated_lines(); | ||
} | ||
|
||
// FIXME: analysis-core 2.0: use real type | ||
@Override | ||
protected List<Integer> computeSeries(final BuildResult current) { | ||
List<Integer> series = new ArrayList<Integer>(); | ||
if (current instanceof DryResult) { | ||
series.add(((DryResult) current).getTotalNumberOfDuplicatedLines()); | ||
} | ||
return series; | ||
} | ||
|
||
@Override | ||
protected JFreeChart createChart(final CategoryDataset dataSet) { | ||
return createLineGraph(dataSet, false); | ||
} | ||
|
||
@Override | ||
protected Color[] getColors() { | ||
return new Color[] {ColorPalette.BLUE}; | ||
} | ||
|
||
@Override | ||
protected CategoryItemRenderer createRenderer(final GraphConfiguration configuration, final String pluginName, final ToolTipProvider toolTipProvider) { | ||
return createLineRenderer(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters