Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753249AbcDURGc (ORCPT ); Thu, 21 Apr 2016 13:06:32 -0400 Received: from smtprelay0087.hostedemail.com ([216.40.44.87]:33308 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752389AbcDURGb (ORCPT ); Thu, 21 Apr 2016 13:06:31 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3871:3872:3874:4321:5007:7903:10004:10400:10848:11232:11657:11658:11783:11914:12043:12517:12519:12679:12740:13069:13161:13229:13311:13357:13439:13894:14181:14659:21080:30054:30056:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: stop39_3885f33648b04 X-Filterd-Recvd-Size: 2424 Message-ID: <1461258387.1918.18.camel@perches.com> Subject: Re: [PATCH 2/3] checkpatch: testing more config for Kconfig help text From: Joe Perches To: Yingjoe Chen , Andy Whitcroft Cc: linux-kernel@vger.kernel.org, srv_heupstream@mediatek.com Date: Thu, 21 Apr 2016 10:06:27 -0700 In-Reply-To: <1461245285-14918-2-git-send-email-yingjoe.chen@mediatek.com> References: <1461245285-14918-1-git-send-email-yingjoe.chen@mediatek.com> <1461245285-14918-2-git-send-email-yingjoe.chen@mediatek.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1478 Lines: 40 On Thu, 2016-04-21 at 21:28 +0800, Yingjoe Chen wrote: > Current help text check only check a config option if it is followed > by another config. > Adding check for help text if the next entry is menuconfig, choice/ > endchoice, comment, menu/endmenu, if/endif, source or end of file. [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -2563,6 +2563,12 @@ sub process { > ? next if ($f =~ /^-/); > ? last if (!$file && $f =~ /^\@\@/); > ? > + if ($f !~ /^[+\- ]/) { > + # End of file > + $is_end = 1; > + last; > + } > + > ? if ($lines[$ln - 1] =~ /^\+\s*(?:bool|tristate)\s*\"/) { > ? $is_start = 1; > ? } elsif ($lines[$ln - 1] =~ /^\+\s*(?:---)?help(?:---)?$/) { > @@ -2573,7 +2579,10 @@ sub process { > ? $f =~ s/#.*//; > ? $f =~ s/^\s+//; > ? next if ($f =~ /^$/); > - if ($f =~ /^\s*config\s/) { > + if ($f =~ /^\s*config\s/ || $f =~ /^\s*menuconfig\s/ || $f =~ /^\s*choice\s/ || > + ????$f =~ /^\s*endchoice$/ || $f =~ /^\s*comment\s/ || $f =~ /^\s*menu\s/ || > + ????$f =~ /^\s*endmenu$/ || $f =~ /^\s*if\s/ || $f =~ /^\s*endif$/ || > + ????$f =~ /^\s*source\s/) { > ? $is_end = 1; > ? last; > ? } This seems relatively verbose. Also, because there's a substitution above that strips leading spaces, the "^\s*" uses are unnecessary and can be simplified to ^ Maybe: if ($f =~ /^(?:config\s|menuconfig\s|choice\s|endchoice\s*$|comment\s|menu\s|endmenu$|if\s|endif\s*$|source\s)