Merge pull request #8 from codespell-project/peternewman-skip

Add the skip option
This commit is contained in:
Eric Larson
2020-06-03 12:53:40 -04:00
committed by GitHub
4 changed files with 40 additions and 1 deletions
+22 -1
View File
@@ -6,9 +6,14 @@ jobs:
test:
name: Run tests
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
codespell_pip_version: ['codespell', 'git+https://github.com/codespell-project/codespell.git']
codespell_pip_version: ['codespell']
experimental: [false]
include:
- codespell_pip_version: 'git+https://github.com/codespell-project/codespell.git'
experimental: true
steps:
- name: Checkout
@@ -41,3 +46,19 @@ jobs:
with:
path: test/testdata
only_warn: 1
diagnose_bats:
name: Diagnose bats
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v2
- run: pip3 --quiet --quiet install git+https://github.com/codespell-project/codespell.git
- run: |
export INPUT_CHECK_FILENAMES=""
export INPUT_CHECK_HIDDEN=""
export INPUT_EXCLUDE_FILE=""
export INPUT_PATH="./test/testdata"
export INPUT_ONLY_WARN=""
./entrypoint.sh
+4
View File
@@ -14,6 +14,10 @@ inputs:
description: 'FILE with lines that should not be changed'
requred: false
default: ''
skip:
description: 'Comma-separated list of files to skip (it accepts globs as well)'
requred: false
default: ''
path:
description: 'Path to run codespell in'
requred: false
+4
View File
@@ -24,6 +24,10 @@ echo "Exclude file '${INPUT_EXCLUDE_FILE}'"
if [ "x${INPUT_EXCLUDE_FILE}" != "x" ]; then
command_args="${command_args} --exclude-file ${INPUT_EXCLUDE_FILE}"
fi
echo "Skipping '${INPUT_SKIP}'"
if [ "x${INPUT_SKIP}" != "x" ]; then
command_args="${command_args} --skip ${INPUT_SKIP}"
fi
echo "Resulting CLI options ${command_args}"
exec 5>&1
res=`{ { codespell ${command_args} ${INPUT_PATH}; echo $? 1>&4; } 1>&5; } 4>&1`
+10
View File
@@ -8,6 +8,8 @@ FILENAME_MISSPELLING_COUNT=1
HIDDEN_MISSPELLING_COUNT=1
EXCLUDED_MISSPELLING_COUNT=1
SUBFOLDER_MISSPELLING_COUNT=1
# From all files called example.txt
EXAMPLE_MISSPELLING_COUNT=5
export RUNNER_TEMP="/foo/runner_temp"
@@ -17,6 +19,7 @@ function setup() {
export INPUT_CHECK_FILENAMES=""
export INPUT_CHECK_HIDDEN=""
export INPUT_EXCLUDE_FILE=""
export INPUT_SKIP=""
export INPUT_PATH="./test/testdata"
export INPUT_ONLY_WARN=""
}
@@ -69,6 +72,13 @@ function setup() {
[ $status -eq $expectedExitStatus ]
}
@test "Check the skip option" {
expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXAMPLE_MISSPELLING_COUNT))
INPUT_SKIP="example.txt"
run "./entrypoint.sh"
[ $status -eq $expectedExitStatus ]
}
@test "Custom path" {
expectedExitStatus=$((SUBFOLDER_MISSPELLING_COUNT))
INPUT_PATH="./test/testdata/subfolder"