From f54d10e3ee363d7bfdcb76a98500b6ba4b47b1ce Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Sat, 9 Mar 2013 12:42:13 +0100 Subject: [PATCH 1/6] codingguidelines: Add else to single line if example --- developer_manual/general/codingguidelines.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/developer_manual/general/codingguidelines.rst b/developer_manual/general/codingguidelines.rst index d761c4da7..499bf86f4 100644 --- a/developer_manual/general/codingguidelines.rst +++ b/developer_manual/general/codingguidelines.rst @@ -118,6 +118,8 @@ Control Structures // single line if if($myVar === 'hi') { $myVar = 'ho'; + } else { + $myVar = 'bye'; } // long ifs @@ -289,6 +291,8 @@ Control Structures // single line if if(myVar === 'hi'){ myVar = 'ho'; + } else { + myVar = 'bye'; } // long ifs From db321e415a526b66438425f335374f59b486081c Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Sat, 9 Mar 2013 12:50:46 +0100 Subject: [PATCH 2/6] codingguidelines: Correct confusion of camelCase and PascalCase --- developer_manual/general/codingguidelines.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/developer_manual/general/codingguidelines.rst b/developer_manual/general/codingguidelines.rst index 499bf86f4..ac358de62 100644 --- a/developer_manual/general/codingguidelines.rst +++ b/developer_manual/general/codingguidelines.rst @@ -65,7 +65,7 @@ All API methods need to be marked with `PHPDoc Date: Sat, 9 Mar 2013 13:27:52 +0100 Subject: [PATCH 3/6] codingguidelines: Always use one space in front of opening braces --- developer_manual/general/codingguidelines.rst | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/developer_manual/general/codingguidelines.rst b/developer_manual/general/codingguidelines.rst index ac358de62..3f5cfd4a8 100644 --- a/developer_manual/general/codingguidelines.rst +++ b/developer_manual/general/codingguidelines.rst @@ -171,11 +171,11 @@ In general take a look at `JSLint `_ without th // set up namespace for sharing across multiple files var MyApp = MyApp || {}; - (function(window, $, exports){ + (function(window, $, exports) { 'use strict'; // if this function or object should be global, attach it to the namespace - exports.myGlobalFunction = function(params){ + exports.myGlobalFunction = function(params) { return params; }; @@ -189,7 +189,7 @@ In general take a look at `JSLint `_ without th // This does not only make everything global but you're programming // JavaScript like C functions with namespaces MyApp = { - myFunction:function(params){ + myFunction:function(params) { return params; }, ... @@ -204,17 +204,17 @@ This is how you'd do inheritance in JavaScript: .. code-block:: javascript // create parent object and bind methods to it - var ParentObject = function(name){ + var ParentObject = function(name) { this.name = name; }; - ParentObject.prototype.sayHello = function(){ + ParentObject.prototype.sayHello = function() { console.log(this.name); } // create childobject, call parents constructor and inherit methods - var ChildObject = function(name, age){ + var ChildObject = function(name, age) { ParentObject.call(this, name); this.age = age; }; @@ -222,7 +222,7 @@ This is how you'd do inheritance in JavaScript: ChildObject.prototype = Object.create(ParentObject.prototype); // overwrite parent method - ChildObject.prototype.sayHello = function(){ + ChildObject.prototype.sayHello = function() { // call parent method if you want to ParentObject.prototype.sayHello.call(this); console.log('childobject'); @@ -241,11 +241,11 @@ Use Pascal case for Objects, Camel case for functions and variables. .. code-block:: javascript - var MyObject = function(){ + var MyObject = function() { this.attr = "hi"; }; - var myFunction = function(){ + var myFunction = function() { return true; }; @@ -289,7 +289,7 @@ Control Structures .. code-block:: javascript // single line if - if(myVar === 'hi'){ + if(myVar === 'hi') { myVar = 'ho'; } else { myVar = 'bye'; @@ -299,17 +299,17 @@ Control Structures if( something === 'something' || condition2 && condition3 - ){ + ) { // your code } // for loop - for(var i=0; i<4; i++){ + for(var i=0; i<4; i++) { // your code } // switch - switch(value){ + switch(value) { case 'hi': // yourcode From 6a07c9429b51f67e767d062bfbda7bcbffd8f0b1 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Sat, 9 Mar 2013 13:32:10 +0100 Subject: [PATCH 4/6] codingguidelines: Add space between control keyword and opening parenthesis --- developer_manual/general/codingguidelines.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/developer_manual/general/codingguidelines.rst b/developer_manual/general/codingguidelines.rst index 3f5cfd4a8..7c921cea9 100644 --- a/developer_manual/general/codingguidelines.rst +++ b/developer_manual/general/codingguidelines.rst @@ -116,14 +116,14 @@ Control Structures Date: Sat, 9 Mar 2013 13:46:27 +0100 Subject: [PATCH 5/6] codingguidelines: Don't use a different style for loops --- developer_manual/general/codingguidelines.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/developer_manual/general/codingguidelines.rst b/developer_manual/general/codingguidelines.rst index 7c921cea9..be0879be8 100644 --- a/developer_manual/general/codingguidelines.rst +++ b/developer_manual/general/codingguidelines.rst @@ -109,7 +109,6 @@ Control Structures * Always use { } for one line ifs * Split long ifs into multiple lines * Always use break in switch statements and prevent a default block with warnings if it shouldn't be accessed -* Do not put spaces between variable and assignments in for loops .. code-block:: php @@ -131,7 +130,7 @@ Control Structures } // for loop - for ($i=0; $i<4; $i++) { + for ($i = 0; $i < 4; $i++) { // your code } @@ -282,7 +281,6 @@ Control Structures * Always use { } for one line ifs * Split long ifs into multiple lines * Always use break in switch statements and prevent a default block with warnings if it shouldn't be accessed -* Do not put spaces between variable and assignments in for loops **DO**: @@ -304,7 +302,7 @@ Control Structures } // for loop - for (var i=0; i<4; i++) { + for (var i = 0; i < 4; i++) { // your code } From 8ebf6650bb4f113632a98b8273def9fc9b33423e Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Sun, 10 Mar 2013 14:01:49 +0100 Subject: [PATCH 6/6] fix broken link --- developer_manual/app/externalapi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/developer_manual/app/externalapi.rst b/developer_manual/app/externalapi.rst index eba581767..d536037db 100644 --- a/developer_manual/app/externalapi.rst +++ b/developer_manual/app/externalapi.rst @@ -7,7 +7,7 @@ Introduction ------------ The external API inside ownCloud allows third party developers to access data provided by ownCloud apps. ownCloud version 5.0 will follow the `OCS v1.7 -specification `_ (draft). +specification `_ (draft). Usage -----