Fix rules

This commit is contained in:
Clément Fournier
2020-03-19 02:52:33 +01:00
parent 0d65c2e6e6
commit 3d429019ee
10 changed files with 51 additions and 14 deletions

View File

@ -1656,8 +1656,8 @@ your API.
<property name="xpath">
<value>
<![CDATA[
//MethodDeclaration[@Public = 'true']/MethodDeclarator/FormalParameters[
count(FormalParameter/Type/ReferenceType/ClassOrInterfaceType[@Image = 'String' and @Array = 'false']) > 3
//MethodDeclaration[@Public=true()]/MethodDeclarator/FormalParameters[
count(FormalParameter/Type/ReferenceType/ClassOrInterfaceType[@Image = 'String' and @Array=false()]) > 3
]
]]>
</value>

View File

@ -2416,7 +2416,7 @@ may indicate problematic behaviour. Empty cases are ignored as these indicate an
+ count(BlockStatement//Statement/ContinueStatement)
+ count(BlockStatement//Statement/ThrowStatement)
+ count(BlockStatement//Statement/IfStatement[@Else= true() and Statement[2][ReturnStatement|ContinueStatement|ThrowStatement]]/Statement[1][ReturnStatement|ContinueStatement|ThrowStatement])
+ count(SwitchLabel[name(following-sibling::node()) = 'SwitchLabel'])
+ count(SwitchLabel[ following-sibling::node()[1][self::SwitchLabel] ])
+ count(SwitchLabel[count(following-sibling::node()) = 0])
< count (SwitchLabel))]
]]>

View File

@ -33,6 +33,8 @@ import net.sourceforge.pmd.lang.rule.XPathRule;
*/
public class XPathMetricFunctionTest {
// TODO 7.0 when removing jaxen these tests need to be updated to use pmd-java:metric
private static final String VIOLATION_MESSAGE = "violation";
@org.junit.Rule