Main Content

Perform Polyspace as You Code Analysis in Visual Studio Code

Polyspace as You Code helps you find defects and coding standard violations while developing in the Visual Studio Code IDE. You can run an analysis and fix as you code, saving you from finding bugs late in the development cycle. When connected to the Polyspace® Access™ central repository, Polyspace as You Code highlights new issues compared to the development baseline.

The tasks in this guide give an overview of basic actions:

  1. Configure Polyspace as You Code in the Visual Studio Code IDE.

  2. Run an analysis and justify or fix findings.

  3. Download and sync a baseline from Polyspace Access to compare with new findings.

The guide assumes you have a working knowledge of Visual Studio Code.

Before beginning the tutorial, confirm Polyspace as You Code is installed on your machine. See Install Polyspace as You Code Extension in Visual Studio Code.

Use your own code or copy and paste this code into Visual Studio Code to follow along with the guide.

example.hpp

#include <string>

class Demo {
    void myFunction(std::string buffer) const{

    }
};

example_source.cpp

#include "example.hpp"


int simple_defect(){
    uint32_t x = -1;
    x++;
    return 1 / x; 
}

To start the guide, see Configure Polyspace as You Code in Visual Studio Code.