Add a per-method length ratchet (max 150 lines, AST-measured) #51
No reviewers
Labels
No labels
accepted
bug
declined
docs
duplicate
enhancement
good first issue
in-progress
needs-info
privacy
security
triage
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
LibreKAT/Ocideck!51
Loading…
Reference in a new issue
No description provided.
Delete branch "chore/method-length-ratchet"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sets up the per-method length ratchet — the per-declaration sibling of the file-size ratchet — and captures today's offenders as a baseline. This PR is the gate only; no methods are refactored yet (those follow one per PR, lowering their baseline entry, exactly like the file splits did).
What it does
tool/check_method_length.dartwalks every.dartfile inlib/and fails when a method, top-level function or constructor body exceeds 150 lines — except the declarations listed inmethodLengthBaseline, whose ceiling is their current length and may only shrink, never grow.analyzerpackage (not a brace heuristic), so closures, multi-line signatures and=>bodies are counted correctly. Keys arepath::Enclosing.name, stable across line edits; local functions count toward their enclosing method._MainLayoutState.build_MarkdownParse._parseBlockMarkdownService.generateSlide_PreviewPanelState.buildSlideThumbnail.buildA new long method, or growth of a baselined one, now fails CI.
Wiring
analyzeradded as a directdev_dependency, pinned to the resolved12.1.0(lockfile updated for CI's--enforce-lockfile).make check-method-lengthtarget, added to themake checkaggregate and as a CI step next tocheck-conventions.docs/CHECKS.md(glance table + detail section).Verification
dart run tool/check_method_length.dart— green (max 150, 28 baselined); fails with the full list when the baseline is emptied, confirming detection works.flutter analyze --fatal-infoson the tool — clean.dart format— clean.What's next (not in this PR)
Split the worst offenders one per PR — starting with the pure-logic monsters that have the strongest test nets (
generateSlide,_parseBlock— round-trip/fuzz/mutation), then thebuild()methods via sub-widget extraction (golden-covered) — lowering each baseline entry as we go.