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=-12.3 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 B2D13C61DD8 for ; Thu, 12 Nov 2020 15:44:02 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 062C3221E9 for ; Thu, 12 Nov 2020 15:44:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZpxsLCoU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 062C3221E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-kernel-mentees-bounces@lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5E0AC87179; Thu, 12 Nov 2020 15:44:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B14BTmdluKj3; Thu, 12 Nov 2020 15:44:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id B19828716E; Thu, 12 Nov 2020 15:44:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 978F9C088B; Thu, 12 Nov 2020 15:44:00 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 289ECC016F for ; Thu, 12 Nov 2020 15:43:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1C21687132 for ; Thu, 12 Nov 2020 15:43:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ugeE3tVqvlK2 for ; Thu, 12 Nov 2020 15:43:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4A98D870A8 for ; Thu, 12 Nov 2020 15:43:58 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id q5so4871530pfk.6 for ; Thu, 12 Nov 2020 07:43:58 -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:mime-version :content-transfer-encoding; bh=UKQ4U9iMZFZ6SAUdvotE/cvuMnDCJZuBYIQk5XkWEFI=; b=ZpxsLCoUDpAhHowIHmK0CPpPPm6Kll8BNR+/rGCLO/+p/dAYPdzxR3Bxu1e6xxgx/r 4VE9AY4jJ8VPGVX7FUkWIPTUR34A9gEYZgAvwQK7CBTdVOXpKMtxMa7+R3jy87qPtF/V F8dpghLcQ3NxtwVc6Yvmvh9dQKbt5Twk7zFv/afUAZ6kDztLqzNFOgw9/QKeUVgIoOay wTnxOQCIL9/9zwO+gVM59BIVR0f8d1jmbKv8tYRl4ujeKlQ1wX4fWdvMiHbgs0CzMYiI G0CoT5VGesVUSY9nsLpXgmIsETK9hfdfUWH8cosm2GVzab173pHpLLPN7zTIBqZkknpx e3Xw== 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:mime-version :content-transfer-encoding; bh=UKQ4U9iMZFZ6SAUdvotE/cvuMnDCJZuBYIQk5XkWEFI=; b=tLGU7W/Gwr6R59KxVpgvPt62e3koARz04SfgtAZXLgXkq73NMSW/GxwQCDDic19Y4I 46Gb74bMd10IZyeOTjqEa82LlJyybLm7a8A4gm465pDbVsGN2a+pznP8boqKkCo6VwQZ i5zXW4naX3x6zGIhrjUPHgR6jhRfioADrd7mWekkcyK3hYdm1Nuf+yokLZz2z96gFiD7 9CNYQizRYoqu5tjZzIjA8QiApbVNm0sWRKq2wWP8haPfAfxoME3g+sa4fddH5UcuG1KP L5C9bg8Zp+BngwCDnukZY3NT9mceHo551MnrLY3V7YEslsSIqD9SO6JHa5qOfT2PqOO5 ts5A== X-Gm-Message-State: AOAM531jUMhCjDV0WHTI7tM2Bu4EnCcbx0bjl2z1vdy5Ogxi1dsUmXOm zMZTVI0mEiyxQ/n9YGnUkec= X-Google-Smtp-Source: ABdhPJxPFiyaTn2LObsot0bagSHZzkGPTff7Z7yhLQ4OgE3Q5Vl8smwu0aEIOAWPYfP4Erc1a+5hVg== X-Received: by 2002:a62:a11a:0:b029:18a:df9e:f537 with SMTP id b26-20020a62a11a0000b029018adf9ef537mr149995pff.29.1605195837801; Thu, 12 Nov 2020 07:43:57 -0800 (PST) Received: from localhost.localdomain ([2405:201:9004:608a:cb83:706a:a1b3:fbe7]) by smtp.gmail.com with ESMTPSA id e8sm6899929pfn.175.2020.11.12.07.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 07:43:57 -0800 (PST) From: Dwaipayan Ray To: lukas.bulwahn@gmail.com Date: Thu, 12 Nov 2020 21:13:30 +0530 Message-Id: <20201112154330.35750-1-dwaipayanray1@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Cc: dwaipayanray1@gmail.com, linux-kernel-mentees@lists.linuxfoundation.org Subject: [Linux-kernel-mentees] [PATCH RFC] checkpatch: add new cases to commit handling X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" Commit extraction in checkpatch fails in some cases. One of the most common false positives is a split line between "commit" and the git SHA of the commit. Improve commit handling to reduce false positives. Improvements: - handle split line between commit and git SHA of commit. - fix handling of split commit description. Signed-off-by: Dwaipayan Ray --- scripts/checkpatch.pl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 024514946bed..f5ba2beac008 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2990,6 +2990,16 @@ sub process { if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) { $orig_desc = $1; $hasparens = 1; + } elsif ($line =~ /^\s*[0-9a-f]{5,}\s+\("([^"]+)"\)/i && + defined $rawlines[$linenr-2] && + $rawlines[$linenr-2] =~ /\bcommit\s*$/i) { + $line =~ /^\s*[0-9a-f]{5,}\s+\("([^"]+)"\)/i; + $orig_desc = $1; + $hasparens = 1; + $space = 0; + $short = 0 if ($line =~ /\b[0-9a-f]{12,40}/i); + $long = 1 if ($line =~ /\b[0-9a-f]{41,}/i); + $case = 0 if ($line =~ /\b[0-9a-f]{5,40}[^A-F]/ && $rawlines[$linenr-2] =~ /\b[Cc]ommit\s*$/); } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i && defined $rawlines[$linenr] && $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) { @@ -3001,7 +3011,9 @@ sub process { $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i; $orig_desc = $1; $rawlines[$linenr] =~ /^\s*([^"]+)"\)/; - $orig_desc .= " " . $1; + my $split_desc = $1; + $split_desc = " $split_desc" if ($line =~ /[\w\,\.]$/); + $orig_desc .= $split_desc; $hasparens = 1; } -- 2.27.0 _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees