diff options
author | Stephen Finucane <stephen@that.guru> | 2019-09-27 09:07:50 +0100 |
---|---|---|
committer | Stephen Finucane <stephen@that.guru> | 2019-09-27 10:36:08 +0100 |
commit | ccad3da2e4627a93630120748a04cd936173c7e1 (patch) | |
tree | e34047414f983ed0efa95b6cfd14078d5efea586 | |
parent | ec0be310ecb27cf7fc3f7c42acfdbe89d5221306 (diff) | |
download | patchwork-ccad3da2e4627a93630120748a04cd936173c7e1.tar patchwork-ccad3da2e4627a93630120748a04cd936173c7e1.tar.gz |
docs: Add documentation for pre-commit
Explain what it is and why you should use it.
Signed-off-by: Stephen Finucane <stephen@that.guru>
-rw-r--r-- | docs/development/contributing.rst | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/docs/development/contributing.rst b/docs/development/contributing.rst index 5089bba..5017160 100644 --- a/docs/development/contributing.rst +++ b/docs/development/contributing.rst @@ -19,11 +19,29 @@ files and may be added for significant changes to existing files. # # SPDX-License-Identifier: GPL-2.0-or-later -Changes that fix semantic issues will be generally be happily received, but -please keep such changes separate from functional changes. +Changes that fix semantic issues will be happily received, but please keep such +changes separate from functional changes. -``pep8`` targets are provided via tox. Refer to the :ref:`testing` section -below for more information on usage of this tool. +Patchwork uses the `pre-commit`_ framework to allow automated style checks when +committing code. This is opt-in but avoids the need to manually run style +checks on commits. Pre-commit can be installed and enabled like so: + +.. code-block:: shell + + $ pip install --user pre-commit + $ pre-commit install --allow-missing-config + +Once installed, the various checks listed in ``.pre-commit-config.yaml`` will +be run on changed files when committing. It is also possible to run the checks +on all files manually: + +.. code-block:: shell + + $ pre-commit run --all-files + +In addition to *pre-commit*, we provide *tox* targets for style checks. These +are used by CI and can be useful if checking all files manually. Refer to the +:ref:`testing` section below for more information on usage of this tool. .. _testing: @@ -163,6 +181,7 @@ Further information about the Patchwork mailing list is available can be found o .. _PEP 8: https://pep8.org/ .. _GPL v2.0 or later: https://spdx.org/licenses/GPL-2.0-or-later.html .. _SPDX License Identifier: https://spdx.org/using-spdx-license-identifier +.. _pre-commit: https://pre-commit.com/ .. _tox: https://tox.readthedocs.io/en/latest/ .. _reno: https://docs.openstack.org/developer/reno/ .. _QEMU guidelines: http://wiki.qemu.org/Contribute/SubmitAPatch |