this post was submitted on 23 Nov 2023
22 points (100.0% liked)

Code Review

155 readers
1 users here now

Welcome to the programming.dev code review community! This is a place where you can review other people's code or request reviews on your own

Before posting please read the sections below (click on one to expand it)

What is a code review?

What is a code review?

A code review is a process where people who did not write a piece of code look over it to find errors, suggest improvements, and make sure it follows coding standards

When doing a code review look for these aspects:

  1. Correctness: Does the code behave as expected and meet the requirements?
  2. Readability: Is the code easy to understand and maintain?
  3. Efficiency: Are there more efficient ways to accomplish the same task?
  4. Best Practices: Does the code follow established coding standards and best practices?
  5. Security: Are there potential security vulnerabilities?
  6. Scalability: Will the code perform well as the application scales?

Post Guidelines

Guidelines

  • Put the programming language you used for your code in square brackets ahead of your post title. e.g. [Python], [React], [C#], etc.
  • Provide a link to a spot where people can view your code (e.g. github, etc.) in your post body
  • In your post title put a small description of what the thing is that you want reviewed and then you can expand on that in more details if you want in your post body

Rules

Rules

Any code review requests you post after your first must be done after you have reviewed two other people's code (and then you need another two for each request after that as well).

Youre free to post your first code review request in this community though without needing to follow this


Credits

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient




Wormhole

[email protected]

founded 1 year ago
MODERATORS
 

Source forges like Gitlab, Gitea, Forgjo, Github, and others do not allow directly leaving comments on code. However, they all do allow leaving comments on pull/merge requests and individual commits. This unfortunately doesn't work for snippets like Gitlab Snippets, Github Gists, etc. .

We can however use these to our advantage and use workarounds in order to make certain parts of our code reviewable:

Snippets

Create a repository to host your snippets (if you don't have one already), add your snippet of code as one commit to the repository (can be in a throwaway branch, the master branch, whatever). Share that commit link!

Larger changes

If you have code that belongs together, it is already in your repository, and is spread out over multiple commits, fear not! Once again, you can use the power of temporary branches. With these methods you can even have your entire repo reviewed.

A commit to review

Create a new branch, delete the parts of the code you want reviewed, create a revert commit, and share that link!

A PR to review

This requires 2 branches. If you've read the steps above, you already know where this is going.

Create a branch (deleted), delete the code and commit it. Create a new branch (revert) from this point and revert the previous commit. Now you can push both branches to your source forge and create a new merge request to merge revert into deleted.


If you have other tips, share them!

you are viewing a single comment's thread
view the rest of the comments
[–] onlinepersona 1 points 11 months ago

That's true, but the person has to show which code to review. If it's the whole project or a single file, that's definitely possible, but multiple files or sections of code become more tricky then. "please review this file from line 40-100, that file from line 20-45, ..."