Skip to content

Instantly share code, notes, and snippets.

@cfbevan
Created August 14, 2024 00:04
Show Gist options
  • Save cfbevan/8f97eaa4e8769e9a34245f1ef641e729 to your computer and use it in GitHub Desktop.
Save cfbevan/8f97eaa4e8769e9a34245f1ef641e729 to your computer and use it in GitHub Desktop.
Full Ruff settings for pyproject
[project]
name = "tool_testing"
version = "0.1.0"
description = "Ruff Tested Project"
authors = [{ name = "", email = "" }]
dependencies = []
requires-python = "==3.11.*"
readme = "README.md"
license = { text = "MIT" }
[project.optional-dependencies]
dev = [
"ruff>=0.4.10",
"pre-commit>=3.7.1",
"pytest>=8.2.2",
"pytest-mock>=3.14.0",
]
[tool.ruff]
exclude = [
".git",
".git-rewrite",
".mypy_cache",
".pytest_cache",
".ruff_cache",
".venv",
".vscode",
"__pycache__",
"__pypackages__",
]
line-length = 100
indent-width = 4
target-version = "py311"
[tool.ruff.lint]
# https://docs.astral.sh/ruff/rules
select = [
"F",
"E",
"W",
"C90",
"I",
"N",
"D",
"UP",
"ANN",
"ASYNC",
"S",
"BLE",
"B",
"A",
"COM",
"C4",
"DTZ",
"T10",
"ISC",
"ICN",
"LOG",
"G",
"INP",
"PIE",
"T20",
"PT",
"Q",
"RSE",
"RET",
"SLF",
"SLOT",
"SIM",
"TID",
"TCH",
"INT",
"ARG",
"PTH",
"ERA",
"PGH",
"PLC",
"PLE",
"PLR",
"PLW",
"TRY",
"FLY",
"PERF",
"RUF",
]
ignore = [
"W505",
"ANN101",
"ANN102",
"D100",
"D101",
"D104",
"ISC001",
"COM812",
]
fixable = ["ALL"]
unfixable = []
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"typing.TypedDict".msg = "Use typing_extensions.TypedDict instead."
[tool.ruff.lint.isort]
force-single-line = true
force-to-top = ["typing"]
lines-after-imports = 2
required-imports = ["from __future__ import annotations"]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402"]
"**/{tests,docs,tools}/*" = ["S101", "S104", "S106"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = false
docstring-code-line-length = "dynamic"
[tool.coverage.paths]
sources = ["SRC_FOLDER"]
tests = ["tests", "*/tests"]
[tool.coverage.run]
branch = true
sources = ["SRC_FOLDER"]
[tool.coverage.report]
show_missing = true
fail_under = 100
[tool.mypy]
ignore_missing_imports = true
strict = false
warn_unreachable = true
pretty = true
show_column_numbers = true
show_error_codes = true
show_error_context = true
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
warn_redundant_casts = true
warn_unused_ignores = false
plugins = ["pydantic.mypy"]
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_any_generics = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment