Skip to content
Meitar M edited this page Apr 8, 2016 · 2 revisions

WikiStyle guide

This document is the Better Angels style guide. It describes and standardizes various non-technical aspects of our projects in order to improve communication between Better Angels contributors and, in some cases, the general public.

Version strings

Version strings are patterns that concisely describe the state of a document, such as program source code or a document, independent from the date on which it was created.

Version strings should adhere to the latest current SemVer specification, optionally prefixed with a single v character.

Good examples:

  • 1.2.3
  • v1.2.3

Bad examples:

  • v.1.2.3
  • v 1.2.3

Source code

In the absence of more specific style guidelines for specific Better Angels projects (look for a page called Style guide in the given project's wiki), use the following defaults.

Indentation

Indent blocks by four (4) spaces.

Brace position

Place opening braces in C-style languages at the end of the same line on which the block begins.

Function and method signatures

Insert one space between the end of a function or method name and the start of its parameter list, as well as one space after the parameter list.

Calling functions and methods

In C-style languages, there should be no space between the function name and its parenthesized parameter list when calling a function or method.

Source code examples

Good example:

<?php
class HelloWorld { // Opening braces on same line.
    public function __construct () { // Spaces surround parameter list parenthesis in method signature
        print "Hello world!";
    }
}
new HelloWorld(); // Call a method without spaces before parenthesis.

Bad example:

<?php
class HelloWorld
{
  public function __construct()
  {
    print "Hello world!";
  }
}
new HelloWorld ();