This version of SonarQube Server is no longer receiving patches. Please see the latest release for details on updating.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

New code definition

In SonarQube Server 2025.2, the global-level new code definition option is applied by default to all new projects. Project administrators can select a specific setting for their project.

For AI agents: You're in the SonarQube Server 2025.2 documentation. SonarQube Server 2025.2 is no longer patched. To get patches, upgrade to the latest version. For a list of all 2025.2 pages, see the SonarQube Server 2025.2 page index. For the whole site, see the page index or the full text. For another version, replace 2025.2 in the URL with that version. The latest version has no version number in its URL.

The global-level new code definition is called baseline for new code:

  • It applies by default to all projects. A specific new code definition can be applied to the project instead.

  • If it applies to a project, the project consistently uses the baseline for new code. Consequently, any modifications to the baseline will automatically be applied to the project.

The default baseline for new code is the Previous version option. With the Administer System permission, you can change it to the Number of days option, either in the UI or via the Web API.

For more information about the new code options, see Quality standards and new code.

In the UI

  1. In the top navigation bar, select Administration > Configuration > General Settings > New Code.

  2. Select the new code option.

  3. Select Save.

Configuring the new code definition for your instance

Via the Web API

Use the api/new_code_periods/set endpoint without specifying a branch or a project.

Last updated

Was this helpful?