Skip to content
Snippets Groups Projects
Commit 10a8b607 authored by Danny Marc Rotscher's avatar Danny Marc Rotscher
Browse files

Merge branch 'ci-check-spelling-on-merge' into 'preview'

Added spell-checking to CI: Check whether change increases number of mistakes.

Closes #53

See merge request !260
parents 77dd93ff 0cab98ba
No related branches found
No related tags found
3 merge requests!322Merge preview into main,!319Merge preview into main,!260Added spell-checking to CI: Check whether change increases number of mistakes.
......@@ -34,6 +34,13 @@ Lint changed md-files:
doc.zih.tu-dresden.de/util/lint-changes.sh
only: [ merge_requests ]
Check spelling for changed md-files:
stage: test
script:
- docker run --rm -w /src -e CI_MERGE_REQUEST_TARGET_BRANCH_NAME "${DOCKER_IMAGE}"
doc.zih.tu-dresden.de/util/check-spelling-changes.sh
only: [ merge_requests ]
Check links for changed md-files:
stage: test
script:
......
#!/bin/bash
set -euo pipefail
scriptpath=${BASH_SOURCE[0]}
basedir=`dirname "$scriptpath"`
basedir=`dirname "$basedir"`
wordlistfile=$basedir/wordlist.aspell
function getNumberOfAspellOutputLines(){
cat - | aspell -p "$wordlistfile" --ignore 2 -l en_US list | sort -u | wc -l
}
branch="preview"
if [ -n "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
branch="origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
fi
any_fails=false
source_hash=`git merge-base HEAD "$branch"`
files=$(git diff --name-only "$source_hash")
for f in $files; do
if [ "${f: -3}" == ".md" ]; then
previous_count=`git show "$source_hash:$f" | getNumberOfAspellOutputLines`
current_count=`cat "$f" | getNumberOfAspellOutputLines`
if [ $current_count -gt $previous_count ]; then
echo "-- File $f"
echo "Change increases spelling mistake count (from $previous_count to $current_count)"
any_fails=true
fi
fi
done
if [ "$any_fails" == true ]; then
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment