This tutorial describes how the Tasks from Violations example flow functions. This example listens for newly-discovered static analysis violations, groups the violations into sections based on a violation attribute, and creates a DTP Project Center task for each of the created sections. See the Project Center documentation for additional information about tasks. 

DTP REST API In Use

  • GET /v1.3/services - get services offered by DTP.
  • POST /v1.2/tasks

Requirements

  • DTP and Extension Designer must be configured correctly. See Server Settings.
  • The Violation Events flow must be deployed to the service. See About the Violations Event Flow.
  • Static Analysis data should sent as new violations after the example is deployed.

About the Violations Event Flow 

This example uses the Violations Event, which is a common utility flow shipped with Extension Designer. This flow is used to subscribe to events related to new or fixed static analysis violations sent into DTP.  Choose Import > Library > Common > Violation Events to deploy the flow to the service.

Setting Up the Examples

  1. Click on a an existing service or create a new service in Extension Designer (see Working with Services).
  2. Create a new flow (see Working with Flows) and choose Import> Library> Examples> Tasks from Violations from the Extension Designer menu to import the Tasks from Violations flow.
  3. Click Deploy.
  4. Send new static analysis violations data to DTP server (see the DTP Engine documentation).
  5. Make a call to the /v1.1/staticAnalysisViolations DTP REST API to see what values are available for grouping violations.
     
  6. Open the Set Grouping Property node and specify with which group you want to associate your violations. By default it is set to severity.
     

Explanation

Double-click the Group SA Violations By msg.groupingProperty function node and review the script. The flow listens to the custom new violation event and groups violations by the specified property.

The flow also adds important properties to the grouped violation lists to process.  

Double-click the Prepare Task Payload function node and review the script.This node prepares the payload that creates the task in Project Center.

Double-click the Tasks POST node. This DTP REST API node uses the /v1.2/tasks endpoint to create tasks in Project Center. 

 

  • No labels