Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1070784ybl; Tue, 3 Dec 2019 00:56:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwcJNb/H8zFlGgtRMru77ChsuIZJ4tFV+ESJYRbHH8Z5Lo19yP9FH91NfVBWtcyu1JQX/TP X-Received: by 2002:aca:4f50:: with SMTP id d77mr2695113oib.147.1575363374142; Tue, 03 Dec 2019 00:56:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575363374; cv=none; d=google.com; s=arc-20160816; b=Y/XWRloFx6F/tC+lo7xW1erMPMR7vHw8utY6jY/+eIZGkL7EfL5yt2WnHOdn8RlQhA NLxAPKZv5pNveShhJhJ5gLbOxBNEE7yj/Sd5SLJuCOMelUlos2jZmknHfRrOypArqZ7O 1kj5S4hhnKlcUoJ0zOjgm4CG0ovCN+xs+UIPOCGxerAAYOVDvlqgkCQp0s3A8nUxTQlS PuWJW2+UbVK1MmiBOgs7Q6pjMyEFjuSCmiSYtEKgx1wKSlcWDhiHcoZ3EDLWbPfJb6fi OsG7ckA649K8ZUf8TsGWZ4GzPKba5SljtzW2etxi3PEtRfhImo92oTIsBuxbwZk4LoPU bHmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=c4x2W8fJmPs/8jviJOuGidB0V8+1neObAZEzb4gzTHU=; b=WW4Q7HtiCXqLes4GeksVcaxdttVMzvgjAltFs/cAGwRnlfSqLu/J1VSfnqERmBHgQU AxUIZppNbYKcYV5RXxcojAaPiVXEmLmaXYplEwU28h1dOuOXXdfCjvq5hZSos0tulxbz DQovmGo7NyB2shtXyessmLLOfy0SIsmTTqJgc31c11sHSu1sCf9cu2o78jL+0MdqO8W2 bdM+McjHo4Lt2+cCVNth/wGOa8fZi16l0FxEj41S6ZCVaf4HgmhaJ58347f7atnvmdly EyahMW/ugHeQEC5hbBz/tjtt2E22dJ9PE+7kaJtTG5ZsyAtIEqfcYJqgyI25UArtBUTD m6Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WS+GCjTd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10si889408otn.53.2019.12.03.00.56.02; Tue, 03 Dec 2019 00:56:14 -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; dkim=pass header.i=@kernel.org header.s=default header.b=WS+GCjTd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbfLCIzV (ORCPT + 99 others); Tue, 3 Dec 2019 03:55:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:35414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbfLCIzV (ORCPT ); Tue, 3 Dec 2019 03:55:21 -0500 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2707720659 for ; Tue, 3 Dec 2019 08:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575363319; bh=m31aHcD0txfHJWKNc3ry756pAIVc76wigOfC41CiuM8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WS+GCjTdSmvP1K/ViX64PcBDw+zuAXYbYZN6tWV8P//zN2g6ESkoJDHzuoOjTCZ3l iguq6sHUxBJsCQpdduX4/r6+qOa266CB+PM+cyKJZWrGpK5ryDLCKRrlLKRZTPgBXC ax6uVafGMzRiKrIuvJb6KXjZOffOtCisuMWx9+4k= Received: by mail-lj1-f182.google.com with SMTP id d20so2780523ljc.12 for ; Tue, 03 Dec 2019 00:55:19 -0800 (PST) X-Gm-Message-State: APjAAAUXlu8aGmxDmP1DbFLnNcOj0hPrZuKzyToWl3XIDCZZpuK0Xa8K Do00MUrrVRukX8wPNjJKhdgKtrqMutPokRJNwvk= X-Received: by 2002:a2e:b0db:: with SMTP id g27mr1954358ljl.74.1575363317362; Tue, 03 Dec 2019 00:55:17 -0800 (PST) MIME-Version: 1.0 References: <1574906800-19901-1-git-send-email-krzk@kernel.org> <87a78gnyaz.fsf@intel.com> In-Reply-To: From: Krzysztof Kozlowski Date: Tue, 3 Dec 2019 16:55:05 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] checkpatch: Look for Kconfig indentation errors To: Joe Perches Cc: Jani Nikula , Andy Whitcroft , "linux-kernel@vger.kernel.org" , Pierre-Louis Bossart Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Dec 2019 at 16:40, 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/ > && > + $rawline !~ /^\+\t[a-z-]/) || > + $rawline =~ /^\+\t* +\t+ *[a-zA-Z0-9-]/ || > + $rawline =~ /^\+\t( | )[a-zA-Z0-9-]/)) { This unfortunately fails if help text starts with one of syntax keywords (e.g. "if"). Isn't this getting over-complicated? The Kconfig is rather simple: 1. no indentation, 2. one tab, 3. one tab + 2 spaces 4. one tab + 2 spaces + some more spaces (e.g. help text) Best regards, Krzysztof