How to customize rulesets using Verissimo Ruleset Editor
Overview
The set of rules applied by Verissimo in a linting session are specified in a ruleset XML file. This video focuses on customizing an existing ruleset using the Ruleset Editor. Learn how to organize rules in categories, add new rules with customized attributes, change the configuration of the ruleset and generate the updated XML file.
This video was made with DVT version 25.1.17.
Details
Introduction
Using the Verissimo Ruleset Editor you can create new ruleset XML files from scratch, but also easily organize and maintain existing ones.
Customizing a ruleset
We’ll begin with this example ruleset file. In the configuration it contains tag and Git annotations, followed by several rules organized into three categories. Some of those rules have already been customized with user‑specified names, various parameters, or tag values.
First, let's generate the Ruleset Editor for this ruleset from the command line. Use the -ruleset argument to specify the location of the input file.
The Ruleset Editor is actually an HTML file which can be generated from Eclipse, VSCode or the command line.
When opened in a browser, the editor starts in Rule Edit Mode, showing all the categories and rules defined in the ruleset.
Now let’s walk through some common tasks you’ll perform in the editor.
Renaming categories
For instance, to rename a category simply click on its name and type in the new one.
Moving rules to different categories
If you need to move additional rules into the newly renamed category, simply select one or more rules, click the Move to Category button and then pick the target category from the list of existing categories.
Adding new rules
To add new rules to our custom ruleset, first switch to Rule Select Mode.
Then, use the filter bar to quickly locate the rules you need.
Hiding already included rules
Notice that the rules which are already included in the ruleset are clearly marked and you can hide them instantly by clicking Hide Added Rules, letting you focus solely on the new candidates you want to incorporate.
Adding rules to an existing category
Now let's select one or more rules click Add to Category and pick the target category from the list of existing categories.
Customizing newly added rules
Now let's return to Rule Edit Mode to customize the newly added rules.
For example we can change the severity, rule parameter values or the priority, which is one of the custom tag annotations configured in the ruleset.
Modyfing tag keys
By the way, you can also modify the tag keys if needed. Click the Configuration button to bring up a panel which displays all existing annotations, letting you modify them or add new ones as needed.
Editing the ruleset XML generation preferences
The ruleset is now ready to be generated. Only changed attributes that differ from their defaults will be written to the XML. If you want finer‑grained control over the output, open Generation Preferences.
Here you can decide which attributes should always be written and whether to include extra details about each rule or its parameters. We’ll simply preserve the existing style of the file and make sure every rule’s parameters are explicitly listed.
Generating the ruleset XML file
Finally, click Generate Ruleset and choose the location for the file.