Verified Commit e27c482f authored by A. Wilcox's avatar A. Wilcox 🦊
Browse files

Add Code Style guide

parent 05cc72e4
......@@ -8,6 +8,16 @@
Code Style
See the `Code Style Guide`_ for information about the code style used in
Project Horizon.
.. _`Code Style Guide`: devel/STYLE.rst
Code Style Guide for Project Horizon
* **A. Wilcox**, documentation writer
© 2019 Adélie Linux Team. CC BY-NC-SA-4.0 open source licence.
This style guide describes how the program code for Project Horizon is
written and styled.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
document are to be interpreted as described in `RFC 2119`_.
.. _`RFC 2119`:
Directory Layout
Tools that are applicable for use in the Runtime Environment and the
Installation Environment MUST be placed in the ``tools`` directory, in their
own subdirectory.
Tools that are used in the Installation Environment only MUST be placed in a
new top-level directory.
Implementation of HorizonScript keys MUST be written in a file in the
``hscript`` directory that describes the general category of their purpose.
For example, a metadata key belongs in ````. If a key does not fit in
to any of the categories that currently exist, a new category MUST be created
for it.
Code Style
Naming Conventions
C++ classes MUST be in the ``Horizon::`` namespace, and MUST be in CamelCase.
Variables MUST be all lowercase with underscores separating words.
Tab stops MUST be 4 spaces. Hard tabs MUST NOT be used.
Parenthetical statements that span multiple lines MUST have their continuation
aligned after the parenthetical. For example:
if(this->function() == "Fox" &&
that->function() != "Vulpes")
Opening curly braces MUST be on the same line as the last line of the statement
that they open. Closing curly braces MUST be on a separate line.
Closing curly braces MUST be indented at the same level as the statement they
are closing. For example:
if(foo) {
Comments MUST be written in complete, concise English sentences.
Blocks of code that are directly traceable to a requirement SHOULD have a REQ
comment, such as:
/* REQ: */
valid = foo->validate();
All methods MUST have a comment preceding their definition explaining their
purpose. Methods SHOULD also use Doxygen-style notation for describing their
parameters, return values (if any), and side-effects (if any).
C++ classes that are meant to be public API (that is, consumed by external
software) MUST use the PImpl_ pattern to encapsulate their members.
.. _PImpl:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment