From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58DFCC433E9 for ; Wed, 27 Jan 2021 05:51:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A8A62075E for ; Wed, 27 Jan 2021 05:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235185AbhA0DQC (ORCPT ); Tue, 26 Jan 2021 22:16:02 -0500 Received: from smtprelay0026.hostedemail.com ([216.40.44.26]:56044 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729334AbhAZUMA (ORCPT ); Tue, 26 Jan 2021 15:12:00 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 3F4C918224D77; Tue, 26 Jan 2021 20:11:11 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: bean36_25142e827591 X-Filterd-Recvd-Size: 3411 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf17.hostedemail.com (Postfix) with ESMTPA; Tue, 26 Jan 2021 20:11:10 +0000 (UTC) Message-ID: <9bfc9c21d93bb55419954114ed3a7e5cbdc84ddb.camel@perches.com> Subject: Re: [PATCH RFC 1/3] checkpatch: add verbose mode From: Joe Perches To: Dwaipayan Ray Cc: linux-kernel-mentees@lists.linuxfoundation.org, lukas.bulwahn@gmail.com, linux-kernel@vger.kernel.org Date: Tue, 26 Jan 2021 12:11:09 -0800 In-Reply-To: <20210126183521.26535-2-dwaipayanray1@gmail.com> References: <20210126183521.26535-1-dwaipayanray1@gmail.com> <20210126183521.26535-2-dwaipayanray1@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-01-27 at 00:05 +0530, Dwaipayan Ray wrote: > Add a new verbose mode to checkpatch.pl to emit additional verbose > test descriptions. > > The verbose mode is optional and can be enabled by the flag > --verbose. > > The test descriptions are itself loaded from the checkpatch descriptions are themselves, but themselves is unnecessary. The verbose descriptions are read from Documentation/dev-tools/checkpatch.rst > documentation file at Documentation/dev-tools/checkpatch.rst. > The descriptions in the documentation are in a specified format > enclosed within .. CHECKPATCH_START and .. CHECKPATCH_END labels. > > This serves a dual purpose as an external documentation to checkpatch > as well as enables flawless integration of the verbose mode. Using 'flawless' when describing code or documentation generally isn't true. > A subtle example of the format is as follows: What is subtle about an example? If there is something subtle about an example, there's also something wrong with the example. > Documentation/dev-tools/checkpatch.rst: > > .. CHECKPATCH_START Nak on the keyword uses. This should really just parse the input file whenever TYPE is found via some fixed format and save the verbose description after that. Use .rst Field Lists instead, and ideally, keep the list in alphabetic order or group by similar use. https://docutils.sourceforge.io/docs/user/rst/quickref.html#field-lists e.g.: :LINE_SPACING: Vertical space is wasted given the limited number of lines an editor window can display when multiple blank lines are used. :SPACING: Whitespace style used in the kernel sources is described in ref:`Documentation/process/Coding-Style.rst section 3.1. :TRAILING_WHITESPACE: Trailing whitespace should always be removed. Some editors highlight the trailing whitespace and cause visual distractions when editing files. etc... > @@ -2185,6 +2235,11 @@ sub report { >   splice(@lines, 1, 1); >   $output = join("\n", @lines); >   } > + > + if ($verbose && !$terse && > + exists $verbose_messages{$type}) { > + $output .= $verbose_messages{$type} . "\n\n"; > + } >   $output = (split('\n', $output))[0] . "\n" if ($terse); Don't use unnecessary multiple tests of the same object, just reorder the code instead. And also please use c-style function parentheses rather than bare tests. if ($terse) { $output = ... } elsif ($verbose && exists($verbose_messages{$type})) { $output .= ... }