This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

CircleCI Build Status CircleCI Orb Version GitHub License CircleCI Community

Overview

Run a Datadog Static Analysis job in your CircleCI workflows.

Setup

To use Datadog Static Analysis, you need to add a static-analysis.datadog.yml file in your repository’s root directory to specify which rulesets to use.

rulesets:
  - <ruleset-name>
  - <ruleset-name>

Example for Python

You can see an example for Python-based repositories:

rulesets:
  - python-code-style
  - python-best-practices
  - python-inclusive

Workflow

Create a file in .circleci to run a Datadog Static Analysis job.

The following is a sample workflow file.

version: 2.1
orbs:
  datadog-static-analysis: datadog/datadog-static-analyzer-circleci-orb@1
jobs:
  run-static-analysis-job:
    docker:
      - image: cimg/node:current
    steps:
      - checkout
      - datadog-static-analysis/analyze:
          service: "my-service"
          env: "ci"
          site: 
          cpu_count: 2
          enable_performance_statistics: false
workflows:
  main:
    jobs:
      - run-static-analysis-job

Environment variables

Set the following environment variables in the CircleCI Project Settings page.

NameDescriptionRequired
DD_API_KEYYour Datadog API key. This key is created by your Datadog organization and should be stored as a secret.Yes
DD_APP_KEYYour Datadog application key. This key is created by your Datadog organization and should be stored as a secret.Yes

Inputs

To customize your workflow, you can set the following parameters for Static Analysis.

NameDescriptionRequiredDefault
serviceThe service you want your results tagged with.Yes
envThe environment you want your results tagged with. Datadog recommends using ci as the value for this input.Nonone
siteThe Datadog site to send information to.Nodatadoghq.com
cpu_countSet the number of CPUs used to by the analyzer.No2
enable_performance_statisticsGet the execution time statistics for analyzed files.Nofalse

Further Reading

Additional helpful documentation, links, and articles:

PREVIEWING: brett0000FF/node-compatibility