mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
chore(CI): fix ci-pending.sh script for linting SQL (#16913)
* fix Checks for pending sql * remove strings in general * Update apps/ci/ci-pending.sh --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -4,17 +4,16 @@ set -e
|
||||
echo "Pending SQL check script:"
|
||||
echo
|
||||
|
||||
for i in `find data/sql/updates/pending* -name "*.sql" -type f`; do
|
||||
if $(cat "$i"|sed "s/'.*'\(.*\)/\1/g"|grep -q -i -E "(PROCEDURE|FUNCTION)"); then
|
||||
echo "> PROCEDURE check - Failed"
|
||||
exit 1
|
||||
else
|
||||
echo "> PROCEDURE check - OK"
|
||||
fi
|
||||
done
|
||||
|
||||
for i in `find data/sql/updates/pending* -name "*.sql" -type f`; do
|
||||
if [[ $(cat "$i"|sed 's/ --[^--]*$//'|tr -d '\n'|tr -d " "|tail -c 1) != ";" ]]; then
|
||||
# We want to ensure the end of file has a semicolon and doesn't have extra
|
||||
# newlines
|
||||
find data/sql/updates/pending* -name "*.sql" -type f | while read -r file; do
|
||||
# The first sed script collapses all strings into an empty string. The
|
||||
# contents of strings aren't necessary for this check and its still valid
|
||||
# sql.
|
||||
#
|
||||
# The second rule removes sql comments.
|
||||
ERR_AT_EOF="$(sed -e "s/'.*'/''/g" -e 's/ --([^-])*$//' "$file" | tr -d '\n ' | tail -c 1)"
|
||||
if [[ "$ERR_AT_EOF" != ";" ]]; then
|
||||
echo "Missing Semicolon (;) or multiple newlines at the end of the file."
|
||||
exit 1
|
||||
else
|
||||
@@ -22,8 +21,8 @@ for i in `find data/sql/updates/pending* -name "*.sql" -type f`; do
|
||||
fi
|
||||
done
|
||||
|
||||
for i in `find data/sql/updates/pending* -name "*sql" -type f`; do
|
||||
if $(cat "$i"|sed "s/'.*'\(.*\)/\1/g"|grep -q -i -E "broadcast_text"); then
|
||||
find data/sql/updates/pending* -name "*.sql" -type f | while read -r file; do
|
||||
if sed "s/'.*'\(.*\)/\1/g" "$file" | grep -q -i -E "broadcast_text"; then
|
||||
echo "> broadcast_text check - Failed"
|
||||
echo " - DON'T EDIT broadcast_text TABLE UNLESS YOU KNOW WHAT YOU ARE DOING!"
|
||||
echo " - This error can safely be ignored if the changes are approved to be sniffed."
|
||||
|
||||
Reference in New Issue
Block a user