ruff-formatter
Ruff Formatter
Fast Python code formatter, drop-in replacement for Black with >99.9% compatibility.
Quick Reference
# Format all files in current directory
ruff format .
# Format specific file(s)
ruff format path/to/file.py
# Check without modifying (CI/pre-commit)
ruff format --check .
# Show diff of what would change
ruff format --diff .
Fixing Formatting Issues
When ruff format --check fails:
- Run
ruff format .to auto-fix all formatting - Review changes with
git diff - Commit the formatted code
For import sorting issues, run linter first:
ruff check --select I --fix . # Sort imports
ruff format . # Then format
Format Suppression
Disable formatting for specific code:
# fmt: off
matrix = [
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
]
# fmt: on
x = 1 # fmt: skip
Configuration
In pyproject.toml or ruff.toml:
[tool.ruff.format]
quote-style = "double" # or "single"
indent-style = "space" # or "tab"
line-length = 88 # default
docstring-code-format = true
Exit Codes
- 0: Success (files formatted or already formatted)
- 1: With
--check: files need formatting - 2: Error (invalid config, CLI error)
More from frizzle-chan/mudd
discord-markdown
>-
31discord-py
Build Discord bots using discord.py. Use when the user asks about Discord bot development, discord.py library, bot commands, slash commands, Discord intents, or Discord API integration. Covers Client, Bot, events, commands extension, app_commands, views, buttons, modals, and cogs.
20postgres-migrations
Write safe PostgreSQL migrations that avoid blocking reads/writes. Use when creating migrations, adding columns, indexes, constraints, or modifying tables. Based on Squawk linter rules.
20add-verb
Add synonyms to verb word lists. Use when adding verbs/synonyms for MUD actions like look, touch, attack, use, take, open, close, or drop.
17healtests
Iteratively fix test failures until all tests pass. Use when tests are failing and you want Claude to automatically plan and fix them in a loop.
17add-check
Add a new code quality check to CI, justfile, and pre-commit hooks. Use when adding linters, formatters, type checkers, or other code quality tools to the project.
17