Skip to content
Snippets Groups Projects
Commit 3a8875d0 authored by Sam Kagan's avatar Sam Kagan
Browse files

Updated pre-commit section of setup docs to be a bit more helpful

parent 2b01787c
No related branches found
No related tags found
1 merge request!1125Updated pre-commit section of setup docs to be a bit more helpful
Pipeline #7238 passed
......@@ -32,12 +32,33 @@ Note: If you notice 'no such file or directory' errors with the docker compose c
3. Run ``make reallyclean``
4. Run ``make build`` again, followed by the docker compose command previously mentioned.
You'll want to set up pre-commit hooks to run automatically, so your code can be
checked to fit with our standards. To do this:
Set up Pre-Commit
~~~~~~~~~~~~~~~~~
1. Run `make init` which will install the `pre-commit` utility
2. Check the installation worked with `pre-commit --version`
3. Install the hooks defined in `.pre-commit-config.yaml` by running `pre-commit install` from the base directory
You'll want to set up pre-commit_ to run its hooks on commit so that our standards can be enforced on your code.
To do this:
1. Run ``make init``, which will install the `pre-commit` utility
2. Check the installation worked with ``pre-commit --version``
3. Install the hooks defined in `.pre-commit-config.yaml` by running ``pre-commit install`` from the base directory
4. Force the 1.1GB Docker image used by the `license-eye` hook to download by making a "toy" commit:
.. code-block:: sh
touch a.py
git add a.py
git commit -m "Testing pre-commit"
You should see the `license-eye` hook fail with a message about needing to fix a file.
5. To clean up, run:
.. code-block:: sh
git restore --staged a.py
rm a.py
**NB:** If you get a 530 error while pulling the Docker image, *it is transient* [1_].
Now the pre-commit checks should run automatically every time you commit.
......@@ -184,3 +205,5 @@ Happy Developing!
.. |image2| image:: media/dockerized-setup-2.png
.. |image3| image:: media/dockerized-setup-3.png
.. |image4| image:: media/dockerized-setup-4.png
.. _1: https://stackoverflow.com/questions/59891901/why-do-i-suddenly-get-error-530-when-executing-docker-pull-python3-7-slim-bust
.. _pre-commit: https://pre-commit.com
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment