Coverage is 0% Even after successful execution of gitaction

This is my sonar-project.properties file

sonar.projectKey=PraveenKumar205_example

sonar.organization=praveenkumar205

sonar.projectName=Example

sonar.projectBaseDir=GoLang/src/github.com/voonik/example

sonar.sources=.

sonar.exclusions=**/*_test.go,**/vendor/**

sonar.go.coverage.reportPaths=coverage.out

sonar.go.tests.reportPaths=report.json

sonar.host.url=https://sonarcloud.io

sonar.tests=.

sonar.test.inclusions=**/*_test.go

sonar.test.exclusions=**/vendor/**

I used following code in gitaction

- name: SonarQube Scan
        uses: sonarsource/sonarqube-scan-action@master
        with:
          projectBaseDir: GoLang/src/github.com/voonik/example
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

Logs

/usr/bin/docker run --name e28490f0d0e1e9aaa04abe80588c8fc8aa9813_e8e05b --label e28490 --workdir /github/workspace --rm -e SOURCE_BRANCH_NAME -e GOPRIVATE -e GOROOT -e GITHUB_TOKEN -e SONAR_TOKEN -e SONAR_HOST_URL -e INPUT_PROJECTBASEDIR -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/example/example":"/github/workspace" e28490:f0d0e1e9aaa04abe80588c8fc8aa9813
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /github/workspace/GoLang/src/github.com/voonik/example/sonar-project.properties
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.11 Alpine (64-bit)
INFO: Linux 5.11.0-1021-azure amd64
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /github/workspace/GoLang/src/github.com/voonik/example/sonar-project.properties
INFO: Analyzing on SonarCloud
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=823ms
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=179ms
INFO: Load/download plugins (done) | time=32644ms
INFO: Loaded core extensions: developer-scanner
INFO: Found an active CI vendor: 'Github Actions'
INFO: Load project settings for component key: 'PraveenKumar205_example'
INFO: Load project settings for component key: 'PraveenKumar205_example' (done) | time=164ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: PraveenKumar205_example
INFO: Base dir: /github/workspace/GoLang/src/github.com/voonik/example
INFO: Working dir: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=158ms
INFO: Check ALM binding of project 'PraveenKumar205_example'
INFO: Detected project binding: BOUND
INFO: Check ALM binding of project 'PraveenKumar205_example' (done) | time=149ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=164ms
INFO: Load branch configuration
INFO: Github event: push
INFO: Auto-configuring pull request 2
INFO: Load branch configuration (done) | time=1423ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=200ms
INFO: Load active rules
INFO: Load active rules (done) | time=5023ms
INFO: Organization key: praveenkumar205
INFO: Pull request 2 for merge into master from new_branch
INFO: Load project repositories
INFO: Load project repositories (done) | time=157ms
INFO: SCM collecting changed files in the branch
WARN: Could not find ref: master in refs/heads, refs/remotes/upstream or refs/remotes/origin
INFO: SCM collecting changed files in the branch (done) | time=158ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/*_test.go, **/vendor/**, **/*_test.go
INFO:   Included tests: **/*_test.go
INFO:   Excluded tests: **/vendor/**
INFO: 40 files indexed
INFO: 40 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for go: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for json: Sonar way
INFO: Quality profile for web: Sonar way
INFO: Quality profile for yaml: Sonar way
INFO: ------------- Run sensors on module Example
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=159ms
INFO: Sensor IaC CloudFormation Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=33ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=15ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML is restricted to changed files only
INFO: Sensor HTML [web] (done) | time=6ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=2ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=11ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: Sensor Code Quality and Security for Go [go]
INFO: 16 source files to be analyzed
INFO: 16/16 source files have been analyzed
INFO: Sensor Code Quality and Security for Go [go] (done) | time=956ms
INFO: Sensor Go Unit Test Report [go]
INFO: Sensor Go Unit Test Report [go] (done) | time=9ms
INFO: Sensor Go Cover sensor for Go coverage [go]
INFO: Load coverage report from '/github/workspace/GoLang/src/github.com/voonik/example/coverage.out'
INFO: Sensor Go Cover sensor for Go coverage [go] (done) | time=15ms
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=4ms
INFO: Sensor JavaScript analysis [javascript]
INFO: Deploying custom rules bundle jar:file:/opt/sonar-scanner/.sonar/cache/8aa50956575faef23c5a269a418f196f/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules13395828106924356312
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed
INFO: Sensor JavaScript analysis [javascript] (done) | time=4975ms
INFO: Sensor TypeScript analysis [javascript]
INFO: No input files found for analysis
INFO: Sensor TypeScript analysis [javascript] (done) | time=1ms
INFO: Sensor CSS Metrics [javascript]
INFO: Sensor CSS Metrics is restricted to changed files only
INFO: Sensor CSS Metrics [javascript] (done) | time=1ms
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=1ms
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
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=8ms
INFO: Sensor AWS SAM template file sensor [security]
INFO: Sensor AWS SAM template file sensor [security] (done) | time=2ms
INFO: Sensor JavaSecuritySensor [security]
INFO: Reading type hierarchy from: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/ucfg2/java
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/ucfg2/java
INFO: No UCFGs have been included for analysis.
INFO: Sensor JavaSecuritySensor [security] (done) | time=6ms
INFO: Sensor CSharpSecuritySensor [security]
INFO: Reading type hierarchy from: /github/workspace/GoLang/src/github.com/voonik/example/ucfg_cs2
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /github/workspace/GoLang/src/github.com/voonik/example/ucfg_cs2
INFO: No UCFGs have been included for analysis.
INFO: Sensor CSharpSecuritySensor [security] (done) | time=5ms
INFO: Sensor PhpSecuritySensor [security]
INFO: Reading type hierarchy from: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/ucfg2/php
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/ucfg2/php
INFO: No UCFGs have been included for analysis.
INFO: Sensor PhpSecuritySensor [security] (done) | time=2ms
INFO: Sensor PythonSecuritySensor [security]
INFO: Reading type hierarchy from: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/ucfg2/python
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/ucfg2/python
INFO: No UCFGs have been included for analysis.
INFO: Sensor PythonSecuritySensor [security] (done) | time=1ms
INFO: Sensor JsSecuritySensor [security]
INFO: Reading type hierarchy from: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/ucfg2/js
INFO: Read 0 type definitions
INFO: Reading UCFGs from: /github/workspace/GoLang/src/github.com/voonik/example/.scannerwork/ucfg2/js
INFO: 06:16:24.142134 Building Runtime Type propagation graph
INFO: 06:16:24.147168 Running Tarjan on 8 nodes
INFO: 06:16:24.150948 Tarjan found 8 components
INFO: 06:16:24.152918 Variable type analysis: done
INFO: 06:16:24.153685 Building Runtime Type propagation graph
INFO: 06:16:24.154333 Running Tarjan on 8 nodes
INFO: 06:16:24.154665 Tarjan found 8 components
INFO: 06:16:24.155046 Variable type analysis: done
INFO: Analyzing 2 ucfgs to detect vulnerabilities.
INFO: Taint analysis starting. Entrypoints: 2
INFO: Running symbolic analysis for 'JS'
INFO: Taint analysis: done.
INFO: Sensor JsSecuritySensor [security] (done) | time=419ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=11ms
INFO: SCM Publisher SCM provider for this project is: git
INFO: SCM Publisher 3 source files to be analyzed
WARN: Shallow clone detected, no blame information will be provided. You can convert to non-shallow with 'git fetch --unshallow'.
INFO: SCM Publisher 0/3 source files have been analyzed (done) | time=10ms
WARN: Missing blame information for the following files:
WARN:   * stringutil/reverse.go
WARN:   * report.json
WARN:   * outyet/main.go
WARN: This may lead to missing/broken features in SonarCloud
INFO: CPD Executor 3 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 14 files
INFO: CPD Executor CPD calculation finished (done) | time=11ms
INFO: SCM writing changed lines
WARN: Could not find ref: master in refs/heads, refs/remotes/upstream or refs/remotes/origin
INFO: SCM writing changed lines (done) | time=2ms
INFO: Analysis report generated in 149ms, dir size=211 KB
INFO: Analysis report compressed in 35ms, zip size=57 KB
INFO: Analysis report uploaded in 477ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: ***/dashboard?id=PraveenKumar205_example&pullRequest=2
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 ***/api/ce/task?id=AX1GSdsp6IMKmb1SKNB1
INFO: Analysis total time: 23.419 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:02.214s
INFO: Final Memory: 38M/130M
INFO: ------------------------------------------------------------------------

GitAction Ran successfully but still showing 0%. Any help is greatly appreciated

Hey @PraveenKumar205

Taking a look at this pull request analysis it appears that coverage data is being imported, there’s simply no coverage being reported for the two new lines the pull request introduces..

Take a look at this changed file where coverage is clearly being reported for many lines

This means:

  • Unless you expect coverage on one of these changed lines, SonarCloud is behaving as expected
  • Once the PR is merged, you should expect coverage information to appear on your Main Branch

FWIW I should mention there is a SonarCloud specific GitHub action – SonarSource/sonarcloud-github-action. I was surprise to see you using the oneo for SonarQube!

1 Like

Thanks @Colin that helped.

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