From 0b23e95c9ec0e4eaa8ef9e8c1335401309380d19 Mon Sep 17 00:00:00 2001 From: alison Date: Fri, 11 Sep 2026 09:14:03 -0300 Subject: [PATCH] feat(frontend): implantar analise sonarqube no frontend (#938) --- .scripts/sonar-scan-frontend.sh | 23 +++++++++++++++++++++++ apps/apae/sonar-project.properties | 6 ++++++ 2 files changed, 29 insertions(+) create mode 100755 .scripts/sonar-scan-frontend.sh create mode 100644 apps/apae/sonar-project.properties diff --git a/.scripts/sonar-scan-frontend.sh b/.scripts/sonar-scan-frontend.sh new file mode 100755 index 00000000..7c196649 --- /dev/null +++ b/.scripts/sonar-scan-frontend.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +if [ -z "$SONAR_TOKEN" ]; then + echo "Erro: A variável de ambiente SONAR_TOKEN não está definida." + echo "Uso: SONAR_TOKEN= $0" + exit 1 +fi + +SONAR_HOST_URL="${SONAR_HOST_URL:-http://localhost:9500}" + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" + +echo "Iniciando análise do SonarQube para o frontend (apps/apae)..." +echo "Servidor SonarQube: $SONAR_HOST_URL" + +docker run --rm \ + --network host \ + -v "$ROOT_DIR/apps/apae:/usr/src" \ + -e SONAR_HOST_URL="$SONAR_HOST_URL" \ + -e SONAR_TOKEN="$SONAR_TOKEN" \ + sonarsource/sonar-scanner-cli:11 \ No newline at end of file diff --git a/apps/apae/sonar-project.properties b/apps/apae/sonar-project.properties new file mode 100644 index 00000000..dd51d830 --- /dev/null +++ b/apps/apae/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=apae-geral-frontend +sonar.projectName=apae-geral-frontend +sonar.sources=src +sonar.exclusions=**/node_modules/**, **/.next/**, public/**, **/next-env.d.ts +sonar.javascript.lcov.reportPaths=coverage/lcov.info +sonar.sourceEncoding=UTF-8 \ No newline at end of file