A quality profile is the place where you define your requirements by requirements for the code by configuring a set of rules against which it will be measured. This means finding which rules you want to activate on your profile, as long as what parameters and setting the properties (severity and potential rule-specific parameters) you want for those rules in your profile.
Searching and finding rules Finding rules and managing their profile associations is the purpose of the Rules page. This is also the page where rules can be activated /deactivated on quality profiles.
Note that to be able to configure rules on a quality profile, you must have the "Administer Quality Profiles and Gates" permission permission.
Whatever search you're doing on the Rules page, when you're browsing a standard or a custom rule, you always have the opportunity to activate it the rule you're looking at on a quality profile (assuming you're logged in and have the correct permissions).
For instance, let's say that you're browsing all the rules tagged as "bug" and you find that one is not activated on in any of your profileprofiles:
Once the rule is activated, it appears in the list of the "Quality Profiles" section:
Note that you do not necessarily need to do this activation rule by rule. You have the opportunity option to bulk activate/deactivate in a quality profile all the rules returned by your search for a single profile:
During a bulk activation:
- Rules are activated with their default severity and default parameters
- If some of the rules are already activated on the selected quality profile, they will just be ignored (same for the deactivation)
- If some of the rules can't be activated (because they are rule templates or manual rules), they will just be ignored
- At the end, a short summary of what happened will be displayed. You might see for instance "2 rules activated" whereas the result of the search contained 9 rules: this might be because 7 of them where already activated for instance.
Quality profile-oriented search
In the Rules page, the "Quality Profile" criterion (always on top) allows you to concentrate on managing a specific quality profile instead of looking at any available rule. This criterion can be activated:
- Activation: this allows to search for rules that are active or not (or botheither) on the given quality profile. By default, it is obviously set to show rules that are active on the profile you selected.
- Language: as because a quality profile is mono-language, this criterion is automatically set to the correct language so that rules of any other language are not shown.
- Inheritance: you will see later that it's possible for a quality profile to inherit rules from another profile. If the selected quality profile is in this caseprofile has a parent profile, then this criterion is automatically displayed.
The purple background of the "Quality Profile" criterion rule header is used to focus your attention when browsing rules: when your search is profile-specific, a top bar will be shown is added on each rule to show its status (activated or not) within the profile, and to provide all the shortcut actions to activate/deactivate/update it on the specified quality profile:
Also, you will notice that the bulk action menu (accessed by clicking on the gears icon at the top right of the list of rules) offers new shortcut entries when your search is qualified by profile to bulk activate/deactivate the rules on the selected quality profile ("Activate in XXX" or "Deactivate in XXX").