pre-commit examples ¶
The .pre-commit-config.yaml used for this current sphinx project ¶
1---
2
3# .pre-commit-config.yaml
4# ========================
5#
6# pre-commit clean
7# pre-commit install
8# pre-commit install-hooks
9#
10# precommit hooks installation
11#
12# - pre-commit autoupdate
13#
14# - pre-commit run black
15#
16# continuous integration
17# ======================
18#
19# - pre-commit run --all-files
20#
21
22repos:
23 - repo: https://github.com/pre-commit/pre-commit-hooks
24 rev: v4.6.0
25 hooks:
26 - id: trailing-whitespace
27 - id: end-of-file-fixer
28 - id: check-yaml
29 - id: check-json
30 - id: fix-encoding-pragma
31 args: ['--remove']
32 - id: forbid-new-submodules
33 - id: mixed-line-ending
34 args: ['--fix=lf']
35 description: Forces to replace line ending by the UNIX 'lf' character.
36 # - id: pretty-format-json
37 # args: ['--no-sort-keys']
38 - id: check-added-large-files
39 args: ['--maxkb=500']
40 - id: no-commit-to-branch
41 args: [--branch, staging]
42
43
44 - repo: https://github.com/asottile/reorder_python_imports
45 rev: v3.12.0
46 hooks:
47 - id: reorder-python-imports
https://gitlab.com/00dani/lemoncurry/blob/master/.pre-commit-config.yaml ¶
1 repos:
2 - repo: https://github.com/pre-commit/pre-commit-hooks
3 rev: v1.3.0
4 hooks:
5 - id: autopep8-wrapper
6 - id: check-byte-order-marker
7 - id: check-case-conflict
8 - id: check-executables-have-shebangs
9 - id: check-json
10 - id: check-merge-conflict
11 - id: check-yaml
12 - id: end-of-file-fixer
13 - id: flake8
14 - id: mixed-line-ending
15 args:
16 - --fix=lf
17 - id: trailing-whitespace
18 - repo: local
19 hooks:
20 - id: pytest
21 name: Check pytest unit tests pass
22 entry: pipenv run pytest
23 pass_filenames: false
24 language: system
25 types: [python]
26 - id: mypy
27 name: Check mypy static types match
28 entry: pipenv run mypy . --ignore-missing-imports
29 pass_filenames: false
30 language: system
31 types: [python]
https://gitlab.com/stavros/django-webauthin/-/blob/master/.pre-commit-config.yaml ¶
1 repos:
2 - repo: https://github.com/ambv/black
3 rev: 18.9b0
4 hooks:
5 - id: black
6 - repo: https://github.com/asottile/reorder_python_imports
7 rev: v1.7.0
8 hooks:
9 - id: reorder-python-imports
10 - repo: https://gitlab.com/pycqa/flake8
11 rev: '3.7.7'
12 hooks:
13 - id: flake8
14 args: ["--config=setup.cfg"]
15 language_version: python3
16 - repo: git://github.com/skorokithakis/pre-commit-mypy
17 rev: v0.610
18 hooks:
19 - id: mypy
20 args: [-s]
21 - repo: local
22 hooks:
23 - id: gitchangelog
24 language: system
25 always_run: true
26 pass_filenames: false
27 name: Generate changelog
28 entry: bash -c "gitchangelog > CHANGELOG.md"
29 stages: [commit]