github: Remove obsolete LGTM workflow

lgtm.com will be shutdown soon.
This commit is contained in:
Tobias Brunner
2022-12-05 16:49:07 +01:00
parent 0d3fcd100d
commit cb5ae75ac1
3 changed files with 0 additions and 160 deletions
-62
View File
@@ -397,68 +397,6 @@ apidoc)
CONFIG="--disable-defaults"
TARGET=apidoc
;;
lgtm)
if [ -z "$LGTM_PROJECT" -o -z "$LGTM_TOKEN" ]; then
echo "The LGTM_PROJECT and LGTM_TOKEN environment variables" \
"are required to run this test"
exit 0
fi
DEPS="jq"
if test -z "$1"; then
base=$COMMIT_BASE
# after rebases or for new/duplicate branches, the passed base commit
# ID might not be valid
git rev-parse -q --verify $base^{commit}
if [ $? != 0 ]; then
# this will always compare against master, while via base we
# otherwise only contains "new" commits
base=$(git merge-base origin/master ${COMMIT_ID})
fi
base=$(git rev-parse $base)
echo "Starting code review for $COMMIT_ID (base $base) on lgtm.com"
git diff --binary $base > lgtm.patch || exit $?
curl -s -X POST --data-binary @lgtm.patch \
"https://lgtm.com/api/v1.0/codereviews/${LGTM_PROJECT}?base=${base}&external-id=${BUILD_NUMBER}" \
-H 'Content-Type: application/octet-stream' \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res || exit $?
lgtm_check_url=$(jq -r '."task-result-url"' lgtm.res)
if [ -z "$lgtm_check_url" -o "$lgtm_check_url" = "null" ]; then
cat lgtm.res
exit 1
fi
lgtm_url=$(jq -r '."task-result"."results-url"' lgtm.res)
echo "Progress and full results: ${lgtm_url}"
echo -n "Waiting for completion: "
lgtm_status=pending
while [ "$lgtm_status" = "pending" ]; do
sleep 15
curl -s -X GET "${lgtm_check_url}" \
-H 'Accept: application/json' \
-H "Authorization: Bearer ${LGTM_TOKEN}" > lgtm.res
if [ $? != 0 ]; then
echo -n "-"
continue
fi
echo -n "."
lgtm_status=$(jq -r '.status' lgtm.res)
done
echo ""
if [ "$lgtm_status" != "success" ]; then
lgtm_message=$(jq -r '.["status-message"]' lgtm.res)
echo "Code review failed: ${lgtm_message}"
exit 1
fi
lgtm_new=$(jq -r '.languages[].new' lgtm.res | awk '{t+=$1} END {print t}')
lgtm_fixed=$(jq -r '.languages[].fixed' lgtm.res | awk '{t+=$1} END {print t}')
echo -n "Code review complete: "
printf "%b\n" "\e[1;31m${lgtm_new}\e[0m new alerts, \e[1;32m${lgtm_fixed}\e[0m fixed"
exit $lgtm_new
fi
;;
*)
echo "$0: unknown test $TEST" >&2
exit 1