@codemod/abap-mergeable-nested-if-miner
Rewrite directly nested ABAP IF blocks into a single IF ... AND ... condition to simplify redundant control flow.
Installation
bash
Usage
This codemod targets ABAP source files such as *.abap and *.asprog and rewrites only the safe, mechanical case where an outer IF contains exactly one nested IF and neither block has ELSE or ELSEIF branches.
Before:
abap
After:
abap
Preserve and no-op behavior:
- Leaves blocks unchanged when the outer body contains sibling statements, comments, or blank lines around the nested
IF - Leaves blocks unchanged when either
IFhasELSEorELSEIF - Repeats the rewrite across longer chains of directly nested
IFblocks - Wraps merged condition parts containing
ORorEQUIVin parentheses before combining them withAND
Implementation note:
The bundled Codemod runtime in this package does not expose an ABAP parser, so the transform uses a raw-text rewrite over ABAP files while the workflow routes files through JSSG for execution.
Development
bash
License
MIT