Coverage not recognizing all code

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Scanner command used: Using pipeline task
  • Languages of the repository: TypeScript mainly
  • Team plan subscription

When I’ve used my local Sonar server, all files (~7k LoC) have been recognized for coverage. Now, in cloud, only a few files are recognized (~1.3k LoC).

My pipline config is the following (used the same for local scan):

- task: SonarCloudPrepare@3
  displayName: 'Prepare Sonar Cloud'
  inputs:
    SonarQube: 'SonarQube Cloud'
    organization: 'myorg'
    scannerMode: 'cli'
    configMode: 'manual'
    cliProjectKey: 'project-key'
    cliProjectName: 'project-name'
    cliProjectVersion: '$(Date:yyyyMMdd).$(Rev:r)'
    cliSources: 'apps/cms/api,apps/cms/ui,libs'
    extraProperties: |
      sonar.test.inclusions=libs/**/*.spec.ts,apps/cms/api/**/*.spec.ts,apps/cms/ui/**.spec.ts
      sonar.javascript.lcov.reportPaths=coverage/summary/lcov.info
      sonar.exclusions=apps/*-e2e/**/*,**/.storybook/**/*,**/eslint.config.cjs
      sonar.inclusions=apps/**/*,libs/**/*
      sonar.coverage.exclusions=**/*.spec.ts,**/test-helper.ts

I might have found an answer myself. Is it possible, that only the new lines between my develop branch and main branch is shown, although there’s no analytics result for main branch yet?

Hi,

Can you share your analysis log?

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.

 
Thx,
Ann