Received: by 10.223.185.116 with SMTP id b49csp2153637wrg; Sun, 4 Mar 2018 20:02:42 -0800 (PST) X-Google-Smtp-Source: AG47ELtQLKUWTrC4PCdtFOrmIcvBPlPA742IU55HnG4wSStFzIvUkZ8c1spmMda2aYlWgbOlSpzG X-Received: by 10.98.13.24 with SMTP id v24mr13879150pfi.89.1520222562457; Sun, 04 Mar 2018 20:02:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520222562; cv=none; d=google.com; s=arc-20160816; b=ZxyXIDQMpRIpaEqb85k9RqqOZeNMPKkPh2bvApsobpp7REeon6JNY/eh16I8mAxg7f l2LURLsaFOdvhZ7lu4LDGRmFvPgScw3sF71yl5PPtiJIQTR6arMdH0dZf3W/sGutj0iJ esgPmamivsmk4wv2mR9SnkB9aRdyyIwxC7f6Ozw+44qbrFeYHp9AbV9al26Vu1eUu/4f zHsj7mpXYVYfpMdRKXbQWQusGeYb6s85029niwVLs6/SaTPeSy3XSmSifhfHCbXiYiTR BNm+OPbHzvuIDWzCFZ7jtZBfE26mJdpVyUbISr2HkD2HrWeCqVItwf46mE4HP9a/95UM iNdA== 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:dkim-signature :arc-authentication-results; bh=T5rmsaOHMRrS3v9pfr0KZPzlk7qSPCqPncFWGTdHdk4=; b=XllDT3EIsyU5wKBMjFm4fWSDXeOUECKn753wAR6xy0YuzoHym8/oWfdWapfMn8f8bm 7ZUqPG3N4OVRGbqtW8FU7H5rWGyisW/ygLJVKUh1t8+vaa2s7sl9oSScQOBqLdP3bpz5 9+93nAQ/6o64eUP6vckLM6xK5oSum+tY9VGw5QhOwXMgHZwMJePftJfjQsJCzSHLkrbH FiWzgMvBLKslYoyPmx6ihIVHlUAb3Pm6VAQLXlDGxoRh1W6VUi9BpOz3CZi2FB0bdgBl wEz1f13f/zDzV3dH0Lrx01vWDA9yKWgNfWWm6vTpvDB8RO3TxQis3mnDBe16RUJ//wyU mUTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tobin.cc header.s=fm2 header.b=EqPa+sub; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=ON9L02Cb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97-v6si8786789pla.96.2018.03.04.20.02.28; Sun, 04 Mar 2018 20:02:42 -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=@tobin.cc header.s=fm2 header.b=EqPa+sub; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=ON9L02Cb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932795AbeCED6m (ORCPT + 99 others); Sun, 4 Mar 2018 22:58:42 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:59597 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932709AbeCED6i (ORCPT ); Sun, 4 Mar 2018 22:58:38 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 2188420A9C; Sun, 4 Mar 2018 22:58:38 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sun, 04 Mar 2018 22:58:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=T5rmsaOHMRrS3v9pf r0KZPzlk7qSPCqPncFWGTdHdk4=; b=EqPa+subl6QD55CAA8pQSvxdBJQKdQc1V dtAbzxixTA7CvDFXENh/fuLiOl2Jrm2Y3ioNgxTcsRaSKRrF9UBMC+CJrhFz1GWv 1PR+chEXhDoJ22U5Ci+fDOYcBMauRD/g2fV8+vdTOjvUL4vNbZvZ9c3whhk/X88D k6iAlEiLNRsaveycUFQX1JT7MTpcl/o8X6KtiAi8Rkfl+qzVFSsnsMivcdE4JGpy 8EKBKsI5JpCc7od76vdNjticTgxIHquAiKDVIxJbnPsljUJmYfS3D/lDsw+wWLNc FPsr4E5FfhHeZUoVbmpqhhl45hKD+ZUlrbIRGOQ8LD9PWm7zvCP7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=T5rmsaOHMRrS3v9pfr0KZPzlk7qSPCqPncFWGTdHdk4=; b=ON9L02Cb 5PnHSrWkq1xm4bPPm4EZ31fVbHmXufSoyMrH/OPI23h1f/SwGrmx57f4flWsSrQB 9/9HslWyGZuwed8fa1rAGa+Hh54TYVfn26UnzEuLVEH2uh/VSi7ozflI5yT1a29n ayB4l8pmXz9cvUDES19db1uGjKOp+YO3lY2ijCebevhxe0i2q51qvjvyGzwfJRsO EaIBbKdrE4h1Xs7ipTVyh+wMU7EqLs68bDD/k0ae7KmrO7IFjT2/Y+ct1kF6fsdA Q4+8QRShFuzsWRzd0yncCfNBxiaz0P8YoiwsDye3vn21UIfqPW+OOut75vGmfMo8 oTIXiDXppShgBw== X-ME-Sender: Received: from localhost (ppp121-44-99-155.bras1.syd7.internode.on.net [121.44.99.155]) by mail.messagingengine.com (Postfix) with ESMTPA id 605A77E1F3; Sun, 4 Mar 2018 22:58:37 -0500 (EST) From: "Tobin C. Harding" To: Andrew Morton , Greg Kroah-Hartman Cc: "Tobin C. Harding" , Joe Perches , Randy Dunlap , Dominik Brodowski , Thomas Gleixner , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH 1/2] checkpatch: add check for tag Co-Developed-by Date: Mon, 5 Mar 2018 14:58:20 +1100 Message-Id: <1520222301-11874-2-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520222301-11874-1-git-send-email-me@tobin.cc> References: <1520222301-11874-1-git-send-email-me@tobin.cc> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joe Perches Recently signature tag Co-Developed-by was added to the kernel (Documentation/process/5.Posting.rst). checkpatch.pl doesn't know about it yet. All prior tags used all lowercase characters except for first character. Checks for this format had to be re-worked to allow for the new tag. Cc: Greg Kroah-Hartman Reviewed-by: Greg Kroah-Hartman Signed-off-by: Tobin C. Harding --- scripts/checkpatch.pl | 58 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3d4040322ae1..fbe2ae2d035f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -461,16 +461,18 @@ our $logFunctions = qr{(?x: seq_vprintf|seq_printf|seq_puts )}; -our $signature_tags = qr{(?xi: - Signed-off-by:| - Acked-by:| - Tested-by:| - Reviewed-by:| - Reported-by:| - Suggested-by:| - To:| - Cc: -)}; +our @valid_signatures = ( + "Signed-off-by:", + "Acked-by:", + "Tested-by:", + "Reviewed-by:", + "Reported-by:", + "Suggested-by:", + "Co-Developed-by:", + "To:", + "Cc:" +); +my $signature_tags = "(?x:" . join('|', @valid_signatures) . ")"; our @typeListMisordered = ( qr{char\s+(?:un)?signed}, @@ -2193,6 +2195,17 @@ sub pos_last_openparen { return length(expand_tabs(substr($line, 0, $last_openparen))) + 1; } +sub get_preferred_sign_off { + my ($sign_off) = @_; + + foreach my $sig (@valid_signatures) { + if (lc($sign_off) eq lc($sig)) { + return $sig; + } + } + return ""; +} + sub process { my $filename = shift; @@ -2499,35 +2512,34 @@ sub process { my $sign_off = $2; my $space_after = $3; my $email = $4; - my $ucfirst_sign_off = ucfirst(lc($sign_off)); + my $preferred_sign_off = ucfirst(lc($sign_off)); - if ($sign_off !~ /$signature_tags/) { + if ($sign_off !~ /$signature_tags/i) { WARN("BAD_SIGN_OFF", "Non-standard signature: $sign_off\n" . $herecurr); - } - if (defined $space_before && $space_before ne "") { + } elsif ($sign_off !~ /$signature_tags/) { + $preferred_sign_off = get_preferred_sign_off($sign_off); if (WARN("BAD_SIGN_OFF", - "Do not use whitespace before $ucfirst_sign_off\n" . $herecurr) && + "'$preferred_sign_off' is the preferred signature form\n" . $herecurr) && $fix) { - $fixed[$fixlinenr] = - "$ucfirst_sign_off $email"; + $fixed[$fixlinenr] = "$preferred_sign_off $email"; } } - if ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) { + if (defined $space_before && $space_before ne "") { if (WARN("BAD_SIGN_OFF", - "'$ucfirst_sign_off' is the preferred signature form\n" . $herecurr) && + "Do not use whitespace before $preferred_sign_off\n" . $herecurr) && $fix) { $fixed[$fixlinenr] = - "$ucfirst_sign_off $email"; + "$preferred_sign_off $email"; } - } + if (!defined $space_after || $space_after ne " ") { if (WARN("BAD_SIGN_OFF", - "Use a single space after $ucfirst_sign_off\n" . $herecurr) && + "Use a single space after $preferred_sign_off\n" . $herecurr) && $fix) { $fixed[$fixlinenr] = - "$ucfirst_sign_off $email"; + "$preferred_sign_off $email"; } } -- 2.7.4