Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: integrate codespell #638

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"autofix",
"automodule",
"cobertura",
"codespell",
"commitlint",
"conventionalcommits",
"datasource",
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions template/.pre-commit-config.yaml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions template/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"autofix",
"automodule",
"cobertura",
"codespell",
"commitlint",
"conventionalcommits",
"datasource",
Expand Down
11 changes: 8 additions & 3 deletions template/Makefile.jinja
Original file line number Diff line number Diff line change
@@ -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 %]

########################################################################################
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading