Pedoman Permintaan Tarik
Dokumen ini memberikan pedoman komprehensif untuk mengirimkan permintaan penarikan ke proyek XOOPS. Mengikuti pedoman ini memastikan peninjauan kode lancar dan waktu penggabungan lebih cepat.
Sebelum Membuat Pull Request
Section titled “Sebelum Membuat Pull Request”Langkah 1: Periksa Masalah yang Ada
Section titled “Langkah 1: Periksa Masalah yang Ada”1. Visit the GitHub repository2. Go to Issues tab3. Search for existing issues related to your change4. Check both open and closed issuesLangkah 2: Fork dan Kloning Repositori
Section titled “Langkah 2: Fork dan Kloning Repositori”# Fork the repository on GitHub# Click "Fork" button on the repository page
# Clone your forkgit clone https://github.com/YOUR_USERNAME/XOOPS.gitcd XOOPS
# Add upstream remotegit remote add upstream https://github.com/XOOPS/XOOPS.git
# Verify remotesgit remote -v# Should show: origin (your fork) and upstream (official)Langkah 3: Buat Cabang Fitur
Section titled “Langkah 3: Buat Cabang Fitur”# Update main branchgit fetch upstreamgit checkout maingit merge upstream/main
# Create feature branch# Use descriptive names: bugfix/issue-number or feature/descriptiongit checkout -b bugfix/123-fix-database-connectiongit checkout -b feature/add-psr-7-supportLangkah 4: Lakukan Perubahan
Section titled “Langkah 4: Lakukan Perubahan”# Make changes to your files# Follow code style guidelines
# Stage changesgit add .
# Commit with clear messagegit commit -m "Fix database connection timeout issue"
# Create multiple commits for logical changesgit commit -m "Add connection retry logic"git commit -m "Improve error messages for debugging"Komit Standar Pesan
Section titled “Komit Standar Pesan”Pesan Komit yang Baik
Section titled “Pesan Komit yang Baik”Gunakan pesan yang jelas dan deskriptif dengan mengikuti pola berikut:
# Format<type>: <subject>
<body>
<footer>
# Example 1: Bug fixfix: resolve database connection timeout
Add exponential backoff retry mechanism to database connection.Connections now retry up to 3 times with increasing delays.
Fixes #123# Example 2: Featurefeat: implement PSR-7 HTTP message interfaces
Implement Psr\Http\Message interfaces for request/response handling.Provides type-safe HTTP message handling across the framework.
BREAKING CHANGE: Updated RequestHandler signatureKategori Jenis Komit
Section titled “Kategori Jenis Komit”| Ketik | Deskripsi | Contoh |
|---|---|---|
feat | Fitur baru | feat: add user dashboard widget |
fix | Perbaikan bug | fix: resolve cache invalidation bug |
docs | Dokumentasi | docs: update API reference |
style | Gaya kode (tidak ada perubahan logika) | style: format imports |
refactor | Pemfaktoran ulang kode | refactor: simplify service layer |
perf | Peningkatan kinerja | perf: optimize database queries |
test | Perubahan pengujian | test: add integration tests |
chore | Build/tooling berubah | chore: update dependencies |
Deskripsi Permintaan Tarik
Section titled “Deskripsi Permintaan Tarik”template PR
Section titled “template PR”## DescriptionClear description of changes made and why.
## Type of Change- [ ] Bug fix- [ ] New feature- [ ] Breaking change- [ ] Documentation update
## Related IssuesCloses #123Related to #456
## Changes Made- Change 1- Change 2- Change 3
## Testing- [ ] Tested locally- [ ] All tests pass- [ ] Added new tests- [ ] Manual testing steps included
## Checklist- [ ] Code follows style guidelines- [ ] Self-review completed- [ ] Comments added for complex logic- [ ] Documentation updated- [ ] No new warnings generated- [ ] Added tests for new functionality- [ ] All tests passingPersyaratan Kualitas Kode
Section titled “Persyaratan Kualitas Kode”Gaya Kode
Section titled “Gaya Kode”Ikuti pedoman Gaya Kode:
<?php// Good: PSR-12 stylenamespace MyModule\Controller;
use MyModule\Model\Item;use MyModule\Repository\ItemRepository;
class ItemController{ private ItemRepository $repository;
public function __construct(ItemRepository $repository) { $this->repository = $repository; }
public function indexAction() { $items = $this->repository->findAll(); return $this->render('items', ['items' => $items]); }}Persyaratan Pengujian
Section titled “Persyaratan Pengujian”Pengujian Satuan
Section titled “Pengujian Satuan”namespace Tests\Feature;
use PHPUnit\Framework\TestCase;use Xoops\Database\XoopsDatabase;
class DatabaseConnectionTest extends TestCase{ private XoopsDatabase $database;
protected function setUp(): void { $this->database = new XoopsDatabase(); }
public function testConnectionWithValidCredentials() { $result = $this->database->connect(); $this->assertTrue($result); }
public function testConnectionWithInvalidCredentials() { $this->database->setCredentials('invalid', 'invalid'); $result = $this->database->connect(); $this->assertFalse($result); }}Menjalankan Tes
Section titled “Menjalankan Tes”# Run all testsvendor/bin/phpunit
# Run specific test filevendor/bin/phpunit tests/Feature/DatabaseConnectionTest.php
# Run with coveragevendor/bin/phpunit --coverage-html coverage/Bekerja dengan Cabang
Section titled “Bekerja dengan Cabang”Terus Perbarui Cabang
Section titled “Terus Perbarui Cabang”# Fetch latest from upstreamgit fetch upstream
# Rebase on latest maingit rebase upstream/main
# Or merge if you prefergit merge upstream/main
# Force push if rebased (warning: only on your branch!)git push -f origin bugfix/123-fix-database-connectionMembuat Permintaan Tarik
Section titled “Membuat Permintaan Tarik”Format Judul PR
Section titled “Format Judul PR”[Type] Short description (fix/feature/docs)
Examples:- [FIX] Resolve database connection timeout issue (#123)- [FEATURE] Implement PSR-7 HTTP message interfaces- [DOCS] Update API reference for Criteria classProses Peninjauan Kode
Section titled “Proses Peninjauan Kode”Yang Dicari Peninjau
Section titled “Yang Dicari Peninjau”-
Kebenaran
- Apakah kode tersebut menyelesaikan masalah yang disebutkan?
- Apakah kasus-kasus edge ditangani?
- Apakah penanganan kesalahan sudah tepat?
-
Kualitas
- Apakah mengikuti standar pengkodean?
- Apakah bisa dipelihara?
- Apakah sudah teruji dengan baik?
-
Kinerja
- Adakah regresi kinerja?
- Apakah kueri dioptimalkan?
- Apakah penggunaan memori masuk akal?
-
Keamanan
- Validasi masukan?
- Pencegahan injeksi SQL? -Authentication/authorization?
Menanggapi Masukan
Section titled “Menanggapi Masukan”# Address feedback# Edit files based on review comments
# Commit changesgit commit -m "Address code review feedback
- Add additional error handling- Improve test coverage for edge cases- Update documentation"
# Push changesgit push origin bugfix/123-fix-database-connectionMasalah dan Solusi Umum PR
Section titled “Masalah dan Solusi Umum PR”Edisi 1: PR Terlalu Besar
Section titled “Edisi 1: PR Terlalu Besar”Masalah: Peninjau tidak dapat meninjau PR dalam jumlah besar secara efektif
Solusi: Bagi menjadi PR yang lebih kecil
- PR Pertama: Perubahan core
- PR Kedua: Tes
- PR Ketiga: Dokumentasi
Edisi 2: Tidak Termasuk Tes
Section titled “Edisi 2: Tidak Termasuk Tes”Masalah: Peninjau tidak dapat memverifikasi fungsionalitas
Solusi: Tambahkan tes komprehensif sebelum mengirimkan
Edisi 3: Konflik dengan Utama
Section titled “Edisi 3: Konflik dengan Utama”Masalah: Cabang Anda tidak sinkron dengan main
Solusi: Rebase pada main terbaru
git fetch upstreamgit rebase upstream/maingit push -f origin your-branchSetelah Penggabungan
Section titled “Setelah Penggabungan”Pembersihan
Section titled “Pembersihan”# Switch to maingit checkout main
# Update maingit pull upstream main
# Delete local branchgit branch -d bugfix/123-fix-database-connection
# Delete remote branchgit push origin --delete bugfix/123-fix-database-connectionRingkasan Praktik Terbaik
Section titled “Ringkasan Praktik Terbaik”Yang harus dilakukan
Section titled “Yang harus dilakukan”- Buat pesan komit deskriptif
- Buatlah PR yang terfokus dan mempunyai tujuan tunggal
- Sertakan tes untuk fungsionalitas baru
- Perbarui dokumentasi
- Masalah terkait referensi
- Jaga agar deskripsi PR tetap jelas
- Segera tanggapi ulasan
Larangan
Section titled “Larangan”- Sertakan perubahan yang tidak terkait
- Gabungkan main ke cabang Anda (gunakan rebase)
- Paksa dorongan setelah peninjauan dimulai
- Lewati tes
- Kirim pekerjaan yang sedang berlangsung
- Abaikan umpan balik peninjauan kode
Dokumentasi Terkait
Section titled “Dokumentasi Terkait”- ../Berkontribusi - Berkontribusi ikhtisar
- Gaya Kode - Pedoman gaya kode
- ../../03-Module-Development/Best-Practices/Testing - Menguji praktik terbaik
- ../Architecture-Decisions/ADR-Index - Pedoman arsitektur
Sumber Daya
Section titled “Sumber Daya”Terakhir Diperbarui: 31-01-2026 Berlaku Untuk: Semua proyek XOOPS Repositori: https://github.com/XOOPS/XOOPS