Skip to content

Commit

Permalink
Add codespell to the template itself (#108)
Browse files Browse the repository at this point in the history
* Add codespell to the template itself

* Fix test typo

* simplify pyproject entry

* Test codespell pyproject entry
  • Loading branch information
adamltyson authored Feb 20, 2024
1 parent 1b2247a commit 8a5daf8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_cookiecutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create_test_configs(create_docs):
"{{cookiecutter.github_username_or_organization}}/"
"{{cookiecutter.package_name}}",
"module_name": "test_cookiecutter_module",
"short_description": "Lets Test CookierCutter",
"short_description": "Lets Test CookieCutter",
"license": "MIT",
"create_docs": "yes" if create_docs else "no",
},
Expand Down Expand Up @@ -225,7 +225,7 @@ def test_pyproject_toml(package_path_config_dict):
assert (
project_toml["project"]["authors"][0]["email"] == config_dict["email"]
)
assert project_toml["project"]["description"] == "Lets Test CookierCutter"
assert project_toml["project"]["description"] == "Lets Test CookieCutter"
assert project_toml["project"]["readme"] == "README.md"
assert project_toml["project"]["requires-python"] == ">=3.9.0"
assert (
Expand Down Expand Up @@ -299,6 +299,9 @@ def test_pyproject_toml(package_path_config_dict):

assert "legacy_tox_ini" in project_toml["tool"]["tox"]

assert project_toml["tool"]["codespell"]["skip"] == ".git"
assert project_toml["tool"]["codespell"]["check-hidden"] is True


def test_pip_install(pip_install):
config_dict = pip_install
Expand All @@ -314,7 +317,7 @@ def test_pip_install(pip_install):
show_details = stdout.decode("utf8")
assert "Name: test-cookiecutter" in show_details
assert "Version: 0.1.dev0" in show_details
assert "Summary: Lets Test CookierCutter" in show_details
assert "Summary: Lets Test CookieCutter" in show_details
assert (
"Author-email: Test Cookiecutter <[email protected]>"
in show_details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ on:
pull_request:
workflow_dispatch:


jobs:
linting:
# scheduled workflows should not run on forks
if: (${{ github.event_name == 'schedule' }} && ${{ github.repository_owner == 'neuroinformatics-unit' }} && ${{ github.ref == 'refs/heads/main' }}) || (${{ github.event_name != 'schedule' }})
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/lint@v2

build_sphinx_docs:
name: Build Sphinx Docs
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions {{cookiecutter.package_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ repos:
- id: check-manifest
args: [--no-build-isolation]
additional_dependencies: [setuptools-scm]
- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in pyproject.toml
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
5 changes: 5 additions & 0 deletions {{cookiecutter.package_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,8 @@ extras =
commands =
pytest -v --color=yes --cov={{cookiecutter.module_name}} --cov-report=xml
"""


[tool.codespell]
skip = '.git'
check-hidden = true

0 comments on commit 8a5daf8

Please sign in to comment.