Continuous Integration with Jenkins

The AI Reviewer Plugin for Jenkins allows you to see the results of a fully automated code review performed by AI Reviewer directly in your Jenkins CI system. The plugin imports the review file exported by AI Reviewer and displays details about the findings detected in your code.

Installing the AI Reviewer Plugin

In order to install the AI Reviewer Plugin for Jenkins, you need a running Jenkins installation (at least version 1.580). For details about installing Jenkins on your machine, please refer to the official Jenkins documentation.

Before installing the AI Reviewer Plugin, please make sure your Jenkins installation already has the Static Analysis Utilities Plugin installed (plugin id: analysis-core, at least version 1.69). If not, please install it using the Jenkins Plugin Manager.

Prerequisites for AI Reviewer plugin

The AI Reviewer Plugin can also be installed using the Jenkins Plugin Manager. Please select the Advanced tab and upload the file aireviewer.hpi, located in the AI Reviewer installation folder under jenkins/. The plugin will install automatically.

Installing AI Reviewer

While a restart of your Jenkins system is not absolutely necessary in this case, it is highly recommended that you do so before using any newly installed plugins. You may check that the plugin is properly installed in the Jenkins Plugin Manager by clicking on the Installed tab.

Using the AI Reviewer Plugin

To use the plugin, you need a working installation of AI Reviewer. For details about installing AI Reviewer on your machine, please refer to Deployment.

Assuming you already have a Jenkins build project set up for you project, you can add AI Reviewer analyses to this by adding a new Build Step to run aireviewer on the code, and a new Post-Build Action to import the generated code review in the AI Reviewer Plugin.

Configuring AI Reviewer

The example above shows a combined build step, which runs aiconfig to capture the project’s build configuration and then runs aireviewer to generate the code review for the project. Note that running aiconfig also results in a full build of the project, so you may decide to combine the running of aiconfig with the actual build of your system, and run aireviewer on its own, in a subsequent build step. If you choose this path, make sure aireviewer is always executed after aiconfig.

If you are not using aiconfig, you may run aireviewer at any point in the build process, provided that the entire source code of the project is available. This means that if you are using some form of source code generation during the build, aireviewer must run after all source code generation steps are completed. For details about using aiconfig and aireviewer, please refer to Project Configuration and Analysis and Reporting.

Upon successful configuration of the above described build step and post-build action, you should be able to trigger a build of your project in Jenkins. If the build is successful, the AI Reviewer Plugin will report the number of findings imported from the review. It will also keep track of findings encountered in previous runs, so you may choose to see only the new findings.

Successful Build

If you click on the link showing the number of findings or on the menu item AI Reviewer findings in your project / build menu, you will see a page with detailed information about these findings.

Detailed Finding Information

You may use the tabs and links in the Details section of this page to navigate to and explore all findings in detail. Also you can jump to the relevant lines in the source code.

Exploring Findings in Detail

If you already have at least two builds in your Jenkins Build History, you will also see an AI Reviewer Trend chart on your project page. This shows the evolution of the number of findings across builds. Findings are classified according to severity as having High, Normal or Low severity.

AI Reviewer Trend

For more details about the various types of findings, please refer to Analyses Reference.

Lower your software maintenance costs, by turning code review into a cheap commodity for your development team!