Skip to content

Add codespell support with configuration and typo fixes - #3759

Merged
matentzn merged 6 commits into
obophenotype:masterfrom
yarikoptic:enh-codespell
Aug 29, 2026
Merged

Add codespell support with configuration and typo fixes#3759
matentzn merged 6 commits into
obophenotype:masterfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown
Contributor

Add codespell configuration, CI check, and fix existing typos.

More about codespell: https://github.com/codespell-project/codespell — a spell-checker for source code that has been introduced to well over a hundred open-source projects with generally positive feedback.

The added CI workflow has permissions: contents: read, so it is a safe addition.

Here I did use claude code with my codespell'ing SKILL since otherwise it would be hard-to-impossible to weed out the typos. I did review the diff, it is quite big but really reviewable. It would be great if not postponed for long time since given the spread -- PR could rot quite quickly. I would be happy to address issues if any observed/reported to make UBERON typos freee

Details on the changes

Changes

Configuration & Infrastructure

  • .codespellrc — comprehensive config that:

    • Skips generated release artifacts derived from src/ontology/uberon-edit.obo (top-level uberon.obo, uberon-base.owl, uberon-with-isa.obo, uberon-taxmod-*.obo, musculoskeletal.*, homology*, project.owl, reasoner_axioms.owl, rules.owl, ssso-merged-uberon.owl, depictions.owl, external-disjoints.owl).
    • Skips subsets/, src/ontology/imports/, src/ontology/taxmods/, src/ontology/diffs/, src/ontology/languages/ (all derived), plus source-ontologies/, resources/, ext-mappings/, mappings/, modules/, reports/, attic/, bulk_ntr_workflow/, experimental/ (external / auto-generated content), and docs/resources/ (binary graffle assets).
    • Skips src/scripts/ubermacros.el (~196k-line auto-generated Emacs macros indexing NCBITaxon species names — Latin binomials trip codespell).
    • Skips LICENSE (fixed legal wording).
    • Uses ignore-regex to protect URLs, camelCase/PascalCase identifiers, and cross-reference values after a PREFIX: (e.g. BAMS:MEnt) so external IDs are never "corrected".
    • Uses ignore-words-list (with per-word comments) for legitimate anatomical, Latin, medical, and abbreviation vocabulary that codespell flags as typos (e.g. mater, processus, vas, regio, collum, discus, cyclin, transferrin, formate, infarction, ans, als, sart, covert, panting, stye, preformed, pervious, horizontale, disjointness, etc.).
  • .github/workflows/codespell.yml — GitHub Actions workflow using the official codespell-project/actions-codespell action, pinned by SHA, permissions: contents: read, triggered on push and PR to master.

Typo Fixes

Ambiguous typos fixed manually (each reviewed in context):

  • component fo the ODKto, considere to beconsidered to be (docs & references)
  • wall fo trunkwall of trunk, foorfoot (×2), fot phalanxfoot, eigth toeeighth, partionportion, throughtthrough (×3), retrictsrestricts, identiyidentity, thathat (×3), referesrefers, extermalexternal, inernalinternal, beinvein (obsoletion comment), con- sistsconsists (line-break artifact) — all in src/ontology/uberon-edit.obo.
  • FormenForamen in def: line for ectepicondylar foramen (codespell's single suggestion here was Foremen, which is wrong for the anatomy domain).

Non-ambiguous typos auto-fixed with codespell -w via datalad run for reproducible provenance. About 200 fixes across src/ontology/uberon-edit.obo, docs, reference/, and scripts. Common patterns: mucuous → mucous, analagous → analogous, accomodate → accommodate, opthalmic → ophthalmic, prinicipal → principal, Hoever → However, seperate → separate, thier → their, protruberances → protuberances, etc.

False-positive reverts — reviewing the codespell -w diff surfaced 5 semantic false positives, all reverted in a follow-up commit and protected in the config so a future run cannot re-introduce them:

  • crus horizontal striae diagonaliscrus horizontale (Latin adjective preserved).
  • xref: BAMS:meantxref: BAMS:MEnt (external cross-reference identifier).
  • cemetery glandcementary gland (documented RELATED synonym).
  • duct remains previousremains pervious (medical term: allowing passage).
  • develop- meantdevelopment (line-break artifact of development).

Historical Context

This repo has ~166 prior commits mentioning typo, spelling, or misspell — automated spell-checking will catch these before merge going forward.

Testing

✅ Codespell passes with zero errors on this branch (with the configured skip / ignore rules).

Notes for reviewers

  • The datalad run commit records the exact uvx codespell -w invocation in git metadata for full provenance; the changes it introduced were then reviewed and 5 false positives were manually reverted in the next commit.
  • src/ontology/uberon-edit.obo was reserialised with robot convert -i src/ontology/uberon-edit.obo -f obo -o src/ontology/uberon-edit.obo (robot 1.9.10) as the final commit, per the project's editor SOP. The reserialisation only reordered synonym: lines alphabetically within their parent Term stanzas (16 lines moved across 9 hunks); no text content changed and codespell still passes with zero errors afterwards.
  • The .codespellrc is heavily commented so future contributors can decide per-entry whether to keep or remove each skip / ignore entry as the corpus evolves.

🤖 Generated with Claude Code (Opus 4.7, 1M context) in an interactive session with @yarikoptic.

PS I removed that @ai4c-agent in signature since I did not use whatever that is . Let me know if I need to return it

@yarikoptic
yarikoptic requested a review from matentzn as a code owner August 26, 2026 16:16
@cmungall

Copy link
Copy Markdown
Member

Thanks @yarikoptic! Still shilling for codespell hope you get a commission for all this 😉😉😉 ❤️ ❤️ ❤️

I believe some of these fixes are for derived docs eg from ODK. I think it's better to exclude some of these. The most valuable fixed are in the ontology source file. I'm unsure of the implications of a direct merge eg if we open ourselves to spurious PR blocks eg if we update ODK....?

@yarikoptic

Copy link
Copy Markdown
Contributor Author

Still shilling for codespell hope you get a commission for all this 😉😉😉 ❤️ ❤️ ❤️

;) thanks for the ❤️s -- appreciated. Besides taming my now existent typosalergy, my evil underlying purpose is to run 'litmus testing' of "open" projects regarding contributions ;) some times responses do surprise me!

also, with all the automation it is nearly as simple for me (or simpler since it right away creates a fork) to do it instead of plain git clone ;)

I believe some of these fixes are for derived docs eg from ODK. I think it's better to exclude some of these.

I would be happy to exclude whatever to be excluded. To not torture CI without need, I will wait for answers to your questions and any particular instructions on which ones to exclude since seems not having any particular 'auto-generated' marker in them like some others do

❯ git diff origin/master.. | lsdiff | grep generated
❯ git diff origin/master.. | lsdiff | sed -e 's,^[ab]/,,g' | xargs grep -i 'Auto-*generated'
.codespellrc:#   - src/scripts/ubermacros.el (auto-generated ~196k-line NCBITaxon index)

# overall:
❯ git grep -li 'Auto-*generated' | wc -l
85

for me to approach them systematically

@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 - As always, much appreciated.

Comment thread src/ontology/uberon-edit.obo Outdated
@@ -22119,7 +22119,7 @@ synonym: "distal tarsal 3 bone" EXACT SYSTEMATIC [UBERON:cjm]
synonym: "ectocuneiforme" EXACT [VSAO:0005054]
synonym: "external cuneiform" EXACT [Wikipedia:Lateral_cuneiform_bone]
synonym: "external cuneiform bone of foot" EXACT []
synonym: "foor distal carpal bone 3" RELATED []
synonym: "foot distal carpal bone 3" RELATED []

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.

not sure, could be

Comment thread docs/odk-workflows/components.md
Comment thread src/ontology/uberon-edit.obo
Comment thread src/ontology/uberon-edit.obo Outdated
Comment thread src/ontology/uberon-edit.obo Outdated
Comment thread src/ontology/uberon-edit.obo Outdated
yarikoptic and others added 3 commits August 28, 2026 08:40
Extend the initial rudimentary .codespellrc so the check runs cleanly
against the hand-curated parts of the repo. Following review feedback
on obophenotype#3759 from @cmungall and @matentzn, this PR is deliberately scoped
to infrastructure + typos in files that are safe to touch here; the
uberon-edit.obo review and any odkcore-side fixes are deferred to
separate PRs.

Skip patterns:
- Top-level release artifacts and derived directories (uberon.obo,
  uberon-base.owl, uberon-with-isa.obo, uberon-taxmod-*.obo,
  musculoskeletal.*, homology*, project.owl, reasoner_axioms.owl,
  rules.owl, ssso-merged-uberon.owl, depictions.owl,
  external-disjoints.owl; subsets/, imports/, taxmods/, diffs/,
  languages/).
- source-ontologies/, resources/, ext-mappings/, mappings/, modules/
  (external content); reports/, attic/, bulk_ntr_workflow/,
  experimental/ (archival / auto-generated / workflow scratch);
  docs/resources/ (binary graffle assets).
- odk-workflows -- docs/odk-workflows/ is auto-generated from odkcore
  and any edit here would be lost on the next ODK refresh. Upstream
  fixes should go to https://github.com/INCATools/ontology-development-kit
  (per matentzn's review).
- src/scripts/ubermacros.el -- ~196k-line auto-generated Emacs macros
  file indexing NCBITaxon species names.
- uberon-bridge-to-*.owl, cl-bridge-to-*.owl (auto-generated by
  `refresh-bridges` via SSSOM inject).
- definitions.owl (generated from src/patterns/data/**/*.tsv).
- LICENSE (fixed legal wording).
- .git-meta (author-workflow scratch for commit / PR message drafts).
- uberon-edit.obo -- deferred to a separate curator-reviewed PR (per
  matentzn's review of obophenotype#3759, which noted the codespell -w pass
  produced several biological-context false positives that need domain
  expertise to distinguish from genuine typos).

Protections via ignore-regex:
- URLs (short host substrings like bu.edu would otherwise flag "bu").
- camelCase / PascalCase identifiers (Prolog vars, code identifiers).
- Cross-reference values after PREFIX: (BAMS:MEnt, BM:Tel-OLT etc.).

ignore-words-list (minimal, only what still-scanned files need):
- Latin / anatomical: mater, vas, processus, regio, collum.
- Ontology term: disjointness (as in "disjointness axiom").
- Code / data: anc, nd (Prolog predicates + GO evidence code "ND"),
  heterogenous, homogenous (accepted variants).

Reduces codespell hits from ~13,600 lines of noise to ~45, all of
which are real typos in still-in-scope files (handled in the next
commits).

Co-Authored-By: Claude Code 2.1.246 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codespell flagged these with multiple possible corrections; each was
reviewed in context and fixed manually.

- reference/reference_0000034.md:166 "considere to be" -> "considered to be"
- reference/references-edit.omn:660   same fix (mirrored file)
- src/patterns/data/default/vein_and_venule_pattern.tsv:18
    "A venous plexus tha connects" -> "that connects"

The corresponding "tha" in the auto-generated src/patterns/definitions.owl
will be corrected the next time the pattern is regenerated from the tsv.

Co-Authored-By: Claude Code 2.1.246 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codespell auto-corrected 42 non-ambiguous typos (single-suggestion) across
docs/, reference/, src/scripts/, src/patterns/, src/ontology/Makefile and
uberon.Makefile, src/ontology/objectproperty.csv, uberon.references,
README-editors.txt, and src/sparql/README.md.

Common fixes: accomodate->accommodate, Hoever->However, prefered->preferred,
backtics->backticks, Examplar->Exemplar, analagous->analogous, eachother->
each other, frequence->frequency, informations->information, implmentation->
implementation, standarization->standardization, and other one-offs.

Co-Authored-By: Claude Code 2.1.246 / 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 ^^^
@yarikoptic

Copy link
Copy Markdown
Contributor Author

@matentzn THANKS! I force pushed cleaned up changes.

@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! I hope you will also do uberon-edit.obo and ODK next :P These are the biggest impact!

@yarikoptic

yarikoptic commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

sure, next after this one is merged will be the uberon-edit.obo ;)

note: 3 failing CI checks due to me submitting from a fork -- I do not think there is anything for me to address there but may be some one would be interested to resubmit from a branch within for better/fuller review etc.

edit: or should I add more or restructure reference to the agentic assistance?

@matentzn
matentzn merged commit f060b3e into obophenotype:master Aug 29, 2026
4 of 7 checks passed
yarikoptic added a commit to yarikoptic/uberon that referenced this pull request Aug 30, 2026
Remove uberon-edit.obo from the codespell skip list.  The previous PR
(obophenotype#3759) deferred this file pending curator review of false positives.
That review has now been done: 40+ domain-specific terms added to
ignore-words-list, each with an inline comment in .codespellrc explaining
why it is protected (Latin TA synonyms, anatomical abbreviations,
intentional misspellings in RELATED synonyms, non-English words in
citations, proper names).

Co-Authored-By: Claude Code 2.1.251 / Claude Sonnet 4.6 <noreply@anthropic.com>
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