Skip to content

[apex] ApexCRUDViolation: false positive with security enforced with line break #2399

@adangel

Description

@adangel

Affects PMD Version: 6.22.0

Rule: ApexCRUDViolation

Description:

When "WITH SECURITY_ENFORCED" is given in a separate line, then it is not seen by the rule. The rule reports a violation then.

Code Sample demonstrating the issue:

public class Foo {
	public Contact foo(String tempID) {
		Contact c = [SELECT Name FROM Contact WHERE Id=: tempID
		WITH SECURITY_ENFORCED];
		return c;
	}
}

Expected outcome:

  • This is a false-positive, since "WITH SECURITY_ENFORCED" is present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions