Skip to content

Commit 02fe6f8

Browse files
committed
COMMUNITY.md: update CodingStyle & branching
Also add a note that this is documentation, not law. Signed-off-by: David Lamparter <[email protected]>
1 parent c1ec5aa commit 02fe6f8

File tree

2 files changed

+799
-15
lines changed

2 files changed

+799
-15
lines changed

COMMUNITY.md

Lines changed: 80 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
[TOC]
44

5+
## General note on this document
6+
7+
This document is "descriptive/post-factual" in that it documents pratices that
8+
are in use; it is not "definitive/pre-factual" in prescribing practices.
9+
10+
This means that when a procedure changes, it is agreed upon, then put into
11+
practice, and then documented here. If this document doesn't match reality,
12+
it's the document that needs to be updated, not reality.
13+
14+
515
## Git Structure
616

717
The master Git for PROJECT resides on Github at
@@ -10,20 +20,21 @@ The master Git for PROJECT resides on Github at
1020
![git branches continually merging to the left from 3 lanes; float-right](doc/git_branches.svg
1121
"git branch mechanics")
1222

13-
There are 3 main branches for development and a release branch for each
23+
There is one main branch for development and a release branch for each
1424
major release.
1525

16-
New contributions are done against the head of the Develop branch. The CI
26+
New contributions are done against the head of the master branch. The CI
1727
systems will pick up the Github Pull Requests or the new patch from
18-
Patchwork, run some basic build and functional tests and will merge them
19-
into the branch automatically on success.
20-
21-
Code on the develop branch will then be further tested and reviewed by the
22-
community and merged to master on a regular interval.
28+
Patchwork, run some basic build and functional tests.
2329

2430
For each major release (1.0, 1.1 etc) a new release branch is created based
2531
on the master.
2632

33+
There was an attempt to use a "develop" branch automatically maintained by
34+
the CI system. This is not currently in active use, though the system is
35+
operational. If the "develop" branch is in active use and this paragraph
36+
is still here, this document obviously wasn't updated.
37+
2738

2839
## Programming language, Tools and Libraries
2940

@@ -250,16 +261,72 @@ Portions:
250261

251262
### Code styling / format
252263

253-
GNU coding standards apply. Indentation follows the result of invoking GNU
254-
indent (as of 2.2.8a) with the `-nut -nfc1` arguments.
264+
Coding style standards in FRR vary depending on location. Pre-existing
265+
code uses GNU coding standards. New code may use Linux kernel coding style.
266+
267+
GNU coding style apply to the following parts:
268+
269+
* lib/
270+
* zebra/
271+
* bgpd/
272+
* ospfd/
273+
* ospf6d/
274+
* isisd/
275+
* ripd/
276+
* ripngd/
277+
* vtysh/
278+
279+
Linux kernel coding style applies to:
280+
281+
* nhrpd/
282+
* watchfrr/
283+
* pimd/
284+
* lib/{checksum,hook,imsg-buffer,imsg,libfrr,md5,module,monotime,queue}.[ch]
285+
286+
BSD coding style applies to:
287+
288+
* ldpd/
289+
290+
**Whitespace changes in untouched parts of the code are not acceptable in
291+
patches that change actual code.** To change/fix formatting issues, please
292+
create a separate patch that only does formatting changes and nothing else.
293+
294+
It is acceptable to rewrap entire files to Linux kernel style, but this
295+
**MUST** come as a separate patch that does nothing other than this
296+
reformatting.
297+
298+
299+
#### GNU style
300+
301+
For GNU coding style, Indentation follows the result of invoking GNU indent:
255302

256303
```
257304
indent -nut -nfc1 file_for_submission.c
258305
```
259306

260-
Please don’t reformat existing files (or only sections modified by your
261-
changes), even if they don’t follow the standard. This makes it very hard to
262-
highlight the changes
307+
Originally, tabs were used instead of spaces, with tabs are every 8 columns.
308+
However, tab interoperability issues mean space characters are now preferred for
309+
new changes. We generally only clean up whitespace when code is unmaintainable
310+
due to whitespace issues, to minimise merging conflicts.
311+
312+
313+
#### Linux kernel & BSD style
314+
315+
These styles are documented externally:
316+
317+
* [https://www.kernel.org/doc/Documentation/CodingStyle](https://www.kernel.org/doc/Documentation/CodingStyle).
318+
* [http://man.openbsd.org/style](http://man.openbsd.org/style)
319+
320+
They are relatively similar but differ in details.
321+
322+
pimd deviates from Linux kernel style in using 2 spaces for indentation, with
323+
Tabs replacing 8 spaces, as well as adding a line break between `}` and `else`.
324+
It is acceptable to convert indentation in pimd/ to Linux kernel style, but
325+
please convert an entire file at a time. (Rationale: apart from 2-space
326+
indentation, the styles are sufficiently close to not upset when mixed.)
327+
328+
Unlike GNU style, these styles use tabs, not spaces.
329+
263330

264331
### Compile-Time conditional code
265332

@@ -307,4 +374,4 @@ of their debugs.
307374
CLI's are a complicated ugly beast. Additions or changes to the CLI
308375
should use a DEFUN to encapsulate one setting as much as is possible.
309376
Additionally as new DEFUN's are added to the system, documentation
310-
should be provided for the new commands.
377+
should be provided for the new commands.

0 commit comments

Comments
 (0)