Files
read_aconity_layers/.pre-commit-config.yaml

64 lines
1.8 KiB
YAML

default_language_version:
python: python3.12
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.11
hooks:
- id: ruff
types: [python]
exclude: docs/
- id: ruff-format
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
hooks:
- id: mypy
types: [python]
exclude: docs/
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check
- repo: https://github.com/python-poetry/poetry
rev: "1.8.0"
hooks:
- id: poetry-check
- id: poetry-install
- id: poetry-lock
- id: poetry-export
args: ["-f", "requirements.txt", "-o", "./requirements.txt"]
- repo: local
hooks:
- id: build-readme
name: build-readme
entry: |
bash -c 'cat docs/readme_top.rst docs/readme_bottom.rst > README.rst'
language: system
files: 'docs/readme*.rst'
- repo: local
hooks:
- id: version-bump-check
name: version-bump-check
entry: |
bash -c '
current_version=$(grep "^version = " Cargo.toml | sed "s/version = \"\(.*\)\"/\1/");
git fetch origin main 2>/dev/null || true;
remote_version=$(git show origin/main:Cargo.toml 2>/dev/null | grep "^version = " | sed "s/version = \"\(.*\)\"/\1/" || echo "0.0.0");
if [ "$current_version" = "$remote_version" ]; then
echo "❌ Version must be bumped before push! Run: cargo bump patch|minor|major";
echo "Local: $current_version, Remote: $remote_version";
exit 1;
fi;
echo "✅ Version bumped: $remote_version -> $current_version"
'
language: system
files: 'Cargo\.toml$'
stages: [pre-push]