forked from phoedos/pmd
Consider lower-case, use parameter strictMode
This commit is contained in:
@ -187,7 +187,8 @@ Having the Logging Level specified provides a cleaner log, and improves readabil
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//MethodCallExpression[@FullMethodName='System.debug'][count(*)=2]
|
||||
//MethodCallExpression[lower-case(@FullMethodName)='system.debug'][count(*)=2
|
||||
or ($strictMode=true() and count(*)=3 and lower-case(VariableExpression/@Image)='debug')]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -46,6 +46,33 @@ public class Foo {
|
||||
static void methodATest() {
|
||||
System.debug(LoggingLevel.DEBUG, 'I am a good debug.') // good
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>Any other method of System is allowed - avoiding false positives</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public void bar() {
|
||||
System.otherMethod();
|
||||
System.otherMethod('test');
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>Test case insensitivity</description>
|
||||
<rule-property name="strictMode">true</rule-property>
|
||||
<expected-problems>2</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public void bar() {
|
||||
SyStEm.DeBuG('test');
|
||||
SyStEm.DeBuG(LoGiNgLeVeL.dEbUg, 'test');
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Reference in New Issue
Block a user