İçeriğe geç
Kodlama ve Yazılım Orta

AI ile Kod Review: Daha İyi PR'lar 30 Dakikada

ChatGPT, Claude, CodeRabbit, GitHub Copilot ile kod review: best practices, security, performance.

YZ
Paylaş:
Kod ekranı

Kod review = takım kalitesinin anahtarı. AI ile 2x hız + tutarlılık. İnsan PR’ı 30 dk, AI 2 dk.

Tool Karşılaştırma

ToolTipGüçlüFiyat
CodeRabbitPR otomatikSmart, learn from team$12/user
GitHub Copilot ReviewPR otomatikGitHub native$19/user
GreptileLarge codebaseRAG codebase$30/user
BitoIDE + PRMulti-language$15/user
DeepCode (Snyk)Security focusOWASP$25/user
ChatGPT manualManualFree with Plus$20/ay
Claude manualManualBest for complex$20/ay

Otomatik PR Review (CodeRabbit)

# .coderabbit.yaml
reviews:
  language: "tr-TR"
  poem: false
  collapse_walkthrough: false
  request_changes_workflow: false
  high_level_summary: true
  review_simple_changes: false
  review_status: true

  chat:
    auto_reply: true
  
  path_filters:
    - "!**/*.lock"
    - "!**/dist/**"
  
  path_instructions:
    - path: "src/api/**"
      instructions: "API security: input validation, auth check, rate limit"
    - path: "src/db/**"
      instructions: "SQL injection, query performance, transaction handling"

CodeRabbit her PR’da otomatik yorum + suggestion.

Manuel Review Prompt

Rol: Sen senior software engineer code reviewer.

Görev: Aşağıdaki PR diff için review:

[diff yapıştır]

Stack: TypeScript, React, PostgreSQL
Style guide: [link]

Çıktı:
1. Summary (PR ne yapıyor)
2. Blocking issues (must-fix)
3. Suggestions (improve)
4. Nits (style, optional)
5. Praise (iyi olan)
6. Test coverage feedback
7. Security check
8. Performance impact
9. Backward compatibility
10. Documentation gap

Detay Review Areas

1. Security

"Aşağıdaki kod için security review:

[kod]

Check:
- SQL injection
- XSS
- CSRF
- Auth bypass
- Sensitive data exposure
- Insecure dependencies
- Hardcoded secrets
- Insufficient logging
- Race condition
- Path traversal
"

2. Performance

"Performance review:

[kod]

Check:
- N+1 queries
- Unnecessary re-renders (React)
- Memory leak
- Bundle size impact
- Algorithm complexity
- Cache opportunity
- Async vs sync
- Database index usage
"

3. Readability

"Code clarity review:

[kod]

Check:
- Naming (descriptive)
- Function length (single responsibility)
- Magic numbers / strings
- Comment quality (why, not what)
- Code duplication
- Abstraction level
- Cognitive complexity
"

4. Testing

"Test review:

[test + source]

Check:
- Test coverage (önemli paths)
- Edge cases
- Mock vs real dependency balance
- Test independence
- Test name descriptive
- Setup / teardown clean
- Flaky test risk
"

Detay: Test Yazma

PR Description AI ile

"PR description üret:

Changes:
[git diff summary]

Format:
## What
- [değişiklik 1]
- [değişiklik 2]

## Why
- [reason]

## How
- [approach]

## Testing
- [...]

## Screenshots (varsa)
- [...]

## Checklist
- [x] Tests added
- [x] Documentation updated
- [ ] Migration script
- [x] Reviewer notified

## Risk
- [...]"

Refactoring Önerileri

Detay: AI ile Refactoring

"Aşağıdaki fonksiyon 200 satır. Refactor önerileri:

[fonksiyon]

Çıktı:
1. Extract function candidates (3)
2. Extract class (varsa)
3. Replace conditional with polymorphism
4. Pure function dönüştürme
5. Side effect izolasyonu
6. Test edilebilirlik artışı
7. Migration plan (small steps)
8. Risk değerlendirme

Review Yorum Yazma

"Aşağıdaki kod sorununu code review yorumu olarak yaz:

Sorun: N+1 query

Format:
- Constructive (saldırgan değil)
- Sebep açıkla
- Alternatif öner
- Code snippet
- Optional kaynak link
- 'I think' tone (dictator değil)
"

Örnek:

“Bu loop her iteration’da DB sorgusu yapıyor (N+1). 100 user için 100 query. Prisma.user.findMany({ include: { posts: true } }) ile tek query’de hallederiz. Performance: 2s → 50ms.”

Style Guide Otomasyon

"Bizim style guide:

[link / paste]

Aşağıdaki PR'ı check:

[diff]

Style violations:
- Naming
- Import order
- Comment style
- Test naming
- File structure
"

ESLint + Prettier + Husky + AI = otomatik enforce.

Architecture Review

"Yeni feature için architecture review:

Spec: [...]

PR: [link]

Check:
- DDD / clean architecture pattern
- Layer separation
- Dependency direction
- Single source of truth
- Coupling level
- Testability
- Future change easy

Pattern violations:
- Premature abstraction
- God class
- Feature envy
- Hidden dependency
"

Pull Request Sizing

"PR size analyz:

PR: 800 lines changed

Çıktı:
- Too big? (eğer > 400 line)
- Logical chunks (split candidates)
- Dependency between chunks
- Suggested PR breakdown:
  - PR 1: refactor (no behavior change)
  - PR 2: new feature
  - PR 3: tests
  - PR 4: docs

Avantaj: review easy, revert easy, less risk"

Feedback Culture

"Review yorumu yazısı kuralları:


- Sorgulayıcı: 'Neden böyle?'
- Önerici: 'Şu daha iyi olabilir'
- Pozitif: 'Bu yaklaşımı sevdim'
- Spesifik: line + öneri


- 'Yanlış' (neden?)
- 'Sen bilmiyorsun' (saldırı)
- 'Always do X' (dictator)
- 'NIT:' over-policing

Anti-pattern: 'bikeshedding' (renk tartışma)"

Review Workflow

1. Yazar: PR aç + description + self-review (test, lint)
2. AI bot: ilk review (2 dk)
3. Bot suggestion'ları yazar fix
4. Reviewer'a notify
5. Reviewer: AI bot zaten check ettiği şeyleri atla
6. Reviewer focus: architecture + business + edge case
7. Yazar: fix + reply
8. Approve + merge

Süre: 2 saat (eski 8 saat).

Yaygın Hatalar

  1. AI bot’a komple güven: insan validation yine şart
  2. Style önce, architecture sonra: yanlış sıra
  3. Çok fazla review yorumu: 20+ comment = paralizasyon
  4. PR çok büyük: review yapılmaz
  5. Geç review: 3 gün eski PR = stale
  6. Junior’a “bekle” demek: öğrenme = direct feedback

Sonraki Adımlar

Özet

Kod review + AI = 2x hız + tutarlılık. Security + performance + style otomatize. İnsan: architecture + business + judgment. Anahtar: CodeRabbit / Copilot bot + insan reviewer hybrid. PR küçük tut, feedback yapıcı, öğrenme odaklı.

Paylaş:

Yapay zeka dünyasından haberdar olun

Haftalık özet bültenimize abone olun, en yeni rehberler ve araç incelemeleri direkt e-postanıza gelsin.

İstediğiniz zaman abonelikten çıkabilirsiniz.