A RetroSearch Logo

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

Search Query:

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

[apex] Mark Database DML statements in For Loop · Issue #1713 · pmd/pmd · GitHub

Affects PMD Version:
6.12

Rule:
AvoidDmlStatementsInLoops

Description:
The current check only warns for the insert word.
But this doesn't warn you when using the Database functions ( see sample 1 ).
This does the exact same thing.

Maybe we can add a rule that check for DML in a method name ( sample 2 ).
But this is something that is personal and can be a false notification.
If we add a rule then they can choose this for their own.

Code Sample demonstrating the issue:
Sample 1

public class Something {
    public void foo() {  
        for (Integer i = 0; i < 151; i++) {
            Account account;
            // ...
            Database.insert(account);
        }
    }
}

Sample 1

public class Something {
    public void foo() {  
        for (Integer i = 0; i < 151; i++) {
            Account account;
            // ...
            account.insertWithContact();
        }
    }
}

Running PMD through: Other


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