Skip to content

Enforce a 500-line Python file-length ratchet in CI #111

Open

Description

@Prateep07

Summary

Add a dependency-free CI check for the Python file-length policy recommended in docs/investigations/file-length-limit.md.

At the measured develop commit 902c759, 14 Python files exceeded 500 physical lines. Use a ratchet so existing files may shrink without requiring an immediate repository-wide split.

Scope

  • Add a standard-library checker and a checked-in baseline for the current over-limit files.
  • Count physical lines, including blank lines, comments, docstrings, and lines inside strings.
  • Check tracked Python files under
    itrostack/, ests/, examples/, and scripts/.
  • Enforce a 500-line maximum for new files and files at or below 500 lines.
  • For existing offenders, fail if a file grows above its baseline; lower the baseline as the file shrinks.
  • Count embedded templates in Python files. Exclude non-Python assets, vendored dependencies, and generated output.
  • Run the check in the existing GitHub Actions workflow and report path, count, and allowed count.
  • Create or update CONTRIBUTING.md with the definition, scope, exemptions, and baseline update process.

Acceptance criteria

  • The checker has focused coverage for a new file over 500, a file exactly at 500, baseline growth, and a file below its baseline.
  • CI runs the check across its supported Python matrix.
  • The baseline and policy documentation agree with the checker behavior.
  • No source files are split as part of this issue.

Out of scope: changing source behavior, splitting files, or replacing physical lines with logical SLOC.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions