Coding Conventions

From wiki.gpii
Jump to: navigation, search

This page describes the conventions used in the coding of the GPII architecture.

General coding and commit guidelines

We are using Fluid's code and commit style guidelines

JSHint should be used on all code before being submitted or committed. It embodies the coding style described in Code Conventions for the JavaScript Programming Language. Indent is 4 spaces. Additional information about coding conventions, style, and other related topics can be found on the GPII Technical Standards page.

Namespacing in JavaScript:

The namespacing used in javascript follows the following convention:

gpii.[.platform].<component>[.implementation]

Where

  • [.platform] will be only be present if the component/implementation is platform specific. Any universal (cross platform) component will leave this out.
  • <component> is the component name that the code implements, and
  • [.implementation] is the (if any) specific implementation of the component. If only one implementation exists (or if it is the one main implementation) this is left out.

Examples:

gpii.linux.launchHandler.gsettings,
gpii.flowManager,
gpii.windows.settingsHandler.registry,

Derived from discussion on mailing list: http://lists.gpii.net/pipermail/architecture/2012-March/000105.html