Received: by 10.223.185.116 with SMTP id b49csp1098540wrg; Fri, 16 Feb 2018 12:25:26 -0800 (PST) X-Google-Smtp-Source: AH8x227wU3/93e6++ydDnPI/Bag17h238JmBXWg5TB5TP2XUiY9/JBjnMKzPylOac1+BpPYTiwAi X-Received: by 2002:a17:902:5a88:: with SMTP id r8-v6mr7126733pli.426.1518812726281; Fri, 16 Feb 2018 12:25:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518812726; cv=none; d=google.com; s=arc-20160816; b=dMy1vqHj7hwiU1BLjbG1o6VGxjLiNwVCmoLhiVv7KZiotxImb2vmderf93ffaWrBJ8 2deW3gQPAWi0+ER4xv39Km9z5DTarVfGzydxmfgiHAgoGNJHuj4uUMwGROmmYkswr/ou c9Xm0XdvjF+FBQyTeLvdVYuXJa3o6RJxrAfV1GiRO2RylPlZcFzxlqP2TzPsHZdutSwa QY52EXswcQgN7Iya6ndQJQuqnMb2c6ZUqPMXM1vPVNpQfhVPdIy6FKNo4QjvTDJqtxNY FZDYzjBeqGKYsYD3+ssujreq37ZoarmB8w8HjURc0QKu6RoMc+TFI7Ih3RvlSl78qM8l 8Qcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=5YSPxgniNmaD6qC7wWYRpahpuYOSg6r9HxEwTfYm8nc=; b=jPe5Ia79PNfjFIDmly3vBoItaDyQLHMx7DN4KpzaQGYwIWK0mxNTvbHfAAl41WxcEo cUULtoikDmkKDrB8i9hVTjSvd1cBWenR3iqyWn+AZjZNORye2zyar2yP/Fq49sEz5EM+ bYBFuPBFVVYVE5lmgavAISluNT0aGYHrMKUN6nchC1rzaCidW5VkGnoiFpPd1FMTY/IQ 2P3rRSzlVF9Df/RZd2oDlBpBx0mMflVYUf6Ry5WvgxlI3JXCrDg2/j+0IhY/pdworFvp 9WRg64iPWW2ViyznYQ8QlZWO5RQoV/MbUDxL8Z3JwpgDQbhUsnIUOWOOXQmWRB/Dz4NW 3hfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TU3XQnRY; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si1460145pga.505.2018.02.16.12.25.12; Fri, 16 Feb 2018 12:25:26 -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=@gmail.com header.s=20161025 header.b=TU3XQnRY; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751029AbeBPUYB (ORCPT + 99 others); Fri, 16 Feb 2018 15:24:01 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35270 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750838AbeBPUXc (ORCPT ); Fri, 16 Feb 2018 15:23:32 -0500 Received: by mail-lf0-f65.google.com with SMTP id a204so5660147lfa.2; Fri, 16 Feb 2018 12:23:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5YSPxgniNmaD6qC7wWYRpahpuYOSg6r9HxEwTfYm8nc=; b=TU3XQnRYv1gHi5dnxZps0ZRLGGBKtKVgF6ay4s8vlvm0cpfwGCsKJ9+dw1lrqI2Z5T duMG8f9mQVZPWX5xr3SgIrmZINtbprG472jLLRf2+1ntKwFaNvx4g42vtdr5oyGg1mhm LQsoDPW8d7ILXYmBKvopnFZjQ31LpMAM+slCJ1BgsDHoYnCHacz+aS3AaaLx7x6jAYN7 u817O2UPUDVtzIVRp9MicmXbZEaFUL7t0kRFH9syyX9CUj0AnhC1VHPlUDzmqDcQNBa+ 9oqORswmygJHqTXxv/PY2UmHPs200UnEyEP9d0Zm+YewlWm9dWNYhsHbmOtB6JWLGXAx xcJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5YSPxgniNmaD6qC7wWYRpahpuYOSg6r9HxEwTfYm8nc=; b=AS49f7mxHVJpciPo2qFma7XAYejQo5Rm2Ba2gWeBfE3ZtRG4TCgWYchCR0uuM23Bzc 5MZd3TSVcPuwiiHyh0d2QGUpT3KhzpBzAmzk/7MXmjxQybGQB4RyU93hNPlweyS4diwf bG15BioSe/T7DE32D+xhe9qbR+q32TWtlihOi/q/Xeubn2lrzHYPtni+ZW3ndFrX9vUv QCm6mSQhdwPILsDYA6dXLDCa0hApoDbDQK8HX9YHEHSiZqNyW6MPBgG53xQj26kXTQfI LpQCzm99QuWOlXExd73j751z9oeKDRh5nW9yjDdF/wzcZC2cIF32/rAsmwm4iFUARPLk tvtg== X-Gm-Message-State: APf1xPBytd1VLxF2DZ8nC7Lzt3DFyHOGdK625ChrXsOw7rykgseeZyvW F5U3m/O6ReyKalNqsAfsyhU= X-Received: by 10.25.163.68 with SMTP id m65mr4866555lfe.83.1518812610741; Fri, 16 Feb 2018 12:23:30 -0800 (PST) Received: from huvuddator.lan (ua-213-113-106-221.cust.bredbandsbolaget.se. [213.113.106.221]) by smtp.gmail.com with ESMTPSA id y7sm1652539ljd.45.2018.02.16.12.23.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 12:23:30 -0800 (PST) From: Ulf Magnusson To: apw@canonical.com, joe@perches.com Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Ulf Magnusson Subject: [PATCH 2/3] checkpatch: kconfig: check help texts for menuconfig and choice Date: Fri, 16 Feb 2018 21:22:54 +0100 Message-Id: <20180216202255.25307-3-ulfalizer@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180216202255.25307-1-ulfalizer@gmail.com> References: <20180216202255.25307-1-ulfalizer@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, only Kconfig symbols are checked for a missing or short help text, and are only checked if they are defined with the 'config' keyword. To make the check more general, extend it to also check help texts for choices and for symbols defined with the 'menuconfig' keyword. This increases the accuracy of the check for symbols that would already have been checked as well, since e.g. a 'menuconfig' symbol after a help text will be recognized as ending the preceding symbol/choice definition. To increase the accuracy of the check further, also recognize 'if', 'endif', 'menu', 'endmenu', 'endchoice', and 'source' as ending a symbol/choice definition. Signed-off-by: Ulf Magnusson --- scripts/checkpatch.pl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2b404317daea..54b782fab4fd 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2797,7 +2797,10 @@ sub process { # Only applies when adding the entry originally, after that we do not have # sufficient context to determine whether it is indeed long enough. if ($realfile =~ /Kconfig/ && - $line =~ /^\+\s*config\s+/) { + # 'choice' is usually the last thing on the line (though + # Kconfig supports named choices), so use a word boundary + # (\b) rather than a whitespace character (\s) + $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) { my $length = 0; my $cnt = $realcnt; my $ln = $linenr + 1; @@ -2822,7 +2825,13 @@ sub process { $f =~ s/#.*//; $f =~ s/^\s+//; next if ($f =~ /^$/); - if ($f =~ /^\s*config\s/) { + + # This only checks context lines in the patch + # and so hopefully shouldn't trigger false + # positives, even though some of these are + # common words in help texts + if ($f =~ /^\s*(?:config|menuconfig|choice|endchoice| + if|endif|menu|endmenu|source)\b/x) { $is_end = 1; last; } -- 2.14.1