optimization of UnnecessaryBooleanAssertion, it was the second most expensive XPath rule, now almost twice as fast
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6228 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
1 parent
0b5403dd51
commit
e2d28c80ee
1 file changed
+5
-10
+5
-10
@@ -168,18 +168,13 @@ statements like assertTrue(true) and assertFalse(false). If you just want a tes
|
||||
<![CDATA[
|
||||
//StatementExpression
|
||||
[
|
||||
.//Name[@Image='assertTrue' or @Image='assertFalse']
|
||||
PrimaryExpression/PrimaryPrefix/Name[@Image='assertTrue' or @Image='assertFalse']
|
||||
and
|
||||
PrimaryExpression/PrimarySuffix/Arguments/ArgumentList
|
||||
/Expression/PrimaryExpression/PrimaryPrefix
|
||||
/Literal/BooleanLiteral
|
||||
PrimaryExpression/PrimarySuffix/Arguments/ArgumentList/Expression
|
||||
[PrimaryExpression/PrimaryPrefix/Literal/BooleanLiteral
|
||||
or
|
||||
(
|
||||
.//Name[@Image='assertTrue' or @Image='assertFalse']
|
||||
and
|
||||
PrimaryExpression/PrimarySuffix/Arguments/ArgumentList
|
||||
/Expression/UnaryExpressionNotPlusMinus[@Image='!']
|
||||
/PrimaryExpression/PrimaryPrefix[Literal/BooleanLiteral or Name[count(../../*)=1]])
|
||||
UnaryExpressionNotPlusMinus[@Image='!']
|
||||
/PrimaryExpression/PrimaryPrefix[Literal/BooleanLiteral or Name[count(../../*)=1]]]
|
||||
]
|
||||
[ancestor::ClassOrInterfaceDeclaration[//ClassOrInterfaceType[typeof(@Image, 'junit.framework.TestCase','TestCase')] or //MarkerAnnotation/Name[typeof(@Image, 'org.junit.Test', 'Test')]]]
|
||||
]]>
|
||||
|
||||
Reference in new issue
Block a user