-
Notifications
You must be signed in to change notification settings - Fork 1k
Add pre-commit config #1406
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 config #1406
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems you activated some new checks, please make sure that CI have the same checks. .precommit should be a subset of CI, not the other way round.
Seems CI do not like the pre commit version |
Let me just explain why it is important that pre-commit is a subset and not a superset. I often make small changes to a PR directly in github, and some users make pull requests without having the full development environment installed. If precommit makes checks that CI does not, these would not be done in the above cases, and we would then run the risk of seeing the effect on the next commit we make. I do believe running black and isort at least in a precommit is a very good thing! You have removed empty lines at the end in some files, I hope that is not a demand because I prefer to end the file with an empty line (and some of my editors actually do it automatically). You need to update dev. |
6b0a7e5
to
5b606d6
Compare
Fixed the typo in
This was the pre-commit default (
I use rebase + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The biggest problem is that precommit catches things that our CI do not, that is the wrong way round. A precommit must be a subset (or equal) to CI, because it is not guaranteed that a pull request have passed the pre-commit.
Please do not misunderstand, I am all for a precommit hook, I have had a hook installed that does pylint/black/flake8 and sort for a long time. But if we add it to the repo, we need to ensure there are no unexpected effects. |
The difference is that when GitHub claim "This branch is out-of-date with the base branch", the PR cannot be merged. We never merge, without the CI giving green light when the PR is run on the latest dev. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought.
This is an adjustable Branch protection rule, and not a GitHub default. I neither have access to this setting, nor care what its value is for this repo. |
Happy to see this PR! |
You should care, not about the setting, but about the effect. This setting is enabled to ensure every PR is tested against the current dev, which is a simply way to avoid conflicts on dev. Locally I do not merge but run “git rebase dev”, but github only offers the merge option, which is why you sometimes see a merge commit. |
I am starting to think about releasing 3.2, it would be nice to have this merged before. |
Yes, I understand the effect. As I said, I use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks
Works for me, adds about 0.3s to commit times.