All, I've been using 'codespell' to find typos in several projects for a long time, via ad-hoc syntax-check rules in cfg.mk. I tried to clean up the rule and make it generic enough to be useful everywhere. I've pushed the attached patch, which includes some hints for cfg.mk configuration to avoid false positives. Every project seem to have a couple of small strings that trigger false positives, but I've not found any least common denominator so it seems simplest to silence this per project. I've noticed that newer versions of codespell is better than older versions at spotting various kind of typos.
/Simon
From fe06b2bec549036c942002f59393cc22e1d79cd7 Mon Sep 17 00:00:00 2001 From: Simon Josefsson <si...@josefsson.org> Date: Thu, 27 Mar 2025 19:45:30 +0100 Subject: [PATCH] maintainer-makefile: Check spelling using 'codespell'. * top/maint.mk (sc_codespell): Add. --- ChangeLog | 5 +++++ top/maint.mk | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index d60af23955..a6b62b9f44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-03-27 Simon Josefsson <si...@josefsson.org> + + maintainer-makefile: Check spelling using 'codespell'. + * top/maint.mk (sc_codespell): Add. + 2025-03-24 Paul Eggert <egg...@cs.ucla.edu> same-inode: don't assume memory objects have ino diff --git a/top/maint.mk b/top/maint.mk index 8c9fff55ab..4ac59914c8 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -1815,6 +1815,21 @@ sc_indent: exit 1; } || :; \ fi +# Check code spelling. +# Example 'cfg.mk' settings for inspiration: +# codespell_ignore_words_list = foo +# exclude_file_name_regexp--sc_codespell = ^po/.*.po|doc/.*.pdf$$ +# codespell_extra_args = --summary --count +# codespell_args = --ignore-words=doc/my-codespell-ignores.txt +codespell_args ?= --ignore-words-list $(codespell_ignore_words_list) \ + $(codespell_extra_args) +sc_codespell: + @if ! command -v codespell > /dev/null; then \ + echo 1>&2 '$(ME): sc_codespell: codespell is missing'; \ + else \ + codespell $(codespell_args) $$($(VC_LIST_EXCEPT)); \ + fi + # If you want to set UPDATE_COPYRIGHT_* environment variables, # put the assignments in this variable. update-copyright-env ?= -- 2.49.0
signature.asc
Description: PGP signature