Skip to content

Commit c6dfa3a

Browse files
committed
doc: Formatting and tweaks to style guide.
Of particular note: 1. I added two exceptions regarding template parameter names: `scalar` and `time` don't need a T. 2. I removed `m_` from class variables. Signed-off-by: Matthew Emmett <[email protected]>
1 parent 519204a commit c6dfa3a

File tree

2 files changed

+65
-61
lines changed

2 files changed

+65
-61
lines changed

doc/source/contributing.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,59 @@
22

33
## Branching and Tagging Model
44

5-
We use the [git-flow] workflow to that extend, that branch names(paces) have a certain meaing:
5+
We use the [git-flow] workflow to that extend, that branch
6+
names(paces) have a certain meaing:
67

78
Branch Name Pattern | Description
8-
--------------------|-------------
9+
--------------------|------------
910
`master` | tip of the `master` branch is always the latest stable release
1011
`development` | tip of the `development` branch is the current state of development and not expected to be stable or even usable
1112
`feature/*` | various feature branches are used to implement new features and should be based off the `development` branch
1213
`release/*` | a release branch is created from the `development` branch and used to prepare a new release and will be merged into `master`
1314
`hotfix/*` | hotfix branches are based off `master` or `development` to fix important and severe bugs and should be merged into `development` and `master` as soon as possible
1415

15-
Releases and release candidates are tagged in the form `release-X.Y.Z(-RCa)`, where `X`, `Y`, and `Z` specify
16-
the version with respect to [semantic versioning] and `a` the number of the release candidate of that version.
16+
Releases and release candidates are tagged in the form
17+
`release-X.Y.Z(-RCa)`, where `X`, `Y`, and `Z` specify the version
18+
with respect to [semantic versioning] and `a` the number of the
19+
release candidate of that version.
1720

1821

1922
## Commit Messages
2023

21-
To ease browsing the proejct's history, we try to keep our commit messages clean and descriptive.
22-
Please try to follow the following rules as best as possible:
24+
To ease browsing the proejct's history, we try to keep our commit
25+
messages clean and descriptive. Please try to follow the following
26+
rules as best as possible:
2327

2428
* Commit Title must not be longer than 50 characters
2529

26-
If applicable, the title should start with a category name (such as `docu`, `tests`, ...)
27-
followed by a colon (e.g. `"docu: add usage examples for plain SDC"` ).
30+
If applicable, the title should start with a category name (such as
31+
`docu`, `tests`, ...) followed by a colon (e.g. `"docu: add usage
32+
examples for plain SDC"` ).
2833

2934
* Commit Description must have line wraps at 72 characters
3035

3136
* Please *sign* your commits (i.e. use `git commit -s`)
3237

33-
This automatically appends a line of the form `"Signed-off-by: Torbjörn Klatt <[email protected]>"` to the end
34-
of the commit message.
38+
This automatically appends a line of the form `"Signed-off-by:
39+
Torbjörn Klatt <[email protected]>"` to the end of the commit
40+
message.
3541

3642

3743
## How to Implement a New Feature?
3844

3945
-# create a fork/clone
4046
-# switch to the `development` branch and pull in the latest changes
41-
-# create a new branch `feature/XYZ` where `XYZ` is a short title of your planned feature
42-
(word seperation should be done with underscores, e.g. `feature/my_awesome_feature`)
47+
-# create a new branch `feature/XYZ` where `XYZ` is a short title of
48+
your planned feature (word seperation should be done with
49+
underscores, e.g. `feature/my_awesome_feature`)
4350
-# hack and write Unit Tests
4451
-# commit
45-
-# repeat steps 4 and 5 until you feel your feature is in an almost usable state and most of the unit tests pass
52+
-# repeat steps 4 and 5 until you feel your feature is in an almost
53+
usable state and most of the unit tests pass
4654
-# write documentation for your feature
4755
-# push your feature branch
48-
-# stay tuned on reviews, remarks and suggestions by the other developers
56+
-# stay tuned on reviews, remarks and suggestions by the other
57+
developers
4958

5059

5160
[git-flow]: http://nvie.com/posts/a-successful-git-branching-model/

doc/source/style_guide.md

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
# Style Guide
22

3-
To ease development we agree on a basic code style described as follows.
4-
53
## Naming Convention
64

7-
In general, abbreviations should only be used if they are absolutely unambigious and would save a
8-
lot of horizontal space.
9-
In case one hesitates whether to abbreviate a variable or not, rather not do it!
5+
In general, abbreviations should only be used if they are absolutely
6+
unambigious and would save a lot of horizontal space.
107

11-
Always use underscores (`_`) as word separation.
8+
Always use underscores (`_`) to separate words.
129

1310
* __Files__
1411

15-
Due to systems which do not distinguish between upper and lower case in file and path names,
16-
always use lowercase for file names and directories.
12+
To accomodate systems which do not distinguish between upper and
13+
lower case in file and path names, always use lowercase for file
14+
names and directories.
1715

18-
Header files should be named after the main/central class contained in.
19-
For example, a class `MyClass` should be in a header file called `my_header.hpp`.
20-
Separate words by underscores.
16+
Header files should be named after the main/central class that they
17+
contain. For example, a class `MyClass` should be in a header file
18+
called `my_header.hpp`. Separate words by underscores.
2119

2220
* __Namespaces__
2321

@@ -26,50 +24,47 @@ Always use underscores (`_`) as word separation.
2624
* __Class Names__
2725

2826
Should start with a capital letter and use _CamelCase_.
29-
30-
Abstract classes should start with a capital `I` denoting an _interface_. E.g. `ISweeper` in
31-
`i_sweeper.hpp`.
27+
28+
Abstract classes should start with a capital `I` denoting an
29+
_interface_. For example, `ISweeper`.
3230

3331
* __Function Names__
3432

35-
Should only consist of lowercase letters and underscores separating words.
33+
Should always be lowercase.
3634

3735
* __Variable Names__
3836

39-
Should always be lowercase using underscores as word separation.
40-
Member variables of classes should start with `m_`.
41-
Constants should all be uppercase with undersocres as word separation.
37+
Should always be lowercase. Constants should all be uppercase with
38+
undersocres as word separation.
4239

43-
* __Template Parameter__
40+
* __Template Parameters__
4441

45-
In case, most template parameters denote a certain type, append a capital `T` to the name of the
46-
template parameter. E.g.
42+
When template parameters refer to a type name, append a capital `T`
43+
to the name of the template parameter. For example
4744
~~~{.cpp}
4845
template<typename typeT>
4946
int my_func(std::vector<typeT> &vec);
5047
~~~
5148

49+
Acceptable exceptions to this rule are `scalar` (which denotes a
50+
spatial type, e.g. `complex<double>`) and `time` (which denotes a
51+
temporal type, e.g. `double`).
52+
5253

5354
## Techniques
5455

5556
### Includes
5657

57-
System headers and those from third party libraries should be included using angular brackets.
58-
Headers from our library should be included using double quotes.
59-
60-
For headers included via angular brackets, the preprocessor will search through all paths given via
61-
the `-I` parameter.
62-
While for includes with double quotes it will only look in the directory of the header including
63-
the included file.
64-
Only when there is no such header in there, the preprocessor will go on with the behaviour for
65-
angular brackets.
58+
System headers and those from third party libraries should be included
59+
using angular brackets. Headers from our library should be included
60+
using double quotes.
6661

6762
### Define Guards
6863

6964
Use `#define` guards in header files to prevent multiple inclusion.
70-
The variable defined should be derived from the header file name itself.
71-
For example, a header file `my_header.hpp` in the folder `PFASST/src/subfolder` should have the
72-
following define guard:
65+
The variable defined should be derived from the header file name
66+
itself. For example, a header file `my_header.hpp` in the folder
67+
`PFASST/include/subfolder` should have the following define guard:
7368

7469
~~~{.cpp}
7570
#ifndef PFASST__SUBFOLDER__MY_HEADER_HPP
@@ -78,19 +73,19 @@ following define guard:
7873
#endif // PFASST__SUBFOLDER__MY_HEADER_HPP
7974
~~~
8075

81-
Always include the library name and at least one subfolder (if applicable) to prevent possible
82-
multiple defines in files with the same name but in different folders.
76+
Always include the library name and at least one subfolder (if
77+
applicable) to prevent multiple defines in files with the same name
78+
but in different folders.
8379

8480
### Encapsulation / Clean API
8581

86-
We want to provide a clean API, thus we use encapsulation wherever possible.
87-
For classes, we prefer private member/data variables and provide access to them via getter/setter
88-
methods.
82+
We want to provide a clean API, thus we use encapsulation wherever
83+
possible. For classes, we prefer private member/data variables and
84+
provide access to them via getter/setter methods.
8985

9086
### C++ Feature Set
9187

92-
We agreed on using the "most common" C++11 features.
93-
These are:
88+
We agreed on using the "most common" C++11 features. These are:
9489

9590
* `auto` keyword
9691
* `shared_ptr` and `unique_ptr`
@@ -102,25 +97,25 @@ These are:
10297
* `constexpr`
10398
* right angle bracket (`vector<vector<T> >` vs. `<vector<vector<T>>`)
10499

105-
@todo Check the list of used/required C++11 features and possibly extend it by a list of minimum
100+
@todo Check the list of used/required C++11 features and possibly extend it by a list of minimum
106101
compiler versions supporting the features.
107102

108103

109104
## Documentation
110105

111106
Document your code.
112107

113-
We use [Doxygen] for generating the documentation webpage.
114-
You can use pretty much all the features, Doxygen provides, including [MathJAX] for formulas and
115-
[Markdown] for easy text formatting.
116-
108+
We use [Doxygen] for generating the documentation webpage. You can
109+
use pretty much all the features, Doxygen provides, including
110+
[MathJAX] for formulas and [Markdown] for easy text formatting.
117111

118112
## Formatting
119113

120114
In short: no tabs, 2 spaces, sane indent-continuation.
121115

122-
We provide a configuration file for the code beautifier [uncrustify] which does a pretty good job
123-
to ensure consistent formatting of the source files.
116+
We provide a configuration file for the code beautifier [uncrustify]
117+
which does a pretty good job to ensure consistent formatting of the
118+
source files.
124119

125120

126121
[Doxygen]: http://www.stack.nl/~dimitri/doxygen/index.html

0 commit comments

Comments
 (0)