Must-share information (formatted with Markdown):
- sonarqube8.9.2CE,custom quality gate
look the picture
1.
2.
3.
4.
Must-share information (formatted with Markdown):
Hi @roy_zheng,
Thanks for reaching out.
Let me sum up what I’ve understood so far :
You have analyzed your project which has 15 bugs in the old code tab.
You created on purpose a quality gate that is supposed to fail if you have any critical / blocker / major issues on the new code.
The screenshot that you’ve sent us describe the normal behavior of SonarQube application.
The code written before the initial execution of SonarQube is always treated as Old Code, which means that the raised issues found on your code won’t be impacted by your new quality gate because the conditions that you created on your quality gate target only the new code.
But from now on, next analysis will be listed in the New Code tab (新代码) on which your custom quality gate will be applied.
I recommend you to have a look at this page.
(https://docs.sonarqube.org/latest/user-guide/clean-as-you-code/).
Hope this clarify,
Regards
Thank u for your reply! Can I create a new quality gate for whole project?
Hi @roy_zheng ,
Happy to hear that the explanation helped.
So, you are trying to apply a quality gate to all the projects, or only to one project?
Are you trying to apply it to Old Code, or to new Code ?
Old Code / New Code topic is very important to us.
Why ?
The Clean As You Code Approach is helping customers benefit as much as possible to raise their code quality, making a clear separation between Code before SonarQube, and code After SonarQube.
It will help you focus on maintaining high standards and taking responsibility specifically in the New Code you’re working on. SonarQube gives you the tools that let you set high standards and take pride in knowing that your code meets those standards.
Let me know a bit more of what are you trying to achieve and I will guide you.
Regards
Thank you for your help @Yacine.Maghezzi !
I found when I create a new quality gate condition , there are tow options “New codes” and “All codes”
Can I appoint quality gate before scanning by specifying parameters like “sonar.quality.gate = xxx”
Hi @roy_zheng ,
There are no possibilities to put quality gates as a parameter before launching the analysis.
The reason is that this would impact the whole project’s stability. A user could simply change the parameter and be able to lower the quality gate for the code committed to be misaligned with the previous builds. This will have a big impact on the consistency and the SonarQube efficiency.
Maybe this can help you get a clearer vision about Quality gates usage (Quality Gates | SonarQube Docs).
You have the possibility to set up quality gates on New Code, Old Code, or both depending on what is your objective and how sense it would make to your project.
We recommend you focus on new code to get higher quality standards for the further developments sprints.
Hope this helps,
Hi @Yacine.Maghezzi,
I really appreciate your help. I will accept your suggestion and focus on new code. ^^
@roy_zheng
Happy to hear that it helped !
You are welcome, have a good day !
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.