Able to get code coverage from API folder for dotnet project but unable to analyze the other folders

HI,

We are facing issue with code coverage which is analyzing only API folder, we would expect Domain folder as part of the code coverage but unable to get it.

Any suggestions could be helpful.

Hi,

The fact that no lines of code are counted for the Domain directory indicates to me that analysis thinks it’s all test files.

Would you care to share your analysis configuration and/or analysis logs?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

Hi @ganncamp

Please find the information below for the analysis configuration.

extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/**/coverage.opencover.xml
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx

sonar_analysis_logs.txt (14.3 KB)

Please find the attachment for the analysis logs.

Could you please let us know if you have any update/solution on the reported issue ?

Hi,

Is there any more logging? This log ends at

2023-06-23T11:31:20.6822918Z ##[section]Finishing: Prepare analysis on SonarCloud

 
Ann

Those are the total logs for prepare analysis task, please let me know if you require any other additional information ?

Also attached the latest logs with debug mode .
sonar_analysis_logs_debug.txt (12.6 KB)

Hi,

Can I have the logs of the end step too, please?

 
Ann

You mean logs of the “Publish Quality Gate Result” ?

Hi,

I’m after the logs that actually show the analysis taking place. Presumably there’s something between ‘Prepare’ and ‘Publish’

 
Ann

Below is the order we have segregated the pipeline, please let me know from which tasks you are expecting the logs ?

Prepare analysis on SonarCloud

dotnet restore

dotnet build

dotnet test

Run Code Analysis

Publish Quality Gate Result

Hi,

The “Run Code Analysis” step.

 
Ann

Please find the logs below

Run_code_analysis_debug.txt (62.1 KB)

Hi,

Could you also share the scanner context? Administration → Background Tasks → [row dots menu] → Show SonarScanner Context

 
Thx,
Ann

Please find the logs below

SonarCloud plugins_background_check_logs.txt (10.9 KB)

Hi,

Thanks for the scanner context.

Here are some excerpts:

Scanner properties of module: WebApp-RestAPI:WebApp-RestAPI:6D5ED7A1-A1BF-488A-A719-88FD57F65687
  - sonar.projectBaseDir=D:\a\1\s\Domain
  - sonar.projectKey=WebApp-RestAPI:WebApp-RestAPI:6D5ED7A1-A1BF-488A-A719-88FD57F65687
  - sonar.projectName=Domain
  - sonar.sources=
  - sonar.tests=
Scanner properties of module: WebApp-RestAPI:WebApp-RestAPI:8970CD6B-0D6C-4DA5-86C5-06E6F7C4A741
  - sonar.projectBaseDir=D:\a\1\s\API
  - sonar.projectKey=WebApp-RestAPI:WebApp-RestAPI:8970CD6B-0D6C-4DA5-86C5-06E6F7C4A741
  - sonar.projectName=API
  - sonar.sources="D:\a\1\s\API\CloudRoleNameInitializer.cs","D:\a\1\s\API\Configurations\AppSettings.cs","D:\a\1\s\API\Configurations\ConnectionConfigurations.cs","D:\a\1\s\API\Configurations\ServicesConfiguration.cs","D:\a\1\s\API\Configurations\SettingsConfiguration.cs","D:\a\1\s\API\Controllers\CategoryController.cs","D:\a\1\s\API\Controllers\ChangeRecordController.cs","D:\a\1\s\API\Controllers\CountController.cs","D:\a\1\s\API\Controllers\EventController.cs","D:\a\1\s\API\Controllers\HomeController.cs","D:\a\1\s\API\Controllers\InputFilesController.cs","D:\a\1\s\API\Controllers\LanguageContentController.cs","D:\a\1\s\API\Controllers\LocationController.cs","D:\a\1\s\API\Controllers\LoginController.cs","D:\a\1\s\API\Controllers\LogoutController.cs","D:\a\1\s\API\Controllers\OutputBundleController.cs","D:\a\1\s\API\Controllers\OutputFilesController.cs","D:\a\1\s\API\Controllers\RangeController.cs","D:\a\1\s\API\Controllers\ReportsController.cs","D:\a\1\s\API\Controllers\SurveyController.cs","D:\a\1...
Scanner properties of module: WebApp-RestAPI:WebApp-RestAPI:476E543B-4CDA-4221-ADAB-A6328991A42E
  - sonar.projectBaseDir=D:\a\1\s\Tests
  - sonar.projectKey=WebApp-RestAPI:WebApp-RestAPI:476E543B-4CDA-4221-ADAB-A6328991A42E
  - sonar.projectName=Tests
  - sonar.sources=
  - sonar.tests="D:\a\1\s\Tests\MockData\AdjustmentSummaryReportMockData.cs","D:\a\1\s\Tests\MockData\CategoryMockData.cs","D:\a\1\s\Tests\MockData\ChangeRecordMockData.cs","D:\a\1\s\Tests\MockData\CountMockData.cs","D:\a\1\s\Tests\MockData\CustomerMockData.cs","D:\a\1\s\Tests\MockData\DeviceMockData.cs","D:\a\1\s\Tests\MockData\DownloadConfigFileMockData.cs","D:\a\1\s\Tests\MockData\EventMockData.cs","D:\a\1\s\Tests\MockData\EventUserMockData.cs","D:\a\1\s\Tests\MockData\FtpMockData.cs","D:\a\1\s\Tests\MockData\InputFilesMockData.cs","D:\a\1\s\Tests\MockData\InventoryDataMockData.cs","D:\a\1\s\Tests\MockData\LanguageContentMockData.cs","D:\a\1\s\Tests\MockData\LocationInstanceMockData.cs","D:\a\1\s\Tests\MockData\LocationMokData.cs","D:\a\1\s\Tests\MockData\MockDataForEntities.cs","D:\a\1\s\Tests\MockData\OnHandsFileMockData.cs","D:\a\1\s\Tests\MockData\OutputElementMockData.cs","D:\a\1\s\Tests\MockData\RangeMockData.cs","D:\a\1\s\Tests\MockData\ReportsMockData.cs","D:\a\1\s\Tests\MockData\Varianc...
Scanner properties of module: WebApp-RestAPI:WebApp-RestAPI:EF30920A-3102-4362-B7A9-F696AA0CC5AA
  - sonar.projectBaseDir=D:\a\1\s\Domain
  - sonar.projectKey=WebApp-RestAPI:WebApp-RestAPI:EF30920A-3102-4362-B7A9-F696AA0CC5AA
  - sonar.projectName=Domain
  - sonar.sources=
  - sonar.tests="D:\a\1\s\Domain\ApiModels\AccuracyDetails.cs","D:\a\1\s\Domain\ApiModels\AddRangeData.cs","D:\a\1\s\Domain\ApiModels\AdjustmentChangeData.cs","D:\a\1\s\Domain\ApiModels\AdjustmentData.cs","D:\a\1\s\Domain\ApiModels\AdjustmentSummaryData.cs","D:\a\1\s\Domain\ApiModels\AdjustmentSummaryDataList.cs","D:\a\1\s\Domain\ApiModels\AdjustmentSummaryResponse.cs","D:\a\1\s\Domain\ApiModels\AggregateConfig.cs","D:\a\1\s\Domain\ApiModels\AuditData.cs","D:\a\1\s\Domain\ApiModels\AuditPerCounter.cs","D:\a\1\s\Domain\ApiModels\AuditsData.cs","D:\a\1\s\Domain\ApiModels\AuditTagViewData.cs","D:\a\1\s\Domain\ApiModels\BypassCloseOutRestrictionDetails.cs","D:\a\1\s\Domain\ApiModels\CategoryDetails.cs","D:\a\1\s\Domain\ApiModels\CategoryRanges.cs","D:\a\1\s\Domain\ApiModels\ChangeDetail.cs","D:\a\1\s\Domain\ApiModels\ChangeRecordDetails.cs","D:\a\1\s\Domain\ApiModels\Column.cs","D:\a\1\s\Domain\ApiModels\ConfigAudit.cs","D:\a\1\s\Domain\ApiModels\ConfigFullStoreVariance.cs","D:\a\1\s\Domain\ApiModels\C...
  - sonar.working.directory=D:\a\1\.sonarqube\out\.sonar\mod0

I don’t know why Domain shows up as two different modules with two different IDs, but we can see that for the first instance there are neither test nor source files detected. For the second, every file is detected as a test file.

This should help.

 
Ann

Thanks for the identification, i have passed through the provided blog not exactly clear where we have to add that piece of code for implicit/explicit could you please help me on this ?

Hi,

Presumably in the project file.

 
HTH,
Ann

Thanks, will let you know if we need any additional information.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.