Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration
The release of PVS-Studio 7.04 coincided with the release of the Warnings Next Generation 6.0.0 plugin for Jenkins. Just in this release, Warnings NG Plugin added support for the PVS-Studio static analyzer. This plugin visualizes data about compiler warnings or other analysis tools in Jenkins. This article will describe in detail how to install and configure this plugin for use with PVS-Studio, as well as describe most of its features.

Installing Warning Next Generation Plugin in Jenkins

By default, Jenkins is located at http://localhost:8080. On the main page of Jenkins, at the top left, select the "Manage Jenkins" item:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Next, select the "Manage Plugins" item, open the "Available" tab:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

In the upper right corner, in the filter field, enter "Warnings Next Generation":

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

We find the plugin in the list, put a tick on the left and click "Install without restart":

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

The plugin installation page will open. On it we will see the results of installing the plugin:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Creating a new task in Jenkins

Now let's create a task with a free configuration. On the main page of Jenkins, select "New Item". Enter the name of the project (for example, WTM) and select the item "Freestyle project".

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Click "OK", after which the task settings page will open. At the bottom of this page, in the "Post-build Actions" item, open the "Add post-build action" list. In the list, select "Record compiler warnings and static analysis results":

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

In the drop-down list of the "Tool" field, select "PVS-Studio", then click the save button. On the task page, click "Build Now" to create a folder in the workspace in Jenkins for our task:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Getting Project Build Results

Today I came across the dotnetcore/WTM project in Github trends. I downloaded it from Github, put it in the WTM build directory in Jenkins, and analyzed it in Visual Studio using the PVS-Studio analyzer. A detailed description of using PVS-Studio in Visual Studio is presented in the article of the same name: PVS-Studio for Visual Studio.

Started building the project in Jenkins a couple of times. As a result, a graph appeared on the top right of the WTM task page in Jenkins, and a menu item appeared on the left PVS-Studio Warnings:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Clicking on a chart or this menu item opens a page with PVS-Studio analyzer report visualization by the Warnings Next Generation plugin:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Results page

There are two pie charts on the top of the page. To the right of the charts there is a chart window. Below is a table.

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

The left pie chart shows the ratio of warnings of different severity levels, the right one shows the ratio of new, uncorrected and corrected warnings. There are three charts. The choice of the displayed graph is done using the arrows on the left and right. The first two graphs show the same information as the charts, while the third shows the change in the number of alerts.

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

You can select assemblies or days as chart points.

It is also possible to narrow and expand the time range of the chart to see data for a certain period:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

You can hide charts of certain metrics by clicking on the metric symbol in the chart legend:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Graph after hiding the "Normal" metric:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

At the bottom there is a table displaying the analyzer report data. When you click on a sector of the pie chart, the table is filtered:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

The table has several tabs for filtering data. In this example, filtering by namespace, file, category (warning name) is available. In the table, you can choose how many warnings to display per page (10, 25, 50, 100):

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

It is possible to filter the data by the string entered in the "Search" field. An example of filtering by the word "Base":

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

On the “Issues” tab, when you click on the plus sign at the beginning of a row in the table, a brief description of the warning will be displayed:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

The short description contains a link to a site with detailed information on this warning.

When you click on the values ​​in the "Package", "Category", "Type", "Severity" columns, the table data is filtered by the selected value. Filter by category:

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

The Age column shows how many builds survived the warning. Clicking on the value in the "Age" column will open the build page where this warning first appeared.

Clicking on the value in the "File" column will open the source code of the file on the line with the code that caused the warning. If the file is not in the build directory or has been moved since the report was generated, the source code of the file cannot be opened.

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

Conclusion

Warnings Next Generation turned out to be a very handy data visualization tool in Jenkins. We hope that the support of PVS-Studio with this plugin will greatly help those who already use PVS-Studio, and also draw attention to the static analysis of other Jenkins users. And if you choose PVS-Studio as a static analyzer, we will be very happy. We invite you download and try our tool.

Configuring the Warnings Next Generation Plugin for PVS-Studio Integration

If you want to share this article with an English-speaking audience, please use the translation link: Valery Komarov. Configuration of the Warnings Next Generation plugin for integration into PVS-Studio.

Source: habr.com

Add a comment