diff options
author | Patrick Georgi <pgeorgi@google.com> | 2019-03-05 22:19:38 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-03-08 08:16:15 +0000 |
commit | b3a8cc54dbaf833c590a56f912209a5632b71f49 (patch) | |
tree | fc524c1a88fe235bc552bbf00446920c3345ac1b /Documentation | |
parent | 9276fe40899a7634817bc5d23c8685257cb689ff (diff) | |
download | coreboot-b3a8cc54dbaf833c590a56f912209a5632b71f49.tar.xz |
Documentation: Our coding style now allows 80 + 2*8 columns in a line
Update the document to match clang-format and checkpatch formally, and
provide a rationale.
Change-Id: I597a27d4e22d07e033b36f0dceb554ac1d8d5789
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31771
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/coding_style.md | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Documentation/coding_style.md b/Documentation/coding_style.md index 048b8e673e..e0341939a6 100644 --- a/Documentation/coding_style.md +++ b/Documentation/coding_style.md @@ -30,6 +30,11 @@ the code move too far to the right, and makes it hard to read on a more than 3 levels of indentation, you're screwed anyway, and should fix your program. +Since most code in a file is indented at least 1 level, we account for +2 levels in addition to the 80 characters on the terminal under the +assumption that editors can scroll to the right, making an 80 characters +screen visible with little loss on the left end. + In short, 8-char indents make things easier to read, and have the added benefit of warning you when you're nesting your functions too deep. Heed that warning. @@ -80,11 +85,11 @@ Get a decent editor and don't leave whitespace at the end of lines. Coding style is all about readability and maintainability using commonly available tools. -The limit on the length of lines is 80 columns and this is a strongly -preferred limit. +The limit on the length of lines is 96 columns (80 columns + 2 tab levels) +and this is a strongly preferred limit. -Statements longer than 80 columns will be broken into sensible chunks, -unless exceeding 80 columns significantly increases readability and does +Statements longer than 96 columns will be broken into sensible chunks, +unless exceeding 96 columns significantly increases readability and does not hide information. Descendants are always substantially shorter than the parent and are placed substantially to the right. The same applies to function headers with a long argument list. However, never break |