scripts: Add codespell check
authorAndreas Schneider <asn@samba.org>
Tue, 14 Mar 2023 07:51:03 +0000 (08:51 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 14 Aug 2023 21:45:30 +0000 (21:45 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
.codespellignore [new file with mode: 0644]
.codespellrc [new file with mode: 0644]
script/codespell.sh [new file with mode: 0755]

diff --git a/.codespellignore b/.codespellignore
new file mode 100644 (file)
index 0000000..ee56c0a
--- /dev/null
@@ -0,0 +1,49 @@
+aas
+afile
+ags
+ans
+blong
+browseable
+bu
+clen
+daa
+ect
+fo
+hampster
+htmp
+ifset
+inout
+ist
+keypair
+mis
+nd
+ois
+ommit
+ot
+otherwrite
+parm
+parm
+parms
+pevent
+plese
+pres
+rcall
+readd
+ro
+siz
+slq
+sorce
+som
+stap
+strin
+thur
+te
+tung
+ue
+unsecure
+unx
+uptodateness
+ypes
+som
+vas
+wronly
diff --git a/.codespellrc b/.codespellrc
new file mode 100644 (file)
index 0000000..de4f0fb
--- /dev/null
@@ -0,0 +1,4 @@
+[codespell]
+skip = ./bin,./docs-xml/archives,./docs-xml/manpages/vfs_fruit.8.xml,./docs-xml/smbdotconf/browse/preferredmaster.xml,./lib/ldb/ldb_sqlite3/trees.ps,./libcli/util/ntstatus.h,./libcli/util/hresult.c,./python/samba/tests/blackbox/testdata,./source3/include/MacExtensions.h,./source3/selftest/ktest-krb5_ccache-2.txt,./source4/setup/display-specifiers,./source4/ldap_server/devdocs,./source4/selftest/provisions,./source4/setup/adprep/WindowsServerDocs,./source4/setup/display-specifiers,./source4/torture/vfs/fruit.c,./testdata,./third_party,*.IBM-DS,*.config,*.diff,*.dump,*.ldif,*.ldf,*.pdml,*.pem,*.po,*.schema
+ignore-regex = \\[t]
+ignore-words = .codespellignore
diff --git a/script/codespell.sh b/script/codespell.sh
new file mode 100755 (executable)
index 0000000..60e0eba
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Check code spelling
+
+if [ $# -lt 1 ]; then
+       echo "Usage: $(basename "${0}") DIR"
+       exit 1
+fi
+
+DIR="${1}"
+
+codespell "${DIR}"
+ret=$?
+
+if [ ${ret} -ne 0 ]; then
+       echo
+       echo "Fix code spelling issues. If it detected false positives" \
+            "please update .codespellignore."
+fi
+
+exit ${ret}