SonarCloud does not show coverage and duplication information on each pull-request(typescript)

It doesn’t show coverage and duplication information after PR
These are my properties.

sonar.typescript.file.suffixes=.ts
sonar.sources=./lib
sonar.projectKey=xxx-cdk
sonar.tests=./test
sonar.test.inclusions=test/*.test.ts,test/**/*.test.ts
sonar.testExecutionReportPaths=coverage/test-reporter.xml
sonar.coverage.exclusions=**/resources/**/*
sonar.exclusions=**/resources/**/*
sonar.issue.ignore.multicriteria=e1
sonar.issue.ignore.multicriteria.e1.ruleKey=typescript:S1848
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.ts
sonar.javascript.lcov.reportPaths=./coverage/lcov.info

And this is my jest.config.js

module.exports = {
  testEnvironment: 'node',
  roots: ['<rootDir>/test'],
  testMatch: ['**/*.test.ts'],
  transform: {
    '^.+\\.tsx?$': 'ts-jest',
  },
  globals: {
    'ts-jest': {
      tsconfig: 'tsconfig.test.json',
    },
  },
  coveragePathIgnorePatterns: ['/node_modules/', '/test/', '/dist/'],
  testResultsProcessor: 'jest-sonar-reporter',
};

Hi,

Are there changes to code in your PRs?

Can you provide an 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.

 
Ann

it was working before. It just starting not showing coverage and duplication. Let me try to find out how to get those logs.

this is the log.

Run Company-Airlines-Org/actions.sonar-scan@v2
Run docker/login-action@v3
Logging into artifactorycloud.ual.com...
Login Succeeded!
Run env > ./.env
Run docker run \
Unable to find image 'artifactorycloud.ual.com/v-docker/sonarsource/sonar-scanner-cli:latest' locally
latest: Pulling from v-docker/sonarsource/sonar-scanner-cli
3c854c8cbf46: Pulling fs layer
4f4fb700ef54: Pulling fs layer
abe98265d206: Pulling fs layer
c49a83759257: Pulling fs layer
c49a83759257: Waiting
4f4fb700ef54: Verifying Checksum
4f4fb700ef54: Download complete
3c854c8cbf46: Verifying Checksum
3c854c8cbf46: Download complete
c49a83759257: Download complete
3c854c8cbf46: Pull complete
4f4fb700ef54: Pull complete
abe98265d206: Verifying Checksum
abe98265d206: Download complete
abe98265d206: Pull complete
c49a83759257: Pull complete
Digest: sha256:02372948eaeeb10dfbe0cfd4174d44b8e405d0aeae431532b2bdb21d0347bf23
Status: Downloaded newer image for artifactorycloud.ual.com/v-docker/sonarsource/sonar-scanner-cli:latest
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 5.0.1.3006
INFO: Java 17.0.10 Alpine (64-bit)
INFO: Linux 5.4.117-58.216.amzn2.x86_64 amd64
INFO: SONAR_SCANNER_OPTS=-Dsonar.projectKey=ual-cdk -Dsonar.projectName=ual-cdk -Dsonar.projectBaseDir=./
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Analyzing on SonarQube server 10.0.0.68432
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=256ms
INFO: Server id: CFA0BEFE-AYe-XchNcezWb9uZ1f4O
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=117ms
INFO: Load/download plugins (done) | time=6331ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Process project properties (done) | time=1ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
INFO: Project key: ual-cdk
INFO: Base dir: /usr/src
INFO: Working dir: /usr/src/.scannerwork
INFO: Load project settings for component key: 'ual-cdk'
INFO: Load project settings for component key: 'ual-cdk' (done) | time=31ms
INFO: Load project branches
INFO: Load project branches (done) | time=33ms
INFO: Load branch configuration
INFO: Detected branch/PR in 'GitHub Action'
INFO: Auto-configuring pull request '412'
INFO: Load branch configuration (done) | time=9ms
WARN: SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
INFO: Auto-configuring with CI 'Github Actions'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=92ms
INFO: Load active rules
INFO: Load active rules (done) | time=2247ms
INFO: Load analysis cache
INFO: Load analysis cache (404) | time=25ms
INFO: Pull request 412 for merge into main from fix/sonar-test-coverage
INFO: Load project repositories
INFO: Load project repositories (done) | time=34ms
INFO: Indexing files...
INFO: Project configuration:
INFO: 0 files indexed
INFO: ------------- Run sensors on module ual-cdk
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=37ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=3ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=26ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=8ms
INFO: Sensor TextAndSecretsSensor [text]
INFO: Sensor TextAndSecretsSensor is restricted to changed files only
INFO: Sensor TextAndSecretsSensor [text] (done) | time=13ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=35ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
INFO: Sensor CSS Rules [javascript]
INFO: Sensor CSS Rules is restricted to changed files only
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=2ms
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
INFO: Sensor IaC Docker Sensor [iac]
INFO: Sensor IaC Docker Sensor is restricted to changed files only
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Docker Sensor [iac] (done) | time=153ms
INFO: Sensor Serverless configuration file sensor [security]
INFO: 0 Serverless function entries were found in the project
INFO: 0 Serverless function handlers were kept as entrypoints
INFO: Sensor Serverless configuration file sensor [security] (done) | time=10ms
INFO: Sensor AWS SAM template file sensor [security]
INFO: Sensor AWS SAM template file sensor [security] (done) | time=3ms
INFO: Sensor AWS SAM Inline template file sensor [security]
INFO: Sensor AWS SAM Inline template file sensor [security] (done) | time=1ms
INFO: Sensor javabugs [dbd]
INFO: Reading IR files from: /usr/src/.scannerwork/ir/java
INFO: No IR files have been included for analysis.
INFO: Sensor javabugs [dbd] (done) | time=5ms
INFO: Sensor pythonbugs [dbd]
INFO: Reading IR files from: /usr/src/.scannerwork/ir/python
INFO: No IR files have been included for analysis.
INFO: Sensor pythonbugs [dbd] (done) | time=0ms
INFO: Sensor JavaSecuritySensor [security]
INFO: Reading type hierarchy from: /usr/src/.scannerwork/ucfg2/java
INFO: Read 0 type definitions
INFO: No UCFGs have been included for analysis.
INFO: Sensor JavaSecuritySensor [security] (done) | time=5ms
INFO: Sensor CSharpSecuritySensor [security]
INFO: Reading type hierarchy from: /usr/src/ucfg_cs2
INFO: Read 0 type definitions
INFO: No UCFGs have been included for analysis.
INFO: Sensor CSharpSecuritySensor [security] (done) | time=1ms
INFO: Sensor PhpSecuritySensor [security]
INFO: Reading type hierarchy from: /usr/src/.scannerwork/ucfg2/php
INFO: Read 0 type definitions
INFO: No UCFGs have been included for analysis.
INFO: Sensor PhpSecuritySensor [security] (done) | time=4ms
INFO: Sensor PythonSecuritySensor [security]
INFO: Reading type hierarchy from: /usr/src/.scannerwork/ucfg2/python
INFO: Read 0 type definitions
INFO: No UCFGs have been included for analysis.
INFO: Sensor PythonSecuritySensor [security] (done) | time=0ms
INFO: Sensor JsSecuritySensor [security]
INFO: Reading type hierarchy from: /usr/src/.scannerwork/ucfg2/js
INFO: Read 0 type definitions
INFO: No UCFGs have been included for analysis.
INFO: Sensor JsSecuritySensor [security] (done) | time=1ms
INFO: ------------- Run sensors on project
INFO: Sensor Analysis Warnings import [csharp]
INFO: Sensor Analysis Warnings import [csharp] (done) | time=4ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=1ms
INFO: SCM Publisher No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
INFO: CPD Executor Calculating CPD for 0 files
INFO: CPD Executor CPD calculation finished (done) | time=0ms
INFO: Analysis report generated in 171ms, dir size=211.9 kB
INFO: Analysis report compressed in 27ms, zip size=26.5 kB
INFO: Analysis report uploaded in 54ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarqubecloud.ual.com/dashboard?id=ual-cdk&pullRequest=412
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarqubecloud.ual.com/api/ce/task?id=AY-W0y41Ifwhmiq8aeHp
INFO: Analysis total time: 11.983 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 23.012s
INFO: Final Memory: 38M/148M
INFO: ------------------------------------------------------------------------
Run curl --request POST \
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   126    0     0  100   126      0    666 --:--:-- --:--:-- --:--:--   670

Hi,

I see a few interesting things in your log. First:

These excerpts indicate that there’s no SCM metadata available in the project directory. (BTW, ignore the bit about sonar.scm.provider. It won’t do any good and I’ve been trying for years to get them to take that part out.) That makes it a impossible for analysis to understand what changed in the PR, or - typically - to even understand that it’s dealing with a PR. So This next excerpt is a bit odd

I suppose you pushed that information into the env manually?

And then we have this

Are there even files in the environment? Perhaps there wasn’t any checkout, and that’s why no SCM data was found?

 
Ann

Hi thanks for the help . setting sonar.scm.disabled=true fixed the issue :).

what SCM stands for ? Also if we disable it , would it affect the results ?

Hi

SCM is Source Control Management.

Disabling that integration means that

  • analysis won’t be able to accurately* tell which code is “new” in branches
    • thus, issue dating may be inaccurate
  • analysis won’t be able to tell which lines/files are part of a PR
  • issues can’t be correctly assigned to their authors

 
Ann

*There’s a fall-back algorithm but it’s not as accurate

Do we know if this will be fixed soon? like I said before, it was working, and it stopped working a few months ago. disabling SCM, got us some info but we need to be able to have a good full scan.

Hi,

Based on your logs, the problem is on your side. You need to sort out why no SCM data was found in your environment.

 
HTH,
Ann

how to check the SCM config ?
I see this

Also I can see this

Hi,

This is about your checkout, and the SCM data in your directory/environment on the CI-side. There’s no SonarCloud-side configuration for this.

You need to look at your pipeline and how the code gets into the workspace.

Specifically: does your pipeline start with a checkout? Into the directory from which analysis is run?

 
Ann