-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ ifdef::env-github[:outfilesuffix: .adoc] | |
7/Flux Coding Style Guide | ||
========================= | ||
|
||
This specification presents the recommended standards when contributing code to the Flux code base. | ||
This specification presents the recommended standards when contributing | ||
code to the Flux code base. | ||
|
||
* Name: github.com/flux-framework/rfc/spec_7.adoc | ||
* Editor: Don Lipari <[email protected]> | ||
|
@@ -22,30 +23,37 @@ be interpreted as described in http://tools.ietf.org/html/rfc2119[RFC 2119]. | |
== Goals | ||
|
||
* Encourage a uniform coding style in flux-framework projects | ||
* Provide a document to reference when providing style feedback in project pull requests | ||
* Provide a document to reference when providing style feedback in | ||
project pull requests | ||
|
||
== C Coding Style Recommendations | ||
|
||
In general, Flux follows the "Kernighan & Ritchie coding style" with the following exceptions or examples: | ||
In general, Flux follows the "Kernighan & Ritchie coding style" with the | ||
following exceptions or examples: | ||
|
||
1. Indenting SHOULD be with spaces, and not tabs. | ||
2. One level of indentation SHOULD be 4 spaces. | ||
3. One space SHOULD separate function names and the opening parenthesis (enhances readability). | ||
4. There SHOULD be no trailing spaces (or tabs) after the last non-space character in a line. | ||
3. One space SHOULD separate function names and the opening parenthesis | ||
(enhances readability). | ||
4. There SHOULD be no trailing spaces (or tabs) after the last non-space | ||
character in a line. | ||
5. Lines SHOULD be limited to 80 characters. | ||
6. Comments SHOULD be indented to the depth of the code they are describing. | ||
7. The return type SHOULD be on the same line as the function declaration. | ||
8. One space SHOULD separate the star and type in pointer declarations. Example: | ||
8. One space SHOULD separate the star and type in pointer declarations. | ||
Example: | ||
---- | ||
int *ptr; | ||
---- | ||
|
||
Tools That Modify Code to Conform to C Coding Style | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
"indent -kr" will bring you most of the way towards conforming to the Flux coding style. | ||
"indent -kr" will bring you most of the way towards conforming to the Flux | ||
coding style. | ||
|
||
Those using vi will automatically follow some of the Flux style based on the presence of the following at the end of each file: | ||
Those using vi will automatically follow some of the Flux style based on | ||
the presence of the following at the end of each file: | ||
|
||
---- | ||
/* | ||
|
@@ -59,7 +67,8 @@ In vim, use the following to highlight whitespace errors: | |
let c_space_errors = 1 | ||
---- | ||
|
||
In emacs, add this to your custom-set-variables defs to highlight whitespace errors: | ||
In emacs, add this to your custom-set-variables defs to highlight | ||
whitespace errors: | ||
|
||
---- | ||
'(show-trailing-whitespace t) | ||
|