From e11923a5e85959a92ef28ec0de283b416ae4d20e Mon Sep 17 00:00:00 2001
From: Tom Copeland
Recently Dan Sheppard integrated an XPath engine into PMD, so now you can write rules as +
Recently Daniel Sheppard integrated an XPath engine into PMD, so now you can write rules as XPath expressions. For example, the XPath expression for our WhileLoopsMustUseBracesRule looks like this:
Concise, eh? Here's an article with a lot more detail.
->Note that access modifiers are held as attributes, so, for example, +
Note that for XPath rules you'll need to set the
+ class
attribute in the rule definition to net.sourceforge.pmd.rules.XPathRule.
Like this:
+
+
+
Note that access modifiers are held as attributes, so, for example, finds all private fields. You can see the code that determines all the attributes here