Bijdrageworkflow
Deze handleiding leidt u door het volledige proces van bijdragen aan XOOPS, van de eerste installatie tot de samengevoegde pull-aanvraag.
Vereisten
Section titled “Vereisten”Voordat u begint met bijdragen, moet u ervoor zorgen dat u over het volgende beschikt:
- Git geïnstalleerd en geconfigureerd
- GitHub-account (gratis)
- PHP 7.4+ voor XOOPS-ontwikkeling
- Componist voor afhankelijkheidsbeheer
- Basiskennis van Git-workflows
- Kennis van de Gedragscode
Stap 1: Fork de repository
Section titled “Stap 1: Fork de repository”Op GitHub-webinterface
Section titled “Op GitHub-webinterface”- Navigeer naar de repository (bijvoorbeeld
XOOPS/XoopsCore27) - Klik op de knop Vork in de rechterbovenhoek
- Selecteer waar u wilt forken (uw persoonlijke account)
- Wacht tot de vork klaar is
Waarom vork?
Section titled “Waarom vork?”- Je krijgt een eigen exemplaar om aan te werken
- Onderhouders hoeven niet veel vestigingen te beheren
- U heeft volledige controle over uw vork
- Pull Requests verwijzen naar uw fork en de upstream repository
Stap 2: Kloon uw vork lokaal
Section titled “Stap 2: Kloon uw vork lokaal”# Clone your fork (replace YOUR_USERNAME)git clone https://github.com/YOUR_USERNAME/XoopsCore27.gitcd XoopsCore27
# Add upstream remote to track original repositorygit remote add upstream https://github.com/XOOPS/XoopsCore27.git
# Verify remotes are set correctlygit remote -v# origin https://github.com/YOUR_USERNAME/XoopsCore27.git (fetch)# origin https://github.com/YOUR_USERNAME/XoopsCore27.git (push)# upstream https://github.com/XOOPS/XoopsCore27.git (fetch)# upstream https://github.com/XOOPS/XoopsCore27.git (nofetch)Stap 3: Ontwikkelomgeving instellen
Section titled “Stap 3: Ontwikkelomgeving instellen”Afhankelijkheden installeren
Section titled “Afhankelijkheden installeren”# Install Composer dependenciescomposer install
# Install development dependenciescomposer install --dev
# For module developmentcd modules/mymodulecomposer installGit configureren
Section titled “Git configureren”# Set your Git identitygit config user.name "Your Name"git config user.email "your.email@example.com"
# Optional: Set global Git configgit config --global user.name "Your Name"git config --global user.email "your.email@example.com"Voer tests uit
Section titled “Voer tests uit”# Make sure tests pass in clean state./vendor/bin/phpunit
# Run specific test suite./vendor/bin/phpunit --testsuite unitStap 4: Maak een functievertakking
Section titled “Stap 4: Maak een functievertakking”Conventie voor de naamgeving van vertakkingen
Section titled “Conventie voor de naamgeving van vertakkingen”Volg dit patroon: <type>/<description>
Soorten:
feature/- Nieuwe functiefix/- Bugfixdocs/- Alleen documentatierefactor/- Coderefactoringtest/- Testtoevoegingenchore/- Onderhoud, gereedschap
Voorbeelden:
# Feature branchgit checkout -b feature/add-two-factor-auth
# Bug fix branchgit checkout -b fix/prevent-xss-in-forms
# Documentation branchgit checkout -b docs/update-api-guide
# Always branch from upstream/main (or develop)git checkout -b feature/my-feature upstream/mainBranch up-to-date houden
Section titled “Branch up-to-date houden”# Before you start work, sync with upstreamgit fetch upstreamgit merge upstream/main
# Later, if upstream has changedgit fetch upstreamgit rebase upstream/mainStap 5: breng uw wijzigingen aan
Section titled “Stap 5: breng uw wijzigingen aan”Ontwikkelingspraktijken
Section titled “Ontwikkelingspraktijken”- Schrijf code volgens de PHP-normen
- Schrijf tests voor nieuwe functionaliteit
- Update de documentatie indien nodig
- Voer linters uit en codeformatters
Codekwaliteitscontroles
Section titled “Codekwaliteitscontroles”# Run all tests./vendor/bin/phpunit
# Run with coverage./vendor/bin/phpunit --coverage-html coverage/
# Run PHP CS Fixer./vendor/bin/php-cs-fixer fix --dry-run
# Run PHPStan static analysis./vendor/bin/phpstan analyse class/ src/Voer goede veranderingen door
Section titled “Voer goede veranderingen door”# Check what you changedgit statusgit diff
# Stage specific filesgit add class/MyClass.phpgit add tests/MyClassTest.php
# Or stage all changesgit add .
# Commit with descriptive messagegit commit -m "feat(auth): add two-factor authentication support"Stap 6: Houd Branch gesynchroniseerd
Section titled “Stap 6: Houd Branch gesynchroniseerd”Terwijl u aan uw feature werkt, kan de hoofdvertakking vooruitgaan:
# Fetch latest changes from upstreamgit fetch upstream
# Option A: Rebase (preferred for clean history)git rebase upstream/main
# Option B: Merge (simpler but adds merge commits)git merge upstream/main
# If conflicts occur, resolve them then:git add .git rebase --continue # or git merge --continueStap 7: Duw naar je vork
Section titled “Stap 7: Duw naar je vork”# Push your branch to your forkgit push origin feature/my-feature
# On subsequent pushesgit push
# If you rebased, you might need force push (use carefully!)git push --force-with-lease origin feature/my-featureStap 8: Maak een pull-verzoek
Section titled “Stap 8: Maak een pull-verzoek”Op GitHub-webinterface
Section titled “Op GitHub-webinterface”- Ga naar je fork op GitHub
- U ziet een melding om vanuit uw vestiging een PR aan te maken
- Klik op “Vergelijken en verzoek ophalen”
- Of klik handmatig op “Nieuwe pull-aanvraag” en selecteer uw vestiging
PR-titel en beschrijving
Section titled “PR-titel en beschrijving”Titelformaat:
<type>(<scope>): <subject>Voorbeelden:
feat(auth): add two-factor authenticationfix(forms): prevent XSS in text inputdocs: update installation guiderefactor(core): improve performanceBeschrijvingssjabloon:
## DescriptionBrief explanation of what this PR does.
## Changes- Changed X from A to B- Added feature Y- Fixed bug Z
## Type of Change- [ ] New feature (adds new functionality)- [ ] Bug fix (fixes an issue)- [ ] Breaking change (API/behavior change)- [ ] Documentation update
## Testing- [ ] Added tests for new functionality- [ ] All existing tests pass- [ ] Manual testing performed
## Screenshots (if applicable)Include before/after screenshots for UI changes.
## Related IssuesCloses #123Related to #456
## Checklist- [ ] Code follows style guidelines- [ ] Self-reviewed own code- [ ] Commented complex code- [ ] Updated documentation- [ ] No new warnings generated- [ ] Tests pass locallyPR-beoordelingchecklist
Section titled “PR-beoordelingchecklist”Zorg ervoor dat u, voordat u het indient, het volgende doet:
- Code volgt de PHP-normen
- Tests zijn inbegrepen en slagen
- Documentatie bijgewerkt (indien nodig)
- Geen samenvoegconflicten
- Commit-berichten zijn duidelijk
- Er wordt verwezen naar gerelateerde problemen
- PR-beschrijving is gedetailleerd
- Geen foutopsporingscode of consolelogboeken
Stap 9: Reageer op feedback
Section titled “Stap 9: Reageer op feedback”Tijdens codebeoordeling
Section titled “Tijdens codebeoordeling”- Lees de opmerkingen aandachtig - Begrijp de feedback
- Stel vragen - Als het onduidelijk is, vraag dan om opheldering
- Bespreek alternatieven - Bespreek op respectvolle wijze benaderingen
- Gevraagde wijzigingen aanbrengen - Update uw vestiging
- Force-push bijgewerkte commits - Als de geschiedenis wordt herschreven
# Make changesgit add .git commit --amend # Modify last commitgit push --force-with-lease origin feature/my-feature
# Or add new commitsgit commit -m "Address feedback on PR review"git push origin feature/my-featureVerwacht iteratie
Section titled “Verwacht iteratie”- De meeste PR’s vereisen meerdere beoordelingsrondes
- Wees geduldig en constructief
- Zie feedback als leermogelijkheid
- Onderhouders kunnen refactoren voorstellen
Stap 10: Samenvoegen en opruimen
Section titled “Stap 10: Samenvoegen en opruimen”Na goedkeuring
Section titled “Na goedkeuring”Zodra de beheerders het goedkeuren en samenvoegen:
- GitHub voegt automatisch samen of klikken van beheerders worden samengevoegd
- Uw filiaal wordt verwijderd (meestal automatisch)
- Wijzigingen vinden upstream plaats
Lokale opschoning
Section titled “Lokale opschoning”# Switch to main branchgit checkout main
# Update main with merged changesgit fetch upstreamgit merge upstream/main
# Delete local feature branchgit branch -d feature/my-feature
# Delete from your fork (if not auto-deleted)git push origin --delete feature/my-featureWerkstroomdiagram
Section titled “Werkstroomdiagram”graph LR A[Fork Repository] --> B[Clone Fork] B --> C[Create Branch] C --> D[Make Changes] D --> E[Commit & Push] E --> F[Create PR] F --> G{Review} G -->|Approved| H[Merge] G -->|Changes Needed| I[Update PR] I --> G H --> J[Cleanup] J --> K[Done]Veelvoorkomende scenario’s
Section titled “Veelvoorkomende scenario’s”Synchroniseren voordat u begint
Section titled “Synchroniseren voordat u begint”# Always start freshgit fetch upstreamgit checkout -b feature/new-thing upstream/mainMeer commits toevoegen
Section titled “Meer commits toevoegen”# Just push againgit add .git commit -m "feat: additional changes"git push origin feature/new-thingFouten herstellen
Section titled “Fouten herstellen”# Last commit has wrong messagegit commit --amend -m "Correct message"git push --force-with-lease
# Revert to previous state (careful!)git reset --soft HEAD~1 # Keep changesgit reset --hard HEAD~1 # Discard changesSamenvoegconflicten afhandelen
Section titled “Samenvoegconflicten afhandelen”# Rebase and resolve conflictsgit fetch upstreamgit rebase upstream/main
# Edit conflicted files to resolve# Then continuegit add .git rebase --continuegit push --force-with-leaseBeste praktijken
Section titled “Beste praktijken”- Houd vestigingen gefocust op afzonderlijke kwesties
- Maak kleine, logische commits
- Schrijf beschrijvende commit-berichten
- Update uw filiaal regelmatig
- Test voordat u duwt
- Documentwijzigingen
- Reageer op feedback
Niet doen- Werk rechtstreeks op de hoofd-/mastertak
Section titled “Niet doen- Werk rechtstreeks op de hoofd-/mastertak”- Meng niet-gerelateerde wijzigingen in één PR
- Commit gegenereerde bestanden of node_modules
- Forceer push nadat PR openbaar is (gebruik —force-with-lease)
- Negeer feedback over codebeoordelingen
- Creëer enorme PR’s (breek deze op in kleinere)
- Gevoelige gegevens vastleggen (API sleutels, wachtwoorden)
Tips voor succes
Section titled “Tips voor succes”Communiceren
Section titled “Communiceren”- Stel vragen bij problemen voordat u aan het werk gaat
- Vraag om begeleiding bij complexe veranderingen
- Bespreek aanpak in de PR-beschrijving
- Reageer snel op feedback
Volg de normen
Section titled “Volg de normen”- Beoordeel de PHP-normen
- Controleer de richtlijnen voor probleemrapportage
- Lees het bijdragenoverzicht
- Volg de Pull Request-richtlijnen
Leer de Codebase
Section titled “Leer de Codebase”- Lees bestaande codepatronen
- Bestudeer vergelijkbare implementaties
- Begrijp de architectuur
- Controleer kernconcepten
Gerelateerde documentatie
Section titled “Gerelateerde documentatie”- Gedragscode
- Richtlijnen voor pull-aanvragen
- Probleemrapportage
- PHP Coderingsnormen
- Bijdragenoverzicht
#xoops #git #GitHub #contributing #workflow #pull-request