How to get total coverage count?

Hi all,
I have gitlab project written in golang. I am running unit tests written in the project to calculate (go) code coverage using Jenkins.
I am using ’ SonarQube Scanner for Jenkins’ plugin.
Code coverage is getting calculated successfully and things are working fine. I am able to get all required information (coverage, lines covered, lines to be covered, etc.) using SonarQube server url.

Now, my requirement is I want to show total coverage count in email. For this, I have created html file.
But how to get total coverage count calculated by sonar-scanner? I can see that number in SonarQube server url at ‘Projects’ tab. But reading it from there in automation is not possible.
So, where does Sonar store all coverage related information, I mean in which file? So, that I can read it from there in automation.
Does it store coverage calculation information in Jenkins server, or sonarqube server?

I just want to get total percentage number. Can I get using ‘sonar-scanner.bat’ command?
Please help me and let me know how to get this count so that I can show it in my coverage report.

Thanks in advance.


Hi Nilesh, welcome to the SonarSource Community!

We have built-in functionality that may save you a lot of custom work here.

You may have missed that SonarQube already includes email notifications when the Quality Gate status changes on a project. If coverage is important enough that you want to email information about it to developers, then it should be included in your Quality Gate criteria. Developers who subscribe to receive Quality Gate notifications will then be informed if the gate failed due to insufficient coverage.

And of course you will need to make sure that Notifications are configured in the first place.

Thanks Jeff, I will check what you have suggested.
I will get back to you if I face any problem implementing it since I have very basic knowledge of SonarQube.

Thanks again.


Hi Jeff,
I am able to get email with following details but it does not contain current code coverage count.

Project: Annotation
Version: 1.0
Quality gate status: Red (was Green)
Quality gate threshold: Line Coverage < 99
More details at

Am I missing anything? What should I add/do to get count?
I want separate email for each project or single email with details of all projects, like below:

Unit Tests Code Coverage Details:

  1. Backup Restore: 67.7%
  2. Annotation Service: 93.2%
  3. Comments Service: 80.4%
  4. Search Service: 71.9%

Any help would be appreciated.

Thanks in advance.