Prasant38
(Prasant kumar Jinaga)
November 23, 2024, 10:44am
1
I have these below Tasks in my Gated.YML file which generates and Publishes the coverage in SonarQube Portal as below
task: DotNetCoreCLI@2
displayName: “Run DI.Apps.Services tests”
inputs:
command: test
projects: “**/Test.IP.Apps.Tests/*.csproj”
arguments: ‘–no-restore --configuration $(BuildConfiguration) --collect “Code coverage”’
task: SonarQubePrepare@4
displayName: Prepare analysis on SonarQube
inputs:
SonarQube: icsp.sonarqube
projectKey: ‘$(Build.DefinitionName)’
projectName: ‘$(Build.DefinitionName)’
extraProperties: |
sonar.qualitygate.wait=true
sonar.qualitygate.timeout=3000 sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)//TestResults/ /coverage.opencover.xml
task: SonarQubeAnalyze@4
displayName: ‘Run Code Analysis’
task: SonarQubePublish@4
displayName: ‘Publish Quality Gate Result’
SonarQube SCreenshot
I want to generate code coverage modulewise Like TestModule for some set of like below files and Publish that Module Coverage in SonarQube
IP.Apps.Services\src\Test.IP.Apps.Business\TestProcessors*
IP.Apps.Services\src\Test.IP.Apps.API.Rest\Controllers\ModuleController.cs
Can you please let me know What is the best possible solution for the same
Colin
(Colin)
November 25, 2024, 3:42pm
2
Hey there.
If you have another coverage report, you just need to supply comma-separated values to sonar.cs. open cover.reportsPaths
!
If that’s not your question, I’d appreciate it if you try and add more details to your question. Please also include what version of SonarQube you’re using (you can find it in the footer of your instance), as requested in the template post.
Prasant38
(Prasant kumar Jinaga)
November 27, 2024, 4:55am
3
So I have these tasks as mensioned below. Thease are generating for entire Test.IP.Apps.Tests/*.csproj Project but if i want to generate for only for some files and folders inside this project . How can we achive that?
task: DotNetCoreCLI@2
displayName: “Run DI.Apps.Services tests”
inputs:
command: test
projects: “**/Test.IP.Apps.Tests/*.csproj”
arguments: ‘–no-restore --configuration $(BuildConfiguration) --collect “Code coverage”’
task: SonarQubePrepare@4
displayName: Prepare analysis on SonarQube
inputs:
SonarQube: icsp.sonarqube
projectKey: ‘$(Build.DefinitionName)’
projectName: ‘$(Build.DefinitionName)’
extraProperties: |
sonar.qualitygate.wait=true
sonar.qualitygate.timeout=3000 sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)//TestResults/ /coverage.opencover.xml
task: SonarQubeAnalyze@4
displayName: ‘Run Code Analysis’
task: SonarQubePublish@4
displayName: ‘Publish Quality Gate Result’
Colin
(Colin)
November 27, 2024, 8:23am
4
It sounds like you want to adjust the analysis scope using sonar.exclusions
or sonar.inclusions
You can also exclude projects from analysis using this tag in the .xxproj
file.