Ccodemod

codemod/abap-no-commented-out-code

Remove full-line ABAP comments that contain commented-out source statements from .abap files.

transformationabapcommentscleanup
Public
0 executions

Run locally

npx codemod @codemod/abap-no-commented-out-code

@codemod/abap-no-commented-out-code

Remove full-line ABAP comments that look like commented-out source statements from *.abap files.

What It Rewrites

  • Full-line * comments whose bodies look like ABAP statements such as assignments, control-flow lines, declarations, and method or PERFORM calls
  • Full-line " comments with the same code-like patterns
  • Contiguous comment-only blocks when every non-separator comment line in the block looks like ABAP code
  • Empty or separator comment lines inside a removable commented-out code block

Preserved Cases

  • Prose comments such as release notes or explanations
  • Trailing inline comments on active ABAP statements
  • Mixed comment blocks that contain both prose and code-like lines
  • Non-ABAP files

Heuristics

The codemod is intentionally conservative. It only removes comment blocks when every meaningful line in the block matches one of these code-like shapes:

  • Standalone block terminators such as ENDIF. or ENDLOOP.
  • Assignments such as lv_total = lines( lt_items ).
  • Method-style calls such as lo_service->run( ).
  • Control statements such as IF sy-subrc = 0.
  • Common ABAP statements such as CLEAR lv_total. or SELECT ... .

If a comment block mixes prose with code-like lines, the whole block stays unchanged.

Usage

bash

Development

bash

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.