Skip to content

Instantly share code, notes, and snippets.

@hhimanshu
Created May 31, 2014 21:21
Show Gist options
  • Save hhimanshu/9078bdef0ccefd7f2aa2 to your computer and use it in GitHub Desktop.
Save hhimanshu/9078bdef0ccefd7f2aa2 to your computer and use it in GitHub Desktop.
Code Review Guideline

Code Review Guidelines

In spirit of keeping our home (read codebase) clean and organized, we must have same protocol to talk.

Every pull request opened on the project needs to be scruitinzed on mutiple aspects. For example,

  • How code is designed
  • How code is formatted.
  • How code structure is created
  • What is the complexity of code analysis
  • How well is it tested

Based on the code reviews done so far, following is the list of items that each pull request must adhere. As time goes on and we learn more, we add more ideas to the list.

  1. Use of loggers if really needed.No System.out.println() in codebase.
  2. Use of final wherever possible. Aim for Immutability
  3. Use of @Nonnull/@Nullable annotations to clearly define the contract
  4. Avoid commented out code. If its commented, its not needed, lets remove it
  5. Test judiciously. Assert as much as we could
  6. Unnecessary use of variables. Create variables only when they are needed more than once.
  7. Class names CamelCase. no exceptions in abbreviations
  8. Narrow the scope of variables. Declare them just where you use them
  9. Code Formatting issues. Please format the code as per the codebase in origin/master
  10. Use of Joda-Time for Date and Time. Read why
  11. Remove Dead Code. If we ever see any piece of code not being used, lets delete it
  12. Remove imports that are not needed. Your IDE could surely help. I know for IntelliJ IDEA

Let's make sure that every pull request we open atleast has the above attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment