﻿# Analysis configuration file \(Settings\.xml\)

## Global configuration file

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:

* **on Windows**: '%APPDATA%\\PVS\-Studio\\Settings\.xml'
* **on Linux**, **macOS**: '\~/\.config/PVS\-Studio/Settings\.xml'

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:

* pvs\-studio\-analyzer\\CompileCommandsAnalyzer\.exe on Linux, macOS and Windows;
* plog\-converter for Linux and macOS\.

**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\.

## Custom configuration 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](https://pvs-studio.com/en/docs/manual/0035/) utility:

```cpp
PVS-Studio_Cmd.exe -t "path\to\Solution.sln" ... \
                    --settings "path\to\CustomSettings.xml"
```

For the [CLMonitor\.exe](https://pvs-studio.com/en/docs/manual/0031/) utility:

```cpp
CLMonitor.exe [analyze|monitor|analyzeFromDump|trace] ... \
              --settings "\path\to\CustomSettings.xml"
```

For the [BlameNotifier\.exe](https://pvs-studio.com/en/docs/manual/0050/) utility:

```cpp
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](https://pvs-studio.com/en/docs/manual/0038/) utility \(only Windows\):

```cpp
PlogConverter.exe -t json ... --settings "path\to\CustomSettings.xml" \
                  "path\to\PVS-Studio.plog"
```

## About the file format and individual settings

### File format

The configuration file has the XML format with the following structure:

```cpp
<?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: 

* ListString — tags of this type take a list of strings as a value\. Each value of the list is defined by the _string_ tag;
* string — tags of this type take a string as a value;
* bool — tags of this type take true or false value;
* Int — tags of this type take an integer as a value;
* Enum — tags of this type take as values constants\. The constants are defined by the type of the corresponding setting\.

### Description of tags of individual settings

The following documentation section describes the key configuration file options and their application\.

#### FileMasks \(ListString\)

**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:

```cpp
<FileMasks>
  <string>SourceTest.cpp</string>
  <string>C*Test.cpp</string>
</FileMasks>
```

#### PathMasks \(ListString\)

**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:

```cpp
<PathMasks>
  <string>*/ThirdParty/*.?pp</string>
  <string>*/Tests/*.?pp</string>
</PathMasks>
```

#### DisableSynchronizeSuppressFiles \(bool\)

**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:

```cpp
<DisableSynchronizeSuppressFiles>true</DisableSynchronizeSuppressFiles>
```

#### DisableDetectableErrors \(string\)

**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:

```cpp
<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\.

#### UserName \(string\)

**It is used in**: _PVS\-Studio\_Cmd, CLMonitor, BlameNotifier, IDE plugins for Visual Studio, Rider, and CLion\._

The tag specifies the analyzer username associated with the license key 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:

```cpp
<UserName>Name</UserName>
```

#### SerialNumber \(string\)

**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:

```cpp
<SerialNumber>XXXX-XXXX-XXXX-XXXX</SerialNumber>
```

#### RemoveIntermediateFiles \(bool\)

**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:

```cpp
<RemoveIntermediateFiles>false</RemoveIntermediateFiles>
```

#### ReportDisabledRules \(bool\)

**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:

```cpp
<ReportDisabledRules>true</ReportDisabledRules>
```

#### Disable64BitAnalysis \(bool\)

**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:

```cpp
<Disable64BitAnalysis>true</Disable64BitAnalysis>
```

#### DisableGAAnalysis \(bool\)

**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:

```cpp
<DisableGAAnalysis>true</DisableGAAnalysis>
```

#### DisableOPAnalysis \(bool\)

**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:

```cpp
<DisableOPAnalysis>true</DisableOPAnalysis>
```

#### DisableCSAnalysis \(bool\)

**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:

```cpp
<DisableCSAnalysis>true</DisableCSAnalysis>
```

#### DisableMISRAAnalysis \(bool\)

**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:

```cpp
<DisableMISRAAnalysis>true</DisableMISRAAnalysis>
```

#### DisableAUTOSARAnalysis \(bool\)

**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:

```cpp
<DisableAUTOSARAnalysis>true</DisableAUTOSARAnalysis>
```

#### DisableOWASPAnalysis \(bool\)

**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:

```cpp
<DisableOWASPAnalysis>true</DisableOWASPAnalysis>
```

#### DisableOWASPAnalysisCs \(bool\)

**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:

```cpp
<DisableOWASPAnalysisCs>true</DisableOWASPAnalysisCs>
```

#### DisableGAAnalysisCs \(bool\)

**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:

```cpp
<DisableGAAnalysisCs>true</DisableGAAnalysisCs>
```

#### PerformPreBuildStep \(bool\)

**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:

```cpp
<PerformPreBuildStep>true</PerformPreBuildStep>
```

#### AutoSettingsImport \(bool\)

**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:

```cpp
<AutoSettingsImport>true</AutoSettingsImport>
```

#### NoNoise \(bool\)

**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:

```cpp
<NoNoise>false</NoNoise>
```

#### ThreadCount \(int\)

**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:

```cpp
<ThreadCount>8</ThreadCount>
```

#### SourceTreeRoot \(string\)

**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:

```cpp
<SourceTreeRoot>D:\ProjectRoot\</SourceTreeRoot>
```

Learn more about this in the documentation section: "[Using relative paths in PVS\-Studio report files](https://pvs-studio.com/en/docs/manual/0027/)"\.

#### UseSolutionDirAsSourceTreeRoot \(bool\)

**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:

```cpp
<UseSolutionDirAsSourceTreeRoot>false</UseSolutionDirAsSourceTreeRoot>
```

#### AnalysisTimeout \(Enum\)

**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: 

* _After\_10\_minutes_ — limits the file's analysis time to 10 minutes;
* _After\_30\_minutes_ — limits the file's analysis time to 30 minutes;
* _After\_60\_minutes_ — limits the file's analysis time to an hour;
* _No\_timeout_ — removes the time limits of file's analysis\. 

**Please note** that removing the time limit may cause the analysis to hang\.

Example:

```cpp
<AnalysisTimeout>After_10_minutes</AnalysisTimeout>
```

#### IncrementalAnalysisTimeout \(Enum\)

**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: 

* _After\_1\_minute_ — limits the incremental analysis to 1 minute;
* _After\_2\_minutes_ — limits the incremental analysis to 2 minutes;
* _After\_5\_minutes_ — limits the incremental analysis to 5 minutes;
* _After\_10\_minutes_ — limits the incremental analysis to 10 minutes;
* _No\_timeout_ — removes the time limit\. 

**Please note** that removing the time limit may cause the analysis to hang\.

Example:

```cpp
<IncrementalAnalysisTimeout>After_2_minutes</IncrementalAnalysisTimeout>
```

#### SecurityRelatedIssues \(bool\)

**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: 

* true;
* false\.

Example:

```cpp
<SecurityRelatedIssues>true</SecurityRelatedIssues>
```

#### UseOldCppParser\(bool\)

**It is used**_ _**in**:_ PVS\-Studio\_Cmd, CLMonitor, IDE plugins for Visual Studio, Rider, and CLion\._

This tag disables the new parser for the C\+\+ analyzer and falls back to the old parser\. Set this to true if you are experiencing any issues with the C\+\+ analyzer\. Possible values: 

* true;
* false\.

Example:

```cpp
<UseOldCppParser>true</UseOldCppParser>
```