Skip to content

Commit a945b50

Browse files
authored
Merge pull request #8 from codespell-project/peternewman-skip
Add the skip option
2 parents bed0b23 + 41ddf53 commit a945b50

4 files changed

Lines changed: 40 additions & 1 deletion

File tree

.github/workflows/testing.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ jobs:
66
test:
77
name: Run tests
88
runs-on: ubuntu-latest
9+
continue-on-error: ${{ matrix.experimental }}
910
strategy:
1011
matrix:
11-
codespell_pip_version: ['codespell', 'git+https://github.com/codespell-project/codespell.git']
12+
codespell_pip_version: ['codespell']
13+
experimental: [false]
14+
include:
15+
- codespell_pip_version: 'git+https://github.com/codespell-project/codespell.git'
16+
experimental: true
1217

1318
steps:
1419
- name: Checkout
@@ -41,3 +46,19 @@ jobs:
4146
with:
4247
path: test/testdata
4348
only_warn: 1
49+
50+
diagnose_bats:
51+
name: Diagnose bats
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v1
55+
- name: Set up Python
56+
uses: actions/setup-python@v2
57+
- run: pip3 --quiet --quiet install git+https://github.com/codespell-project/codespell.git
58+
- run: |
59+
export INPUT_CHECK_FILENAMES=""
60+
export INPUT_CHECK_HIDDEN=""
61+
export INPUT_EXCLUDE_FILE=""
62+
export INPUT_PATH="./test/testdata"
63+
export INPUT_ONLY_WARN=""
64+
./entrypoint.sh

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
description: 'FILE with lines that should not be changed'
1515
requred: false
1616
default: ''
17+
skip:
18+
description: 'Comma-separated list of files to skip (it accepts globs as well)'
19+
requred: false
20+
default: ''
1721
path:
1822
description: 'Path to run codespell in'
1923
requred: false

entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ echo "Exclude file '${INPUT_EXCLUDE_FILE}'"
2424
if [ "x${INPUT_EXCLUDE_FILE}" != "x" ]; then
2525
command_args="${command_args} --exclude-file ${INPUT_EXCLUDE_FILE}"
2626
fi
27+
echo "Skipping '${INPUT_SKIP}'"
28+
if [ "x${INPUT_SKIP}" != "x" ]; then
29+
command_args="${command_args} --skip ${INPUT_SKIP}"
30+
fi
2731
echo "Resulting CLI options ${command_args}"
2832
exec 5>&1
2933
res=`{ { codespell ${command_args} ${INPUT_PATH}; echo $? 1>&4; } 1>&5; } 4>&1`

test/test.bats

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ FILENAME_MISSPELLING_COUNT=1
88
HIDDEN_MISSPELLING_COUNT=1
99
EXCLUDED_MISSPELLING_COUNT=1
1010
SUBFOLDER_MISSPELLING_COUNT=1
11+
# From all files called example.txt
12+
EXAMPLE_MISSPELLING_COUNT=5
1113

1214
export RUNNER_TEMP="/foo/runner_temp"
1315

@@ -17,6 +19,7 @@ function setup() {
1719
export INPUT_CHECK_FILENAMES=""
1820
export INPUT_CHECK_HIDDEN=""
1921
export INPUT_EXCLUDE_FILE=""
22+
export INPUT_SKIP=""
2023
export INPUT_PATH="./test/testdata"
2124
export INPUT_ONLY_WARN=""
2225
}
@@ -69,6 +72,13 @@ function setup() {
6972
[ $status -eq $expectedExitStatus ]
7073
}
7174

75+
@test "Check the skip option" {
76+
expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXAMPLE_MISSPELLING_COUNT))
77+
INPUT_SKIP="example.txt"
78+
run "./entrypoint.sh"
79+
[ $status -eq $expectedExitStatus ]
80+
}
81+
7282
@test "Custom path" {
7383
expectedExitStatus=$((SUBFOLDER_MISSPELLING_COUNT))
7484
INPUT_PATH="./test/testdata/subfolder"

0 commit comments

Comments
 (0)