add uri_ignore_words_list option (#46)
Testing / Check for spelling errors (push) Successful in 3s
Testing / Run tests (git+https://github.com/codespell-project/codespell.git, false) (push) Successful in 13s
Publish stable image / Publish stable image (push) Failing after 2s
Testing / Test run action (push) Successful in 4s
Testing / Run tests (codespell, false) (push) Successful in 6s
Testing / Diagnose bats (codespell) (push) Skipped
Testing / Diagnose bats (git+https://github.com/codespell-project/codespell.git) (push) Skipped

This commit is contained in:
Daniel McCloy
2022-08-18 16:09:11 -04:00
committed by GitHub
parent 2391250ab0
commit 22ff5a2e4b
5 changed files with 37 additions and 2 deletions
+14
View File
@@ -95,6 +95,20 @@ with:
ignore_words_list: abandonned,ackward
```
### Parameter: uri_ignore_words_list
Comma-separated list of words which will be ignored by `codespell` in URIs and emails only.
Words are case sensitive based on how they are written in the dictionary file.
If set to "*", all misspelling in URIs and emails will be ignored.
This parameter is optional; by default `codespell` will check all URIs and emails for typos.
```
uses: codespell-project/actions-codespell@master
with:
uri_ignore_words_list: abandonned
```
### Parameter: path
Indicates the path to run `codespell` in.
+4
View File
@@ -30,6 +30,10 @@ inputs:
description: 'Comma-separated list of words to be ignored. Words are case sensitive based on how they are written in the dictionary file'
required: false
default: ''
uri_ignore_words_list:
description: 'comma separated list of words to be ignored in URIs and emails only'
required: false
default: ''
path:
description: 'Path to run codespell in'
required: false
+4
View File
@@ -40,6 +40,10 @@ echo "Ignore words list '${INPUT_IGNORE_WORDS_LIST}'"
if [ "x${INPUT_IGNORE_WORDS_LIST}" != "x" ]; then
command_args="${command_args} --ignore-words-list ${INPUT_IGNORE_WORDS_LIST}"
fi
echo "Ignore URI words list '${INPUT_URI_IGNORE_WORDS_LIST}'"
if [ "x${INPUT_URI_IGNORE_WORDS_LIST}" != "x" ]; then
command_args="${command_args} --uri-ignore-words-list ${INPUT_URI_IGNORE_WORDS_LIST}"
fi
echo "Resulting CLI options ${command_args}"
exec 5>&1
res=`{ { codespell --count ${command_args} ${INPUT_PATH}; echo $? 1>&4; } 1>&5; } 4>&1`
+14 -2
View File
@@ -7,12 +7,13 @@
# This currently breaks the tests, so only enabling when troubleshooting
#load teardown
ROOT_MISSPELLING_COUNT=5
ROOT_MISSPELLING_COUNT=6
FILENAME_MISSPELLING_COUNT=1
HIDDEN_MISSPELLING_COUNT=1
EXCLUDED_MISSPELLING_COUNT=1
BUILTIN_NAMES_MISSPELLING_COUNT=1
IGNORE_WORDS_MISSPELLING_COUNT=5
URI_IGNORE_WORDS_MISSPELLING_COUNT=1
SUBFOLDER_MISSPELLING_COUNT=1
# From all files called example.txt
EXAMPLE_MISSPELLING_COUNT=5
@@ -40,6 +41,7 @@ function setup() {
export INPUT_BUILTIN=""
export INPUT_IGNORE_WORDS_FILE=""
export INPUT_IGNORE_WORDS_LIST=""
export INPUT_URI_IGNORE_WORDS_LIST=""
export INPUT_PATH="./test/testdata"
export INPUT_ONLY_WARN=""
}
@@ -103,7 +105,7 @@ function setup() {
}
@test "Check the skip option" {
errorCount=$((ROOT_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXAMPLE_MISSPELLING_COUNT))
errorCount=$((ROOT_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXAMPLE_MISSPELLING_COUNT - URI_IGNORE_WORDS_MISSPELLING_COUNT))
# codespell's exit status is 0, or 65 if there are errors found
if [ $errorCount -eq 0 ]; then expectedExitStatus=0; else expectedExitStatus=65; fi
INPUT_SKIP="example.txt"
@@ -142,6 +144,16 @@ function setup() {
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
}
@test "Use a URI ignore words list" {
errorCount=$((ROOT_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - URI_IGNORE_WORDS_MISSPELLING_COUNT))
# codespell's exit status is 0, or 65 if there are errors found
if [ $errorCount -eq 0 ]; then expectedExitStatus=0; else expectedExitStatus=65; fi
INPUT_URI_IGNORE_WORDS_LIST="bu"
run "./entrypoint.sh"
[ $status -eq $expectedExitStatus ]
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
}
@test "Custom path" {
errorCount=$((SUBFOLDER_MISSPELLING_COUNT))
# codespell's exit status is 0, or 65 if there are errors found
+1
View File
@@ -2,3 +2,4 @@
Abandonned
ABANDONNED
AbAnDoNnEd
https://www.bu.edu