From 43e3eb2c611ce1c73cfe2bd48fbb6a049f3984cd Mon Sep 17 00:00:00 2001 From: Carter Francis Date: Wed, 27 Mar 2024 09:06:47 -0500 Subject: [PATCH 1/3] Formatting: Add Pre-commit for running black --- .pre-commit-config.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..48bd62fa --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: + - repo: https://github.com/psf/black + # Version can be updated by running "pre-commit autoupdate" + rev: 24.3.0 + hooks: + - id: black +ci: + # Don't run automatically on PRs, instead add the comment + # "pre-commit.ci autofix" on a pull request to manually trigger auto-fixing + autofix_prs: false From 4aabdf8a32cdd88863734668efd44b820f1b6d25 Mon Sep 17 00:00:00 2001 From: Carter Francis Date: Wed, 27 Mar 2024 09:07:57 -0500 Subject: [PATCH 2/3] Documentation: Added changes to CHANGELOG.rst --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0b15cd2a..f5cc5389 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,7 @@ Unreleased Added ----- - Explicit support for Python 3.11. +- Added Pre-Commit for code formatting. Changed ------- From d7811aa390f54cd6befa05b2d98199caa074f4aa Mon Sep 17 00:00:00 2001 From: Carter Francis Date: Wed, 27 Mar 2024 09:32:41 -0500 Subject: [PATCH 3/3] Documentation: Add to CONTRIBUTING.rst --- CONTRIBUTING.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 1f5ab479..a3443541 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -86,6 +86,10 @@ Please run the latest version of `black `_ on your newly added and modified files prior to each PR. +If this doesn't work for you, you can also use the Pre-commit CI to reformat your code +on github by commenting "pre-commit autofix" on your PR. + + Run and write tests -------------------