You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a program in net 6, in which I run coverage on my local computer, in sonar and BuildQualityChecks they give a value greater than 80%. Then we migrate the project to net 8 and the coverage locally gives greater than 80%, in sonar from the pipeline also greater than 80% but the BuildQualityChecks task gives less than 80%. Attached I show the tasks of the pipeline.
`steps:
template: ../spellCheck.yml
task: SonarQubePrepare@6
displayName: 'Prepare analysis on SonarQube'
condition: and(succeeded(), eq('${{parameters.includeSonar}}', 'true'))
inputs:
SonarQube: 'SC-ECP-PRD-SonarQube-AD-True'
scannerMode: 'MSBuild'
projectKey: 'True-API-ApiConfigBackend'
projectName: 'True-API-ApiConfigBackend'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions = /.bin
sonar.cs.vstest.reportsPaths = $(Agent.TempDirectory)/.trx
sonar.cs.opencover.reportsPaths = $(Agent.TempDirectory)//coverage.opencover.xml
sonar.coverage.exclusions = /Host.UI/, /Entities/ , /Configuration/Query/
sonar.exclusions= **/.yaml,/Dockerfile
this is a little strange as all the tools should work based on the same coverage file. Build Quality Checks does not evaluate coverage itself, it simple reads the data from Azure DevOps. So, you should first look at the build summary page and check what value is displayed there:
BQC might report slightly different values depending on the coverage type that you are using as some tools evaluate things like branch coverage slightly different (in my case, BQC is reporting 458/509 branches covered (89.9804%), while Report Generator (what is used in Azure DevOps) reports 453/502 branches covered (~90.2%), This is usually not the case with lines coverage, though.
Could you maybe send me the logs and possibly the .coverage file for your pipelines to [email protected], so I can take a look?
In addition, I wonder why you have the sleep and the publish code coverage step in your pipeline. As far as I know, the DotNetCoreCLI task publishes coverage data automatically, so there is no need for the additional publish. In fact, it can change the coverage data as Azure DevOps might merge the two copies of the same coverage data into one dataset. If coverage is not automatically published by DotNetCoreCLI, the publish step is necessary, but the sleep step should probably after the publish step.
I have a program in net 6, in which I run coverage on my local computer, in sonar and BuildQualityChecks they give a value greater than 80%. Then we migrate the project to net 8 and the coverage locally gives greater than 80%, in sonar from the pipeline also greater than 80% but the BuildQualityChecks task gives less than 80%. Attached I show the tasks of the pipeline.
`steps:
template: ../spellCheck.yml
task: SonarQubePrepare@6
displayName: 'Prepare analysis on SonarQube'
condition: and(succeeded(), eq('${{parameters.includeSonar}}', 'true'))
inputs:
SonarQube: 'SC-ECP-PRD-SonarQube-AD-True'
scannerMode: 'MSBuild'
projectKey: 'True-API-ApiConfigBackend'
projectName: 'True-API-ApiConfigBackend'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions = /.bin
sonar.cs.vstest.reportsPaths = $(Agent.TempDirectory)/.trx
sonar.cs.opencover.reportsPaths = $(Agent.TempDirectory)//coverage.opencover.xml
sonar.coverage.exclusions = /Host.UI/, /Entities/ , /Configuration/Query/
sonar.exclusions= **/.yaml,/Dockerfile
task: DevOpsEcopetrol.sonar-extension-branch.task-variable.sonar-extension-branch@0
condition: and(succeeded(), eq('${{parameters.includeSonar}}', 'true'))
displayName: branch
task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: "$(functionsProjects)"
arguments: "--configuration $(buildConfiguration)"
task: DotNetCoreCLI@2
displayName: Run Tests
inputs:
command: test
arguments: '--settings "$(Build.SourcesDirectory)/Develop/Sln Items/Ecp.True.CodeCoverage.NetCore.runsettings" --configuration $(buildConfiguration) --collect "Code coverage"'
projects: "$(unitTestProjects)"
publishTestResults: true
testRunTitle: 'Unit Tests'
task: PowerShell@2
displayName: "Sleep for Code Coverage Merge"
inputs:
targetType: "inline"
script: "Start-Sleep -Seconds 30"
task: PublishCodeCoverageResults@2
displayName: "Publish Code Coverage Results"
inputs:
summaryFileLocation: '$(Agent.TempDirectory)/*.trx'
reportDirectory: '$(Agent.TempDirectory)/**/coverage.opencover.xml'
failIfCoverageEmpty: true
task: BuildQualityChecks@9
displayName: "Check Code Coverage"
inputs:
checkCoverage: true
coverageFailOption: fixed
coverageThreshold: $(serverSideUnitTestingThreshold)
coverageType: "lines"
buildConfiguration: $(buildConfiguration)
treat0of0as100: true
task: SonarQubeAnalyze@6
condition: and(succeeded(), eq('${{parameters.includeSonar}}', 'true'))
displayName: "Run Code Analysis"
task: SonarQubePublish@6
condition: and(succeeded(), eq('${{parameters.includeSonar}}', 'true'))
displayName: "Publish Quality Gate Result"
task: DotNetCoreCLI@2$(buildConfiguration) --output $ (Build.ArtifactStagingDirectory)"
displayName: Publish
inputs:
command: publish
publishWebProjects: False
projects: "$(functionsProjects)"
arguments: "--configuration
`
The text was updated successfully, but these errors were encountered: