The development of the PVS-Studio analyzer is speeding up. Therefore, most likely, now each release will be followed by a special note so that users don't miss changes that may be useful to them. What's interesting is that from now on we won't just list everything that was added or improved. Rather, now on the contrary, the purpose is to highlight the most important features in the news to avoid having just a boring list of changes. So, we offer you a press release for PVS-Studio 7.09.
This section is not related to the new version of PVS-Studio, but we would like to note a pleasant event that just took place shortly before the release.
On August 6, 2020, Forrester Research released a study called Now Tech: Static Application Security Testing, Q3 2020, which included the PVS-Studio analyzer as a SAST-specialized solution. Forrester is one of the leading researchers of the impact of new and innovative technologies on business processes and the market, so the inclusion of PVS-Studio in this study is a decent confirmation (both for our users and for us) of the relevance of this direction in which our product is developing. The research report is available for purchase to subscribers and customers of Forrester Research.
Regular readers of our blog are likely to remember that we use our own engine for parsing C and C++ code. This has both advantages and disadvantages. The C++ language is now rapidly developing and it has become clear that a serious reworking of the analyzer core is required. Otherwise, the analyzer will gradually get worse at parsing complex templates and get confused when inferring types of certain objects. This got our team a bit distracted from developing new diagnostics. However, after completing the planned work, we will be able to reduce the amount of memory consumed, improve support of C++20, and make many other improvements. In turn, these changes in the future will make the data flow analysis mechanism multipass. This will significantly improve the accuracy of many existing diagnostics.
New general analysis diagnostics:
Micro optimizations:
Let's have a closer look at the new V012 diagnostic: Some warnings could have been disabled.
Some methods of suppressing false positives allow you to completely disable the analyzer diagnostics. As a result, not only will some warnings be marked as false positives, but it also will become possible to remove them from further reports.
To find out which mechanisms are involved in disabling diagnostics, you can enable adding special warnings to the analyzer report.
pvs-studio-analyzer analyze ... --cfg source.cpp.PVS-Studio.cfg
As a result, the analyzer report will display messages with the V012 code and information about the sources of disabling diagnostics. PVS-Studio IDE plugins support navigation to the reason of disabling diagnostics in source code files and configuration files with rules (.pvsconfig). The paths to the configuration files containing the analyzer exception rules will also be added to the analyzer report as V012 messages.
In the PVS-Studio C# analyzer, there are now extended abilities of navigation through source files for Visual Studio and Rider plugins. Now it is possible to follow potentially dangerous fragments of code inside methods when the analyzer complains about calling such a method.
Also, the PVS-Studio C# analyzer supports redefining the certainty levels of warnings in the diagnostics configuration files (. pvsconfig). This feature has been available for a long time in the C++ analyzer.
The analyzer's warnings have three certainty levels: High, Medium, and Low. Depending on the used constructs in code, the analyzer estimates the reliability of warnings and assigns them an appropriate level in a report.
In some projects, searching for specific types of errors can be very important, regardless of the level of a warning's certainty. Sometimes there can be a reverse situation, when the error messages are of little use, but a developer doesn't want to disable them at all. In such cases, you can manually set the diagnostics' level of High/Medium/Low. To do this, you should use special comments that can be added in code or the diagnostics configuration file.
In the configuration file (.pvsconfig), you can write:
//V_LEVEL_1::3001
//V_LEVEL_2::3010,3020,3030
//V_LEVEL_3::3002
New diagnostics:
Most of the new diagnostics in this release are added for the Java language. By the way, speaking of creating Java diagnostics, we wrote a small note: Under the hood of PVS-Studio for Java: how we develop diagnostics.
New diagnostics:
Since the previous release, in our blog we have posted several notes on integrating PVS-Studio into the development process. We think that they can be useful for DevOps specialists and developers who implement static code analysis methodology in their companies.