Skip to content

Add codespell support with configuration and fixes - #21

Merged
gouttegd merged 10 commits into
INCATools:mainfrom
yarikoptic:enh-codespell
Sep 21, 2026
Merged

gouttegd merged 10 commits into
INCATools:mainfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown
Contributor

Add codespell configuration and fix existing typos.

Original motivation: obophenotype/uberon#3759 — codespell fixes in Uberon surfaced typos originating from ODK templates, so it makes sense to add codespell here at the source.

More about codespell: https://github.com/codespell-project/codespell

I personally introduced it to over a hundred of projects already mostly with a positive feedback
(see the "improveit-dashboard").

CI workflow has permissions set only to read so also should be safe.

Changes

Configuration & Infrastructure

  • Added [tool.codespell] section in pyproject.toml with skip patterns and check-hidden = true.
  • Added GitHub Actions workflow .github/workflows/codespell.yml running on pushes and PRs to main, using codespell-project/actions-codespell pinned by SHA.
  • Skip list: .git,.git-meta,.gitignore,.gitattributes,*.pdf,*.svg.

Domain-Specific Whitelist

Added one legitimate term to ignore-words-list:

  • eto — ontology id used in tests/configs/test-edit-obo.yaml (codespell would otherwise suggest to/ego/veto/wto).

Ambiguous typos fixed manually (context review)

  • src/incatools/odk/model.py:926 — remaning → remaining (docstring: "impact any remaining use of OWLTools").
  • src/incatools/odk/templates/_dynamic_documentation.jinja2:716 — fo → to ("when adding the component to the ODK configuration file").

Non-ambiguous typos fixed automatically (codespell -w)

Reproducibly via datalad run (see commit 7e0d44d). Notable ones:

  • prefered → preferred, accomodates → accommodates, overriden → overridden, instanciate(d) → instantiate(d).
  • Informations/informations → Information/information (docstrings & help text in download.py, helper.py).
  • editted → edited, offical → official, updateing → updating, re-use → reuse, multile → multiple, commmand → command, inofficial → unofficial, superceded → superseded, perfoming → performing.

Extended-dictionary follow-up pass

Ran codespell --builtin clear,rare,usage,code,names and found one further real typo:

  • src/incatools/odk/templates/_dynamic_documentation.jinja2:409 — dont → don't.

Other extended-pass hits were legitimate and intentionally left alone:

  • ro/RO — the Relation Ontology identifier, used throughout examples and templates.
  • master, whitelist — inclusive-language concerns, out of scope for a spell-checking PR.

Pre-existing grammar tidy-up

src/incatools/odk/config.py:189 had can accomodates before this PR. Codespell only corrected the spelling (→ can accommodates), which left the grammar broken, so the sentence was tweaked to can accommodate the change.

Historical Context

This project has had prior commits manually fixing typos (Typo fix., Typo fixes., More typo fixes.), demonstrating the value of adding automated spell-checking to catch these earlier.

Testing

  • uvx codespell passes with zero errors on the default builtins after all fixes.

Generated with Claude Code and love to typos free code.

yarikoptic and others added 7 commits August 28, 2026 08:30
Skip: also .git-meta (author-workflow scratch), *.pdf, *.svg.
Whitelist: 'eto' — ontology id used in tests/configs/test-edit-obo.yaml
(codespell suggests to/ego/veto/wto).

Co-Authored-By: Claude Code 2.1.250 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- src/incatools/odk/model.py:926: remaning -> remaining
  (adjective before "use of OWLTools" in docstring)
- src/incatools/odk/templates/_dynamic_documentation.jinja2:716: fo -> to
  ("when adding the component to the ODK configuration file")

Co-Authored-By: Claude Code 2.1.250 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fixed typos:
- accomodates -> accommodates (src/incatools/odk/config.py)
- prefered -> preferred (src/incatools/odk/cli.py)
- Informations/informations -> Information/information (src/incatools/odk/download.py, helper.py)
- overriden -> overridden (src/incatools/odk/{model,setup}.py, templates/src/ontology/Makefile.jinja2)
- instanciate/instanciated -> instantiate/instantiated (src/incatools/odk/template.py)
- editted -> edited (templates/CONTRIBUTING.md.jinja2)
- offical -> official (templates/CONTRIBUTING.md.jinja2)
- updateing -> updating (templates/_dynamic_documentation.jinja2)
- re-use -> reuse (templates/_dynamic_documentation.jinja2)
- multile -> multiple (templates/_dynamic_files.jinja2)
- commmand -> command (templates/src/ontology/Makefile.jinja2)
- inofficial -> unofficial (templates/src/ontology/Makefile.jinja2)
- superceded -> superseded (templates/src/ontology/README-editors.md.jinja2)
- perfoming -> performing (templates/src/sparql/README.md.jinja2)

Co-Authored-By: Claude Code 2.1.250 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "uvx codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
- src/incatools/odk/templates/_dynamic_documentation.jinja2:409:
  dont -> don't ("If you don't have it yet, ...")

Found via `codespell --builtin clear,rare,usage,code,names`. Other hits
from that pass were legitimate (`ro`/`RO` = Relation Ontology; `master`
and `whitelist` are inclusive-language concerns out of scope here).

Co-Authored-By: Claude Code 2.1.250 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
matentzn
matentzn previously approved these changes Sep 18, 2026

@matentzn matentzn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yarikoptic for your many years of making these PRs everywhere. Much appreciated.

I am fine this this!

The one thing I'd still like a decision on, @gouttegd: the action is pinned by SHA (which does match v2.2, I checked), but it's a Docker action whose image installs codespell[toml]>=2.2.4 — an open lower bound, rebuilt on every run. Pinning the action doesn't pin the dictionary: any future codespell release that adds a word can turn a perfectly innocent PR red for a typo the contributor didn't write. - I am ok with that but thats your call.

Comment thread .github/workflows/codespell.yml Outdated
Comment thread pyproject.toml Outdated
@gouttegd
gouttegd dismissed matentzn’s stale review September 18, 2026 13:07

This PR is not to be merged until the requested changes have been made.

@matentzn

Copy link
Copy Markdown
Contributor

@yarikoptic thanks again for the PR - will you address the two remaining comments?

Address review feedback from @gouttegd on PR INCATools#21:

- Add `codespell` to the `dev` dependency group in pyproject.toml
  alongside ruff/mypy/pytest, and invoke it via `uv run codespell`
  from the existing `code-quality.yml` workflow — avoids spinning
  up a separate Docker-based action just for the spell check.
- Drop the standalone `.github/workflows/codespell.yml`.
- Extend the codespell `skip` list with `.venv` and `.*cache` so
  it doesn't scan uv's virtualenv or mypy/ruff/pytest caches.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@yarikoptic

Copy link
Copy Markdown
Contributor Author

pushed

@matentzn
matentzn requested a review from gouttegd September 21, 2026 15:09

@gouttegd gouttegd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good, thanks!

@matentzn matentzn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @yarikoptic

@gouttegd will leave merging to you when you are sweeping.

@gouttegd
gouttegd merged commit c4dd524 into INCATools:main Sep 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants