-
Couldn't load subscription status.
- Fork 216
GitHub Actions Lint: spellintian, codespell #1818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
c35da8a
98767f7
66c662e
fb8a0f5
369d7b4
924f970
7cb2051
2900052
6abac14
568d533
2594579
78a58e2
3ca702b
1bb2efc
4af4b75
2951908
37bcc49
e3f5d5d
115cbbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "problemMatcher": [ | ||
| { | ||
| "owner": "lint-generic-spelling", | ||
| "pattern": [ | ||
| { | ||
| "regexp": "^(notice|error)(:(file|dir):([^:]+)(:lines? (\\d+)(-(\\d+))?)?)?: (.+)$", | ||
| "severity": 1, | ||
| "file": 4, | ||
| "line": 6, | ||
| "message": 9 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #!/usr/bin/env bash | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As sort of mentioned before, I'm beginning to wonder more if this should all become ci.sh or part of the Makefile or something, I'm not really sure. Probably makes sense to leave it until everything is migrated so we can easily re-assess what it all looks like compared to .travis-ci.sh . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I have some ideas for wrapping things but I just want to get everything working initially first. I'm significantly changing things such that I would write a new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's cool, lets leave this for the future then. |
||
| # This program is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU Library General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| # | ||
| # spellintian.sh | ||
| # Copyright (C) 2023 Perry Naseck, Peter Newman | ||
|
|
||
| # This script is based on Travis CI tests by Peter Newman | ||
| if ! [ -x "$(command -v zrun)" ]; then | ||
| echo "error: Cannot find zrun. Do you need the moreutils package?" | ||
| exit 1; | ||
| fi; | ||
| if ! [ -x "$(command -v spellintian)" ]; then | ||
| echo "error: Cannot find spellintian. Do you need the lintian package?" | ||
| exit 1; | ||
| fi; | ||
| if ! [ -x "$(command -v codespell)" ]; then | ||
| echo "error: Cannot find codespell. Install via pip." | ||
| exit 1; | ||
| fi; | ||
|
|
||
| SPELLINGBLACKLIST=$(cat <<-BLACKLIST | ||
| -wholename "./.codespellignorewords" -or \ | ||
| -wholename "./.codespellignorelines" -or \ | ||
| -wholename "./.git/*" -or \ | ||
| -wholename "./aclocal.m4" -or \ | ||
| -wholename "./config/config.guess" -or \ | ||
| -wholename "./config/config.sub" -or \ | ||
| -wholename "./config/depcomp" -or \ | ||
| -wholename "./config/install-sh" -or \ | ||
| -wholename "./config/libtool.m4" -or \ | ||
| -wholename "./config/ltmain.sh" -or \ | ||
| -wholename "./config/ltoptions.m4" -or \ | ||
| -wholename "./config/ltsugar.m4" -or \ | ||
| -wholename "./config/missing" -or \ | ||
| -wholename "./libtool" -or \ | ||
| -wholename "./config.log" -or \ | ||
| -wholename "./config.status" -or \ | ||
peternewman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| -wholename "./Makefile" -or \ | ||
| -wholename "./Makefile.in" -or \ | ||
| -wholename "./autom4te.cache/*" -or \ | ||
peternewman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| -wholename "./java/Makefile" -or \ | ||
| -wholename "./java/Makefile.in" -or \ | ||
| -wholename "./olad/www/new/js/app.min.js" -or \ | ||
| -wholename "./olad/www/new/js/app.min.js.map" -or \ | ||
| -wholename "./olad/www/new/libs/angular/js/angular.min.js" -or \ | ||
| -wholename "./olad/www/new/libs/marked/js/marked.min.js" -or \ | ||
| -wholename "./olad/www/mobile.js" -or \ | ||
| -wholename "./olad/www/ola.js" -or \ | ||
| -wholename "./configure" -or \ | ||
| -wholename "./common/protocol/Ola.pb.*" -or \ | ||
peternewman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| -wholename "./plugins/artnet/messages/ArtNetConfigMessages.pb.*" -or \ | ||
| -wholename "./tools/ola_trigger/config.tab.*" -or \ | ||
| -wholename "./tools/ola_trigger/lex.yy.cpp" | ||
| BLACKLIST | ||
| ) | ||
|
|
||
| spellingfiles=$(eval "find ./ -type f -and ! \( \ | ||
| $SPELLINGBLACKLIST \ | ||
| \) | xargs") | ||
|
|
||
| # count the number of codespell errors | ||
| codespell_errors="$(zrun codespell --interactive 0 --disable-colors --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" --exclude-file .codespellignorelines --ignore-words .codespellignorewords $spellingfiles 2>&1)" | ||
| codespell_errors_count="$([ "$codespell_errors" == "" ] && printf "0" || (printf "%s\n" "$codespell_errors" | wc -l))" | ||
| codespell_severity="$([ "$codespell_errors_count" == "0" ] && printf "notice" || printf "error" )" | ||
|
|
||
| # count the number of spellintian errors, including duplicate words | ||
| spellintian_errors="$(zrun spellintian $spellingfiles 2>&1)" | ||
| spellintian_errors_count=$([ "$spellintian_errors" == "" ] && printf "0" || (printf "%s\n" "$spellintian_errors" | wc -l)) | ||
| spellintian_severity="$([ "$spellintian_errors_count" == "0" ] && printf "notice" || printf "error" )" | ||
|
|
||
| total_errors_count="$(($spellintian_errors_count + $codespell_errors_count))" | ||
| total_severity="$([ "$total_errors_count" == "0" ] && printf "notice" || printf "error" )" | ||
|
|
||
| if [[ $spellintian_errors_count -ne 0 ]]; then | ||
| # print the output for info | ||
| printf "%s\n" "$spellintian_errors" | sed 's/^\(.*\): \(.*\)$/error:file:\1: spellintian: \2/g' | ||
| fi; | ||
|
|
||
| if [[ $codespell_errors_count -ne 0 ]]; then | ||
| # print the output for info | ||
| printf "%s\n" "$codespell_errors" | sed 's/^\(.*\):\([0-9]\+\): \(.*\)$/error:file:\1:line \2: codespell: \3/g' | ||
| fi; | ||
|
|
||
| echo "$spellintian_severity: Found $spellintian_errors_count spelling errors via spellintian" | ||
| echo "$codespell_severity: Found $codespell_errors_count spelling errors via codespell" | ||
| echo "$total_severity: Found $total_errors_count total spelling errors" | ||
| if [[ $total_errors_count -ne 0 ]]; then | ||
| exit 1; | ||
| fi; | ||
Uh oh!
There was an error while loading. Please reload this page.