Prefer IS NOT over NOT ... IS
WarningClean ABAP & Modern SyntaxQuickFix Ready#EC PREF_IS_NOTRemote Enabled
Overview
Prefer IS NOT over NOT ... IS.
ATC Finding Message:
Use IS NOT instead of NOT ... IS
Rationale
Writing NOT before a complete IS expression forces the reader to negate the condition mentally and can be misread in compound logic. IS NOT keeps the subject first and reads in natural order, as in lo_instance IS NOT BOUND. Prefer IS NOT for predicates such as IS BOUND, IS INITIAL, and IS ASSIGNED.
Non-Compliant
abap
IF NOT lt_items IS INITIAL.
process_items( lt_items ).
ENDIF.Compliant
abap
IF lt_items IS NOT INITIAL.
process_items( lt_items ).
ENDIF.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.
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC PREF_IS_NOT
" SAP CI_ prefix format:
... "#EC CI_PREF_IS_NOTRelated Rules
- Prefer IS [NOT] INITIAL over lines( ) or Literal Comparisons —
#EC PREF_IS_INITIAL - Prefer CASE over Multiple IF / ELSEIF on the Same Variable —
#EC PREF_CASE - Prefer COND #( ) Expression over IF/ELSEIF/ELSE —
#EC PREF_COND
Technical Details
- Native ATC Class:
ZCL_SKYLINT_PREF_IS_NOT - Implementation File: zcl_skylint_pref_is_not.clas.abap