Skip to content

Commit c902c4c

Browse files
ch4ot1cjonatack
authored andcommitted
doc: Add to Doxygen documentation guidelines
and update the table of contents. Co-authored-by: Jon Layton <[email protected]>
1 parent 3ce8298 commit c902c4c

File tree

1 file changed

+55
-17
lines changed

1 file changed

+55
-17
lines changed

doc/developer-notes.md

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Developer Notes
99
- [Coding Style (C++)](#coding-style-c)
1010
- [Coding Style (Python)](#coding-style-python)
1111
- [Coding Style (Doxygen-compatible comments)](#coding-style-doxygen-compatible-comments)
12+
- [Generating Documentation](#generating-documentation)
1213
- [Development tips and tricks](#development-tips-and-tricks)
1314
- [Compiling for debugging](#compiling-for-debugging)
1415
- [Compiling for gprof profiling](#compiling-for-gprof-profiling)
@@ -34,6 +35,9 @@ Developer Notes
3435
- [Source code organization](#source-code-organization)
3536
- [GUI](#gui)
3637
- [Subtrees](#subtrees)
38+
- [Upgrading LevelDB](#upgrading-leveldb)
39+
- [File Descriptor Counts](#file-descriptor-counts)
40+
- [Consensus Compatibility](#consensus-compatibility)
3741
- [Scripted diffs](#scripted-diffs)
3842
- [Release notes](#release-notes)
3943
- [RPC interface guidelines](#rpc-interface-guidelines)
@@ -137,12 +141,17 @@ For example, to describe a function use:
137141

138142
```c++
139143
/**
140-
* ... text ...
141-
* @param[in] arg1 A description
142-
* @param[in] arg2 Another argument description
143-
* @pre Precondition for function...
144+
* ... Description ...
145+
*
146+
* @param[in] arg1 input description...
147+
* @param[in] arg2 input description...
148+
* @param[out] arg3 output description...
149+
* @return Return cases...
150+
* @throws Error type and cases...
151+
* @pre Pre-condition for function...
152+
* @post Post-condition for function...
144153
*/
145-
bool function(int arg1, const char *arg2)
154+
bool function(int arg1, const char *arg2, std::string& arg3)
146155
```
147156
148157
A complete list of `@xxx` commands can be found at http://www.doxygen.nl/manual/commands.html.
@@ -157,44 +166,73 @@ To describe a class, use the same construct above the class definition:
157166
* @see GetWarnings()
158167
*/
159168
class CAlert
160-
{
161169
```
162170

163171
To describe a member or variable use:
164172
```c++
165-
int var; //!< Detailed description after the member
173+
//! Description before the member
174+
int var;
166175
```
167176

168177
or
169178
```c++
170-
//! Description before the member
171-
int var;
179+
int var; //!< Description after the member
172180
```
173181

174182
Also OK:
175183
```c++
176184
///
177-
/// ... text ...
185+
/// ... Description ...
178186
///
179187
bool function2(int arg1, const char *arg2)
180188
```
181189
182-
Not OK (used plenty in the current source, but not picked up):
190+
Not picked up by Doxygen:
183191
```c++
184192
//
185-
// ... text ...
193+
// ... Description ...
186194
//
187195
```
188196

197+
Also not picked up by Doxygen:
198+
```c++
199+
/*
200+
* ... Description ...
201+
*/
202+
```
203+
189204
A full list of comment syntaxes picked up by Doxygen can be found at http://www.doxygen.nl/manual/docblocks.html,
190205
but the above styles are favored.
191206

192-
Documentation can be generated with `make docs` and cleaned up with `make clean-docs`. The resulting files are located in `doc/doxygen/html`; open `index.html` to view the homepage.
207+
Recommendations:
193208

194-
Before running `make docs`, you will need to install dependencies `doxygen` and `dot`. For example, on macOS via Homebrew:
195-
```
196-
brew install graphviz doxygen
197-
```
209+
- Avoiding duplicating type and input/output information in function
210+
descriptions.
211+
212+
- Use backticks (&#96;&#96;) to refer to `argument` names in function and
213+
parameter descriptions.
214+
215+
- Backticks aren't required when referring to functions Doxygen already knows
216+
about; it will build hyperlinks for these automatically. See
217+
http://www.doxygen.nl/manual/autolink.html for complete info.
218+
219+
- Avoid linking to external documentation; links can break.
220+
221+
- Javadoc and all valid Doxygen comments are stripped from Doxygen source code
222+
previews (`STRIP_CODE_COMMENTS = YES` in [Doxyfile.in](doc/Doxyfile.in)). If
223+
you want a comment to be preserved, it must instead use `//` or `/* */`.
224+
225+
### Generating Documentation
226+
227+
The documentation can be generated with `make docs` and cleaned up with `make
228+
clean-docs`. The resulting files are located in `doc/doxygen/html`; open
229+
`index.html` in that directory to view the homepage.
230+
231+
Before running `make docs`, you'll need to install these dependencies:
232+
233+
Linux: `sudo apt install doxygen graphviz`
234+
235+
MacOS: `brew install doxygen graphviz`
198236

199237
Development tips and tricks
200238
---------------------------

0 commit comments

Comments
 (0)