Python Format and Lint

Ruff + Black-style formatting for a clean, consistent codebase.

  • ruff
  • python lint
  • mypy
  • format python
  • flake8

Python Format and Lint

Ruff + Black-style formatting for a clean, consistent codebase.

Commands

CommandWhat it does
ruff check .Lint the project
ruff check --fix .Auto-fix what is safe
ruff format .Black-compatible formatting
mypy src/Static type checking
python -m compileall -q .Syntax sanity sweep

Example

ruff check --fix .
ruff format .
mypy src/

FAQ

Ruff vs flake8+black+isort?

Ruff replaces all three in one fast binary with compatible rules and formatting.

Which rules to enable first?

Pyflakes (F), pycodestyle (E), isort (I), pyupgrade — then bugbear (B) as the team matures.

常見問題

Ruff vs flake8+black+isort?
Ruff replaces all three in one fast binary with compatible rules and formatting.
Which rules to enable first?
Pyflakes (F), pycodestyle (E), isort (I), pyupgrade — then bugbear (B) as the team matures.

Python