You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
PMD is reporting an error when checking if it possible to update it or not and the example in documentation does not resolve it. If you change that line by Case.SObjectType.getDescribe().isUpdateable() which is almost the same PMD does not report the issue.
According to the docs it would seem that we currently asume the only way to obtain the DescribeSObjectResult from which to collect the CRUD checks from is from the getDescribe() method; however, the sObjectType static member variable also returns it:
Obtaining sObject Describe Results Using Tokens
To access the describe result for an sObject, use one of the following methods:
Call the getDescribe method on an sObject token.
Use the Schema sObjectType static variable with the name of the sObject. For example, Schema.sObjectType.Lead.
Schema.DescribeSObjectResult is the data type for an sObject describe result.
The following example uses the getDescribe method on an sObject token: Schema.DescribeSObjectResult dsr = Account.sObjectType.getDescribe();
The following example uses the Schema sObjectType static member variable: Schema.DescribeSObjectResult dsr = Schema.SObjectType.Account;
adangel
changed the title
[Apex] ApexCRUDViolation false positive reported
[apex] ApexCRUDViolation false positive reported
Oct 7, 2021
Affects PMD Version: 6.38
Rule: ApexCRUDViolation
Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_apex_security.html#apexcrudviolation
Description:
PMD is reporting an error when checking if it possible to update it or not and the example in documentation does not resolve it. If you change that line by Case.SObjectType.getDescribe().isUpdateable() which is almost the same PMD does not report the issue.
Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation at line 42, but that's wrong. That's a false positive.
Running PMD through: [Other] IntelliJ using Illuminated Cloud
The text was updated successfully, but these errors were encountered: