-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.pre-commit-config.yaml
112 lines (104 loc) · 4.16 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
# based on Glaciohack pre-commit config
ci:
autofix_prs: false
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
exclude: \.txt$
- id: trailing-whitespace # Remove trailing
# whitespaces
- id: check-merge-conflict
# Fix common spelling mistakes
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: [
'--ignore-words-list', 'alos,inout,vor',
'--ignore-regex', '\bnin\b',
'--'
]
types_or: [python, rst, markdown]
files: ^(earthspy|docs|tests)/
# Replace relative imports
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
# Format the code aggressively using black
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
args: [--line-length=88]
# Lint the code using flake8
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
args: [
'--max-line-length', '122',
'--extend-ignore', 'E203,B028', # flake8
# disagrees
# with
# black, so
# this
# should be
# ignored.
'--'
]
additional_dependencies:
- flake8-comprehensions
- flake8-bugbear
files: ^(earthspy|tests)
# Sort imports using isort
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [ "--profile", "black" ]
# Automatically upgrade syntax to a minimum version
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py37-plus]
# Various formattings
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
# Detect common mistake of using single backticks when
# writing rst
- id: rst-backticks
# Detect mistake of rst directive not ending with
# double colon or space before the double colon
- id: rst-directive-colons
types: [text]
types_or: [python, rst]
# Detect mistake of inline code touching normal text
# in rst
- id: rst-inline-touching-normal
types: [text]
types_or: [python, rst]
# Eval should never be used (can do arbitrary code
# execution)
- id: python-no-eval
# Enforce the use of type annotations instead of
# docstring type comments
- id: python-use-type-annotations
- repo: local
hooks:
# Generate pip's dev-requirements.txt from conda's
# dev-environment.yml to run snyk (snyk doesn't currently
# support conda)
- id: pip-to-conda
name: Generate pip dependency from conda
language: python
entry: .github/scripts/generate_pip_deps_from_conda.py
files: ^(dev-environment.yml|requirements-dev.txt)$
pass_filenames: false
additional_dependencies: [tomli, pyyaml]