What it does
bonsai-lint is one static binary that reads JavaScript, TypeScript, Vue, Python, Java, PHP and Go. It needs no runtime or toolchain for any of those languages and adds nothing to your project. Point it at any project with nothing to configure. A mixed codebase is scored in one pass on one metric. Findings print worst first, with the score, the location and the qualified name of each unit. A clean run prints nothing and exits 0. The default threshold is 15. You can change it for a single run with --over, or for a project in bonsai-lint.toml. The VS Code extension analyses the buffer as you type. In GitHub Actions, --format github annotates each finding on its line of the diff.
Capabilities
- Scores a closure in a loop in a condition at its real depth.
- Scores scripts, templates, route files and module-level setup as well.
- Baselines existing findings so that only regressions fail.
- Checks syntax only, with no autoloader, reflection or module resolution, and bonsai-lint says untrusted source is safe to scan.
- Assembles the report after files are read, parsed and scored in parallel, and bonsai-lint says two runs of the same commit are byte-for-byte identical however many workers ran.
When to use it
- You want to find the code that is hard to read in one project or a whole monorepo.
- You want to adopt a complexity check on a legacy codebase by baselining existing findings and failing only on regressions.
- You want findings annotated on the diff of a pull request in GitHub Actions.