Skip to contentSkip to conversation

checkpatch: Add a check for forbidden tags in the git log

PATCH New Alban Bedel 2 participants 2 messages Oct 7, 2014 – Oct 20, 2014 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: Add a check for forbidden tags in the git log

After doing this error too many times myself add a check for left over tags from gerrit and co.

---
 scripts/checkpatch.pl | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
scripts/checkpatch.pl +15 -0
index 74db2e2..3f1dedf 100755
@@ -351,6 +351,15 @@ our $signature_tags = qr{(?xi:
 	Cc:
 )};
 
+our $forbidden_tags = qr{(?xi:
+	Bug[=:]|
+	Test[=:]|
+	Issue:|
+	Change-Id:|
+	Review URL:|
+	Reviewed-On:
+)};
+
 our @typeList = (
 	qr{void},
 	qr{(?:unsigned\s+)?char},
@@ -1894,6 +1903,12 @@ sub process {
 			}
 		}
 
+# Check for left over tags
+		if ($line =~ /^\s*$forbidden_tags/i) {
+			WARN("FORBIDDEN_TAGS",
+			     "Do not leave extra tags (internal review marker, etc)\n" . $herecurr)
+		}
+
 # Check for wrappage within a valid hunk of the file
 		if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
 			ERROR("CORRUPTED_PATCH",
Signature · 1 line
2.1.1
#1 lore raw

PATCH 1/1 checkpatch: Add a check for forbidden tags in the git log

Quoted 31 lines · Alban Bedel

After doing this error too many times myself add a check for left over tags from gerrit and co.

---
 scripts/checkpatch.pl | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
scripts/checkpatch.pl +9 -0
index 74db2e2..3f1dedf 100755
@@ -351,6 +351,15 @@ our $signature_tags = qr{(?xi:
 	Cc:
 )};
 
+our $forbidden_tags = qr{(?xi:
+	Bug[=:]|
+	Test[=:]|
+	Issue:|
+	Change-Id:|
+	Review URL:|
+	Reviewed-On:
+)};
+
 our @typeList = (
 	qr{void},
 	qr{(?:unsigned\s+)?char},
@@ -1894,6 +1903,12 @@ sub process {
 			}
 		}

scripts/checkpatch.pl sub process { · line 1914

Quoted 10 lines
scripts/checkpatch.pl +6 -0
 
+# Check for left over tags
+		if ($line =~ /^\s*$forbidden_tags/i) {
+			WARN("FORBIDDEN_TAGS",
+			     "Do not leave extra tags (internal review marker, etc)\n" . $herecurr)
+		}
+
 # Check for wrappage within a valid hunk of the file
 		if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
 			ERROR("CORRUPTED_PATCH",

Since we last re-synced checkpatch.pl, there's a check for just Change-Id now. I would suggest bringing this up with upstream to also ignore these other tags as it's a more generic problem. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141020/7d6f42f3/attachment.pgp>