Skip to content

Commit 00fe608

Browse files
committed
Use black in ci.
1 parent 33e8b46 commit 00fe608

10 files changed

+28
-12
lines changed

.git-blame-ignore-revs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Black all the code.
2+
33e8b461b6ddb717859dde664b71209ce69c119a

.github/PULL_REQUEST_TEMPLATE.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
<!--- We appreciate your help and want to give you credit. Please take a moment to put an `x` in the boxes below as you complete them. -->
88
- [ ] I've added this contribution to the `CHANGELOG`.
99
- [ ] I've added my name to the `AUTHORS` file (or it's already there).
10+
- [ ] I installed pre-commit hooks (`pip install pre-commit && pre-commit install`), and ran `black` on my code.
11+
- [x] Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: stable
4+
hooks:
5+
- id: black
6+
language_version: python3.7

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ install: ./.travis/install.sh
55
script:
66
- source ~/.venv/bin/activate
77
- tox
8-
8+
- if [[ "$TOXENV" == "py37" ]]; then black --check cli_helpers tests ; else echo "Skipping black for $TOXENV"; fi
99
matrix:
1010
include:
1111
- os: linux

.travis/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ fi
2222
pip install virtualenv
2323
python -m virtualenv ~/.venv
2424
source ~/.venv/bin/activate
25-
pip install tox
25+
pip install -r requirements-dev.txt -U --upgrade-strategy only-if-needed

CONTRIBUTING.rst

+13-7
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,24 @@ You can also measure CLI Helper's test coverage by running::
8080
Coding Style
8181
------------
8282

83-
CLI Helpers requires code submissions to adhere to
84-
`PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_.
85-
It's easy to check the style of your code, just run::
83+
When you submit a PR, the changeset is checked for pep8 compliance using
84+
`black <https://github.com/psf/black>`_. If you see a build failing because
85+
of these checks, install ``black`` and apply style fixes:
8686

87-
$ pep8radius master
87+
::
8888

89-
If you see any PEP 8 style issues, you can automatically fix them by running::
89+
$ pip install black
90+
$ black .
9091

91-
$ pep8radius master --in-place
92+
Then commit and push the fixes.
9293

93-
Be sure to commit and push any PEP 8 fixes.
94+
To enforce ``black`` applied on every commit, we also suggest installing ``pre-commit`` and
95+
using the ``pre-commit`` hooks available in this repo:
9496

97+
::
98+
99+
$ pip install pre-commit
100+
$ pre-commit install
95101

96102
Documentation
97103
-------------

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ recursive-include docs *.rst
66
recursive-include docs Makefile
77
recursive-include tests *.py
88
include tests/config_data/*
9+
exclude .pre-commit-config.yaml .git-blame-ignore-revs

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
autopep8==1.3.3
22
codecov==2.0.9
33
coverage==4.3.4
4-
pep8radius
4+
black>=20.8b1
55
Pygments>=2.4.0
66
pytest==3.0.7
77
pytest-cov==2.4.0

tasks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def initialize_options(self):
7171

7272
def run(self):
7373
"""Run the linter."""
74-
cmd = "pep8radius {branch} {{fix: --in-place}}{{verbose: -vv}}"
74+
cmd = "black ."
7575
cmd = cmd.format(branch=self.branch)
7676
self.call_and_exit(self.apply_options(cmd, ("fix",)))
7777

tox.ini

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ setenv =
1212
commands =
1313
pytest --cov-report= --cov=cli_helpers
1414
coverage report
15-
pep8radius master
1615
bash -c 'if [ -n "$CODECOV" ]; then {envbindir}/coverage xml && {envbindir}/codecov; fi'
1716
deps = -r{toxinidir}/requirements-dev.txt
1817
usedevelop = True

0 commit comments

Comments
 (0)