From 02f0fbaf66fd5b90c5097d42bc87c878c486791d Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Wed, 8 Jan 2020 22:00:51 +0100 Subject: Ebuild coding style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- ebuild-format.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ebuild-format.rst b/ebuild-format.rst index 89ebeda..9f78705 100644 --- a/ebuild-format.rst +++ b/ebuild-format.rst @@ -1,6 +1,33 @@ Ebuild file format ================== +.. index:: + single: bash; conditions + single: bash; variable reference + single: indentation + +Coding style +------------ +:Source: QA +:Reported: partially via repoman and pkgcheck + +While Gentoo leaves most of the coding style choices to developers, +there are a few rules which we try to enforce. Those are: + +- Always indent using a single tab for indentation level. Do not + attempt to align, as it will not work with different tab widths. + +- Whenever using named variables, use bracketed variable form, i.e. + ``${foo}`` rather than ``$foo``. + +- Use bash conditions ``[[ ... ]]`` rather than POSIX-ish ``[ ... ]`` + or ``test`` builtin. + +*Rationale*: the recommended constructs are less error-prone. +Consistency avoids unnecessary changes when other developers edit +the ebuild. + + .. index:: eblit Code must be contained within ebuild and eclasses -- cgit v1.2.3-65-gdbad