Static Analysis and CircleCI Orbs
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。
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.
Name | Description | Required |
---|
DD_API_KEY | Your Datadog API key. This key is created by your Datadog organization and should be stored as a secret. | Yes |
DD_APP_KEY | Your Datadog application key. This key is created by your Datadog organization and should be stored as a secret. | Yes |
To customize your workflow, you can set the following parameters for Static Analysis.
Name | Description | Required | Default |
---|
service | The service you want your results tagged with. | Yes | |
env | The environment you want your results tagged with. Datadog recommends using ci as the value for this input. | No | none |
site | The Datadog site to send information to. | No | datadoghq.com |
cpu_count | Set the number of CPUs used to by the analyzer. | No | 2 |
enable_performance_statistics | Get the execution time statistics for analyzed files. | No | false |
Further Reading
Additional helpful documentation, links, and articles: