A RetroSearch Logo

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

Search Query:

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

[apex] ApexCRUDViolationRule maintains state across files · Issue #3484 · pmd/pmd · GitHub

Affects PMD Version: 6.37.0

Rule: ApexCRUDViolationRule

Description: When scanning multiple classes with the same name at the same time, false negatives are generated because the rule's state is maintained across files.

Code Sample demonstrating the issue:

./dir1/TestFile1.cls

public class Foo {

	public void doTheThing() {
		if (Account.sObjectType.getDescribe().isAccessible()) {
			Account[] accs = [SELECT Id FROM Account];
		}
	}
}

./dir2/TestFile1.cls

public class Foo {

	public void doTheThing() {
		Account[] accs = [SELECT Id FROM Account];
	}
}

Expected outcome:
If you scan both files separately, then the dir1 version reports no violations of the rule, and the dir2 version reports one violation at line 4.
But if you scan both at the same time, then dir2 reports no violations of the rule.

Running PMD through: 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