It's common to use code formatters and linters to ensure code quality. To make sure your code conforms before committing, you can use pre-commit hooks.
To set this up write a script at .git/hooks/pre-commit that runs your formatter, linters and any other checks you want. This script will …