-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
108 lines (97 loc) · 3.5 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
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
# list of supported hooks: https://pre-commit.com/hooks.html
- id: check-case-conflict # checks for files that would conflict in case-insensitive file systems
- id: check-docstring-first # checks a common error of defining a docstring after code
- id: check-executables-have-shebangs # ensures that (non-binary) executables have a shebang
- id: check-shebang-scripts-are-executable # ensures that (non-binary) files with a shebang are executable
- id: check-merge-conflict # checks for files that contain merge conflict strings
- id: check-symlinks # checks for symlinks which do not point to anything
- id: check-toml # checks toml files for parseable syntax
- id: check-yaml # checks yaml files for parseable syntax
- id: debug-statements # checks for debugger imports and py37+ `breakpoint()` calls in python source
- id: detect-private-key # detects the presence of private keys
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline
- id: mixed-line-ending # replaces or checks mixed line ending
- id: name-tests-test # verifies that test files are named correctly
- id: trailing-whitespace # trims trailing whitespace
# python linter and formatter, also handles upgrading python code to latest version
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.15
hooks:
- id: ruff
- id: ruff-format
# python security linter
- repo: https://github.com/PyCQA/bandit
rev: "1.7.5"
hooks:
- id: bandit
args: ["-s", "B101"]
# yaml formatting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.6
hooks:
- id: prettier
types: [yaml]
# word spelling linter
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args:
- --skip=data/**,logs/**,*.bib,*.js
- --ignore-words-list=ans
# python docstring coverage checking
- repo: https://github.com/econchick/interrogate
rev: 1.5.0 # or master if you're bold
hooks:
- id: interrogate
args: [-vv, --config=pyproject.toml, src/, --fail-under, "100"]
pass_filenames: false
# md formatting
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
args: ["--number"]
additional_dependencies:
- mdformat-gfm
- mdformat-tables
- mdformat_frontmatter
- mdformat-toc
- mdformat-black
# shell scripts linter
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
# jupyter notebook cell output clearing
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
# jupyter notebook linting
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-black
args: ["--line-length=120"]
- id: nbqa-isort
args: ["--profile=black"]
- id: nbqa-flake8
args:
[
"--exclude=data/*,logs/*",
"--extend-ignore=E402",
"--max-line-length=120",
]
# python type checker
- repo: https://github.com/mattseymour/pre-commit-pytype
rev: 2023.5.8
hooks:
- id: pytype
args: ["--disable", "import-error,not-supported-yet", "-n", "auto"]