Configuring the Warnings Next Generation plugin for PVS-Studio integration





Picture 12






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 warnings about compiler or other analysis tools in Jenkins. This article will explain in detail how to install and configure this plugin for use with PVS-Studio, and also describe most of its features.





Install Warning Next Generation Plugin in Jenkins



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







Picture 1








Next, select the “Manage Plugins” item, open the “Available” tab:







Picture 8








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







Picture 3








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







Picture 14








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







Picture 5








Creating a new task in Jenkins



Now create a task with a free configuration. On the Jenkins homepage, select “New Item”. Enter the name of the project (for example, WTM) and select “Freestyle project”.







Picture 6








Click OK, and then 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":







Picture 7








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:







Picture 18








Getting project build results



Today in the Github trends, I came across the dotnetcore / WTM project. I downloaded it from Github, put it into the WTM assembly 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 .



I 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 the PVS-Studio Warnings menu item appeared on the left:







Picture 2








By clicking on the graph or this menu item, a page opens with the visualization of the PVS-Studio analyzer report by the Warnings Next Generation plugin:







Picture 9








Results Page



On the page above are two pie charts. To the right of the charts is a chart window. Below is a table.







Picture 10








The left pie chart shows the correlation of warnings of different hazard levels, and the right one shows the correlation of new, uncorrected and corrected warnings. There are three graphs. The choice of the displayed chart is carried out using the arrows on the left and right. The first two graphs display the same information as the diagrams, and the third - the change in the number of warnings.







Picture 26








You can select assemblies or days as graph points.



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







Picture 27








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







Picture 28








The graph after hiding the “Normal” metric:







Picture 29








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







Picture 11








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 on one page (10, 25, 50, 100):







Picture 32








It is possible to filter data by the line entered in the "Search" field. Filtering example for the word “Base”:







Picture 33








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







Picture 34








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



By clicking on the values ​​in the columns “Package”, “Category”, “Type”, “Severity”, the table data is filtered by the selected value. Filtering by Category:







Picture 36








The Age column shows how many builds survived this warning. Clicking on a value in the Age column will open the assembly page in which 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 assembly directory or was moved after creating the report, opening the source code of the file will be impossible.







Picture 37








Conclusion



Warnings Next Generation has proven to be a very convenient 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 will also draw attention to the static analysis of other Jenkins users. And if as a static analyzer your choice falls on PVS-Studio, we will be very happy. We invite you to download and try our tool.











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



All Articles