PVS studio in 4.17

I installed PVS Studio trial to test it out. Ooook, so it is written that it works with command-line Unreal Build tool. I suppose I can not simply run it in my Visual Studio 2017 solution file. But any specific information is missing on this topic completely, like, I never deal with command line tool when building my projects naturally. Or I simply can’t find the info hidden somewhere? Any link?

Indeed, you can use command line Unreal Build Tool to run PVS-Studio analysis. This is convenient, if you wish to configure a regular check of your code with the analyzer. Unfortunately, there is currently no public documentation available for this. However, since you are using a trial, it will be easier, for evaluation purposes, to just run PVS-Studio Compiler Monitoring when building your code, and you will have the same analysis results. You can then open these results in PVS-Studio Visual Studio extension and work with it from there.

The documentation on PVS-Studio compiler monitoring is available here: Compiler Monitoring System in PVS-Studio

Hope that helps!

I had massive issues with using the Compiler Monitoring on a project with plugins, but it works fine when using the command line integration.

I haven’t had time yet to dig into exactly what’s different, but the integration does create a config file and add some command line switches when running PVS.

But I agree I would love a way to run this from VS and get the report there, sounds like a candidate to add to the Unreal VS tools?

If you still require it, contact us, so we can possibly resolve these issues.

At present, there are no plans on adding the specific support for Unreal projects to Visual Studio on the side of PVS-Studio team, unfortunately. You can still use PVS-Studio VS integration for working with the report, but have to manually import it after running compiler monitoring \ Unreal Build Tool.

Can the free version of pvs studio be used here? If yes, how do you set it up to analyze your code and how it works together with the engine?

You can use free version of PVS-Studio according to the instructions available here. You would generally need to mark your files with special comments and run the analyzer (either by compiler monitoring or direct integration to the build system).

However, the case of UE engine project is a little more complex, and there could be potentially issues with some of engine files not being analyzed because you could have trouble inserting the PVS-Studio prerequisite comments (see the description in the link above) into the UE library code or the code autogenerated by EU build system.

We do provide the free version “as is” and have not tested it specifically on UE projects. In case of the issues, we currently have no plans of specially supporting EU for the free version, and would generally advise you to consider one of our commercial licenses.

Would you mind explaining how you did it with the command line? Using the bare minimum of arguments (a target sln) I got the same error I got in VS - non makefile solution or whatever.

Hi, George.

It seems you are using PVS-Studio_Cmd for the analysis (judging by you mentioning the target sln argument). This tool is intended for ‘regular’ MSBuild projects - UE projects are not the regular ones. To analyze such a project with PVS-Studio, you should use either CLMonitor.exe tool or direct integration of analyzer into Unreal Build System. However, both direct integration and console CLMonitor.exe require a PVS-Studio license, and are not available under trial. For trial, you can use PVS-Studio Standalone, which actually act a GUI for CLMonitor.exe.