Coding Standards

From stoney cloud
Revision as of 10:13, 6 September 2013 by Michael (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Jump to: navigation, search

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

File Headers

PHP

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

<?php
/*
 * Copyright (C) 2013 stepping stone GmbH
 *                    Switzerland
 *                    http://www.stepping-stone.ch
 *                    support@stepping-stone.ch
 *
 * Authors:
 *  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
 * Licence.
 * You may obtain a copy of the Licence at:
 *
 * http://www.osor.eu/eupl
 *
 * 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.
 *
 * $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) 2013 stepping stone GmbH
#                    Switzerland
#                    http://www.stepping-stone.ch
#                    support@stepping-stone.ch
#
# Authors:
#  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
# Licence.
# You may obtain a copy of the Licence at:
#
# http://www.osor.eu/eupl
#
# 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.
#
################################################################################

Perl

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

#!/usr/bin/perl -w
#
# Copyright (C) 2013 stepping stone GmbH
#                    Switzerland
#                    http://www.stepping-stone.ch
#                    support@stepping-stone.ch
#
# Authors:
#  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
# Licence.
# You may obtain a copy of the Licence at:
#
# http://www.osor.eu/eupl
#
# 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.
#
# $Id$
#
#

Config

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

# Copyright (C) 2013 stepping stone GmbH
#                    Switzerland
#                    http://www.stepping-stone.ch
#                    support@stepping-stone.ch
#
# Authors:
#  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
# Licence.
# You may obtain a copy of the Licence at:
#
# http://www.osor.eu/eupl
#
# 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.
#
# $Id$
#
#