Reviewdog 标志

Reviewdog

组织
AgentSecOps
reviewdog

使用 reviewdog 将自动化代码审查和安全 lint 集成到 CI/CD 流水线中。汇总多种安全与质量工具(SAST、lint 工具、格式化工具)的检查结果,并将其统一为针对拉取请求的代码审查评论。适用于:(1)将安全扫描集成到代码审查流程中;(2)自动为拉取请求提供安全反馈;(3)将多个工具的输出整合为可执行的审查评论;(4)在 CI/CD 流水线中落实安全编码标准;(5)在开发过程中提供行内安全标注。

Add to TypingMind

概览

发布者AgentSecOps
代码仓库SecOpsAgentKit
技能名称reviewdog
星标数
225
复刻数
44
附带文件
6
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 6 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 AgentSecOps 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Reviewdog AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/AgentSecOps/SecOpsAgentKit/tree/main/skills/secsdlc/reviewdog
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AgentSecOps/SecOpsAgentKit.git /tmp/SecOpsAgentKit
mkdir -p .claude/skills
cp -r /tmp/SecOpsAgentKit/skills/secsdlc/reviewdog .claude/skills/reviewdog
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Reviewdog,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Reviewdog。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Reviewdog 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Reviewdog - Automated Security Code Review

Overview

Reviewdog is an automated code review tool that integrates security scanning and linting results into pull request review comments. It acts as a universal adapter between various security tools (SAST scanners, linters, formatters) and code hosting platforms (GitHub, GitLab, Bitbucket), enabling seamless security feedback during code review.

Key Capabilities:

  • Aggregates findings from multiple security and quality tools
  • Posts inline review comments on specific code lines
  • Supports 40+ linters and security scanners out-of-the-box
  • Integrates with GitHub Actions, GitLab CI, CircleCI, and other CI platforms
  • Filters findings to show only new issues in diff (fail-on-diff mode)
  • Supports custom rulesets and security policies

Quick Start

Basic reviewdog usage with a security scanner:

bash
# Install reviewdog
go install github.com/reviewdog/reviewdog/cmd/reviewdog@latest

# Run a security scanner and pipe to reviewdog
bandit -r . -f json | reviewdog -f=bandit -reporter=github-pr-review

# Or use with Semgrep
semgrep --config=auto --json | reviewdog -f=semgrep -reporter=local

GitHub Actions integration:

yaml
- name: Run reviewdog
  uses: reviewdog/action-setup@v1
- name: Security scan with reviewdog
  env:
    REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  run: |
    bandit -r . -f json | reviewdog -f=bandit -reporter=github-pr-review

Core Workflow

Step 1: Install reviewdog

Install reviewdog in your CI environment or locally:

bash
# Via Go
go install github.com/reviewdog/reviewdog/cmd/reviewdog@latest

# Via Homebrew (macOS/Linux)
brew install reviewdog

# Via Docker
docker pull reviewdog/reviewdog:latest

Step 2: Configure Security Tools

Set up the security scanners you want to integrate. Reviewdog supports multiple input formats:

Supported Security Tools:

  • SAST: Semgrep, Bandit, ESLint Security, Brakeman
  • Secret Detection: Gitleaks, TruffleHog, detect-secrets
  • IaC Security: Checkov, tfsec, terrascan
  • Container Security: Hadolint, Trivy, Dockle
  • General Linters: ShellCheck, yamllint, markdownlint

Step 3: Integrate into CI/CD Pipeline

Add reviewdog to your CI pipeline to automatically post security findings as review comments:

GitHub Actions Example:

yaml
name: Security Review
on: [pull_request]

jobs:
  security-scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup reviewdog
        uses: reviewdog/action-setup@v1

      - name: Run Bandit SAST
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          pip install bandit
          bandit -r . -f json | \
            reviewdog -f=bandit \
                     -name="Bandit SAST" \
                     -reporter=github-pr-review \
                     -filter-mode=added \
                     -fail-on-error

GitLab CI Example:

yaml
security_review:
  stage: test
  script:
    - pip install bandit reviewdog
    - bandit -r . -f json |
        reviewdog -f=bandit
                 -reporter=gitlab-mr-discussion
                 -filter-mode=diff_context
  only:
    - merge_requests

Step 4: Configure Review Behavior

Customize reviewdog's behavior using flags:

bash
# Filter to show only issues in changed lines
reviewdog -filter-mode=diff_context

# Filter to show only issues in added lines
reviewdog -filter-mode=added

# Fail the build if findings are present
reviewdog -fail-on-error

# Set severity threshold
reviewdog -level=warning

Step 5: Review Security Findings

Reviewdog posts findings as inline comments on the pull request:

  • Inline annotations: Security issues appear directly on affected code lines
  • Severity indicators: Critical, High, Medium, Low severity levels
  • Remediation guidance: Links to CWE/OWASP references when available
  • Diff-aware filtering: Only shows new issues introduced in the PR

Security Considerations

  • API Token Security: Store GitHub/GitLab tokens in secrets management (GitHub Secrets, GitLab CI/CD variables)

    • Never commit tokens to version control
    • Use minimum required permissions (read/write on pull requests)
    • Rotate tokens regularly
  • Access Control:

    • Configure reviewdog to run only on trusted branches
    • Use CODEOWNERS to require security team approval for reviewdog config changes
    • Restrict who can modify .reviewdog.yml configuration
  • Audit Logging:

    • Log all security findings to SIEM or security monitoring platform
    • Track when findings are introduced and resolved
    • Monitor for bypassed security checks
  • Compliance:

    • Maintains audit trail of security reviews (SOC2, ISO27001)
    • Enforces security policy compliance in code review
    • Supports compliance reporting through CI/CD artifacts
  • Safe Defaults:

    • Use fail-on-error to block PRs with security findings
    • Enable filter-mode=added to catch new vulnerabilities
    • Configure severity thresholds appropriate to your risk tolerance

Bundled Resources

Scripts (scripts/)

  • setup_reviewdog.py - Automated reviewdog installation and CI configuration generator
  • run_security_suite.sh - Runs multiple security scanners through reviewdog

References (references/)

  • supported_tools.md - Complete list of supported security tools with configuration examples
  • reporter_formats.md - Available output formats and reporter configurations
  • cwe_mapping.md - Mapping of common tool findings to CWE categories

Assets (assets/)

  • github_actions_template.yml - GitHub Actions workflow for multi-tool security scanning
  • gitlab_ci_template.yml - GitLab CI configuration for reviewdog integration
  • .reviewdog.yml - Sample reviewdog configuration file
  • pre_commit_config.yaml - Pre-commit hook integration

Common Patterns

Pattern 1: Multi-Tool Security Suite

Run multiple security tools and aggregate results in a single review:

bash
#!/bin/bash
# Run comprehensive security scan

# Python security
bandit -r . -f json | reviewdog -f=bandit -name="Python SAST" -reporter=github-pr-review &

# Secrets detection
gitleaks detect --report-format json | reviewdog -f=gitleaks -name="Secret Scan" -reporter=github-pr-review &

# IaC security
checkov -d . -o json | reviewdog -f=checkov -name="IaC Security" -reporter=github-pr-review &

wait

Pattern 2: Severity-Based Gating

Block PRs based on severity thresholds:

yaml
- name: Critical findings - Block PR
  run: |
    semgrep --config=p/security-audit --severity=ERROR --json | \
      reviewdog -f=semgrep -level=error -fail-on-error -reporter=github-pr-review

- name: Medium findings - Comment only
  run: |
    semgrep --config=p/security-audit --severity=WARNING --json | \
      reviewdog -f=semgrep -level=warning -reporter=github-pr-review

Pattern 3: Differential Security Scanning

Only flag new security issues introduced in the current PR:

bash
# Only show findings in newly added code
reviewdog -filter-mode=added -fail-on-error

# Show findings in modified context (added + surrounding lines)
reviewdog -filter-mode=diff_context

Pattern 4: Custom Security Rules

Integrate custom security policies using grep or custom parsers:

bash
# Check for prohibited patterns
grep -nH -R "eval(" . --include="*.py" | \
  reviewdog -f=grep -name="Dangerous Functions" -reporter=github-pr-review

# Custom JSON parser
./custom_security_scanner.py --json | \
  reviewdog -f=rdjson -name="Custom Policy" -reporter=github-pr-review

Integration Points

  • CI/CD Platforms:

    • GitHub Actions (native action available)
    • GitLab CI/CD
    • CircleCI
    • Jenkins
    • Azure Pipelines
    • Bitbucket Pipelines
  • Security Tools:

    • SAST: Semgrep, Bandit, ESLint, Brakeman, CodeQL
    • Secrets: Gitleaks, TruffleHog, detect-secrets
    • IaC: Checkov, tfsec, terrascan, kics
    • Containers: Hadolint, Trivy, Dockle
  • Code Hosting:

    • GitHub (PR comments, check runs, annotations)
    • GitLab (MR discussions)
    • Bitbucket (inline comments)
    • Gerrit (review comments)
  • SDLC Integration:

    • Pre-commit hooks: Fast local feedback before push
    • PR/MR review: Automated security review on code changes
    • Trunk protection: Block merges with security findings
    • Security dashboard: Aggregate findings for visibility

Troubleshooting

Issue: Reviewdog not posting comments

Solution:

  • Verify GitHub token has correct permissions (repo scope for private repos, public_repo for public)
  • Check CI environment has REVIEWDOG_GITHUB_API_TOKEN or GITHUB_TOKEN set
  • Ensure repository settings allow PR comments from workflows
  • Verify reviewdog is running in PR context (not on push to main)

Issue: Too many false positives

Solution:

  • Use filter-mode=added to only show new issues
  • Configure tool-specific suppressions in .reviewdog.yml
  • Adjust severity thresholds with -level flag
  • Use baseline files to ignore existing issues

Issue: Performance issues with large repositories

Solution:

  • Run reviewdog only on changed files using filter-mode=diff_context
  • Cache tool dependencies and databases in CI
  • Run expensive scanners on scheduled jobs, lightweight ones on PR
  • Use parallel execution for multiple tools

Issue: Integration with custom security tools

Solution:

  • Convert tool output to supported format (checkstyle, sarif, rdjson, rdjsonl)
  • Use -f=rdjson for custom JSON output following reviewdog diagnostic format
  • Create errorformat pattern for text-based outputs
  • See references/reporter_formats.md for format specifications

Advanced Configuration

Custom reviewdog configuration (.reviewdog.yml)

yaml
runner:
  bandit:
    cmd: bandit -r . -f json
    format: bandit
    name: Python Security
    level: warning

  semgrep:
    cmd: semgrep --config=auto --json
    format: semgrep
    name: Multi-language SAST
    level: error

  gitleaks:
    cmd: gitleaks detect --report-format json
    format: gitleaks
    name: Secret Detection
    level: error

Integration with Security Frameworks

Map findings to OWASP Top 10 and CWE:

bash
# Semgrep with OWASP ruleset
semgrep --config "p/owasp-top-ten" --json | \
  reviewdog -f=semgrep -name="OWASP Top 10" -reporter=github-pr-review

# Include CWE references in comments
reviewdog -f=semgrep -name="CWE Analysis" -reporter=github-pr-review

References

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Reviewdog AI 技能有什么作用?

使用 reviewdog 将自动化代码审查和安全 lint 集成到 CI/CD 流水线中。汇总多种安全与质量工具(SAST、lint 工具、格式化工具)的检查结果,并将其统一为针对拉取请求的代码审查评论。适用于:(1)将安全扫描集成到代码审查流程中;(2)自动为拉取请求提供安全反馈;(3)将多个工具的输出整合为可执行的审查评论;(4)在 CI/CD 流水线中落实安全编码标准;(5)在开发过程中提供行内安全标注。

为什么在 TypingMind 中使用 Reviewdog?

因为您只需安装一次,就能搭配任何模型使用。Reviewdog 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Reviewdog?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/AgentSecOps/SecOpsAgentKit/tree/main/skills/secsdlc/reviewdog。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Reviewdog?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Reviewdog 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Reviewdog 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Reviewdog AI 技能免费吗?

AgentSecOps 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇