From patchwork Thu Nov 1 15:06:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 991962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42m7pD6VdFzB4XH for ; Fri, 2 Nov 2018 02:06:44 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 3499FAA6; Thu, 1 Nov 2018 15:06:41 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D4626A6E for ; Thu, 1 Nov 2018 15:06:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2064475B for ; Thu, 1 Nov 2018 15:06:38 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigabrt.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 89FC940006; Thu, 1 Nov 2018 15:06:36 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 1 Nov 2018 08:06:31 -0700 Message-Id: <20181101150632.32493-1-blp@ovn.org> X-Mailer: git-send-email 2.16.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 1/2] checkpatch: Add explicit test for mailing list as author. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Somehow some such patches snuck through. checkpatch caught them (and the committer missed that) but this makes it even more explicit. Signed-off-by: Ben Pfaff Reviewed-by: Yifeng Sun --- tests/checkpatch.at | 8 ++++++++ utilities/checkpatch.py | 3 +++ 2 files changed, 11 insertions(+) diff --git a/tests/checkpatch.at b/tests/checkpatch.at index 8af3a8c0371e..bd7422494e33 100755 --- a/tests/checkpatch.at +++ b/tests/checkpatch.at @@ -51,6 +51,14 @@ try_checkpatch \ Commit: A" \ "ERROR: Author A needs to sign off." +# Single author but somehow the mailing list is the author. +try_checkpatch \ + "Author: Foo Bar via dev + Commit: A + + Signed-off-by: A" \ + "ERROR: Author should not be mailing list." + # Sign-off for single author and different committer. try_checkpatch \ "Author: A diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 5f5dd8318e32..54aa4b6346db 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -731,6 +731,9 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None): if not author: print_error("Patch lacks author.") continue + if " via " in author or "@openvswitch.org" in author: + print_error("Author should not be mailing list.") + continue if author in co_authors: print_error("Author should not be also be co-author.") continue From patchwork Thu Nov 1 15:06:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 991963 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42m7qN4wXJzB4XY for ; Fri, 2 Nov 2018 02:07:44 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 26E3BEA8; Thu, 1 Nov 2018 15:06:43 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id CDA7BC75 for ; Thu, 1 Nov 2018 15:06:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D14AF75B for ; Thu, 1 Nov 2018 15:06:40 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigabrt.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 0C2324000A; Thu, 1 Nov 2018 15:06:37 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 1 Nov 2018 08:06:32 -0700 Message-Id: <20181101150632.32493-2-blp@ovn.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181101150632.32493-1-blp@ovn.org> References: <20181101150632.32493-1-blp@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 2/2] checkpatch: Speed up checking when spell checking not enabled. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org On my machine it takes almost a second for enchant to read its dictionary. This time is wasted when spell checking is not enabled. This commit makes checkpatch read the dictionary only when it will be used. Signed-off-by: Ben Pfaff Reviewed-by: Yifeng Sun --- utilities/checkpatch.py | 117 +++++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 55 deletions(-) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 54aa4b6346db..8bbda78989c4 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -21,59 +21,6 @@ import os import re import sys -try: - import enchant - - extra_keywords = ['ovs', 'vswitch', 'vswitchd', 'ovs-vswitchd', 'netdev', - 'selinux', 'ovs-ctl', 'dpctl', 'ofctl', 'openvswitch', - 'dpdk', 'hugepage', 'hugepages', 'pmd', 'upcall', - 'vhost', 'rx', 'tx', 'vhostuser', 'openflow', 'qsort', - 'rxq', 'txq', 'perf', 'stats', 'struct', 'int', - 'char', 'bool', 'upcalls', 'nicira', 'bitmask', 'ipv4', - 'ipv6', 'tcp', 'tcp4', 'tcpv4', 'udp', 'udp4', 'udpv4', - 'icmp', 'icmp4', 'icmpv6', 'vlan', 'vxlan', 'cksum', - 'csum', 'checksum', 'ofproto', 'numa', 'mempool', - 'mempools', 'mbuf', 'mbufs', 'hmap', 'cmap', 'smap', - 'dhcpv4', 'dhcp', 'dhcpv6', 'opts', 'metadata', - 'geneve', 'mutex', 'netdev', 'netdevs', 'subtable', - 'virtio', 'qos', 'policer', 'datapath', 'tunctl', - 'attr', 'ethernet', 'ether', 'defrag', 'defragment', - 'loopback', 'sflow', 'acl', 'initializer', 'recirc', - 'xlated', 'unclosed', 'netlink', 'msec', 'usec', - 'nsec', 'ms', 'us', 'ns', 'kilobits', 'kbps', - 'kilobytes', 'megabytes', 'mbps', 'gigabytes', 'gbps', - 'megabits', 'gigabits', 'pkts', 'tuple', 'miniflow', - 'megaflow', 'conntrack', 'vlans', 'vxlans', 'arg', - 'tpid', 'xbundle', 'xbundles', 'mbundle', 'mbundles', - 'netflow', 'localnet', 'odp', 'pre', 'dst', 'dest', - 'src', 'ethertype', 'cvlan', 'ips', 'msg', 'msgs', - 'liveness', 'userspace', 'eventmask', 'datapaths', - 'slowpath', 'fastpath', 'multicast', 'unicast', - 'revalidation', 'namespace', 'qdisc', 'uuid', 'ofport', - 'subnet', 'revalidation', 'revalidator', 'revalidate', - 'l2', 'l3', 'l4', 'openssl', 'mtu', 'ifindex', 'enum', - 'enums', 'http', 'https', 'num', 'vconn', 'vconns', - 'conn', 'nat', 'memset', 'memcmp', 'strcmp', - 'strcasecmp', 'tc', 'ufid', 'api', 'ofpbuf', 'ofpbufs', - 'hashmaps', 'hashmap', 'deref', 'dereference', 'hw', - 'prio', 'sendmmsg', 'sendmsg', 'malloc', 'free', 'alloc', - 'pid', 'ppid', 'pgid', 'uid', 'gid', 'sid', 'utime', - 'stime', 'cutime', 'cstime', 'vsize', 'rss', 'rsslim', - 'whcan', 'gtime', 'eip', 'rip', 'cgtime', 'dbg', 'gw', - 'sbrec', 'bfd', 'sizeof', 'pmds', 'nic', 'nics', 'hwol', - 'encap', 'decap', 'tlv', 'tlvs', 'decapsulation', 'fd', - 'cacheline', 'xlate', 'skiplist', 'idl', 'comparator', - 'natting', 'alg', 'pasv', 'epasv', 'wildcard', 'nated', - 'amd64', 'x86_64', 'recirculation'] - - spell_check_dict = enchant.Dict("en_US") - for kw in extra_keywords: - spell_check_dict.add(kw) - - no_spellcheck = False -except: - no_spellcheck = True - RETURN_CHECK_INITIAL_STATE = 0 RETURN_CHECK_STATE_WITH_RETURN = 1 RETURN_CHECK_AWAITING_BRACE = 2 @@ -86,6 +33,66 @@ total_line = 0 colors = False spellcheck_comments = False quiet = False +spell_check_dict = None + + +def open_spell_check_dict(): + import enchant + + try: + extra_keywords = ['ovs', 'vswitch', 'vswitchd', 'ovs-vswitchd', + 'netdev', 'selinux', 'ovs-ctl', 'dpctl', 'ofctl', + 'openvswitch', 'dpdk', 'hugepage', 'hugepages', + 'pmd', 'upcall', 'vhost', 'rx', 'tx', 'vhostuser', + 'openflow', 'qsort', 'rxq', 'txq', 'perf', 'stats', + 'struct', 'int', 'char', 'bool', 'upcalls', 'nicira', + 'bitmask', 'ipv4', 'ipv6', 'tcp', 'tcp4', 'tcpv4', + 'udp', 'udp4', 'udpv4', 'icmp', 'icmp4', 'icmpv6', + 'vlan', 'vxlan', 'cksum', 'csum', 'checksum', + 'ofproto', 'numa', 'mempool', 'mempools', 'mbuf', + 'mbufs', 'hmap', 'cmap', 'smap', 'dhcpv4', 'dhcp', + 'dhcpv6', 'opts', 'metadata', 'geneve', 'mutex', + 'netdev', 'netdevs', 'subtable', 'virtio', 'qos', + 'policer', 'datapath', 'tunctl', 'attr', 'ethernet', + 'ether', 'defrag', 'defragment', 'loopback', 'sflow', + 'acl', 'initializer', 'recirc', 'xlated', 'unclosed', + 'netlink', 'msec', 'usec', 'nsec', 'ms', 'us', 'ns', + 'kilobits', 'kbps', 'kilobytes', 'megabytes', 'mbps', + 'gigabytes', 'gbps', 'megabits', 'gigabits', 'pkts', + 'tuple', 'miniflow', 'megaflow', 'conntrack', + 'vlans', 'vxlans', 'arg', 'tpid', 'xbundle', + 'xbundles', 'mbundle', 'mbundles', 'netflow', + 'localnet', 'odp', 'pre', 'dst', 'dest', 'src', + 'ethertype', 'cvlan', 'ips', 'msg', 'msgs', + 'liveness', 'userspace', 'eventmask', 'datapaths', + 'slowpath', 'fastpath', 'multicast', 'unicast', + 'revalidation', 'namespace', 'qdisc', 'uuid', + 'ofport', 'subnet', 'revalidation', 'revalidator', + 'revalidate', 'l2', 'l3', 'l4', 'openssl', 'mtu', + 'ifindex', 'enum', 'enums', 'http', 'https', 'num', + 'vconn', 'vconns', 'conn', 'nat', 'memset', 'memcmp', + 'strcmp', 'strcasecmp', 'tc', 'ufid', 'api', + 'ofpbuf', 'ofpbufs', 'hashmaps', 'hashmap', 'deref', + 'dereference', 'hw', 'prio', 'sendmmsg', 'sendmsg', + 'malloc', 'free', 'alloc', 'pid', 'ppid', 'pgid', + 'uid', 'gid', 'sid', 'utime', 'stime', 'cutime', + 'cstime', 'vsize', 'rss', 'rsslim', 'whcan', 'gtime', + 'eip', 'rip', 'cgtime', 'dbg', 'gw', 'sbrec', 'bfd', + 'sizeof', 'pmds', 'nic', 'nics', 'hwol', 'encap', + 'decap', 'tlv', 'tlvs', 'decapsulation', 'fd', + 'cacheline', 'xlate', 'skiplist', 'idl', + 'comparator', 'natting', 'alg', 'pasv', 'epasv', + 'wildcard', 'nated', 'amd64', 'x86_64', + 'recirculation'] + + global spell_check_dict + spell_check_dict = enchant.Dict("en_US") + for kw in extra_keywords: + spell_check_dict.add(kw) + + return True + except: + return False def get_color_end(): @@ -359,7 +366,7 @@ def filter_comments(current_line, keep=False): def check_comment_spelling(line): - if no_spellcheck or not spellcheck_comments: + if not spell_check_dict or not spellcheck_comments: return False comment_words = filter_comments(line, True).replace(':', ' ').split(' ') @@ -919,7 +926,7 @@ if __name__ == '__main__': elif o in ("-f", "--check-file"): checking_file = True elif o in ("-S", "--spellcheck-comments"): - if no_spellcheck: + if not open_spell_check_dict(): print("WARNING: The enchant library isn't availble.") print(" Please install python enchant.") else: