From 910f2751f053d70ba56094359851fd65c8285db7 Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Sun, 7 Dec 2025 19:36:27 -0800 Subject: [PATCH] chore: Update Publish.yml to improve SonarCloud scanner commands and enhance checkout steps with fetch-depth --- .github/workflows/Publish.yml | 34 +++++++++++++++++++++++----------- qodana.yaml | 5 +++++ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/Publish.yml b/.github/workflows/Publish.yml index 446b6959..32bee64d 100644 --- a/.github/workflows/Publish.yml +++ b/.github/workflows/Publish.yml @@ -70,12 +70,13 @@ jobs: - name: Collect Coverage Files run: | mkdir -p coverage - find . -name "coverage.opencover.xml" -type f -exec cp --backup=numbered {} coverage/ \; - # Rename numbered backups to standard extensions if needed, or just keep them unique - # Simple copy with unique names: count=1 find . -name "coverage.opencover.xml" -type f | while read file; do - cp "$file" "coverage/coverage_${count}.opencover.xml" + dest="coverage/coverage_${count}.opencover.xml" + cp "$file" "$dest" + # Sanitize paths for Qodana (convert absolute to relative) + # This strips the current working directory from the paths in the XML + sed -i "s|$(pwd)/||g" "$dest" count=$((count+1)) done @@ -132,17 +133,20 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} shell: pwsh run: | + $ErrorActionPreference = 'Stop' + dotnet restore - dotnet sonarscanner begin -k:"mihakralj_QuanTAlib" -o:"mihakralj-quantalib" -d:sonar.token="${{ secrets.SONAR_TOKEN }}" -d:sonar.host.url="https://sonarcloud.io" ` - -d:sonar.cs.opencover.reportsPaths="coverage/*.xml" ` - -d:sonar.coverage.exclusions="**Tests.cs,**/*.md,**/*.html,**/*.css,**/docs/**/*,**/archive/**/*,**/notebooks/**/*,**/obj/**/*,**/bin/**/*" ` - -d:sonar.exclusions="**/TestResults/**/*,**/bin/**/*,**/obj/**/*,**/*.html,**/coverage/**/*,**/CoverageReport/**/*,**/*.md,**/*.css,**/docs/**/*,**/archive/**/*,**/notebooks/**/*" ` - -d:sonar.test.exclusions="**Tests.cs,**/obj/**/*,**/bin/**/*" ` - -d:sonar.scanner.scanAll="false" + + dotnet sonarscanner begin /k:"mihakralj_QuanTAlib" /o:"mihakralj-quantalib" /d:sonar.token="$env:SONAR_TOKEN" /d:sonar.host.url="https://sonarcloud.io" ` + /d:sonar.cs.opencover.reportsPaths="coverage/*.xml" ` + /d:sonar.coverage.exclusions="**Tests.cs,**/*.md,**/*.html,**/*.css,**/docs/**/*,**/archive/**/*,**/notebooks/**/*,**/obj/**/*,**/bin/**/*" ` + /d:sonar.exclusions="**/TestResults/**/*,**/bin/**/*,**/obj/**/*,**/*.html,**/coverage/**/*,**/CoverageReport/**/*,**/*.md,**/*.css,**/docs/**/*,**/archive/**/*,**/notebooks/**/*" ` + /d:sonar.test.exclusions="**Tests.cs,**/obj/**/*,**/bin/**/*" ` + /d:sonar.scanner.scanAll="false" dotnet build --no-restore --configuration Debug - dotnet sonarscanner end -d:sonar.token="${{ secrets.SONAR_TOKEN }}" + dotnet sonarscanner end /d:sonar.token="$env:SONAR_TOKEN" # ============================================================================== # 3. Qodana Scan @@ -176,6 +180,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Download Coverage Reports uses: actions/download-artifact@v4 @@ -197,6 +203,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Download Coverage Reports uses: actions/download-artifact@v4 @@ -229,6 +237,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup .NET SDK uses: actions/setup-dotnet@v4 @@ -254,6 +264,8 @@ jobs: contents: read steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup .NET SDK uses: actions/setup-dotnet@v4 diff --git a/qodana.yaml b/qodana.yaml index a91001d3..ce490aa2 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -42,8 +42,13 @@ exclude: # Public API unused internally - this is a library - name: UnusedMember.Global - name: MemberCanBePrivate.Global + - name: MemberCanBePrivate.Local - name: ClassNeverInstantiated.Global - name: UnusedType.Global + - name: UnusedMethodReturnValue.Global + - name: AutoPropertyCanBeMadeGetOnly.Global + - name: MemberCanBeMadeStatic.Global + - name: MemberCanBeMadeStatic.Local # Redundant using directives - managed by IDE/build, not critical for library - name: RedundantUsingDirective