-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: code reviews #56
Open
B0berman
wants to merge
8
commits into
main
Choose a base branch
from
docs/code-reviews
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b22dd8f
add code reviews doc
B0berman 397f044
remove blank lines
B0berman 3db4772
pr suggestions
B0berman 9c080b8
fix: lint
B0berman d909998
feat: add code review etiquette
B0berman 69b8672
fix: lint
B0berman 1c64d34
fix: lint
B0berman 9aca321
chore: pr suggestions
B0berman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,71 @@ | ||||||
--- | ||||||
title: Code Reviews | ||||||
description: Code reviews best practices | ||||||
--- | ||||||
|
||||||
Code reviews are an integral part of any high-quality software development workflow. Whether you're a reviewer or an author, following good practices will improve the team's productivity and code quality while ensuring a smoother development flow. | ||||||
Writing clean and readable code, preparing code for review, conducting thorough and effective code reviews, and using tools to automate parts of the process, are key points to keep a healthy codebase. | ||||||
|
||||||
## Consider the review when writing code | ||||||
|
||||||
When writing code it is essential to consider the review process right from the start. Code that’s designed with the reviewer in mind results in more efficient and productive code reviews, ultimately speeding up the development lifecycle. | ||||||
|
||||||
- Prioritize Clean and Readable Code: Adopting consistent coding styles and best practices helps to ensure that everyone on the team can easily understand and maintain each other's code. It also streamlines onboarding for new team members and enhances collaboration across the board. | ||||||
- Keep PRs small and focused: Small PRs reduce review complexity, allow for faster feedback, and prevent blockers from piling up in the review pipeline. | ||||||
- Incorporate review time in planning: The time it takes for your code to be reviewed, feedback to be incorporated, and any revisions to be made can have a huge impact on a task's overall timeline. Accurately accounting for this in your task estimations ensures more realistic deadlines and helps prevent bottlenecks. | ||||||
|
||||||
## Preparing Code for Review | ||||||
|
||||||
As an author, preparing for code review doesn’t only mean writing clean and maintainable code, but also providing context for reviewers to quickly understand what your code is doing. | ||||||
Writing clear and comprehensive commit messages and adding relevant documentation and comments is particularly helpful when dealing with complex logic, as it gives reviewers additional insight and helps them follow your thought process. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Split this sentence up to make it more readable.
Suggested change
|
||||||
|
||||||
## Conducting Effective Code Reviews | ||||||
|
||||||
Effective code reviews require a balance between attention to detail and a focus on the bigger picture. Making sure that we allocate enough time to review a pull request is critical to avoid missing anything. | ||||||
|
||||||
### Code review etiquette | ||||||
|
||||||
Here are some key principles for effective and respectful code review communication: | ||||||
|
||||||
#### Be Constructive and Actionable | ||||||
|
||||||
Focus on feedback that helps the author improve by offering clear suggestions for how to address issues. Avoid vague comments and ensure that your feedback points toward a specific, actionable improvement. | ||||||
|
||||||
#### Balance Criticism with Praise | ||||||
|
||||||
Recognize what’s done well before highlighting areas that need improvement. Acknowledging strengths helps build confidence while making the author more receptive to constructive criticism. | ||||||
|
||||||
#### Focus on Clarity, Maintainability, and Correctness | ||||||
|
||||||
Ensure that the code adheres to team standards and is easy to read and maintain. It’s not just about fixing errors but also about making the code cleaner and more understandable for future developers. | ||||||
|
||||||
#### Recognize Effort and Intent | ||||||
|
||||||
Appreciate the time and thought put into the code, even when revisions are needed. A small note of recognition goes a long way in maintaining a collaborative and supportive team atmosphere. | ||||||
|
||||||
#### Encourage Collaboration | ||||||
|
||||||
Frame feedback in a way that invites open discussion and solutions. This creates a culture of shared decision-making and helps the author feel part of the process rather than simply receiving orders. | ||||||
B0berman marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
By adhering to these practices, you can create a code review culture that improves the code while fostering collaboration, mutual respect, and growth within the team. | ||||||
|
||||||
## Collaboration and Communication | ||||||
|
||||||
Good collaboration in code reviews starts before the code is written by anticipating complex changes or implementations and engaging the team in discussions early in the process. By aligning on the approach upfront, reviews become smoother and more efficient. | ||||||
|
||||||
The actual code review also goes beyond pointing out errors; it requires open communication and empathy. When providing feedback, focus on constructive and actionable comments that help the author understand the problem and how to address it. | ||||||
|
||||||
## Tools and Automation in Code Reviews | ||||||
|
||||||
Automation plays a key role in making code reviews more efficient and consistent. By integrating linters and static analysis tools, teams can enforce coding standards and catch errors automatically, allowing reviewers to focus more on logic and architecture. | ||||||
|
||||||
At Very Good Ventures we use our open source analysis tool, very_good_analysis. Very good analysis is a lint library heavily inspired by flutter_lints and pedantic (although it is deprecated now), but has a stricter set of lint rules. We believe these linting rules create a healthier, more scalable codebase. | ||||||
B0berman marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## Post-Review: Merging and Follow-Up | ||||||
|
||||||
Once the code review is complete, it’s important to make sure that all feedback has been properly addressed before merging. When merging, consider best practices like squashing commits to keep the history clean and concise. | ||||||
After merging, it’s helpful to follow up on any potential improvements or edge cases identified during the review, ensuring they are tracked and revisited in future iterations. | ||||||
B0berman marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## Conclusion | ||||||
|
||||||
Effective code reviews are essential for maintaining a high-quality, maintainable codebase while fostering a collaborative and efficient development process. By prioritizing clear communication, leveraging tools to automate mundane checks, and focusing on collaboration, teams can ensure a smoother, more effective development workflow. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the words lower case to stay consistent with the other points.