From 4e10a238879eebb36600d8717da95e9fb7f5b7c2 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Mon, 13 Jun 2016 13:58:06 -0700 Subject: [PATCH] doc: merge coding_style -> conventions.rst This removes warning about duplicate symbol (of _coding_style, due to the inclusion) plus also a very short file which can be very well inside conventions.rst. Change-Id: I7b8467a0a845225a4fe4356f012f60ab0ea202aa Signed-off-by: Inaky Perez-Gonzalez --- doc/contribute/coding_style.rst | 41 --------------------------------- doc/contribute/conventions.rst | 40 +++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 42 deletions(-) delete mode 100644 doc/contribute/coding_style.rst diff --git a/doc/contribute/coding_style.rst b/doc/contribute/coding_style.rst deleted file mode 100644 index e88bef8333c..00000000000 --- a/doc/contribute/coding_style.rst +++ /dev/null @@ -1,41 +0,0 @@ -:orphan: - -.. _coding_style: - -Coding Style -************ - -Use this coding guideline to ensure that your development complies with -the project's style and naming conventions. - -In general, follow the `Linux kernel coding style`_, with the following -exceptions: - -* Add braces to every ``if`` and ``else`` body, even for single-line code - blocks. Use the :option:`--ignore BRACES` flag to make :program:`checkpatch` - stop complaining. -* Use hard tab stops. Set the tab width 8 spaces. Break lines at 80 characters. - If you are trying to align comments after declarations, use spaces instead of - tabs to align them. -* Use C89-style single line comments, :literal:`/* */`. The C99-style - single line comment, //, is not allowed. -* Use :literal:`/** */` for any comments that need to appear in the - documentation. - -Checking for Conformity Using Checkpatch -======================================== - -The Linux kernel GPL-licensed tool :program:`checkpatch` is used to -check coding style conformity. :program:`Checkpatch` is available in the -scripts directory. To invoke it when committing code, edit your -:file:`.git/hooks/pre-commit` file to contain: - -.. code-block:: bash - - #!/bin/sh - - set -e exec - - exec git diff --cached | ${ZEPHYR_BASE}/scripts/checkpatch.pl - || true - -.. _Linux kernel coding style: https://www.kernel.org/doc/Documentation/CodingStyle diff --git a/doc/contribute/conventions.rst b/doc/contribute/conventions.rst index 4f1d766b2d5..e52cae73349 100644 --- a/doc/contribute/conventions.rst +++ b/doc/contribute/conventions.rst @@ -163,4 +163,42 @@ components. | -ENOSYS | Function is not implemented. | +-----------------+------------------------------------------------+ -.. include:: coding_style.rst +.. _coding_style: + +Coding Style +************ + +Use this coding guideline to ensure that your development complies with +the project's style and naming conventions. + +In general, follow the `Linux kernel coding style`_, with the following +exceptions: + +* Add braces to every ``if`` and ``else`` body, even for single-line code + blocks. Use the :option:`--ignore BRACES` flag to make :program:`checkpatch` + stop complaining. +* Use hard tab stops. Set the tab width 8 spaces. Break lines at 80 characters. + If you are trying to align comments after declarations, use spaces instead of + tabs to align them. +* Use C89-style single line comments, :literal:`/* */`. The C99-style + single line comment, //, is not allowed. +* Use :literal:`/** */` for any comments that need to appear in the + documentation. + +Checking for Conformity Using Checkpatch +======================================== + +The Linux kernel GPL-licensed tool :program:`checkpatch` is used to +check coding style conformity. :program:`Checkpatch` is available in the +scripts directory. To invoke it when committing code, edit your +:file:`.git/hooks/pre-commit` file to contain: + +.. code-block:: bash + + #!/bin/sh + + set -e exec + + exec git diff --cached | ${ZEPHYR_BASE}/scripts/checkpatch.pl - || true + +.. _Linux kernel coding style: https://www.kernel.org/doc/Documentation/CodingStyle