2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-04 00:05:15 +00:00

checkpatch.py: Don't run subject checks in source-file mode.

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.

Additionally, introduce two simple tests to verify that
the source file mode still functions.

Fixes: 1b8fa4a66a ("checkpatch: Add checks for the subject line.")
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
This commit is contained in:
Aaron Conole
2025-03-27 11:10:15 -04:00
parent 6403a49f3e
commit f141b7c352
2 changed files with 74 additions and 3 deletions

View File

@@ -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()