Інструкції щодо запиту на витяг
У цьому документі містяться вичерпні вказівки щодо надсилання запитів на підключення до проектів XOOPS. Дотримання цих вказівок забезпечує плавний перегляд коду та швидше злиття.
Перед створенням Pull Request
Section titled “Перед створенням Pull Request”Крок 1. Перевірте наявні проблеми
Section titled “Крок 1. Перевірте наявні проблеми”1. Visit the GitHub repository2. Go to Issues tab3. Search for existing issues related to your change4. Check both open and closed issuesКрок 2: Розщеплення та клонування репозиторію
Section titled “Крок 2: Розщеплення та клонування репозиторію”# 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)Крок 3: Створіть гілку функції
Section titled “Крок 3: Створіть гілку функції”# 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-supportКрок 4: Внесіть зміни
Section titled “Крок 4: Внесіть зміни”# 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"Стандарти повідомлень фіксації
Section titled “Стандарти повідомлень фіксації”Хороші повідомлення фіксації
Section titled “Хороші повідомлення фіксації”Використовуйте чіткі описові повідомлення за такими шаблонами:
# 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 signatureКатегорії типу фіксації
Section titled “Категорії типу фіксації”| Тип | Опис | Приклад |
|---|---|---|
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 | Build/tooling зміни | chore: update dependencies |
Опис запиту на отримання
Section titled “Опис запиту на отримання”PR шаблон
Section titled “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 passingВимоги до якості коду
Section titled “Вимоги до якості коду”Стиль коду
Section titled “Стиль коду”Дотримуйтесь інструкцій щодо стилю коду:
<?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]); }}Вимоги до тестування
Section titled “Вимоги до тестування”Модульні тести
Section titled “Модульні тести”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); }}Виконання тестів
Section titled “Виконання тестів”# Run all testsvendor/bin/phpunit
# Run specific test filevendor/bin/phpunit tests/Feature/DatabaseConnectionTest.php
# Run with coveragevendor/bin/phpunit --coverage-html coverage/Робота з філіями
Section titled “Робота з філіями”Підтримуйте оновлення гілки
Section titled “Підтримуйте оновлення гілки”# 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-connectionСтворення Pull Request
Section titled “Створення Pull Request”Формат назви PR
Section titled “Формат назви 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 classПроцес перевірки коду
Section titled “Процес перевірки коду”Що шукають рецензенти
Section titled “Що шукають рецензенти”-
Правильність
- Чи вирішує код поставлену проблему?
- Чи обробляються крайові випадки?
- Чи доцільна обробка помилок?
-
Якість
- Чи відповідає він стандартам кодування?
- Це ремонтопридатне? — Добре перевірено?
-
Продуктивність
- Чи є регресії продуктивності?
- Чи оптимізовані запити?
- Чи доцільне використання пам’яті?
-
Безпека
- Перевірка введених даних?
- SQL профілактика ін’єкцій?
- Authentication/authorization?
Відповідь на відгуки
Section titled “Відповідь на відгуки”# 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-connectionПоширені проблеми з PR і їх вирішення
Section titled “Поширені проблеми з PR і їх вирішення”Проблема 1: PR занадто великий
Section titled “Проблема 1: PR занадто великий”Проблема: рецензенти не можуть ефективно розглядати масові рекламні оголошення
Рішення: Розбийте на менші PR
- Перший PR: основні зміни
- Другий ПР: Тести
- Третій PR: Документація
Проблема 2: тести не включені
Section titled “Проблема 2: тести не включені”Проблема: Рецензенти не можуть перевірити функціональність
Рішення: додайте комплексні тести перед подачею
Проблема 3: Конфлікти з Main
Section titled “Проблема 3: Конфлікти з Main”Проблема: Ваша гілка не синхронізована з основною
Рішення: Перебазуйте на останню основну базу
git fetch upstreamgit rebase upstream/maingit push -f origin your-branchПісля злиття
Section titled “Після злиття”Очищення
Section titled “Очищення”# 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-connectionПідсумок найкращих практик
Section titled “Підсумок найкращих практик”Що робити
Section titled “Що робити”- Створюйте описові повідомлення комітів
- Здійснюйте цілеспрямований, одноцільовий PR
- Включіть тести для нових функцій
- Оновити документацію
- Довідкові питання
- Зберігайте чіткі описи PR
- Швидко відповідайте на відгуки
Не варто
Section titled “Не варто”- Включіть непов’язані зміни
- Об’єднайте main у свою гілку (використовуйте rebase)
- Примусове натискання після початку перегляду
- Пропустити тести
- Надіслати незавершену роботу
- Ігноруйте відгуки про перевірку коду
Пов’язана документація
Section titled “Пов’язана документація”- ../Contributing - Огляд участі
- Code-Style - Правила стилю коду
- ../../03-Module-Development/Best-Practices/Testing - Тестування найкращих практик
- ../Architecture-Decisions/ADR-Index - Архітектурні рекомендації
Ресурси
Section titled “Ресурси”Останнє оновлення: 2026-01-31 Стосується: Усі проекти XOOPS Репозиторій: https://github.com/XOOPS/XOOPS