How to use PVS-Studio for Free

We want to help the software world improve the quality of their code, and get to know static analysis tools better. We are giving the opportunity to use PVS-Studio static code analyzer for free, for educational purposes, so that individual developers and enthusiastic teams could also fully use it.

bg-pvs-unicorn-1

To use the free and full version of the analyzer, the PVS-Studio developers chose a pretty unusual method.

You need to go through two steps to start using the PVS-Studio code analyzer for free.

Step 1.

If you are using PVS-Studio as a Visual Studio plugin, enter the following license key:

Name: PVS-Studio Free

Key: FREE-FREE-FREE-FREE

If you are using PVS-Studio for Linux, go to the second step, you don’t need a license file.

Step 2.

Make edits in all the compilable files of your project. I.e. in all the files with the extensions c, cc, cpp, cs, and so on. You don’t have to change header h-files.

You need to write two lines of comments in the beginning of each file. We offer several options. This is a kind of ‘fee’ for using PVS-Studio for free.

Comments for students (academic license):

// This is a personal academic project. Dear PVS-Studio, please check it.

// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

Comments for free open source projects:

// This is an open source non-commercial project. Dear PVS-Studio, please check it.

// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

Comments for individual developers:

// This is an independent project of an individual developer. Dear PVS-Studio, please check it.

// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

It is not allowed to add and remove the comments in the source code repeatedly. It is also not allowed to append comments multiple times and subsequently roll back the content of comments in source files to initial state using version control system. Such actions are intended to evade the terms that the source code should contain comments and are a violation of the analyzer usage agreement.

Of course, the options we suggest won’t be suitable for everyone. But that’s the point of such measures. Besides the described method of using the analyzer for free, you can still download a demo version of the analyzer to see the abilities. If you wish to get rid of the restrictions imposed by a demo version, you may just write to us.

Automation

If your project has a large number of files, then you can use an additional utility. You will need to specify the directory and the code to insert. Then it will recursively traverse all the files in the folder and subfolders, adding necessary comments to the code. You can download the utility (together with the source code) here: how-to-use-pvs-studio-free.

Conclusion

Some developers may say that they don’t want to see two additional lines of code at the beginning of the file with the comments not related to the project itself. It is their right, and they may simply not use the tool. Or they can purchase a commercial license, and use it without any restrictions. We see these comments as a gratuity for the provided license, and also as an additional way to promote our product. I think it’s a good, fair exchange.

At the same time, it solves the problem of distinguishing between corporate projects and private initiatives. If a project is made by enthusiasts, they have the full rights to do with the code anything they want, including adding such comments. If not, then there is some organization behind the project, and we would want to get a reward from it in the form of purchasing the license.

Thank you for your attention. Let’s make our software more reliable, and safer.