Falcon AI is here - World's only AI-powered MuleSoft DevSecOps tool.

Analyzing Branches & Pull Requests using IZ Analyzer

Overview

In a standard development model, we create multiple branches to maintain various versions of the source code. Branches may be broadly classified into categories such as feature, release, development branches, and many more.

With all these classifications in place, how do we keep track of the code quality across branches?

With our latest Mulesoft code review tool IZ Analyzer Branch & Pull Request analysis available as an Open source plug-in, you can ensure that you maintain code quality consistency all the way down to the branch level in your Mule projects.

Prerequisites

This blog post assumes that the readers are aware of the following prerequisites –

Setting up Branch analysis

A branch is created in IZ Analyzer when the sonar.branch.name parameter is passed during analysis. The value passed for sonar.branch.name  will be visible in UI.

Analysing the master branch

NOTE:- We will be using a Mule project purely for demonstration purposes. Ideally Branches and Pull Requests can be analyzed for any type of project (Eg: Java, HTML etc).

Let us start with a sample Mule project called analyzer-orders-sapi and GIT as SCM tool.

MuleSoft Code Review

Let’s analyse the project from master branch using the following command

mvn sonar:sonar -Dsonar.projectKey=analyzer-orders-sapi -Dsonar.organization=<organization key> -Dsonar.host.url=https://analyzer.integralzone.com -Dsonar.login=<access token> -Dsonar.sources=. -Dsonar.branch.name=master

NOTE:- Notice the sonar.branch.name analysis parameter included in the command.

MuleSoft Code Review

As we see in the above image, issues are now categorized under master branch. Let’s create a GIT Branch and see how to analyse a Branch in the next step.

Analyzing non master Branches

Let’s create a new branch called “create_order_issue_fix” and switch to the new branch.

MuleSoft Code Review
Mulesoft static code analysis

We will add few additional lines of code in this new branch and analyze source code using the same command, which was used earlier to analyze the master branch. User will have to change the value of sonar.branch.name to create_order_issue_fix

mvn sonar:sonar -Dsonar.projectKey=analyzer-orders-sapi -Dsonar.organization=<organization key> -Dsonar.host.url=https://analyzer.integralzone.com -Dsonar.login=<access token> -Dsonar.sources=. -Dsonar.branch.name=create_order_issue_fix

Once the analysis is complete, we should be able to see the new branch under the Branches and Pull Requests dropdown menu of your project as shown below.

MuleSoft Code Review
Mulesoft static code analysis

Branch level issues will be displayed once we select the appropriate branch. Issues displayed at the branch level will be the new set of issues introduced in the branch when compared to the master branch.

MuleSoft Code Review
Mulesoft static code analysis

Analysing Pull Requests

Pull Request analysis shows your Pull Request’s Quality Gate and Analysis in the IZ Analyzer interface. This analysis shows new issues introduced by the Pull Request before merging with the target branch

Let’s create a Pull Request with create_order_issue_fix as source branch and master as target branch. We will be needing the Pull Request’s ID during the analysis.

Note: Use your SCM providers Web UI to create the Pull Request

Use the following command to analyze the created Pull Request.

vn sonar:sonar -Dsonar.projectKey=analyzer-orders-sapi -Dsonar.organization=<organization key> -Dsonar.host.url=https://analyzer.integralzone.com -Dsonar.login=<access token> -Dsonar.sources=. -Dsonar.pullrequest.key=101 -Dsonar.pullrequest.branch=create_order_issue_fix -Dsonar.pullrequest.base=master

We have added the following new parameters to analyze the Pull Request.

Parameter Name Description
sonar.pullrequest.key Unique identifier of your Pull Request. Must correspond to the key of the Pull Request in your SCM.
sonar.pullrequest.branch The name of the branch that contains the changes to be merged.
sonar.pullrequest.base The branch into which the Pull Request will be merged.

Once the analysis is complete we should be able to see the Pull Request under Branches and Pull Requests dropdown menu of your project as shown below.

MuleSoft Code Review
Mulesoft static code analysis

Issues at Pull Request level will be displayed once we select the appropriate branch. Issues displayed at branch level will be the new set of issues introduced in the Pull Request, when compared to the master branch.

MuleSoft Code Review
Mulesoft static code analysis

End Note

Hope you found this article interesting. Do drop us a comment below with your inputs, views, and opinions regarding uploading Mule coverage report using IZ Analyzer.

Try IZ Analyzer for Free

Try one of the most powerful code analysis and review products in the Mulesoft ecosystem for free.

Sign up now for a free trial below:

https://analyzer.integralzone.com/try

Want us to give you and your team an exclusive demo? Book a slot below:

Leave a Reply

Your email address will not be published. Required fields are marked *

Schedule a consultation to begin your 2-week free trial


Every MuleSoft Project Needs ‘Falcon Suite’.

Falcon Suite is world’s only enterprise-ready solution for high quality, secure and compliant MuleSoft implementation. Here is why you should try our 2-week free trial.

Automated Code Review

Enhance code quality with real-time, in-line scanning and correction, reducing manual review time.

Continuous Monitoring

Ensure ongoing system integrity with 24/7 monitoring and vulnerability resolution.

API Health Monitoring

Maintain uninterrupted API performance with real-time health checks and instant alerts.

Robust Security

Protect against data breaches with comprehensive security and compliance checks.

Schedule a consultation to begin your
2-week free trial

Schedule a consultation to begin your
2-week free trial

Every MuleSoft Project Needs ‘Falcon Suite’.

Falcon Suite is world’s only enterprise-ready solution for high quality, secure and compliant MuleSoft implementation. Here is why you should try our 2- week free trial.

Automated Code Review

Enhance code quality with real-time, in-line scanning and correction, reducing manual review time.

Continuous Monitoring

Ensure ongoing system integrity with 24/7 monitoring and vulnerability resolution.

API Health Monitoring

Maintain uninterrupted API performance with real-time health checks and instant alerts.

Robust Security

Protect against data breaches with comprehensive security and compliance checks.