Skip to content

Commit

Permalink
banned-words.sh added
Browse files Browse the repository at this point in the history
How to add a second keyword? e.g. tww and wastewater
  • Loading branch information
sjib committed May 8, 2024
1 parent 0df4769 commit 68e40a3
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions scripts/banned-words.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# This test checks for use of deprecated/outdated methods and suggests their replacement

declare -a KEYWORDS=()
declare -a HINTS=()
declare -a EXCLUDES=()

KEYWORDS[0]="qgep"
HINTS[0]="No mention of QGEP"

RES=0
DIR=$(git rev-parse --show-toplevel)

pushd "${DIR}" >/dev/null || exit

for i in "${!KEYWORDS[@]}"; do
FOUND=$(git grep "${KEYWORDS[$i]}" -- '*' -- ':!*banned-words.sh' ':!docs/en/wincan2qgep/**' ':!docs/.tx/config' | grep --invert-match skip-keyword-check)

if [[ ${FOUND} ]]; then
echo "Found source files with banned keyword: ${KEYWORDS[$i]}!"
echo " -> ${HINTS[$i]}"
echo " or mark with // skip-keyword-check"
echo
echo "${FOUND}"
echo
RES=1
fi

done

popd >/dev/null || exit

if [[ $RES -eq 1 ]]; then
echo " *** Found banned keywords"
fi

exit $RES

0 comments on commit 68e40a3

Please sign in to comment.