From 2c620029905d1d8a6b7a1d1861c12feaf3b4087e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 8 Oct 2007 21:20:24 -0300 Subject: Runs checkpatch.pl during make commit From: Mauro Carvalho Chehab checkpatch.pl is the official tool for checking CodingStyle violations on kernel patches. This changeset makes it run every time a "make commit" is called. This allows detecting CodingStyle violations during development phase. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/prep_commit_msg.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'v4l/scripts/prep_commit_msg.pl') diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl index cb0740a5d..1316a7c44 100755 --- a/v4l/scripts/prep_commit_msg.pl +++ b/v4l/scripts/prep_commit_msg.pl @@ -49,8 +49,27 @@ if ($user eq "") { $user = "$ENV{USER} <>"; } +$checkpatch=$ENV{CHECKPATCH}; + +if (!$checkpatch) { + $checkpatch="/lib/modules/`uname -r`/build/scripts/checkpatch.pl"; +} + print "# Added/removed/changed files:\n"; system "hg $diff | diffstat -p1 -c"; + +open IN,"hg $diff | $checkpatch -q --nosignoff --notree -|"; +my $err=0; +while () { + if (!$err) { + print "#\n# WARN: checkpatch.pl returned some errors. Please fix.\n"; + $err=1; + } + print "# $_"; +} +close IN; + + if (-s $autopatch) { print "#\n# Note, a problem with your patch was detected! These changes were made\n"; print "# automatically: $autopatch\n"; -- cgit v1.2.3