Is there a code style guide to be used when submitting patches to bird? An emacs file, clang-format or similar would be useful. Thanks, Kenth
On Tue, Jun 11, 2019 at 01:37:42PM +0000, Kenth Eriksson wrote:
Is there a code style guide to be used when submitting patches to bird? An emacs file, clang-format or similar would be useful.
Hi Well, historically different parts of BIRD used different coding styles, now we try to converge on 2 columns per indentation, Allman style (opening brace on new line). Canonical way to indent to X-th column is by X/8 tabs and X%8 spaces. For EMACS, it is: (setq-default c-default-style "bsd") (setq-default c-basic-offset 2) -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
Signed-off-by: Kenth Eriksson <kenth.eriksson@infinera.com> --- .dir-locals.el | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 00000000..98b38690 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,6 @@ +; Bird project coding conventions + +((c-mode + (c-file-style . "BSD") + (c-basic-offset . 2) + (show-trailing-whitespace . t))) -- 2.21.0
On 6/11/19 3:49 PM, Ondrej Zajicek wrote:
On Tue, Jun 11, 2019 at 01:37:42PM +0000, Kenth Eriksson wrote:
Is there a code style guide to be used when submitting patches to bird? An emacs file, clang-format or similar would be useful.
Hi
Well, historically different parts of BIRD used different coding styles, now we try to converge on 2 columns per indentation, Allman style (opening brace on new line). Canonical way to indent to X-th column is by X/8 tabs and X%8 spaces.
For EMACS, it is:
(setq-default c-default-style "bsd") (setq-default c-basic-offset 2)
Even currently different parts of BIRD use different coding styles as I can't get used to Allman or EMACS when writing completely new code. So parts of BIRD are still being written in (something like) Linux kernel style with 2 columns per indentation. The main rule is to use the same style as the file uses around the new code. Yes, it's somehow a mess, we know; we won't do much about that. Maria
On Tue, 2019-06-11 at 16:15 +0200, Maria Jan Matejka wrote:
On 6/11/19 3:49 PM, Ondrej Zajicek wrote:
On Tue, Jun 11, 2019 at 01:37:42PM +0000, Kenth Eriksson wrote:
Is there a code style guide to be used when submitting patches to bird? An emacs file, clang-format or similar would be useful.
Hi
Well, historically different parts of BIRD used different coding styles, now we try to converge on 2 columns per indentation, Allman style (opening brace on new line). Canonical way to indent to X-th column is by X/8 tabs and X%8 spaces.
For EMACS, it is:
(setq-default c-default-style "bsd") (setq-default c-basic-offset 2)
Even currently different parts of BIRD use different coding styles as I can't get used to Allman or EMACS when writing completely new code. So parts of BIRD are still being written in (something like) Linux kernel style with 2 columns per indentation.
Please include somtething in your project that defines how you want indentation to look. My patch with an emacs dir-locals.el was a just a suggestion.
The main rule is to use the same style as the file uses around the new code. Yes, it's somehow a mess, we know; we won't do much about that.
Maria
participants (4)
-
Kenth Eriksson -
Kenth Eriksson -
Maria Jan Matejka -
Ondrej Zajicek