importgitdeffind_hotspots(repo_path:str):repo=git.Repo(repo_path)# 매 file 의 commit countfile_changes=defaultdict(int)forcommitinrepo.iter_commits('main',max_count=1000):forfileincommit.stats.files:file_changes[file]+=1# 매 file 의 complexityfile_complexity={}forfileinfile_changes.keys():file_complexity[file]=compute_cyclomatic_complexity(file)# Hotspot = 매 high churn × high complexityhotspots=[{'file':f,'churn':c,'complexity':file_complexity.get(f,0),'hotspot_score':c*file_complexity.get(f,0)}forf,cinfile_changes.items()]returnsorted(hotspots,key=lambdax:-x['hotspot_score'])[:20]
CI integration (multi-tool)
# .github/workflows/code-quality.ymlon:[pull_request]jobs:quality:runs-on:ubuntu-lateststeps:- uses:actions/checkout@v4with:{fetch-depth:0}# Static- run:npm run lint- run:npm run typecheck# Security- uses:snyk/actions/setup@master- run:snyk code test# AI review (CodeRabbit auto-runs)# Test coverage- run:npm test -- --coverage- uses:codecov/codecov-action@v3# SonarQube- uses:SonarSource/sonarcloud-github-action@masterenv:SONAR_TOKEN:${{ secrets.SONAR_TOKEN }}
# .team/rules/api-pattern.yaml- id:prefer-tRPC-over-RESTpattern:| fetch('/api/...')message:| This codebase uses tRPC. Prefer trpc.* over fetch.severity:WARNING
Auto-fix 의 PR-only scope
// 매 auto-fix 가 own PR (not 매 PR 의 mix)
asyncfunctionprocessSuggestion(suggestion){constbranch=`ai-fix/${suggestion.id}`;awaitgit.checkoutBranch(branch);awaitapplyFix(suggestion);awaitgit.commit(`AI auto-fix: ${suggestion.summary}`);awaitgit.push(branch);awaitopenPR({title:`[AI Fix] ${suggestion.summary}`,body:`Severity: ${suggestion.severity}\nConfidence: ${suggestion.confidence}\n\n${suggestion.explanation}`,head: branch,base:'main',});}
🤔 의사결정 기준 (Decision Criteria)
상황
추천 stack
Small startup
Cursor + CodeRabbit
Mid-size
+ Snyk Code
Enterprise
Sonar + Snyk + CodeRabbit + Cursor
Privacy / on-prem
Sonar self-host + ConnectAI / Continue.dev
Air-gapped
Qodo + internal LLM
Legacy / large monorepo
Greptile + Kodesage
Security-critical
Veracode + Snyk + Semgrep
Behavioral / debt
CodeScene
기본값: Cursor (IDE) + CodeRabbit (PR) + Snyk (security). 매 layer 의 different tool.
⚠️ 모순 및 업데이트 (Contradictions & Updates)
Tool consolidation vs best-of-breed: 매 tool 의 multiple = redundant overhead. 매 single 의 limit.
Cloud AI vs privacy: 매 enterprise 의 self-host push.
Auto-fix 의 hallucination: 매 production push 의 risk.
AI 의 false positive 의 fatigue: 매 dev 의 dismiss.
Cost ↑: 매 LLM API 의 매 PR 의 $.
DORA metric 의 unclear improvement: 매 study 의 mixed evidence.