Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1095455ybl; Tue, 3 Dec 2019 01:25:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyMWul+keeRbZq/nwRyKmS1+s031dFg4Ocm4foOyDKfrR3GVSNhB+oiBnW0xUTlJMFDBxgi X-Received: by 2002:a9d:5388:: with SMTP id w8mr2291643otg.368.1575365147497; Tue, 03 Dec 2019 01:25:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575365147; cv=none; d=google.com; s=arc-20160816; b=BMek3Y/9Qc/SvmsRQsEAwTqIXansjPQ5jtMgjVFfFCEI+4F8axDttM0ELRp+65n1Nt Od+rXJCpgFayPTYzdrvl0VKBr1bEhsrhcr8rwTvS0Bu1yCK0m6WH8WU9MbTabz9FwOLF 1FH5nOx0yBq571vYIdRwXb1aE0Ubyg/jtMvGMVHsT6DmMfKmDZU9FzDrNCSeeHHQgUpf fdexTB+Ao/aiUIO8fyIOhqRIBhtzKjjWwvwcCgB3ym0jtFo8MnDbbPEN939zQ28utQNK hkoGqxZwFW2KQt5hQcFfdedyt3/IU0f1JAMgPUbsAH0NX1K10nDbwcECbslM11QJZnbg HS5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from; bh=OAf4F0sGQnKp/d9HAOR69bSHI+UMErb9ys6tAh7CA0s=; b=shHvtj2SKKa6dJahMmdlvjXSklaQvLe4wS9N5QqqWc+ZRa3YON+jUapAaBX6XUvigC tqEIxn66Hp1MMYfaNDlXj9Yz0M1j780QWm78+XFuPka1V5pzvY0v1rEul5GDIGA/jEWA q+r+L0auKq3aPo1QytqQvQSJ9nc0VAAu3s/26dy9S4XAjZTLPufZQ2KDOKgWp7A3wZaJ jKB/OQnWxUEF2BibO3N/a9kv33YNVnnn+ft/XpdPyTgfYPf2U6ClQeIvXjPfiFyeDLZL CR1hDhgfYXMAtGPD89T628teLzzzj71Xjur2DofL+nFd31BlA1rGup61LZJR4eclq0HS Dxpw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si917559oij.157.2019.12.03.01.25.34; Tue, 03 Dec 2019 01:25:47 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726008AbfLCJXj (ORCPT + 99 others); Tue, 3 Dec 2019 04:23:39 -0500 Received: from mga02.intel.com ([134.134.136.20]:16352 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbfLCJXj (ORCPT ); Tue, 3 Dec 2019 04:23:39 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 01:23:38 -0800 X-IronPort-AV: E=Sophos;i="5.69,272,1571727600"; d="scan'208";a="204909504" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.66.161]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 01:23:36 -0800 From: Jani Nikula To: Joe Perches , Krzysztof Kozlowski Cc: Andy Whitcroft , "linux-kernel\@vger.kernel.org" , Pierre-Louis Bossart Subject: Re: [PATCH] checkpatch: Look for Kconfig indentation errors In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <1574906800-19901-1-git-send-email-krzk@kernel.org> <87a78gnyaz.fsf@intel.com> Date: Tue, 03 Dec 2019 11:23:33 +0200 Message-ID: <874kyhkbje.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 03 Dec 2019, Joe Perches wrote: > 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. Alternatively, perhaps you could complain about indentation that is not one of 1) empty string, 2) exactly one tab, or 3) exactly one tab followed by exactly two spaces? BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center