Skip to content
Snippets Groups Projects
Commit 2c3211be authored by Jan Frenzel's avatar Jan Frenzel
Browse files

Reused if instead of grep to avoid checks of non-markdown files and

README.md in grep-forbidden-words.sh.
parent 0128eefb
No related branches found
No related tags found
3 merge requests!322Merge preview into main,!319Merge preview into main,!273Added tab-separated ruleset to grep-forbidden-words.sh to ease adding more rules.
......@@ -38,25 +38,27 @@ fi
any_fails=false
files=$(git diff --name-only "$(git merge-base HEAD "$branch")" | grep '.md$' | grep -v '^doc.zih.tu-dresden.de/README.md$')
files=`git diff --name-only "$(git merge-base HEAD "$branch")"`
for f in $files; do
while IFS=$'\t' read -r flags pattern exceptionPatterns; do
while IFS=$'\t' read -r -a exceptionPatternsArray; do
echo "Checking wording of $f: $pattern"
case "$flags" in
"i")
if grep -n -i "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then
any_fails=true
fi
;;
"s")
if grep -n "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then
any_fails=true
fi
;;
esac
done <<< $exceptionPatterns
done <<< $ruleset
if [ "$f" != doc.zih.tu-dresden.de/README.md -a "${f: -3}" == ".md" ]; then
while IFS=$'\t' read -r flags pattern exceptionPatterns; do
while IFS=$'\t' read -r -a exceptionPatternsArray; do
echo "Checking wording of $f: $pattern"
case "$flags" in
"i")
if grep -n -i "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then
any_fails=true
fi
;;
"s")
if grep -n "$pattern" "$f" | grepExceptions "${exceptionPatternsArray[@]}" ; then
any_fails=true
fi
;;
esac
done <<< $exceptionPatterns
done <<< $ruleset
fi
done
if [ "$any_fails" == true ]; then
......
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