Regarding pmd:fileName() function #4629
-
Hi @oowekyala, As you suggested in the below ticket i updated my script with xpath expression but the below expression is only identifying the files with .cls extension but I also have .xml files in the same directory which it is not flagging. Is there any limitation of this function where it only looks for .cls? Thanks.
Ticket ref: #4601 |
Beta Was this translation helpful? Give feedback.
Answered by
oowekyala
Jul 7, 2023
Replies: 1 comment 3 replies
-
You need to set the language of your rule to <rule name="MyXPathRule"
language="xml"
message="A message"
class="net.sourceforge.pmd.lang.xml.rule.DomXPathRule">
<properties>
<property name="xpath">
<value><![CDATA[
/*[starts-with(pmd:fileName(), 'SA_')]
]]></value>
</property>
</properties>
</rule> |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
allurisriakhil
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to set the language of your rule to
xml
so that it executes on XML files. Preferably use the rule classDomXPathRule
too: