copier/.pre-commit-config.yaml
2022-11-30 20:28:45 +00:00

100 lines
2.7 KiB
YAML

default_language_version:
python: python3
default_stages:
- commit
repos:
# checking our hooks themselves
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
# hooks running from local virtual environment
- repo: local
hooks:
- id: autoflake
name: autoflake
entry: poetry run autoflake
language: system
types: [python]
args: ["-i", "--remove-all-unused-imports", "--ignore-init-module-imports"]
- id: black
name: black
entry: poetry run black
language: system
types: [python]
require_serial: true
- id: flake8
name: flake8
entry: poetry run flake8
language: system
types: [python]
require_serial: true
- id: poetry_check
description: Check the integrity of pyproject.toml
name: poetry_check
entry: poetry check
language: system
pass_filenames: false
require_serial: true
- id: poetry-lock-check
name: poetry-lock-check
entry: poetry lock
args: ["--check"]
language: system
pass_filenames: false
- id: isort
name: isort
entry: poetry run isort
require_serial: true
language: system
types_or: [cython, pyi, python]
args: ["--filter-files"]
- id: commitizen
name: commitizen
entry: poetry run cz check
args: [--allow-abort, --commit-msg-file]
language: system
stages: [commit-msg]
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.1
hooks:
- id: pyupgrade
args: [--py37-plus]
# prettier to format our many yaml files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
exclude: |
(?x)
# Those files have wrong syntax and would fail
^tests/demo_invalid/copier.yml|tests/demo_transclude_invalid(_multi)?/demo/copier.yml$
# HACK https://github.com/prettier/prettier/issues/9430
|^tests/demo
# miscellaneous hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-toml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
exclude: \.noeof\. # Some tests require no EOF
- id: fix-encoding-pragma
args: ["--remove"]
- id: mixed-line-ending
args: ["--fix=lf"]
- id: trailing-whitespace