Affects PMD Version: 7.13.0
Rule:
ApexCRUDViolation
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
Affects PMD Version: 7.13.0
Rule:
ApexCRUDViolation
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
the following does not:
Expected outcome:
PMD should report a violation.
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
CLI