mirror of
https://github.com/openziti/ziti-sdk-c.git
synced 2026-11-15 20:53:50 +00:00
add codespell integration for spelling checks in dev mode and CI
This commit is contained in:
@@ -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
|
||||
@@ -16,5 +16,3 @@ jobs:
|
||||
|
||||
- name: Run code spelling check
|
||||
uses: codespell-project/actions-codespell@v2
|
||||
with:
|
||||
ignore_words_list: controll,mapp,tolen,unstalled
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 ()
|
||||
|
||||
Reference in New Issue
Block a user