Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1060552ybl; Tue, 3 Dec 2019 00:41:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwaY0SC49SH6QzJdHSfjJur09C2KGt/cqHnI0qEEl/OO56LixLgb7VNLA4Mzy5pGvE1Y+tL X-Received: by 2002:aca:4587:: with SMTP id s129mr2590326oia.124.1575362503953; Tue, 03 Dec 2019 00:41:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575362503; cv=none; d=google.com; s=arc-20160816; b=cf/CzRvY3nIPsWA15P6CNG/sPidgzCye8BdyHaT8Qmdqzg0VmD1BTDLbPco/sQklZ4 nm9LqW7kz3DhqMpt/yAH9lq1D5QO/fxO1WTAI9sOVuCaDRmGAaZaUvFAjL+uNnP11b5C KTXFee1K5I/lX+rczLqHjxAAnTX8EVHJMCnQ/5rGtfaFoCTBd0Lw63c4TvlRSX2ppGK6 Co69DEyyBsObvzfTJjYxmdlOFASH1/fvNaDe/C8w/0zn5g/Xxx81cMg3+ogzHuG96rI+ IUBP1BjuMdpLHpCx+wgb0mNjz/fIaNlgyKKBtDb5Fj5ttM+i7r9fHarwAoCe0FxJxcNn XWtA== 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=WniE+9/KYQDDcQI8iOwXx3YUkc+5EArzkW7XGvHf+M0=; b=Zvb+y1NUanmXXlfLf1p1eDdEMJ0BNNKnd96WJ3F5qtbgyoHwcjxRNK3XGsLj8nm9yx LWWShX6pLRJwdLbMm7O6sRLuE8/zHfX8hxkeatnkL78BaIALC9JMaXPJa4/vtAP7WMqq klIr8GHXIFL3A0L++AefHZ4W8HwP3IF/e8GUvrJ+7V+BeOYr4x1BpJYlak97GKtDpOhG EMSjIE7ubHQk5zopIkGbCoS2EK98A9iwlWbZR8MwwnbYenjB49W4kkyv871ID6ygWd8O DpQFEhWHo99hZ1jOHVXINclzYDOD2y6rke1BKXCG9VyhwdMYLTaiFN25+A/B9Ys6TDIL lQPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nsKyqEW1; 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 h184si966320oia.19.2019.12.03.00.41.31; Tue, 03 Dec 2019 00:41:43 -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=nsKyqEW1; 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 S1726017AbfLCIlD (ORCPT + 99 others); Tue, 3 Dec 2019 03:41:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:60582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbfLCIlD (ORCPT ); Tue, 3 Dec 2019 03:41:03 -0500 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 F316F206DF for ; Tue, 3 Dec 2019 08:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575362462; bh=xNXnJQMqxsoMv7LLaUi0i2Vx2d7CHjbfF+XyAr5UNpk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nsKyqEW1GpkfYJMMDx/Ca9z+dwFg0Oef8NTJGyCHGlF5uZGoZ51gQPswVkQ9cg7ma 6V/Rl+lRsqWk5gQH8lqNfA62jKFMdG8N/ysX6ojc2XihD4w8DRylicaKLdh0JhI9wK 5C8ta1GFhhbmI9+6qGmYCkxfT3X9lepTwF3q2Ts0= Received: by mail-lj1-f176.google.com with SMTP id j6so2822591lja.2 for ; Tue, 03 Dec 2019 00:41:01 -0800 (PST) X-Gm-Message-State: APjAAAV9NMW6HbzRglz5bBZ0EbfxcUGArdI8VmMbHCCiuE5gLJQlP+AD OSjVfT/H0/tSm1XjxWpuCK2CFUkVpzSARd7nhmA= X-Received: by 2002:a2e:9d9a:: with SMTP id c26mr1828903ljj.225.1575362460172; Tue, 03 Dec 2019 00:41:00 -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:40:48 +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 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-]/)) { Best regards, Krzysztof