codespell: Exclude paths by patterns following pre-commit check conventions
In order to share `.codespellrc` between our CI checks and `pre-commit` checks, we need to match paths without the leading `./`. Convert to a `bash` script so we can use `dotglob` to pass paths explicitly. Unfortunately this means we can no longer run `codespell` manually with no arguments. Instead we can run `.gitlab/ci/codespell.bash`.
This commit is contained in:
parent
11d0a631d4
commit
d11552c2d9
23
.codespellrc
23
.codespellrc
@ -5,18 +5,19 @@ check-hidden =
|
||||
quiet-level = 2
|
||||
builtin = clear,rare,en-GB_to_en-US
|
||||
|
||||
# Skip paths matching fnmatch glob patterns.
|
||||
skip =
|
||||
*/.git,
|
||||
*/build,
|
||||
*/Copyright.txt,
|
||||
*/CTestCustom.cmake.in,
|
||||
*/Modules/Internal/CPack/NSIS.template.in,
|
||||
*/Source/CursesDialog/form/*,
|
||||
*/Source/kwsys/*,
|
||||
*/Tests/RunCMake/CPack/tests/DMG_SLA/German.*,
|
||||
*/Tests/RunCMake/ParseImplicitData/*.input,
|
||||
*/Tests/StringFileTest/test.utf8,
|
||||
*/Utilities/cm*,
|
||||
.git,
|
||||
build,
|
||||
Copyright.txt,
|
||||
CTestCustom.cmake.in,
|
||||
Modules/Internal/CPack/NSIS.template.in,
|
||||
Source/CursesDialog/form/*,
|
||||
Source/kwsys/*,
|
||||
Tests/RunCMake/CPack/tests/DMG_SLA/German.*,
|
||||
Tests/RunCMake/ParseImplicitData/*.input,
|
||||
Tests/StringFileTest/test.utf8,
|
||||
Utilities/cm*,
|
||||
*.pfx,
|
||||
|
||||
ignore-words-list =
|
||||
|
@ -4,8 +4,12 @@ set -e
|
||||
|
||||
result=0
|
||||
|
||||
# 'codespell' with no arguments adds a leading './' to all paths.
|
||||
# Avoid that by globbing top-level entries explicitly.
|
||||
shopt -s dotglob
|
||||
echo "Running 'codespell' on source code..."
|
||||
codespell || result=1
|
||||
codespell * || result=1
|
||||
shopt -u dotglob
|
||||
|
||||
if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
|
||||
for COMMIT in $(git rev-list "^$CI_MERGE_REQUEST_DIFF_BASE_SHA" "$CI_COMMIT_SHA"); do
|
@ -584,7 +584,7 @@
|
||||
stage: build
|
||||
extends: .fedora41
|
||||
script:
|
||||
- .gitlab/ci/codespell.sh
|
||||
- .gitlab/ci/codespell.bash
|
||||
interruptible: true
|
||||
|
||||
.cmake_build_linux:
|
||||
|
Loading…
Reference in New Issue
Block a user