You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Blueriq Model Analyzer(BMA) is designed to evaluate Blueriq Models and assess its maintainability and quality. The Model Analyzer is developed to work with the well known code quality platform called SonarQube. The BMA itself is a SonarQube plugin which will run inside SonarQube.

How does it work

SonarQube uses indexed folders and files of a project to assign issues and measures on. With a Java or C# project the source directory is scanned and indexed into SonarQube. After the files have been indexed an analyzer is run to scan the files for issues and collects its measures. Since Blueriq doesn't work with a source directory but with a branch export from the Management Service, we need to create our own folder structure. Therefore a property needs to be set sonar.blueriq.workingDir, where the BMA can create a folder structure that represents a blueriq project structure. This includes the repository and branch.

Running analysis

To the perform an analysis the command “mvn sonar:sonar” must be executed from a command prompt, in the directory where the pom.xml is located. When this command is executed, it will fetch a branch export from the management service and run analysis on it. When the analysis is done the command prompt will inform that the analysis was successful.

 

All the required properties must be set, otherwise the command prompt will show which properties aren't set.

Evaluating analysis results

When the analysis has finished the results can be viewed through a webbrowser of your choice, at http://<your-machine-name>:<port_number> for instance http://localhost:9000/

Analyzed projects are shown under Projects and are clickable to acquire more in depth insight.:

After clicking on the project, a new screen will appear with three tabs to browse through the analysis results:

  • Issues
  • Measures
  • Code

Scope of analysis 

The Blueriq Model Analyzer plugin distinguishes between issues and measures.

Code 

The third tab in the upper left corner, called Code, gives you an overview of your projects. When clicking on "Open Component's Page" button in front a project (highlighted in red in the image), the focus will move to that project and its homepage with be displayed, showing only its measures. The breadcrumbs trail at the top of the page will also be updated.

Single-project and multi-project

When scanning a single project with source code and filled properties for the BMA, the BMA will create a new source directory in SonarQube under the existing code project. All the previous issues and measures from the source code project will still exist and a new source directory will be shown inside SonarQube with name workingDir/repository/branch/project.

When scanning a multi-project solution, the BMA will create a new sub project under the root project. SonarQube will only scan files when there on project with no other sub projects. Therefore the BMA creates a sub project under the root project where is can register its own source directory and issues and measures.

Measures

The Blueriq Model Analyzer is capable of calculating the following measures:

Measure
Explanation
Number of modulesCounts the number of modules in you Blueriq Model.
Number of reusable expressions Counts the number of reusable expressions in your Blueriq Model.
Number complex expressionCounts the number of complex expressions in you Blueriq Model.

You can view the measures of your Blueriq Model by clicking the Measures tab in the upper left corner of your screen, calculated measures are shown at the bottom of the screen:

When a project/folder is selected, the measures of the project/folder and all its modules are displayed. Custom measures will also be displayed in the list of all the other measures.

Module measures

The BMA indexes projects and modules as files in SonarQube. If you want to see module specific measures you will need to open a file in SonarQube and click on show measures.

Issues 

The Blueriq Model Analyzer is capable of detecting the following issues:

Rule
Explanation
Elements in flowThis rule counts the number of elements within one flow and reports back an issue when the configured maximum number of elements is exceeded. It is recommended for maintainability issues, to keep the number of elements in flows below this maximum, otherwise the flow is seen as complex.
Flow viewportThis rule calculates whether or not your flow can be displayed on a standard screen. If not, you are advised to refactor for maintainability reasons.
Included library in projectThis rule searches for libraries in your Blueriq Model and reports back an issue when unused libraries are found. In case a library is connected to the project its modules should be used in the project. If it is connected, but not used the rule will trigger. However, there is an exception: there are libraries that does not contain modules, e.g. the AquimaLibrary which only uses globals. So this rule checks also if a library uses global elements.
DiamondThis rule checks whether modules are configured in such a way that a diamond, i.e. a closed circuit occurs in your Blueriq Model. If so, it is advised to refactor your model on this. From a modeling point of view this module structure could be curious. Additionally the model can behave unexpected in case specialization is used.
Expression duplicatesDetects duplicate expressions per module, considering all modules in scope. This is an indication that expressions have to be maintained in multiple places which is bad for maintainability reasons.
Reusable expression duplicatesThis rule checks whether a reusable expression is duplicated somewhere in your Blueriq Model, even across modules within a project which are not in each other's scope.
Gaps in Decision TableThis rule compares all conditions in a decision table for gaps between conditions. If there is a gap between two conditions an issue will be created. An issue can consist out of multiple warnings since multiple gaps may exist in a decision table.
Simplify ExpressionThis rule checks whether boolean logic in an expression can be simplified. If so, the simplified expression is reported as issue.

You can view the issues of your Blueriq Model by clicking the Issues tab in the upper left corner of your screen:


Also see:

Rule Parameters

  • No labels