From patchwork Tue Aug 10 17:26:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timothy Redaelli X-Patchwork-Id: 1515472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iNSREQ26; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GkfyQ620Rz9sT6 for ; Wed, 11 Aug 2021 03:26:53 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 9037182F9B; Tue, 10 Aug 2021 17:26:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mnGzFEcKD2To; Tue, 10 Aug 2021 17:26:43 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id F2EA4823E2; Tue, 10 Aug 2021 17:26:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C559BC0010; Tue, 10 Aug 2021 17:26:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6DE42C000E for ; Tue, 10 Aug 2021 17:26:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 64E9F402E3 for ; Tue, 10 Aug 2021 17:26:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zahUDcpsQQ13 for ; Tue, 10 Aug 2021 17:26:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 7A66E4026E for ; Tue, 10 Aug 2021 17:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628616395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=trS3lyjUN1XasURnxEdaFwmxQzu9xcbFd33jVbqHSXE=; b=iNSREQ26TVRWxst0JWBUkczG6zn4jRPtei4Bz0mc6s+p1cqTG/4AtxI4D6Dr4Z6Ey3sxff 67GQ7FibKJWSQHy8zdVpBn5hYQUqLAiU5iiXax87rdhTyaZzC2cwqOMFQ6JaIoe0njkAgG +5pt7u7IvrLE3yPS19ijsHaiFfxkRqo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-208-nizHXr87PMuFILmOv33InA-1; Tue, 10 Aug 2021 13:26:34 -0400 X-MC-Unique: nizHXr87PMuFILmOv33InA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 44226801A92 for ; Tue, 10 Aug 2021 17:26:33 +0000 (UTC) Received: from carbon.redhat.com (unknown [10.39.192.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4900E13AD3 for ; Tue, 10 Aug 2021 17:26:32 +0000 (UTC) From: Timothy Redaelli To: dev@openvswitch.org Date: Tue, 10 Aug 2021 19:26:24 +0200 Message-Id: <20210810172624.104634-1-tredaelli@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=tredaelli@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] checkpatch: check if some tags are wrongly written X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Currently, there are some patches with the tags wrongly written (with space instead of dash ) and this may prevent some automatic system or CI to detect them correctly. This commit adds a check in checkpatch to be sure the tag is written correctly with dash and not with space. The tags supported by the commit are: Reported-by, Requested-by, Suggested-by, Reported-at, and Submitted-at It's not necessary to add "Signed-off-by" since it's already checked in checkpatch. Signed-off-by: Timothy Redaelli Acked-by: Aaron Conole --- tests/checkpatch.at | 44 +++++++++++++++++++++++++++++++++++++++++ utilities/checkpatch.py | 13 ++++++++++++ 2 files changed, 57 insertions(+) diff --git a/tests/checkpatch.at b/tests/checkpatch.at index 0718acd99..8eb6a7558 100755 --- a/tests/checkpatch.at +++ b/tests/checkpatch.at @@ -348,3 +348,47 @@ try_checkpatch \ " AT_CLEANUP + +AT_SETUP([checkpatch - malformed tags]) +try_checkpatch \ + " Author: A + + Reported by: foo... + Signed-off-by: A" \ + "ERROR: Reported-by tag is malformed. + 1: Reported by: foo... +" +try_checkpatch \ + " Author: A + + Requested by: foo... + Signed-off-by: A" \ + "ERROR: Requested-by tag is malformed. + 1: Requested by: foo... +" +try_checkpatch \ + " Author: A + + Suggested by: foo... + Signed-off-by: A" \ + "ERROR: Suggested-by tag is malformed. + 1: Suggested by: foo... +" +try_checkpatch \ + " Author: A + + Reported at: foo... + Signed-off-by: A" \ + "ERROR: Reported-at tag is malformed. + 1: Reported at: foo... +" +try_checkpatch \ + " Author: A + + Submitted at: foo... + Signed-off-by: A" \ + "ERROR: Submitted-at tag is malformed. + 1: Submitted at: foo... +" + +AT_CLEANUP diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 699fb4b02..97e21eeaa 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -749,6 +749,14 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None): is_gerrit_change_id = re.compile(r'(\s*(change-id: )(.*))$', re.I | re.M | re.S) + tags_typos = { + r'^Reported by:': 'Reported-by:', + r'^Requested by:': 'Requested-by:', + r'^Suggested by:': 'Suggested-by:', + r'^Reported at:': 'Reported-at:', + r'^Submitted at:': 'Submitted-at:' + } + reset_counters() for line in text.splitlines(): @@ -838,6 +846,11 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None): print("%d: %s\n" % (lineno, line)) elif spellcheck: check_spelling(line, False) + for typo, correct in tags_typos.items(): + m = re.match(typo, line, re.I) + if m: + print_error("%s tag is malformed." % (correct[:-1])) + print("%d: %s\n" % (lineno, line)) elif parse == PARSE_STATE_CHANGE_BODY: newfile = hunks.match(line)