category.xsl.codestyle.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <ruleset name="Code Style" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> <description> Rules which enforce a specific coding style. </description> <rule name="UseConcatOnce" language="xsl" since="5.0" 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.xpath.XPathRule" externalInfoUrl="${pmd.website.baseurl}/pmd_rules_xsl_codestyle.html#useconcatonce"> <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)". </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()[contains(substring-after(@select,'concat'),'concat')] ]]> </value> </property> </properties> <example> <![CDATA[ <xsl:variable name="var" select="concat("Welcome",concat("to you ",$name))"/> <xsl:variable name="var" select="concat("Welcome","to you ",$name))"> ]]> </example> </rule> </ruleset>