Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/dictionaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check Dictionaries

on:
push:
paths:
- 'codespell_dictionary.txt'
- 'codespell_whitelist.txt'
pull_request:
paths:
- 'codespell_dictionary.txt'
- 'codespell_whitelist.txt'

jobs:
check-dictionaries:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run make check-dictionaries
run: |
make check-dictionaries || (echo "check-dictionaries failed, run: make sort-dictionaries")
24 changes: 23 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ endif
BUILD = $(PYTHON) -m sphinx
OPTS =-c . -W # Treat warnings as errors

DICTIONARIES := codespell_dictionary.txt codespell_whitelist.txt

help:
@$(BUILD) -M help "$(SOURCE)" "$(OUT)" $(OPTS)
@echo " multiversion to build documentation for all branches"
Expand All @@ -34,9 +36,29 @@ test-tools:
spellcheck:
git ls-files '*.md' '*.rst' | xargs codespell --config codespell.cfg

check-dictionaries:
@echo "Checking dictionaries..."
@for dict in $(DICTIONARIES); do \
echo "Checking $$dict..."; \
if grep -E -n "^\s*$$|\s$$|^\s" $$dict; then \
echo "Dictionary $$dict contains empty lines or leading/trailing spaces, triming..."; \
sed -E -i.bak -e 's/^[[:space:]]+//; s/[[:space:]]+$$//; /^$$/d' $$dict && rm $$dict.bak; \
fi; \
done

sort-dictionaries:
@echo "Sorting dictionaries..."
@for dict in $(DICTIONARIES); do \
echo "Sorting $$dict..."; \
if ! LC_ALL=C sort -f -b -c $$dict; then \
echo "Dictionary $$dict is not sorted, sorting..."; \
LC_ALL=C sort -f -b -o $$dict $$dict; \
fi; \
done

linkcheck:
$(BUILD) -b linkcheck $(OPTS) $(SOURCE) $(LINKCHECKDIR)
@echo
@echo "Check finished. Report is in $(LINKCHECKDIR)."

.PHONY: help Makefile multiversion test test-unit linkcheck
.PHONY: help Makefile multiversion test test-unit linkcheck lint spellcheck check-dictionaries sort-dictionaries
6 changes: 3 additions & 3 deletions codespell_dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
amnet->ament
amemt->ament
amentt->ament
amnet->ament
caktin->catkin
catikn->catkin
catin->catkin
caktin->catkin
colcno->colcon
colcn->colcon
colcno->colcon
colcom->colcon
colconb->colcon
colconm->colcon
Expand Down
4 changes: 2 additions & 2 deletions codespell_whitelist.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
empy
ws
lets
jupyter
lets
ws
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ To do this, add it to the `codespell_whitelist <https://github.com/ros2/ros2_doc
.. code-block:: text

empy
ws
lets
jupyter
lets
ws

To include custom corrections that ``codespell`` should apply, you can add them to the `codespell_dictionary <https://github.com/ros2/ros2_documentation/blob/{REPOS_FILE_BRANCH}/codespell_dictionary.txt>`_ file as follows:

Expand All @@ -199,6 +199,11 @@ To include custom corrections that ``codespell`` should apply, you can add them
rosabg->rosbag
rosdistroy->rosdistro

To check the dictionaries, you can run the ``make check-dictionaries`` command.
This will check the blank lines and leading/trailing spaces in the dictionaries.
If it complains about the dictionaries, you can run the ``make sort-dictionaries`` command.
This command will automatically modify the dictionaries if any issues are found.

Migrating Pages from the ROS Wiki
---------------------------------

Expand Down