How to enter the PVS-Studio license and what is the next move
- What is included in the license
- Ways to activate the license using the GUI
- Ways to activate the license from a command line
- Quick start or what's next?
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.
What is included in the license
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
Ways to activate the license using the GUI
?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.
Microsoft Visual Studio
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:
JetBrains IntelliJ IDEA / Rider / CLion
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.
C and C++ Compiler Monitoring UI
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.
Visual Studio Code
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:
Qt Creator
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.
Ways to activate the license from a command line
Windows
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.
Linux/macOS
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.
Java analyzer
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}"
Replace the 'USER_NAME' variable by the user name, and the 'LICENSE_KEY' variable by the license key.
Quick start or what's next?
You can read more about running the analyzer on the following pages:
- Getting acquainted with the PVS-Studio static code analyzer on Windows
- How to run PVS-Studio on Linux and macOS (C, C++)
- PVS-Studio C# installation on Linux and macOS
- How to run PVS-Studio Java
- Get started with PVS-Studio in Visual Studio
- Using PVS-Studio with JetBrains Rider and CLion
- How to use PVS-Studio in Qt Creator
- PVS-Studio for embedded development
- Analysis of Unreal Engine projects
- Analyzing Visual Studio / MSBuild / .NET Core projects from the command line using PVS-Studio
- Analysis of C++ projects based on JSON Compilation Database
- Build-system independent analysis (C and C++)
- How to integrate PVS-Studio into CMake with a CMake module