Difference between revisions of "Coding Conventions"

From wiki.gpii
Jump to: navigation, search
(General coding and commit guidelines: JSHint as replacement for Fluid's JSLint version)
(General coding and commit guidelines)
 
Line 5: Line 5:
 
We are using [http://wiki.fluidproject.org/display/fluid/Coding+and+Commit+Standards#CodingandCommitStandards-CodeConventions Fluid's code and commit style guidelines]
 
We are using [http://wiki.fluidproject.org/display/fluid/Coding+and+Commit+Standards#CodingandCommitStandards-CodeConventions Fluid's code and commit style guidelines]
  
[http://swarm.fluidproject.org/jslint Fluid's instance of JSLint] should be used on all code before being submitted or committed. It embodies the coding style described in [http://javascript.crockford.com/code.html Code Conventions for the JavaScript Programming Language]. Indent is 4 spaces.
+
[http://wiki.fluidproject.org/display/fluid/Coding+and+Commit+Standards#CodingandCommitStandards-JavaScript JSHint] should be used on all code before being submitted or committed. It embodies the coding style described in [http://javascript.crockford.com/code.html 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.
 
 
'''Note''': The project is in the process of switching to '''[http://jshint.com/ JSHint]'''. (See the [http://lists.gpii.net/pipermail/architecture/2014-April/002149.html discussion that started on 11 April 2014].)
 
  
 
=== Namespacing in JavaScript: ===
 
=== Namespacing in JavaScript: ===

Latest revision as of 17:41, 8 May 2015

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