ruff
Extremely fast Python linter and formatter — Rust-based tool that replaces flake8, pylint, isort, pyupgrade, and black in a single tool. ruff features: 800+ built-in lint rules (flake8, pylint, pycodestyle, pydocstyle, pyflakes, isort equivalents), --fix for auto-fixing many violations, format sub-command (black-compatible formatter), select/ignore for rule configuration, per-file-ignores, extend-select for enabling rule categories, ruff check --watch for continuous linting, Python 3.8-3.13 support, pyproject.toml configuration, line-length, target-version, and VS Code extension. 10-100x faster than flake8+isort+black.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Code quality tool that runs locally. --fix modifies files — backup before bulk fixing unfamiliar codebases. S rules (flake8-bandit) detect security issues: hardcoded passwords, SQL injection patterns, use of eval(). Enable S rules: select = ['S'] for security-focused linting.
⚡ Reliability
Best When
All Python linting and formatting — ruff replaces flake8, isort, and black with one tool at 10-100x the speed, making it the modern standard for Python code quality.
Avoid When
Type checking (use mypy/pyright), non-Python files, or when specific flake8 plugins with no ruff equivalent are required.
Use Cases
- • Agent lint files — ruff check src/; ruff check src/ --fix — run ruff; agent lints Python files; --fix auto-corrects fixable violations; exit code 0 for no violations, 1 for violations; output: file:line:col rule-code message
- • Agent format code — ruff format src/; ruff format src/ --check — format; agent formats Python files like black; --check mode exits non-zero if files need formatting (CI); ruff format is black-compatible — same style decisions
- • Agent check specific rules — ruff check --select E,F,I src/ — select; agent enables only E (pycodestyle errors), F (pyflakes), I (isort); ruff check --ignore E501 for line length; select ALL for all rules; select specific: --select RUF for ruff-specific rules
- • Agent CI integration — ruff check . --output-format=github — GitHub Actions format; agent outputs annotations for GitHub PR review; --output-format json for machine-readable; exit code used for CI pass/fail; combine: ruff check . && ruff format . --check
- • Agent pyproject.toml config — [tool.ruff]; line-length = 88; target-version = 'py311'; select = ['E', 'F', 'I', 'UP']; ignore = ['E501']; [tool.ruff.per-file-ignores]; 'tests/*.py' = ['S101'] — config; agent configures ruff in pyproject.toml; UP = pyupgrade rules for modern Python; S101 = assert allowed in tests
Not For
- • Type checking — ruff does not do type inference; for type checking use mypy or pyright
- • Complex custom rules — ruff supports some custom rules but not as extensible as flake8 plugins; for custom AST analysis write custom plugin
- • Non-Python files — ruff is Python-only; for multi-language linting use pre-commit with multiple tools
Interface
Authentication
No auth — local code quality tool.
Pricing
ruff is MIT licensed. Created by Astral (Charlie Marsh). Free for all use.
Agent Metadata
Known Gotchas
- ⚠ ruff check and ruff format are separate commands — ruff check lints; ruff format formats (black-compatible); running ruff check --fix does NOT format like black; agent code: CI should run both: ruff check . --fix && ruff format . --check; or: ruff check . && ruff format . as separate steps
- ⚠ Default rules are conservative — ruff check . with no config only checks E and F rules; to get isort-like behavior: add I to select; to get pyupgrade: add UP; agent code starting fresh: [tool.ruff.lint]; select = ['E', 'F', 'I', 'UP', 'B'] — add B for bugbear rules
- ⚠ --fix may change code semantics — most fixes are safe (whitespace, imports) but some rules (UP rules) modernize syntax; agent code: review --fix changes before committing; use --fix-only --fixable with specific rules for safety; or use ruff check --diff to preview changes
- ⚠ per-file-ignores for test files — test code often uses assert statements (S101) and has magic method patterns; [tool.ruff.lint.per-file-ignores]; 'tests/*.py' = ['S101', 'ANN'] — allows assert in tests; disables annotation requirements in tests; agent code: configure per-file rules for different code contexts
- ⚠ noqa comments work like flake8 — # noqa: E501 suppresses line-length for that line; # noqa suppresses all rules on line; ruff respects flake8 noqa comments for compatibility; agent code migrating from flake8: existing # noqa comments work in ruff without changes
- ⚠ ruff does not check type annotations — ruff rule ANN checks annotation presence but not types; for type correctness: mypy or pyright; ruff + mypy are complementary — ruff for style/bugs, mypy for types; agent code: add mypy to CI alongside ruff for complete code quality
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for ruff.
Scores are editorial opinions as of 2026-03-06.