deepsource

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DeepSource CLI

DeepSource CLI

Authentication

认证

bash
./scripts/check_auth.sh
If not authenticated:
bash
deepsource auth login
bash
./scripts/check_auth.sh
如果未完成认证:
bash
deepsource auth login

Goals

功能目标

Get code review issues

获取代码审查问题

bash
deepsource issues --output json
Filter examples:
bash
deepsource issues --severity critical,major --output json
deepsource issues --category security,bug-risk --output json
deepsource issues --path src/auth --output json
deepsource issues --severity critical --category security --limit 20 --output json
Scope to a PR or branch:
bash
deepsource issues --pr 42 --output json
deepsource issues --default-branch --output json
bash
deepsource issues --output json
过滤示例:
bash
deepsource issues --severity critical,major --output json
deepsource issues --category security,bug-risk --output json
deepsource issues --path src/auth --output json
deepsource issues --severity critical --category security --limit 20 --output json
限定到某个PR或分支:
bash
deepsource issues --pr 42 --output json
deepsource issues --default-branch --output json

Get report card

获取报告卡

bash
deepsource report-card --output json
Returns grades (A-F) and scores for security, reliability, complexity, hygiene, coverage, and an aggregate.
Scope to a PR or commit:
bash
deepsource report-card --pr 42 --output json
deepsource report-card --commit abc123 --output json
bash
deepsource report-card --output json
返回安全、可靠性、复杂度、代码卫生、覆盖率的评分等级(A-F)和得分,以及综合得分。
限定到某个PR或提交:
bash
deepsource report-card --pr 42 --output json
deepsource report-card --commit abc123 --output json

Get vulnerabilities

获取漏洞

bash
deepsource vulnerabilities --output json
Filter by severity:
bash
deepsource vulnerabilities --severity critical,high --output json
Scope to a PR or branch:
bash
deepsource vulnerabilities --pr 42 --output json
deepsource vulnerabilities --default-branch --output json
bash
deepsource vulnerabilities --output json
按严重程度过滤:
bash
deepsource vulnerabilities --severity critical,high --output json
限定到某个PR或分支:
bash
deepsource vulnerabilities --pr 42 --output json
deepsource vulnerabilities --default-branch --output json

Check analysis status

检查分析状态

bash
deepsource repo status --output json
deepsource runs --output json
deepsource runs --commit abc123 --output json
repo status
shows activation and configured analyzers.
runs
shows recent analysis run history.
bash
deepsource repo status --output json
deepsource runs --output json
deepsource runs --commit abc123 --output json
repo status
命令展示仓库激活状态和已配置的分析器,
runs
命令展示最近的分析运行历史。

Key patterns

核心使用规则

  • Auto-detection: Inside a git repo the CLI auto-detects the repo and current branch. Use
    --repo
    when outside the repo or targeting a different one. Use scope flags (
    --pr
    ,
    --commit
    ,
    --default-branch
    ) to override the auto-detected branch.
  • Always use
    --output json
    for machine-readable output.
  • Repo format:
    --repo provider/owner/name
    — providers:
    gh
    ,
    gl
    ,
    bb
    ,
    ads
    .
  • Scope flags are mutually exclusive:
    --commit
    ,
    --pr
    , and
    --default-branch
    cannot be combined. Omit all three to use auto-detection.
  • 自动检测: 在git仓库内部时,CLI会自动检测对应仓库和当前分支。当你处于仓库外部或需要指定其他仓库时,使用
    --repo
    参数。使用范围参数(
    --pr
    --commit
    --default-branch
    )可以覆盖自动检测到的分支。
  • 始终使用
    --output json
    参数来获取机器可读的输出格式。
  • 仓库格式:
    --repo provider/owner/name
    — 平台取值:
    gh
    gl
    bb
    ads
  • 范围参数互斥:
    --commit
    --pr
    --default-branch
    不可同时使用。三个参数都省略时将启用自动检测。

Documentation

文档

Run
deepsource <command> --help
for detailed flag reference.
运行
deepsource <command> --help
可查看详细的参数参考。