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/.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 df7be12f..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 @@ -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 @@ -85,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/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/.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 aa86fd46..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 %] ######################################################################################## @@ -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 @@ -87,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: 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