add codespell integration for spelling checks in dev mode and CI

This commit is contained in:
eugene
2026-09-16 11:11:52 -04:00
parent 35d7cb44ea
commit cb0e896d72
4 changed files with 48 additions and 2 deletions
+6
View File
@@ -0,0 +1,6 @@
# Shared by CI (.github/workflows/linters.yml) and local runs.
# Run locally with `codespell` from the checkout root, or `cmake --build <dir> --target codespell`.
[codespell]
# Build output and local-only tool directories. None of these contain tracked
# files, so CI scans exactly what it did before.
skip = ./.git,./build,./build-*,./cmake-build-*,./Testing,./.claude,./.worktrees,./.pytest_cache
-2
View File
@@ -16,5 +16,3 @@ jobs:
- name: Run code spelling check
uses: codespell-project/actions-codespell@v2
with:
ignore_words_list: controll,mapp,tolen,unstalled
+27
View File
@@ -50,3 +50,30 @@ cd build
cmake --preset ci-linux-x64 ..
cmake --build .
```
## Linting
Pull requests run a [codespell](https://github.com/codespell-project/codespell) check. The settings live in
`.codespellrc` at the checkout root, and both CI and local runs read that same file, so a run on your machine
matches the one in CI.
Install it once:
```bash
pip install codespell
```
Then check the tree from the checkout root:
```bash
codespell
```
If you have a configured build directory, the same check is wired up as a CMake target (developer mode only):
```bash
cmake --build build --target codespell
```
A clean tree exits 0. To let a flagged word through, add an `ignore-words-list` entry to `.codespellrc` rather than
to the workflow — codespell merges the two lists, so an entry in only one place is easy to lose track of.
+15
View File
@@ -149,6 +149,21 @@ if (ziti_DEVELOPER_MODE AND NOT CMAKE_CROSSCOMPILING)
endif ()
endif ()
if (ziti_DEVELOPER_MODE)
find_program(CODESPELL codespell)
if (CODESPELL)
add_custom_target(codespell
COMMENT "check spelling (settings in .codespellrc)"
COMMAND ${CODESPELL}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
USES_TERMINAL
)
message(NOTICE "dev mode: use codespell target to check spelling")
else ()
message(NOTICE "codespell not found: 'codespell' target is not available (pip install codespell)")
endif ()
endif ()
if (ziti-sdk_IS_TOP_LEVEL AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/local.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/local.cmake")
endif ()