2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

checkpatch: Add check for a Fixes tag.

A new check for common mistakes while formatting a 'Fixes:' tag.

Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Ilya Maximets
2022-07-26 15:29:55 +02:00
parent 6a9ec13aa3
commit 91b41af0d9
2 changed files with 78 additions and 0 deletions

View File

@@ -793,6 +793,8 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None):
re.I | re.M | re.S)
is_gerrit_change_id = re.compile(r'(\s*(change-id: )(.*))$',
re.I | re.M | re.S)
is_fixes = re.compile(r'(\s*(Fixes:)(.*))$', re.I | re.M | re.S)
is_fixes_exact = re.compile(r'^Fixes: [0-9a-f]{12} \(".*"\)$')
tags_typos = {
r'^Acked by:': 'Acked-by:',
@@ -895,6 +897,13 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None):
print_error(
"Remove Gerrit Change-Id's before submitting upstream.")
print("%d: %s\n" % (lineno, line))
elif is_fixes.match(line) and not is_fixes_exact.match(line):
print_error('"Fixes" tag is malformed.\n'
'Use the following format:\n'
' git log -1 '
'--pretty=format:"Fixes: %h (\\\"%s\\\")" '
'--abbrev=12 COMMIT_REF\n')
print("%d: %s\n" % (lineno, line))
elif spellcheck:
check_spelling(line, False)
for typo, correct in tags_typos.items():