-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
125 lines (114 loc) · 3.89 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
125 lines (114 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_install_hook_types: [pre-commit, commit-msg, pre-push]
default_stages: [pre-commit]
minimum_pre_commit_version: 4.0.0
exclude: ^.vscode/
repos:
# These meta hooks check the pre-commit configuration itself.
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
# Commitizen enforces semantic and conventional commit messages.
- repo: https://github.com/commitizen-tools/commitizen
rev: 6afcd8e9560ddf1b9a5032262a0be26540e85fb3 # frozen: v4.16.5
hooks:
- id: commitizen
name: Check conventional commit message
stages: [commit-msg]
# Ruff formats and lints code.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: cb8c523fd4835aba42af70f4cad5568db4df0b6c # frozen: v0.16.0
hooks:
- id: ruff-format
args: [--config, pyproject.toml]
- id: ruff-check
args: [--config, pyproject.toml, --fix, --exit-non-zero-on-fix]
# Run Pylint from the local repo to make sure venv packages
# specified in pyproject.toml are available.
- repo: local
hooks:
- id: pylint
name: Check pylint issues
entry: pylint
language: python
files: ^src/package/|^tests/
types: [text, python]
args: [--rcfile, pyproject.toml]
# Type-check all Python code.
- repo: local
hooks:
- id: mypy
name: Check typing annotations
entry: mypy
language: python
files: ^src/package/|^tests/ # Declare files to run the hook only when necessary.
types: [text, python]
pass_filenames: false
args: [--config-file, pyproject.toml]
# Enable a whole bunch of useful helper hooks, too.
# See https://pre-commit.com/hooks.html for more hooks.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict
- id: check-added-large-files
stages: [pre-commit]
args: [--maxkb=500]
- id: debug-statements
- id: end-of-file-fixer
stages: [pre-commit]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
stages: [pre-commit]
- id: detect-private-key
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: check-yaml
- id: check-toml
- repo: https://github.com/pre-commit/pygrep-hooks
rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # frozen: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-check-mock-methods
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
# Check the reStructured Text files that make up
# this package's documentation.
# Commenting this out because https://github.com/Lucas-C/pre-commit-hooks-markup/issues/13
# - repo: https://github.com/Lucas-C/pre-commit-hooks-markup
# rev: 501f3d60cee13c712492103343bc23efdc7b3d1f # frozen: v1.0.1
# hooks:
# - id: rst-linter
# Check and prettify the configuration files.
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: 4380fbb73a154b5f5624794c1c78d9719ccc860f # frozen: v2.16.0
hooks:
- id: pretty-format-yaml
args: [--autofix]
# Commenting this out because https://github.com/pappasam/toml-sort/issues/11
# - id: pretty-format-toml
# args: [--autofix]
# Check GitHub Actions workflow files.
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: c04ed26e40637cab1aa9879c693832a9c120fb20 # frozen: v1.7.12.24
hooks:
- id: actionlint
# On push to the remote, run all unit tests.
- repo: local
hooks:
- id: pytest
name: Run unit tests
entry: pytest --config-file pyproject.toml --cov-config pyproject.toml -m 'not integration and not performance' src/package/ tests/ docs/
language: python
verbose: true
always_run: true
pass_filenames: false
stages: [pre-push]