Creating a quality profile

The Sonar way quality profile is designed to be broadly suitable for most projects and you can use custom quality profiles to adjust your project as it progresses.

The Sonar way profile is designed to be broadly suitable for most projects, and it is intended only as a starting point. In many cases, you will want to adjust your quality profile later.

If you have multiple projects, you might also need to have different profiles for each. You might run into the following situations:

  • You have different technical requirements from one project to another.

  • You want to ensure stronger requirements for some of your projects than for others.

To create a quality profile, you need the Administer Quality Profiles permission. You can:

  • Extend an existing quality profile (duplicate an existing profile with inheritance).

  • Copy an existing quality profile (duplicate an existing profile without inheritance).

  • Create a quality profile from scratch.

  • Import a quality profile from another SonarQube instance.

We highly recommend that you customize your profiles by extending the Sonar way profile. This allows you to manage most use cases. Indeed, if your profiles inherit from the Sonar way profile, you will automatically benefit from:

  • Newly implemented rules.

  • Changes in a rule’s configuration.

  • The deactivation of deprecated rules.

Extending a quality profile

When you extend a profile, you create a child profile that inherits all the activated rules in the parent profile. You can then activate additional rules in the child, beyond those that are inherited. You can also deactivate rules that are activated in the parent.

For more information about inheritance, check out the Understanding quality profiles page.

By using the Create button

  1. See Retrieving your organizations to access your organization, then go to the Quality Profiles page.

  2. In the top right corner of the page, select Create. The New Quality Profile page opens.

  3. In Name, enter the name of the new quality profile.

  4. In Language, select the language of the new quality profile.

  5. In Parent, select the quality profile you want to extend.

  6. Select Create.

To change the created profile, see Editing a quality profile.

From the parent profile’s menu

  1. See the Viewing quality profiles page to learn how to select the quality profile that you want to extend.

  2. Select the three-dot button and select Extend in the menu. The Extend Profile dialog opens.

  3. In New name, enter the name of the new quality profile.

  4. Select Extend.

To change the created profile, see Editing a quality profile.

Copying a quality profile

  1. See the Viewing quality profiles page to learn how to select the quality profile that you want to copy.

  2. Select the three-dot button and select Copy in the menu. The Copy Profile dialog opens.

  3. In Name, enter the name of the new quality profile.

  4. Select Copy.

To change the created profile, see the instructions on the Editing a quality profile page.

Creating a quality profile from scratch

  1. See Retrieving your organizations to access your organization, the go to the Quality Profiles page.

  2. In the top right corner of the page, select Create. The New Quality Profile page opens.

  3. In Name, enter the name of the new quality profile.

  4. In Language, select the language of the new quality profile.

  5. In Parent, select None.

  6. Select Create.

To change the created profile, see the instructions on the Editing a quality profile page.

Importing a quality profile from another SonarQube instance

You can export a custom quality profile to an XML file and import it from another SonarQube instance. SonarQube Server, Cloud, and SonarQube Community Build support this feature.

When you import the quality profile:

  • If a quality profile with an identical name already exists, it will be updated. The update process involves adding any active rules from the backup that were not active in the existing profile. Existing active rules will not be updated.

  • Otherwise, a new profile is created.

Any user can export a quality profile.You need the Administer Quality Profiles permission to import a quality profile.

To export a custom quality profile:

  1. Go to Quality Profiles.

  2. Locate the quality profile’s row and select the three-dot button in the far right of the row.

  3. Select Back up in the menu.

To import a backed up quality profile:

  1. Go to Quality Profiles.

  2. In the top right corner of the page, select Restore. The Restore File dialog opens.

  3. Select Choose File and find your XML file.

  4. Select Restore.

Last updated

Was this helpful?