Difference between revisions of "Coding Standards"

From stoney cloud
Jump to: navigation, search
[unchecked revision][unchecked revision]
(Created page with "= Common Rules = * Use spaces and not tabs wherever possible. * Indentation is 4 spaces (and set tab width in your environment/editor to 4 spaces). == vim Minimal Configurati...")
 
(File Headers)
Line 12: Line 12:
 
set autoindent
 
set autoindent
 
</pre>
 
</pre>
 +
 +
= Licence =
 +
We have decided to release all our open sourced software under the [[agpl-3.0.txt | GNU Affero General Public License]] (Version 3, 19 November 2007).
 +
 +
== Scripts of Programmes consisting of one file ==
 +
<pre>
 +
Copyright (C) 2014 stepping stone GmbH
 +
                    Switzerland
 +
                    http://www.stepping-stone.ch
 +
                    support@stepping-stone.ch
 +
 
 +
Authors:
 +
  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 +
 +
This program is free software: you can redistribute it and/or
 +
modify it under the terms of the GNU Affero General Public
 +
License as published  by the Free Software Foundation, version
 +
3 of the License.
 +
 +
This program is distributed in the hope that it will be useful,
 +
but WITHOUT ANY WARRANTY; without even the implied warranty of
 +
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +
GNU Affero General Public License for more details.
 +
 +
You should have received a copy of the GNU Affero General Public
 +
License  along with this program.
 +
If not, see <http://www.gnu.org/licenses/>.
 +
</pre>
 +
 +
== Scripts of Programmes consisting of multiple files ==
 +
<pre>
 +
Copyright (C) 2014 stepping stone GmbH
 +
                    Switzerland
 +
                    http://www.stepping-stone.ch
 +
                    support@stepping-stone.ch
 +
 
 +
Authors:
 +
  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 +
 +
This file is part of the stoney cloud.
 +
 +
stoney cloud is free software: you can redistribute it and/or
 +
modify it under the terms of the GNU Affero General Public
 +
License as published  by the Free Software Foundation, version
 +
3 of the License.
 +
 +
stoney cloud is distributed in the hope that it will be useful,
 +
but WITHOUT ANY WARRANTY; without even the implied warranty of
 +
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +
GNU Affero General Public License for more details.
 +
 +
You should have received a copy of the GNU Affero General Public
 +
License  along with stoney cloud.
 +
If not, see <http://www.gnu.org/licenses/>.
 +
</pre>
 +
  
 
= File Headers =
 
= File Headers =
 +
The following file header examples presume, that your scripts of programmes consist of multiple files.
  
 
== PHP ==
 
== PHP ==
Line 21: Line 78:
 
<?php
 
<?php
 
/*
 
/*
  * Copyright (C) 2013 stepping stone GmbH
+
  * Copyright (C) 2014 stepping stone GmbH
 
  *                    Switzerland
 
  *                    Switzerland
 
  *                    http://www.stepping-stone.ch
 
  *                    http://www.stepping-stone.ch
 
  *                    support@stepping-stone.ch
 
  *                    support@stepping-stone.ch
  *
+
  *
 
  * Authors:
 
  * Authors:
 
  *  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 
  *  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 
* Licensed under the EUPL, Version 1.1.
 
 
  *
 
  *
  * You may not use this work except in compliance with the
+
  * This file is part of the stoney cloud.
  * Licence.
+
  *
  * You may obtain a copy of the Licence at:
+
  * stoney cloud is free software: you can redistribute it and/or
 +
* modify it under the terms of the GNU Affero General Public
 +
* License as published  by the Free Software Foundation, version
 +
* 3 of the License.
 
  *
 
  *
  * http://www.osor.eu/eupl
+
  * stoney cloud is distributed in the hope that it will be useful,
 +
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 +
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 +
* GNU Affero General Public License for more details.
 
  *
 
  *
  * Unless required by applicable law or agreed to in
+
  * You should have received a copy of the GNU Affero General Public
  * writing, software distributed under the Licence is
+
  * License along with stoney cloud.
  * distributed on an "AS IS" basis,
+
  * If not, see <http://www.gnu.org/licenses/>.
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+
* express or implied.
+
* See the Licence for the specific language governing
+
* permissions and limitations under the Licence.
+
 
  *
 
  *
 
  * $Id$
 
  * $Id$
 +
*
 
  *
 
  *
 
  */
 
  */
Line 59: Line 117:
 
################################################################################
 
################################################################################
 
#
 
#
# Copyright (C) 2013 stepping stone GmbH
+
# Copyright (C) 2014 stepping stone GmbH
 
#                    Switzerland
 
#                    Switzerland
 
#                    http://www.stepping-stone.ch
 
#                    http://www.stepping-stone.ch
 
#                    support@stepping-stone.ch
 
#                    support@stepping-stone.ch
#
+
#
 
# Authors:
 
# Authors:
 
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 
# Licensed under the EUPL, Version 1.1.
 
 
#
 
#
# You may not use this work except in compliance with the
+
# This file is part of the stoney cloud.
# Licence.
+
# You may obtain a copy of the Licence at:
+
 
#
 
#
# http://www.osor.eu/eupl
+
# stoney cloud is free software: you can redistribute it and/or
 +
# modify it under the terms of the GNU Affero General Public
 +
# License as published  by the Free Software Foundation, version
 +
# 3 of the License.
 +
#
 +
# stoney cloud is distributed in the hope that it will be useful,
 +
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +
# GNU Affero General Public License for more details.
 +
#
 +
# You should have received a copy of the GNU Affero General Public
 +
# License  along with stoney cloud.
 +
# If not, see <http://www.gnu.org/licenses/>.
 +
#
 +
# $Id$
 
#
 
#
# Unless required by applicable law or agreed to in
 
# writing, software distributed under the Licence is
 
# distributed on an "AS IS" basis,
 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 
# express or implied.
 
# See the Licence for the specific language governing
 
# permissions and limitations under the Licence.
 
 
#
 
#
 
################################################################################
 
################################################################################
Line 92: Line 153:
 
#!/usr/bin/perl -w
 
#!/usr/bin/perl -w
 
#
 
#
# Copyright (C) 2013 stepping stone GmbH
+
# Copyright (C) 2014 stepping stone GmbH
 
#                    Switzerland
 
#                    Switzerland
 
#                    http://www.stepping-stone.ch
 
#                    http://www.stepping-stone.ch
 
#                    support@stepping-stone.ch
 
#                    support@stepping-stone.ch
#
+
#
 
# Authors:
 
# Authors:
 
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 
# Licensed under the EUPL, Version 1.1.
 
 
#
 
#
# You may not use this work except in compliance with the
+
# This file is part of the stoney cloud.
# Licence.
+
# You may obtain a copy of the Licence at:
+
 
#
 
#
# http://www.osor.eu/eupl
+
# stoney cloud is free software: you can redistribute it and/or
 +
# modify it under the terms of the GNU Affero General Public
 +
# License as published  by the Free Software Foundation, version
 +
# 3 of the License.
 
#
 
#
# Unless required by applicable law or agreed to in
+
# stoney cloud is distributed in the hope that it will be useful,
# writing, software distributed under the Licence is
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# distributed on an "AS IS" basis,
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+
# GNU Affero General Public License for more details.
# express or implied.
+
#
# See the Licence for the specific language governing
+
# You should have received a copy of the GNU Affero General Public
# permissions and limitations under the Licence.
+
# License  along with stoney cloud.
 +
# If not, see <http://www.gnu.org/licenses/>.
 
#
 
#
 
# $Id$
 
# $Id$
Line 125: Line 186:
  
 
<pre>
 
<pre>
# Copyright (C) 2013 stepping stone GmbH
+
# Copyright (C) 2014 stepping stone GmbH
 
#                    Switzerland
 
#                    Switzerland
 
#                    http://www.stepping-stone.ch
 
#                    http://www.stepping-stone.ch
 
#                    support@stepping-stone.ch
 
#                    support@stepping-stone.ch
#
+
#
 
# Authors:
 
# Authors:
 
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 
# Licensed under the EUPL, Version 1.1.
 
 
#
 
#
# You may not use this work except in compliance with the
+
# This file is part of the stoney cloud.
# Licence.
+
#
# You may obtain a copy of the Licence at:
+
# stoney cloud is free software: you can redistribute it and/or
 +
# modify it under the terms of the GNU Affero General Public
 +
# License as published  by the Free Software Foundation, version
 +
# 3 of the License.
 
#
 
#
# http://www.osor.eu/eupl
+
# stoney cloud is distributed in the hope that it will be useful,
 +
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 +
# GNU Affero General Public License for more details.
 
#
 
#
# Unless required by applicable law or agreed to in
+
# You should have received a copy of the GNU Affero General Public
# writing, software distributed under the Licence is
+
# License  along with stoney cloud.
# distributed on an "AS IS" basis,
+
# If not, see <http://www.gnu.org/licenses/>.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+
# express or implied.
+
# See the Licence for the specific language governing
+
# permissions and limitations under the Licence.
+
 
#
 
#
 
# $Id$
 
# $Id$

Revision as of 20:40, 21 April 2014

Common Rules

  • Use spaces and not tabs wherever possible.
  • Indentation is 4 spaces (and set tab width in your environment/editor to 4 spaces).

vim Minimal Configuration

set tabstop=4
set expandtab
" By default, go for an indent of 4
set shiftwidth=4
" Do clever indent things. Don't make a # force column zero.
set autoindent

Licence

We have decided to release all our open sourced software under the GNU Affero General Public License (Version 3, 19 November 2007).

Scripts of Programmes consisting of one file

 Copyright (C) 2014 stepping stone GmbH
                    Switzerland
                    http://www.stepping-stone.ch
                    support@stepping-stone.ch
  
 Authors:
  Hans Mustermann <hans.mustermann@stepping-stone.ch>

 This program is free software: you can redistribute it and/or
 modify it under the terms of the GNU Affero General Public 
 License as published  by the Free Software Foundation, version
 3 of the License.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Affero General Public License for more details.

 You should have received a copy of the GNU Affero General Public
 License  along with this program.
 If not, see <http://www.gnu.org/licenses/>.

Scripts of Programmes consisting of multiple files

 Copyright (C) 2014 stepping stone GmbH
                    Switzerland
                    http://www.stepping-stone.ch
                    support@stepping-stone.ch
  
 Authors:
  Hans Mustermann <hans.mustermann@stepping-stone.ch>

 This file is part of the stoney cloud.

 stoney cloud is free software: you can redistribute it and/or
 modify it under the terms of the GNU Affero General Public 
 License as published  by the Free Software Foundation, version
 3 of the License.

 stoney cloud is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Affero General Public License for more details.

 You should have received a copy of the GNU Affero General Public
 License  along with stoney cloud.
 If not, see <http://www.gnu.org/licenses/>.


File Headers

The following file header examples presume, that your scripts of programmes consist of multiple files.

PHP

Whereat Hans Mustermann <hans.mustermann@stepping-stone.ch> needs to be replaced by the actual author.

<?php
/*
 * Copyright (C) 2014 stepping stone GmbH
 *                    Switzerland
 *                    http://www.stepping-stone.ch
 *                    support@stepping-stone.ch
 *  
 * Authors:
 *  Hans Mustermann <hans.mustermann@stepping-stone.ch>
 *
 * This file is part of the stoney cloud.
 *
 * stoney cloud is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public 
 * License as published  by the Free Software Foundation, version
 * 3 of the License.
 *
 * stoney cloud is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License  along with stoney cloud.
 * If not, see <http://www.gnu.org/licenses/>.
 *
 * $Id$
 *
 *
 */

Bash

Whereat Hans Mustermann <hans.mustermann@stepping-stone.ch> needs to be replaced by the actual author.

#!/bin/bash
################################################################################
# <FILE-NAME>.sh - <SHORT DESCRIPTION>
################################################################################
#
# Copyright (C) 2014 stepping stone GmbH
#                    Switzerland
#                    http://www.stepping-stone.ch
#                    support@stepping-stone.ch
#  
# Authors:
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
#
# This file is part of the stoney cloud.
#
# stoney cloud is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public 
# License as published  by the Free Software Foundation, version
# 3 of the License.
#
# stoney cloud is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License  along with stoney cloud.
# If not, see <http://www.gnu.org/licenses/>.
#
# $Id$
#
#
################################################################################

Perl

Whereat Hans Mustermann <hans.mustermann@stepping-stone.ch> needs to be replaced by the actual author.

#!/usr/bin/perl -w
#
# Copyright (C) 2014 stepping stone GmbH
#                    Switzerland
#                    http://www.stepping-stone.ch
#                    support@stepping-stone.ch
#  
# Authors:
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
#
# This file is part of the stoney cloud.
#
# stoney cloud is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public 
# License as published  by the Free Software Foundation, version
# 3 of the License.
#
# stoney cloud is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License  along with stoney cloud.
# If not, see <http://www.gnu.org/licenses/>.
#
# $Id$
#
#

Config

Whereat Hans Mustermann <hans.mustermann@stepping-stone.ch> needs to be replaced by the actual author.

# Copyright (C) 2014 stepping stone GmbH
#                    Switzerland
#                    http://www.stepping-stone.ch
#                    support@stepping-stone.ch
#  
# Authors:
#  Hans Mustermann <hans.mustermann@stepping-stone.ch>
#
# This file is part of the stoney cloud.
#
# stoney cloud is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public 
# License as published  by the Free Software Foundation, version
# 3 of the License.
#
# stoney cloud is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License  along with stoney cloud.
# If not, see <http://www.gnu.org/licenses/>.
#
# $Id$
#
#