From a06d0fd07b233c7705c49e786c7c1054420aa823 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:01:17 -0500 Subject: [PATCH 01/17] Initialize pre-commit configuration --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 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..6ec2e9b7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +# configuration file for pre-commit and pre-commit.ci + +repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-ast + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-merge-conflict + - id: check-case-conflict + - id: check-illegal-windows-names + - id: name-tests-test + - id: detect-private-key + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: forbid-submodules + - id: check-json + - id: check-toml + - id: check-yaml From 42778c9e56c2b26359c6f66a479ffcd329116430 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:02:46 -0500 Subject: [PATCH 02/17] Comment out a few hooks --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ec2e9b7..eb8262f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,15 +6,15 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project rev: v6.0.0 hooks: - id: check-ast - - id: trailing-whitespace - - id: end-of-file-fixer +# - id: trailing-whitespace +# - id: end-of-file-fixer - id: check-merge-conflict - id: check-case-conflict - id: check-illegal-windows-names - - id: name-tests-test +# - id: name-tests-test - id: detect-private-key - id: fix-byte-order-marker - - id: mixed-line-ending +# - id: mixed-line-ending - id: forbid-submodules - id: check-json - id: check-toml From d99cc4b68575210e121f7053c102c1bcb579c1ce Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:06:07 -0500 Subject: [PATCH 03/17] Enable mixed-line-ending and remove check-json --- .pre-commit-config.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb8262f2..f39219b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,8 +14,7 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project # - id: name-tests-test - id: detect-private-key - id: fix-byte-order-marker -# - id: mixed-line-ending + - id: mixed-line-ending - id: forbid-submodules - - id: check-json - id: check-toml - id: check-yaml From 7d048e659eb03e807dff794ac660217483a1d8f2 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:08:24 -0500 Subject: [PATCH 04/17] Add texthooks --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f39219b8..c9c3f608 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,3 +18,11 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project - id: forbid-submodules - id: check-toml - id: check-yaml + +- repo: https://github.com/sirosen/texthooks + rev: 0.7.1 + hooks: +# - id: fix-smartquotes + - id: fix-spaces + - id: fix-ligatures + - id: forbid-bidi-controls \ No newline at end of file From 9517cc72f1689e6a207e8af3d8f7334fd6ffc239 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:13:26 -0500 Subject: [PATCH 05/17] Comment out mdformat --- .pre-commit-config.yaml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c9c3f608..d6d965cc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,4 +25,27 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project # - id: fix-smartquotes - id: fix-spaces - id: fix-ligatures - - id: forbid-bidi-controls \ No newline at end of file + - id: forbid-bidi-controls + +#- repo: https://github.com/sphinx-contrib/sphinx-lint +# rev: v1.0.1 +# hooks: +# - id: sphinx-lint + +- repo: https://github.com/abravalheri/validate-pyproject + rev: v0.24.1 + hooks: + - id: validate-pyproject + name: validate pyproject.toml + additional_dependencies: ['validate-pyproject-schema-store[all]'] + +# - repo: https://github.com/hukkin/mdformat +# rev: 1.0.0 +# hooks: +# - id: mdformat +# name: format .md files +# additional_dependencies: +# - mdformat-footnote +# - mdformat-gfm +# - mdformat-gfm-alerts +# - mdformat-ruff \ No newline at end of file From 1ec00fd5ceb0441e46cbda1311b146f38584bef1 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:19:19 -0500 Subject: [PATCH 06/17] Check GitHub workflows against schema --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d6d965cc..b1f2e9bb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,6 +32,11 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project # hooks: # - id: sphinx-lint +- repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.35.0 + hooks: + - id: check-github-workflows + - repo: https://github.com/abravalheri/validate-pyproject rev: v0.24.1 hooks: From 43b37ad160562af7933790796a63d55dede922cc Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:19:49 -0500 Subject: [PATCH 07/17] Add commented out hooks --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b1f2e9bb..f7f4a1af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,14 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project - id: check-toml - id: check-yaml +#- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks +# rev: v2.15.0 +# hooks: +# - id: pretty-format-yaml +# args: [--autofix] +# - id: pretty-format-ini +# args: [--autofix] + - repo: https://github.com/sirosen/texthooks rev: 0.7.1 hooks: From e8ef46303b772343a0fb49888a85478c967ed372 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:20:06 -0500 Subject: [PATCH 08/17] Add commented out pyproject-fmt hook --- .pre-commit-config.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f7f4a1af..483f6203 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,6 +52,12 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project name: validate pyproject.toml additional_dependencies: ['validate-pyproject-schema-store[all]'] +# - repo: https://github.com/tox-dev/pyproject-fmt +# rev: v2.11.1 +# hooks: +# - id: pyproject-fmt +# name: format pyproject.toml + # - repo: https://github.com/hukkin/mdformat # rev: 1.0.0 # hooks: @@ -61,4 +67,4 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project # - mdformat-footnote # - mdformat-gfm # - mdformat-gfm-alerts -# - mdformat-ruff \ No newline at end of file +# - mdformat-ruff From 4ca9b5773dc35b9e73e6ccd61465a362f58ad1bb Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:22:45 -0500 Subject: [PATCH 09/17] Add commented out ruff hooks --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 483f6203..94a3f059 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,6 +2,14 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project +#- repo: https://github.com/astral-sh/ruff-pre-commit +# rev: v0.14.5 +# hooks: +# - id: ruff-check +# name: ruff-check (see https://docs.astral.sh/ruff/rules) +# args: [--fix] +# - id: ruff-format + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: From ba33fc5f28239a463670ad4565f12be4b5b9d77e Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:25:16 -0500 Subject: [PATCH 10/17] Re-order hooks --- .pre-commit-config.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94a3f059..549bde1c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,14 +2,6 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project -#- repo: https://github.com/astral-sh/ruff-pre-commit -# rev: v0.14.5 -# hooks: -# - id: ruff-check -# name: ruff-check (see https://docs.astral.sh/ruff/rules) -# args: [--fix] -# - id: ruff-format - - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: @@ -43,6 +35,14 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project - id: fix-ligatures - id: forbid-bidi-controls +#- repo: https://github.com/astral-sh/ruff-pre-commit +# rev: v0.14.5 +# hooks: +# - id: ruff-check +# name: ruff-check (see https://docs.astral.sh/ruff/rules) +# args: [--fix] +# - id: ruff-format + #- repo: https://github.com/sphinx-contrib/sphinx-lint # rev: v1.0.1 # hooks: From 30aa4f2e9abe1e8a6c6189eac7b1cbed15cd9f2f Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:26:25 -0500 Subject: [PATCH 11/17] Re-order hooks --- .pre-commit-config.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 549bde1c..aa64f033 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,13 +11,15 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project - id: check-merge-conflict - id: check-case-conflict - id: check-illegal-windows-names -# - id: name-tests-test - id: detect-private-key - id: fix-byte-order-marker - id: mixed-line-ending - id: forbid-submodules - id: check-toml - id: check-yaml +# - id: trailing-whitespace +# - id: end-of-file-fixer +# - id: name-tests-test #- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks # rev: v2.15.0 From 1dee36b87a0126119aa6a1f29cda9450816eb2fc Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:38:31 -0500 Subject: [PATCH 12/17] Add initial configuration for codespell --- .pre-commit-config.yaml | 7 +++++++ pyproject.toml | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa64f033..d8362e20 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,6 +50,13 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project # hooks: # - id: sphinx-lint +#- repo: https://github.com/codespell-project/codespell +# rev: v2.4.1 +# hooks: +# - id: codespell +# name: codespell (add false positives to pyproject.toml) +# args: [--write-changes] + - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.35.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 08123ad3..1baf7531 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -167,5 +167,14 @@ ignore = [ "E501", # Ignore line too long ] +[tool.codespell] +skip = "*.png,*.jpg,*.jpeg,*cache*,*egg*,.git,.hypothesis,.idea,.nox,.tox,_build,venv,*.lock" +# Add false positives found by codespell to ignore-words-list +ignore-words-list = """ +fo, +inout, +tha, +thi""" + [tool.pylint] disable = ["line-too-long", "too-many-arguments",] From 6c15e15f163dbe1da493a9c3559e199ce3570888 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:39:02 -0500 Subject: [PATCH 13/17] Use pretty-format-yaml only on .pre-commit.config.yaml --- .pre-commit-config.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d8362e20..c416b86b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,11 +21,12 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project # - id: end-of-file-fixer # - id: name-tests-test -#- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks -# rev: v2.15.0 -# hooks: -# - id: pretty-format-yaml -# args: [--autofix] +- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks + rev: v2.15.0 + hooks: + - id: pretty-format-yaml + args: [--autofix] + files: .pre-commit-config.yaml # - id: pretty-format-ini # args: [--autofix] From 87212d2b5f6797df75b1c0b4c98edecb5cc99213 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:39:23 -0500 Subject: [PATCH 14/17] Add name to clarify hook --- .pre-commit-config.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c416b86b..bcc97c60 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,8 +6,7 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project rev: v6.0.0 hooks: - id: check-ast -# - id: trailing-whitespace -# - id: end-of-file-fixer + name: check abstract syntax tree - id: check-merge-conflict - id: check-case-conflict - id: check-illegal-windows-names From db55a035bc8c88522d19944484955dc5300cae0e Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:39:43 -0500 Subject: [PATCH 15/17] Specify line ending except for one file --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bcc97c60..8ef5dcac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,6 +13,8 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project - id: detect-private-key - id: fix-byte-order-marker - id: mixed-line-ending + args: [--fix=lf] + exclude: docs/make.bat - id: forbid-submodules - id: check-toml - id: check-yaml From e011f53afbaf750425aeb21bbfe4d14f22bb69ee Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 12:52:03 -0500 Subject: [PATCH 16/17] Enable codespell but temporarily exclude most files --- .pre-commit-config.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8ef5dcac..79b3df9d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,12 +52,14 @@ repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project # hooks: # - id: sphinx-lint -#- repo: https://github.com/codespell-project/codespell -# rev: v2.4.1 -# hooks: -# - id: codespell -# name: codespell (add false positives to pyproject.toml) -# args: [--write-changes] +- repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell + name: codespell (add false positives to pyproject.toml) + # temporarily exclude most files since suggested changes require some thought + exclude: pyspedas|docs/source + # args: [--write-changes] - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.35.0 From 8e93f92d5b18f358cfe58665299a6b540b4cf814 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 18 Nov 2025 18:41:04 -0500 Subject: [PATCH 17/17] Add comments and a ci configuration --- .pre-commit-config.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79b3df9d..a92f2be0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,11 @@ -# configuration file for pre-commit and pre-commit.ci +# Configuration file for pre-commit and pre-commit.ci. +# +# To perform automated fixes, either run `pre-commit run --all-files` +# or comment `pre-commit.ci autofix` on a pull request. + +ci: # https://pre-commit.ci/#configuration + autofix_prs: false + autoupdate_schedule: monthly repos: # https://pre-commit.com/#adding-pre-commit-plugins-to-your-project