Smjernice za zahtjev za povlačenje
Ovaj dokument pruža sveobuhvatne smjernice za podnošenje zahtjeva za povlačenje projektima XOOPS. Slijeđenje ovih smjernica osigurava glatke preglede koda i brže spajanje.
Prije stvaranja zahtjeva za povlačenje
Section titled “Prije stvaranja zahtjeva za povlačenje”Korak 1: Provjerite postoje li problemi
Section titled “Korak 1: Provjerite postoje li problemi”1. Visit the GitHub repository2. Go to Issues tab3. Search for existing issues related to your change4. Check both open and closed issuesKorak 2: račvajte i klonirajte spremište
Section titled “Korak 2: račvajte i klonirajte spremište”# 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)Korak 3: Stvorite granu značajki
Section titled “Korak 3: Stvorite granu značajki”# 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-supportKorak 4: Unesite svoje promjene
Section titled “Korak 4: Unesite svoje promjene”# 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"Standardi poruka o uvrštavanju
Section titled “Standardi poruka o uvrštavanju”Dobre poruke predaje
Section titled “Dobre poruke predaje”Koristite jasne, opisne poruke slijedeći ove obrasce:
# 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 signatureKategorije tipa uvrštavanja
Section titled “Kategorije tipa uvrštavanja”| Upišite | Opis | Primjer |
|---|---|---|
feat | Nova značajka | feat: add user dashboard widget |
fix | Ispravak pogreške | fix: resolve cache invalidation bug |
docs | Dokumentacija | docs: update API reference |
style | Stil koda (bez promjene logike) | style: format imports |
refactor | Prerađivanje koda | refactor: simplify service layer |
perf | Poboljšanje performansi | perf: optimize database queries |
test | Promjene testa | test: add integration tests |
chore | Izrada/promjene alata | chore: update dependencies |
Opis zahtjeva za povlačenjem
Section titled “Opis zahtjeva za povlačenjem”PR predložak
Section titled “PR predložak”## 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 passingZahtjevi kvalitete koda
Section titled “Zahtjevi kvalitete koda”Stil koda
Section titled “Stil koda”Slijedite smjernice Code-Stylea:
<?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]); }}Zahtjevi za testiranje
Section titled “Zahtjevi za testiranje”Jedinični testovi
Section titled “Jedinični testovi”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); }}Izvođenje testova
Section titled “Izvođenje testova”# Run all testsvendor/bin/phpunit
# Run specific test filevendor/bin/phpunit tests/Feature/DatabaseConnectionTest.php
# Run with coveragevendor/bin/phpunit --coverage-html coverage/Rad s podružnicama
Section titled “Rad s podružnicama”Držite podružnicu ažuriranom
Section titled “Držite podružnicu ažuriranom”# 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-connectionStvaranje zahtjeva za povlačenjem
Section titled “Stvaranje zahtjeva za povlačenjem”PR Format naslova
Section titled “PR Format naslova”[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 classProces pregleda koda
Section titled “Proces pregleda koda”Što recenzenti traže
Section titled “Što recenzenti traže”-
Ispravnost
- Rješava li kod navedeni problem?
- Obrađuju li se rubni slučajevi?
- Je li rukovanje pogreškama primjereno?
-
Kvaliteta
- Prati li standarde kodiranja?
- Može li se održavati?
- Je li dobro ispitan?
-
Performanse
- Ima li regresija performansi?
- Jesu li upiti optimizirani?
- Je li korištenje memorije razumno?
-
Sigurnost
- Validacija unosa?
- SQL sprječavanje ubrizgavanja?
- Autentifikacija/autorizacija?
Odgovaranje na povratne informacije
Section titled “Odgovaranje na povratne informacije”# 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-connectionUobičajeni PR problemi i rješenja
Section titled “Uobičajeni PR problemi i rješenja”Problem 1: PR je prevelik
Section titled “Problem 1: PR je prevelik”Problem: Recenzenti ne mogu učinkovito pregledati masovne PR-ove
Rješenje: Podijelite se na manje PR-ove
- Prvi PR: Temeljne promjene
- Drugi PR: Testovi
- Treći PR: Dokumentacija
Problem 2: Testovi nisu uključeni
Section titled “Problem 2: Testovi nisu uključeni”Problem: recenzenti ne mogu provjeriti funkcionalnost
Rješenje: dodajte opsežne testove prije slanja
Problem 3: Sukobi s glavnim
Section titled “Problem 3: Sukobi s glavnim”Problem: Vaša grana nije sinkronizirana s glavnom
Rješenje: Rebase na najnoviji glavni
git fetch upstreamgit rebase upstream/maingit push -f origin your-branchNakon spajanja
Section titled “Nakon spajanja”Čišćenje
Section titled “Čišćenje”# 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-connectionSažetak najboljih praksi
Section titled “Sažetak najboljih praksi”Što učiniti
Section titled “Što učiniti”- Stvorite opisne poruke predaje
- Napravite fokusirane PR-ove s jednom svrhom
- Uključite testove za novu funkcionalnost
- Ažuriranje dokumentacije
- Pitanja povezana s referencama
- PR opisi neka budu jasni
- Brzo odgovarajte na recenzije
Nemojte
Section titled “Nemojte”- Uključi nepovezane promjene
- Spojite main u svoju granu (koristite rebase)
- Prisilni pritisak nakon početka pregleda
- Preskoči testove
- Pošaljite radove u tijeku
- Zanemarite povratne informacije o pregledu koda
Povezana dokumentacija- ../Doprinos - Pregled doprinosa
Section titled “Povezana dokumentacija- ../Doprinos - Pregled doprinosa”- Code-Style - Smjernice za stil koda
- ../../03-Module-Development/Best-Practices/Testing - Najbolje prakse testiranja
- ../Architecture-Decisions/ADR-Index - Arhitektonske smjernice
Resursi
Section titled “Resursi”- Git dokumentacija
- Pomoć za GitHub zahtjev za povlačenjem
- Konvencionalna predaja
- XOOPS GitHub organizacija
Zadnje ažuriranje: 2026-01-31 Odnosi se na: Sve XOOPS projekte Repozitorij: https://github.com/XOOPS/XOOPS