Many PVS-Studio's tools use an XML file to store the configuration.
Such a file can be used either implicitly (the global Settings.xml file located in a special folder) or passed explicitly to PVS-Studio tools via a special flag.
By default, PVS-Studio's tools use the global Settings.xml configuration file located:
The global configuration file is used by almost all PVS-Studio's tools, unless an alternative file is passed to them. The following tools do not use the global configuration file:
Note: PVS-Studio plugins for Visual Studio, Rider, and CLion, as well as the C and C++ Compiler Monitoring UI utility use only the global Settings.xml file.
You can specify the analysis settings for a project in a special XML file. After that, you can pass this file to the PVS-Studio CLI tools via a special flag.
Note: to avoid mistakes when writing the configuration file, we recommend copying the global Settings.xml file and modifying it.
Below are examples of how to run utilities with the special CustomSettings.xml configuration file (name the file as you like).
For the PVS-Studio_Cmd.exe utility:
PVS-Studio_Cmd.exe -t "path\to\Solution.sln" ... \
--settings "path\to\CustomSettings.xml"
For the CLMonitor.exe utility:
CLMonitor.exe [analyze|monitor|analyzeFromDump|trace] ... \
--settings "\path\to\CustomSettings.xml"
For the BlameNotifier.exe utility:
BlameNotifier.exe "path\to\PVS-Studio.plog" \
--VCS Git \
--recipientsList "path\to\recipients.txt" \
--server ... --sender ... \
--login ... --password ... \
--settings "path\to\CustomSettings.xml"
For the PlogConverter.exe utility (only Windows):
PlogConverter.exe -t json ... --settings "path\to\CustomSettings.xml" \
"path\to\PVS-Studio.plog"
The configuration file has the XML format with the following structure:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationSettings>
...
<Tag>Value</Tag>
...
</ApplicationSettings>
Instead of Tag write the option identifier (e.g. FileMasks). Instead of Value write the option's value. A description of available options and their values is given below.
Values of the options can be of the following types:
The following documentation section describes the key configuration file options and their application.
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
The tag describes a list of file masks that are applied to exclude files from analysis. Masks of this type are used to filter messages by names of the files only and not by these files' directories. You can specify both the full file name and the mask with the help of wildcard characters: the "*" character (any number of characters) and the "?" character (any single character).
The FileMasks tag accepts a list of the <string> tags, each containing a file mask.
For example, the following fragment shows how to exclude all SourceTest.cpp and C*Test.cpp files from the analysis:
<FileMasks>
<string>SourceTest.cpp</string>
<string>C*Test.cpp</string>
</FileMasks>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
The tag describes a list of Path masks used to exclude directories from analysis. Masks of this type allow you to exclude files from analysis based on their location.
The PathMasks tag accepts a list of the <string> tags, each containing a path mask.
For example, the following fragment shows how to exclude all cpp and hpp files located in the ThirdParty and Tests directories:
<PathMasks>
<string>*/ThirdParty/*.?pp</string>
<string>*/Tests/*.?pp</string>
</PathMasks>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio.
This option disables the synchronization of supress files between projects of the same solution. This can be useful if you want a message that is suppressed in one project to not be suppressed in others.
The DisableSynchronizeSuppressFiles tag can take one of two values: true, false. If the value is set to true, automatic synchronisation of suppress files is disabled. By default, the value is set to false.
Example:
<DisableSynchronizeSuppressFiles>true</DisableSynchronizeSuppressFiles>
It is used in: PlogConverter.exe (Windows), BlameNotifier, IDE plugins for Visual Studio and Rider.
The tag specifies a list of diagnostic rules that should be hidden in the report when you view it in IDE via the PVS-Studio plugin.
The DisableDetectableErrors tag takes a list of diagnostic rules separated by spaces. Note that a space must also be specified after the last code piece.
This option is also used by the PlogConverter.exe (Windows) and BlameNotifier utilities to exclude warnings from the resulting report.
For example, when converting a report using PlogConverter.exe, you can use the following line to exclude diagnostic rules you are not interested in:
<DisableDetectableErrors>V126 V203 V2001 V2006 </DisableDetectableErrors>
This way you can pass the *.xml file to PlogConverter.exe through the ‑‑setting flag and get a report without V126, V203, V2001, V2006 warnings.
It is used in: PVS-Studio_Cmd, CLMonitor, BlameNotifier, IDE plugins for Visual Studio, Rider, and CLion.
The tag specifies the name required to check the validity of the license.
Note: you can ignore this tag in the special settings file, if you have already performed activation. PVS-Studio will then search for the license in the global Settings.xml file.
Example:
<UserName>Name</UserName>
It is used in: PVS-Studio_Cmd, CLMonitor, BlameNotifier, IDE plugins for Visual Studio, Rider, and CLion.
The tag specifies the license key to verify the validity of the license.
Note: you can ignore this tag in the special settings file, if you have already performed activation. PVS-Studio will then search for the license in the global Settings.xml file.
Example:
<SerialNumber>XXXX-XXXX-XXXX-XXXX</SerialNumber>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
This tag enables/disables automatic deletion of intermediate analyzer files, such as the core configuration files of the analyzer and the preprocessed files.
The RemoveIntermediateFiles tag takes the true or false value. If the value is true, all temporary files will be deleted.
By default, the value is true. It may be useful to save intermediate files to further investigate problems with the analyzer.
Example:
<RemoveIntermediateFiles>false</RemoveIntermediateFiles>
It is used in: PVS-Studio_Cmd, IDE plugins for Visual Studio.
The tag allows you to enable the option that displays the sources of the warning suppression. The option helps to see which mechanisms disable the diagnostic rules.
The ReportDisabledRules tag takes the true or false value. If the value is true, the report will contain messages with the V012 code. It will also contain the information about the sources that disabled the diagnostic rules.
By default, the value is set to false.
Example:
<ReportDisabledRules>true</ReportDisabledRules>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, and CLion.
The tag disables a group of 64-bit diagnostic rules. Diagnostic rules from the disabled group will not be applied.
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<Disable64BitAnalysis>true</Disable64BitAnalysis>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, and CLion.
The tag disables the general-purpose diagnostic group for C and C++ (General Analysis).
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<DisableGAAnalysis>true</DisableGAAnalysis>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
The tag disables the micro-optimization diagnostic group for C and C++.
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<DisableOPAnalysis>true</DisableOPAnalysis>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
The tag disables a group of specific diagnostic rules added at the request of our users (Customer Specific) for C and C++.
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<DisableCSAnalysis>true</DisableCSAnalysis>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, and CLion.
The tag disables a group of diagnostic rules that check the C and C++ code for compliance with MISRA standards.
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<DisableMISRAAnalysis>true</DisableMISRAAnalysis>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, and CLion.
The tag disables a group of diagnostic rules that check the C++ code for compliance with AUTOSAR standards.
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<DisableAUTOSARAnalysis>true</DisableAUTOSARAnalysis>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, and CLion.
The tag disables a group of diagnostic rules that check the C and C++ code for compliance with OWASP ASVS.
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<DisableOWASPAnalysis>true</DisableOWASPAnalysis>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, and Rider.
The tag disables a group of diagnostic rules that check the C# code for compliance with the OWASP ASVS.
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<DisableOWASPAnalysisCs>true</DisableOWASPAnalysisCs>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, and Rider.
The tag disables the general-purpose diagnostic group for C# (General Analysis).
If the value is set to true, all diagnostic rules of this group are disabled.
Example:
<DisableGAAnalysisCs>true</DisableGAAnalysisCs>
It is used in: PVS-Studio_Cmd and IDE plugins for Visual Studio.
If you enable this setting, you can perform actions recorded in the Custom Build Step section of the Visual Studio project file (vcproj/vcxproj) before starting the analysis. Note that the analyzer needs compiled code to work correctly. For example, if Custom Build Step is used to generate the *.h files before compilation, Custom Build Step needs to be executed (by enabling this setting) before analyzing the project as well.
The PerformPreBuildStep tag takes the true/false value.
If the value is true, the setting is enabled.
Example:
<PerformPreBuildStep>true</PerformPreBuildStep>
It is used in: PVS-Studio_Cmd, CLMonitor, BlameNotifier, and IDE plugins for Visual Studio.
The tag enables automatic import of settings (xml files) from the '%APPDATA%\PVS-Studio\SettingsImports' directory. When importing, the settings-flags (true\false), as well as settings that store a single value (for example, a string) are replaced with settings from 'SettingsImports'. Settings that have multiple values (for example, excluded directories) are combined.
If there are several xml files in the 'SettingsImports' folder, these files will be applied to the current settings sequentially in order, according to their names.
The AutoSettingsImport tag takes the true/false value.
If the value is true, automatic import is enabled.
Example:
<AutoSettingsImport>true</AutoSettingsImport>
It is used in: PVS-Studio_Cmd and IDE plugins for Visual Studio.
The tag disables the generation of warnings of the Low level of certainty.
If the value is set to true, messages of the 3rd certainty level will not be included in the report.
Example:
<NoNoise>false</NoNoise>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
The tag sets the number of parallel running analyzer's core processes that will be involved in the analysis. By default, the value is set to the number of processor cores.
Note that it is not recommended to set this setting to a value greater than the number of processor cores. Also note that there is a limit of 16 cores for non-Enterprise licenses.
Example:
<ThreadCount>8</ThreadCount>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
This option allows you to specify the root part of the path to the source files in the analyzer report. When generating the report, the root part will be replaced with a special marker |?|. By default, this option is empty and the analyzer always generates a report with absolute paths to files. The setting allows to get an analyzer report with relative paths. The report can then be used on machines with different locations of the source files being checked.
Example:
<SourceTreeRoot>D:\ProjectRoot\</SourceTreeRoot>
Learn more about this in the documentation section: "Using relative paths in PVS-Studio report files".
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
The tag allows you to enable the use of the solution directory as the SourceTreeRoot value.
If the value is true, the part of the path containing the path to the solution directory will be replaced with a special marker. The SourceTreeRoot parameter will be ignored.
Example:
<UseSolutionDirAsSourceTreeRoot>false</UseSolutionDirAsSourceTreeRoot>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
The tag specifies the time after which the analysis of the file will be interrupted. The parameter can take the following values:
Please note that removing the time limit may cause the analysis to hang.
Example:
<AnalysisTimeout>After_10_minutes</AnalysisTimeout>
It is used in: PVS-Studio_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion.
The tag sets a time limit for incremental analysis. Possible values:
Please note that removing the time limit may cause the analysis to hang.
Example:
<IncrementalAnalysisTimeout>After_2_minutes</IncrementalAnalysisTimeout>
It is used in: PVS-Studio_Cmd, IDE plugin for Visual Studio.
The tag enables addition of Security Related Issues labels to the SAST field of a warning. Possible values:
Example:
<AnalysisTimeout>true</AnalysisTimeout>