From 9a50170a805ab9f70a78d1b1ce5c56ec44b64886 Mon Sep 17 00:00:00 2001 From: Chandan Somani Date: Fri, 7 Jul 2023 16:07:57 -0400 Subject: [PATCH] checkpatch: Add suggestions to the spell checker. This will be useful for correcting possible spelling mistakes with ease. Suggestions limited to 3 at first, but can be made configurable in the future. Acked-by: Aaron Conole Signed-off-by: Chandan Somani Signed-off-by: Eelco Chaudron --- utilities/checkpatch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index acf9a0102..e5d5029f2 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -412,6 +412,7 @@ def check_spelling(line, comment): words = words.replace(':', ' ').split(' ') flagged_words = [] + num_suggestions = 3 for word in words: skip = False @@ -442,6 +443,8 @@ def check_spelling(line, comment): if len(flagged_words) > 0: for mistake in flagged_words: print_warning("Possible misspelled word: \"%s\"" % mistake) + print("Did you mean: ", + spell_check_dict.suggest(mistake)[:num_suggestions]) return True