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.

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

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:


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.

Rules

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


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


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. 
  • No labels