PVS-Studio 7.21 has been released. This short note describes the analyzer's main enhancements and lists our recent articles and quizzes.
You can download PVS-Studio 7.21 here. If you don't have a license key, you can get a trial key here.
So, what's new?
GitLab Code Quality reports
The PVS-Studio analyzer's results now can be converted into reports compatible with GitLab Code Quality. This will help monitor the quality of the project within the GitLab ecosystem.
The documentation on using PVS-Studio in GitLab CI/CD describes how to get a report of this type.
Closer integration with Unreal Engine
We keep enhancing support of Unreal Engine projects. And we have 3 news to share with you:
Improving cross-platform scenarios
The PVS-Studio plugin for Visual Studio now supports JSON suppress files. This format was previously supported only in utilities on Linux and macOS. This simplifies the use of suppress files in cross-platform scenarios. It is also now easier to integrate PVS-Studio in the development process of cross-platform projects that contain legacy code.
New warning suppression features
Now you can automatically filter analyzer warnings whose messages contain the specified text. The feature allows you to suppress specific diagnostics' warnings that match a template — without disabling the diagnostics completely. You can create a filter of this kind in .pvsconfig files (C++, C#) or directly in code (C++ only).
Let's take a look at the following example. The V3022 diagnostic of PVS-Studio for C# is triggered if the expression in code is always true or false.
Here's the code fragment:
static void ProcessStr(String str)
{
if (str == "temp")
{
if (str.Length != 0) // V3022 (expression is always true)
....
if (str.Length == 0) // V3022 (expression is always false)
....
}
}
Let's say we are not going to disable the V3022 diagnostic completely, but we only want to see warnings for conditions that are always false. So, we just need to create the following filter in the .pvsconfig file:
//-V::3022::{always true}
PVS-Studio will filter out V3022 warnings that contain the "always true" text. If you use this filter for the code fragment above, the first warning will be gone, while the second one will remain.
Diagnostic configuration files (.pvsconfig) documentation
Diagnostic configuration files allow to configure the analyzer to fit your needs, for example:
The new documentation section describes all features of .pvsconfig files and how to use these files in different environments.
New diagnostics
C, C++
C#
Quizzes
We made a quiz on "Who you are in C#". You can try it here.
By the way, leave a comment if you managed to get a different result than "You are a garbage collector". Because I don't know if it's me being so unlucky or if we're all being trolled by our C# team... :)
If you missed other activities, here they are:
Articles
For those who code in C++:
For those who code in C#:
Checking projects for bugs:
By the way, leave a comment if you managed to get a different result than "You are a garbage collector". Because I don't know if it's me being so unlucky or if we're all being trolled by our C# team... :)
Haha, I figured out the correct answers.
You are LINQ – hot, intelligent, but lazy.
You procrastinate until the last minute. But if the lead demands tangible results, you jump right into the task and carefully process the input data. The truth is that you fail to remember exactly which task you’ve already done, and sometimes you do the same task many times.
I also made notes so that mere mortals can follow in my footsteps:
1. Sunday is obviously shorter than Saturday, suggesting buffer overflow bug. Apparently C# hasn't managed to eliminate that class of bugs yet.
2. Nullable context seems to be a cheap substitute for C++ references, but to C# devs it's obviously an oasis in their desert world.
3. The *conditional* operator.
4. Option 3 is vacuously true.
5. This question will weed out pretenders. C# keeps devs busy, but they try to keep it secret.
6. This is meant to trip up junior devs.
7. List is a broad term.
8. Java for Professionals, obviously.
9. Last 3 are obviously wrong.
10. Option 2 seems to be a C# dev's description of the concept.
It turns out that GC isn't the worst you can get.
Giving the wrongest answer to each question leads to a NullReferenceException.
Thank you for the answer! :)
English
Français
605