In SonarQube, rule templates are used to create custom rules. Technically speaking, they are rules with multiple cardinality that can be used as a "template". But unlike what has always been possible in SonarQube, those rule templates are not "rules" and should not be treated the same way anymore:
- it should not be possible to activate them on a profile.
- it should only be possible to create a copy/instance of those templates in order to create a "real" rule (= custom rule) that can be activated on a profile.
Here are the use cases to cover:
- I want to see all the available rule templates to discover what custom rules I can create
- On a rule template, I want to quickly create a custom rule based on this template and to directly activate it on one or several profiles
- On a custom rule, I want to be able to easily update its name, description, ...etc - and even delete it if it should no longer be used (delete = set status to REMOVED).
- When I find a rule template, I want to see all the custom rules created from it.
In term of UI, this means at least (to be discussed and confirmed):
- Having 1 new (hidden by default) field in the search form:
- "Templates only" (boolean): if set, only the rule templates are shown
- On a rule template:
- It should be clear that this is a template and not a rule
- No profile panel as a template should not be activated on a profile
- But a specific "Create custom rule" action that opens a modal window with the following fields:
- name (mandatory)
- description (mandatory)
- Note: this must be specified using the markdown syntax in order to be able to format the code with block quotes, url, lists, ...etc.
- severity (mandatory)
- status (optional, will be "READY" by default)
- message (mandatory)
- parameters from the template (mandatory if any)
- key (optional - will be generated if not given)
- list of profiles to activate the rule on (optional)
- There should also be a way to see custom rules created with this template:
- Either the list of rules directly printed out in the panel
- or a link that activates the "Created from" field
- On a custom rule: all what can be display for a standard rule, plus:
- It should be clear that this is a custom rule (and somehow it should be possible to find which template was used)
- There should be an action to update this rule (i.e. modify its name/description/... etc), probably in a modal window
- There should be an action to delete this rule