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.
Example | Explanation |
---|---|
java -jar <location on disk>\bma-sonar-scanner.jar | The <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.properties | The <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.
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:
- BMA rule: Aggregates should not contain too many metadata elements
- BMA rule: AQ_RequestParameters service should be implemented in certain way
- BMA rule: Condition node should have a label
- BMA rule: Decision table gap and overlap analysis
- BMA rule: Decision table should not be used as an attribute default value
- BMA rule: Duplicate expressions should be eliminated
- BMA rule: Element names should comply with a naming convention
- BMA rule: Elements should not contain connection details
- BMA rule: Elements should not contain username and password
- BMA rule: Elements should not have too many specializations
- BMA rule: Exposed flows should have role(s) assigned
- BMA rule: Expression is too complex
- BMA rule: Expression may be simplified
- BMA rule: Flow contains incorrect condition node
- BMA rule: Flow contains rest service client with unconnected exits
- BMA rule: Flows should fit the default viewport
- BMA rule: Flows should not contain many complex elements
- BMA rule: Flows should not contain too many elements
- BMA rule: Incorrect usage of today
- BMA rule: Library elements should be used
- BMA rule: Module should not contain specialized elements
- BMA rule: Precondition should not evaluate to a constant value
- BMA rule: Projects should not contain diamond shaped module structure
- BMA rule: Reusable expressions should not be duplicated
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.