diff mbox series

[ovs-dev,2/3] checkpatch: add suggestions to the spell checker

Message ID 20230707200758.45032-2-csomani@redhat.com
State Accepted
Commit 9a50170a805ab9f70a78d1b1ce5c56ec44b64886
Headers show
Series [ovs-dev,v2,1/3] checkpatch: reorganize flagged words using a list | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Chandan Somani July 7, 2023, 8:07 p.m. UTC
This will be useful for correcting possible spelling
mistakes with ease. Suggestions limited to 3 at first,
but configurable in the future.

Signed-off-by: Chandan Somani <csomani@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
---
 utilities/checkpatch.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Eelco Chaudron July 11, 2023, 7:11 a.m. UTC | #1
On 7 Jul 2023, at 22:07, Chandan Somani wrote:

> This will be useful for correcting possible spelling
> mistakes with ease. Suggestions limited to 3 at first,
> but configurable in the future.
>
> Signed-off-by: Chandan Somani <csomani@redhat.com>
> Acked-by: Aaron Conole <aconole@redhat.com>
> ---

This looks good, thank Chandan.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
diff mbox series

Patch

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