Difference between revisions of "Coding Rules"
From ArmadeusWiki
m (→C files) |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | This page defines the Coding Rules that apply to all the source code | + | This page defines the Coding Rules that apply to all the source code written for the Armadeus Project BSP. Patches for existing Free Software used by Armadeus Project must use the original project rules (if any). |
==C files== | ==C files== | ||
− | * Both | + | * Both user space or driver code shall use the Linux kernel "coding style". Details are given here: ''buildroot/output/build/linux-x.x/Documentation/CodingStyle'' |
* If not sure, one can use the following script to automagically indent its source files: ''buildroot/output/build/linux-x.x/scripts/Lindent'' | * If not sure, one can use the following script to automagically indent its source files: ''buildroot/output/build/linux-x.x/scripts/Lindent'' | ||
==C++ files== | ==C++ files== | ||
− | * | + | * 2 possibilities: |
+ | ** either comply with the "C files" Coding Rules listed just above or, | ||
+ | ** follow the [http://qt-project.org/wiki/Qt_Coding_Style Qt Coding Style.] | ||
+ | * Main differences between both are: spaces vs tab indentation and variable naming (''my_variable'' vs ''myVariable''). | ||
==Python files== | ==Python files== | ||
− | * | + | * Follow the [http://www.python.org/dev/peps/pep-0008/ Style Guide for Python code]. |
==Makefiles== | ==Makefiles== | ||
− | * Makefiles syntax is already rigid enough to limit coder | + | * Makefiles syntax is already rigid enough to limit coder eccentricity :-) |
* However: constants should be in Uppercase. | * However: constants should be in Uppercase. | ||
==Bash scripts== | ==Bash scripts== | ||
− | * Indentation: 1 | + | * Indentation: 1 Tabulation, |
− | * Do not use more than 132 columns | + | * Do not use more than 132 columns, |
− | * Constants in Uppercase | + | * Constants in Uppercase. |
+ | |||
+ | ==Licences== | ||
+ | * Armadeus Project only accept sources that comply with the major Licenses available in the Free Software community: GPL, GPLv2, LGPL or BSD. |
Latest revision as of 06:47, 15 October 2012
This page defines the Coding Rules that apply to all the source code written for the Armadeus Project BSP. Patches for existing Free Software used by Armadeus Project must use the original project rules (if any).
C files
- Both user space or driver code shall use the Linux kernel "coding style". Details are given here: buildroot/output/build/linux-x.x/Documentation/CodingStyle
- If not sure, one can use the following script to automagically indent its source files: buildroot/output/build/linux-x.x/scripts/Lindent
C++ files
- 2 possibilities:
- either comply with the "C files" Coding Rules listed just above or,
- follow the Qt Coding Style.
- Main differences between both are: spaces vs tab indentation and variable naming (my_variable vs myVariable).
Python files
- Follow the Style Guide for Python code.
Makefiles
- Makefiles syntax is already rigid enough to limit coder eccentricity :-)
- However: constants should be in Uppercase.
Bash scripts
- Indentation: 1 Tabulation,
- Do not use more than 132 columns,
- Constants in Uppercase.
Licences
- Armadeus Project only accept sources that comply with the major Licenses available in the Free Software community: GPL, GPLv2, LGPL or BSD.