2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

checkpatch: Separate out the built-in spelling words.

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).  This patch adds 'FreeBSD' and 'gcloud' to the list as it
was tested against
80d723736b64 ("cirrus: Update to FreeBSD 14.3 and 13.5.").  It also
adds "apis", "enablement", "ifdef", and "tnl" after the patch proposed
by Eelco at the referenced link.

Link: d6fecfc949.1750328980.git.echaudro@redhat.com/
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Aaron Conole <aconole@redhat.com>
This commit is contained in:
Aaron Conole 2025-07-15 09:41:02 -04:00
parent b5f898cc32
commit eeb7d7d995
4 changed files with 382 additions and 74 deletions

View File

@ -39,10 +39,12 @@ Subject: Patch this is.
fi fi
} }
# try_checkpatch_c_file SOURCE [ERRORS] [CHECKPATCH-ARGS] # try_checkpatch_c_file SOURCE [ERRORS] [CHECKPATCH-ARGS] [FILTER]
# #
# Runs checkpatch against test SOURCE expecting the set of specified # Runs checkpatch against test SOURCE expecting the set of specified
# ERRORS (and warnings). Optionally, sets [CHECKPATCH-ARGS] # ERRORS (and warnings). Optionally, sets [CHECKPATCH-ARGS]. The
# optional FILTER can be used to adjust the expected output before
# processing.
try_checkpatch_c_file() { try_checkpatch_c_file() {
echo "$1" | sed 's/^ //' > test.c echo "$1" | sed 's/^ //' > test.c
@ -57,7 +59,9 @@ try_checkpatch_c_file() {
AT_CHECK([OVS_SRC_DIR=$top_srcdir $PYTHON3 \ AT_CHECK([OVS_SRC_DIR=$top_srcdir $PYTHON3 \
$top_srcdir/utilities/checkpatch.py $3 -q -f test.c], $top_srcdir/utilities/checkpatch.py $3 -q -f test.c],
[1], [stdout]) [1], [stdout])
AT_CHECK([sed '/^Lines checked:/,$d' stdout], [0], [expout]) AT_CHECK([sed "$4
/^Lines checked:/d
/^$/d" stdout], [0], [expout])
else else
AT_CHECK([OVS_SRC_DIR=$top_srcdir $PYTHON3 \ AT_CHECK([OVS_SRC_DIR=$top_srcdir $PYTHON3 \
$top_srcdir/utilities/checkpatch.py $3 -q -f test.c]) $top_srcdir/utilities/checkpatch.py $3 -q -f test.c])
@ -693,8 +697,7 @@ try_checkpatch_c_file \
}" \ }" \
"WARNING: Empty return followed by brace, consider omitting "WARNING: Empty return followed by brace, consider omitting
test.c:6: test.c:6:
} }"
"
AT_CLEANUP AT_CLEANUP
AT_SETUP([checkpatch - file contents checks - parenthesized constructs]) AT_SETUP([checkpatch - file contents checks - parenthesized constructs])
@ -722,7 +725,42 @@ try_checkpatch_c_file \
}" \ }" \
"ERROR: Improper whitespace around control block "ERROR: Improper whitespace around control block
test.c:5: test.c:5:
$ctr ( first_run) { $ctr ( first_run) {"
"
done done
AT_CLEANUP 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\"
test.c:4:
/* naintenance mode */" \
"-S" \
"/^Did you mean:/d"
try_checkpatch_c_file \
"#include <foo.h>
#include <bar.h>
/* hugepage mode */
void foo() {
$ctr ( first_run ) {
something(check_node);
}
}" \
"" \
"-S"
AT_CLEANUP

View File

@ -66,6 +66,7 @@ EXTRA_DIST += \
utilities/ovs-vlan-test.in \ utilities/ovs-vlan-test.in \
utilities/ovs-vsctl-bashcomp.bash \ utilities/ovs-vsctl-bashcomp.bash \
utilities/checkpatch.py \ utilities/checkpatch.py \
utilities/checkpatch_dict.txt \
utilities/docker/Makefile \ utilities/docker/Makefile \
utilities/docker/ovs-override.conf \ utilities/docker/ovs-override.conf \
utilities/docker/start-ovs \ utilities/docker/start-ovs \

View File

@ -56,71 +56,6 @@ def open_spell_check_dict():
pass pass
try: 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 global spell_check_dict
spell_check_dict = enchant.Dict("en_US") spell_check_dict = enchant.Dict("en_US")
@ -132,8 +67,12 @@ def open_spell_check_dict():
for word in words: for word in words:
spell_check_dict.add_to_session(word.strip()) spell_check_dict.add_to_session(word.strip())
for kw in extra_keywords: check_dict_file = os.path.join(get_top_directory(), "utilities",
spell_check_dict.add_to_session(kw) "checkpatch_dict.txt")
if os.path.exists(check_dict_file):
with open(check_dict_file, "r") as project_words:
for check_word in project_words:
spell_check_dict.add_to_session(check_word.strip())
return True return True
except: except:

View File

@ -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