A Dagger module — written in the .dang module language —
that wraps ruff, the extremely fast Python
linter and formatter.
Ruff ships as a self-contained static binary, so this module extracts it from
the pinned ghcr.io/astral-sh/ruff image (tracked by Dependabot via
images/ruff/Dockerfile) and runs it on an Alpine
base — no Python, pip, uv, or virtualenv required.
| Function | Description |
|---|---|
check |
Lint with ruff check; fails on violations (a @check). |
format-check |
Verify formatting with ruff format --check; fails if unformatted. |
lint |
Return the lint report as text without failing on violations. |
fix |
Apply ruff check --fix and return the modified source directory. |
format |
Run ruff format and return the formatted source directory. |
version |
The version of the bundled ruff binary. |
The constructor takes the project source from the workspace at sourcePath
(default /). args are forwarded to every ruff invocation, and container
overrides the default Alpine + ruff base.
Install the module in your workspace:
dagger install github.com/dagger/ruffCheck for lint and format issues:
dagger checkOr to only run the ruff module:
dagger check ruffTo apply the formatter:
dagger generate
dagger generate ruff