devtools: add checkpatch spelling dictionary builder

The script checkpatch.pl (used in checkpatches.sh) can use a dictionary
from the codespell project to check spelling.
There are multiple dictionaries to be used.

The script build-dict.sh concatenate multiple dictionaries and remove
some annoying false positives.

The dictionary built by this script must be saved in a file which
is referenced with the environment variable DPDK_CHECKPATCH_CODESPELL.
The easiest is to export this variable in ~/.config/dpdk/devel.config.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
This commit is contained in:
Thomas Monjalon 2020-07-07 10:35:55 +02:00
parent b071f1fa88
commit 7dba4148ca
2 changed files with 23 additions and 0 deletions

View File

@ -85,6 +85,7 @@ F: doc/
Developers and Maintainers Tools
M: Thomas Monjalon <thomas@monjalon.net>
F: MAINTAINERS
F: devtools/build-dict.sh
F: devtools/check-dup-includes.sh
F: devtools/check-maintainers.sh
F: devtools/check-forbidden-tokens.awk

22
devtools/build-dict.sh Executable file
View File

@ -0,0 +1,22 @@
#! /bin/sh -e
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2020 Mellanox Technologies, Ltd
# Build a spelling dictionary suitable for DPDK_CHECKPATCH_CODESPELL
# path to local clone of https://github.com/codespell-project/codespell.git
codespell_path=$1
# concatenate codespell dictionaries, except GB/US one
for suffix in .txt _code.txt _informal.txt _names.txt _rare.txt _usage.txt ; do
cat $codespell_path/codespell_lib/data/dictionary$suffix
done |
# remove too short or wrong checks
sed '/^..->/d' |
sed '/^uint->/d' |
sed "/^doesn'->/d" |
sed '/^wasn->/d' |
# print to stdout
cat