Configuration of the Warnings Next Generation plugin for integration with PVS-Studio +32


Picture 4


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


Installation of Warning Next Generation Plugin in Jenkins


By default, Jenkins is located at http://localhost:8080. On the front page of Jenkins on the top left, choose the item «Manage Jenkins»:

Picture 1



Next, select «Manage Plugins» and open the «Available» tab:

Picture 8



In the top right corner, enter «Warnings Next Generation» in the filter field:

Picture 3



Find the plugin in the list, put a tick on the left and click «Install without restart»:

Picture 14



The plugin installation page will open. It will show us the results of the plugin installation:

Picture 5



Creating a New Task in Jenkins


Now let's create a free configuration task. On the main Jenkins page, choose «New Item». Enter the project name (for example, WTM) and choose «Freestyle project».

Picture 6



Click «Ok», then the task configuration page will open. Open the list «Add post-build action» at the bottom of this page in the item «Post-build Actions». In the list, select «Record compiler warnings and static analysis results»:

Picture 7



In the drop-down list of the field «Tool» choose «PVS-Studio» and then click save. On the task page, click «Build Now» to create a folder in Jenkins' workspace for our task:

Picture 18



Getting Project Build Results


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

After that, I ran the project build in Jenkins a couple of times. As a result, a graph appeared on the right at the top of the WTM task page in Jenkins. A menu item PVS-Studio Warnings appeared on the left:

Picture 2



By clicking the graph or this menu item, you'll open the page with visualization of the PVS-Studio analyzer report by the plugin Warnings Next Generation:

Picture 9



Results Page


There are two pie charts on the top of the page. To the right of these charts, there is a graph window. A table is at the bottom.

Picture 13



The left pie chart shows the ratio of warnings of different levels of danger, on the right — the ratio of new, outstanding and fixed warnings. There are three graphs. You can choose the graphs to display using the arrows on the left and right. First two graphs show the same information as charts and the third one shows the number a change in the number of warnings.

Picture 26



You can choose builds or days as graph points.

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

Picture 27



You can hide the graphs of certain metrics by clicking on the metric designation in the legend of the graph:

Picture 28



The graph after hiding the «Normal» metric:

Picture 29



The table at the bottom displays the analyzer report data. When you click on the pie sector, the table is filtered:

Picture 12



There are several bookmarks in the table to filter the data. In this example, filtering is available by namespace, file, category (warning name). In the table, you can choose the number of warnings to display per page (10, 25, 50, 100):

Picture 32



You can filter data by a line entered in the «Search» field. An example of filtering by the word «Base»:

Picture 33



On the «Issues» tab, when you click on the plus at the top of the table line, a short warning description will be displayed:

Picture 34



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

When you click on the values in the «Package», «Category», «Type», «Severity» columns, the table's data is filtered by the chosen value. Filtering by category:

Picture 36



The column «Age» shows the number of builds with a certain warning. When clicking the value in the column «Age», a build page will open when a certain warning has first appeared.

When clicking the value in the column «File», the file's source code will open on the line with the code that caused the warning. If a file is absent in the build directory or was removed after creating the report, opening the file's source code will be unavailable.

Picture 37



Conclusion


Warnings Next Generation turned out to be a very convenient tool for data visualization in Jenkins. We hope that support of this plugin by PVS-Studio will help those who already use PVS-Studio, as well as draw attention of other Jenkins users to static analysis. If your choice falls on PVS-Studio as a static code analyzer, we'll be very pleased. You're welcome to download and try our tool.




К сожалению, не доступен сервер mySQL