Browse Source

codacy

pull/4207/head
Daniel Gibbs 2 years ago
parent
commit
0ddc00f07b
  1. 6
      .github/workflows/serverlist-validate.sh

6
.github/workflows/serverlist-validate.sh

@ -2,14 +2,14 @@
echo "Checking that all the game servers are listed in all csv files" echo "Checking that all the game servers are listed in all csv files"
echo "this check will ensure serverlist.csv has the same number of lines (-2 lines) as the other csv files" echo "this check will ensure serverlist.csv has the same number of lines (-2 lines) as the other csv files"
# count the number of lines in the serverlist.csv # count the number of lines in the serverlist.csv
cd lgsm/data cd "lgsm/data" || exit
serverlistcount="$(wc -l < serverlist.csv)" serverlistcount="$(wc -l < serverlist.csv)"
echo "serverlistcount: $serverlistcount" echo "serverlistcount: $serverlistcount"
# get list of all csv files starting with ubunutu debian centos # get list of all csv files starting with ubunutu debian centos
csvlist="$(ls -1 | grep -E '^(ubuntu|debian|centos|rhel|almalinux|rocky).*\.csv$')" csvlist="$(ls -1 | grep -E '^(ubuntu|debian|centos|rhel|almalinux|rocky).*\.csv$')"
# loop though each csv file and make sure the number of lines is the same as the serverlistcount # loop though each csv file and make sure the number of lines is the same as the serverlistcount
for csv in $csvlist; do for csv in $csvlist; do
csvcount="$(wc -l < $csv)" csvcount="$(wc -l < "${csv}")"
csvcount=$((csvcount-2)) csvcount=$((csvcount-2))
if [ "$csvcount" -ne "$serverlistcount" ]; then if [ "$csvcount" -ne "$serverlistcount" ]; then
echo "ERROR: $csv ($csvcount) does not match serverlist.csv ($serverlistcount)" echo "ERROR: $csv ($csvcount) does not match serverlist.csv ($serverlistcount)"
@ -19,4 +19,4 @@ for csv in $csvlist; do
fi fi
done done
exit ${exitcode} exit "${exitcode}"

Loading…
Cancel
Save