From dc3f3f112c4019f194a41662062d6cadc7cb9416 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Tue, 19 Oct 2021 11:01:29 +1100
Subject: [PATCH] check_spelling: ignore common suffix's when hyphenated

Allow informal convention of adding -ish or -ness onto the end of any word.
This is done a handful of times and seems reasonable to support.
---
 check_source/check_spelling.py          | 10 ++++++++--
 check_source/check_spelling_c_config.py |  5 +++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/check_source/check_spelling.py b/check_source/check_spelling.py
index 6e140e7..704e235 100755
--- a/check_source/check_spelling.py
+++ b/check_source/check_spelling.py
@@ -74,6 +74,7 @@ from check_spelling_c_config import (
     dict_custom,
     dict_ignore,
     dict_ignore_hyphenated_prefix,
+    dict_ignore_hyphenated_suffix,
     files_ignore,
 )
 
@@ -114,8 +115,13 @@ def dictionary_check(w: str) -> bool:
 
             # Allow: `un-word`, `re-word`.
             w_split = w.strip("-").split("-")
-            if w_split and w_split[0].lower() in dict_ignore_hyphenated_prefix:
-                del w_split[0]
+            if len(w_split) > 1:
+                if w_split and w_split[0].lower() in dict_ignore_hyphenated_prefix:
+                    del w_split[0]
+            # Allow: `word-ish`, `word-ness`.
+            if len(w_split) > 1:
+                if w_split and w_split[-1].lower() in dict_ignore_hyphenated_suffix:
+                    del w_split[-1]
 
             for w_sub in w_split:
                 if w_sub:
diff --git a/check_source/check_spelling_c_config.py b/check_source/check_spelling_c_config.py
index f807cbe..1c074e0 100644
--- a/check_source/check_spelling_c_config.py
+++ b/check_source/check_spelling_c_config.py
@@ -450,6 +450,11 @@ dict_ignore_hyphenated_prefix = {
     "un",
 }
 
+dict_ignore_hyphenated_suffix = {
+    "ish",
+    "ness",
+}
+
 files_ignore = {
     "source/tools/utils_doc/rna_manual_reference_updater.py",  # Contains language ID references.
 }
-- 
GitLab