Skip to content

Commit

Permalink
Merge pull request python-trio#294 from njsmith/yapf-on-travis
Browse files Browse the repository at this point in the history
[travis] Check for code formatting problems
  • Loading branch information
njsmith authored Aug 19, 2017
2 parents 2c3e922 + 10403ef commit 38b49fa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ matrix:
language: python
python: 3.6
env: DOC_BUILD=1
- os: linux
language: python
python: 3.6
env: FORMATTING=1
- os: linux
language: generic
env: USE_PYPY_NIGHTLY=1
Expand All @@ -27,9 +31,6 @@ matrix:
- os: osx
language: generic
env: MACPYTHON=3.6.0
# 2017-03-07: They fixed the main bug I was hitting, so let's give it a try...
# allow_failures:
# - env: USE_PYPY_NIGHTLY=1

script:
- ci/travis.sh
21 changes: 21 additions & 0 deletions ci/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,27 @@ if [ "$DOC_BUILD" = "1" ]; then
# -n (nit-picky): warn on missing references
# -W: turn warnings into errors
sphinx-build -nW -b html source build
elif [ "$FORMATTING" = "1" ]; then
pip install -U yapf
yapf -rdp setup.py trio > formatting-fixes.patch
if [ -s formatting-fixes.patch ]; then
cat <<EOF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The following formatting problems were found. To fix them, run
pip install yapf
yapf -rip setup.py trio
in your local checkout.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
EOF
cat formatting-fixes.patch
exit 1
fi
else
# Actual tests
pip install -Ur test-requirements.txt
Expand Down

0 comments on commit 38b49fa

Please sign in to comment.