Webinar: Evaluation - 05.12
PVS-Studio is the analyzer that searches for bugs in programs written in C, C++, C#, and Java. The PVS-Studio 7.08 release includes a lot of new exciting features. The C# analyzer, in addition to working on the Windows OS, now also works on Linux and macOS. It is now possible to output analysis results in the TeamCity format. The Perforce system is supported in the utility for automatic notification of developers. The plugin for the JetBrains Rider development environment is now available. In the PVS-Studio Java analyzer, you can search for Java SE API compatibility problems. Let's look at these new features in more detail in the article.
At the end of April, we started beta testing of the C# analyzer for Linux and macOS. It was quite successful: we collected feedback, made a number of improvements and fixes.
Now finally, we are releasing the analyzer version comprising the C# analyzer for Linux and macOS! Thus, now the C# analyzer, as well as C, C++, and Java analyzers, is available under all platforms supported by PVS-Studio - Windows, Linux, and macOS.
The command-line utility for analyzing C# projects under Linux \ macOS is called pvs-studio-dotnet. The features of installing and using the analyzer are described in the corresponding sections of the documentation:
On the sidelines of the development and testing of the C# analyzer for Linux and macOS, we have also been developing the PVS-Studio plugin for JetBrains Rider. A no less positive news is that it's also included in the release and is available under all supported platforms: Windows, Linux, macOS.
For more information about installing and using the plugin, see the documentation section "Using PVS-Studio with JetBrains Rider".
In the Windows version of the analyzer, in the PVS-Studio_Cmd command line utility, a new mode of checking the specified list of files has been added, which is useful for setting up automatic checking of pull \ merge requests and commits.
Despite the fact that previous analyzer versions already had a similar mode, working with it wasn't the most convenient, especially for C++ projects.
Firstly, in the case of analyzing both C++ and C# projects, an XML file was required to specify the list of files for analysis (via the ‑‑sourceFiles flag). In other words, it had to be formed in a special way from the list of files in PR, MR, and a commit. This adds an additional step.
Secondly, let's say source files had to be analyzed based on .h files. That is the .h file is changed, you need to analyze all files where it was included explicitly or indirectly. Previously the presence of build system artifacts (tlog files) was required. In addition, one had to first get these files when building the project being checked.
Now it is much easier and more convenient to use this mode – you don't need any tlog files or special XML files. One can simply use the same ‑‑sourceFiles flag to send a simple text file with a list of files for analysis. That's it, no tlog files! To solve the problem of storing dependencies, the analyzer now creates a special cache of dependencies between the header and source files, instead of using tlog files, which greatly simplifies this mode of use.
This mode is described in more detail in the section "Setting individual files for checking" in the documentation section "Analyzing Visual Studio / MSBuild / .NET Core projects from the command line using PVS-Studio".
Added nine diagnostic rules. Among them, the V6078 diagnostics clearly deserves more attention, and we'll look at it separately in the next section.
C, C++:
Java:
Dalia Abo Sheasha's talk "Migrating beyond Java 8", which we heard at the autumn Joker 2019 conference, inspired us to implement a new diagnostic rule that allows us to detect incompatibilities in the Java SE API between different versions of Java.
At the moment, Java SE 14 has already been released. Despite this, many companies continue using previous Java versions (Java SE 6, 7, 8,...). As time passes and Java is constantly updating, the problem of compatibility of different versions of Java SE API becomes more urgent every year.
When new versions of Java SE are released, they are usually backward compatible with earlier versions. For example, an application developed on the basis of Java SE 8 should run on Java version 11 without problems. However, in practice, some incompatibilities may occur in a number of classes and methods. This incompatibility is due to the fact that some APIs undergo changes: they are deleted, their behavior changes, they are marked as outdated, and much more.
This problem will only get worse when you start thinking about porting your project to a newer Java SE. Or when the technical support of your app will receive more and more emails saying that the app behaves incorrectly or can't start at all.
To help solve this problem, we added the "big" V6078 diagnostic rule to the analyzer. For a more detailed story of this diagnostic development, see the article "The PVS-Studio analyzer: detecting potential compatibility issues with Java SE API".
Around the same time with the release, we made PVS-Studio friends with Compiler Explorer. Of course, this doesn't directly relate to the release, but I would like to mention this to those who missed this news.
Thanks to the Compiler Explorer project, you can quickly get ready with synthetic examples of C and C++ code, and see how the PVS-Studio analyzer reacts on them.
Check out and try: Online examples (C, C++).
0