Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/mojzis/madoqua. TODO: one-line description of madoqua mojzis.github.io/madoqua
Something went wrong. Try again.
Files
- Rust 99%
- Makefile 1%
README.md
# madoqua
A pre-commit hook for Python repos: fix what you staged, re-stage it, run the
checks in parallel, say one line. Small, fast, silent until there's something
to say.
```
pre-commit ok (3 files, 1.8s, slowest: ty check 1.6s): ruff fix, ruff format applied & staged; ruff check, ty check passed
```
That is the entire output of a clean commit. A commit with a problem prints
only the tool that had one.
[Documentation](https://mojzis.github.io/madoqua) ·
[Configuration](https://mojzis.github.io/madoqua/configuration.html) ·
[Commands](https://mojzis.github.io/madoqua/commands/overview.html)
## Install
```sh
uv tool install madoqua
# or
pipx install madoqua
# or, per project
uv add --dev madoqua
```
## Use
```sh
madoqua install # write hooks/pre-commit and point git at it
madoqua run # what the hook does; also what a bare `madoqua` does
madoqua stats # what the hook has been costing you
```
madoqua needs a virtualenv at `<repo_root>/.venv` with the tools it calls
installed — it refuses to run a `ruff` from outside it, because a version that
disagrees with CI produces failures that look like your code's fault. With the
defaults that means `uv venv && uv sync`.
## Configure
Zero configuration gets you `ruff check --fix`, `ruff format`, `ruff check` and
`ty check`. To change that, add `[tool.madoqua]` to `pyproject.toml`:
```toml
[tool.madoqua]
fix = ["ruff check --fix --quiet", "ruff format --quiet"]
check = [
"ruff check --quiet",
{ name = "ty", cmd = "ty check", timeout_s = 120, max_output_lines = 200 },
]
```
`hooks.local.toml` in the repo's git directory — `.git/hooks.local.toml` in an
ordinary clone — is a personal, uncommitted overlay on the same schema:
`check`/`fix` replace a list, `extend_check`/`extend_fix` append to it, scalars
win. `MADOQUA_SKIP="ty,ruff check"` drops checks by name for one run.
See [Configuration](https://mojzis.github.io/madoqua/configuration.html).
## Exit codes
| Code | Meaning |
|---|---|
| `0` | Clean — the commit may proceed |
| `1` | A check fail…