82 lines
3.1 KiB
YAML
82 lines
3.1 KiB
YAML
# .pre-commit-config.yaml
|
|
|
|
# Optional: Set a minimum pre-commit version
|
|
# min_pre_commit_version: '2.9.0'
|
|
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.6.0 # Use the latest stable version
|
|
hooks:
|
|
- id: check-yaml
|
|
- id: end-of-file-fixer
|
|
- id: trailing-whitespace
|
|
# - id: check-added-large-files # Optional: good for catching accidental large file commits
|
|
|
|
- repo: https://github.com/pycqa/flake8
|
|
rev: 7.0.0 # Use the latest stable version of flake8
|
|
hooks:
|
|
- id: flake8
|
|
# Optional: specify arguments for flake8
|
|
# args: ['--max-line-length=88', '--extend-ignore=E203']
|
|
# It's often better to configure flake8 via .flake8, setup.cfg, or pyproject.toml
|
|
# so it's consistent whether run via pre-commit or manually.
|
|
additional_dependencies: [
|
|
# Add any flake8 plugins you use here, e.g.:
|
|
# 'flake8-bugbear',
|
|
# 'flake8-comprehensions',
|
|
# 'flake8-docstrings',
|
|
# 'pep8-naming'
|
|
]
|
|
|
|
- repo: https://github.com/codespell-project/codespell
|
|
rev: v2.2.6 # Use the latest stable version
|
|
hooks:
|
|
- id: codespell
|
|
args: [
|
|
# "--ignore-words-list=your,custom,words,here",
|
|
# Or point to a file:
|
|
# "--ignore-words=.codespellignore",
|
|
"--skip=*.json,*.lock,*.svg,*.css,*.html", # Skip file types less likely to need it
|
|
# "--check-filenames",
|
|
# "--check-hidden"
|
|
]
|
|
# You can create a .codespellignore file with one word per line for words to ignore.
|
|
|
|
|
|
# --- Use a "local" hook for mypy ---
|
|
- repo: local
|
|
hooks:
|
|
- id: mypy
|
|
name: mypy
|
|
# The command to execute. It's expected to be found in the PATH
|
|
# of the environment where you run `git commit`.
|
|
entry: mypy
|
|
args: ["--explicit-package-bases", "src/"]
|
|
# 'system' tells pre-commit to find the command in the current environment
|
|
# instead of building an isolated one.
|
|
language: system
|
|
# Specify which files to run on.
|
|
types: [python]
|
|
pass_filenames: false
|
|
# You might still need args if not configured elsewhere, but a mypy.ini is better.
|
|
# args: [--config-file=mypy.ini]
|
|
# `pass_filenames: false` can be useful here if you want mypy to analyze the
|
|
# whole project as configured in mypy.ini, rather than just the changed files.
|
|
# Try without it first.
|
|
# pass_filenames: false
|
|
|
|
# --- Version checking ---
|
|
- repo: local
|
|
hooks:
|
|
- id: version-check
|
|
name: check for version consistency
|
|
# The command to execute. It's a Python script.
|
|
entry: python tools/check_versions.py
|
|
# Use 'system' to run it with the current environment's Python
|
|
language: system
|
|
# This hook doesn't need to run on every file.
|
|
# It should run if either of the version files change.
|
|
# This makes it very fast.
|
|
files: ^(pyproject\.toml|src/nodes/__init__\.py)$
|
|
# The regex `^...$` ensures it matches the full path from the repo root.
|