Importing data from PMD, Checkstyle, Findbugs and checKingQA
- The ruleset import wizard
- Selecting a file to import (Upload a ruleset file)
- Mapping the imported categories (Map user rules categories to CQM values)
- Adding the imported rules to existing models (Add rules to user's models)
- The preview page (Import preview)
- The results page
- Analyzing your code with imported rules
|Table of Contents|
The Models Management in Kiuwan allows to import rule data from different sources.
If you work with PMD, Checkstyle, Findbugs or checKingQA, you can import your rule sets into Kiuwan, use them in your models and analyze your code with your own custom rules. Use the import button, in the top bar of rules section, to begin the importing process:
The ruleset import wizard
After clicking the "Import" button, a wizard will appear and will guide you through these steps:
- Selecting a file (Upload a ruleset file).
- Mapping categories (Map user rules categories to CQM values).
- Adding rules to models (Add rules to user's models).
- Preview the import (Import preview).
- Import results.
Selecting a file to import (Upload a ruleset file)
Select a file to upload by clicking the "Upload" button:
You can upload one of these files:
If the selected file can be read by the import wizard, a summary of the read data will be shown: the engine detected, the number of categories identified and the rules read.
Although you will be able to import rulesets from newer versions, only rules compliant with the previous library versions can be applied when analyzing. See Kiuwan Local Analyzer documentation to read more about this topic.
Special features when importing checKingQA rulesets
When importing checKingQA rulesets you can reference product rules by using their standarized identifier. Rules with a name that starts with "OPT." will be identified as Kiuwan rules and will be searched in the current Kiuwan's rules library. If found, they will not be installed in your account's library but identified to be added to the selected models in the next steps. This means that when working with checKingQA rulesets that reference Kiuwan's rules the only available operation is adding those rules to the specified models. You can mix product and user rules in the same ruleset. Product rules will not be imported, but user rules will.
In the previous situation, note that only priority and repair difficulty will be imported. The rule classification under the characteristic criterion will be taken from the library defaults for each rule. This is the reason why you will not see the "Mapping" step when importing rulesets containing only product rules.
Mapping the imported categories (Map user rules categories to CQM values)
Kiuwan needs the imported rules to be classified under CQM categories. In this section, you can map the read categories to CQM values through a simple interface. It is possible that not all rules read are associated to a category. Here you can map these rules to a CQM value as well.
Note that it is not necessary to map all the read categories in the import wizard, but you won't be able to add to a model any rule that is not classified under CQM. You can always classify the rules later accessing the rule details from your library.
Adding the imported rules to existing models (Add rules to user's models)
Once you have configured the CQM mapping, and if you have created at least one model, it is possible to add the imported rules to any of them:
It is needed a full CQM mapping in the previous step to be able to add any rule to a model. You can also leave all the models unselected so the rules will only be imported in your account's library.
The preview page (Import preview)
Once you have completed the import configuration, a preview page will be shown.
Here you can see the rules that will be added/modified to your library or models selected. Furthermore, each rule contains information about its CQM value, Priority and the Action to do (Install or Merge).
The results page
Once the import has finished, a results pop-up will be shown:
This pop-up shows the summary result of the import run.
Analyzing your code with imported rules
First, you need to add the imported rules to an existing model (you can have done this with the import wizard already). You can mix any imported rule with the ones already in your library in the same model. To look for imported rules in your library you can select de "Engine" in the filter "Engine". This will help you identify which rules come from a PMD, Checkstyle or Findbugs import (checKingQA imported rules will be classified under "Kiuwan" engine value).
Once your model contains imported rules, you need to publish it, and then, you can run your analysis from the Kiuwan Local Analyzer.
Analyzing with imported custom rules
You can analyze your code using your own rule implementations from PMD, Checkstyle, Findbugs or checKingQA as long as you add your custom libraries using the Kiuwan local analyzer extension mechanism. Read the Kiuwan local analyzer documentation on how to add custom libraries and how the extension mechanism works.
If your rules are based on the standard rules supplied in the supported versions of PMD, Checkstyle, Findbugs or checKingQA, the Kiuwan Local Analyzer will work out of the box.