-
Notifications
You must be signed in to change notification settings - Fork 11
/
.pre-commit-config.yaml
149 lines (145 loc) · 4.96 KB
/
.pre-commit-config.yaml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#
# This is the configuration file of the pre-commit framework for this repository:
# https://pypi.org/project/pre-commit
#
# pre-commit runs in the GitHub Workflow of this project on each push and PR.
# Additionally, you can run it locally for faster fixing of issues using
# $ pip3 install pre-commit -r requirements-dev.txt
#
# On the initial run, pre-commit downloads its checkers, subsequent runs are fast:
#
# $ pre-commit run # automatically checks which checks are needed.
# $ pre-commit run -a # runs all fixes and checks, even when not needed
#
# When this works, you can enable it as the pre-commit hook for this git clone:
# $ pre-commit install
# $ pre-commit install --hook-type pre-push
#
# Global installation as a git-template (for new clones):
# $ git config --global init.templateDir ~/.git-template
# $ pre-commit init-templatedir ~/.git-template
#
# You can skip checks if you commit very often you don't want them to run, e.g:
# export SKIP=mypy,pylint;git commit -m "quick save" (or for --amend)
#
# For more customisation, see https://pre-commit.com/#temporarily-disabling-hooks
# and https://pre-commit.com/#confining-hooks-to-run-at-certain-stages (e.g push)
#
# After this, the pre-commit fixes and checks run when you commit an update.
#
# Install pre-commit as a global pre-commit hook(for all repos with a config):
# $ git config --global init.templateDir ~/.git-template
# $ pre-commit init-templatedir ~/.git-template
#
# Detailed Usage information for all possible situations:
# https://github.com/pre-commit/pre-commit.com/blob/main/sections/advanced.md
# Cheat sheet on the config file keywords:
# https://github.com/dexpota/cheatsheets/blob/master/pre-commit
exclude: "^tests/data"
fail_fast: true
default_stages: [commit]
repos:
- repo: local
hooks:
- id: forbidden_types
name: forbidden
entry: Binaries are not allowed in this repository, generate data if needed
types: [binary]
language: fail
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: no-commit-to-branch
args: [--branch, master]
always_run: true
- repo: https://github.com/akaihola/darker
rev: v2.1.1
hooks:
- id: darker
args: [--isort, -tpy36]
verbose: true
additional_dependencies:
- isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
hooks:
- id: mypy
additional_dependencies:
- pytest-subprocess
- types-mock
- types-six
- types-toml
- repo: https://github.com/rcmdnk/pyproject-pre-commit
rev: v0.1.9
hooks:
- id: shellcheck
- id: mdformat-check
exclude: README-Unicode.md
language: python
- repo: https://github.com/pycqa/pylint
rev: v2.17.4
hooks:
- id: pylint
args:
[
-sn, # Don't display the score
--load-plugins=pylint.extensions.eq_without_hash,
--ignore-imports=yes,
"--disable=duplicate-code,line-too-long",
]
log_file: ".git/pre-commit-pylint.log"
additional_dependencies:
- pyfakefs
- six
- mock
- pandas
- pytest_forked
- toml
- repo: local
hooks:
- id: run-pyre
name: run-pyre (expect this to take 30 seconds)
entry: python pyre_runner.py
types: [python]
language: python
log_file: ".git/pre-commit-pyre.log"
additional_dependencies: [pyre-check,mock]
- id: pytype
name: pytype (may take up to two minutes)
entry: sh -c "pytype >/dev/tty"
types: [python]
verbose: true
language: python
language_version: python3.8
require_serial: true
additional_dependencies: [pytype]
- id: pytest
name: Check pytest unit tests pass
types: [python]
# entry: sh -c "pytest -x -rf --new-first --show-capture=all >/dev/tty"
entry: sh -c "tox -e py38-covcombine >/dev/tty"
verbose: true
language: python
require_serial: true
pass_filenames: false
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
hooks:
# Enforce that `# type: ignore` annotations always occur with specific codes.
# Sample annotations: # type: ignore[attr-defined] # type: ignore[attr-defined,name-defined]
- id: python-check-blanket-type-ignore
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=50']
- id: check-shebang-scripts-are-executable # TODO: Remove shebangs from xcp/**/*.py
- id: check-symlinks
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: mixed-line-ending
args: ['--fix=lf']
description: Replace line endings with LF