code_formatting_standards
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
code_formatting_standards [2009/11/04 18:09] – dbw2 | code_formatting_standards [2010/03/16 15:08] – dbw2 | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== General Conventions ===== | ===== General Conventions ===== | ||
As a general rule, Evergreen contributions should follow these basic conventions. | As a general rule, Evergreen contributions should follow these basic conventions. | ||
- | * Code | + | * Indents - tabs vs. spaces |
- | * Indents should be 4 spaces | + | * The general rule for all files needing indentation is 4 space indents, no literal tabs |
- | * Lines should be kept at 80 characters or less if possible | + | * The following file types are **exceptions** to this rule |
- | * Tokens should be separated by whitespace (i.e '$this = 1' not ' | + | - Code written in C |
- | * Opening braces should be on the same line as the corresponding token and ' | + | - Database schema/code files (.sql files) |
+ | - Makefiles | ||
+ | - Plain text files | ||
+ | | ||
+ | * Opening braces should be on the same line as the corresponding token and ' | ||
if ($this) { | if ($this) { | ||
that(); | that(); | ||
Line 21: | Line 25: | ||
something() | something() | ||
}</ | }</ | ||
- | | + | |
- | * XML files | + | |
- | * FIXME (4 space indents as well?) | + | |
- | * Text files | + | |
- | * Basic text files may use actual tab characters as needed | + | |
===== Tool Specifics ===== | ===== Tool Specifics ===== | ||
Line 35: | Line 35: | ||
set expandtab | set expandtab | ||
set backspace=indent, | set backspace=indent, | ||
- | autocmd BufEnter ? | + | autocmd BufEnter ?akefile*,*txt,*out,*csv, |
- | autocmd BufEnter | + | |
- | autocmd BufEnter | + | |
- | autocmd BufEnter | + | |
</ | </ | ||
In addition, the following VIM options have been recommended by a prominent Evergreen developer but are not actually format related :-) :< | In addition, the following VIM options have been recommended by a prominent Evergreen developer but are not actually format related :-) :< | ||
Line 57: | Line 54: | ||
==== perltidy ==== | ==== perltidy ==== | ||
- | The following options are recommended | + | The following options are recommended |
* -b : Backup and modify in place | * -b : Backup and modify in place | ||
* -ce : Enable the " | * -ce : Enable the " | ||
Example: < | Example: < |
code_formatting_standards.txt · Last modified: 2022/02/10 13:34 by 127.0.0.1