From 971da7a0e7a00268732d8c8b70b906f7a875f45f Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Sat, 6 Jul 2024 01:46:14 +0000 Subject: [PATCH 1/2] chore: integrate codespell --- .pre-commit-config.yaml | 6 ++++++ Makefile | 3 ++- pyproject.toml | 4 ++++ template/.pre-commit-config.yaml.jinja | 6 ++++++ template/Makefile.jinja | 3 ++- template/pyproject.toml.jinja | 4 ++++ 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4d073d1e..bcfd65e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -82,6 +82,12 @@ repos: files: '(^|/)pyproject\.toml$' types: - toml + - id: codespell + name: codespell + entry: codespell + language: python + types: + - text - id: forbidden-files name: forbidden files entry: found Copier update rejection files; review them and remove them diff --git a/Makefile b/Makefile index df7be12f..045a3bc5 100644 --- a/Makefile +++ b/Makefile @@ -49,13 +49,14 @@ dev-%: pdm install --dev --group $* # Prepare the development environment. -# Install the pacakge in editable mode with all optional dependencies and pre-commit hoook. +# Install the package in editable mode with all optional dependencies and pre-commit hook. dev: pdm install if [ "$(CI)" != "true" ] && command -v pre-commit > /dev/null 2>&1; then pre-commit install; fi # Install standalone tools prerequisites: + pipx install --force codespell[toml]==2.3.0 pipx install --force pdm==2.16.1 ifeq ($(PIPX_PYTHON_VERSION), 3.8) pipx install --force pre-commit==3.5.0 diff --git a/pyproject.toml b/pyproject.toml index da02c085..163feffe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,6 +95,10 @@ lint.per-file-ignores."tests/*" = [ ] lint.pydocstyle.convention = "google" +[tool.codespell] +write-changes = true +check-filenames = true + [tool.pyproject-fmt] indent = 4 keep_full_version = true diff --git a/template/.pre-commit-config.yaml.jinja b/template/.pre-commit-config.yaml.jinja index a1fe63e5..f3ec4b3b 100644 --- a/template/.pre-commit-config.yaml.jinja +++ b/template/.pre-commit-config.yaml.jinja @@ -85,6 +85,12 @@ repos: files: '(^|/)pyproject\.toml$' types: - toml + - id: codespell + name: codespell + entry: codespell + language: python + types: + - text - id: forbidden-files name: forbidden files entry: found Copier update rejection files; review them and remove them diff --git a/template/Makefile.jinja b/template/Makefile.jinja index aa86fd46..a1001459 100644 --- a/template/Makefile.jinja +++ b/template/Makefile.jinja @@ -51,13 +51,14 @@ dev-%: pdm install --dev --group $* # Prepare the development environment. -# Install the pacakge in editable mode with all optional dependencies and pre-commit hoook. +# Install the package in editable mode with all optional dependencies and pre-commit hook. dev: pdm install if [ "$(CI)" != "true" ] && command -v pre-commit > /dev/null 2>&1; then pre-commit install; fi # Install standalone tools prerequisites: + pipx install --force codespell[toml]==2.3.0 pipx install --force pdm==2.16.1 ifeq ($(PIPX_PYTHON_VERSION), 3.8) pipx install --force pre-commit==3.5.0 diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 60efbe24..191cbc29 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -136,6 +136,10 @@ lint.per-file-ignores."tests/*" = [ ] lint.pydocstyle.convention = "google" +[tool.codespell] +write-changes = true +check-filenames = true + [tool.pyproject-fmt] indent = 4 keep_full_version = true From e124852ca64c6c57913835ea40f816bd70f17ad3 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Sat, 6 Jul 2024 02:32:29 +0000 Subject: [PATCH 2/2] make codespell --- .vscode/settings.json | 1 + Makefile | 8 ++++++-- template/.vscode/settings.json | 1 + template/Makefile.jinja | 8 ++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7766d6b5..936f77b9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,6 +17,7 @@ "autofix", "automodule", "cobertura", + "codespell", "commitlint", "conventionalcommits", "datasource", diff --git a/Makefile b/Makefile index 045a3bc5..9e9af78b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt lint pre-commit test-run test build publish doc-autobuild doc-gen doc-mypy doc-coverage doc consistency +.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt codespell lint pre-commit test-run test build publish doc-autobuild doc-gen doc-mypy doc-coverage doc consistency ######################################################################################## # Variables @@ -86,8 +86,12 @@ ruff-format: pyproject-fmt: pyproject-fmt pyproject.toml +# Check lint with codespell. +codespell: + codespell + # Check lint with all linters. -lint: mypy ruff ruff-format pyproject-fmt +lint: mypy ruff ruff-format pyproject-fmt codespell # Run pre-commit with autofix against all files. pre-commit: diff --git a/template/.vscode/settings.json b/template/.vscode/settings.json index 7766d6b5..936f77b9 100644 --- a/template/.vscode/settings.json +++ b/template/.vscode/settings.json @@ -17,6 +17,7 @@ "autofix", "automodule", "cobertura", + "codespell", "commitlint", "conventionalcommits", "datasource", diff --git a/template/Makefile.jinja b/template/Makefile.jinja index a1001459..52877772 100644 --- a/template/Makefile.jinja +++ b/template/Makefile.jinja @@ -1,5 +1,5 @@ [% from pathjoin("includes", "variable.jinja") import page_url with context -%] -.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt lint pre-commit test-run test build publish doc-autobuild doc-gen doc-mypy doc-coverage doc +.PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt codespell lint pre-commit test-run test build publish doc-autobuild doc-gen doc-mypy doc-coverage doc [%- if project_name == "Serious Scaffold Python" %] consistency[% endif %] ######################################################################################## @@ -88,8 +88,12 @@ ruff-format: pyproject-fmt: pyproject-fmt pyproject.toml +# Check lint with codespell. +codespell: + codespell + # Check lint with all linters. -lint: mypy ruff ruff-format pyproject-fmt +lint: mypy ruff ruff-format pyproject-fmt codespell # Run pre-commit with autofix against all files. pre-commit: