mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, apw@canonical.com,
	Olof Johansson <olof@lixom.net>
Subject: [PATCH] checkpatch: warn on found Change-Id lines
Date: Sun,  9 Oct 2011 22:56:56 -0700	[thread overview]
Message-ID: <1318226216-5317-1-git-send-email-olof@lixom.net> (raw)

Some external projects use repo, which uses a special-format Change-Id
field in the commit message for some internal bookkeeping (to re-associate
patches back to review entries, etc). Sometimes they sneak into patches
going upstream, which is embarrassing for the developer, and annoying
for the maintainer.

Add checking for these to checkpatch, to catch them before
posting. Provide a way to disable the check to keep checkpatch useful
for intra-project use.

Signed-off-by: Olof Johansson <olof@lixom.net>
---

 scripts/checkpatch.pl |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3dfc471..bac1c93 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -18,6 +18,7 @@ my $quiet = 0;
 my $tree = 1;
 my $chk_signoff = 1;
 my $chk_patch = 1;
+my $chk_changeid = 1;
 my $tst_only;
 my $emacs = 0;
 my $terse = 0;
@@ -45,6 +46,7 @@ Options:
   -q, --quiet                quiet
   --no-tree                  run without a kernel tree
   --no-signoff               do not check for 'Signed-off-by' line
+  --no-change-id             don't complain about 'Change-Id' lines
   --patch                    treat FILE as patchfile (default)
   --emacs                    emacs compile window format
   --terse                    one line per report
@@ -99,6 +101,7 @@ GetOptions(
 	'q|quiet+'	=> \$quiet,
 	'tree!'		=> \$tree,
 	'signoff!'	=> \$chk_signoff,
+	'change-id!'	=> \$chk_changeid,
 	'patch!'	=> \$chk_patch,
 	'emacs!'	=> \$emacs,
 	'terse!'	=> \$terse,
@@ -341,6 +344,7 @@ sub deparenthesize {
 }
 
 $chk_signoff = 0 if ($file);
+$chk_changeid = 0 if ($file);
 
 my @dep_includes = ();
 my @dep_functions = ();
@@ -1578,6 +1582,10 @@ sub process {
 				}
 			}
 		}
+# Check for Change-Id lines:
+		if ($line =~ /^\s*change-id:/i && $chk_changeid) {
+			ERROR("CHANGE_ID", "Found Change-Id line\n", $herecurr);
+		}
 
 # Check for wrappage within a valid hunk of the file
 		if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
-- 
1.7.4.1


             reply	other threads:[~2011-10-10  5:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-10  5:56 Olof Johansson [this message]
2011-10-10 17:09 ` Joe Perches
2011-10-10 22:10   ` Andrew Morton
2011-10-10 22:32     ` [PATCH] checkpatch: Add a --strict check for utf-8 in commit logs Joe Perches
2011-10-10 22:42       ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318226216-5317-1-git-send-email-olof@lixom.net \
    --to=olof@lixom.net \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®