Skip to content

Instantly share code, notes, and snippets.

@techhazard
Forked from Attumm/Code_Review.md
Last active August 13, 2020 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techhazard/4dbc6ee84ad34bbc47da64315a59cffc to your computer and use it in GitHub Desktop.
Save techhazard/4dbc6ee84ad34bbc47da64315a59cffc to your computer and use it in GitHub Desktop.
Code_Review.md

CODE REVIEW GUIDE

Technical

Read the code like a compiler

Read each line of code line by line. Never assume, always check.

Trust but verify.
  • When in doubt create a dissuscion to check.
  • Learn the list of code smells by heart.
Simple is better then complex.

If something is to hard to understand, maybe it's too hard to justify supporting it in the future.

Follow checklist

This is a good example of a code review checklist

Stay profesional

Use Egoless programming

Live by the ten commandments of egoless programming. It will be great for yourself and the team.

Knowlegde
  • As reviewer it is not expected that you have all the answers.
  • Don't assume you know more than writer of the code, It could be the Dunning-Kruger effect (You think you are more knowledgable than you actually are)
  • Don't assume you know less then the writer of the code. It could be Imposter Syndrome (You know more than you think you do)
  • If something is unclear ask questions, maybe some comments in the code could help the next person reading the code.

Make sure your comments don't fall under law of triviality. If the only thing you can suggest is change of variable name or something similarly small, maybe it's not important enough to change.

Layout of great comment

A great comment has three parts.

  1. Problem statement, include why it's a problem.
  2. Possible Solution, why does this solve the problem, and how good is the suggestion?
  3. Link to documentation / stackoverflow for more information.
Example Comment
This project is a RESTful json api (atleast it tries to be :)), other formats if needed.
Returning a string directly (like you did here with "bar") instead of a json object, will break with the rest of the app.

To quote [The zen of Python](https://www.python.org/dev/peps/pep-0020/):

> Special cases aren't special enough to break the rules.

Instead of returning a string, you should return an object like so:

   return jsonify({"foo": "bar"})

For more information about our RESTful app see the link to our documentation: http://mycompany.com/docs/restful-api.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment