diff options
Diffstat (limited to 'nvim/scripts')
| -rw-r--r-- | nvim/scripts/sonarqube.md | 28 | ||||
| -rwxr-xr-x | nvim/scripts/sonarqube.sh | 13 |
2 files changed, 41 insertions, 0 deletions
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 @@ | |||
| 1 | # Installieren | ||
| 2 | |||
| 3 | ```sh | ||
| 4 | brew install sonar-scanner | ||
| 5 | ``` | ||
| 6 | |||
| 7 | # Token erstellen | ||
| 8 | |||
| 9 | 1. Mit VPN verbinden. | ||
| 10 | 2. Bei [Sonarqube] anmelden. | ||
| 11 | 3. Auf "Account" -> "My Account" -> "Security" klicken | ||
| 12 | 4. Einen neuen Token erstellen: | ||
| 13 | Name: "command-line" | ||
| 14 | Type: "User Token" | ||
| 15 | Expires in: "1 year" | ||
| 16 | 5. Token und Host-URL in `/opt/homebrew/etc/sonar-scanner.properties` einfügen: | ||
| 17 | ```conf | ||
| 18 | sonar.token=<token> | ||
| 19 | sonar.host.url=https://sonarqube.dev.up2parts.com | ||
| 20 | ``` | ||
| 21 | |||
| 22 | # Sonarqube ausführen | ||
| 23 | |||
| 24 | Im Projektverzeichnis `sonar-scaner` ausführen. | ||
| 25 | Sonarqube muss für das Projekt mit einer Datei `sonar-project.properties` konfiguriert sein. | ||
| 26 | |||
| 27 | [Sonarqube]: https://sonarqube.dev.up2parts.com/ | ||
| 28 | |||
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 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -eu | ||
| 4 | |||
| 5 | SONAR_TOKEN=$(awk -F= '/^sonar.token=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties) | ||
| 6 | SONAR_HOST_URL=$(awk -F= '/^sonar.host.url=/ {print $2}' /opt/homebrew/etc/sonar-scanner.properties) | ||
| 7 | PROJECT_KEY=$(awk -F= '/^sonar.projectKey=/ {print $2}' ./sonar-project.properties) | ||
| 8 | |||
| 9 | curl -s \ | ||
| 10 | -u "$SONAR_TOKEN:" \ | ||
| 11 | "$SONAR_HOST_URL/api/issues/search?componentKeys=$PROJECT_KEY&statuses=OPEN" | | ||
| 12 | jq -r '.issues[] | "\(.component | sub("^[^:]+:"; "")):\(.line // 1): [\(.severity)] \(.message | gsub("\n"; " ")) (\(.author))"' | ||
| 13 | |||
