Subversion Repositories bacoAlunos

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2001 es 1
<?xml version="1.0"?>
2
<!--
3
The MIT License (MIT)
4
 
5
Copyright (c) 2017 Yegor Bugayenko
6
 
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
13
 
14
The above copyright notice and this permission notice shall be included
15
in all copies or substantial portions of the Software.
16
 
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
SOFTWARE.
24
-->
25
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="2.0">
26
  <xsl:template match="/metric">
27
    <html lang="en">
28
      <head>
29
        <meta charset="UTF-8"/>
30
        <meta name="description" content="jpeek metric"/>
31
        <meta name="keywords" content="code quality metrics"/>
32
        <meta name="author" content="jpeek.org"/>
33
        <link rel="shortcut icon" href="http://www.jpeek.org/logo.png"/>
34
        <link rel="stylesheet" href="http://cdn.rawgit.com/yegor256/tacit/gh-pages/tacit-css-1.1.1.min.css"/>
35
        <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/sortable/0.8.0/js/sortable.min.js">&#xA0;</script>
36
        <title>
37
          <xsl:value-of select="title"/>
38
        </title>
39
        <style type="text/css">
40
          body {
41
            padding: 1em;
42
          }
43
          td {
44
            padding-top: 0.25em;
45
            padding-bottom: 0.25em;
46
          }
47
          th {
48
            cursor: pointer;
49
          }
50
        </style>
51
      </head>
52
      <body>
53
        <p>
54
          <a href="http://www.jpeek.org">
55
            <img alt="logo" src="http://www.jpeek.org/logo.svg" style="height:60px"/>
56
          </a>
57
        </p>
58
        <p>
59
          <a href="index.html">
60
            <xsl:text>Back to index</xsl:text>
61
          </a>
62
        </p>
63
        <h1>
64
          <xsl:value-of select="title"/>
65
        </h1>
66
        <p>
67
          <xsl:text>"Yellow" zone: </xsl:text>
68
          <code>
69
            <xsl:value-of select="colors"/>
70
          </code>
71
          <xsl:text>.</xsl:text>
72
        </p>
73
        <xsl:apply-templates select="app/@value"/>
74
        <p>
75
          <xsl:text>Packages: </xsl:text>
76
          <xsl:value-of select="count(//package)"/>
77
          <xsl:text>, classes: </xsl:text>
78
          <xsl:value-of select="count(//class)"/>
79
          <xsl:text>, average: </xsl:text>
80
          <xsl:choose>
81
            <xsl:when test="//class">
82
              <xsl:value-of select="format-number(sum(//class/@value) div count(//class), '0.0000')"/>
83
            </xsl:when>
84
            <xsl:otherwise>
85
              <xsl:text>0</xsl:text>
86
            </xsl:otherwise>
87
          </xsl:choose>
88
          <xsl:text>.</xsl:text>
89
        </p>
90
        <p>
91
          <xsl:text>Green: </xsl:text>
92
          <xsl:value-of select="count(//class[@color='green'])"/>
93
          <xsl:text>, yellow: </xsl:text>
94
          <xsl:value-of select="count(//class[@color='yellow'])"/>
95
          <xsl:text>, red: </xsl:text>
96
          <xsl:value-of select="count(//class[@color='red'])"/>
97
          <xsl:text>.</xsl:text>
98
        </p>
99
        <xsl:apply-templates select="app"/>
100
        <p>
101
          <xsl:text>This report was generated by </xsl:text>
102
          <a href="http://www.jpeek.org">
103
            <xsl:text>jpeek</xsl:text>
104
          </a>
105
          <xsl:text> </xsl:text>
106
          <xsl:value-of select="@version"/>
107
          <xsl:text> on </xsl:text>
108
          <xsl:value-of select="@date"/>
109
          <xsl:text>.</xsl:text>
110
        </p>
111
      </body>
112
    </html>
113
  </xsl:template>
114
  <xsl:template match="app/@value">
115
    <p>
116
      <xsl:text>App measurement: </xsl:text>
117
      <code>
118
        <xsl:value-of select="."/>
119
      </code>
120
      <xsl:text>.</xsl:text>
121
    </p>
122
  </xsl:template>
123
  <xsl:template match="app[not(package)]">
124
    <p>
125
      <xsl:text>No measurements for packages.</xsl:text>
126
    </p>
127
  </xsl:template>
128
  <xsl:template match="app[package]">
129
    <table data-sortable="true">
130
      <colgroup>
131
        <col/>
132
        <col/>
133
      </colgroup>
134
      <thead>
135
        <tr>
136
          <th>
137
            <xsl:text>ID</xsl:text>
138
          </th>
139
          <th style="text-align:right">
140
            <xsl:text>Value</xsl:text>
141
          </th>
142
        </tr>
143
      </thead>
144
      <tbody>
145
        <xsl:apply-templates select="package"/>
146
      </tbody>
147
    </table>
148
  </xsl:template>
149
  <xsl:template match="package">
150
    <xsl:if test="@value">
151
      <tr>
152
        <td>
153
          <code>
154
            <strong>
155
              <xsl:value-of select="@id"/>
156
            </strong>
157
          </code>
158
        </td>
159
        <td style="text-align:right">
160
          <xsl:value-of select="@value"/>
161
        </td>
162
      </tr>
163
    </xsl:if>
164
    <xsl:apply-templates select="class"/>
165
  </xsl:template>
166
  <xsl:template match="class">
167
    <tr>
168
      <td>
169
        <code>
170
          <xsl:value-of select="../@id"/>
171
          <xsl:text>.</xsl:text>
172
          <xsl:value-of select="@id"/>
173
        </code>
174
      </td>
175
      <td>
176
        <xsl:if test="@color">
177
          <xsl:attribute name="style">
178
            <xsl:text>text-align:right;</xsl:text>
179
            <xsl:text>color:</xsl:text>
180
            <xsl:choose>
181
              <xsl:when test="@color='red'">
182
                <xsl:text>red</xsl:text>
183
              </xsl:when>
184
              <xsl:when test="@color='green'">
185
                <xsl:text>green</xsl:text>
186
              </xsl:when>
187
              <xsl:when test="@color='yellow'">
188
                <xsl:text>orange</xsl:text>
189
              </xsl:when>
190
              <xsl:otherwise>
191
                <xsl:text>inherit</xsl:text>
192
              </xsl:otherwise>
193
            </xsl:choose>
194
            <xsl:text>;</xsl:text>
195
          </xsl:attribute>
196
        </xsl:if>
197
        <xsl:value-of select="@value"/>
198
      </td>
199
    </tr>
200
  </xsl:template>
201
</xsl:stylesheet>