From ebc418a02a145346e5bc1703d7eb336595920cfb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Jul 2020 02:27:08 +0200 Subject: [PATCH 1/9] Move codespell ignore file to new misc/suppressions directory This is not really a script, so having it under misc/scripts was not very logical. Also rename it to explicitly indicate that this file contains the words to ignore as the next commit will also add another file ignoring the whole lines. --- misc/{scripts/codespell.ignore => suppressions/codespell-words} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename misc/{scripts/codespell.ignore => suppressions/codespell-words} (100%) diff --git a/misc/scripts/codespell.ignore b/misc/suppressions/codespell-words similarity index 100% rename from misc/scripts/codespell.ignore rename to misc/suppressions/codespell-words From 1eccf833f9789b05ad1423cc266585851862a27e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Jul 2020 02:24:47 +0200 Subject: [PATCH 2/9] Add codespell line suppression file This file is used with "-x misc/suppressions/codespell-lines" codespell option and allows to ignore entire lines, instead of ignoring words that only occur once or twice and shouldn't be ignored globally because they could well be misspelt elsewhere. The remaining words in codespell.ignore occur too many times (as parameter names in various places) to be ignored in this way. --- misc/suppressions/codespell-lines | 25 +++++++++++++++++++++++++ misc/suppressions/codespell-words | 3 --- 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 misc/suppressions/codespell-lines diff --git a/misc/suppressions/codespell-lines b/misc/suppressions/codespell-lines new file mode 100644 index 0000000000..e80bff8717 --- /dev/null +++ b/misc/suppressions/codespell-lines @@ -0,0 +1,25 @@ +wxMessageBox(L"Salut \u00E0 toi!"); // U+00E0 is "Latin Small Letter a with Grave" +wxMessageBox("Salut à toi!"); +wxMessageBox(wxString::FromUTF8("Salut \xC3\xA0 toi!")); +(week|wee)(night|knights) matches all ten characters of "weeknights", +expressions (BRE). EREs are roughly those of the traditional @e egrep, +@row2col{ b , Rest of RE is a BRE. } + the ARE (?: or the BRE \(. + return wxPrivate::wxAnyAsImpl::DoAs(*this); + static T DoAs(const wxAny& any) + static wxString DoAs(const wxAny& any) + removeable, + virtual void HandleLineEvent( unsigned int n, bool doubleClick ); + sequence of labels is A, B, ..., Z, AA, AB, ..., AZ, BA, ..., ..., ZZ, + wxEdge otherE, + void swap(wxScopedPtr& ot); + SEH (structured exception handling) which currently means only Microsoft + void Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN); +// Copyright: (c) 2009 Marcin Malich + * All of the settings below require SEH support (__try/__catch) and can't work + the version check in `include/wx/msw/seh.h` to suppress this warning for the +#endif /* compiler doesn't support SEH */ +// Name: wx/msw/seh.h +// Purpose: declarations for SEH (structured exceptions handling) support + // 2019), i.e. SEH translator seems to work just fine without /EHa too, so +// Purpose: helpers for the structured exception handling (SEH) under Win32 diff --git a/misc/suppressions/codespell-words b/misc/suppressions/codespell-words index 913a7b6c48..693a2774ec 100644 --- a/misc/suppressions/codespell-words +++ b/misc/suppressions/codespell-words @@ -1,6 +1,3 @@ convertor -malcom ot -othere -seh ser From e4a826d25073ff1e9a9de6bedf3cdc1ca2896c12 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Jul 2020 17:11:21 +0200 Subject: [PATCH 3/9] Add GitHub workflow checking spelling for headers and docs Run codespell using GitHub Actions to flag any new spelling errors. --- .github/workflows/code_checks.yml | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/code_checks.yml diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml new file mode 100644 index 0000000000..0e16b0a147 --- /dev/null +++ b/.github/workflows/code_checks.yml @@ -0,0 +1,43 @@ +# This workflow does some quick checks. +name: Code Checks + +on: + push: + branches: + - master + paths: + - '.github/workflows/code_checks.yml' + - 'docs/**' + - 'include/**' + - 'interface/**' + - 'misc/suppressions/**' + - '**/*.md' + - '!docs/changes*txt' + pull_request: + branches: + - master + paths: + - '.github/workflows/code_checks.yml' + - 'docs/**' + - 'include/**' + - 'interface/**' + - 'misc/suppressions/**' + - '**/*.md' + - '!docs/changes*txt' + +jobs: + check-unix: + runs-on: ubuntu-20.04 + name: Check Spelling + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install codespell + run: | + sudo apt install codespell + + - name: Run codespell + run: | + codespell -I misc/suppressions/codespell-words -x misc/suppressions/codespell-lines -S docs/changes.txt -S docs/changes_30.txt -S '*.png' -S '*.ico' -S '*.bmp' -S '*.cur' -S docs/doxygen/images README.md docs include interface From 1fcdaa7f229d2538d3d1db8374b54de7f08eb81e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Jul 2020 17:25:18 +0200 Subject: [PATCH 4/9] Combine all values of codespell --skip option into one codespell 1.17.1 from Debian Sid accepts multiple -S options, but 1.16 in Ubuntu 20.04 doesn't seem to like them. --- .github/workflows/code_checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index 0e16b0a147..db57fa3f4d 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -40,4 +40,4 @@ jobs: - name: Run codespell run: | - codespell -I misc/suppressions/codespell-words -x misc/suppressions/codespell-lines -S docs/changes.txt -S docs/changes_30.txt -S '*.png' -S '*.ico' -S '*.bmp' -S '*.cur' -S docs/doxygen/images README.md docs include interface + 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 From d432b1a685ea71ff014f93df3a8c2954edf3f9fa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Jul 2020 17:30:47 +0200 Subject: [PATCH 5/9] Try installing codespell 1.17.1 via pip The 1.16 version available in Ubuntu 20.04 doesn't work nearly as well as the latest one. --- .github/workflows/code_checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index db57fa3f4d..247bb4eeef 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -36,7 +36,7 @@ jobs: - name: Install codespell run: | - sudo apt install codespell + pip install codespell==1.17.1 - name: Run codespell run: | From 77e1e6330b8d52c16f02333a496b7914c1645698 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Jul 2020 17:33:50 +0200 Subject: [PATCH 6/9] Run codespell from where it is installed by pip And disable the (useful) warning about this directory not being in PATH. --- .github/workflows/code_checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index 247bb4eeef..94eedcdc5f 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -36,8 +36,8 @@ jobs: - name: Install codespell run: | - pip install codespell==1.17.1 + pip install --no-warn-script-location codespell==1.17.1 - name: Run codespell run: | - 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 + $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 From 0744cd14a182e7ff33313ea80e4aed22c9e12f55 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Jul 2020 17:38:01 +0200 Subject: [PATCH 7/9] Try using Python 3 for codespell Running it using Python 2 seems to result in a problem with not matching an exclusion line with non-ASCII character, which works fine with Python 3 locally. --- .github/workflows/code_checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index 94eedcdc5f..d3852768e0 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -36,7 +36,7 @@ jobs: - name: Install codespell run: | - pip install --no-warn-script-location codespell==1.17.1 + pip3 install --no-warn-script-location codespell==1.17.1 - name: Run codespell run: | From 96bac38274049a01ee58ff4012877ca5a5671b3a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Jul 2020 17:38:47 +0200 Subject: [PATCH 8/9] Fix spelling mistakes found by codespell --- docs/index.htm | 2 +- docs/msw/install.md | 2 +- docs/wine/install.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.htm b/docs/index.htm index 5d1c28d77e..43a6fbc0c0 100644 --- a/docs/index.htm +++ b/docs/index.htm @@ -127,7 +127,7 @@

Contributor Notes

Contributor notes contain information useful only to wxWidgets developers - for the maintainance of the project:

+ for the maintenance of the project:

  • Index of Contributor Notes
  • diff --git a/docs/msw/install.md b/docs/msw/install.md index 1c70494833..21a5c3d5fd 100644 --- a/docs/msw/install.md +++ b/docs/msw/install.md @@ -299,7 +299,7 @@ debug mode, edit makefile.bcc and change /aa to /Tpe in link commands. Using the Debugger and IDE in BDS or Turbo Explorer --------------------------------------------------- -Doubleclick / open \%WXWIN\%\samples\minimal\borland.bdsproj. The current version +Double-click / open \%WXWIN\%\samples\minimal\borland.bdsproj. The current version is to be used with a dynamic build of wxWidgets-made by running make -f Makefile.bcc -DBUILD=debug -DSHARED=1 in wxWidgets\build\msw. You also need the `wxWidgets\lib\bcc_dll` diff --git a/docs/wine/install.txt b/docs/wine/install.txt index e6e3d3311b..8563f41f1c 100644 --- a/docs/wine/install.txt +++ b/docs/wine/install.txt @@ -367,7 +367,7 @@ configure --disable-static --enable-shared --enable-gui \ --with-libjpeg --enable-debug_cntxt Compiling a sample won't work yet because 'winebuild' needs -to be called, and the resuling C file compiled and linked. +to be called, and the resulting C file compiled and linked. Plus, Windows DLLs need to be imported. Note that the documentation on the WINE web site on using From e875b11f74350ec7e8fbc421f1e12d092d2cf050 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 18 Jul 2020 19:38:20 +0200 Subject: [PATCH 9/9] 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