Hello,
We use SonarCloud in our pipeline to analyse the code of our projects. We use coverlet for code coverage and have had a number of issues with the Quality Gate failing so I have recently updated our .runsettings to include only our controllers/endpoints. After pushing through the changes and running the pipeline, coverlet is showing as 0.0% code coverage and seems to list all of our files, including those that should be excluded.
Our pipeline executes the code coverage with the following code:
# Run 'Admin.Api' unit tests.
- task: DotNetCoreCLI@2
displayName: 'Run Admin.Api unit tests'
inputs:
command: 'test'
majorVersion: 8
minorVersion: 0
projects: '**/Admin/**/*.UnitTests.csproj'
arguments: '--configuration $(buildConfig) --collect:"XPlat Code Coverage" --settings $(System.DefaultWorkingDirectory)/src/Services/Admin/Admin.UnitTests/.runsettings'
# Run 'Identity.Api' unit tests.
- task: DotNetCoreCLI@2
displayName: 'Run Identity.Api unit tests'
inputs:
command: 'test'
majorVersion: 8
minorVersion: 0
projects: '**/Identity/**/*.UnitTests.csproj'
arguments: '--configuration $(buildConfig) --collect:"XPlat Code Coverage" --settings $(System.DefaultWorkingDirectory)/src/Services/Identity/Identity.UnitTests/.runsettings'
Azure is showing our code coverage correctly:
We have also got a warning from SonarCloud telling us: “There were parsing errors in 1 files while analyzing the project. Check the logs for further details.”
We have attempted to find the logs it mentioned but have had no luck. We think it’s in Background Tasks but can find no logs option.