- Rename AvoidDatabaseMethodCallsInLoopsRule to OperationWithLimitsInLoop.
- Add AvoidDmlStatementsInLoopsRule, AvoidSoqlInLoopsRule, and AvoidSoslInLoopsRule checks into OperationWithLimitsInLoop.
- Deprecate AvoidDmlStatementsInLoopsRule, AvoidSoqlInLoopsRule, and AvoidSoslInLoopsRule in favor of OperationWithLimitsInLoop.
Fixes https://github.com/pmd/pmd/issues/1713, Database statements aren't detected in for loops.
- Added new AvoidDatabaseMethodCallsInLoopsRule that adds a violation if any methods from the System Database class are invoked from within a loop.
- Refactored AvoidDmlStatementsInLoopsRule, AvoidSoqlInLoopsRule, and AvoidSoslInLoopsRule to derive from AbstractAvoidNodeInLoopsRule.
Fixes https://github.com/pmd/pmd/issues/2774, false positives and false
negatives for ApexSharingViolationsRule.
Sharing settings are not inherited by inner classes. Sharing settings
need to be declared on the class that contains the Database method, DML,
SOQL, or SOSL.
The change inverts the direction from which nodes are found and
analyzed. The previous code visited the ASTUserClass and then searched
for descendant nodes that met a certain criteria. It did not visit inner
ASTUserClass nodes because it didn't use rule chains or call the super's
visit moethod for ASTUserClassi.
The new implementation visits all nodes that correspond to Database
method, DML, SOQL, or SOSL nodes and then finds the nearest ASTUserClass
parent node. This ASTUserClass is examined to determine if it has
declared a sharing setting as required.
There is no way to introduce the new API
in a binary compatible change, so LVHandler::getDefaultParserOptions,
LVHandler::getParser and Parser::parse
will remain like this until 7.0 and be
broken.
The columns that are reported by CPD were inconsistent across languages
before. A language like Java (using a JavaCC-based tokenizer) would use
a width of 8 for tabs, whereas a language like C# (using an Antlr-based
tokenizer) would use 1 instead.
This includes unit tests for most languages to ensure a tab character is
counted as 1. The configuration for JavaCC has been adjusted to respect
this as well.
This removes junit-vintage-engine as a test dependency
as well as kotlintest-runner-junit5.
The engines are only needed during test execution, but should
not be available for test compilation.
For this to work, the latest surefire plugin is required.