format-code: simplify codespell
* Avoid copying codespell config files into the workspace.
* Drop 'ignore-words' support.
* Filter out Signed-off-by lines.
The 'openbmc-spelling-ignore.txt' file contained someone's last
name, which was being triggered by codespell as being similar enough
to a real word that it was identified as a mispelling. Instead of
keeping their name in an ignore file, filter out the Signed-off-by.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie2c96a000c352dc02a5dee1db3d2d9ea2b629cef
diff --git a/config/openbmc-spelling-ignore.txt b/config/openbmc-spelling-ignore.txt
deleted file mode 100644
index 86ae29c..0000000
--- a/config/openbmc-spelling-ignore.txt
+++ /dev/null
@@ -1 +0,0 @@
-ba
diff --git a/run-unit-test-docker.sh b/run-unit-test-docker.sh
index 30103f6..ff84e49 100755
--- a/run-unit-test-docker.sh
+++ b/run-unit-test-docker.sh
@@ -34,10 +34,8 @@
BRANCH=${BRANCH:-"master"}
OBMC_BUILD_SCRIPTS="openbmc-build-scripts"
UNIT_TEST_PY_DIR="scripts"
-CONFIG_DIR="config"
UNIT_TEST_PY="unit-test.py"
FORMAT_CODE_SH="format-code.sh"
-SPELLINGS_TXT="openbmc-spelling.txt openbmc-spelling-ignore.txt"
DBUS_UNIT_TEST_PY="dbus-unit-test.py"
TEST_ONLY="${TEST_ONLY:-}"
DBUS_SYS_CONFIG_FILE=${dbus_sys_config_file:-"/usr/share/dbus-1/system.conf"}
@@ -80,12 +78,6 @@
"${WORKSPACE}"/${FORMAT_CODE_SH}
chmod a+x "${WORKSPACE}"/${FORMAT_CODE_SH}
-# Copy spellings.txt file into workspace
-for f in ${SPELLINGS_TXT}; do
- cp "${WORKSPACE}/${OBMC_BUILD_SCRIPTS}/${CONFIG_DIR}/${f}" \
- "${WORKSPACE}/${f}"
-done
-
# Configure docker build
cd "${WORKSPACE}"/${OBMC_BUILD_SCRIPTS}
echo "Building docker image with build-unit-test-docker"
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
index d5a9730..3bc4baa 100755
--- a/scripts/format-code.sh
+++ b/scripts/format-code.sh
@@ -11,6 +11,7 @@
DIR=$1
WORKSPACE=$PWD
+WORKSPACE_CONFIG="${WORKSPACE}/openbmc-build-scripts/config"
set -e
@@ -18,19 +19,19 @@
# Run the codespell with openbmc spcific spellings on the patchset
echo "openbmc-dictionary - misspelling count >> "
-codespell -D openbmc-spelling.txt -d --count "${DIR}"/.git/COMMIT_EDITMSG
+sed "s/Signed-off-by.*//" "${DIR}/.git/COMMIT_EDITMSG" | \
+ codespell -D "${WORKSPACE_CONFIG}/openbmc-spelling.txt" -d --count -
# Run the codespell with generic dictionary on the patchset
echo "generic-dictionary - misspelling count >> "
-codespell --builtin clear,rare,en-GB_to_en-US -d --count \
- --ignore-words=openbmc-spelling-ignore.txt \
- "${DIR}"/.git/COMMIT_EDITMSG
+sed "s/Signed-off-by.*//" "${DIR}/.git/COMMIT_EDITMSG" | \
+ codespell --builtin clear,rare,en-GB_to_en-US -d --count -
# Check for commit message issues
gitlint \
--target "${DIR}" \
- --extra-path "${WORKSPACE}/openbmc-build-scripts/config/gitlint/" \
- --config "${WORKSPACE}/openbmc-build-scripts/config/.gitlint"
+ --extra-path "${WORKSPACE_CONFIG}/gitlint/" \
+ --config "${WORKSPACE_CONFIG}/.gitlint"
cd "${DIR}"
@@ -48,7 +49,7 @@
ESLINT_RC="-c .eslintrc.json"
else
echo "Running the json validator on the repo using the global config"
- ESLINT_RC="--no-eslintrc -c ${WORKSPACE}/openbmc-build-scripts/config/eslint-global-config.json"
+ ESLINT_RC="--no-eslintrc -c ${WORKSPACE_CONFIG}/eslint-global-config.json"
fi
ESLINT_COMMAND="eslint . ${ESLINT_IGNORE} ${ESLINT_RC} \