From 2489007e7d740ccbc3e0a202914e243ad5178787 Mon Sep 17 00:00:00 2001 From: codeworkx Date: Sat, 22 Sep 2012 09:48:20 +0200 Subject: merge opensource jb u5 Change-Id: I1aaec157aa196f3448eff8636134fce89a814cf2 --- scripts/checkpatch.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'scripts') diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 0b3e35c..9ada45c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -16,6 +16,7 @@ use Getopt::Long qw(:config no_auto_abbrev); my $quiet = 0; my $tree = 1; +my $chk_subject = 1; my $chk_signoff = 1; my $chk_patch = 1; my $tst_only; @@ -98,6 +99,7 @@ if (-f $conf) { GetOptions( 'q|quiet+' => \$quiet, 'tree!' => \$tree, + 'subject!' => \$chk_subject, 'signoff!' => \$chk_signoff, 'patch!' => \$chk_patch, 'emacs!' => \$emacs, @@ -340,6 +342,7 @@ sub deparenthesize { return $string; } +$chk_subject = 0 if ($file); $chk_signoff = 0 if ($file); my @dep_includes = (); @@ -1533,6 +1536,26 @@ sub process { } } +# Check for subject: + if ($chk_subject && $line =~ /^Subject: \[PATCH\] (\s*)(\[.*\])?/i) { + my $space_before = $1; + my $brace_usage = $2; + if (defined $space_before && $space_before ne "") { + WARN("BAD_SUBJECT", + "Remove leading whitespace on subject\n" . $herecurr); + } + if (defined $brace_usage && $brace_usage ne "") { + WARN("BAD_SUBJECT", + "Avoid using '[xxx]' on subject. Use 'xxx:' instead\n" . $herecurr); + } + if ($lines[$linenr] !~ /^$/) { + ERROR("MISSING_BLANK_LINE_AFTER_SUBJECT", + "Missing blank line after Subject: line\n" . $herecurr); + } + } + + #($line =~ /^Subject:/i) && ? 1 : 0; + # Check the patch for a signoff: if ($line =~ /^\s*signed-off-by:/i) { $signoff++; -- cgit v1.1