Re: [ovs-dev] [PATCH 1/3] checkpatch: reorganize flagged words using a list

2023-06-30 Thread Aaron Conole
Chandan Somani  writes:

> A list approach lets us single out each flagged word and
> provide more useful details, like spelling suggestions.
> This will be used in an upcoming patch.
>
> Signed-off-by: Chandan Somani 
> ---
>  utilities/checkpatch.py | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
> index 0d30b71b5..bc5f696bb 100755
> --- a/utilities/checkpatch.py
> +++ b/utilities/checkpatch.py
> @@ -411,6 +411,8 @@ def check_spelling(line, comment):
>  words = filter_comments(line, True) if comment else line
>  words = words.replace(':', ' ').split(' ')
>  
> +flagged_words = []
> +
>  for word in words:
>  skip = False
>  strword = re.subn(r'\W+', '', word)[0].replace(',', '')
> @@ -435,9 +437,13 @@ def check_spelling(line, comment):
>  skip = True
>  
>  if not skip:
> -print_warning("Check for spelling mistakes (e.g. \"%s\")"
> -  % strword)
> -return True
> +flagged_words.append(strword)
> +
> +if len(flagged_words > 0):

This statement doesn't look right.  I think you meant:

if len(flagged_words) > 0:

> +for mistake in flagged_words:
> +print_warning("Possible misspelled word: \"%s\"" % mistake)
> +
> +return True
>  
>  return False

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 1/3] checkpatch: reorganize flagged words using a list

2023-06-29 Thread Chandan Somani
A list approach lets us single out each flagged word and
provide more useful details, like spelling suggestions.
This will be used in an upcoming patch.

Signed-off-by: Chandan Somani 
---
 utilities/checkpatch.py | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index 0d30b71b5..bc5f696bb 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -411,6 +411,8 @@ def check_spelling(line, comment):
 words = filter_comments(line, True) if comment else line
 words = words.replace(':', ' ').split(' ')
 
+flagged_words = []
+
 for word in words:
 skip = False
 strword = re.subn(r'\W+', '', word)[0].replace(',', '')
@@ -435,9 +437,13 @@ def check_spelling(line, comment):
 skip = True
 
 if not skip:
-print_warning("Check for spelling mistakes (e.g. \"%s\")"
-  % strword)
-return True
+flagged_words.append(strword)
+
+if len(flagged_words > 0):
+for mistake in flagged_words:
+print_warning("Possible misspelled word: \"%s\"" % mistake)
+
+return True
 
 return False
 
-- 
2.26.3

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev