Skip to content

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 NameData TypeDefault ValueDescription & Guidance
MAX_NPATHInteger200Maximum 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_NPATH

Technical Details ​

Released under the MIT License.