Skip to content

Instantly share code, notes, and snippets.

@johnidm
Last active August 6, 2025 13:59
Show Gist options
  • Save johnidm/8ab47bfb9b18f2bae923676562564220 to your computer and use it in GitHub Desktop.
Save johnidm/8ab47bfb9b18f2bae923676562564220 to your computer and use it in GitHub Desktop.
Standart ruff Configuration

Install the dependency

pip install ruff

Foramt files

ruff format .
ruff check --fix

Check errors

ruff check .
[tool.ruff.lint]
select = [
    "S", # flake8-bandit
    "B", # flake8-bugbear
    "C", # flake8-comprehensions
    "SIM", # flake8-simplify
    "I", # isort
    "E", # pycodestyle errors
    "W", # pycodestyle warnings
    "F", # pyflakes
    "D", # pydocstyle
    "UP", # pyupgrade
    "RUF100", # Unused noqa directive
]

[tool.ruff]
line-length = 120
target-version = "py312"

ignore = ["B904", "E501", "S101", "D1", "D212"]

[tool.ruff.lint.per-file-ignores]
"tests/test_*.py" = [
    "S",
]
"__init__.py" = ["F401"] # Ignore unused imports in __init__.py files

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false


[tool.ruff.lint.isort]
combine-as-imports=true
split-on-trailing-comma=true
section-order = ["future", "standard-library", "django", "third-party", "first-party", "local-folder"]
force-wrap-aliases=true

[tool.ruff.lint.isort.sections]
django = ["django"]

[tool.ruff.lint.pydocstyle]
convention = "google"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment