[doc] [xml] Adjust externalInfoUrl properties to new site - Part 11

Note: I also took the chance to fix tab damage
This commit is contained in:
Andreas Dangel
2017-08-15 11:20:16 +02:00
parent ceef1819e5
commit 819da2c3b4
3 changed files with 125 additions and 119 deletions

View File

@ -8,30 +8,28 @@
The Basic POM Ruleset contains a collection of good practices regarding Maven's POM files. The Basic POM Ruleset contains a collection of good practices regarding Maven's POM files.
</description> </description>
<rule name="ProjectVersionAsDependencyVersion" <rule name="ProjectVersionAsDependencyVersion"
language="xml" language="pom"
since="5.4" since="5.4"
message="Do not use project's version to express a dependency's version." message="Do not use project's version to express a dependency's version."
class="net.sourceforge.pmd.lang.rule.XPathRule" class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/rules/pom/basic.html#ProjectVersionAsDependencyVersion"> externalInfoUrl="${pmd.website.baseurl}/pmd_rules_pom_basic.html#projectversionasdependencyversion">
<description> <description>
<![CDATA[ Using that expression in dependency declarations seems like a shortcut, but it can go wrong.
Using that expression in dependency declarations seems like a shortcut, but it can go wrong. By far the most common problem is the use of By far the most common problem is the use of ${project.version} in a BOM or parent POM.
${project.version} in a BOM or parent POM. </description>
]]> <priority>3</priority>
</description> <properties>
<priority>3</priority> <property name="xpath">
<properties> <value>
<property name="xpath"> <![CDATA[
<value>
<![CDATA[
//dependency/version/text[contains(@Image,'{project.version}')] //dependency/version/text[contains(@Image,'{project.version}')]
]]> ]]>
</value> </value>
</property> </property>
</properties> </properties>
<example> <example>
<![CDATA[ <![CDATA[
<project...> <project...>
... ...
<dependency> <dependency>
@ -39,33 +37,34 @@ ${project.version} in a BOM or parent POM.
<version>${project.dependency}</version> <version>${project.dependency}</version>
</dependency> </dependency>
</project> </project>
]]> ]]>
</example> </example>
</rule> </rule>
<rule name="InvalidDependencyTypes" <rule name="InvalidDependencyTypes"
language="xml" language="pom"
since="5.4" since="5.4"
message="By default, Maven only recognized the following types: $validTypes." message="By default, Maven only recognized the following types: $validTypes."
class="net.sourceforge.pmd.lang.rule.XPathRule" class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/rules/pom/basic.html#InvalidDependencyTypes"> externalInfoUrl="${pmd.website.baseurl}/pmd_rules_pom_basic.html#invaliddependencytypes">
<description><![CDATA[ <description>
While Maven will not failed if you use an invalid type for a dependency in the dependency management section, it will not also uses the dependency. ]]> While Maven will not failed if you use an invalid type for a dependency in the
</description> dependency management section, it will not also uses the dependency.
<priority>3</priority> </description>
<properties> <priority>3</priority>
<property name="xpath"> <properties>
<value> <property name="xpath">
<value>
<![CDATA[ <![CDATA[
//dependencyManagement/dependency/type/text[not(contains('pom, jar, maven-plugin, ejb, war, ear, rar, par',@Image))] //dependencyManagement/dependency/type/text[not(contains('pom, jar, maven-plugin, ejb, war, ear, rar, par',@Image))]
]]> ]]>
</value> </value>
</property> </property>
<!-- FIXME: property injection seems to be failing with XML.... --> <!-- FIXME: property injection seems to be failing with XML.... -->
<!-- property name="validTypes" value="pom, jar, maven-plugin, ejb, war, ear, rar, par" description="Set of valid types."--> <!-- property name="validTypes" value="pom, jar, maven-plugin, ejb, war, ear, rar, par" description="Set of valid types."-->
</properties> </properties>
<example> <example>
<![CDATA[ <![CDATA[
<project...> <project...>
... ...
<dependencyManagement> <dependencyManagement>
@ -81,7 +80,7 @@ While Maven will not failed if you use an invalid type for a dependency in the d
</dependencyManagement> </dependencyManagement>
</project> </project>
]]> ]]>
</example> </example>
</rule> </rule>
</ruleset> </ruleset>

View File

@ -8,29 +8,30 @@
The Basic XML Ruleset contains a collection of good practices which everyone should follow. The Basic XML Ruleset contains a collection of good practices which everyone should follow.
</description> </description>
<rule name="MistypedCDATASection" <rule name="MistypedCDATASection"
language="xml" language="xml"
since="5.0" since="5.0"
message="Potentialy mistyped CDATA section with extra [ at beginning or ] at the end." message="Potentialy mistyped CDATA section with extra [ at beginning or ] at the end."
class="net.sourceforge.pmd.lang.rule.XPathRule" class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/rules/xml/basic.html#MistypedCDATASection"> externalInfoUrl="${pmd.website.baseurl}/pmd_rules_xml_basic.html#mistypedcdatasection">
<description> <description>
An XML CDATA section begins with a &lt;!CDATA[ marker, which has only one [, and ends with a ]]&gt; marker, which has only two ]. An XML CDATA section begins with a &lt;!CDATA[ marker, which has only one [, and ends with a ]]&gt; marker, which has only two ].
</description> </description>
<priority>3</priority> <priority>3</priority>
<properties> <properties>
<property name="xpath"> <property name="xpath">
<value> <value>
<![CDATA[ <![CDATA[
//cdata-section[starts-with(@Image,'[') or ends-with(@Image,']')] //cdata-section[starts-with(@Image,'[') or ends-with(@Image,']')]
]]> ]]>
</value> </value>
</property> </property>
</properties> </properties>
<example> <example>
<![CDATA[ <![CDATA[
An extra [ looks like &lt;!CDATA[[]]&gt;, and an extra ] looks like &lt;!CDATA[]]]&gt;. An extra [ looks like &lt;!CDATA[[]]&gt;, and an extra ] looks like &lt;!CDATA[]]]&gt;.
]]> ]]>
</example> </example>
</rule> </rule>
</ruleset>
</ruleset>

View File

@ -8,49 +8,57 @@
This ruleset regroups a collection of good practices regarding XPath querying and functions inside an XSL. This ruleset regroups a collection of good practices regarding XPath querying and functions inside an XSL.
</description> </description>
<rule name="UseConcatOnce" <rule name="UseConcatOnce"
language="xsl" language="xsl"
since="5.0" since="5.0"
message="The xpath concat() function accepts as many arguments as required, you may be able to factorize this expression" message="The xpath concat() function accepts as many arguments as required, you may be able to factorize this expression"
class="net.sourceforge.pmd.lang.rule.XPathRule" class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/rules/xsl/xpath.html#UseConcatOnce"> externalInfoUrl="${pmd.website.baseurl}/pmd_rules_xsl_xpath.html#useconcatonce">
<description> <description>
The XPath concat() functions accepts as many arguments as required so you can have "concat($a,'b',$c)" rather than "concat($a,concat('b',$c)". The XPath concat() functions accepts as many arguments as required so you can have
</description> "concat($a,'b',$c)" rather than "concat($a,concat('b',$c)".
<priority>3</priority> </description>
<properties> <priority>3</priority>
<property name="xpath"> <properties>
<value> <property name="xpath">
<![CDATA[
//node()[contains(substring-after(@select,'concat'),'concat')]
]]>
<!-- the use of node() allow to target any node with an select attribute <!-- the use of node() allow to target any node with an select attribute
but also workaround the ambiguity of having the xsl namespace in the but also workaround the ambiguity of having the xsl namespace in the
node name.--> node name.-->
</value> <value>
</property> <![CDATA[
</properties> //node()[contains(substring-after(@select,'concat'),'concat')]
<example> ]]>
<![CDATA[ </value>
<xsl:variable name="var" select="concat("Welcome",concat("to you ",$name))"/> </property>
<xsl:variable name="var" select="concat("Welcome","to you ",$name))"> </properties>
]]> <example>
</example> <![CDATA[
</rule> <xsl:variable name="var" select="concat("Welcome",concat("to you ",$name))"/>
<rule name="AvoidAxisNavigation" <xsl:variable name="var" select="concat("Welcome","to you ",$name))">
language="xsl" ]]>
since="5.0" </example>
message="Axis navigation has the largest impact when writing an XPath query." </rule>
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/rules/xsl/xpath.html#AvoidAxisNavigation"> <rule name="AvoidAxisNavigation"
<description> language="xsl"
Avoid using the 'following' or 'preceeding' axes whenever possible, as these can cut through 100% of the document in the worst case. Also, try to avoid using 'descendant' or 'descendant-self' axes, as if you're at the top of the Document, it necessarily means cutting through 100% of the document. since="5.0"
</description> message="Axis navigation has the largest impact when writing an XPath query."
<priority>3</priority> class="net.sourceforge.pmd.lang.rule.XPathRule"
<properties> externalInfoUrl="${pmd.website.baseurl}/pmd_rules_xsl_xpath.html#avoidaxisnavigation">
<property name="xpath"> <description>
<value> Avoid using the 'following' or 'preceeding' axes whenever possible, as these can cut
<![CDATA[ through 100% of the document in the worst case. Also, try to avoid using 'descendant'
or 'descendant-self' axes, as if you're at the top of the Document, it necessarily means
cutting through 100% of the document.
</description>
<priority>3</priority>
<properties>
<property name="xpath">
<!-- the use of node() allow to target any node with an select attribute
but also workaround the ambiguity of having the xsl namespace in the
node name.-->
<value>
<![CDATA[
//node()[ //node()[
contains(@select,'preceeding::') contains(@select,'preceeding::')
or or
@ -66,17 +74,15 @@ Avoid using the 'following' or 'preceeding' axes whenever possible, as these can
) )
] ]
]]> ]]>
<!-- the use of node() allow to target any node with an select attribute </value>
but also workaround the ambiguity of having the xsl namespace in the </property>
node name.--> <property name="checkSelfDescendantAbreviation" type="Boolean" description="descendant::self abreviation, '//', will also trigger this rule." value="false"/>
</value> </properties>
</property> <example>
<property name="checkSelfDescendantAbreviation" type="Boolean" description="descendant::self abreviation, '//', will also trigger this rule." value="false"/> <![CDATA[
</properties> <xsl:variable name="var" select="//item/descendant::child"/>
<example> ]]>
<![CDATA[ </example>
<xsl:variable name="var" select="//item/descendant::child"/> </rule>
]]>
</example>
</rule>
</ruleset> </ruleset>