[apex] Add test case, refs #776
Note: only solution right now is supressing the rule for the string.
This commit is contained in:
@ -71,6 +71,23 @@ public class Foo {
|
|||||||
void foo() {
|
void foo() {
|
||||||
return '001A0000006Vm9uIAE';
|
return '001A0000006Vm9uIAE';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>[apex] AvoidHardcodingId false positives #776</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
public class Foo {
|
||||||
|
void foo() {
|
||||||
|
// this is a false positive, we can't say, whether it's a salesforce id or not
|
||||||
|
@SuppressWarnings('PMD.AvoidHardcodingId')
|
||||||
|
String IMEI__c = '359040082913024';
|
||||||
|
|
||||||
|
// now the 6th character is non-0, definitive not a salesforce id
|
||||||
|
String IMEI2__c = '359041082913024';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
Reference in New Issue
Block a user