DEV Community

Mukund Jha
Mukund Jha

Posted on

Scrut: a Python linter that only reviews the code you actually changed

Most static analysis tools run on the whole repository. That sounds reasonable — until you inherit a 400-line function written by someone who left in 2019, and your CI suddenly fails you for it.
Scrut works the other way around. It asks Git which files your next commit touches — git diff HEAD plus untracked files — and analyzes only those. Your report contains findings you can actually act on, before the push, not noise from code you never touched.

  • No daemon. No network. No config files to maintain.
  • 16 AST-based rules (SCR001–SCR016): bare excepts, duplicate branches, long if/elif chains, cyclomatic complexity, nesting depth, large comprehensions — plus the exact metrics: counts come from the AST, not regex.
  • Errors are data, not failures: a file that can't parse becomes one ERROR entry; the rest of the review still runs.
  • Exit codes: 0 clean, 1 findings, 2 tool error — enforcement is opt-in, the review isn't.
  • Fast enough to run in the seconds before git push: a 200-file tree (≈16k functions) reviews in ~25s. pip install scrut cd your-repo scrut What it does not do: gate your commits, connect to your network, or claim metrics it can't compute exactly. The philosophy, in one line: review the Python you changed, not the Python you inherited.
  • GitHub: github.com/mukundzha/scrut
  • PyPI: pypi.org/project/scrut

Top comments (1)

Collapse
 
mukund_zha profile image
Mukund Jha

If anyone have any problems or query or any kind of feedback . you can ask me here?