Is it possible to disable coverage test in sonarcloud?
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?
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
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
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.
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?
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.