Skip to content

Commit 6f0aa9d

Browse files
authored
Organize pre-commit setup (#757)
1 parent 82d083d commit 6f0aa9d

4 files changed

Lines changed: 30 additions & 46 deletions

File tree

.pre-commit-config.yaml

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,32 @@
1-
exclude: docs
1+
exclude: "(^dynaconf/vendor+.|^venv/+.|^.venv/+.|^env/+.|^.tox/+.|^build/+.|docs)"
2+
default_language_version:
3+
python: python3
24
repos:
3-
- repo: https://github.com/asottile/reorder_python_imports
4-
rev: v3.0.1
5-
hooks:
6-
- id: reorder-python-imports
7-
language_version: python3
8-
args: [--py3-plus]
9-
exclude: &exc "(^dynaconf/vendor+.|^venv/+.|^.venv/+.|^env/+.|^.tox/+.|^build/+.)"
10-
- repo: https://github.com/ambv/black
11-
rev: 22.3.0
12-
hooks:
13-
- id: black
14-
args: [--line-length=79]
15-
language_version: python3
16-
exclude: *exc
17-
18-
- repo: https://github.com/pre-commit/mirrors-mypy
19-
rev: v0.942
20-
hooks:
21-
- id: mypy
22-
files: ^dynaconf/
23-
exclude: *exc
24-
255
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.1.0
6+
rev: v4.2.0
277
hooks:
288
- id: trailing-whitespace
29-
language_version: python3
30-
exclude: *exc
319
- id: end-of-file-fixer
32-
language_version: python3
33-
exclude: *exc
3410
- id: check-yaml
35-
language_version: python3
36-
exclude: *exc
3711
- id: check-merge-conflict
38-
language_version: python3
39-
exclude: *exc
4012
- id: debug-statements
41-
language_version: python3
42-
exclude: *exc
4313
- id: fix-encoding-pragma
44-
language_version: python3
45-
exclude: *exc
4614
args: [--remove]
15+
- repo: https://github.com/asottile/reorder_python_imports
16+
rev: v3.1.0
17+
hooks:
18+
- id: reorder-python-imports
19+
- repo: https://github.com/ambv/black
20+
rev: 22.3.0
21+
hooks:
22+
- id: black
23+
args: [--line-length=79]
4724
- repo: https://gitlab.com/pycqa/flake8
4825
rev: 3.9.2
4926
hooks:
5027
- id: flake8
51-
args: ['--ignore=F403,W504,W503,F841,E401,F401,E402']
52-
language_version: python3
53-
exclude: *exc
28+
- repo: https://github.com/pre-commit/mirrors-mypy
29+
rev: v0.960
30+
hooks:
31+
- id: mypy
32+
files: ^dynaconf/

Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,11 @@ test_all: test_examples test_integration test_redis test_vault test
192192
install:
193193
pip install --upgrade pip
194194
pip install -r requirements_dev.txt
195-
make setup-pre-commit
196-
197-
setup-pre-commit:
198-
pre-commit install
199-
pre-commit install-hooks
200195

201196
run-pre-commit:
202197
rm -rf .tox/
203198
rm -rf build/
204-
pre-commit run --files $$(find -regex '.*\.\(py\|yaml\|yml\|md\)') -v
199+
pre-commit run --all-files
205200

206201
pep8:
207202
# Flake8 ignores

example/ignore_unknown_envvars/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ MYAPP_SECRET=hunter1
88
VAR1=bar
99

1010
# Wanted, prefixed variable.
11-
MYAPP_VAR1=ham
11+
MYAPP_VAR1=ham

setup.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
[bdist_wheel]
22
universal = 1
33

4+
[flake8]
5+
ignore = F403
6+
W504
7+
W503
8+
F841
9+
E401
10+
F401
11+
E402
12+
max-line-length = 79
13+
414
[mypy]
515
ignore_missing_imports = True
616

0 commit comments

Comments
 (0)