Skip to content

Commit 04560ea

Browse files
authored
Merge pull request #196 from dan98765/add_black_formatter_precommit_hook
Add black formatter precommit hook
2 parents 91fb8c2 + c46f4e7 commit 04560ea

21 files changed

+635
-782
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1+
repos:
12
- repo: git://github.com/pre-commit/pre-commit-hooks
2-
sha: v0.8.0
3+
rev: v1.3.0
34
hooks:
4-
- id: autopep8-wrapper
5-
args:
6-
- -i
7-
- --ignore=E128,E309,E501
8-
exclude: ^docs/.*$
95
- id: check-json
106
- id: check-yaml
117
- id: debug-statements
128
- id: end-of-file-fixer
139
exclude: ^docs/.*$
1410
- id: trailing-whitespace
11+
exclude: README.md
1512
- id: pretty-format-json
1613
args:
1714
- --autofix
18-
- --indent=4
15+
- repo: https://github.com/asottile/pyupgrade
16+
rev: v1.4.0
17+
hooks:
18+
- id: pyupgrade
19+
- repo: https://github.com/ambv/black
20+
rev: 18.6b4
21+
hooks:
22+
- id: black
23+
language_version: python3.6

conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,32 @@
44

55
try:
66
import pyannotate_runtime
7+
78
PYANOTATE_PRESENT = True
89
except ImportError:
910
PYANOTATE_PRESENT = False
1011

1112
if PYANOTATE_PRESENT:
13+
1214
def pytest_collection_finish(session):
1315
"""Handle the pytest collection finish hook: configure pyannotate.
1416
Explicitly delay importing `collect_types` until all tests have
1517
been collected. This gives gevent a chance to monkey patch the
1618
world before importing pyannotate.
1719
"""
1820
from pyannotate_runtime import collect_types
21+
1922
collect_types.init_types_collection()
2023

2124
@pytest.fixture(autouse=True)
2225
def collect_types_fixture():
2326
from pyannotate_runtime import collect_types
27+
2428
collect_types.resume()
2529
yield
2630
collect_types.pause()
2731

2832
def pytest_sessionfinish(session, exitstatus):
2933
from pyannotate_runtime import collect_types
34+
3035
collect_types.dump_stats("type_info.json")

0 commit comments

Comments
 (0)