diff options
author | friendica <info@friendica.com> | 2013-10-15 16:52:57 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-10-15 16:52:57 -0700 |
commit | 9cb3a44177115e81a9a1923fd0e00386748a6582 (patch) | |
tree | 35c4aff40c883ad0f8c88087a5d07955a72ffdc9 | |
parent | 100043da38af9e1f01a3943e5bc996ab5311894a (diff) | |
download | volse-hubzilla-9cb3a44177115e81a9a1923fd0e00386748a6582.tar.gz volse-hubzilla-9cb3a44177115e81a9a1923fd0e00386748a6582.tar.bz2 volse-hubzilla-9cb3a44177115e81a9a1923fd0e00386748a6582.zip |
add code-style guidelines. These aren't laws or rules, they are guidelines.
-rw-r--r-- | doc/Developers.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/Developers.md b/doc/Developers.md index e4905ccd1..4b339dee9 100644 --- a/doc/Developers.md +++ b/doc/Developers.md @@ -27,3 +27,27 @@ Please pull in any changes from the project repository and merge them with your Also - **test your changes**. Don't assume that a simple fix won't break something else. If possible get an experienced Red developer to review the code. Further documentation can be found at the Github wiki pages at: [https://github.com/friendica/red/wiki](https://github.com/friendica/red/wiki). + +**Licensing** + +All code contributed to the project falls under the MIT license, unless otherwise specified. We will accept third-party code which falls under MIT, BSD and LGPL, but copyleft licensing (GPL, and AGPL) is only permitted in addons. It must be possible to completely remove the GPL (copyleft) code from the main project without breaking anything. + +**Coding Style** + +In the interests of consistency we adopt the following code styling. We may accept patches using other styles, but where possible please try to provide a consistent code style. We aren't going to argue or debate the merits of this style, and it is irrelevant what project 'xyz' uses. This is not project 'xyz'. This is a baseline to try and keep the code readable now and in the future. + +* All comments should be in English. + +* We use doxygen to generate documentation. This hasn't been consistently applied, but learning it and using it are highly encouraged. + +* Indentation is accomplished primarily with tabs using a tab-width of 4. + +* String concatenation and operators should be separated by whitespace. e.g. "$foo = $bar . 'abc';" instead of "$foo=$bar.'abc';" + +* Generally speaking, we use single quotes for string variables and double quotes for SQL statements. "Here documents" should be avoided. Sometimes using double quoted strings with variable replacement is the most efficient means of creating the string. In most cases, you should be using single quotes. + +* Use whitespace liberally to enhance readability. When creating arrays with many elements, we will often set one key/value pair per line, indented from the parent line appropriately. Lining up the assignment operators takes a bit more work, but also increases readability. + +* Generally speaking, opening braces go on the same line as the thing which opens the brace. They are the last character on the line. Closing braces are on a line by themselves. + + |