Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

PR Best Practices

Dinu Kumarasiri edited this page Nov 27, 2016 · 5 revisions

PR Best Practices

Source Code Comments

When you are creating a new class or a method, do not forget to add class/method comments according to the following structure.

Class comments

 /*
  * Proper comment on the class like what it does and 
  * if there are design level description
  * 
  * @author <Authorname>
  * @since 2016-03-29 
  */

Method comments

/**
 * Returns an Image object that can then be painted on the screen. 
 * The url argument must specify an absolute {@link URL}. The name
 * argument is a specifier that is relative to the url argument. 
 * <p>
 * This method always returns immediately, whether or not the 
 * image exists. When this applet attempts to draw the image on
 * the screen, the data will be loaded. The graphics primitives 
 * that draw the image will incrementally paint on the screen. 
 *
 * @param  url  an absolute URL giving the base location of the image
 * @param  name the location of the image, relative to the url argument
 * @return      the image at the specified URL
 * @see         Image
 */
 public Image getImage(URL url, String name) {
        try {
            return getImage(new URL(url, name));
        } catch (MalformedURLException e) {
            return null;
        }
 }

Adding images

* res/ -> drawable/ Bitmap files (.png, .9.png, .jpg, .gif) or XML files that are compiled into the following drawable resource subtypes:

                 -  Bitmap files
                 -  Nine-Patches (re-sizable bitmaps)
                 -  State lists
                 -  Shapes
                 -  Animation drawables
                 -  Other drawables 

* res/ -> mipmap/ Drawable files for different launcher icon densities. 

Commits

  1. Use meaningful commit messages
  2. Do not over commit. (Do not include multiple commits for a small change)
  3. Do not add the merge commits to the PR
  4. Usually use a single commit for a single issue, unless the issues are related or contain a significant code change.
  5. There are certain kind of files you do not add to source control. If you already don't know about them, please do a quick search and find them and remove them from your commit.

General

  1. When sending a PR have an appropriate title referencing the issue which it solves.
  2. If it is a UI change, add a screen shot of the new/fixed UI.
  3. Have a short description on what has gone wrong (like a root cause analysis and description of the fix), if that information is not already present in the issue.
  4. Do not ask us to review it in a separate comment. We will review it anyway.