diff --git a/doc/precommit.md b/doc/precommit.md index b7286ff3..c955a72c 100644 --- a/doc/precommit.md +++ b/doc/precommit.md @@ -1,22 +1,24 @@ ### Install pre-commit hook The `all.bash` script runs quickly enough so that you can use it as a git -pre-commit hook. If you don't already have a pre-commit hook, you can install it with +pre-commit hook. If you don't already have a pre-commit hook, you can install +it with ``` ln -s -f ../../all.bash .git/hooks/pre-commit ``` -Google workstations start with a small shell script as a pre-commit hook. To add -`all.bash` to it, edit `.git/hooks/pre-commit` and add the line +Google workstations start with a small shell script as a pre-commit hook. To +add `all.bash` to it, edit `.git/hooks/pre-commit` and add the line ``` ./all.bash ``` You may prefer to run `all.bash` only when you push (which happens when you run -`git codereview mail`). You'll need a small script to discard the arguments that -the pre-push hook is called with. Make this the contents of `.git/hooks/pre-push`: +`git codereview mail`). You'll need a small script to discard the arguments +that the pre-push hook is called with. Make this the contents of +`.git/hooks/pre-push`: ``` #!/bin/sh @@ -31,14 +33,14 @@ chmod +x .git/hooks/pre-push ### Running Linters/Formatters/Tests -The `all.bash` script can be used to selectively run actions on the source (e.g. -linters, code formatters, or tests). Run `./all.bash help` to see a list of -supported actions. +The `all.bash` script can be used to selectively run actions on the source +(e.g. linters, code formatters, or tests). Run `./all.bash help` to see a list +of supported actions. Some actions are not run by the default invocation of `./all.bash` that is -executed in the commit hook. Notably, the `prettier` command is not run, because -it has a dependency on nodejs, which is otherwise not needed and which not all -developers have installed on their system. +executed in the commit hook. Notably, the `prettier` command is not run, +because it has a dependency on nodejs, which is otherwise not needed and which +not all developers have installed on their system. If you are modifying CSS or Javascript, install prettier as described at https://prettier.io/docs/en/install.html, and run `./all.bash prettier` to