From ef46155ba4003142c43741945faf3b0700794669 Mon Sep 17 00:00:00 2001 From: nineteendo Date: Wed, 10 Apr 2024 21:39:08 +0200 Subject: [PATCH 01/16] Add pre-commit setup to the Lifecycle of a pull request --- getting-started/pull-request-lifecycle.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/getting-started/pull-request-lifecycle.rst b/getting-started/pull-request-lifecycle.rst index 1c16f1592..5cb6d7aef 100644 --- a/getting-started/pull-request-lifecycle.rst +++ b/getting-started/pull-request-lifecycle.rst @@ -101,6 +101,11 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`patchcheck` and about :ref:`runtests`) +* To make sure your code is formatted correctly, we recommend to install + `pre-commit `_, and set it up as a git hook:: + + pre-commit install + * Once you are satisfied with the changes, add the files and commit them:: git add @@ -108,7 +113,12 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`good-commits`) -* Then push your work to your GitHub fork:: +* When your code isn't formatted correctly, the commit will fail with an appropriate + error message. e.g.:: + + Misc/NEWS.d/3.5.0.rst:8: No newline at end of file. (missing-final-newline) + +* Once all formatting errors have been fixed, you can push your work to your GitHub fork:: git push origin From 72bf4ce541bbeaf9659f9b7e03ec125abcd48b2d Mon Sep 17 00:00:00 2001 From: nineteendo Date: Thu, 11 Apr 2024 09:01:43 +0200 Subject: [PATCH 02/16] Add pre-commit subsection --- getting-started/pull-request-lifecycle.rst | 9 ++------- getting-started/setup-building.rst | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/getting-started/pull-request-lifecycle.rst b/getting-started/pull-request-lifecycle.rst index 5cb6d7aef..5674c4791 100644 --- a/getting-started/pull-request-lifecycle.rst +++ b/getting-started/pull-request-lifecycle.rst @@ -101,11 +101,6 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`patchcheck` and about :ref:`runtests`) -* To make sure your code is formatted correctly, we recommend to install - `pre-commit `_, and set it up as a git hook:: - - pre-commit install - * Once you are satisfied with the changes, add the files and commit them:: git add @@ -113,8 +108,8 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`good-commits`) -* When your code isn't formatted correctly, the commit will fail with an appropriate - error message. e.g.:: +* When your code isn't formatted correctly, :ref:`pre-commit` will block + the commit with an appropriate error message. e.g.:: Misc/NEWS.d/3.5.0.rst:8: No newline at end of file. (missing-final-newline) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 30b756708..b2d242676 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -58,6 +58,26 @@ itself. Git is easily available for all common operating systems. ``git push``, or ``git fetch``. On Windows, you should also :ref:`enable autocrlf `. +.. _pre-commit: + +Install pre-commit +------------------ + +To make sure your code is formatted correctly, we recommend to install +`pre-commit `_, and set it up as a git hook. + +You will only need to execute these steps once per machine: + +1. Go to https://pre-commit.com#installation. + +2. Run the install command for your global package manager. + +3. Install the git hook scripts:: + + $ pre-commit install + pre-commit installed at .git/hooks/pre-commit + + (now ``pre-commit`` will run automatically on ``git commit``!) .. _checkout: From dcfca2fb02c01c64bd7bb4c32e233f97c0764a7e Mon Sep 17 00:00:00 2001 From: Nice Zombies Date: Thu, 11 Apr 2024 09:10:53 +0200 Subject: [PATCH 03/16] Update getting-started/setup-building.rst Co-authored-by: Erlend E. Aasland --- getting-started/setup-building.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index b2d242676..afb42ac3e 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -63,8 +63,8 @@ itself. Git is easily available for all common operating systems. Install pre-commit ------------------ -To make sure your code is formatted correctly, we recommend to install -`pre-commit `_, and set it up as a git hook. +To make sure your code is formatted correctly, we recommend installing +`pre-commit `_, and set it up as a Git hook. You will only need to execute these steps once per machine: From 0c8971ef9db36c2f2c670cf7b9edabb2ea66d5f5 Mon Sep 17 00:00:00 2001 From: Nice Zombies Date: Thu, 11 Apr 2024 09:11:04 +0200 Subject: [PATCH 04/16] Update getting-started/setup-building.rst Co-authored-by: Erlend E. Aasland --- getting-started/setup-building.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index afb42ac3e..b21681531 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -72,7 +72,7 @@ You will only need to execute these steps once per machine: 2. Run the install command for your global package manager. -3. Install the git hook scripts:: +3. Install the Git hook:: $ pre-commit install pre-commit installed at .git/hooks/pre-commit From 78b3c4d82d5d15043ec7447d22ee46d956876f6a Mon Sep 17 00:00:00 2001 From: nineteendo Date: Thu, 11 Apr 2024 09:21:20 +0200 Subject: [PATCH 05/16] Fix duplicate target name --- getting-started/pull-request-lifecycle.rst | 4 ++-- getting-started/setup-building.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/getting-started/pull-request-lifecycle.rst b/getting-started/pull-request-lifecycle.rst index 5674c4791..ecc2cfb31 100644 --- a/getting-started/pull-request-lifecycle.rst +++ b/getting-started/pull-request-lifecycle.rst @@ -108,8 +108,8 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`good-commits`) -* When your code isn't formatted correctly, :ref:`pre-commit` will block - the commit with an appropriate error message. e.g.:: +* When your code isn't formatted correctly, :ref:`pre-commit ` + will block the commit with an appropriate error message. e.g.:: Misc/NEWS.d/3.5.0.rst:8: No newline at end of file. (missing-final-newline) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index b2d242676..fd1f7d498 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -58,7 +58,7 @@ itself. Git is easily available for all common operating systems. ``git push``, or ``git fetch``. On Windows, you should also :ref:`enable autocrlf `. -.. _pre-commit: +.. _install-pre-commit: Install pre-commit ------------------ From 423edd7a703207098281f99110aedeff5fff65c5 Mon Sep 17 00:00:00 2001 From: nineteendo Date: Thu, 11 Apr 2024 09:45:59 +0200 Subject: [PATCH 06/16] Remove unneeded sentence & checked with DeepL Co-authored-by: Erlend E. Aasland --- getting-started/pull-request-lifecycle.rst | 4 ++-- getting-started/setup-building.rst | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/getting-started/pull-request-lifecycle.rst b/getting-started/pull-request-lifecycle.rst index ecc2cfb31..788b81cca 100644 --- a/getting-started/pull-request-lifecycle.rst +++ b/getting-started/pull-request-lifecycle.rst @@ -108,8 +108,8 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`good-commits`) -* When your code isn't formatted correctly, :ref:`pre-commit ` - will block the commit with an appropriate error message. e.g.:: +* If your code isn't formatted correctly, :ref:`pre-commit ` + will block the commit with an appropriate error message, e.g.:: Misc/NEWS.d/3.5.0.rst:8: No newline at end of file. (missing-final-newline) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index bc43c3e93..53ab900b2 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -64,9 +64,7 @@ Install pre-commit ------------------ To make sure your code is formatted correctly, we recommend installing -`pre-commit `_, and set it up as a Git hook. - -You will only need to execute these steps once per machine: +`pre-commit `_ and setting it up as a Git hook: 1. Go to https://pre-commit.com#installation. From f60aca28fdeb891b1c7f9a777588f49df7a220ac Mon Sep 17 00:00:00 2001 From: Nice Zombies Date: Thu, 11 Apr 2024 10:10:43 +0200 Subject: [PATCH 07/16] Update getting-started/setup-building.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- getting-started/setup-building.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 53ab900b2..85ea1a1b9 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -75,7 +75,7 @@ To make sure your code is formatted correctly, we recommend installing $ pre-commit install pre-commit installed at .git/hooks/pre-commit - (now ``pre-commit`` will run automatically on ``git commit``!) + Now pre-commit will run automatically on ``git commit``. .. _checkout: From 590c86cb852f3c228b09a4c1bb1986f1066d2ea9 Mon Sep 17 00:00:00 2001 From: Nice Zombies Date: Thu, 11 Apr 2024 10:41:55 +0200 Subject: [PATCH 08/16] Update getting-started/setup-building.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- getting-started/setup-building.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 85ea1a1b9..3b3e1c782 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -66,11 +66,9 @@ Install pre-commit To make sure your code is formatted correctly, we recommend installing `pre-commit `_ and setting it up as a Git hook: -1. Go to https://pre-commit.com#installation. +1. `Install pre-commit `__. -2. Run the install command for your global package manager. - -3. Install the Git hook:: +2. Install the Git hook:: $ pre-commit install pre-commit installed at .git/hooks/pre-commit From 259e774eacd996d1277681c492a8762793763178 Mon Sep 17 00:00:00 2001 From: Nice Zombies Date: Thu, 11 Apr 2024 10:42:16 +0200 Subject: [PATCH 09/16] Update getting-started/setup-building.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- getting-started/setup-building.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index 3b3e1c782..127f8713c 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -63,7 +63,7 @@ itself. Git is easily available for all common operating systems. Install pre-commit ------------------ -To make sure your code is formatted correctly, we recommend installing +To make sure your code is linted correctly, we recommend installing `pre-commit `_ and setting it up as a Git hook: 1. `Install pre-commit `__. From 6d7415a5d64ac2599e9408c631989afd8595e32e Mon Sep 17 00:00:00 2001 From: nineteendo Date: Thu, 11 Apr 2024 10:58:24 +0200 Subject: [PATCH 10/16] Fix installation guide Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- getting-started/pull-request-lifecycle.rst | 4 +-- getting-started/setup-building.rst | 29 +++++++++------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/getting-started/pull-request-lifecycle.rst b/getting-started/pull-request-lifecycle.rst index 788b81cca..19f87220d 100644 --- a/getting-started/pull-request-lifecycle.rst +++ b/getting-started/pull-request-lifecycle.rst @@ -108,12 +108,12 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`good-commits`) -* If your code isn't formatted correctly, :ref:`pre-commit ` +* If your code isn't linted correctly, :ref:`pre-commit ` will block the commit with an appropriate error message, e.g.:: Misc/NEWS.d/3.5.0.rst:8: No newline at end of file. (missing-final-newline) -* Once all formatting errors have been fixed, you can push your work to your GitHub fork:: +* 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 127f8713c..fccc17230 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -58,23 +58,6 @@ itself. Git is easily available for all common operating systems. ``git push``, or ``git fetch``. On Windows, you should also :ref:`enable autocrlf `. -.. _install-pre-commit: - -Install pre-commit ------------------- - -To make sure your code is linted correctly, we recommend installing -`pre-commit `_ and setting it up as a Git hook: - -1. `Install pre-commit `__. - -2. Install the Git hook:: - - $ pre-commit install - pre-commit installed at .git/hooks/pre-commit - - Now pre-commit will run automatically on ``git commit``. - .. _checkout: Get the source code @@ -146,6 +129,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: From 1b1fdcc3a67f2d0074411514ff261c11f47b0d7b Mon Sep 17 00:00:00 2001 From: nineteendo Date: Thu, 11 Apr 2024 10:59:27 +0200 Subject: [PATCH 11/16] Revert newline --- getting-started/setup-building.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index fccc17230..aad188433 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -58,6 +58,7 @@ itself. Git is easily available for all common operating systems. ``git push``, or ``git fetch``. On Windows, you should also :ref:`enable autocrlf `. + .. _checkout: Get the source code From 8d1fac877a67da4c1a140e99af101c3ff373e828 Mon Sep 17 00:00:00 2001 From: nineteendo Date: Thu, 11 Apr 2024 11:01:15 +0200 Subject: [PATCH 12/16] Fix formatting --- getting-started/setup-building.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index aad188433..b10ed3f41 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -138,10 +138,10 @@ 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 + $ pre-commit install --allow-missing-config + pre-commit installed at .git/hooks/pre-commit - Now pre-commit will run automatically on ``git commit``. +Now pre-commit will run automatically on ``git commit``. .. _compiling: From 652798967e4045836e896aecee7e147753734367 Mon Sep 17 00:00:00 2001 From: nineteendo Date: Thu, 11 Apr 2024 11:04:06 +0200 Subject: [PATCH 13/16] Fix formatting 2 --- getting-started/setup-building.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index b10ed3f41..c43e3dc1e 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -138,8 +138,8 @@ 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 + $ pre-commit install --allow-missing-config + pre-commit installed at .git/hooks/pre-commit Now pre-commit will run automatically on ``git commit``. From ce9c04295ff695973f94f2aa26d6be48ba9529d7 Mon Sep 17 00:00:00 2001 From: nineteendo Date: Thu, 11 Apr 2024 11:06:05 +0200 Subject: [PATCH 14/16] Fix formatting attempt 3 --- getting-started/setup-building.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting-started/setup-building.rst b/getting-started/setup-building.rst index c43e3dc1e..0ffdb02b8 100644 --- a/getting-started/setup-building.rst +++ b/getting-started/setup-building.rst @@ -136,10 +136,10 @@ 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 `_ as a Git hook:: - $ pre-commit install --allow-missing-config - pre-commit installed at .git/hooks/pre-commit + $ pre-commit install --allow-missing-config + pre-commit installed at .git/hooks/pre-commit Now pre-commit will run automatically on ``git commit``. From 6dbae67daaa5988aeaaa656a397a4714119c395c Mon Sep 17 00:00:00 2001 From: Nice Zombies Date: Thu, 11 Apr 2024 12:10:23 +0200 Subject: [PATCH 15/16] Update getting-started/pull-request-lifecycle.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- getting-started/pull-request-lifecycle.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/pull-request-lifecycle.rst b/getting-started/pull-request-lifecycle.rst index 19f87220d..45df76b2a 100644 --- a/getting-started/pull-request-lifecycle.rst +++ b/getting-started/pull-request-lifecycle.rst @@ -111,7 +111,7 @@ You should have already :ref:`set up your system `, * If your code isn't linted correctly, :ref:`pre-commit ` will block the commit with an appropriate error message, e.g.:: - Misc/NEWS.d/3.5.0.rst:8: No newline at end of file. (missing-final-newline) + 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:: From 4217718983b2c625cb84f568e3ec81eafa61ddd7 Mon Sep 17 00:00:00 2001 From: Nice Zombies Date: Thu, 11 Apr 2024 12:10:37 +0200 Subject: [PATCH 16/16] Update getting-started/pull-request-lifecycle.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- getting-started/pull-request-lifecycle.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getting-started/pull-request-lifecycle.rst b/getting-started/pull-request-lifecycle.rst index 45df76b2a..225b352be 100644 --- a/getting-started/pull-request-lifecycle.rst +++ b/getting-started/pull-request-lifecycle.rst @@ -109,7 +109,7 @@ You should have already :ref:`set up your system `, (Learn more about :ref:`good-commits`) * If your code isn't linted correctly, :ref:`pre-commit ` - will block the commit with an appropriate error message, e.g.:: + will block the commit with an error message, for example:: Doc/library/stdtypes.rst:5718: No newline at end of file. (missing-final-newline)