From now on, all new projects have to define their new code to get a Quality Gate. The clean-as-you-code methodology is at the heart of SonarCloud and there is no one definition that can fit perfectly for all projects. So you will be prompted to select the definition that best fits your project right after having created it:
As a result of these changes, the Quality Gate will not be computed for the first analysis. The focus of our default Quality Gate is on new code only so that it cannot be computed without the definition of new code being available.
Of course, if you are already familiar with the concept you can set up a default value for the new code definition in your organization settings (Organization → Administration → New Code) that will be applied to all new projects.
Hi @Martin_Bednorz,
I having some issues with this new change.
I don’t see the option to Set New Code definition on already existing projects.
I have set the organization New Code definition.
Any help would be appreciated.
Existing projects were automatically migrated to their previous setting. Before this change, the default value was set to the last 30 days, so I imagine that your existing projects were migrated to that value as well. You can navigate to the configuration page by selecting Administration --> New Code inside your project on SonarCloud.
@Martin_Bednorz but the problem is that in existing projects, they have the status “None” or “Not computed” in the quality portal, causing failures in the gate.
We have a parameter similar to “sonar.leak.period” to use the “Previous version” option. See the script below as I use it before the change.
We have an on going documentation work about these parameters.
After the new code recent changes, this configuration was modified. Now it is necessary to configure the value and type (sonar.leak.period.type) of the leak period. You can keep the approach you have now for the value (sonar.leak.period), but need also to send the type (you must send both at same request as you can check at the API settings documentation). The types allowed (for the sonar.leak.period.type setting) are: “date”, “version”, “days” and “previous_version”.
@Alexandre_Holzhey, I successfully tested this parameter in my sonarcloud setup script. But the documentation goes without this information … lol Thanks for the help. I’m very grateful.
Yes, as i described in previous answer the types allowed are:
You can do this change using the UI, at project administration option “New Code”. You can also set it for the organization, configuring a default new code setup to be used into new projects only. For existent projects you should change them individually.