From d758edbf83c2c1126aecf6a22fc1446baaa72b4a Mon Sep 17 00:00:00 2001 From: Tomoya Fujita Date: Wed, 5 Feb 2025 21:48:03 -0800 Subject: [PATCH] automatic spelling check by sphinx-spelling ext. Signed-off-by: Tomoya Fujita --- Makefile | 6 ++++++ conf.py | 8 ++++++++ docker/image/Dockerfile | 3 ++- requirements.txt | 1 + source/spelling_wordlist.txt | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 source/spelling_wordlist.txt diff --git a/Makefile b/Makefile index 5014099150f..0d194ec6545 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ SOURCE = source OUT = build LINKCHECKDIR = $(OUT)/linkcheck +SPELLCHECKDIR = $(OUT)/spellcheck PYTHON := python3 ifeq ($(OS),Windows_NT) PYTHON := python @@ -28,6 +29,11 @@ lint: test: doc8 --ignore D001 --ignore-path build +spellcheck: + $(BUILD) -b spelling $(OPTS) $(SOURCE) $(SPELLCHECKDIR) + @echo + @echo "Check finished. Report is in $(SPELLCHECKDIR)." + linkcheck: $(BUILD) -b linkcheck $(OPTS) $(SOURCE) $(LINKCHECKDIR) @echo diff --git a/conf.py b/conf.py index d8b2b0487f3..72c2a5bd025 100644 --- a/conf.py +++ b/conf.py @@ -84,8 +84,16 @@ 'sphinx_rtd_theme', 'sphinx_sitemap_ros', 'sphinxcontrib.mermaid', + "sphinxcontrib.spelling", ] +# Spelling configuration +spelling_show_suggestions = False +spelling_ignore_acronyms = True +spelling_ignore_case = True +spelling_ignore_digits = True +#spelling_word_list_filename = "spelling_wordlist.txt" + # Intersphinx mapping intersphinx_mapping = { diff --git a/docker/image/Dockerfile b/docker/image/Dockerfile index 28ee3e2bea7..641043af840 100644 --- a/docker/image/Dockerfile +++ b/docker/image/Dockerfile @@ -20,7 +20,8 @@ RUN apt-get update && \ graphviz \ locales \ make \ - python3-pip && \ + python3-pip \ + enchant-2 && \ rm -rf /var/lib/apt/lists/* RUN locale-gen en_US en_US.UTF-8 diff --git a/requirements.txt b/requirements.txt index 2406de14841..37cb03fd4f6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ sphinx-multiversion sphinx-rtd-theme sphinx-tabs sphinxcontrib-mermaid +sphinxcontrib.spelling diff --git a/source/spelling_wordlist.txt b/source/spelling_wordlist.txt new file mode 100644 index 00000000000..9ac022bb145 --- /dev/null +++ b/source/spelling_wordlist.txt @@ -0,0 +1 @@ +rviz