Skip to content

Instantly share code, notes, and snippets.

@rubenhortas
Last active March 24, 2026 18:48
Show Gist options
  • Select an option

  • Save rubenhortas/b5006ce4cb208c8a96d44bbc9ee4c3df to your computer and use it in GitHub Desktop.

Select an option

Save rubenhortas/b5006ce4cb208c8a96d44bbc9ee4c3df to your computer and use it in GitHub Desktop.
Ruff settings for Python projects
# ~/.config/ruff/settings.toml
line-length = 120
[lint]
select = [
"E", # pycodestyle errors
"F", # Pyflakes
"I", # isort
"UP", # pyupgrade
"ANN", # flake8-annotations
"B", # flake8-bugbear
"S", # flake8-bandit (security)
"SIM", # flake8-simplify
"RUF", # Ruff-specific rules
"N", # PEP8 naming
"W", # Pycodestyle warnings (style issues)
"FLY", # Flynt – f-string conversion suggestions
"SLOT", # Flake8-slots – suggests use of __slots__ where appropriate
"PERF", # Perflint
]
extend-select = [
# "D", # Pydocstyle - docstring formatting
"TID", # Flake8-tidy-imports – enforces specific import styles (e.g., no relative imports)
"BLE", # Flake8-blind-except – flags bare excepts
"TRY", # Tryceratops – try/except usage suggestions
"PIE", # Flake8-pie – Python improvement suggestions
"PTH", # flake8-use-pathlib
"C4", # flake8-comprehensions
# "FBT",# Flake8-boolean-trap – potential pitfalls with booleans
"INP", # Flake8-no-pep420 – requires __init__.py files (no implicit namespace packages)
"TC", # Flake8-type-checking – proper import of typing in type checks
"ARG", # Flake8-unused-arguments – flags unused function arguments
"LOG", # flake8-logging
"G", # Flake8-logging-format – logging format string issues
"TD", # Flake8-todos – flags TODO comments
"FIX", # Flake8-fixme – flags FIXME comments
]
ignore = [
"E501", # Line too long (because we are using the formatter)
"BLE001", # Blind exception
"COM812", # Conflicts with the formatter
"ISC001", # Conflicts with the formatter
]
[format]
quote-style = "double"
indent-style = "space"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment