LinuxCommandLibrary

ruff

TLDR

Check current directory

$ ruff check
copy
Check specific files
$ ruff check [file.py] [other.py]
copy
Auto-fix issues
$ ruff check --fix
copy
Format code
$ ruff format
copy
Show fixable issues
$ ruff check --show-fixes
copy
Watch mode
$ ruff check --watch
copy
Select specific rules
$ ruff check --select [E,F,W]
copy
Ignore rules
$ ruff check --ignore [E501]
copy

SYNOPSIS

ruff [check] [format] [--fix] [--select rules] [options] [paths]

DESCRIPTION

ruff is an extremely fast Python linter written in Rust. It implements rules from Flake8, isort, pyupgrade, and other tools.
Speed is the primary advantage. Ruff is 10-100x faster than traditional Python linters. This enables real-time feedback and CI integration without delays.
Rule selection controls which checks run. Categories include E (pycodestyle errors), F (Pyflakes), W (warnings), I (isort), UP (pyupgrade), and many more.
The formatter is Black-compatible, providing consistent code style. It integrates with the linter for a unified toolchain.
Configuration in pyproject.toml or ruff.toml customizes behavior. Per-file ignores and extends support complex project needs.
Fix mode modifies files automatically. Unsafe fixes may change behavior and require separate opt-in.

PARAMETERS

check

Run linting.
format
Format code.
--fix
Auto-fix violations.
--unsafe-fixes
Apply unsafe fixes.
--select RULES
Rules to enable.
--ignore RULES
Rules to ignore.
--extend-select RULES
Additional rules.
--config FILE
Configuration file.
--show-fixes
Show available fixes.
--watch
Watch for changes.
--output-format FMT
Output format (text, json, etc.).
--statistics
Show statistics.
--diff
Show diff for fixes.

CAVEATS

Rust-based - requires separate installation from Python. Not all Flake8 plugins are implemented. Rapidly evolving.

HISTORY

Ruff was created by Charlie Marsh in 2022. It achieved immediate popularity due to its speed, replacing multiple Python tools with a single fast alternative.

SEE ALSO

flake8(1), black(1), pylint(1), isort(1)

> TERMINAL_GEAR

Curated for the Linux community

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

$129.95
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50