Statement Indentation Must Match Block Nesting
WarningClean ABAP & Modern SyntaxQuickFix Ready#EC NO_BAD_INDENTRemote Enabled
Overview
Bad Statement Indentation.
ATC Finding Message:
Statement indentation does not match block nesting
Rationale
Indentation is the fastest visual cue for block nesting, so inconsistent indentation misleads readers about which statements belong together. It also creates noisy diffs when a formatter runs. Indent each block level consistently.
Non-Compliant
abap
METHOD calculate.
DATA lv_total TYPE i.
LOOP AT lt_items INTO ls_item.
lv_total = lv_total + ls_item-amount.
ENDLOOP.
ENDMETHOD.Compliant
abap
METHOD calculate.
DATA lv_total TYPE i.
LOOP AT lt_items INTO ls_item.
lv_total = lv_total + ls_item-amount.
ENDLOOP.
ENDMETHOD.Automated QuickFix
This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):
- Position the cursor on the flagged statement.
- Press Ctrl + 1 (Quick Assist).
- Select the automated refactoring to apply the clean syntax immediately.
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 |
|---|---|---|---|
INDENT_STEP | Integer | 2 | Standard indentation step per nested block level (default: 2 spaces) |
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_BAD_INDENT
" SAP CI_ prefix format:
... "#EC CI_NO_BAD_INDENTRelated Rules
- Limit Control Flow Nesting Depth (Guard Clause Enforcement) —
#EC MAX_NESTING - Limit Method and Constructor Statement Length —
#EC MAX_METHOD_LEN - Limit Source Code Line Length (Avoid Horizontal Scrolling) —
#EC MAX_LINE_LEN
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_BAD_INDENT - Implementation File: zcl_skylint_no_bad_indent.clas.abap