From e875b11f74350ec7e8fbc421f1e12d092d2cf050 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 18 Jul 2020 19:38:20 +0200 Subject: [PATCH] Run codespell from a separate script in GitHub workflow This allows to give a more detailed error message in case of a problem and also makes it simpler to run the spell check locally. --- .github/workflows/code_checks.yml | 4 +++- misc/scripts/spellcheck | 32 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 misc/scripts/spellcheck diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index d3852768e0..381f88eb1f 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -39,5 +39,7 @@ jobs: pip3 install --no-warn-script-location codespell==1.17.1 - name: Run codespell + env: + CODESPELL: $HOME/.local/bin/codespell run: | - $HOME/.local/bin/codespell -I misc/suppressions/codespell-words -x misc/suppressions/codespell-lines -S 'docs/changes.txt,docs/changes_30.txt,*.png,*.ico,*.bmp,*.cur,docs/doxygen/images' README.md docs include interface + ./misc/scripts/spellcheck diff --git a/misc/scripts/spellcheck b/misc/scripts/spellcheck new file mode 100755 index 0000000000..ea6c69dddc --- /dev/null +++ b/misc/scripts/spellcheck @@ -0,0 +1,32 @@ +#!/bin/sh +CODESPELL=${CODESPELL-codespell} + +# Make sure we run codespell from the top wx directory. +cd `dirname "$0"`/../.. + +if ! command -v $CODESPELL > /dev/null; then + echo "ERROR: codespell not available." >&2 + exit 127 +fi + +$CODESPELL \ + -I misc/suppressions/codespell-words \ + -x misc/suppressions/codespell-lines \ + -S 'docs/changes.txt,docs/changes_30.txt,*.png,*.ico,*.bmp,*.cur,docs/doxygen/images' \ + README.md docs include interface + +rc=$? + +if [ $rc != 0 ]; then + cat <& 2 + exit $rc +fi