Add some more options to the action (#14)

* Add some more options to the action

* Add the options to the action script

* Add the ignore words tests

* Create ignore-words-file.txt

* More work on the tests

* Add some missing descriptions

* Diagnose our latest bats test failure

* Correct the IGNORE_WORDS_MISSPELLING_COUNT in the tests

* Add a test for a builtin dictionary

* Add a names typo

* Fix the test counts
This commit is contained in:
Peter Newman
2020-06-15 10:17:35 -04:00
committed by GitHub
parent 5cce0c18c5
commit da31b11da4
6 changed files with 55 additions and 1 deletions
+3
View File
@@ -71,6 +71,9 @@ jobs:
export INPUT_CHECK_FILENAMES=""
export INPUT_CHECK_HIDDEN=""
export INPUT_EXCLUDE_FILE=""
export INPUT_SKIP=""
export INPUT_IGNORE_WORDS_FILE="./test/ignore-words-file.txt"
export INPUT_IGNORE_WORDS_LIST=""
export INPUT_PATH="./test/testdata"
export INPUT_ONLY_WARN=""
./entrypoint.sh
+12
View File
@@ -18,6 +18,18 @@ inputs:
description: 'Comma-separated list of files to skip (it accepts globs as well)'
required: false
default: ''
builtin:
description: 'Comma-separated list of builtin dictionaries to include'
required: false
default: ''
ignore_words_file:
description: 'File with a list of words to be ignored'
required: false
default: ''
ignore_words_list:
description: 'Comma-separated list of words to be ignored'
required: false
default: ''
path:
description: 'Path to run codespell in'
required: false
+12
View File
@@ -28,6 +28,18 @@ echo "Skipping '${INPUT_SKIP}'"
if [ "x${INPUT_SKIP}" != "x" ]; then
command_args="${command_args} --skip ${INPUT_SKIP}"
fi
echo "Builtin dictionaries '${INPUT_BUILTIN}'"
if [ "x${INPUT_BUILTIN}" != "x" ]; then
command_args="${command_args} --builtin ${INPUT_BUILTIN}"
fi
echo "Ignore words file '${INPUT_IGNORE_WORDS_FILE}'"
if [ "x${INPUT_IGNORE_WORDS_FILE}" != "x" ]; then
command_args="${command_args} --ignore-words ${INPUT_IGNORE_WORDS_FILE}"
fi
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 "Resulting CLI options ${command_args}"
exec 5>&1
res=`{ { codespell ${command_args} ${INPUT_PATH}; echo $? 1>&4; } 1>&5; } 4>&1`
+1
View File
@@ -0,0 +1 @@
abandonned
+26
View File
@@ -7,6 +7,8 @@ ROOT_MISSPELLING_COUNT=5
FILENAME_MISSPELLING_COUNT=1
HIDDEN_MISSPELLING_COUNT=1
EXCLUDED_MISSPELLING_COUNT=1
BUILTIN_NAMES_MISSPELLING_COUNT=1
IGNORE_WORDS_MISSPELLING_COUNT=6
SUBFOLDER_MISSPELLING_COUNT=1
# From all files called example.txt
EXAMPLE_MISSPELLING_COUNT=5
@@ -20,6 +22,9 @@ function setup() {
export INPUT_CHECK_HIDDEN=""
export INPUT_EXCLUDE_FILE=""
export INPUT_SKIP=""
export INPUT_BUILTIN=""
export INPUT_IGNORE_WORDS_FILE=""
export INPUT_IGNORE_WORDS_LIST=""
export INPUT_PATH="./test/testdata"
export INPUT_ONLY_WARN=""
}
@@ -79,6 +84,27 @@ function setup() {
[ $status -eq $expectedExitStatus ]
}
@test "Use an additional builtin dictionary" {
expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT + BUILTIN_NAMES_MISSPELLING_COUNT))
INPUT_BUILTIN="clear,rare,names"
run "./entrypoint.sh"
[ $status -eq $expectedExitStatus ]
}
@test "Use an ignore words file" {
expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - IGNORE_WORDS_MISSPELLING_COUNT))
INPUT_IGNORE_WORDS_FILE="./test/ignore-words-file.txt"
run "./entrypoint.sh"
[ $status -eq $expectedExitStatus ]
}
@test "Use an ignore words list" {
expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - IGNORE_WORDS_MISSPELLING_COUNT))
INPUT_IGNORE_WORDS_LIST="abandonned"
run "./entrypoint.sh"
[ $status -eq $expectedExitStatus ]
}
@test "Custom path" {
expectedExitStatus=$((SUBFOLDER_MISSPELLING_COUNT))
INPUT_PATH="./test/testdata/subfolder"
+1 -1
View File
@@ -1 +1 @@
It's ackward when you make a spelling mistake.
It's ackward when you make a spelling mistake. My name is Tim.