--- id: wiki-2026-0508-자동화된-코드-리뷰 title: 자동화된 코드 리뷰 category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Automated Code Review, AI Code Review, LLM Code Review] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [code-review, automation, llm, devops, ci-cd] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: typescript framework: github-actions --- # 자동화된 코드 리뷰 ## 매 한 줄 > **"매 PR 의 first reviewer 의 의 robot"**. 매 lint / type / security / style / LLM-based 의 layer 의 PR 의 자동 의 review. 매 2026 — 매 Claude Opus 4.7, GPT-5, CodeRabbit, Greptile 의 PR 의 sub-second 의 inline comment. ## 매 핵심 ### 매 5 layers 1. **Formatting** — Prettier, Black, gofmt. 매 zero-arg. 2. **Linting** — ESLint, Ruff, golangci-lint. 매 rule-based. 3. **Type checking** — TypeScript, mypy, Pyright. 4. **Security** — SAST (Semgrep, CodeQL), secret scanning (Gitleaks). 5. **LLM review** — Claude / GPT-5 의 의 architectural / logic / 의도 의 comment. ### 매 2026 의 LLM review 의 capability - 매 inline 의 line-level comment. - 매 cross-file 의 understanding (1M context). - 매 codebase 의 convention 의 learning (RAG). - 매 false positive < 10% — 매 production-ready. ### 매 CI integration - 매 PR open / push 시 trigger. - 매 GitHub Actions / GitLab CI / Buildkite. - 매 results 의 PR 의 inline 의 post. ### 매 한계 - 매 LLM 의 hallucination — 매 "이 함수 의 의 안전 X" 의 의 false alarm. - 매 large diff (>1000 lines) 의 의 quality 의 drop. - 매 domain knowledge 의 부족 — 매 business rule 의 catch X. - 매 human review 의 replacement 의 의 X — 매 augmentation. ## 💻 패턴 ### 매 Pre-commit (local) ```yaml # .pre-commit-config.yaml repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.7.0 hooks: [{id: ruff}, {id: ruff-format}] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.13.0 hooks: [{id: mypy}] - repo: https://github.com/gitleaks/gitleaks rev: v8.20.0 hooks: [{id: gitleaks}] ``` ### 매 GitHub Actions — full pipeline ```yaml name: Code Review on: [pull_request] jobs: static: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm ci && npm run lint && npm run typecheck - uses: returntocorp/semgrep-action@v1 - uses: github/codeql-action/analyze@v3 llm-review: runs-on: ubuntu-latest steps: - uses: anthropics/claude-code-action@v1 with: model: claude-opus-4-7 api-key: ${{ secrets.ANTHROPIC_API_KEY }} ``` ### 매 Claude API 의 PR review (custom) ```typescript import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic(); async function review(diff: string, context: string) { const res = await client.messages.create({ model: "claude-opus-4-7", max_tokens: 4096, system: [ { type: "text", text: REVIEW_GUIDE, cache_control: { type: "ephemeral" } }, { type: "text", text: context, cache_control: { type: "ephemeral" } }, ], messages: [{ role: "user", content: `Review this PR diff:\n\n${diff}`, }], }); return res.content; } ``` ### 매 Inline comment 의 posting ```typescript import { Octokit } from "@octokit/rest"; await octokit.pulls.createReviewComment({ owner, repo, pull_number, body: comment.body, commit_id, path: comment.file, line: comment.line, side: "RIGHT", }); ``` ### 매 Semgrep 의 custom rule ```yaml rules: - id: no-eval pattern: eval(...) message: 매 eval 의 의 unsafe languages: [python, javascript] severity: ERROR ``` ### 매 Gitleaks (secret detection) ```bash gitleaks detect --source . --report-format json --report-path leaks.json # 매 CI 의 의 fail 의 의 if leaks.json non-empty ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | 매 small team, 매 simple lang | 매 lint + type + format only | | 매 enterprise / regulated | 매 + SAST + DAST + LLM | | 매 OSS project | 매 CodeRabbit / Greptile (free tier) | | 매 high-velocity | 매 Claude inline review (sub-second) | | 매 critical infra | 매 LLM review + 매 mandatory human | **기본값**: 매 lint + type + format + Semgrep + Claude review 의 standard stack. ## 🔗 Graph - 응용: [[GitHub Actions]] · [[153_pre-commit과_품질_게이트|Pre-commit Hooks]] · [[CodeRabbit]] - Adjacent: [[SAST]] ## 🤖 LLM 활용 **언제**: 매 PR 의 first-pass review. 매 stylistic / obvious bug catch. 매 onboarding의 reviewer 의 augmentation. **언제 X**: 매 architectural 의 fundamental 의 decision — 매 senior human reviewer 의 필요. ## ❌ 안티패턴 - **LLM-only review**: 매 human 의 skip — 매 hallucination 의 trust. - **Comment spam**: 매 매 nit 의 의 inline — 매 review fatigue. - **No baseline**: 매 SAST 의 thousands of legacy issues — 매 noise. - **Bypass 의 routine**: 매 `--no-verify` 의 의 habitual. ## 🧪 검증 / 중복 - Verified — GitHub Actions docs (2026); Anthropic Claude Code Action; Semgrep / Gitleaks docs. - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — 5-layer review pipeline + Claude integration |