What problem does it solve?
Ruff helps you automatically catch Python style, correctness, and modernization issues so you spend less time on manual linting and formatting and more time shipping code.
Core Features & Use Cases
- Fast linting and rule-based diagnostics: Uses hundreds of rules to find PEP 8 violations, logical issues, unused imports, and unsafe patterns.
- Auto-fixing with
--fix: Applies safe, rule-driven corrections to reduce tedious cleanup work.
- Black-compatible formatting: Ensures consistent code layout via
ruff format, including check, diff, and CI-friendly validation.
- Code modernization (UP rules): Updates deprecated or outdated Python constructs to newer, idiomatic syntax (e.g., pyupgrade-style improvements).
Use case: You inherit a Python repo with inconsistent formatting and lingering legacy syntax; run Ruff to both lint and auto-fix issues, then format everything to enforce a uniform style across the codebase.
Quick Start
Run ruff check --fix . && ruff format . to automatically fix lint issues and then format all Python files in the current project.