Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
Running PVS-Studio in TeamCity
menu mobile close menu
Analyzer diagnostics
General Analysis (C++)
General Analysis (C#)
General Analysis (Java)
Micro-Optimizations (C++)
Diagnosis of 64-bit errors (Viva64, C++)
Customer specific requests (C++)
MISRA errors
AUTOSAR errors
OWASP errors (C++)
OWASP errors (C#)
Problems related to code analyzer
Additional information
toggle menu Contents

Running PVS-Studio in TeamCity

Apr 06 2021

To automate analysis in TeamCity, use the analyzer as a console application.

In TeamCity, create a Build Step with the following parameters:

  • Runner type: Command Line;
  • Step Name: <name>;
  • Run: Custom script;
  • Custom script: <script>.

Add two commands to the script: an analysis command and an optional command that converts the report to the format you need.

The documentation below provides sample commands to process analysis results and to integrate analysis into build systems:

Viewing analysis results

HTML reports

In TeamCity, you can add HTML analyzer reports to a build's artifacts.

First, generate an HTML report that has the code navigation feature:

Windows: C, C++, C#

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

Linux/macOS: C, C++

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

Windows/Linux/macOS: Java

Access Maven or Gradle plugin settings. Indicate 'fullhtml' in the 'outputType' field.

Proceed to 'Edit Configuration Settings -> General Settings -> Artifact paths' and specify the HTML report's directory.

After the build succeeds, the analyzer's fullhtml report will be available in artifacts. To access it, open the 'Artifacts' tab and click the 'index.html' file. You can also display the report on a special build session report tab. To do this, proceed to the project settings, open 'Report Tabs' and click 'Create new build report tab'.

In the 'Start page' field, specify the 'index.html' path relative to the artifact folder. For example, if the 'Artifacts' tab looks as follows:

TeamCity/image1.png

enter 'fullhtml/index.html' into 'Start Page'. After you add the tab, it will display analysis results:

TeamCity/image2.png

When clicked, analyzer warnings open in a new browser tab:

TeamCity/image4.png

Standard TeamCity reports

The 'plog-converter' utility supports standard TeamCity reports - TeamCity Inspections Type. After generating a report, print it with stdout at any step of the build.

Below are ways to do it:

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 is coming soon.

After the build succeeds, TeamCity will display the analyzer report on a new build information tab:

TeamCity/image6.png

To navigate to the code that triggered a diagnostic, click the line number to the left of this diagnostic. TeamCity will take you to the code if the following conditions are met: you have specified the absolute source file path, your project is open in an IDE (Eclipse, Visual Studio, IntelliJ IDEA), and you have installed the TeamCity plugin.

close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam