Skip to content

Commit 65cb4d4

Browse files
committed
initialize pre-commit hooks and python black
1 parent d16f13b commit 65cb4d4

5 files changed

+61
-1
lines changed

.pre-commit-config.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.3.0
4+
hooks:
5+
- id: check-yaml
6+
- repo: https://github.com/psf/black
7+
rev: 19.3b0
8+
hooks:
9+
- id: black
10+
name: fmt
11+
12+
default_language_version:
13+
python: python3.7

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,25 @@ Then use ``tox`` to run the complete suite against the full set of build targets
5454

5555
Help is always appreciated! Feel free to open an issue if you find a problem, or a pull request if you've solved an issue.
5656

57+
### Pre-Commit Hooks
58+
59+
We use [pre-commit](https://pre-commit.com/) hooks, primarily to ensure consistent formatting among contributors.
60+
61+
If you haven't already, install all dev dependencies in `requirements-dev.txt` to enable pre-commit hooks.
62+
63+
Install pre-commit locally from the brownie root folder:
64+
65+
```bash
66+
pre-commit install
67+
```
68+
69+
Commiting will now automatically run the local pre-commit hooks.
70+
71+
If, for some reason, you need to force the commit without running the pre-commit hooks, you can manually disable the pre-commit.
72+
```bash
73+
git commit -m "commit message" --no-verify
74+
```
75+
5776
## License
5877

5978
This project is licensed under the [MIT license](LICENSE).

pyproject.toml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Brownie configuration for Black.
2+
3+
# NOTE: you have to use single-quoted strings in TOML for regular expressions.
4+
# It's the equivalent of r-strings in Python. Multiline strings are treated as
5+
# verbose regular expressions by Black. Use [ ] to denote a significant space
6+
# character.
7+
8+
[tool.black]
9+
line-length = 88
10+
target-version = ['py36', 'py37', 'py38']
11+
include = '\.pyi?$'
12+
exclude = '''
13+
/(
14+
\.eggs
15+
| \.git
16+
| \.hg
17+
| \.mypy_cache
18+
| \.tox
19+
| \.venv
20+
| _build
21+
| buck-out
22+
| build
23+
| dist
24+
| env
25+
| venv
26+
)/
27+
'''

requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ pytest-cov>=2.7.1
44
pytest-mock>=1.10.4
55
twine==1.13.0
66
wheel==0.33.4
7+
black==19.3b0

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ python =
1111

1212
[flake8]
1313
max-line-length=100
14-
ignore=W504
14+
ignore=E203,W503,W504
1515
exclude=tests/brownie-test-project
1616

1717
[testenv:lint]

0 commit comments

Comments
 (0)