-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
106 lines (96 loc) · 3.18 KB
/
.pre-commit-config.yaml
File metadata and controls
106 lines (96 loc) · 3.18 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
# this file configures the hooks that will run when calling `pre-commit run -a`
# list of supported hooks: https://pre-commit.com/hooks.html
# to update the list of hooks, run `pre-commit autoupdate`
default_language_version:
python: python3.12
repos:
# classic hooks from the pre-commit repo itself
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-illegal-windows-names
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: forbid-submodules
- id: mixed-line-ending
- id: trailing-whitespace
- id: check-yaml
args: [ "--unsafe" ] # needed since we use tags in YAML files w/ custom safe loading
# python code formatting and linting with ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.1
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
# python upgrading syntax to newer version
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.0
hooks:
- id: pyupgrade
args: ["--py312-plus"]
# python docstring formatting - disabled because of some problem
# with the plugin - re-enable if it is fixed
# - repo: https://github.com/myint/docformatter
# rev: v1.7.5
# hooks:
# - id: docformatter
# args:
# [
# "--in-place",
# "--wrap-summaries=100",
# "--wrap-descriptions=100",
# "--style=sphinx",
# "--black",
# ]
# md formatting
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22
hooks:
- id: mdformat
args: ["--number"]
additional_dependencies:
- mdformat-gfm
- mdformat-tables
- mdformat_frontmatter
# - mdformat-toc
# - mdformat-black
# jupyter notebook cell output clearing
# NOTE: nbstripout is configured as a git filter instead of a pre-commit hook so that outputs are
# stripped from commits but preserved locally. To install the filter (done automatically
# when using `make install`), use:
# make setup-nbstripout-tool && make setup-nbstripout
# The check below verifies notebooks don't have outputs (catches filter misconfiguration).
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout
args: ["--verify"]
name: nbstripout (verify no outputs)
# jupyter notebook linting with ruff
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
- id: nbqa-ruff
args: [--fix]
- id: nbqa-ruff-format
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
# forbid non-ascii in staged lines only (legacy files are not flagged)
- repo: local
hooks:
- id: forbid-non-ascii
name: forbid non-ascii in staged lines
entry: python3 scripts/check_ascii_staged.py
language: system
types: [python]