On 3/25/25 16:11, Aaron Conole via dev wrote:
> Checkpatch has the ability to scan source files rather than exclusively
> scanning patch files.  In this mode, some checks get disabled (ex: all
> of the header and commit message parsing) and the display modes are
> adjusted to simply print the file and line, rather than including the patch
> line details.
> 
> When checkpatch was updated for subject parsing, it was inadvertently
> ignoring the source file mode.  This means any checks run against a source
> file will always print a bogus subject suggestion, and warning.  Fix this
> by not printing these warnings when in source file mode.  This should have
> no effect on checkpatch against actual patch files.
> 
> Fixes: 1b8fa4a66aa4 ("checkpatch: Add checks for the subject line.")
> Signed-off-by: Aaron Conole <[email protected]>
> ---
>  utilities/checkpatch.py | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Should we add a unit test for this to avoid regressing again?

Best regards, Ilya Maximets.

> 
> diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
> index 3c09b94cf5..b356731ea4 100755
> --- a/utilities/checkpatch.py
> +++ b/utilities/checkpatch.py
> @@ -1189,10 +1189,12 @@ def ovs_checkpatch_file(filename):
>          else:
>              mail.add_header('Subject', sys.argv[-1])
>  
> -        print("Subject missing! Your provisional subject is",
> -              mail['Subject'])
> +        if not checking_file:
> +            print("Subject missing! Your provisional subject is",
> +                  mail['Subject'])
>  
> -    if run_subject_checks('Subject: ' + mail['Subject'], spellcheck):
> +    if not checking_file and run_subject_checks('Subject: ' + 
> mail['Subject'],
> +                                                spellcheck):
>          result = True
>  
>      ovs_checkpatch_print_result()

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to