These guidelines ensure high-quality commits in MinIO’s GitHub repositories, maintaining a clear, valuable commit history for our open-source projects. They apply to all contributors, fostering efficient reviews and robust code.
Pull Requests (PRs) drive quality in MinIO’s codebase by:
- Enabling peer review without pair programming.
- Documenting changes for future reference.
- Ensuring commits tell a clear story of development.
A poor commit lasts forever, even if code is refactored.
A strong MinIO PR:
- Delivers a complete, valuable change (feature, bug fix, or improvement).
- Has a concise title (e.g.,
[S3] Fix bucket policy parsing #1234) and a summary with context, referencing issues (e.g.,#1234). - Contains well-written, logical commits explaining why changes were made (e.g., “Add S3 bucket tagging support so that users can organize resources efficiently”).
- Is small, focused, and easy to review—ideally one commit, unless multiple commits better narrate complex work.
- Adheres to MinIO’s coding standards (e.g., Go style, error handling, testing).
PRs must flow smoothly through review to reach production. Large PRs should be split into smaller, manageable ones.
-
Title and Summary:
- Use a scannable title:
[Subsystem] Action Description #Issue(e.g.,[IAM] Add role-based access control #567). - Include context in the summary: what changed, why, and any issue references.
- Use
[WIP]for in-progress PRs to avoid premature merging or choose GitHub draft PRs.
- Use a scannable title:
-
Commits:
- Write clear messages: what changed and why (e.g., “Refactor S3 API handler to reduce latency so that requests process 20% faster”).
- Rebase to tidy commits before submitting (e.g.,
git rebase -i mainto squash typos or reword messages), unless multiple contributors worked on the branch. - Keep PRs focused—one feature or fix. Split large changes into multiple PRs.
-
Testing:
- Include unit tests for new functionality or bug fixes.
- Ensure existing tests pass (
make test). - Document testing steps in the PR summary if manual testing was performed.
-
Before Submitting:
- Run
make verifyto check formatting, linting, and tests. - Reference related issues (e.g., “Closes #1234”).
- Notify team members via GitHub
@mentionsif urgent or complex.
- Run
Reviewers ensure MinIO’s commit history remains a clear, reliable record. Responsibilities include:
-
Commit Quality:
- Verify each commit explains why the change was made (e.g., “So that…”).
- Request rebasing if commits are unclear, redundant, or lack context (e.g., “Please squash typo fixes into the parent commit”).
-
Code Quality:
- Check adherence to MinIO’s Go standards (e.g., error handling, documentation).
- Ensure tests cover new code and pass CI.
- Flag bugs or critical issues for immediate fixes; suggest non-blocking improvements as follow-up issues.
-
Flow:
- Review promptly to avoid blocking progress.
- Balance quality and speed—minor issues can be addressed later via issues, not PR blocks.
- If unable to complete the review, tag another reviewer (e.g.,
@username please take over).
-
Shared Responsibility:
- All MinIO contributors are reviewers. The first commenter on a PR owns the review unless they delegate.
- Multiple reviewers are encouraged for complex PRs.
-
No Self-Edits:
- Don’t modify the PR directly (e.g., fixing bugs). Request changes from the submitter or create a follow-up PR.
- If you edit, you’re a collaborator, not a reviewer, and cannot merge.
-
Testing:
- Assume the submitter tested the code. If testing is unclear, ask for details (e.g., “How was this tested?”).
- Reject untested PRs unless testing is infeasible, then assist with test setup.
- Small PRs: Easier to review, faster to merge. Split large changes logically.
- Clear Commits: Use
git rebase -ito refine history before submitting. - Engage Early: Discuss complex changes in issues or Slack (https://slack.min.io) before coding.
- Be Responsive: Address reviewer feedback promptly to keep PRs moving.
- Learn from Reviews: Use feedback to improve future contributions.
By following these guidelines, we ensure MinIO’s codebase remains high-quality, maintainable, and a joy to contribute to. Happy coding!