From bd3a55e16b8035d65a768862e2f07b4ee3ef889e Mon Sep 17 00:00:00 2001 From: glass-ships Date: Fri, 3 Jan 2025 14:25:14 -0500 Subject: [PATCH] Add note about setting up pre-commit --- doc/getting_started/contributing.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/getting_started/contributing.rst b/doc/getting_started/contributing.rst index c807b64f..ddc2e14e 100755 --- a/doc/getting_started/contributing.rst +++ b/doc/getting_started/contributing.rst @@ -64,7 +64,25 @@ main repository (see `Larger changes <#Larger-changes>`_ below). Once you have the code, you will need to install Refl1D, including its dependencies. You can do this by following the instructions in the `Installation guide `_. -.. simple-patches: +Making Changes +============== + +Pre-commit hooks +---------------- + +Once you have installed the code with ``pip install -e .[dev]``, you can make changes to the code. Note that refl1d uses `pre-commit `_ to run automated checks and linting/formatting on the code before it is committed. + +First, activate the Python environment in which you installed refl1d. Then, install the pre-commit hooks by running:: + + pre-commit install + +This will install the pre-commit hooks in your git repository. The pre-commit hooks will run every time you commit changes to the repository. If the checks fail, the commit will be aborted. + +You can run the checks manually by running:: + + pre-commit run + +To see what actions are being run, inspect the `.pre-commit-config.yaml` file in the root of the repository. Simple patches --------------