Saikat Kumar Dey

pre-commit hooks

June 1, 2022

Code smells should be identified before they’re pushed committed.

pre-commit hooks allow you to define a standard for your codebase.

You don’t need to worry if the latest PR follows the PEP 8 conventions. Simply add a flake8 hook to your pre-commit config file. Even better, add a black config to ensure your code formatting is PEP 8 compliant.

Accidentally added a large-file to staging? No problem, pre-commit hooks will point it out.

Forgot to remove debug statements in your latest patch? pre-commit hooks got you!

Forgot to add a huge file from staging? pre-commit hook will help you!

Sometimes we commit massive jupyter notebooks (due to output) which makes the repository heavy & difficult to work with. pre-commit hooks could automatically strip the output from our notebooks before you commit.

pre-commit hooks will prevent anyone from committing changes to your code-base with such known issues.

It will allow the reviewers to focus on core contribution of a pull-request instead of trivial issues which could be avoided.

What are you waiting for ? Go get yourself some pre-commit hooks for your freshly minted repository!