-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
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 for TheAlgorithms/Python #2511
Conversation
There are a bunch of files that will be fixed if I run this. Also, take a look at https://github.com/asottile/reorder_python_imports |
We also need to inform people to enable it in their local copy by: $ pip install pre-commit
$ pre-commit install Also, there are badges for pre-commit and black. |
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.
This is awesome! How long does it take to run on your machine? (If it is not fast, contributors will turn it off.) Please add the badges to README.md in a separate follow-up PR. Please fix the issues in a separate PR that we should land before this one.
By default, Also, the environment is installed only when it is run the first time and when the |
OK. Yes now I understand. After this lands, we can add something like this to |
I don't think so we need a workflow file for this as all this is done locally. The workflow file is run after the commit has been pushed and mainly used to check if every test passed. It's mostly just for the visuals as far as I can understand. |
TODO:
Is that correct? |
A fraction of all contributors will install and run pre-commit. The workflow would check the work of the contributors who do not install the tool and it will allow us to remove all that complexity from .travis.yml which should speed up our test runs. |
Got it! |
Do you have rights to click the |
Missed it! But I don't think so as that will be available only to members and owners. Oh, it's still not merged then, no I don't have the rights. |
OK. We need the fix PR before we merge. Also I added to the GitHub Action to your task list above. |
@cclauss DON'T MERGE THIS YET. |
@cclauss Please take a look at the changes: |
I can see the merge option on the app but not on the browser. |
THANKS!! |
Hi @dhruvmanila , I guess we should warn peope about pre-commit at CONTRIBUTING.md file. |
Let's not force the complexities of a local install of pre-commit on all contributors. Some folks are pretty junior and adding pre-commit to their machines might turn them off from contributing. The README should however show them how to find and solve issues when the GitHub Action does not love their contribution. |
Maybe we should put it in The other idea would be to separate out the files for each test but having a lot of files doesn't seem attractive. |
* Add pre-commit basic config file * Add pre-commit to requirements.txt * Small tweaks and use stable for black * Fix isort section in pre-commit-config file * Fix errors and EOF only for Python files
* Add pre-commit basic config file * Add pre-commit to requirements.txt * Small tweaks and use stable for black * Fix isort section in pre-commit-config file * Fix errors and EOF only for Python files
As mentioned in #2509 (comment)
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.