Running PVS-Studio in TeamCity

Automating the analyzer run

In order to automate the analysis process in CI (Continuous Integration), you need to run the analyzer as a console application.

You need to create a Build Step in TeamCity with the following parameters:

Runner type: Command Line;

  • Step Name: <name>;
  • Run: Custom script;
  • Custom script: <script>.

In the script, write the analysis command (and the command for converting the report in the needed format).

Examples of commands to run the analyzer, handle the analysis results and integrate the analyzer into build systems are given on the following pages of documentation:

Viewing analysis results

The first way

In TeamCity you can attach analyzer reports in the HTML format to builds, having specified them in the artifacts.

Here are some ways to generate an HTML report with navigation along the code:

Windows: C, C++, C#

PlogConverter.exe ... --renderTypes FullHtml ...

Linux/macOS: C, C++

plog-converter ... --renderTypes fullhtml ...

Windows/Linux/macOS: Java

In the plugins settings for Maven and Gradle in the 'outputType' field set the 'fullhtml' value.

In the menu Edit Configuration Settings > General Settings > Artifact paths specify the directory with the resulting HTML-report.

After the build is completed successfully, the analyzer report in html format will be available in artifacts. To open it, click on the file index.html on the 'Artifacts' tab. You can also make the analyzer report appear on a special tab of the build session report. To do this, go to the project settings, open 'Report Tabs' and create new build report tab.

In the window for adding a tab, specify the path to the index.html file in the 'Start page' field relative to the root directory of artifacts. For example, if the content of the 'Artifacts' tab looks something like this:


Then write the path 'fullhtml/index.html' in the 'Start Page' field. After you add a tab, you can view the analysis results on it:


When clicking analyzer warnings, additional browser tabs will be opening:


In other CIs, configuration of analyzer runs and working with reports are performed in the same way.

The second way

The converter supports standard reports for TeamCity - TeamCity Inspections Type. After generation a report it has to be output in stdout at any step of the build.

Such report can be generated and output in stdout in the following ways:

Windows: C, C++, C#

PlogConverter.exe ... –-renderTypes=TeamCity -o TCLogsDir ...
Type TCLogsDir\MyProject.plog_TeamCity.txt

Linux/macOS: C, C++

plog-converter ... -t teamcity -o report_tc.txt ...
cat report_tc.txt

Windows/Linux/macOS: Java

Support will be available soon.

After successful build execution the analyser report will appear in a new tab with the information on this build:


In order to navigate along the code you can click the line number on the left of the diagnostic rule. The transition will occur if there is an absolute path to the source file, the open project in an IDE (Eclipse, Visual Studio, IntelliJ IDEA), and the installed TeamCity plugin.

Additional links

Bugs Found

Checked Projects
Collected Errors
14 429
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →