Skip to content

Commit

Permalink
Source Files / General Rules: limit line lengths to 80 columns
Browse files Browse the repository at this point in the history
We currently say "stick with 80 if it's convenient, extend to 120
otherwise". This is too lax; much new edk2 code ignores the 80 columns
recommendation, resulting in source files that are hard to read for some
contributors. Remove the 120 columns excuse and make 80 columns a
requirement.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
  • Loading branch information
lersek committed Aug 11, 2017
1 parent 3f1100b commit 2c5534a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions 5_source_files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@

## 5.1 General Rules

### 5.1.1 Lines shall be 120 columns, or less
### 5.1.1 Lines shall be 80 columns, or less

Preferably, limit line lengths to 80 columns or less. When this doesn't leave
sufficient space for a good postfix style comment, extend the line to a total
of 120 columns. Having some level of uniformity in the expected width of the
source is useful for viewing and printing the code.
Limit line lengths to 80 columns.

Lines longer than 80 columns make it more difficult for the reader to find the
beginning of the next line. They also tend to prevent users from displaying two
source listings side-by-side on common display devices.

When the 80 columns limit doesn't leave sufficient space for a postfix style
comment, break the line into shorter segments at logical boundaries (for
example, between the arguments of a function call, adhering to the spacing
rules), or replace the postfix style comment with a standalone comment that
precedes the statement.

### 5.1.2 Do not use tab characters

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ Copyright (c) 2006-2017, Intel Corporation. All rights reserved.
| 2.1 | DRAFT for REFORMAT | 10/30/2015 |
| 2.2 | Convert to Gitbook | June 2017 |
| | [#425](https://bugzilla.tianocore.org/show_bug.cgi?id=425) [CCS] clarify line breaking and indentation requirements for multi-line function calls | |
| | Limit lines to 80 columns | |

0 comments on commit 2c5534a

Please sign in to comment.