From e99756d1d5acb6805003b403985ee0a2a253bf26 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Wed, 25 Mar 2026 07:08:57 +0100 Subject: Neovim: Sonarqube Unterstützung hinzugefügt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nvim/scripts/sonarqube.md | 28 ++++++++++++++++++++++++++++ nvim/scripts/sonarqube.sh | 13 +++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 nvim/scripts/sonarqube.md create mode 100755 nvim/scripts/sonarqube.sh (limited to 'nvim/scripts') diff --git a/nvim/scripts/sonarqube.md b/nvim/scripts/sonarqube.md new file mode 100644 index 0000000..d276053 --- /dev/null +++ b/nvim/scripts/sonarqube.md @@ -0,0 +1,28 @@ +# Installieren + +```sh +brew install sonar-scanner +``` + +# Token erstellen + +1. Mit VPN verbinden. +2. Bei [Sonarqube] anmelden. +3. Auf "Account" -> "My Account" -> "Security" klicken +4. Einen neuen Token erstellen: + Name: "command-line" + Type: "User Token" + Expires in: "1 year" +5. Token und Host-URL in `/opt/homebrew/etc/sonar-scanner.properties` einfügen: +```conf +sonar.token= +sonar.host.url=https://sonarqube.dev.up2parts.com +``` + +# Sonarqube ausführen + +Im Projektverzeichnis `sonar-scaner` ausführen. +Sonarqube muss für das Projekt mit einer Datei `sonar-project.properties` konfiguriert sein. + +[Sonarqube]: https://sonarqube.dev.up2parts.com/ + diff --git a/nvim/scripts/sonarqube.sh b/nvim/scripts/sonarqube.sh new file mode 100755 index 0000000..ef1be89 --- /dev/null +++ b/nvim/scripts/sonarqube.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eu + +SONAR_TOKEN=$(awk -F= '/^sonar.token=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties) +SONAR_HOST_URL=$(awk -F= '/^sonar.host.url=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties) +PROJECT_KEY=$(awk -F= '/^sonar.projectKey=/ {print $2}' ./sonar-project.properties) + +curl -s \ + -u "$SONAR_TOKEN:" \ + "$SONAR_HOST_URL/api/issues/search?componentKeys=$PROJECT_KEY&statuses=OPEN" | + jq -r '.issues[] | "\(.component | sub("^[^:]+:"; "")):\(.line // 1): [\(.severity)] \(.message | gsub("\n"; " ")) (\(.author))"' + -- cgit v1.3