Checkpatch contains a large list of spelling words, currently 326.  The
in-built list is quite cumbersome, and includes duplicate entries
('netdev' and 'revalidation').  Managing this list will continue to grow
difficult over time, and really shouldn't be so difficult.  To make the
maintenance of OVS specific spelling words easier, create a new file
that will contain the spelling words and move the list into that file
(sorted).  Additionally, add 'FreeBSD' and 'gcloud' to the list as I
tested against 80d723736b64 ("cirrus: Update to FreeBSD 14.3 and 13.5.")

Signed-off-by: Aaron Conole <[email protected]>
---
v2->v3:  - Fix the 'uuid validate' line
         - Incorporate Eelco's HW offload word list
         - Rename the wordlist and move it to 'utilities'
         - Introduce a spellcheck test case

 tests/checkpatch.at           |  37 ++++
 utilities/automake.mk         |   1 +
 utilities/checkpatch.py       |  73 +-------
 utilities/checkpatch_dict.txt | 330 ++++++++++++++++++++++++++++++++++
 4 files changed, 374 insertions(+), 67 deletions(-)
 create mode 100644 utilities/checkpatch_dict.txt

diff --git a/tests/checkpatch.at b/tests/checkpatch.at
index 3182ca8808..2728eaca68 100755
--- a/tests/checkpatch.at
+++ b/tests/checkpatch.at
@@ -726,3 +726,40 @@ try_checkpatch_c_file \
     "
 done
 AT_CLEANUP
+
+AT_SETUP([checkpatch - spelling checks])
+AT_SKIP_IF([! $PYTHON3 -c 'import enchant' >/dev/null 2>&1])
+
+dnl First check with some default words
+
+try_checkpatch_c_file \
+   "#include <foo.h>
+    #include <bar.h>
+
+    /* naintenance mode */
+    void foo() {
+       $ctr ( first_run ) {
+          something(check_node);
+       }
+    }" \
+    "WARNING: Possible misspelled word: \"naintenance\"
+Did you mean:  [['maintenance', 'countenance', 'centenarian']]
+test.c:4:
+/* naintenance mode */
+    " \
+    "-S"
+
+try_checkpatch_c_file \
+   "#include <foo.h>
+    #include <bar.h>
+
+    /* hugepage mode */
+    void foo() {
+       $ctr ( first_run ) {
+          something(check_node);
+       }
+    }" \
+    "" \
+    "-S"
+
+AT_CLEANUP
diff --git a/utilities/automake.mk b/utilities/automake.mk
index fcd353109d..a76e077e1f 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -66,6 +66,7 @@ EXTRA_DIST += \
        utilities/ovs-vlan-test.in \
        utilities/ovs-vsctl-bashcomp.bash \
        utilities/checkpatch.py \
+       utilities/checkpatch_dict.txt \
        utilities/docker/Makefile \
        utilities/docker/ovs-override.conf \
        utilities/docker/start-ovs \
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index 566a2bd60b..9dcdf9eb6f 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -56,71 +56,6 @@ def open_spell_check_dict():
         pass
 
     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', 'linux', 'afxdp', 'promisc', 'goto',
-                          'misconfigured', 'misconfiguration', 'checkpatch',
-                          'debian', 'travis', 'cirrus', 'appveyor', 'faq',
-                          'erspan', 'const', 'hotplug', 'addresssanitizer',
-                          'ovsdb', 'dpif', 'veth', 'rhel', 'jsonrpc', 'json',
-                          'syscall', 'lacp', 'ipf', 'skb', 'valgrind',
-                          'appctl', 'arp', 'asan', 'backport', 'backtrace',
-                          'chmod', 'ci', 'cpu', 'cpus', 'dnat', 'dns', 'dpcls',
-                          'eol', 'ethtool', 'fdb', 'freebsd', 'gcc', 'github',
-                          'glibc', 'gre', 'inlined', 'ip', 'ipfix', 'ipsec',
-                          'ixgbe', 'libbpf', 'libcrypto', 'libgcc',
-                          'libopenvswitch', 'libreswan', 'libssl', 'libxdp',
-                          'lldp', 'llvm', 'lockless', 'mcast', 'megaflows',
-                          'mfex', 'ncat', 'networkmanager', 'pcap', 'pedit',
-                          'pidfile', 'pps', 'rculist', 'rebalance', 'rebased'
-                          'recirculations', 'revalidators', 'rst', 'sed',
-                          'shrinked', 'snat', 'stderr', 'stdout', 'testpmd',
-                          'tftp', 'timeval', 'trie', 'tso', 'ubsan', 'ukey',
-                          'umask', 'unassociated', 'unixctl', 'uuid'
-                          'virtqueue', 'vms', 'vnet', 'vport', 'vports',
-                          'vtep', 'wc', 'wget', 'xenserver', 'util']
-
         global spell_check_dict
 
         spell_check_dict = enchant.Dict("en_US")
@@ -132,8 +67,12 @@ def open_spell_check_dict():
                     for word in words:
                         spell_check_dict.add_to_session(word.strip())
 
-        for kw in extra_keywords:
-            spell_check_dict.add_to_session(kw)
+        sw_file = os.path.join(get_top_directory(), "utilities",
+                               "checkpatch_dict.txt")
+        if os.path.exists(sw_file):
+            with open(sw_file, "r") as spelling_words:
+                for sw in spelling_words:
+                    spell_check_dict.add_to_session(sw.strip())
 
         return True
     except:
diff --git a/utilities/checkpatch_dict.txt b/utilities/checkpatch_dict.txt
new file mode 100644
index 0000000000..13f107246b
--- /dev/null
+++ b/utilities/checkpatch_dict.txt
@@ -0,0 +1,330 @@
+acl
+addresssanitizer
+afxdp
+alg
+alloc
+amd64
+api
+apis
+appctl
+appveyor
+arg
+arp
+asan
+attr
+backport
+backtrace
+bfd
+bitmask
+bool
+cacheline
+cgtime
+char
+checkpatch
+checksum
+chmod
+ci
+cirrus
+cksum
+cmap
+comparator
+conn
+conntrack
+const
+cpu
+cpus
+cstime
+csum
+cutime
+cvlan
+datapath
+datapaths
+dbg
+debian
+decap
+decapsulation
+defrag
+defragment
+deref
+dereference
+dest
+dhcp
+dhcpv4
+dhcpv6
+dnat
+dns
+dpcls
+dpctl
+dpdk
+dpif
+dst
+eip
+enablement
+encap
+enum
+enums
+eol
+epasv
+erspan
+ether
+ethernet
+ethertype
+ethtool
+eventmask
+faq
+fastpath
+fd
+fdb
+free
+freebsd
+FreeBSD
+gbps
+gcc
+gcloud
+geneve
+gid
+gigabits
+gigabytes
+github
+glibc
+goto
+gre
+gtime
+gw
+hashmap
+hashmaps
+hmap
+hotplug
+http
+https
+hugepage
+hugepages
+hw
+hwol
+icmp
+icmp4
+icmpv6
+idl
+ifdef
+ifindex
+initializer
+inlined
+int
+ip
+ipf
+ipfix
+ips
+ipsec
+ipv4
+ipv6
+ixgbe
+json
+jsonrpc
+kbps
+kilobits
+kilobytes
+l2
+l3
+l4
+lacp
+libbpf
+libcrypto
+libgcc
+libopenvswitch
+libreswan
+libssl
+libxdp
+linux
+liveness
+lldp
+llvm
+localnet
+lockless
+loopback
+malloc
+mbps
+mbuf
+mbufs
+mbundle
+mbundles
+mcast
+megabits
+megabytes
+megaflow
+megaflows
+memcmp
+mempool
+mempools
+memset
+metadata
+mfex
+miniflow
+misconfiguration
+misconfigured
+ms
+msec
+msg
+msgs
+mtu
+multicast
+mutex
+namespace
+nat
+nated
+natting
+ncat
+netdev
+netdevs
+netflow
+netlink
+networkmanager
+nic
+nicira
+nics
+ns
+nsec
+num
+numa
+odp
+ofctl
+ofpbuf
+ofpbufs
+ofport
+ofproto
+openflow
+openssl
+openvswitch
+opts
+ovs
+ovs-ctl
+ovsdb
+ovs-vswitchd
+pasv
+pcap
+pedit
+perf
+pgid
+pid
+pidfile
+pkts
+pmd
+pmds
+policer
+ppid
+pps
+pre
+prio
+promisc
+qdisc
+qos
+qsort
+rculist
+rebalance
+rebased
+recirc
+recirculation
+recirculations
+revalidate
+revalidation
+revalidator
+revalidators
+rhel
+rip
+rss
+rsslim
+rst
+rx
+rxq
+sbrec
+sed
+selinux
+sendmmsg
+sendmsg
+sflow
+shrinked
+sid
+sizeof
+skb
+skiplist
+slowpath
+smap
+snat
+src
+stats
+stderr
+stdout
+stime
+strcasecmp
+strcmp
+struct
+subnet
+subtable
+syscall
+tc
+tcp
+tcp4
+tcpv4
+testpmd
+tftp
+timeval
+tlv
+tlvs
+tnl
+tpid
+travis
+trie
+tso
+tunctl
+tuple
+tx
+txq
+ubsan
+udp
+udp4
+udpv4
+ufid
+uid
+ukey
+umask
+unassociated
+unclosed
+unicast
+unixctl
+upcall
+upcalls
+us
+usec
+userspace
+util
+utime
+uuid
+valgrind
+vconn
+vconns
+veth
+vhost
+vhostuser
+virtio
+virtqueue
+vlan
+vlans
+vms
+vnet
+vport
+vports
+vsize
+vswitch
+vswitchd
+vtep
+vxlan
+vxlans
+wc
+wget
+whcan
+wildcard
+x86_64
+xbundle
+xbundles
+xenserver
+xlate
+xlated
-- 
2.49.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to