Coding style - General practices

  • Don’t put an else right after a return (or a break). Delete the else, it’s unnecessary and increases indentation level.
  • Don’t leave debug printfs or dumps lying around.
  • Use JavaDoc-style comments.
  • When fixing a problem, check to see if the problem occurs elsewhere in the same file, and fix it everywhere if possible.
  • End the file with a newline. Make sure your patches don’t contain files with the text “no newline at end of file” in them.
  • Declare local variables as near to their use as possible.
  • For new files, be sure to use the right license boilerplate, per our license policy.