wiki:CodingGuidelines/SubmittingPatches

Version 7 (modified by kallisti5, 12 years ago) ( diff )

change svn references to git references

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 the haiku/ or buildtools/ branch.
    • git status will display which files are modified, added, or deleted
  • Perform a git diff...
    • git diff > ~/DescriptiveName.patch
    • git diff or/specify/per/file or/specify/directory/ > ~/DescriptiveName.patch
  • Note: If patching newly created files, git add <path-to-new-file> needs to be done before git 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.
  • When submitting the patch to a ticket, check the 'patch' check box in the 'Attachment Flags'

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.

Note: See TracWiki for help on using the wiki.