You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

jdepend.xsl 9.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  2. <xsl:output method="html" indent="yes"/>
  3. <xsl:decimal-format decimal-separator="." grouping-separator="," />
  4. <xsl:template match="JDepend">
  5. <html>
  6. <head>
  7. <title>JDepend Analysis</title>
  8. <style type="text/css">
  9. body {
  10. font:normal 68% verdana,arial,helvetica;
  11. color:#000000;
  12. }
  13. table tr td, tr th {
  14. font-size: 68%;
  15. }
  16. table.details tr th{
  17. font-weight: bold;
  18. text-align:left;
  19. background:#a6caf0;
  20. }
  21. table.details tr td{
  22. background:#eeeee0;
  23. }
  24. p {
  25. line-height:1.5em;
  26. margin-top:0.5em; margin-bottom:1.0em;
  27. margin-left:2em;
  28. margin-right:2em;
  29. }
  30. h1 {
  31. margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
  32. }
  33. h2 {
  34. margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
  35. }
  36. h3 {
  37. margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
  38. }
  39. h4 {
  40. margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
  41. }
  42. h5 {
  43. margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
  44. }
  45. h6 {
  46. margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
  47. }
  48. .Error {
  49. font-weight:bold; color:red;
  50. }
  51. .Failure {
  52. font-weight:bold; color:purple;
  53. }
  54. .Properties {
  55. text-align:right;
  56. }
  57. </style>
  58. </head>
  59. <body>
  60. <!--h1>JDepend Report</h1>
  61. <ul>
  62. <xsl:for-each select="./Packages/Package">
  63. <xsl:sort select="@name"/>
  64. <li><xsl:value-of select="@name"/></li>
  65. </xsl:for-each>
  66. </ul-->
  67. <h1><a name="top">JDepend Analysis</a></h1>
  68. <p align="right">Designed for use with <a href="http://www.clarkware.com/software/JDepend.html">JDepend</a> and <a href="http://jakarta.apache.org">Ant</a>.</p>
  69. <hr size="2" />
  70. <table width="100%"><tr><td>
  71. <a name="NVsummary"><h2>Summary</h2></a>
  72. </td><td align="right">
  73. [<a href="#NVsummary">summary</a>]
  74. [<a href="#NVpackages">packages</a>]
  75. [<a href="#NVcycles">cycles</a>]
  76. [<a href="#NVexplanations">explanations</a>]
  77. </td></tr></table>
  78. <table width="100%" class="details">
  79. <tr>
  80. <th>Package</th>
  81. <th>Total Classes</th>
  82. <th><a href="#EXnumber">Abstract Classes</a></th>
  83. <th><a href="#EXnumber">Concrete Classes</a></th>
  84. <th><a href="#EXafferent">Afferent Couplings</a></th>
  85. <th><a href="#EXefferent">Efferent Couplings</a></th>
  86. <th><a href="#EXabstractness">Abstractness</a></th>
  87. <th><a href="#EXinstability">Instability</a></th>
  88. <th><a href="#EXdistance">Distance</a></th>
  89. </tr>
  90. <xsl:for-each select="./Packages/Package">
  91. <xsl:if test="count(error) = 0">
  92. <tr>
  93. <td align="left">
  94. <a>
  95. <xsl:attribute name="href">#PK<xsl:value-of select="@name"/>
  96. </xsl:attribute>
  97. <xsl:value-of select="@name"/>
  98. </a>
  99. </td>
  100. <td align="right"><xsl:value-of select="Stats/TotalClasses"/></td>
  101. <td align="right"><xsl:value-of select="Stats/AbstractClasses"/></td>
  102. <td align="right"><xsl:value-of select="Stats/ConcreteClasses"/></td>
  103. <td align="right"><xsl:value-of select="Stats/Ca"/></td>
  104. <td align="right"><xsl:value-of select="Stats/Ce"/></td>
  105. <td align="right"><xsl:value-of select="format-number(Stats/A, '0%')"/></td>
  106. <td align="right"><xsl:value-of select="format-number(Stats/I, '0%')"/></td>
  107. <td align="right"><xsl:value-of select="format-number(Stats/D, '0%')"/></td>
  108. </tr>
  109. </xsl:if>
  110. </xsl:for-each>
  111. <xsl:for-each select="./Packages/Package">
  112. <xsl:if test="count(error) &gt; 0">
  113. <tr>
  114. <td align="left">
  115. <xsl:value-of select="@name"/>
  116. </td>
  117. <td align="left" colspan="8"><xsl:value-of select="error"/></td>
  118. </tr>
  119. </xsl:if>
  120. </xsl:for-each>
  121. </table>
  122. <table width="100%"><tr><td>
  123. <a name="NVpackages"><h2>Packages</h2></a>
  124. </td><td align="right">
  125. [<a href="#NVsummary">summary</a>]
  126. [<a href="#NVpackages">packages</a>]
  127. [<a href="#NVcycles">cycles</a>]
  128. [<a href="#NVexplanations">explanations</a>]
  129. </td></tr></table>
  130. <xsl:for-each select="./Packages/Package">
  131. <xsl:if test="count(error) = 0">
  132. <h3><a><xsl:attribute name="name">PK<xsl:value-of select="@name"/></xsl:attribute>
  133. <xsl:value-of select="@name"/></a></h3>
  134. <table width="100%"><tr>
  135. <td><a href="#EXafferent">Afferent Couplings</a>: <xsl:value-of select="Stats/Ca"/></td>
  136. <td><a href="#EXefferent">Efferent Couplings</a>: <xsl:value-of select="Stats/Ce"/></td>
  137. <td><a href="#EXabstractness">Abstractness</a>: <xsl:value-of select="format-number(Stats/A, '0%')"/></td>
  138. <td><a href="#EXinstability">Instability</a>: <xsl:value-of select="format-number(Stats/I, '0%')"/></td>
  139. <td><a href="#EXdistance">Distance</a>: <xsl:value-of select="format-number(Stats/D, '0%')"/></td>
  140. </tr></table>
  141. <table width="100%" class="details">
  142. <tr>
  143. <th>Abstract Classes</th>
  144. <th>Concrete Classes</th>
  145. <th>Used by Packages</th>
  146. <th>Uses Packages</th>
  147. </tr>
  148. <tr>
  149. <td valign="top" width="25%">
  150. <xsl:if test="count(AbstractClasses/Class)=0">
  151. <i>None</i>
  152. </xsl:if>
  153. <xsl:for-each select="AbstractClasses/Class">
  154. <xsl:value-of select="node()"/><br/>
  155. </xsl:for-each>
  156. </td>
  157. <td valign="top" width="25%">
  158. <xsl:if test="count(ConcreteClasses/Class)=0">
  159. <i>None</i>
  160. </xsl:if>
  161. <xsl:for-each select="ConcreteClasses/Class">
  162. <xsl:value-of select="node()"/><br/>
  163. </xsl:for-each>
  164. </td>
  165. <td valign="top" width="25%">
  166. <xsl:if test="count(UsedBy/Package)=0">
  167. <i>None</i>
  168. </xsl:if>
  169. <xsl:for-each select="UsedBy/Package">
  170. <a>
  171. <xsl:attribute name="href">#PK<xsl:value-of select="node()"/></xsl:attribute>
  172. <xsl:value-of select="node()"/>
  173. </a><br/>
  174. </xsl:for-each>
  175. </td>
  176. <td valign="top" width="25%">
  177. <xsl:if test="count(DependsUpon/Package)=0">
  178. <i>None</i>
  179. </xsl:if>
  180. <xsl:for-each select="DependsUpon/Package">
  181. <a>
  182. <xsl:attribute name="href">#PK<xsl:value-of select="node()"/></xsl:attribute>
  183. <xsl:value-of select="node()"/>
  184. </a><br/>
  185. </xsl:for-each>
  186. </td>
  187. </tr>
  188. </table>
  189. </xsl:if>
  190. </xsl:for-each>
  191. <table width="100%"><tr><td>
  192. <a name="NVcycles"><h2>Cycles</h2></a>
  193. </td><td align="right">
  194. [<a href="#NVsummary">summary</a>]
  195. [<a href="#NVpackages">packages</a>]
  196. [<a href="#NVcycles">cycles</a>]
  197. [<a href="#NVexplanations">explanations</a>]
  198. </td></tr></table>
  199. <xsl:if test="count(Cycles/Package) = 0">
  200. <p>There are no cyclic dependancies.</p>
  201. </xsl:if>
  202. <xsl:for-each select="Cycles/Package">
  203. <h3><xsl:value-of select="@Name"/></h3><p>
  204. <xsl:for-each select="Package">
  205. <xsl:value-of select="."/><br/>
  206. </xsl:for-each></p>
  207. </xsl:for-each>
  208. <table width="100%"><tr><td>
  209. <a name="NVexplanations"><h2>Explanations</h2></a>
  210. </td><td align="right">
  211. [<a href="#NVsummary">summary</a>]
  212. [<a href="#NVpackages">packages</a>]
  213. [<a href="#NVcycles">cycles</a>]
  214. [<a href="#NVexplanations">explanations</a>]
  215. </td></tr></table>
  216. <p>The following explanations are for quick reference and are lifted directly from the original <a href="http://www.clarkware.com/software/JDepend.html">JDepend documentation</a>.</p>
  217. <h3><a name="EXnumber">Number of Classes</a></h3>
  218. <p>The number of concrete and abstract classes (and interfaces) in the package is an indicator of the extensibility of the package.</p>
  219. <h3><a name="EXafferent">Afferent Couplings</a></h3>
  220. <p>The number of other packages that depend upon classes within the package is an indicator of the package's responsibility. </p>
  221. <h3><a name="EXefferent">Efferent Couplings</a></h3>
  222. <p>The number of other packages that the classes in the package depend upon is an indicator of the package's independence. </p>
  223. <h3><a name="EXabstractness">Abstractness</a></h3>
  224. <p>The ratio of the number of abstract classes (and interfaces) in the analyzed package to the total number of classes in the analyzed package. </p>
  225. <p>The range for this metric is 0 to 1, with A=0 indicating a completely concrete package and A=1 indicating a completely abstract package. </p>
  226. <h3><a name="EXinstability">Instability</a></h3>
  227. <p>The ratio of efferent coupling (Ce) to total coupling (Ce / (Ce + Ca)). This metric is an indicator of the package's resilience to change. </p>
  228. <p>The range for this metric is 0 to 1, with I=0 indicating a completely stable package and I=1 indicating a completely instable package. </p>
  229. <h3><a name="EXdistance">Distance</a></h3>
  230. <p>The perpendicular distance of a package from the idealized line A + I = 1. This metric is an indicator of the package's balance between abstractness and stability. </p>
  231. <p>A package squarely on the main sequence is optimally balanced with respect to its abstractness and stability. Ideal packages are either completely abstract and stable (x=0, y=1) or completely concrete and instable (x=1, y=0). </p>
  232. <p>The range for this metric is 0 to 1, with D=0 indicating a package that is coincident with the main sequence and D=1 indicating a package that is as far from the main sequence as possible. </p>
  233. </body>
  234. </html>
  235. </xsl:template>
  236. </xsl:stylesheet>