Skip to content

Top-level code

Most complexity tools only score functions and methods, so a 200-line procedural template, a route table or a module-level bootstrap is invisible to them. bonsai-lint scores whatever is left over as a <toplevel> unit, one per file:

84 services/api/templates/report/summary.php:1 <toplevel>
37 services/api/scripts/migrate-tenants.php:1 <toplevel>
A cognitive complexity warning on a PHP template whose logic sits at file scope, reported as toplevel

Files with no top-level logic report nothing, so this costs you no noise. Turn it off with --no-toplevel or toplevel = false.