ruff check: Fast Linting Command Reference
Lint a Python codebase in milliseconds.
ruff check runs a fast Rust-based linter over your code, reporting style and correctness issues. Its speed makes it ideal as an early, cheap CI gate.
Common flags / usage
- ruff check . -- lint the whole tree
- --fix -- auto-fix violations that are safe to fix
- --no-fix -- report only, never modify (CI default)
- --output-format=github -- emit GitHub Actions annotations
- --select / --ignore RULES -- tune the active rule set
Example
shell
- run: pip install ruff
- run: ruff check --output-format=github .In CI
Run ruff check without --fix in CI so it fails on violations instead of silently rewriting code. --output-format=github turns findings into inline PR annotations. Pair with "ruff format --check" to enforce formatting too.
Key takeaways
- ruff check is a very fast linter, good as an early CI gate.
- Use --output-format=github for inline PR annotations.
- Keep --fix out of CI so violations fail rather than auto-rewrite.
Related guides
black --check: Formatting Gate Command ReferenceReference for black --check in CI: verifying formatting without rewriting files, the --diff flag, exit codes…
flake8: Style Linting Command ReferenceReference for flake8 in CI: linting for style and simple errors, selecting and ignoring codes, configuration…
mypy: Static Type Checking Command ReferenceReference for mypy in CI: static type checking, strict mode, caching for speed, handling missing stubs, and a…