Code Quality

IZ Analyzer’s AutoFix Feature: Secrets Exposed!

Written by:
Published on February 21, 2022

IZ Analyzer’s AutoFix Feature: Secrets Exposed!

When it comes to MuleSoft™ code quality analysis, IZ Analyzer is an outright choice among the Developer community. At Integral Zone, our R&D team is constantly working on releasing new features that will make our users’ lives easier. This time it is a big update!

For starters, IZ Analyzer is a feature rich product for Code quality assessment(CQA) for APIs and comes with an array of possibilities.

  • It comes bundled with over 200 predefined rules to validate MuleSoft projects.
  • One can create custom rules in addition to the default ones.
  • Also, it can scan popular non-mule API specifications like OAS.
  • Moreover, IZ Analyzer can also be configured with an organization’s DevOps process, supporting all major platforms like Azure, Jenkins, etc.

This blog is focused on the Anypoint Studio plug-in for IZ Analyzer. Would you like to know how IZ Analyzer integrates with Anypoint Studio so that MuleSoft developers can check their code for potential violations during development? All that with a single click!

Let me walk you through how to setup IZ Analyzer in Anypoint Studio. As soon as that is done, we will import a Mule project template into Anypoint Studio. MuleSoft’s official training project apdev-flights-ws will be used for demonstration purposes. As we explore different aspects of IZ Analyzer, we will be able to:

  • Inspect how the on-the-fly palette displays and flags the rule violations
  • Check other tabs like rule description, auto-fix logs etc.
  • Test the newly launched AutoFix feature and its Preview button, fix a few complex rules.

Let’s get started.

Setting Up Anypoint Studio

IZ Analyzer can be set up by signing into the product registration here. After registering and obtaining the security key, Anypoint Studio can be configured.

Anypoint Studio configuration of the product is also fairly simple. For a step by step guide of the same kindly follow our documentation on this link. Once the product registration and configuration in the studio is complete, we are all set to launch IZ Analyzer.

Importing Mule Project, Scanning for CQA Violations

  • Step 1: Upon launch, import the MuleSoft project in the studio.
  • Step 2: When the project is imported, you can see the complete set of rule violations mapped to the error categories.
  • Step 3: Double click on any of the error description to see rule description view. Notice the description.
  • Recommended step: Explore the custom rule editor view. Explore other views like AutoFix Logs, Rule Description etc.

AutoFix – the newest feature in IZ Analyzer


During the walkthrough, we have completed the Anypoint Studio setup. We had imported a Mule project as well as configured IZ Analyzer in our studio. In the following sections, let us explore how the latest AutoFix feature can help Mule developers attain highest code quality early in SDLC. AutoFix feature also introduces a nifty ‘Preview’ button, to preview the changes about to happen.

To start, let me list out the routine development process;
– Developer completes development.
– Code is committed to the repo, Dev build is deployed.
– IUT tests executed, issues identified and resolved.
– Once IUT is done code is pushed to UAT.
– UAT tests are executed, issues are identified, reported and resolved.
– Code is ready for pre-prod and sent to the Architect or Lead for review.
– Potential CQA violations are identified and shared for rectification.
– In pre-prod deployment builds, embedded CQA are executed.

One point to note is that some of these steps may vary depending on the organization’s philosophy. It could be in different ways for different people. However CQA is generally executed in the later stages of the entire life cycle and in case of an anomaly, developer has to generally go back to the drawing board to rectify.

What stands out in IZ Analyzer with the latest feature is that the Developer will assess the code, right in his/her respective studio. Code compliance becomes quick & efficient as you can comply the code to the code quality profiles. Developers can preview the fix that will be applied with the preview button. Now, Code violations are fixed with the mere click of a button. Imagine how many hours you could save by reducing your technical debt.

Now let’s dig a little deeper. Let’s see some code violations. We will start with this one.

  • API Implementation should not be in auto generated file

Notice that in interface.xml itself a POST call implementation is present. This is against best practice and hence the rule error. Notice on the fly results show the error as well. When one clicks preview it will show what changes will be applied as a part of the fix.

Notice the fix preview that will be generated, see what changes will be applied as part of the fix, click OK. Click on FIX button. Once FIX button is clicked, the Transform Message component in POST method flow in interface.xml will get replaced. A new flow reference component will be added. It will be referring to a new flow generated in interface-impl.xml having the Transform Message component which was initially in interface.xml.



Notice how post fix new flow ref is generated. Also notice how in imple.xml new flow implementation is auto generated and is referred from interface.xml. All this on mere button click!

We will see one more code quality rule which is non externalization of properties. Ideally a good MuleSoft project would have connector configurations in config files. For instance in HTTP Listener config, the best practice is to keep all config in a property file. But what if during development the hostname or port are not externalized or what if you have legacy projects which are not aligned to best practices?

Click on preview button to see as a part of fix for externalization of Hostname and Port, what changes will be done to the code.

When you click fix, see how respective configs are externalized and generated to be referred from the HTTP Listener config. Refer below picture.

IZ Analyzer – AutoFix Logs

IZ Analyzer’s AutoFix and Preview features are fascinating.
While you can align all code quality anomalies with the click of a button to best practices, one may forget to track what all changes were done as a part of this exercise. There can be situations in which there are quite a few fixes, and a report or analysis is required.

In case, one needs to send a summary of the AutoFix applied to a project lead or for personal record, IZ Analyzer will generate a CSV report in the target folder of the project path.

Endnotes

IZ Analyzer, which is already used by clients from multiple industries, saves about 80% of costs and time on MuleSoft projects. From our research, most of the MuleSoft customers appear to be following either manual code reviews or rudimentary automation where errors are inherent.

IZ Analyzer’s Anypoint Studio plugin, especially with its latest Preview and AutoFix features, simply takes MuleSoft CQA to the next level making it easy, faster and simply hassle free. IZ Analyzer’s 450+ predefined rules ensure that best practices are never compromised, plus the ability to create additional custom rules allows the Customers to implement their organization specific rules. Overall, our customers recover the licensing cost of IZ Analyzer within first 2 months of using the product.


Let us know what you think, feel free to drop a comment.

Start using IZ Analyzer for Free

Interested in trying out the most powerful MuleSoft code review tool in the Mule Ecosystem? Try now our free Online scanner and get your scan results instantly.

There’s more to it. If you would like to see the product in action, book an online demo.

Feel free to leave a reply or query.


Mulesoft™ is a unified, single solution for iPaaS and full lifecycle API management. For further information, please visit www.mulesoft.com.

Leave a Reply

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

Other Blog Posts

Other Blog Posts

Customer Success Stories: Why IZ Analyzer Is a Game Changer

IZ Analyzer, a dynamic code analysis tool, has garnered significant praise from a diverse range of clients, each with their own unique perspectives on what makes it stand out. Client Feedback: A Deep Dive Client from a Fortune 500 beverage manufacturing: Specialized MuleSoft Code Scanning For this global leader in the beverage industry, the specialization …

Read more

MuleSoft Runtime Code Scanning – Why Do You Need It?

One of the most frequently asked questions is if we have static code analysis and a well defined DevOps process, why would we need run time code analysis? In this article, let’s explore the differences between the two and why you might want to have runtime code analysis (and IZ Runtime Analyzer) even if you have …

Read more

Ensuring Software Quality in Healthcare: Leveraging IZ Analyzer for MuleSoft Code Scanning 🏥💻

Ensuring software quality in the healthcare industry is a top priority, with direct implications for patient safety, data security, and regulatory compliance. Healthcare software development requires adherence to specific rules and best practices to meet the unique challenges of the industry. In this blog post, we will explore essential software quality rules specific to healthcare …

Read more