Explanation

This rule analyses all expressions and determines whether they are complex by the following criteria:

  • more than five AND or OR logical operators
  • more than two nested COLLECT statements

We estimate that resolving this issue will on average take 30 minutes.

Parameters

This rule can be configured using the following parameters:

maxLogicalOperations

The maximum acceptable number of AND or OR logical operations for an expression to not be considered complex.
Default Value: 5

maxNestedCollects

The maximum acceptable number of nested COLLECT statements for an expression to not be considered complex.
Default Value: 2

Possible improvement

Try to split up some part of the expression, either as reusable expression, using an intermediate attribute or using a local variable. If this is not possible make sure to put comments in the expression explaining what is happening.

Example

This expression is considered too complex (and unnecessarily complex as well, because the desired result could simply be achieved by SUM( COLLECT Person.PersonalPremium FROM ALL Person )! )

It results in this code smell:


  • No labels