Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 is series of components which either work with or extends SonarQube.

How does it work

When you want to analyze a source code project, being either a Java, C# or Blueriq project, you can leverage SonarQube do handle the analysis for you. SonarQube consist out a few concepts.

SonarQube Server

The main application of SonarQube, where your analysis projects are stored and can be viewed. It also houses registered SonarQube Plugins.

SonarQube Plugin

A plugin is an extension for SonarQube, which can analyse source code. SonarQube delivers plugins for a variety of language, such as Java and C#. These plugins perform the analysis of your source code and sends the results of the analysis to the SonarQube Server.

SonarQube Scanner

A scanner is a tool to execute your source code analysis. SonarQube delivers scanners for a variety of build systems, such as Maven and MSBuild. You configure a scanner to execute your source code analysis. The scanner will fetch all registered plugins from the SonarQube Server and will give the configured source code to every plugin so that the plugin can runs its analysis.

SonarQube Quality Gate

See Quality gate.

Table of Contents

Blueriq Model Analyzer

The Model Analyzer consists out of three components. A Plugin, a Scanner and a Quality Gate. The SonarQube Scanners index the gives source code directories and files, so it can run its analysis on those indexed files. Since Blueriq Models live in Blueriq Studio and does not consist out files, we needed to create our own scanner. The scanner creates directories and files in a structure way which represents your Blueriq project structure including repository and branch. Once this file structure is in place, the scanner works just like every other SonarQube Scanner.

Scope of the analysis 

The Model Analyzer can only analyze the content of project which are created in the project itself. For more information see Analysis Scope.

Configure analysis

The Blueriq Sonar Scanner needs to be configured to read your Blueriq Model on which the analysis will be run. Blueriq Sonar Scanner takes care of this by reading a application.properties file. See Configuring Sonar Scanner on how to setup your application.properties file.

Running analysis
Anchor
running-analysis
running-analysis

To perform an analysis you need to have the Blueriq Sonar Scanner somewhere on you local environment. This Blueriq Sonar Scanner can be found in the zip of the Blueriq Model Analyzer and is called bma-sonar-scanner.jar. To perform an analysis you will need to execute a command from a command prompt. The command consist out of two parts. The first part being the execution of java with the Blueriq Sonar Scanner and the second part is the location of the application.properties.

ExampleExplanation
java -jar <location on disk>\bma-sonar-scanner.jarThe <location on disk> needs to be replaced with the location of where the bma-sonar-scanner.jar can be found.
-Dspring.config.location=file:<location on disk>\application.propertiesThe <location on disk> needs to be replaced with location of where the application.properties can be found.

When performing the following  command java -Dspring.config.location=file:.\application.properties -jar C:\tools\bma-sonar-scanner.jar . The Blueriq Sonar Scanner which is located in C:\tools will be executed with application.properties from the current directory. When this command is executed, Blueriq Sonar Scanner will either download a branch export from the management service or from a configured location, and perform the analysis. 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 web browser 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:

Clicking on the project will show a new screen with three tabs to browse through the analysis results:

  • Issues
  • Measures
  • Code

Code 

The third tab in the upper left corner, called Code, gives you an overview of your projects and its quality. 

Selecting a project will go one level deeper and display the code smells that are detected on specific modules.

Measures

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

Measure

UI Children

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.

pageBMA Measures


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 in sidebar under the section size:

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 

Rules

The Blueriq Model Analyzer is capable of detecting generating model smells based on the following issuesrules:

Rule

UI Children

Explanation

columns

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.

3
pageBMA Rules


The model smells of your Blueriq Model can be viewed
You can view the issues of your Blueriq Model by clicking the Issues tab in the upper left corner of your screen:

Image Modified

Also see:

Rule Parameters


FAQ

I get the following Exception when running the BMA javax.xml.bind.UnmarshalException: Unable to create an instance of ...

- This issue means that you performing an analysis with a branch export which could either be a newer or older version than that is supported by the BMA release you are using.