Affects PMD Version: 6.37.0
Rule: ApexCRUDViolationRule
Description:
SOQL queries that occur inside a for-loop are not reported (false negative).
Seems to have been introduced by #3367; changing line 220 of ApexCRUDViolationRule.java
to return super.visit(node, data);
fixed the issue.
Code Sample demonstrating the issue:
public with sharing class Beep {
public void boop() {
Account[] accs = [SELECT Id FROM Account]; // This triggers the rule, like it should.
for (Account acc : accs) {
Account[] otherAccs = [SELECT Id FROM Account]; // This does NOT trigger the rule, but it should.
}
}
}
Expected outcome:
A violation should be reported at line 5, but isn't. False negative.
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
CLI
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4