summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-01-08 22:00:51 +0100
committerMichał Górny <mgorny@gentoo.org>2020-01-08 22:00:51 +0100
commit02f0fbaf66fd5b90c5097d42bc87c878c486791d (patch)
treec6b92ebdc94baf797b74294891b768b7b41922cb /ebuild-format.rst
parentLanguage-specific bits (diff)
downloadpolicy-guide-02f0fbaf66fd5b90c5097d42bc87c878c486791d.tar.gz
policy-guide-02f0fbaf66fd5b90c5097d42bc87c878c486791d.tar.bz2
policy-guide-02f0fbaf66fd5b90c5097d42bc87c878c486791d.zip
Ebuild coding style
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'ebuild-format.rst')
-rw-r--r--ebuild-format.rst27
1 files changed, 27 insertions, 0 deletions
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