Skip to content
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

Create code-review-guidelines.md #2282

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions code-review-guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Learning to Write Good Code Reviews

![charlytoc_Image_of_a_diverse_group_of_developers_discussing_aro_7773fc51-0eb9-4693-90fa-b266a820ceb9](https://github.com/breatheco-de/content/assets/107764250/0e8083c5-57c5-485d-9761-ab9431477d4c)

### What is a Code Review?

A code review is an essential part of the learning process for students. It's a way to ensure that students are following good coding practices as they work on projects. When using version control systems like Git, students typically make multiple commits as they modify their files.
As mentors, it's our responsibility to review this modified code and identify areas where the student may not be following best practices. This process helps students improve their coding skills and learn from their mistakes.
This process is easy to do using Rigobot as you can see [here](https://github.com/breatheco-de/content/blob/master/how-to-review-code.md)


### Key Takeaways

* A code review is a crucial part of the learning process for students.
* It ensures that students are following good coding practices as they work on projects.
* Version control systems like Git help track changes made to files throughout the project development process.
* Mentors play a key role in reviewing modified code and providing feedback on best practices.

### Common Guidelines for Conducting Code Reviews
![charlytoc_Close-up_image_of_a_screen_showing_code_with_inline_c_f14f9948-2321-49c3-955c-d86fc1bb3676](https://github.com/breatheco-de/content/assets/107764250/0d9351ff-e622-4c4d-9676-8a3ae0356c93)

#### 1. **Understand the Context**
- Before starting the review, understand the purpose of the code changes. This helps in providing relevant and constructive feedback.

#### 2. **Check for Code Functionality**
- Ensure the code works as intended and meets the requirements specified in the task description.

#### 3. **Readability and Maintainability**
- Review the code for clarity and simplicity. Good code should be easy to read and understand by others.
- Check for consistent naming conventions and coding standards.
![Comments](https://github.com/breatheco-de/content/assets/107764250/daa78317-caec-4e38-9a0e-9a8180e6062b)

#### 4. **Optimization**
- Look for any inefficient code segments that can be optimized without compromising readability.

#### 5. **Error Handling**
- Ensure that the code properly handles possible errors or exceptions.

#### 6. **Security**
- Check for any security vulnerabilities, such as SQL injection or cross-site scripting (XSS).

#### 7. **Testing**
- Verify that there are adequate unit tests and that they cover edge cases.
- Check if the tests are meaningful and not just for increasing coverage metrics.

#### 8. **Documentation**
- Ensure that the code is well-documented, including comments in complex areas, to help future maintainers understand the logic.

#### 9. **Peer Feedback**
- Encourage peer-to-peer code reviews to foster a collaborative environment and diverse viewpoints.

#### 10. **Use Tools**
- Utilize code review tools and static code analyzers to automate some aspects of the review process. You can use Rigobot for this process.

#### 11. **Constructive Feedback**
- Provide feedback that is specific, actionable, and respectful. Focus on the code and not the coder.

#### 12. **Follow-up**
- Ensure that any critical issues are addressed and that there is a follow-up review if necessary.


By following these guidelines and utilizing Rigobot, code reviews can become a powerful part of the development process, enhancing both the quality of the code and the skills of the developers involved.
Loading