From 122d137241eee0a8915646915d853c99c365121c Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Wed, 1 Apr 2026 17:11:48 +0200 Subject: Neovim: Python-Provider, Bessere Statusline und Sonarqube überarbeitet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nvim/scripts/sonarqube.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'nvim/scripts') diff --git a/nvim/scripts/sonarqube.sh b/nvim/scripts/sonarqube.sh index 15c042e..ee2148e 100755 --- a/nvim/scripts/sonarqube.sh +++ b/nvim/scripts/sonarqube.sh @@ -2,17 +2,28 @@ set -eu +errexit() { + echo "$@" >&2 + exit "${2:-1}" +} + +command -v curl >/dev/null || errexit "curl nicht installiert" +command -v jq >/dev/null || errexit "jq nicht installiert" + SONAR_CONFIGURATION_FILE="/opt/homebrew/etc/sonar-scanner.properties" -PROJECT_FILE=$(find . -maxdepth 1 -name "sonar-project*.properties" | head -n 1) +[ -f "$SONAR_CONFIGURATION_FILE" ] || errexit "Keine globale sonarcube Konfiguration gefunden!" + +PROJECT_FILE=$(find . -maxdepth 1 -name "sonar-project*.properties" -print -quit) +[ -n "$PROJECT_FILE" ] || errexit "Keine sonar-project*.properties Datei gefunden!" + +SONAR_TOKEN=$(awk -F= '/^sonar.token=/ {gsub(/^[ \t]+|[ \t]+$/,"",$2); print $2}' "$SONAR_CONFIGURATION_FILE") +[ -n "$SONAR_TOKEN" ] || errexit "Kein 'sonar.token' in $SONAR_CONFIGURATION_FILE vorhanden" -if [ -z "$PROJECT_FILE" ]; then - echo "Keine sonar-project*.properties Datei gefunden!" >&2 - exit 1 -fi +SONAR_HOST_URL=$(awk -F= '/^sonar.host.url=/ {gsub(/^[ \t]+|[ \t]+$/,"",$2); print $2}' "$SONAR_CONFIGURATION_FILE") +[ -n "$SONAR_HOST_URL" ] || errexit "Kein 'sonar.host.url' in $SONAR_CONFIGURATION_FILE vorhanden" -SONAR_TOKEN=$(awk -F= '/^sonar.token=/ {print $2}' "$SONAR_CONFIGURATION_FILE") -SONAR_HOST_URL=$(awk -F= '/^sonar.host.url=/ {print $2}' "$SONAR_CONFIGURATION_FILE") -PROJECT_KEY=$(awk -F= '/^sonar.projectKey=/ {print $2}' "$PROJECT_FILE") +PROJECT_KEY=$(awk -F= '/^sonar.projectKey=/ {gsub(/^[ \t]+|[ \t]+$/,"",$2); print $2}' "$PROJECT_FILE") +[ -n "$PROJECT_KEY" ] || errexit "Kein 'sonar.projectKey' in $PROJECT_FILE vorhanden" curl -s \ -u "$SONAR_TOKEN:" \ -- cgit v1.3