Skip to content

Instantly share code, notes, and snippets.

@coordt
Last active December 6, 2023 15:34
Show Gist options
  • Save coordt/ff0b2d812b918442af3e4b1076d949c8 to your computer and use it in GitHub Desktop.
Save coordt/ff0b2d812b918442af3e4b1076d949c8 to your computer and use it in GitHub Desktop.
pre-commit configuration
ci:
autofix_prs: false
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.6'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: test.*
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
exclude: test.*
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-yaml
exclude: test.*
args: [--allow-multiple-documents]
- id: debug-statements
- id: end-of-file-fixer
exclude: "^tests/resources/"
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args: ["--remove"]
- id: requirements-txt-fixer
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
additional_dependencies: ["gibberish-detector"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies: ["toml", "types-all"]
- repo: https://github.com/jsh9/pydoclint
rev: 0.3.8
hooks:
- id: pydoclint
args:
- "--config=pyproject.toml"
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate
exclude: test.*
[tool.interrogate]
ignore-init-method = true
ignore-init-module = false
ignore-magic = true
ignore-semiprivate = false
ignore-private = false
ignore-property-decorators = false
ignore-module = false
ignore-nested-functions = true
ignore-nested-classes = true
ignore-setters = false
fail-under = 95
exclude = ["setup.py", "docs", "build"]
ignore-regex = ["^get$", "^mock_.*", ".*BaseClass.*"]
verbose = 0
quiet = false
whitelist-regex = []
color = true
[tool.black]
line-length = 119
[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
# "UP" "TRY" "PLR"
select = ["E", "W", "F", "I", "N", "B", "BLE", "C", "D", "E", "F", "I", "N", "S", "T", "W", "RUF", "NPY", "PD", "PGH", "ANN", "C90", "PLC", "PLE", "PLW", "TCH"]
ignore = [
"ANN002", "ANN003", "ANN101", "ANN102", "ANN204", "ANN401",
"S101", "S104",
"D105", "D106", "D107", "D200", "D212",
"PD011",
"PLW1510",
"B008",
]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["E", "W", "F", "I", "N", "B", "BLE", "C", "D", "E", "F", "I", "N", "S", "T", "W", "RUF", "NPY", "PD", "PGH", "ANN", "C90", "PL", "PLC", "PLE", "PLW", "TCH"]
unfixable = []
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
# Same as Black.
line-length = 119
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
typing-modules = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"]
[tool.ruff.per-file-ignores]
"tests/*" = ["S101", "PLR0913", "PLR0915", "PGH003", "ANN001", "ANN202", "ANN201", "PLR0912", "TRY301", "PLW0603", "PLR2004", "ANN101", "S106", "TRY201", "ANN003", "ANN002", "S105", "TRY003"]
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.ruff.isort]
order-by-type = true
[tool.ruff.pydocstyle]
convention = "google"
[tool.pydoclint]
style = "google"
exclude = '\.git|tests'
require-return-section-when-returning-nothing = false
arg-type-hints-in-docstring = false
check-return-types = false
quiet = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment