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

Run pre-commit on Travis CI #1081

merged 4 commits into from
Oct 21, 2019

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Oct 20, 2019

#874 (comment) notes pre-commit is needed on the CI.

This adds a new lint job to run pre-commit.

Also, instead of running local versions of the lint tools, which need installing explicitly on Travis, use pinned repo versions and let pre-commit install them.

This is the standard way of running pre-commit. @asottile wrote in #1073 (comment):

repo: local and especially language: system are meant as escape hatches from the """normal way""" and have significant drawbacks (but are provided for those exceptional cases).

Finally, since pre-commit is also running Black, mypy and Flake8 in a single job, we no longer need them as separate jobs and can reduce the number from 6 to 4 (and Travis gives 5 parallel).

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.

@ambv ambv merged commit 000147c into psf:master Oct 21, 2019
@ambv
Copy link
Collaborator

ambv commented Oct 21, 2019

Thank you for this, it will make our tests tighter.

@hugovk hugovk deleted the add-pre-commit-to-ci branch October 21, 2019 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants