Flux de Contribution
Ce guide vous guide à travers le processus complet de contribution à XOOPS, de la configuration initiale à la demande de tirage fusionnée.
Prérequis
Section intitulée « Prérequis »Avant de commencer à contribuer, assurez-vous d’avoir:
- Git installé et configuré
- Compte GitHub (gratuit)
- PHP 7.4+ pour le développement XOOPS
- Composer pour la gestion des dépendances
- Connaissance de base des flux de travail Git
- Familiarité avec le Code de Conduite
Step 1: Fork the Repository
Section intitulée « Step 1: Fork the Repository »On GitHub Web Interface
Section intitulée « On GitHub Web Interface »- Navigate to the repository (e.g.,
XOOPS/XoopsCore27) - Click the Fork button in the top-right corner
- Select where to fork (your personal account)
- Wait for the fork to complete
Why Fork?
Section intitulée « Why Fork? »- You get your own copy to work on
- Maintainers don’t need to manage many branches
- You have full control of your fork
- Pull Requests reference your fork and the upstream repo
Step 2: Clone Your Fork Locally
Section intitulée « Step 2: Clone Your Fork Locally »# 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)Step 3: Set Up Development Environment
Section intitulée « Step 3: Set Up Development Environment »Install Dependencies
Section intitulée « Install Dependencies »# Install Composer dependenciescomposer install
# Install development dependenciescomposer install --dev
# For module developmentcd modules/mymodulecomposer installConfigure Git
Section intitulée « Configure Git »# 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"Run Tests
Section intitulée « Run Tests »# Make sure tests pass in clean state./vendor/bin/phpunit
# Run specific test suite./vendor/bin/phpunit --testsuite unitStep 4: Create Feature Branch
Section intitulée « Step 4: Create Feature Branch »Branch Naming Convention
Section intitulée « Branch Naming Convention »Follow this pattern: <type>/<description>
Types:
feature/- New featurefix/- Bug fixdocs/- Documentation onlyrefactor/- Code refactoringtest/- Test additionschore/- Maintenance, tooling
Examples:
# 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/mainKeep Branch Up to Date
Section intitulée « Keep Branch Up to Date »# Before you start work, sync with upstreamgit fetch upstreamgit merge upstream/main
# Later, if upstream has changedgit fetch upstreamgit rebase upstream/mainStep 5: Make Your Changes
Section intitulée « Step 5: Make Your Changes »Development Practices
Section intitulée « Development Practices »- Write code following PHP Standards
- Write tests for new functionality
- Update documentation if needed
- Run linters and code formatters
Code Quality Checks
Section intitulée « Code Quality Checks »# 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/Commit Good Changes
Section intitulée « Commit Good Changes »# 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"Step 6: Keep Branch in Sync
Section intitulée « Step 6: Keep Branch in Sync »While working on your feature, the main branch might advance:
# 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 --continueStep 7: Push to Your Fork
Section intitulée « Step 7: Push to Your Fork »# 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-featureStep 8: Create Pull Request
Section intitulée « Step 8: Create Pull Request »On GitHub Web Interface
Section intitulée « On GitHub Web Interface »- Go to your fork on GitHub
- You’ll see a notification to create a PR from your branch
- Click “Compare & pull request”
- Or manually click “New pull request” and select your branch
PR Title and Description
Section intitulée « PR Title and Description »Title Format:
<type>(<scope>): <subject>Examples:
feat(auth): add two-factor authenticationfix(forms): prevent XSS in text inputdocs: update installation guiderefactor(core): improve performanceDescription Template:
## 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 Review Checklist
Section intitulée « PR Review Checklist »Before submitting, ensure:
- Code follows PHP Standards
- Tests are included and pass
- Documentation updated (if needed)
- No merge conflicts
- Commit messages are clear
- Related issues are referenced
- PR description is detailed
- No debug code or console logs
Step 9: Respond to Feedback
Section intitulée « Step 9: Respond to Feedback »During Code Review
Section intitulée « During Code Review »- Read comments carefully - Understand the feedback
- Ask questions - If unclear, ask for clarification
- Discuss alternatives - Respectfully debate approaches
- Make requested changes - Update your branch
- Force-push updated commits - If rewriting history
# 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-featureExpect Iteration
Section intitulée « Expect Iteration »- Most PRs require multiple review rounds
- Be patient and constructive
- View feedback as learning opportunity
- Maintainers may suggest refactors
Step 10: Merge and Cleanup
Section intitulée « Step 10: Merge and Cleanup »After Approval
Section intitulée « After Approval »Once maintainers approve and merge:
- GitHub auto-merges or maintainer clicks merge
- Your branch is deleted (usually automatic)
- Changes are in upstream
Local Cleanup
Section intitulée « Local Cleanup »# 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-featureWorkflow Diagram
Section intitulée « Workflow Diagram »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]Common Scenarios
Section intitulée « Common Scenarios »Syncing Before Starting
Section intitulée « Syncing Before Starting »# Always start freshgit fetch upstreamgit checkout -b feature/new-thing upstream/mainAdding More Commits
Section intitulée « Adding More Commits »# Just push againgit add .git commit -m "feat: additional changes"git push origin feature/new-thingFixing Mistakes
Section intitulée « Fixing Mistakes »# 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 changesHandling Merge Conflicts
Section intitulée « Handling Merge Conflicts »# Rebase and resolve conflictsgit fetch upstreamgit rebase upstream/main
# Edit conflicted files to resolve# Then continuegit add .git rebase --continuegit push --force-with-leaseBest Practices
Section intitulée « Best Practices »- Keep branches focused on single issues
- Make small, logical commits
- Write descriptive commit messages
- Update your branch frequently
- Test before pushing
- Document changes
- Be responsive to feedback
- Work directly on main/master branch
- Mix unrelated changes in one PR
- Commit generated files or node_modules
- Force push after PR is public (use —force-with-lease)
- Ignore code review feedback
- Create huge PRs (break into smaller ones)
- Commit sensitive data (API keys, passwords)
Tips for Success
Section intitulée « Tips for Success »Communicate
Section intitulée « Communicate »- Ask questions in issues before starting work
- Ask for guidance on complex changes
- Discuss approach in the PR description
- Respond to feedback promptly
Follow Standards
Section intitulée « Follow Standards »- Review PHP Standards
- Check Issue Reporting guidelines
- Read Contributing Overview
- Follow Pull Request Guidelines
Learn the Codebase
Section intitulée « Learn the Codebase »- Read existing code patterns
- Study similar implementations
- Understand the architecture
- Check Core Concepts
Documentation Connexe
Section intitulée « Documentation Connexe »- Code de Conduite
- Directives de Demande de Tirage
- Signalement de Problèmes
- Normes de Codage PHP
- Aperçu de la Contribution
#xoops #git #github #contributing #workflow #pull-request