From deffc1f143febd22c7ba5c985709609cdba9afc3 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Mon, 5 Sep 2016 14:54:07 +0100 Subject: [PATCH] docs: add a short document about coding style recommendation Signed-off-by: Rolf Neugebauer --- docs/coding-style.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docs/coding-style.md diff --git a/docs/coding-style.md b/docs/coding-style.md new file mode 100644 index 000000000..6e42d7dda --- /dev/null +++ b/docs/coding-style.md @@ -0,0 +1,15 @@ +## Shell scripts +Shell scripts should loosely follow the general Alpine style which is derived from the Linux Kernel guidelines, i.e. tabs for indentation etc. + +It's also useful to run `shellcheck` on the scripts. + +## Go code +New Go code should be formatted with `gofmt` + +## C code +C code written from scratch should follow the +[Linux kernel coding guidelines](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/CodingStyle) +as much as it makes sense for userspace code. You can check your code with [checkpatch.pl](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/scripts/checkpatch.pl) like this: +``` +checkpatch.pl --no-tree --file +```