A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/3202 below:

[apex] ApexCRUDViolationRule fails to report CRUD violation on COUNT() queries · Issue #3202 · pmd/pmd · GitHub

Affects PMD Version:
5.5.4 - 6.33

Rule:

ApexCRUDViolation

Description:

A query that uses a simple COUNT()with no other aggregators and no fields inside the COUNT operations fails to report the CRUD check.

Code Sample demonstrating the issue:

/**
 * @description X
 */
public with sharing class CRUDCheck {
    
    /**
     * @description X
     */
    public static void checkMe() {

        //this gets reported
        Integer x = [SELECT COUNT(Id) FROM Account];

        //this doesnn't get reported
        Integer y = [SELECT COUNT() FROM Account];
    }
}

Expected outcome:

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Apex PMD VSCode Extension


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