|
Download scripts/complexity-policy.md from VoiceOfML/Search: direct link, hf CLI and curl.
- Browser
- Download file 2.37 kB
-
https://huggingface.co/spaces/VoiceOfML/Search/resolve/main/scripts/complexity-policy.md
- Command line
-
hf download hf://spaces/VoiceOfML/Search/scripts/complexity-policy.md
-
curl -L -o complexity-policy.md https://huggingface.co/spaces/VoiceOfML/Search/resolve/main/scripts/complexity-policy.md
2.37 kB
Source complexity budget
The goal is fewer decisions and less dead code, not smaller functions at any cost.
- Measure owned source under
static/andscripts/; Space additionally measuresbackend/andapp.py. Pipeline v1 measures Python inscripts/. Tests, vendored code, types, assets, generated output, Pipeline's standalone JS tool, and Space's native C extension are not measured by v1. They retain their separate checks. Do not move source outside this inventory to avoid the budget. - JavaScript uses the lockfile-pinned ESLint
complexityrule with inline directives disabled. Its function and class execution regions retain the v1 budget. The same run counts outer script/module decisions separately againstquality/js-program-budget.json; nothing is added to or removed from the v1 account. The top-level default is zero new decisions per file. Python uses an AST decision count: branches, loop headers,except, assertions, Boolean short circuits, comprehensions, and non-defaultmatcharms. Module, class, function and lambda bodies are separate regions. These are static counts, not coverage or runtime cost; the two language scores are not directly comparable. - Each file has a default peak of 12. Existing files over 12 have grandfathered caps on both the peak and the sum of points above 12. The repository also caps the total number of decisions (scores minus each region's base point). Moving branches into helpers does not earn a reduction in that total.
- Read hotspots with
python3 -B scripts/check_complexity.py --scope frontend --mode report(usesitein Space andpipelinein Pipeline). Use--mode tightento lower checked-in caps after a reduction; it refuses a regression. Review baseline changes as policy changes: do not regenerate upward withsampleto make a check green. The static gate runsquality/check_complexity_v2.py. An independent reviewer or CI can pass--base-budgetand--base-program-budgetto it from a trusted revision to reject edits that raise existing caps. Tighten a program cap only after reviewing report mode's exact proposal. Do not transfer room between the two budgets. - Tests still decide whether a change is correct. Keep site contracts, readbacks, sanitization, and rollback boundaries intact. Prove a compatibility branch has no current consumer before removing it.