Running¶
Precommit takes advantage of something called "Git Hooks", which exists in your local .git/
folder per repository. These "hooks" allow Precommit to run wheneve you attempt a commit. Precommit should be listed as a dev dependency on every CHIME FRB/SPS project, so if you simply follow the Poetry tutorial and enter the shell with poetry shell
, you can access Precommit.
Whenever you first clone/create a repository, to add the .git/
hook, you'll have to run
or
if you're not in the Poetry virtual environment shell.
If you'd like to have Precommit installed globally on your local deivce, you can simply install it with pip, using:
It is important to note that Precommit only runs on staged changed files (files modified and staged with git add
). Although, you can run it on all files with
to test your entire repository.