# Ruff configuration
# https://docs.astral.sh/ruff/
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
# Same as Black.
line-length = 88
indent-width = 4
# Assume Python 3.12
target-version = "py312"
[lint]
# Enable all rules by default.
select = ["ALL"]
ignore = [
"ANN003", # Missing type annotation for **kwargs
"ANN202", # Missing return type annotation for private function
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"ANN002", # Missing type annotation for *args
"BLE001", # Do not catch blind exception: `Exception`
"COM812", # Missing trailing comma (conflicts with formatter)
"COM819", # Prohibited trailing comma
"C901", # Function is too complex
"D100", # Missing docstring in public module
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D203", # 1 blank line required before class docstring (conflicts with D211)
"D213", # Multi-line docstring summary should start at the second line (conflicts with D212)
"D413", # Missing blank line after last section
"E501", # Line too long (handled by formatter)
"EXE002", # The file is executable but no shebang is present
"FBT001", # Boolean positional arg in function definition
"FBT002", # Boolean default value in function definition
"FBT003", # Boolean positional value in function call
"ISC001", # Single line implicit string concatenation (conflicts with formatter)
"ISC002", # Multi-line implicit string concatenation
"PLR2004", # Magic value used in comparison
"PLR0913", # Too many arguments to function call
"PLR0912", # Too many branches
"PLR0915", # Too many statements
"PLR0911", # Too many return statements
"Q000", # Bad quotes inline string (conflicts with formatter)
"Q001", # Bad quotes multiline string (conflicts with formatter)
"Q002", # Bad quotes docstring (conflicts with formatter)
"Q003", # Avoidable escaped quote
"RUF001", # String contains ambiguous unicode character
"S101", # Use of assert detected
"S104", # Possible binding to all interfaces
"S105", # Possible hardcoded password
"S108", # Probable insecure usage of temp file/directory
"S110", # `try`-`except`-`pass` detected
"S112", # `try`-`except`-`continue` detected
"SIM105", # Use `contextlib.suppress()` instead of try-except-pass
"TRY400", # Use `logging.exception` instead of `logging.error`
"W191", # Indentation contains tabs
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[lint.per-file-ignores]
"tests/**/*.py" = [
"ANN201", # Missing return type annotation for public function
"ANN001", # Missing type annotation for function argument
"D", # pydocstyle (docstring conventions)
"ARG002", # Unused function argument
"S106", # Possible hardcoded password
"SLF001", # Private member accessed
]
[format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"