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

Add pre-commit hook #1572

Closed
Molkree opened this issue May 15, 2021 · 0 comments
Closed

Add pre-commit hook #1572

Molkree opened this issue May 15, 2021 · 0 comments
Labels

Comments

@Molkree
Copy link
Contributor

Molkree commented May 15, 2021

Is your feature request related to a problem? Please describe.
As part of #1170, creating separate issue for discussion specific to the pre-commit.

Describe the solution you'd like
Add pre-commit hook that will run Black + other tools of choice. Black definitely will be there as it's already in the GH check and recommended in tardis docs, what else should be used?

isort seems like a good idea.

flake8 will require more configuration but also can be added.

Describe alternatives you've considered
Everyone writes however they want and PRs get messier from "blackify" commits more often. Anarchy.

Additional context
I think this should be a staggered approach:

  • first add pre-commit with only Black, this should be easy.
  • then add isort, will need to add config as well.
  • flake8 (or pylint? or something else?) will require significantly more effort and should be done later.

pre-commit requires to pin to rev, like this:

-   repo: https://github.com/psf/black
    rev: 21.5b1

which means that config should be updated from time to time.

How to do that?
"Dumb" solution: add a workflow that runs pre-commit autoupdate weekly and commits changes.
Maybe an "easier" solution: use pre-commit.ci. It will update pre-commit config every week AND it will check all PRs and fix them. This will even allow to remove the existing Black check from GitHub Actions (at least for PRs). They say it is free for open source repositories but paid for "organization" repositories. I suppose tardis-sn is the former?
If we don't use pre-commit.ci, we'll also need to add isort+linter checks to GitHub Actions manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants