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 hooks #1

Open
bhishanpdl opened this issue May 24, 2020 · 0 comments
Open

Add pre-commit hooks #1

bhishanpdl opened this issue May 24, 2020 · 0 comments

Comments

@bhishanpdl
Copy link
Owner

bhishanpdl commented May 24, 2020

Add pre-commit hooks for debug-statements and so on.
Make sure you do not accidentally commit wrong commits.

Reference: https://github.com/pre-commit/pre-commit-hooks

Using pre-commit:

pip install pre-commit
cd to_your_repo
pre-commit --version
make sure you have .pre-commit-config.yaml file at the root of the repo

pre-commit install # this will create `.git/hooks/pre-commit` executable file

Deliberately I have a file tests/tests_example.py which should fail.

pre-commit run --all-files # gives fail error.

Once the pre-commit command is run in GitHub repo, usual git commands will use the git hooks automatically. This means whenever we run git commit -m "hello" the command will fail if it does not meet the requirements.

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

No branches or pull requests

1 participant