📜 ⬆️ ⬇️

C #, PVS-Studio, ReSharper

We are constantly asked the question: “Does it make sense to use the PVS-Studio code analyzer if ReSharper is already in use?”. The implication is that the answer should be an article that will compare the capabilities of these tools in identifying errors in programs. We know that this is a dead end, and such an article will not do anything. However, the question is asked so often that you still need to have an answer to it. The answer is yes, there is meaning. Immediately I warn you that in the article you will not find the expected comparison. But if you spend only 10 minutes to fully read this article, we are sure you will agree with our answer and vision of the situation.

PVS-Studio is a static code analyzer that detects errors in the code of C, C ++ programs. Recently, the analyzer has mastered a new field for itself - C #. Historically, among the auxiliary tools for C # ReSharper reigns. This tool belongs to the productivity tool and is not a static code analyzer in the classical sense. However, ReSharper can do many different checks and colors suspicious parts of the code. Therefore, the programmers inevitably have a question: “Does it make sense to look towards PVS-Studio if you already have ReSharper?”.

Answer: Yes! We are sure of this answer. But to justify it with a simple table of comparison of possibilities will not work. To make such a sign is not a problem. But we didn’t make detailed comparisons. As life shows, the writing of such comparisons rather spoils our karma, and does not improve it.

For example, we had the experience of comparing PVS-Studio with Cppcheck and Visual Studio SCA. Was spent a lot of time and effort. The results were presented in a brief and detailed version. After that, only the lazy one did not write that we did everything wrong or that our comparison is dishonest thanks to specially selected projects for verification.
')
We see no more sense in wasting time on such comparisons. No matter how carefully and honestly we approached him, one can always say that the comparison was biased.

Nevertheless, we need to answer something to a person who asks about ReSharper. We can offer a great comparison option:

Are you already using ReSharper? Fine! Now install PVS-Studio and find errors in your project!

This will be the best demonstration of the benefits of using PVS-Studio. By the way, there is no opposition. Tools can perfectly complement each other.

The reader will say - well, the new tool does not hurt. But can you get into the market for C # tools? Here everything is already occupied and divided. Does anyone need PVS-Studio for C #? To begin with, the answer is:

Certainty of death, small chance of success. What are we waiting for?

" True death. No chance of success. So what are we waiting for ?! " ( en ).

Actually, we have already encountered the question, "Do you need a PVS-Studio analyzer?". This question sounded when the PVS-Studio analyzer was young and it only had to gain popularity among C ++ programmers. The appearance of one more tool seemed pointless, as there were already:
  1. Compilers that implement the functionality of static analyzers. For example, some editions of Visual Studio contain static analyzer C ++ code. And, for example, there is a Clang.
  2. There are free code analyzers, such as Cppcheck.
  3. There are powerful paid tools: Coverity, Klocwork and so on.

So why do we need “PVS-Studio for C ++?”. And we had nothing to answer this question. There is nothing to answer it now. But this question no longer matters. We can easily demonstrate the benefits of the PVS-Studio analyzer.

There is no longer any difference, whether there are any other tools or not. We found thousands of errors in the programs, which is documented . We found these errors, despite the existence of other tools. You can talk about competitive advantages as much as you like. But we are not interested. Here are 9355 errors found in projects such as Chromium, Qt, LibreOffice, TortoiseSVN, Unreal Engine 4 and so on .

Moreover, now we can give links when someone wants comparison with a specific tool.
With the C # analyzer, we are only at the beginning of this path. While we can modestly declare:
Wait a bit, and the question of comparison will disappear. No, don't wait. The analyzer can and should be used. Let him be young, and so far we have implemented only a small part of the diagnostics from the planned one. But he can start benefiting right now. Try the automatic check mode after compilation. Hope you enjoy. And if something is wrong - write , we are very actively working with feedback and suggestions.

Results Regardless of whether you use ReSharper or not, we suggest downloading and trying the PVS-Studio analyzer. If he finds mistakes in your project, it will be the best proof of his benefit. Just do not forget that single checks do not make sense. Code analyzers benefit only with regular use. It is inefficient to look for typos and errors, debugging the code, if the analyzer can do it for you. Of course, he is not able to find all the errors, but he can save you a lot of time for more useful things than finding a typo in the condition.

Source: https://habr.com/ru/post/276517/


All Articles