Skip to content

Commit

Permalink
#25 layout
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 27, 2017
1 parent 0a3845a commit a870e5c
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/jpeek/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static Iterable<Directive> metric(final Path file)
final double yellow = (double) xml.nodes("//*[@color='yellow']").size();
final double red = (double) xml.nodes("//*[@color='red']").size();
final double score = 10.0d
* (green + yellow * 0.3d + red * 0.05d)
* (green + yellow * 0.25d + red * 0.05d)
/ (green + yellow + red);
return new Directives()
.add("metric")
Expand Down
87 changes: 83 additions & 4 deletions src/main/resources/org/jpeek/index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ SOFTWARE.
<xsl:text>jpeek</xsl:text>
</title>
<style>
body {
padding: 1em;
}
sup {
top: -0.5em;
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
.under {
font-size: 75%;
display: block;
Expand All @@ -56,7 +66,13 @@ SOFTWARE.
</a>
</p>
<p>
<xsl:text>Overall score is </xsl:text>
<xsl:text>Overall score</xsl:text>
<a href="#1">
<sup>
<xsl:text>1</xsl:text>
</sup>
</a>
<xsl:text> is </xsl:text>
<strong>
<xsl:value-of select="format-number(sum(metric/score) div count(metric),'0.##')"/>
</strong>
Expand All @@ -70,9 +86,19 @@ SOFTWARE.
</th>
<th>
<xsl:text>Classes</xsl:text>
<a href="#2">
<sup>
<xsl:text>2</xsl:text>
</sup>
</a>
</th>
<th>
<xsl:text>Average</xsl:text>
<a href="#3">
<sup>
<xsl:text>3</xsl:text>
</sup>
</a>
</th>
<th>
<xsl:text>Min</xsl:text>
Expand All @@ -82,15 +108,35 @@ SOFTWARE.
</th>
<th>
<xsl:text>Green</xsl:text>
<a href="#4">
<sup>
<xsl:text>4</xsl:text>
</sup>
</a>
</th>
<th>
<xsl:text>Yellow</xsl:text>
<a href="#4">
<sup>
<xsl:text>4</xsl:text>
</sup>
</a>
</th>
<th>
<xsl:text>Red</xsl:text>
<a href="#4">
<sup>
<xsl:text>4</xsl:text>
</sup>
</a>
</th>
<th>
<xsl:text>Score</xsl:text>
<a href="#5">
<sup>
<xsl:text>5</xsl:text>
</sup>
</a>
</th>
<th>
<xsl:text>Options</xsl:text>
Expand All @@ -102,12 +148,45 @@ SOFTWARE.
</tbody>
</table>
<p>
<sup id="1">
<xsl:text>1</xsl:text>
</sup>
<xsl:text>Overall score is an arithmetic average of all metric
scores from the "Score" column in the table. </xsl:text>
<sup id="2">
<xsl:text>2</xsl:text>
</sup>
<xsl:text>"Classes" shows the total amount of classes measured by this metric,
in most cases the number will be the same for all metrics. </xsl:text>
<sup id="3">
<xsl:text>3</xsl:text>
</sup>
<xsl:text>Mathematical average of all measurements, which
doesn't give too much information about the quality of code,
but is visible here for statistical purposes;
we recommend to pay attention to the "Score" column. </xsl:text>
<sup id="4">
<xsl:text>4</xsl:text>
</sup>
<xsl:text>"Green," "Yellow," and "Red" columns show how many
classes received that colors on their measurements;
obviously, red classes are those which have lower quality;
to see them just click the name of the metric in the first
column. </xsl:text>
<sup id="5">
<xsl:text>5</xsl:text>
</sup>
<xsl:text>"Score" is a weighted average of the numbers
from the "Green," "Yellow," and "Red" columns;
the weight of green classes is 1.0, yellow ones get 0.25,
and red ones get 0.05. </xsl:text>
</p>
<p style="color:gray;font-size:75%;">
<xsl:text>This report was generated by </xsl:text>
<a href="http://www.jpeek.org">
<xsl:text>jpeek</xsl:text>
<xsl:text>jpeek </xsl:text>
<xsl:value-of select="@version"/>
</a>
<xsl:text> </xsl:text>
<xsl:value-of select="@version"/>
<xsl:text> on </xsl:text>
<xsl:value-of select="@date"/>
<xsl:text>.</xsl:text>
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/org/jpeek/jpeek.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ SOFTWARE.
<xsl:value-of select="app/@title"/>
</title>
<style type="text/css">
body {
padding: 1em;
}
td {
padding-top: 0.25em;
padding-bottom: 0.25em;
Expand Down

0 comments on commit a870e5c

Please sign in to comment.