Affects PMD Version: 7.13.0
Rule:
Description:
The ApexCRUDViolation rule is failing to detect a violation if SOQL is passed in directly as an input argument instead of being on its own line.
Code Sample demonstrating the issue:
Although this code correctly reports a violation
public with sharing class Dummy { public void test() { Map<ID, Account> mapOfAccounts; List<Account> accountList = [ SELECT Id, Name FROM Account WHERE Id IN :setOfAccountId ]; mapOfAccounts = new Map<ID, Account>(accountList); } }
the following does not:
public with sharing class Dummy {
public void test() {
Map<ID, Account> mapOfAccounts;
mapOfAccounts = new Map<ID, Account>([
SELECT Id, Name
FROM Account
WHERE Id IN :setOfAccountId
]);
}
}
Expected outcome:
PMD should report a violation.
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