Difference between revisions of "Coding Standards"
[unchecked revision] | [unchecked revision] |
(→File Headers) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 18: | Line 18: | ||
== Scripts of Programmes consisting of one file == | == Scripts of Programmes consisting of one file == | ||
<pre> | <pre> | ||
− | Copyright (C) | + | Copyright (C) 2015 stepping stone GmbH |
Switzerland | Switzerland | ||
http://www.stepping-stone.ch | http://www.stepping-stone.ch | ||
Line 43: | Line 43: | ||
== Scripts of Programmes consisting of multiple files == | == Scripts of Programmes consisting of multiple files == | ||
<pre> | <pre> | ||
− | Copyright (C) | + | Copyright (C) 2015 stepping stone GmbH |
Switzerland | Switzerland | ||
http://www.stepping-stone.ch | http://www.stepping-stone.ch | ||
Line 78: | Line 78: | ||
<?php | <?php | ||
/* | /* | ||
− | * Copyright (C) | + | * Copyright (C) 2015 stepping stone GmbH |
* Switzerland | * Switzerland | ||
* http://www.stepping-stone.ch | * http://www.stepping-stone.ch | ||
Line 101: | Line 101: | ||
* License along with stoney cloud. | * License along with stoney cloud. | ||
* If not, see <http://www.gnu.org/licenses/>. | * If not, see <http://www.gnu.org/licenses/>. | ||
− | |||
− | |||
− | |||
* | * | ||
*/ | */ | ||
Line 117: | Line 114: | ||
################################################################################ | ################################################################################ | ||
# | # | ||
− | # Copyright (C) | + | # Copyright (C) 2015 stepping stone GmbH |
# Switzerland | # Switzerland | ||
# http://www.stepping-stone.ch | # http://www.stepping-stone.ch | ||
Line 140: | Line 137: | ||
# License along with stoney cloud. | # License along with stoney cloud. | ||
# If not, see <http://www.gnu.org/licenses/>. | # If not, see <http://www.gnu.org/licenses/>. | ||
− | |||
− | |||
− | |||
# | # | ||
################################################################################ | ################################################################################ | ||
Line 153: | Line 147: | ||
#!/usr/bin/perl -w | #!/usr/bin/perl -w | ||
# | # | ||
− | # Copyright (C) | + | # Copyright (C) 2015 stepping stone GmbH |
# Switzerland | # Switzerland | ||
# http://www.stepping-stone.ch | # http://www.stepping-stone.ch | ||
Line 176: | Line 170: | ||
# License along with stoney cloud. | # License along with stoney cloud. | ||
# If not, see <http://www.gnu.org/licenses/>. | # If not, see <http://www.gnu.org/licenses/>. | ||
− | |||
− | |||
− | |||
# | # | ||
</source> | </source> | ||
Line 186: | Line 177: | ||
<pre> | <pre> | ||
− | # Copyright (C) | + | # Copyright (C) 2015 stepping stone GmbH |
# Switzerland | # Switzerland | ||
# http://www.stepping-stone.ch | # http://www.stepping-stone.ch | ||
Line 209: | Line 200: | ||
# License along with stoney cloud. | # License along with stoney cloud. | ||
# If not, see <http://www.gnu.org/licenses/>. | # If not, see <http://www.gnu.org/licenses/>. | ||
− | |||
− | |||
− | |||
# | # | ||
</pre> | </pre> | ||
+ | == JavaScript == | ||
+ | Whereat Hans Mustermann <hans.mustermann@stepping-stone.ch> needs to be replaced by the actual author. | ||
+ | |||
+ | <source lang="javascript"> | ||
+ | /* | ||
+ | * Copyright (C) 2015 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/>. | ||
+ | * | ||
+ | */ | ||
+ | </source> | ||
[[Category:Development]] | [[Category:Development]] |
Latest revision as of 15:52, 9 January 2015
Contents
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) 2015 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) 2015 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) 2015 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/>. * */
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) 2015 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/>. # ################################################################################
Perl
Whereat Hans Mustermann <hans.mustermann@stepping-stone.ch> needs to be replaced by the actual author.
#!/usr/bin/perl -w # # Copyright (C) 2015 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/>. #
Config
Whereat Hans Mustermann <hans.mustermann@stepping-stone.ch> needs to be replaced by the actual author.
# Copyright (C) 2015 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/>. #
JavaScript
Whereat Hans Mustermann <hans.mustermann@stepping-stone.ch> needs to be replaced by the actual author.
/*
* Copyright (C) 2015 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/>.
*
*/