Skip to content

Add codespell support with configuration and fixes - #3452

Open
yarikoptic wants to merge 6 commits into
stan-dev:developfrom
yarikoptic:enh-codespell
Open

yarikoptic wants to merge 6 commits into
stan-dev:developfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown

Submission Checklist

  • Run unit tests: ./runTests.py src/test/unit — not run locally; the only code changes are comments and a same-length rename of a local test variable (sentinal → sentinel), so CI should cover it
  • Run cpplint: make cpplint — not run locally; no line lengths changed
  • Declare copyright holder and open-source license: see below

Summary

Add codespell config and a CI workflow, and fix the typos it currently finds.

I have added codespell to over a hundred projects already, mostly with positive feedback (see the "improveit-dashboard"). The workflow only has contents: read permission, so it should be safe. Git history has 200+ commits mentioning typo/spelling fixes, so automating this check seems worth it.

Details of changes

Configuration & CI

  • .codespellrc skips lib/ (vendored rapidjson, stan_math submodule), licenses/stan-doc-license.txt (verbatim CC license text), plus generic caches / minified assets.
  • ignore-words-list: alo (BFGS line search bracket variable, paired with ahi) and optin (clang-tidy check group in make/clang-tidy).
  • .github/workflows/codespell.yml runs on push to and PRs against develop.

Ambiguous typos fixed manually

  • enchanced → enhanced, tht → that (RELEASE-NOTES.txt)
  • doesnt' → doesn't (RELEASE-NOTES.txt)

Intentional spelling kept

  • src/test/unit/services/check_adaptation.hpp: "lements of inverse mass matrix:" is a deliberate substring match, so it is marked with // codespell:ignore-next-line.

Non-ambiguous typos fixed by codespell -w (recorded with datalad run)

  • sentinal → sentinel — local variables in src/test/unit/io/*, optimization and pathfinder tests
  • execption, implmentation — docstrings in src/stan/mcmc/chainset.hpp
  • lincense (README.md), and many typos in historical RELEASE-NOTES.txt

None of these fixes change behavior (no functional bug fixes found).

I also ran an extended pass (--builtin clear,rare,usage,code,names). It only reported domain terms (warmup, ith, stdio, master), so I left those as they are.

Intended Effect

Catch new typos in CI, and fix the existing ones.

How to Verify

pip install codespell && codespell (or uvx codespell) should exit 0. The Codespell CI job should pass.

Side Effects

None expected. Contributors may sometimes need to add a word to ignore-words-list in .codespellrc or use an inline codespell:ignore comment.

Documentation

None needed.

AI disclosure

Per the Stan AI Contribution Policy: I prepared this with help from Claude Code. I reviewed every change and can explain and defend it.

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):

Yaroslav Halchenko

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:


🤖 Generated with Claude Code

yarikoptic and others added 6 commits October 20, 2026 13:39
… identifiers

- skip lib/ (vendored rapidjson, stan_math submodule) and the verbatim
  CC license text, plus generic caches/.git-meta/minified assets
- ignore "alo" (BFGS line search bracket variable) and "optin"
  (clang-tidy check group)

Co-Authored-By: Claude Code 2.1.300 / Claude Opus 5.5 <noreply@anthropic.com>
- enchanced -> enhanced (RELEASE-NOTES.txt) - "enhanced include syntax"
- tht -> that (RELEASE-NOTES.txt) - "in a way that is consistent"
- check_adaptation.hpp: "lements of inverse mass matrix:" is a deliberate
  substring to match regardless of "E"/"e" casing; marked with
  codespell:ignore-next-line

Co-Authored-By: Claude Code 2.1.300 / Claude Opus 5.5 <noreply@anthropic.com>
Fixed typos:
- sentinal -> sentinel (local variables in src/test/unit/io/*, optimization and pathfinder tests)
- execption -> exception, implmentation -> implementation (src/stan/mcmc/chainset.hpp docstrings)
- lincense -> license (README.md)
- various typos in historical RELEASE-NOTES.txt (adapatation, vas, maintanence,
  seralization, doesnt', manaul, ouptut, user-defiend, Dcoumentation,
  techinically, corect, supressed, constriants, initialze, priting)

Co-Authored-By: Claude Code 2.1.300 / Claude Opus 5.5 <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 ^^^
codespell -w does not rewrite this one due to the misplaced apostrophe.

Co-Authored-By: Claude Code 2.1.300 / Claude Opus 5.5 <noreply@anthropic.com>
@WardBrian

Copy link
Copy Markdown
Member

If we’d like to add this sort of checking I think it might make sense to move it inside our Jenkins pipeline rather than a separate action, though I’m also unsure if it’s worth gating PRs on

@yarikoptic

Copy link
Copy Markdown
Author

I don't have much (if any) experience with jenkins, but can easily strip github action off this PR, or ask claude to attempt to re-express it within present Jenkinsfile, just say.

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.

2 participants