Skip to content
Permalink
Browse files
[JENKINS-13235] sloccount report formating on build summary
- Build summary now displays a sortable table instead of the list of languages.
- HTML code of summary is now formatted directly in jelly instead of in java code.
- German and Japanese translation strings blindly copied from existing languages_*.properties.
- Old and now unused translation strings removed.
  • Loading branch information
mixalturek committed Jan 25, 2014
1 parent 4e86a27 commit ed93848bfa98f16eee1235fac6022d0f6a89974a

This file was deleted.

@@ -38,28 +38,14 @@ public String getUrlName() {
return URL_NAME;
}

public String getSummary(){

String retVal = "";

if(this.result != null){
retVal = ReportSummary.createReportSummary(this.result.getStatistics(),
this.getPreviousStatistics());
}

return retVal;
}

public String getDetails(){

String retVal = "";

if(this.result != null){
retVal = ReportSummary.createReportSummaryDetails(this.result.getStatistics(),
this.getPreviousStatistics());
}

return retVal;
/**
* Get differences between two report statistics.
*
* @return the differences
*/
public SloccountDiffSummary getDiffSummary() {
return SloccountDiffSummary.getDiffSummary(getPreviousStatistics(),
result.getStatistics());
}

public SloccountResult getResult(){
@@ -34,7 +34,7 @@ private SloccountChartBuilder(){

public static JFreeChart buildChart(SloccountBuildAction action){

String strLines = Messages.Sloccount_ReportSummary_Lines();
String strLines = Messages.Sloccount_Trend_Lines();

JFreeChart chart = ChartFactory.createStackedAreaChart(null, null,
strLines, buildDataset(action), PlotOrientation.VERTICAL,
@@ -100,7 +100,7 @@ private static CategoryDataset buildDataset(SloccountBuildAction lastAction){

public static JFreeChart buildChartDelta(SloccountBuildAction action){

String strLinesDelta = Messages.Sloccount_ReportSummary_Lines()
String strLinesDelta = Messages.Sloccount_Trend_Lines()
+ " " + Messages.Sloccount_Trend_Delta();

JFreeChart chart = ChartFactory.createStackedAreaChart(null, null,
@@ -0,0 +1,98 @@
package hudson.plugins.sloccount;

import hudson.plugins.sloccount.util.StringUtil;

/**
* Base class for diff storage.
*
* @author Michal Turek
*/
public abstract class SloccountDiff implements Comparable<SloccountDiff> {
/** Lines count in the newer report. */
private final int lineCount;

/** Difference of lines count between current and previous report. */
private final int lineCountDelta;

/** Files count in the newer report. */
private final int fileCount;

/** Difference of files count between current and previous report. */
private final int fileCountDelta;

/**
* Constructor.
*
* @param lineCount
* lines count in the newer report
* @param lineCountDelta
* difference of lines count between current and previous
* report
* @param fileCount files
* count in the newer report
* @param fileCountDelta
* difference of files count between current and previous
* report
*/
public SloccountDiff(int lineCount,
int lineCountDelta, int fileCount, int fileCountDelta) {
this.lineCount = lineCount;
this.lineCountDelta = lineCountDelta;
this.fileCount = fileCount;
this.fileCountDelta = fileCountDelta;
}


/**
* Compare two instances using lines count, descendant.
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(SloccountDiff o) {
return o.lineCount - lineCount;
}

public int getLineCount() {
return lineCount;
}

public int getLineCountDelta() {
return lineCountDelta;
}

public int getFileCount() {
return fileCount;
}

public int getFileCountDelta() {
return fileCountDelta;
}

public String getLineCountString() {
return StringUtil.grouping(lineCount);
}

public String getLineCountDeltaString() {
if(lineCountDelta == 0) {
return "";
}

// Negative prefix '-' is added automatically
String result = StringUtil.grouping(lineCountDelta);
return (lineCountDelta > 0) ? "+" + result : result;
}

public String getFileCountString() {
return StringUtil.grouping(fileCount);
}

public String getFileCountDeltaString() {
if(fileCountDelta == 0) {
return "";
}

// Negative prefix '-' is added automatically
String result = StringUtil.grouping(fileCountDelta);
return (fileCountDelta > 0) ? "+" + result : result;
}
}
@@ -0,0 +1,37 @@
package hudson.plugins.sloccount;

/**
* Storage for differences of a language between two reports.
*
* @author Michal Turek
*/
public class SloccountDiffLanguage extends SloccountDiff {
/** Language name. */
private final String name;

/**
* Constructor.
*
* @param name
* language name
* @param lineCount
* lines count in the newer report
* @param lineCountDelta
* difference of lines count between current and previous
* report
* @param fileCount files
* count in the newer report
* @param fileCountDelta
* difference of files count between current and previous
* report
*/
public SloccountDiffLanguage(String name, int lineCount,
int lineCountDelta, int fileCount, int fileCountDelta) {
super(lineCount, lineCountDelta, fileCount, fileCountDelta);
this.name = name;
}

public String getName() {
return name;
}
}

0 comments on commit ed93848

Please sign in to comment.