Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run pre-commit on Travis CI #1081

Merged
merged 4 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
# "Version control integration" in README.md.
exclude: ^(blib2to3/|profiling/|tests/data/)
repos:
- repo: local
- repo: local
hooks:
- id: black
name: black
language: system
entry: black
types: [python]
- id: flake8
name: flake8
language: system
entry: flake8
types: [python]
- id: mypy
name: mypy
language: system
entry: mypy
types: [python]
exclude: ^docs/conf.py
- id: black
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least for black, I believe the intention was to dogfood black itself -- the others I agree 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have unit tests that run Black on itself, so this check would likely conflict with those tests if a PR changes formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the version pre-commit installs is only available for pre-commit, so wouldn't affect those unit tests.

Anyway, I've reverted this bit so Black dogfoods for pre-commit as well.

name: black
language: system
entry: black
require_serial: true
types: [python]
hugovk marked this conversation as resolved.
Show resolved Hide resolved

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.740
hooks:
- id: mypy
exclude: ^docs/conf.py
20 changes: 7 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
dist: xenial
language: python
cache: pip
cache:
pip: true
directories:
- $HOME/.cache/pre-commit
env:
- TEST_CMD="coverage run tests/test_black.py"
install:
- pip install coverage coveralls flake8 flake8-bugbear mypy
- pip install coverage coveralls pre-commit
- pip install -e '.[d]'
script:
- $TEST_CMD
Expand All @@ -15,18 +17,10 @@ notifications:
on_failure: always
matrix:
include:
- name: "mypy"
python: 3.6
env:
- TEST_CMD="mypy black.py blackd.py tests/test_black.py"
- name: "black"
python: 3.7
env:
- TEST_CMD="black --check --verbose ."
- name: "flake8"
- name: "lint"
python: 3.7
env:
- TEST_CMD="flake8 black.py blackd.py tests/test_black.py"
- TEST_CMD="pre-commit run --all-files"
- name: "3.6"
python: 3.6
- name: "3.7"
Expand Down