#!/bin/sh set -eu SONAR_CONFIGURATION_FILE="/opt/homebrew/etc/sonar-scanner.properties" PROJECT_FILE=$(find . -maxdepth 1 -name "sonar-project*.properties" | head -n 1) if [ -z "$PROJECT_FILE" ]; then echo "Keine sonar-project*.properties Datei gefunden!" >&2 exit 1 fi 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") curl -s \ -u "$SONAR_TOKEN:" \ "$SONAR_HOST_URL/api/issues/search?componentKeys=$PROJECT_KEY&statuses=OPEN&ps=500" | jq -r '.issues[] | "\(.component | sub("^[^:]+:"; "")):\(.line // 1): [\(.severity)] \(.message | gsub("\n"; " ")) (\(.author))"'