Changes between Version 3 and Version 4 of CodingStandards
- Timestamp:
- Dec 31, 1969, 4:20:58 PM (54 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodingStandards
v3 v4 1 1 = OpenSHA Coding Standards = 2 Anyone working on OpenSHA should strive to write efficient, well-documented, and testable code. To facilitate a uniform appearenceGood code is not only well-written, efficient, and well-documented, but also is written with a uniform formatting standard. Below I outline some suggested coding standards we all try to stick with in order to provide a uniform and clean look and feel to our source code files. Please feel free to update this if you feel strongly about a certain topic, these rules are meant to serve as a starting point only. 3 4 Many of the configurations recommended below can be set within your IDE of choice. 2 Anyone working on OpenSHA should strive to write efficient, well-documented, and testable code. To facilitate uniform presentation and encourage a high level of readability, several syntactic standards to which this project adheres are outlined below. Most of the recommended syntax configurations can be set within your IDE of choice. 5 3 6 4 == Syntax == 7 5 8 '''Tabs''' : Use tabs, not spaces. This allows individuals to adjust indentation to their liking ,6 '''Tabs''' : Use tabs, not spaces. This allows individuals to adjust indentation to their liking. 9 7 10 '''Line Length''' : A single line of code shall not exceed the 80 character printable page width. This rule helps when printing the page, or when viewing the code on a fixed-width terminal.8 '''Line Length''' : Limit lines to 80 characters. Wrap long lines appropriately. 11 9 12 '''Line Wrapping''' : When a single line of code must extend beyond the above 80 character max, the next line should be indented by two (2) tabs (with "tabs" as outlined above).10 '''Line Wrapping''' : Indent wrapped lines with two tabs. 13 11 14 12 '''Code Blocks''' : Code contained within a containing block shall always be indented by a single tab from the containing block. When creating a new block of code (i.e. functions, loops, if-statements, etc...), the opening bracket "{" shall be on the same line as the start of the block and the closing bracket shall be on its own line aligned to the opening indentation of that block. This is true except for when the code block can fit entirely on a single line, in such a case it is allowable to do so however there should be sufficient space for a leading ''and'' trailing space between the code-block body and the brackets. For example: