Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
1 parent
4e86a27
commit ed93848
Showing
12 changed files
with
335 additions
and
171 deletions.
There are no files selected for viewing
130 changes: 0 additions & 130 deletions
130
src/main/java/hudson/plugins/sloccount/ReportSummary.java
This file was deleted.
Oops, something went wrong.
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
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,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; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/hudson/plugins/sloccount/SloccountDiffLanguage.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,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; | ||
} | ||
} |
Oops, something went wrong.