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