codemod/abap-separate-statements-per-line
Rewrite ABAP source files so each period-terminated statement is placed on its own physical line.
# @codemod/abap-separate-statements-per-line
Rewrite ABAP source files so each period-terminated statement is placed on its own physical line.
## Installation
```bash
# Run from the registry
codemod run @codemod/abap-separate-statements-per-line --target path/to/abap-project
# Or run locally
npx codemod workflow run -w workflow.yaml --target path/to/abap-project
```
## Usage
This codemod targets `**/*.abap` files and rewrites lines like:
```abap
DATA foo TYPE i. DATA bar TYPE i.
```
into:
```abap
DATA foo TYPE i.
DATA bar TYPE i.
```
Behavior:
- Splits only on statement-ending periods that occur outside string literals and comments.
- Preserves indentation for every extracted statement.
- Leaves single-statement lines unchanged.
- Preserves decimals like `1.5`, string content like `'A.B'`, templates like `|v1.2|`, and trailing `"` comments.
Implementation note:
ABAP is not currently a parser-backed JSSG language, so this package uses a line-aware text rewrite rather than AST edits.
## Development
```bash
# Test the transformation
pnpm test
# Type-check the scripts
pnpm run check-types
# Validate the workflow
npx codemod workflow validate -w workflow.yaml
```
## License
MIT