Effective Code Reviews on GitHub
Conducting constructive code reviews: inline diff comments, suggestion blocks, review states (Approve, Request Changes), and review etiquette.
Effective Code Reviews on GitHub
Code review is a collaborative quality assurance process where peers inspect pull requests to identify bugs, ensure architectural consistency, share knowledge, and mentor team members.
1. The Three Review Responses
When submitting a formal review on a Pull Request:
- Comment: Submit general feedback without explicitly approving or blocking the merge.
- Approve: Confirm that the code meets project standards, passes tests, and is ready to merge.
- Request Changes: Block merging until required bug fixes, test additions, or architectural adjustments are resolved.
2. Using GitHub Suggestion Blocks
Reviewers can propose exact one-click diff changes directly within review comments using Markdown suggestion blocks:
```suggestion
const timeoutMs = Number(process.env.TIMEOUT_MS) || 5000;
```The author can click Apply suggestion on GitHub to instantly commit the change.
3. Reviewer Checklist
- Functionality: Does the code achieve the intended goal without breaking edge cases?
- Tests: Are there automated tests verifying the fix or feature?
- Security: Are inputs sanitized? Are any secrets or sensitive credentials exposed?
- Performance: Are there N+1 queries, memory leaks, or un-debounced event listeners?
- Readability & Standards: Are variables well-named? Does code conform to repository conventions?
Related Topics
The Open-Source Fork Workflow
Contributing to open-source via forks: forking on GitHub, configuring upstream remotes, syncing main, and opening cross-repo pull requests.
GitHub Branch Protection Rules
Protecting production branches: requiring pull request reviews, requiring status checks (CI), preventing force pushes, and repository governance.