diff options
Diffstat (limited to 'nvim/scripts/sonarqube.sh')
| -rwxr-xr-x | nvim/scripts/sonarqube.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/nvim/scripts/sonarqube.sh b/nvim/scripts/sonarqube.sh index ef1be89..15c042e 100755 --- a/nvim/scripts/sonarqube.sh +++ b/nvim/scripts/sonarqube.sh | |||
| @@ -2,12 +2,20 @@ | |||
| 2 | 2 | ||
| 3 | set -eu | 3 | set -eu |
| 4 | 4 | ||
| 5 | SONAR_TOKEN=$(awk -F= '/^sonar.token=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties) | 5 | SONAR_CONFIGURATION_FILE="/opt/homebrew/etc/sonar-scanner.properties" |
| 6 | SONAR_HOST_URL=$(awk -F= '/^sonar.host.url=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties) | 6 | PROJECT_FILE=$(find . -maxdepth 1 -name "sonar-project*.properties" | head -n 1) |
| 7 | PROJECT_KEY=$(awk -F= '/^sonar.projectKey=/ {print $2}' ./sonar-project.properties) | 7 | |
| 8 | if [ -z "$PROJECT_FILE" ]; then | ||
| 9 | echo "Keine sonar-project*.properties Datei gefunden!" >&2 | ||
| 10 | exit 1 | ||
| 11 | fi | ||
| 12 | |||
| 13 | SONAR_TOKEN=$(awk -F= '/^sonar.token=/ {print $2}' "$SONAR_CONFIGURATION_FILE") | ||
| 14 | SONAR_HOST_URL=$(awk -F= '/^sonar.host.url=/ {print $2}' "$SONAR_CONFIGURATION_FILE") | ||
| 15 | PROJECT_KEY=$(awk -F= '/^sonar.projectKey=/ {print $2}' "$PROJECT_FILE") | ||
| 8 | 16 | ||
| 9 | curl -s \ | 17 | curl -s \ |
| 10 | -u "$SONAR_TOKEN:" \ | 18 | -u "$SONAR_TOKEN:" \ |
| 11 | "$SONAR_HOST_URL/api/issues/search?componentKeys=$PROJECT_KEY&statuses=OPEN" | | 19 | "$SONAR_HOST_URL/api/issues/search?componentKeys=$PROJECT_KEY&statuses=OPEN&ps=500" | |
| 12 | jq -r '.issues[] | "\(.component | sub("^[^:]+:"; "")):\(.line // 1): [\(.severity)] \(.message | gsub("\n"; " ")) (\(.author))"' | 20 | jq -r '.issues[] | "\(.component | sub("^[^:]+:"; "")):\(.line // 1): [\(.severity)] \(.message | gsub("\n"; " ")) (\(.author))"' |
| 13 | 21 | ||
