Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1071664ybl; Tue, 3 Dec 2019 00:57:38 -0800 (PST) X-Google-Smtp-Source: APXvYqzqo3g2+xIVxCtDxTYWYJFs3jY0QoPGdbsAKXEOrLlloeObxPXKw3oJvnHpkrYjpG4N6QB/ X-Received: by 2002:a9d:6315:: with SMTP id q21mr2101846otk.15.1575363458190; Tue, 03 Dec 2019 00:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575363458; cv=none; d=google.com; s=arc-20160816; b=xHjGcZdETvmECri+HiOZervOoLWGPGMw/pK3+TYb6Ii7YFFiTbhDrph7LSb9Kp5+kT LipV5P0scJFM6Z724Bk1HUyVdWGxGuvq1XexQxEUULQx/ocFXW8SWeW6HlJhsHA+inBV 7pRhiDfkPQSJBceeufOoUH7z06QQx/wB2y7k8bdT6dZiyY9JJqqzRuIVY4ErNozt2exD aENiP9zYuPbST81clIo/xhxCVKp8NZaqVTR4F6OLeIfyaXZS12TiS5eWR8f9qQ24g8Zr Rh29+zf1PZ34YqyrY6Fo5cl4wcdQsMI4mvlbmIDq1sHNSIdrTe4Nybpl5r7jExTBbfP0 8IzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=qct30AswFjJ7agVdLp5yKPtwvF7V9ZXZl9j71MiF/Vo=; b=TXp4hNhE1MiZTb7XJ5rgdSFur5WxDiRv0rYEI06xXpJPwmzodYqc8sK9vBx136gdgw 0B0UMJECUAFwZjSK+y/lYWJSZeeWGnWRxpTSnyOsFTLwbD4bLvdJtdoQkEurzrx4cRPW woowzw6CiG7QgSskKAxSwmJ+1ldWEnj0hfYg6gs8y1qbck0lO0keBRbkiGjGPkqeVCvl JQ+ooVTZDfUdKWB9RziVFRWsvQn16G2HiFJhFzFjmycaTyaUJVYWhLys+MqWrmNr5MT/ rTqdlcTIGZWRJeJ6FFvX8fumNI4QgWIVe989XEoPsNobAST3yIDAetlyOW8VsiWn+US2 T6iQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p28si893742oth.296.2019.12.03.00.57.26; Tue, 03 Dec 2019 00:57:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726189AbfLCI4w (ORCPT + 99 others); Tue, 3 Dec 2019 03:56:52 -0500 Received: from smtprelay0117.hostedemail.com ([216.40.44.117]:37562 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725773AbfLCI4w (ORCPT ); Tue, 3 Dec 2019 03:56:52 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id A8A5718037C64; Tue, 3 Dec 2019 08:56:50 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2828:2908:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3871:3872:3874:4321:4605:5007:7875:10004:10400:10450:10455:10848:11232:11658:11914:12043:12297:12663:12740:12760:12895:13019:13069:13311:13357:13439:14181:14659:14721:19904:19999:21080:21433:21451:21627:21740:21939:30034:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: taste11_3b9cb87ae0b31 X-Filterd-Recvd-Size: 2898 Received: from XPS-9350.home (unknown [47.151.135.224]) (Authenticated sender: joe@perches.com) by omf18.hostedemail.com (Postfix) with ESMTPA; Tue, 3 Dec 2019 08:56:49 +0000 (UTC) Message-ID: Subject: Re: [PATCH] checkpatch: Look for Kconfig indentation errors From: Joe Perches To: Krzysztof Kozlowski Cc: Jani Nikula , Andy Whitcroft , "linux-kernel@vger.kernel.org" , Pierre-Louis Bossart Date: Tue, 03 Dec 2019 00:56:16 -0800 In-Reply-To: References: <1574906800-19901-1-git-send-email-krzk@kernel.org> <87a78gnyaz.fsf@intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-12-03 at 16:40 +0800, Krzysztof Kozlowski wrote: > On Thu, 28 Nov 2019 at 17:35, Joe Perches wrote: > > On Thu, 2019-11-28 at 11:29 +0200, Jani Nikula wrote: > > > On Thu, 28 Nov 2019, Krzysztof Kozlowski wrote: > > > > Kconfig should be indented with one tab for first level and tab+2 spaces > > > > for second level. There are many mixups of this so add a checkpatch > > > > rule. > > > > > > > > Signed-off-by: Krzysztof Kozlowski > > > > > > I agree unifying the indentation is nice, and without something like > > > this it'll start bitrotting before Krzysztof's done fixing them all... I > > > think there's been quite a few fixes merged lately. > > > > > > I approve of the idea, but I'm clueless about the implementation. > > > > I think that a grammar, or a least an array of words > > that are supposed to start on a tab should be used here. > > This won't work for wrong indentation of help text. This is quite > popular Kconfig indentation violation so worth checking. I can then > check for: > 1. any white-space violations before array of Kconfig words - that > 2. spaces mixed with tab before any text, > 3. just spaces before any text, > 4. tab + wrong number of spaces before any text. > > It would look like: > + if ($realfile =~ /Kconfig/ && > + (($rawline =~ > /^\+\s+(?:config|menuconfig|choice|endchoice|if|endif|menu|endmenu|source|bool|tristate|prompt|help|---help---|depends|select)\b/ Many of these are not correct. config, menuconfig, choice, endchoice, source are primarily used at the beginning of a line. if is odd as it's a logical block or test It really needs a lex grammar to work properly.