Skip to content

Commit b9fb2b4

Browse files
authored
automatic spellcheck by codespell for common misspellings. (#4997)
* automatic spellcheck by codespell for common misspellings. Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com> * remove indention from the whitelist. Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com> --------- Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
1 parent b0a330a commit b9fb2b4

File tree

6 files changed

+35
-4
lines changed

6 files changed

+35
-4
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@ jobs:
3737
- name: Lint
3838
run: make lint
3939

40+
spellcheck:
41+
runs-on: ubuntu-22.04
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
46+
- name: Setup Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: '3.10'
50+
51+
- name: Install dependencies with pip
52+
run: pip install --no-warn-script-location --user -r requirements.txt -c constraints.txt
53+
54+
- name: Spellcheck
55+
run: make spellcheck
56+
4057
build:
4158
needs: [test, lint]
4259
runs-on: ubuntu-22.04

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ lint:
2828
test:
2929
doc8 --ignore D001 --ignore-path build
3030

31+
spellcheck:
32+
git ls-files '*.md' '*.rst' | xargs codespell --ignore-words=codespell_whitelist.txt --skip="source/Releases/*"
33+
3134
linkcheck:
3235
$(BUILD) -b linkcheck $(OPTS) $(SOURCE) $(LINKCHECKDIR)
3336
@echo

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ For local testing of the current tree use:
5151

5252
`sensible-browser build/html/index.html`
5353

54+
### Spelling Check
55+
56+
To check the spelling, use:
57+
58+
`make spellcheck`
59+
60+
> [!NOTE]
61+
> If that detects specific words that need to be ignored, add it to [codespell_whitelist](./codespell_whitelist.txt).
62+
5463
### Deployment test
5564

5665
To test building the multisite version deployed to the website use:

codespell_whitelist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
empy

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
codespell
12
doc8
23
docutils
34
pip

source/The-ROS2-Project/Contributing/Code-Style-Language-Versions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ Pointer Syntax Alignment
166166
Class Privacy Keywords
167167
~~~~~~~~~~~~~~~~~~~~~~
168168

169-
* Do not put 1 space before ``public:``, ``private:``, or ``protected:``, it is more consistent for all indentions to be a multiple of 2
169+
* Do not put 1 space before ``public:``, ``private:``, or ``protected:``, it is more consistent for all indentations to be a multiple of 2
170170

171-
* rationale: most editors don't like indentions which are not a multiple of the (soft) tab size
171+
* rationale: most editors don't like indentations which are not a multiple of the (soft) tab size
172172
* Use zero spaces before ``public:``, ``private:``, or ``protected:``, or 2 spaces
173173
* If you use 2 spaces before, indent other class statements by 2 additional spaces
174174
* Prefer zero spaces, i.e. ``public:``, ``private:``, or ``protected:`` in the same column as the class
@@ -254,7 +254,7 @@ This is **not** OK:
254254
}
255255

256256

257-
Use open braces rather than excessive indention, e.g. for distinguishing constructor code from constructor initializer lists
257+
Use open braces rather than excessive indentation, e.g. for distinguishing constructor code from constructor initializer lists
258258

259259
This is OK:
260260

@@ -364,7 +364,7 @@ Since there is not an existing CMake style guide we will define our own:
364364
* Use ``snake_case`` identifiers (variables, functions, macros).
365365
* Use empty ``else()`` and ``end...()`` commands.
366366
* No whitespace before ``(``\ 's.
367-
* Use two spaces of indention, do not use tabs.
367+
* Use two spaces of indentation, do not use tabs.
368368
* Do not use aligned indentation for parameters of multi-line macro invocations. Use two spaces only.
369369
* Prefer functions with ``set(PARENT_SCOPE)`` to macros.
370370
* When using macros prefix local variables with ``_`` or a reasonable prefix.

0 commit comments

Comments
 (0)