@codemod/abap-file-too-many-lines-miner
Analyze ABAP source files and report files whose physical line count exceeds a configurable maximum, emitting per-file metrics and remediation guidance to reduce maintainability risks from overly large implementation units.
This codemod implements a read-only mining workflow for oversized ABAP implementation units. It does not rewrite source files.
Installation
bash
Usage
The workflow scans candidate files as plain text, normalizes line endings, counts physical lines, and reports any file whose count is strictly greater than maxLines.
ABAP detection rules:
- Canonical
.abapfiles are analyzed by default. - Non-standard filenames are only analyzed when both of these are true:
detectByContentSniffing=trueincludeGlobsis widened to include those files, for example**/*
- Generated files with markers such as
<generated>ordo not editare skipped whenexcludeGenerated=true. - Symlink handling follows the Codemod sandbox path policy.
followSymlinks=trueis accepted for workflow compatibility, but explicit real-path de-duplication is limited by the current JSSG runtime surface.
Reporting behavior:
- One warning finding is emitted per violating file with stable fields:
rule_idfile_pathfile_typephysical_line_countmax_allowed_lineslines_over_limitseverityremediation_guidance
- Metrics are emitted through
codemod:metricsfor per-file counts, per-type totals, repository totals, percentiles, max observed line count, and skipped-file reasons. - Source files are never edited.
Parameters:
maxLines: non-negative integer threshold, default1000includeGlobs: comma or newline separated candidate file globs, default**/*.abapexcludeGlobs: comma or newline separated skip globsexcludeGenerated:trueorfalse, defaulttruefollowSymlinks:trueorfalse, defaultfalsedetectByContentSniffing:trueorfalse, defaultfalsefileTypeInference:trueorfalse, defaulttrue
Examples:
bash
Implementation note:
Codemod does not currently expose a native ABAP parser in JSSG, so this package intentionally performs read-only physical-line analysis over matched file text. The workflow uses a JSSG carrier step and codemod:metrics, but violation detection depends only on normalized file content length, not AST structure.
Development
bash
License
MIT