ข้ามไปยังเนื้อหา

แนวทางการขอดึง

เอกสารนี้ให้แนวทางที่ครอบคลุมสำหรับการส่งคำขอดึงไปยังโครงการ XOOPS การปฏิบัติตามหลักเกณฑ์เหล่านี้ทำให้แน่ใจได้ว่าการตรวจสอบโค้ดจะราบรื่นและเวลาในการรวมจะเร็วขึ้น

1. Visit the GitHub repository
2. Go to Issues tab
3. Search for existing issues related to your change
4. Check both open and closed issues
Terminal window
# Fork the repository on GitHub
# Click "Fork" button on the repository page
# Clone your fork
git clone https://github.com/YOUR_USERNAME/XOOPS.git
cd XOOPS
# Add upstream remote
git remote add upstream https://github.com/XOOPS/XOOPS.git
# Verify remotes
git remote -v
# Should show: origin (your fork) and upstream (official)
Terminal window
# Update main branch
git fetch upstream
git checkout main
git merge upstream/main
# Create feature branch
# Use descriptive names: bugfix/issue-number or feature/description
git checkout -b bugfix/123-fix-database-connection
git checkout -b feature/add-psr-7-support
Terminal window
# Make changes to your files
# Follow code style guidelines
# Stage changes
git add .
# Commit with clear message
git commit -m "Fix database connection timeout issue"
# Create multiple commits for logical changes
git commit -m "Add connection retry logic"
git commit -m "Improve error messages for debugging"

ใช้ข้อความที่สื่อความหมายชัดเจนตามรูปแบบเหล่านี้:

# Format
<type>: <subject>
<body>
<footer>
# Example 1: Bug fix
fix: 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: Feature
feat: 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 signature
พิมพ์คำอธิบายตัวอย่าง
featคุณสมบัติใหม่feat: add user dashboard widget
fixแก้ไขข้อผิดพลาดfix: resolve cache invalidation bug
docsเอกสารประกอบdocs: update API reference
styleรูปแบบโค้ด (ไม่มีการเปลี่ยนแปลงลอจิก)style: format imports
refactorการปรับโครงสร้างโค้ดใหม่refactor: simplify service layer
perfการปรับปรุงประสิทธิภาพperf: optimize database queries
testทดสอบการเปลี่ยนแปลงtest: add integration tests
choreการเปลี่ยนแปลงการสร้าง/เครื่องมือchore: update dependencies
markdown
## Description
Clear description of changes made and why.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Related Issues
Closes #123
Related 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 passing

ปฏิบัติตามหลักเกณฑ์สไตล์โค้ด:

<?php
// Good: PSR-12 style
namespace 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]);
}
}
tests/Feature/DatabaseConnectionTest.php
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);
}
}
Terminal window
# Run all tests
vendor/bin/phpunit
# Run specific test file
vendor/bin/phpunit tests/Feature/DatabaseConnectionTest.php
# Run with coverage
vendor/bin/phpunit --coverage-html coverage/
Terminal window
# Fetch latest from upstream
git fetch upstream
# Rebase on latest main
git rebase upstream/main
# Or merge if you prefer
git merge upstream/main
# Force push if rebased (warning: only on your branch!)
git push -f origin bugfix/123-fix-database-connection
[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 class
  1. ความถูกต้อง

    • รหัสช่วยแก้ปัญหาที่ระบุไว้หรือไม่
    • Edge case ได้รับการจัดการหรือไม่?
    • การจัดการข้อผิดพลาดมีความเหมาะสมหรือไม่?
  2. คุณภาพ

    • มันเป็นไปตามมาตรฐานการเข้ารหัสหรือไม่?
    • สามารถบำรุงรักษาได้หรือไม่?
    • ผ่านการทดสอบแล้วดีไหม?
  3. ประสิทธิภาพ

    • มีการถดถอยด้านประสิทธิภาพหรือไม่?
    • แบบสอบถามได้รับการปรับให้เหมาะสมหรือไม่
    • การใช้หน่วยความจำสมเหตุสมผลหรือไม่?
  4. ความปลอดภัย

    • การตรวจสอบอินพุต?
    • SQL การป้องกันการฉีด?
    • การรับรองความถูกต้อง/การอนุญาต?
Terminal window
# Address feedback
# Edit files based on review comments
# Commit changes
git commit -m "Address code review feedback
- Add additional error handling
- Improve test coverage for edge cases
- Update documentation"
# Push changes
git push origin bugfix/123-fix-database-connection

ปัญหา: ผู้ตรวจสอบไม่สามารถตรวจสอบ PR จำนวนมากได้อย่างมีประสิทธิภาพ

วิธีแก้ปัญหา: แบ่งเป็น PR ขนาดเล็กลง

  • PR แรก: การเปลี่ยนแปลงหลัก
  • PR ที่สอง: การทดสอบ
  • PR ที่สาม: เอกสารประกอบ

ปัญหา: ผู้ตรวจสอบไม่สามารถยืนยันการทำงานได้

วิธีแก้ไข: เพิ่มการทดสอบที่ครอบคลุมก่อนส่ง

ปัญหา: สาขาของคุณไม่ซิงค์กับสาขาหลัก

วิธีแก้ไข: Rebase บน main ล่าสุด

Terminal window
git fetch upstream
git rebase upstream/main
git push -f origin your-branch
Terminal window
# Switch to main
git checkout main
# Update main
git pull upstream main
# Delete local branch
git branch -d bugfix/123-fix-database-connection
# Delete remote branch
git push origin --delete bugfix/123-fix-database-connection
  • สร้างข้อความยืนยันเชิงอธิบาย
  • จัดทำ PR ที่เน้นจุดประสงค์เดียว
  • รวมการทดสอบฟังก์ชันการทำงานใหม่
  • อัปเดตเอกสาร
  • อ้างอิงประเด็นที่เกี่ยวข้อง
  • เก็บคำอธิบาย PR ให้ชัดเจน
  • ตอบกลับบทวิจารณ์ทันที
  • รวมการเปลี่ยนแปลงที่ไม่เกี่ยวข้อง
  • รวม main เข้ากับสาขาของคุณ (ใช้ rebase)
  • บังคับผลักดันหลังจากเริ่มการตรวจสอบ
  • ข้ามการทดสอบ
  • ส่งงานระหว่างดำเนินการ
  • ละเว้นความคิดเห็นเกี่ยวกับการตรวจสอบโค้ด
  • ../การมีส่วนร่วม - ภาพรวมการมีส่วนร่วม
  • Code-Style - แนวทางสไตล์โค้ด
  • ../../03-Module-Development/Best-Practices/Testing - การทดสอบแนวทางปฏิบัติที่ดีที่สุด
  • ../Architecture-Decisions/ADR-Index - แนวปฏิบัติทางสถาปัตยกรรม

อัปเดตล่าสุด: 31-01-2026 ใช้กับ: โครงการ XOOPS ทั้งหมด พื้นที่เก็บข้อมูล: https://github.com/XOOPS/XOOPS