Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6236267rwn; Tue, 13 Sep 2022 00:38:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR4f8fxrNK4Q077wroJzbPnqTrEJJKSzMvNf9P3veIDRIJVTbfc4s9VCjpQ94B1PjCLp+03q X-Received: by 2002:a63:dd46:0:b0:438:d562:e959 with SMTP id g6-20020a63dd46000000b00438d562e959mr11359988pgj.432.1663054736850; Tue, 13 Sep 2022 00:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663054736; cv=none; d=google.com; s=arc-20160816; b=BCc3LdlIwfFqWUpFPzQ26f2SiRABEYBrIJMlknpmndQUazz7WVR1UbDfoYjAbOSr87 c/+3zHqlf2COTlaQKdxO+jXL5/QZxQAGuwpwAQhX7XzaGAADloGKvkpb/329R6joNTuB rxuBGydru2mpVrhjwTQhwrCbfQiWiB3rzyIOgf9bsUDej20cTXsdWw/UIgebFKetmBh2 /VMmQTeoW0Y/MRvdPCdFwe1FBOgbK1iumXy5ZqP/88YOxXDheSzH02m09SIGW765OUy7 oN8ZwW9QXATi1Q4JAAlACc+wDeZpT4fUIOd6BcUgMOMn2FHTvvnhw/INYNp768Sp9o4M wBPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LnmTmf+fuhPnF4eBYNnq2sxPqPnDopgZi1nGrmjVkXE=; b=BlD/O5RpSOgzOG6ObIQP7x+FvDG35GQ2r8fTP4Lpm8WQmlthW3pqoEyT0gskvctZG/ jS/wNuOXr/hX9lO3/NIwsWjYLz1hKzjocC6YtwswsknJdqBAv3Yb6Ye4d9b+0gX0dWxr YzTfDUWbgIexujsIRCIYpJKmdHvWlZVjdkfibQ7RroJASjOv+TyaejwsMyWCe0vAfLiu GQws5kbOE+shrYSUI4mJsO3FrP40X1RoN/ikA8uBAPZzhENXNwf34D13/hnoseofDHXU Pf99nVEGlhBMeHPhvlp1M+FJuxdONiKheamCidnWmwrhfwudRdCWEZJ2L4HLL822je0/ BWiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RpxTl9YA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020a170902b58e00b0017139f381c9si6591837pls.569.2022.09.13.00.38.42; Tue, 13 Sep 2022 00:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RpxTl9YA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230370AbiIMG6Z (ORCPT + 99 others); Tue, 13 Sep 2022 02:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbiIMG6X (ORCPT ); Tue, 13 Sep 2022 02:58:23 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 400961C91C; Mon, 12 Sep 2022 23:58:22 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id 198so11206746ybc.1; Mon, 12 Sep 2022 23:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=LnmTmf+fuhPnF4eBYNnq2sxPqPnDopgZi1nGrmjVkXE=; b=RpxTl9YAxT0hmdQQ/88LOuX0P8NDm5fDvdsTNZ8Ph8Me/rFAu+zrBp4rZDmMiso09q eXcEQdIV6OuQzspB5Iul4Df8/+HzYCiVJ2DUHLIFEi87z/vLQ8liACLIHPL3tgJKEGu1 al2+k7gGEhjXqEOWrpdq/L4G67Hs4SeKkjoFGo0Hur9PQ+XSFtzW73nDBZHMFfy6c7oi mMHRgeUUZ99V1N5qnIl9v9d4UOKH7JSFMDZ+BzTadazSrZcgXp7DQoQprZt/P2dEIMaK xpEMp/5P8GTcas9brGLRMHpUcz49oKbDN1jvGOhvWRy05GySh+OZghDvg3jvBAtjyWlG +OUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=LnmTmf+fuhPnF4eBYNnq2sxPqPnDopgZi1nGrmjVkXE=; b=t8jQsd1j/NUiw69ECOGWdLwOpExReZJuEi2Txrr/CiabZGVC6xKiG/7H/SFVGIljly BIuLzjhP4Bnw8OS12wGGPssbtLKjlJzZc0KQZeRbpqSpwbaRJ/sttObTcDmDEzzWvJ+T IaMg4cqBs4HcGaF8q2Ux8HSVrXEFzfHy0+uG9PosxEAjk1riMTxqmZdAMBNmBpXMd5iI +7SlZwUYIsN0Pq+o5bAkELrpxX+WCSFcmo9JgerOb8b0RmwY2XeRC5ZRj6DFd/B9R7RV p8TJf+ZiGqRjWYEA7towWCVbsL6mxFdinHQfhvAYK9l4gc/bRTbSqfB0fErTmelgCmHq DsSw== X-Gm-Message-State: ACgBeo2OrYuDq8+S16hKRs/QVmmwgxDNJxQub1MwfdFkWU5uK942rCgE lIv58ggHdcEEHcRADhbmid9J70sMCT9FEitnAS0= X-Received: by 2002:a05:6902:89:b0:695:7ed0:d8cb with SMTP id h9-20020a056902008900b006957ed0d8cbmr24844042ybs.77.1663052301393; Mon, 12 Sep 2022 23:58:21 -0700 (PDT) MIME-Version: 1.0 References: <20220910083835.2219239-1-niklas.soderlund@corigine.com> In-Reply-To: <20220910083835.2219239-1-niklas.soderlund@corigine.com> From: Lukas Bulwahn Date: Tue, 13 Sep 2022 08:58:10 +0200 Message-ID: Subject: Re: [PATCH v6] checkpatch: warn for non-standard fixes tag style To: =?UTF-8?Q?Niklas_S=C3=B6derlund?= Cc: Dwaipayan Ray , Joe Perches , Jonathan Corbet , Andy Whitcroft , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Philippe Schenker , Stephen Rothwell , oss-drivers@corigine.com, Simon Horman , Louis Peens Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 10, 2022 at 10:38 AM Niklas S=C3=B6derlund wrote: > > Add a warning for fixes tags that does not fall in line with the > standards specified by the community. > > Signed-off-by: Niklas S=C3=B6derlund > Reviewed-by: Simon Horman > Reviewed-by: Louis Peens > --- > * Changes since v5 > - Add support for --fix option for checkpatch.pl. > > * Changes since v4 > - Extend test to cover lines with whitespace before the fixes: tag, e.g. > match check on /^\s*fixes:?/i. > > * Changes since v3 > - Add test that title in tag match title of commit referenced by sha1. > > * Changes since v2 > - Change the pattern to match on 'fixes:?' to catch more malformed > tags. > > * Changes since v1 > - Update the documentation wording and add mention one cause of the > message can be that email program splits the tag over multiple lines. > --- > Documentation/dev-tools/checkpatch.rst | 8 +++++ > scripts/checkpatch.pl | 43 ++++++++++++++++++++++++++ > 2 files changed, 51 insertions(+) > > diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-t= ools/checkpatch.rst > index b52452bc2963..8c8456a3bd18 100644 > --- a/Documentation/dev-tools/checkpatch.rst > +++ b/Documentation/dev-tools/checkpatch.rst > @@ -612,6 +612,14 @@ Commit message > > See: https://www.kernel.org/doc/html/latest/process/submitting-patch= es.html#describe-your-changes > > + **BAD_FIXES_TAG** > + The Fixes: tag is malformed or does not fall in line with the standa= rds > + specified by the community. This can occur if the tag have been spli= t into > + multiple lines (e.g., when pasted in email program with word wrappin= g > + enabled). > + > + See: https://www.kernel.org/doc/html/latest/process/submitting-patch= es.html#describe-your-changes > + Thanks for all the work on checkpatch here! Just three nits: does not fall in line with ~~> how about "is not aligned with" or "does not follow"? "specified" and "standards" is a "big" word. Let us be more brief and avoid "specification" and "standard". "standards specified by the community" ~> "community standards", maybe even "community conventions"? "when pasted in email program" ~> "when pasted in an email program" Maybe you also add a sentence on word wrapping of Fixes: tags, such as: Note that the Fixes: tag line shall not be wrapped. Nevertheless, for the documentation part: Reviewed-by: Lukas Bulwahn Acked-by: Lukas Bulwahn Lukas > > Comparison style > ---------------- > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 79e759aac543..77f577535fc3 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -3140,6 +3140,49 @@ sub process { > } > } > > +# Check Fixes: styles is correct > + if (!$in_header_lines && $line =3D~ /^\s*fixes:?/i) { > + my $orig_commit =3D ""; > + my $id =3D "0123456789ab"; > + my $title =3D "commit title"; > + my $tag_case =3D 1; > + my $tag_space =3D 1; > + my $id_length =3D 1; > + my $id_case =3D 1; > + my $title_has_quotes =3D 0; > + > + if ($line =3D~ /(\s*fixes:?)\s+([0-9a-f]{5,})\s+(= $balanced_parens)/i) { > + my $tag =3D $1; > + $orig_commit =3D $2; > + $title =3D $3; > + > + $tag_case =3D 0 if $tag eq "Fixes:"; > + $tag_space =3D 0 if ($line =3D~ /^fixes:?= [0-9a-f]{5,} ($balanced_parens)/i); > + > + $id_length =3D 0 if ($orig_commit =3D~ /^= [0-9a-f]{12}$/i); > + $id_case =3D 0 if ($orig_commit !~ /[A-F]= /); > + > + # Always strip leading/trailing parens th= en double quotes if existing > + $title =3D substr($title, 1, -1); > + if ($title =3D~ /^".*"$/) { > + $title =3D substr($title, 1, -1); > + $title_has_quotes =3D 1; > + } > + } > + > + my ($cid, $ctitle) =3D git_commit_info($orig_comm= it, $id, > + $title); > + > + if ($ctitle ne $title || $tag_case || $tag_space = || > + $id_length || $id_case || !$title_has_quotes)= { > + if (WARN("BAD_FIXES_TAG", > + "Please use correct Fixes: style 'Fi= xes: <12 chars of sha1> (\"\")' - ie: 'Fixes: $cid (\"$ctitle\"= )'\n" . $herecurr) && > + $fix) { > + $fixed[$fixlinenr] =3D "Fixes: $c= id (\"$ctitle\")"; > + } > + } > + } > + > # Check email subject for common tools that don't need to be mentioned > if ($in_header_lines && > $line =3D~ /^Subject:.*\b(?:checkpatch|sparse|smatch)= \b[^:]/i) { > -- > 2.37.3 >