forked from GlacioHack/geoutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
99 lines (90 loc) · 3.93 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
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.0.0
hooks:
- id: codespell
args: [--ignore-words-list=alos]
types_or: [python, rst, markdown]
files: ^(geoutils|doc|tests)/
# Replace relative imports (e.g. 'from . import georaster' -> 'from geoutils import georaster')
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.0
hooks:
- id: absolufy-imports
# Format the code aggressively using black
- repo: https://github.com/psf/black
rev: 21.6b0
hooks:
- id: black
args: [--line-length=120]
# Lint the code using flake8
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: [
--max-line-length=120,
--extend-ignore=E203, # flake8 disagrees with black, so this should be ignored.
]
additional_dependencies:
- flake8-comprehensions==3.1.0
- flake8-bugbear==21.3.2
files: ^(geoutils|tests)
# Lint the code using mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
hooks:
- id: mypy
args: [
--strict,
--ignore-missing-imports, # Don't warn about stubs since pre-commit runs in a limited env
--allow-untyped-calls, # Dynamic function/method calls are okay. Untyped function definitions are not okay.
--show-error-codes,
--no-warn-unused-ignores, # Ignore 'type: ignore' comments that are not used.
--disable-error-code=attr-defined, # "Module has no attribute 'XXX'" occurs because of the pre-commit env.
--disable-error-code=name-defined # "Name 'XXX' is not defined" occurs because of the pre-commit env.
]
additional_dependencies: [tokenize-rt==3.2.0]
# Sort imports using isort
- repo: https://github.com/PyCQA/isort
rev: 5.8.0
hooks:
- id: isort
# Automatically upgrade syntax to a minimum version
- repo: https://github.com/asottile/pyupgrade
rev: v2.19.1
hooks:
- id: pyupgrade
args: [--py37-plus]
# Various formattings
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.8.0
hooks:
# Single backticks should apparently not be used
- id: rst-backticks
# Check that all directives end with double colon
- id: rst-directive-colons
types: [text]
types_or: [python, rst]
# Inline code should not touch normal text
- 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
# Add custom regex lints (see .relint.yml)
- repo: https://github.com/codingjoe/relint
rev: 1.2.1
hooks:
- id: relint