summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-04-25 16:31:27 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-04-28 07:54:44 +0000
commit5721f2aceb22e975ba0ca8d7fd7d442472a2c43a (patch)
treef42a42370215a2f9af9d2a66b5ccc4be52948e82
parent5031182ac62cf7d0f13b2c56cbd45fc3ca764934 (diff)
downloadqtrepotools-5721f2aceb22e975ba0ca8d7fd7d442472a2c43a.tar.gz
sanitize-commit: complain about missing Coverity-Id footers
Change-Id: Ib24710488f48b0466fe3c222aad996b506c47494 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
-rwxr-xr-xgit-hooks/sanitize-commit9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit
index 0871b04..dae7174 100755
--- a/git-hooks/sanitize-commit
+++ b/git-hooks/sanitize-commit
@@ -416,6 +416,7 @@ my $inchangelog = 0;
my $doftr = !defined($cfg{footer});
my ($footer, $cherry) = (STS_BLANK, 0);
my ($revert1, $revert2, $nonrevert) = (0, 0, 0);
+my ($coverity, $cid) = (0, 0);
my $msgline = 0;
my %picktos = ();
open MSG, "git cat-file -p ".$sha1." |" or die "cannot run git: $!";
@@ -518,6 +519,8 @@ while (<MSG>) {
}
}
complain_ln("Capitalization of \"Pick-to\" is wrong", "") if (!/^Pick-to:/);
+ } elsif (/^Coverity-Id: /) {
+ $cid = 1;
}
} elsif (/^\[change-?log\]/i) {
$inchangelog = 1;
@@ -556,6 +559,9 @@ while (<MSG>) {
if (!$badurl && /$badurl_rx/o) {
complain_ln("URL pointing to Gerrit or JIRA", "url");
}
+ if (/\b[Cc]overity\b|\b[Cc][Ii][Dd][Ss]?:? *#?[0-9]+/) {
+ $coverity = $lineno;
+ }
check_spelling() if ($spell_check);
check_apple_terminology();
styleFail("Trailing whitespace") if (s/[ \t]+\r?$//);
@@ -574,6 +580,9 @@ if ($badrev && !defined($cfg{revby})) {
if ($badsign) {
do_complain($badsign, "Unnecessary Signed-off-by footer", "", -1);
}
+if ($coverity && !$cid) {
+ do_complain($coverity, "Mention of Coverity without Coverity-Id footer is probably incorrect", "");
+}
if ($with_pickbot) {
if ($havecherry) {
if (%picktos) {