wiki:CodingGuidelines/SubmittingPatches

Version 5 (modified by mmadia, 9 years ago) (diff)

added automatic whitespace, more formatting.

Submitting Patches

Expressing your desire to work on a ticket

By default, tickets are assigned to a default component owner. If you wish to work on an assigned ticket, simply comment on the ticket to inform the person. For the most part, this is to reduce the frustration of duplicating work.

Automatic whitespace cleanup

Sometimes you'll see a commit message of "Automatic whitespace cleanup. No functional change.", for example hrev36509. It is preferred for new code to not introduced unneeded whitespace. Luckily, there is an option in Pe to perform this for you automatically. Here is how to enable it from within Pe.

  • In the menu bar, select Window --> Preferences
  • Select "Files" from the left pane
  • enable [x] Discard trailing space
  • click [Apply]

Now, when you save & close a file, any stray spaces at the end of any lines will be automatically removed.

Preparing to create patch file

  • Create patches from within the HAIKU_TOP directory. This is the directory that contains configure and typically is haiku/ or buildtools/
    • svn stat will display which files are modified, added, or deleted
    • svn diff path/to/modified/files additional/paths/are/allowed/ > ~/DescriptiveName.patch
    • Note: If patching newly created files, svn add <path-to-new-file> needs to be done before svn diff

Submitting the patch

  • Plain text is preferred (not compressed files), as it allows easy viewing within the web browser.
  • The Coding Guidelines are expected to be followed when submitting patches.
    • Note: When patching existing files that do not follow our Coding Guidelines, it is preferable to apply the stylization to the entire file. If that is not possible, then conform to the pervading style being used.
  • checkstyle can be used to help identify violations
  • HaikuCodingGuidelinesVIM? integrate with vim to check style.

Be aware, that these style checker tools may generate false positives (eg, evaluating comments as coding violations) or may miss other violations.

Following up

Lastly and most importantly: once a developer reviews your submitted code, expect them to point out any and all flaws. This is standard procedure and is constructive criticism. Remember, we want to help you improve your coding abilities.

You may want to either subscribe to or read the haiku-commits mailing list archives. It is quite common for the discussion of recently committed code to occur on this list.