PVS-Studio as a plugin for SonarQube

Sergey Khrenov
Articles: 11



SonarQube is an open source platform, designed for continuous analysis and measurement of code quality.More than a year PVS-Studio has a plugin for the integrating the results of the work in SonarQube. Thanks to it, the abilities of detection critical errors in C/C++/C# can be expanded by the functionality of the quality monitoring. PVS-Studio and SonarQube greatly complement each other, allowing to build a powerful factory to bring the program code to the ideal state.

Picture 7

High-quality static analysis, in addition to the analysis itself, includes tasks of displaying the results of the work in the user-friendly format and providing a wide range of abilities to handle these results. Following these principles, PVS-Studio analyzer offers the following features:

  • Working with the bug report right in the tool window of Microsoft Visual Studio or a separate Standalone utility. Navigation along the code, filtering and sorting of the report, suppression of the display of certain warnings, particular files and folders are excluded from the analysis and so on.
  • The report file (xml) can be converted to a readable format (html, text) for further distribution among those who are interested.
  • The error list can be mailed to those developers who made the errors. To do this, there are special utilities built in PVS-Studio.
  • To accumulate the launch statistics and its further analysis in dynamics, there is a possibility to use a special tool Analysis Statistics, built into plugin for Microsoft Visual Studio or Standalone utility.

However, for the full management of the software project lifecycle, it's necessary to control not only errors, but also other metrics of the source code: the number of rows, cyclomatic complexity, amount of errors per KLOC, unit test code coverage, duplication and so on.

Despite the fact that PVS-Studio does not have built-in tools for continuous analysis and measurement of code quality, thanks to the possibility of integration with the SonarQube platform, all this is available to users of the Enterprise version of PVS-Studio already out of the box.

Using the PVS-Studio plugin for the integration of the C/C++/C# analysis results to SonarQube, in addition to the power of PVS-Studio, you get the following abilities:

  • Reports of code duplication, compliance with the coding standards, unit tests coverage, possible errors in the code, density of comments in the code, technical debt and much more.
  • Storing the history of metrics and building graphs for the changes of these metrics over time.
  • Fully automated analysis: integration with Maven, Ant, Gradle and common continuous integration systems.
  • Integration with such IDEs as Visual Studio, IntelliJ IDEA and Eclipse plugin using SonarLint.
  • Integration with external tools: JIRA, Mantis, LDAP, Fortify and so on.
  • Possibility of extending the existing functionality with the help of third-party plugins.
  • SQALE methodology to evaluate the technical debt.

Configuring of the SonarQube plugin won't take more than 15 minutes, after that you can load the analysis results to SonarQube using PVS-Studio and start using all the abilities of this tool, for example:

  • Advanced abilities of filtering, categorisation and sorting of warnings:
Picture 1
  • Code navigation:
Picture 2
  • Metrics and reports:
Picture 3
Picture 5
  • And much more ...

You can find the full list of SonarQube features on the official site. This article provides a detailed description of the integration of PVS-Studio into SonarQube.

Check your C/C++/C# projects using PVS-Studio analyzer, implement continuous analysis and management of your code using SonarQube plugin!

Download and try PVS-Studio: http://www.viva64.com/en/pvs-studio/

An example of using PVS-Studio and SonarQube plugin in the analysis of PascalABC.NET is given in the article.

To purchase a commercial license, please contact us via the email. You can also write to us to get a temporary license key for a comprehensive investigation of PVS-Studio, if you want to avoid the limitations of the demo version.



Use PVS-Studio to search for bugs in C, C++ and C# code

We offer you to check your project code with PVS-Studio. Just one bug found in the project will show you the benefits of the static code analysis methodology better than a dozen of the articles.

goto PVS-Studio;

Sergey Khrenov
Articles: 11


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;