Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
description: 'If set, check hidden files (those starting with ".") as well'
required: false
default: ''
quiet_level:
description: 'Bitmask that allows suppressing messages'
required: false
default: ''
exclude_file:
description: 'File with lines that should not be checked for spelling mistakes'
required: false
Expand Down
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ if [ -n "${INPUT_CHECK_HIDDEN}" ]; then
echo "Checking hidden"
command_args="${command_args} --check-hidden"
fi
echo "Check quiet level? '${INPUT_QUIET_LEVEL}'"
if [ -n "${INPUT_QUIET_LEVEL}" ]; then
echo "Checking quiet level"
command_args="${command_args} --quiet-level ${INPUT_QUIET_LEVEL}"
fi
echo "Exclude file '${INPUT_EXCLUDE_FILE}'"
if [ "x${INPUT_EXCLUDE_FILE}" != "x" ]; then
command_args="${command_args} --exclude-file ${INPUT_EXCLUDE_FILE}"
Expand Down
13 changes: 13 additions & 0 deletions test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ROOT_MISSPELLING_COUNT=5
FILENAME_MISSPELLING_COUNT=1
HIDDEN_MISSPELLING_COUNT=1
QUIET_LEVEL_MISSPELLING_COUNT=1
EXCLUDED_MISSPELLING_COUNT=1
BUILTIN_NAMES_MISSPELLING_COUNT=1
IGNORE_WORDS_MISSPELLING_COUNT=5
Expand All @@ -35,6 +36,7 @@ function setup() {
# Set default input values
export INPUT_CHECK_FILENAMES=""
export INPUT_CHECK_HIDDEN=""
export INPUT_QUIET_LEVEL=""
export INPUT_EXCLUDE_FILE=""
export INPUT_SKIP=""
export INPUT_BUILTIN=""
Expand Down Expand Up @@ -82,6 +84,17 @@ function setup() {
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
}

@test "Check quiet level" {
errorCount=$QUIET_LEVEL_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_QUIET_LEVEL="0"
INPUT_PATH="./test/testdata/example.bin"
run "./entrypoint.sh"
[ $status -eq $expectedExitStatus ]
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
}

@test "Check a hidden file without INPUT_CHECK_HIDDEN set" {
errorCount=0
# codespell's exit status is 0, or 65 if there are errors found
Expand Down