Skip to content

Add lexical comment counts and shrink-only stats budgets - #122

Merged
cdowin merged 1 commit into
mainfrom
121-stats-ratchets
Oct 12, 2026
Merged

cdowin merged 1 commit into
mainfrom
121-stats-ratchets

Conversation

@cdowin

@cdowin cdowin commented Oct 12, 2026

Copy link
Copy Markdown
Owner

stats mixed comments with blank lines, so consumers could not enforce comment budgets or distinguish ## docs from other prose. Use the existing GDScript tokenizer to report comment-only lines, the doc-comment subset, inline comment lines and standalone docstring lines, alongside code/case counts. Token physical extents keep hashes and escaped quotes inside multiline strings out of comment counts.

Add stats --ratchet FILE against the verb's JSON output. Scope/role roots must match; comment/doc/inline/docstring counters and test-code/case counts must remain under their caps. An existing Git-base baseline may only lower its limits; widening scope, deleting a cap or raising it fails. Malformed baselines are usage errors; zero-file scans remain failures. No consumer-specific paths or duplicate lexer.

Validation: extended existing hand-counted stats fixtures; string/comment distinction, inline/docstring evasion, test-code growth, cap increases and malformed baselines have positive/negative probes. make precommit passes: 301 tests, 167 subtests, one preexisting skip, shell and eight Godot static checks.

Wiki verb reference

godot-devkit stats [dir ...] [--by dir] [--json] [--ratchet FILE]: reports physical/code/comment/doc/inline/docstring/test counts from git-known files. Capture the baseline with stats --json > tools/ci/stats-baseline.json; invoke the same scope/roots with stats --ratchet tools/ci/stats-baseline.json. Lower caps as debt is removed. Production code counts are context; test code/case counts are caps. docs is a subset of comments, not added twice. Existing baseline limits are compared to origin/main, or HEAD in a standalone repository.

Release notes

Minor: add lexical comment/doc/inline/docstring counts and shrink-only stats ratchets.
Upgrade: table consumers must account for the new columns; JSON consumers can read the additive fields. Capture a new JSON baseline once before using --ratchet. Existing stats role configuration remains unchanged.

Closes #121

@cdowin
cdowin merged commit 9728687 into main Oct 12, 2026
4 checks passed
@cdowin
cdowin deleted the 121-stats-ratchets branch October 12, 2026 19:20
@cdowin cdowin mentioned this pull request Oct 12, 2026
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.

stats reports comment and doc-comment lines per bucket

1 participant