Is it possible to disable coverage test in sonarcloud?
Hi Sebastien,
I believe youâre asking about the Coverage on New Code metric in the Sonar Way Quality Gate (QG). The Sonar Way QG can not be edited, however you can copy the Sonar Way QG and create your own QG and then edit/delete the coverage metric from the new QG you created.
If thatâs not what youâre looking to achieve, let us know. Thanks!
Thank you for you reply, I actually already copied a qulity gate from Sonar Way QG, but I canât find anything regarding Coverage. Of these two:
- Maintainability Rating on New Code
- Reliability Rating on New Code
Which one I have to delete?
Hello Sebastien,
Looks like I didnât solve your issue. Your objective is not clear to me. Can you provide a more detailed explanation of your goal(s).
To help frame this up, please consider the following: SonarCloud is going to âgradeâ in 5 analysis categories:
- Reliability (bugs)
- Vulnerability (security)
- Maintainability (code smells)
- Test Coverage
- Duplications
Each one of these categories has several metrics that can be used in your Quality Gate. Thanks.
No i can assure you you understood correctly, actually, I already disabled the coverage test feature from the copied quality gate. But it looks like it still there, see the repo https://sonarcloud.io/organizations/primefaces/
Maybe the first time I run Sonar on this repo, it used Sonar Way quality gate, and since then it kept these errors (even though I changed into a new quality gate?
FYI, my objective is to get rid of these coverage errors
Sebastien,
I believe I understand your objective. I also believe itâs a misunderstanding related to analysis and the purpose of the Quality Gate. Letâs also make sure weâre talking about the same meaning regarding disabling.
You can remove or edit a condition from a Quality Gate, but that doesnât disable that âconditionâ from the analysis. i.e., the analysis is always going to return the facts and thatâs what you see in the results with the grades for bugs, vulnerabilities and smells and the % for coverage and dups. So even if you decide to not check for coverage in your Quality Gate, the fact remains that the code has a certain coverage % and the analysis is always going to report that.
The Quality Gate is simply a boolean flag to help you determine if your project is production ready or not. This go/no-go criteria can be based on the built-in Sonar Way metrics or a set of metrics you define yourself. Regardless of the conditions you choose for the Quality Gate, itâs just a go/no-go status that is independent from the results of the analysis.
So, for example, you could remove all conditions from your Quality Gate and your project would pass by default, but that doesnât mean the code is free from issues. It could be far from it. So, when you run an analysis and look at the summary graphic and it reports 3.9% coverage - itâs because the analysis logic calculated that as the test coverage.
I encourage you to read our documentation on the Quality Gate and Fixing the Water Leak concepts. Theyâre both very powerful and instrumental in efficiently and manageably writing quality code.
Hopefully Iâve helped sort things out for you. If not, let me know. Thanks!
Thank you for this very detailed answer. Actually, I donât mind the coverage test,but what annoys me is, if I want to see whatâs wrong in a class, I just have to take a look at the file and check these red markers, but I have all these âNot covered by tests.â messages⊠Which makes it harder to find what really is really problematic in this class⊠And since Iâm aware we donât have a lot tests, and we donât plan to write more⊠I donât take account these alerts. Thre is no way to disable that?
Hi Sebastien,
if you really want to disable this, you can explicitly exclude all files for code coverage:
Does it need to rerun an analysis? Or it should be taking account automatically?
Any change of analysis settings needs a new analysis to be ran for changes to be effective!
Great Iâll try that! Quick question, is it possible to update to token of an ogranization?
I think itâs best you open a separate topic for that, and detail which token you refer to, and why youâre looking to change it.
This removes from coverage section from Project Homepage, but still on the dashboard it shows as â-â.
Is there also a way to remove Coverage section from Dashboard ?
This should remove the whole section altogether. If it does not, this probably means you havenât set the setting correctly.
It did remove the complete section from Project Homepage, but on the dashboard I still see Coverage listed with a â-â under it. And I see the same behavior on SonarCloud as well.
Can you clarify what you mean by âdashboardâ? The main âProjectsâ page?
Yes, the âProjectsâ page with listing of all projects.
OK, got it. We will find a way to fix this somehow (SONAR-11648).
Thanks for your feedback!