maven-plugin-pmd-build: Output also deprecated rules that are no references.

This commit is contained in:
Andreas Dangel
2015-03-14 14:40:00 +01:00
parent 03e35f5596
commit 70070295b7
4 changed files with 22 additions and 3 deletions

View File

@ -34,7 +34,7 @@
</document>
</xsl:template>
<xsl:template match="rule[@name][not(@deprecated) or @deprecated='false']">
<xsl:template match="rule[@name][not(@ref)]">
<xsl:variable name="rulename" select="@name" />
<xsl:variable name="classname" select="@class" />
@ -50,6 +50,12 @@
<xsl:value-of select="$Priority" />: <xsl:value-of select="priority" />
</p>
<p>
<xsl:choose>
<xsl:when test="@deprecated='true'">
<xsl:attribute name="style">border-radius: 3px; border-style: solid; border-width: 1px 1px 1px 5px; margin: 20px 0px; padding: 20px; border-color: #eee; border-left-color: #ce4844</xsl:attribute>
<strong>Deprecated</strong><br/>
</xsl:when>
</xsl:choose>
<xsl:value-of select="description" />
</p>
<xsl:choose>

View File

@ -53,12 +53,18 @@
<xsl:for-each select="./rule">
<li>
<xsl:choose>
<xsl:when test="@name and (not(@deprecated) or @deprecated='false')">
<xsl:when test="@name and not(@ref)">
<a>
<xsl:attribute name="href"><xsl:value-of
select="substring(@externalInfoUrl,$urlPrefixLength + 1)" /></xsl:attribute>
<xsl:value-of select="@name" />
</a>: <xsl:value-of select="description" />
</a>:
<xsl:choose>
<xsl:when test="@deprecated='true'">
Deprecated rule.
</xsl:when>
</xsl:choose>
<xsl:value-of select="description" />
</xsl:when>
<xsl:when test="@name and @deprecated='true' and @ref and not(contains(@ref, '.xml'))">
<a>

View File

@ -42,6 +42,8 @@ public class RuleSetToDocsTest extends TestBase {
assertTrue(codeSizeRuleset.contains("<a href=\"#NPathComplexity\">NPathComplexity</a>"));
assertTrue(codeSizeRuleset.contains("JumbledIncrementer"));
assertTrue(codeSizeRuleset.contains("<a href=\"basic.html#JumbledIncrementer\">JumbledIncrementer</a>"));
assertTrue(codeSizeRuleset.contains("SoonToBeRemoved"));
}
@Test

View File

@ -58,4 +58,9 @@ void bar() { // this is something more complex than it needs to be,
<rule deprecated="true" name="OldNameOfNPathComplexity" ref="NPathComplexity"/>
<rule deprecated="true" ref="rulesets/java/basic.xml/JumbledIncrementer" />
<rule deprecated="true" name="SoonToBeRemoved" language="java" since="1.0" message="Foo">
<description>This rule will be removed with the next version.</description>
<priority>3</priority>
</rule>
</ruleset>