mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 23:05:29 +00:00
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 <aconole@redhat.com> Signed-off-by: Chandan Somani <csomani@redhat.com> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
This commit is contained in:
committed by
Eelco Chaudron
parent
d25c6bd8df
commit
9a50170a80
@@ -412,6 +412,7 @@ def check_spelling(line, comment):
|
|||||||
words = words.replace(':', ' ').split(' ')
|
words = words.replace(':', ' ').split(' ')
|
||||||
|
|
||||||
flagged_words = []
|
flagged_words = []
|
||||||
|
num_suggestions = 3
|
||||||
|
|
||||||
for word in words:
|
for word in words:
|
||||||
skip = False
|
skip = False
|
||||||
@@ -442,6 +443,8 @@ def check_spelling(line, comment):
|
|||||||
if len(flagged_words) > 0:
|
if len(flagged_words) > 0:
|
||||||
for mistake in flagged_words:
|
for mistake in flagged_words:
|
||||||
print_warning("Possible misspelled word: \"%s\"" % mistake)
|
print_warning("Possible misspelled word: \"%s\"" % mistake)
|
||||||
|
print("Did you mean: ",
|
||||||
|
spell_check_dict.suggest(mistake)[:num_suggestions])
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user