diff --git a/getting-started/pull-request-lifecycle.rst b/getting-started/pull-request-lifecycle.rst index 1c16f1592..225b352be 100644 --- a/getting-started/pull-request-lifecycle.rst +++ b/getting-started/pull-request-lifecycle.rst @@ -108,7 +108,12 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`good-commits`) -* Then push your work to your GitHub fork:: +* If your code isn't linted correctly, :ref:`pre-commit ` + will block the commit with an error message, for example:: + + Doc/library/stdtypes.rst:5718: No newline at end of file. (missing-final-newline) + +* Once all linting errors have been fixed, you can push your work to your GitHub fork:: git push origin diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 30b756708..0ffdb02b8 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -130,6 +130,18 @@ affected files as described below.) Patches for the documentation can be made from the same repository; see :ref:`documenting`. +.. _install-pre-commit: + +Install pre-commit as a Git hook +-------------------------------- + +To make sure your code is linted correctly, we recommend setting up +`pre-commit `_ as a Git hook:: + + $ pre-commit install --allow-missing-config + pre-commit installed at .git/hooks/pre-commit + +Now pre-commit will run automatically on ``git commit``. .. _compiling: