PVS-Studio is a static analyzer for C, C++, C#, and Java code. You can run the analyzer on Windows, Linux and macOS. It is necessary to activate the license before using the analyzer. Please find the section that applies to you and then follow the instructions there.
Note. All actions are performed after the analyzer installation. The analyzer is available for download on the "Download PVS-Studio" page.
The license consists of a user name and a 16-character license key of the "XXXX-XXXX-XXXX-XXXX" format. If you don't have a license, you can fill out the trial request form.
Here is an example of how the license information may look like:
JohnSmith <--- Username
ASD1-DAS3-5KK3-LODR <--- License key
?Installer PVS-Studio Installer
You can enter the license during the installation of PVS-Studio. The installation wizard prompts you to request a license or enter an existing one.
Choose I have a license and want to activate it and click Next:
Enter your user name in the 'License Name' field. Enter your license key in the 'License Key' field. If the credentials are valid, you get a message with the license information.
In the Visual Studio menu, open Extensions > PVS-Studio > Options (PVS-Studio > Options before Visual Studio 2015):
Then navigate to the right side of the menu, to the PVS-Studio > Registration tab:
Enter the user name in the 'Name' field and the license key in the 'LicenseKey' field. If you entered the valid license, you will get the following message with the license information:
If you entered the invalid license, you will get the following message:
To enter the analyzer license, open any project, then open the IDE settings window:
Go to the 'PVS-Studio > Registration' tab in the opened window:
Enter the user name in the 'Name' field and the license key in the 'License Key' field.
If you enter the valid license, the 'Invalid License' label is replaced with 'Valid License' and the license expiration date appears in the 'Expires' field. Click Apply or OK to confirm and save the license.
To enter the license, go to the utility menu by selecting Tools > Options > Registration:
Enter the user name in the 'Name' field and enter the license key in the 'LicenseKey' field.
To enter the license in Visual Studio Code, open View > Command Palette.
Start typing PVS, choose 'PVS-Studio: Show settings' and open it.
Choose the 'License' tab in the opened window.
Enter the user name in the 'User name' field and the license key in the 'Key' field. If you enter the valid license, you will get a message with the license information:
To enter the license in Qt Creator, open Analyze > PVS-Studio > Options...
Next, click the 'PVS-Studio' tab and open the 'Registration' tab. Enter your user name in the 'Name' field and your license key in the 'License Key' field. If you enter the valid license, you will get a message with the license information.
If you enter the invalid license, you get the following message:
Click Apply or OK to confirm and save the entered license.
If you cannot enter the license in the GUI, you can use the analyzer in a special mode on Windows.
The command line may look like this:
PVS-Studio_Cmd.exe credentials --userName %USER_NAME% ^
--licenseKey %LICENSE_KEY%
Replace the 'USER_NAME' variable by the user name, and the 'LICENSE_KEY' variable by the license key.
When you run PVS-Studio this way, the analyzer writes the license to the settings file in the default location: "%APPDATA%/PVS-Studio/Settings.xml ". If the settings file does not exist, it will be created. Use the ‑‑settings flag to specify the path to the settings file in a non-default location.
Use the ‑‑licInfo flag to get current license information.
If the license cannot be entered in the GUI when running the analyzer on Linux/macOS platforms, you can use the special 'pvs-studio-analyzer' utility.
The command line on Linux/macOS may look like this:
pvs-studio-analyzer credentials ${USER_NAME} ${LICENSE_KEY}
Replace the 'USER_NAME' variable by the user name, and the 'LICENSE_KEY' variable by the license key.
When you run PVS-Studio this way, the analyzer writes the license to the settings file in the default location: "~/.config/PVS-Studio/PVS-Studio.lic". If the settings file does not exist, it will be created.
PVS-Studio Java can be installed independently from the other components of PVS-Studio, so you can also activate the license using plugins for build systems.
If you use Maven, the command line for entering the license may look like this:
mvn pvsstudio:pvsCredentials "-Dpvsstudio.userName=${USER_NAME}" \
"-Dpvsstudio.licenseKey=${LICENSE_KEY}"
If you use Gradle, the license can be activated with the following command:
./gradlew pvsCredentials "-Ppvsstudio.userName=${USER_NAME}" \
"-Ppvsstudio.licenseKey=${LICENSE_KEY}"
When using the Java analyzer core from the console, you can activate the license with the command:
java -jar pvs-studio.jar --activate-license --user-name $USER_NAME \
--license-key $LICENSE_KEY
Replace the 'USER_NAME' variable by the user name, and the 'LICENSE_KEY' variable by the license key.
You can read more about running the analyzer on the following pages: