Skip to content

ci: enforce 500-line Python file-length ratchet (#111) - #126

Open
AadarshM07 wants to merge 1 commit into
nitrocloudofficial:developfrom
AadarshM07:issue#111
Open

AadarshM07 wants to merge 1 commit into
nitrocloudofficial:developfrom
AadarshM07:issue#111

Conversation

@AadarshM07

Copy link
Copy Markdown
Collaborator

Summary

Closes #111

Implements the dependency-free CI file-length policy check and ratchet mechanism recommended in docs/investigations/file-length-limit.md:

  • Enforces a 500 physical-line limit on tracked Python files in nitrostack/, tests/, examples/, and scripts/.
  • Establishes a checked-in baseline (.file_length_baseline.json) for the 14 pre-existing legacy files that exceed 500 lines.
  • Implements a one-way ratchet: existing files cannot grow past their baseline, and --update-baseline lowers the baseline as files shrink or graduates them when they reach ≤ 500 lines.
  • Adds the check to .github/workflows/test.yml across the Python 3.10, 3.11, and 3.12 matrix.
  • Documents the policy, definition, scope, exemptions, and ratchet workflow in CONTRIBUTING.md.

Changes

  • scripts/check_file_lengths.py: Standard-library checker script with ratchet and baseline update logic.
  • .file_length_baseline.json: Baseline manifest containing recorded line counts for the 14 legacy over-limit files.
  • tests/test_file_length_check.py: Focused test suite covering 500-line boundary, new files > 500, baseline growth, ratchet lowering, and baseline graduation.
  • .github/workflows/test.yml: Added step to execute python scripts/check_file_lengths.py before pytest.
  • CONTRIBUTING.md: Developer guide explaining the policy, counting rules, and baseline update commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant