Maximum nested activate blocks#
Maximum nested Activate Blocks
Description#
Maximum hierarchical levels of conditional blocks (‘If Block’, ‘When Block’). Parameter: maximum value (e.g.: ‘7’)
The rule parameter is an integer value describing the maximum authorized depth for nested conditional blocks. Default value is 7
.
Rationale#
This enforces compliance with a specific modeling standard by placing an upper bound on the depth of nested conditional blocks.
Verification#
This rule checks all Activate Blocks (If Blocks or When Blocks) throughout the model. It retrieves the Number of nested activate blocks metric associated to each block.
The rule fails if the maximum number of nested activate blocks exceeds the authorized value.
Resolution#
Consider refactoring the offending chain of nested activate blocks to reduce its depth, as detailed in the rule failure message.
Customization#
This rule depends on the Number of nested activate blocks
metric, that must be included in the package. If you customize the ID of this metric, you must
provide it when instantiating the rule, using the parameter metric_id
.
Cf. Customization for an example.