From 45ac10c38f364ab05a4136f44dc75ffddad84b27 Mon Sep 17 00:00:00 2001 From: joshuapregua Date: Tue, 25 Aug 2026 16:36:18 +0800 Subject: [PATCH] chore: add SonarQube code analysis configuration --- .github/workflows/sonar.yaml | 32 ++++++++++++++++++++++++++++++++ sonar-project.properties | 21 +++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/sonar.yaml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml new file mode 100644 index 0000000..9f891dc --- /dev/null +++ b/.github/workflows/sonar.yaml @@ -0,0 +1,32 @@ +on: + # trigger analysis for pushes and pull requests + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + +name: SonarQube Main Workflow + +jobs: + sonarqube: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # fetch full history for better SCM information + fetch-depth: 0 + + - name: Run SonarQube Scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + + - name: Quality Gate check + uses: sonarsource/sonarqube-quality-gate-action@master + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..09cb238 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,21 @@ +# Server and project configuration +# Note: SONAR_HOST_URL secret in the workflow takes precedence at scan time. +# This entry documents the expected host and is a no-op when the secret is set. +sonar.host.url=https://sonar.wpengine.io/ +sonar.projectVersion=1.0 +sonar.sourceEncoding=UTF-8 +sonar.scm.provider=git + +# Project Identifiers +sonar.projectName=local-addon-notes +sonar.projectKey=getflywheel_local-addon-notes_353f0d7e-470a-455f-9210-df9fd02b6013 + +# Paths to source code directories and files (relative paths) +sonar.sources=src,style.css,assets + +# Exclusions - test files + vendor/build dirs + auto-generated code +sonar.exclusions=**/*.test.*,**/*.spec.*,node_modules/**,lib/**,dist/**,build/**,coverage/**,.nyc_output/** + +# Paths to test source directories (relative paths) +sonar.tests=src +sonar.test.inclusions=**/*.test.*,**/*.spec.*