Limit NPath Complexity per Method
WarningMetrics & Complexity Limits#EC MAX_NPATHRemote Enabled
Overview
Limit NPath complexity per procedure.
ATC Finding Message:
Procedure NPath complexity exceeds threshold
Rationale
NPath complexity measures the total number of acyclic execution paths through a procedure. Unlike cyclomatic complexity which grows linearly with decision points, NPath complexity grows multiplicatively across sequential and nested control structures (IF, CASE, loops, compound boolean expressions). High NPath complexity makes exhaustive testing impossible. Keep NPath under the threshold by breaking large procedures into cohesive helper methods.
Non-Compliant
abap
METHOD process.
IF cond_a = abap_true.
...
ENDIF.
IF cond_b = abap_true.
...
ENDIF.
IF cond_c = abap_true.
...
ENDIF.
ENDMETHOD.Compliant
abap
METHOD process.
handle_condition_a( ).
handle_condition_b( ).
handle_condition_c( ).
ENDMETHOD.Configuration & Thresholds
This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:
| Parameter Name | Data Type | Default Value | Description & Guidance |
|---|---|---|---|
MAX_NPATH | Integer | 200 | Maximum allowed NPath execution paths per procedure (default: 200) |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC MAX_NPATH
" SAP CI_ prefix format:
... "#EC CI_MAX_NPATHRelated Rules
- Limit Cyclomatic Complexity (McCabe Complexity Metric) —
#EC MAX_CYCLO_COMP - Limit Cognitive Complexity per Method —
#EC MAX_COGNITIVE - Limit Control Flow Nesting Depth (Guard Clause Enforcement) —
#EC MAX_NESTING - Limit Method and Constructor Statement Length —
#EC MAX_METHOD_LEN
Technical Details
- Native ATC Class:
ZCL_SKYLINT_MAX_NPATH - Implementation File: zcl_skylint_max_npath.clas.abap