From 6a212e94ca314a0f241bb375c87c87e9f421eeff Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Wed, 11 Mar 2026 19:32:50 +0100 Subject: [PATCH 1/2] Add sonar-exclusions for dotnet --- .github/workflows/reusable-dotnet-quality.yml | 10 ++++++++-- actions/dotnet/build-test-sonar/action.yml | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-dotnet-quality.yml b/.github/workflows/reusable-dotnet-quality.yml index 60bbe5a..be8e4d5 100644 --- a/.github/workflows/reusable-dotnet-quality.yml +++ b/.github/workflows/reusable-dotnet-quality.yml @@ -48,6 +48,11 @@ on: type: boolean required: false default: false + sonar-exclusions: + description: Files or directories that should be excluded from Sonar analysis + type: string + required: false + default: "node_modules" sonar-host-url: description: Sonar host URL type: string @@ -150,10 +155,11 @@ jobs: uses: ./workflow-parts/actions/dotnet/build-test-sonar with: dotnet-test-args: ${{ inputs.dotnet-test-args }} - sonar-organization: ${{ inputs.sonar-organization }} + sonar-exclusions: ${{ inputs.sonar-exclusions }} sonar-host-url: ${{ inputs.sonar-host-url }} - sonar-project-name: ${{ inputs.sonar-project-name }} + sonar-organization: ${{ inputs.sonar-organization }} sonar-project-key: ${{ inputs.sonar-project-key }} + sonar-project-name: ${{ inputs.sonar-project-name }} sonar-token: ${{ secrets.sonar-token }} - name: Check license compliance with FOSSA if: ${{ inputs.fossa-enabled }} diff --git a/actions/dotnet/build-test-sonar/action.yml b/actions/dotnet/build-test-sonar/action.yml index 04b4b76..7f4ffa8 100644 --- a/actions/dotnet/build-test-sonar/action.yml +++ b/actions/dotnet/build-test-sonar/action.yml @@ -10,6 +10,10 @@ inputs: description: Java version that will be installed (for Sonar CLI) required: false default: "21" + sonar-exclusions: + description: Files or directories that should be excluded from Sonar analysis + required: false + default: "node_modules" report-folder: description: Folder where report files will be generated required: false @@ -71,7 +75,7 @@ runs: /d:sonar.token="${{ inputs.sonar-token}}" \ /d:sonar.host.url="${{ inputs.sonar-host-url }}" \ /d:sonar.cpd.exclusions="**/*Generated*.cs,${{ inputs.report-folder }}/**" \ - /d:sonar.exclusions="${{ inputs.report-folder }}/**/*" \ + /d:sonar.exclusions="${{ inputs.report-folder }}/**,${{ inputs.sonar-exclusions }}" \ /d:sonar.coverageReportPaths="${{ inputs.report-folder }}/SonarQube.xml" \ /d:sonar.cs.vstest.reportsPaths="${{ inputs.report-folder }}/TestResults/*.trx" shell: bash From 966d8c2c58d44b38875cf91e567e354f7b5b10fe Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Thu, 12 Mar 2026 15:50:20 +0100 Subject: [PATCH 2/2] Update sonar exclusions default --- actions/dotnet/build-test-sonar/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/dotnet/build-test-sonar/action.yml b/actions/dotnet/build-test-sonar/action.yml index 7f4ffa8..2aeae11 100644 --- a/actions/dotnet/build-test-sonar/action.yml +++ b/actions/dotnet/build-test-sonar/action.yml @@ -13,7 +13,7 @@ inputs: sonar-exclusions: description: Files or directories that should be excluded from Sonar analysis required: false - default: "node_modules" + default: "**/node_modules/**" report-folder: description: Folder where report files will be generated required: false