CMake/.gitlab/ci/typos.bash
Alex Turbov c3777c1536 ci: Extend spellcheck job with 'typos' tool
Unlike the `codespell`, `typos` is capable of finding typos
in combined identifiers (`CamelCase` or `snake_case`).
2025-01-22 08:51:45 -05:00

18 lines
370 B
Bash
Executable File

#!/bin/sh
set -e
result=0
echo "Running 'typos' on source code..."
typos || result=1
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
echo "Running 'typos' on commit message of $COMMIT..."
git show --format=%B -s "$COMMIT" | typos - || result=1
done
fi
exit $result