-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathDocStrings.qhelp
39 lines (28 loc) · 1.24 KB
/
DocStrings.qhelp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>PEP8 mandates that all public modules, classes, functions and methods should have a documentation
string. Ensuring that every public module, class, function and method is documented makes it easier
for other developers to maintain the code.
</p>
</overview>
<recommendation>
<p>If a module, class, function or method needs to be public then add a documentation string that
describes the
purpose or use of the object (see PEP 257 for guidelines). If the object does not need to be public
then make it "private" by changing its name from <code>xxx</code> to <code>_xxx</code>.</p>
</recommendation>
<example>
<p>The following simple, public function should be updated to include a documentation string
immediately after the <code>def</code> line.</p>
<sample src="DocStrings.py" />
<p>You might insert the documentation string: <code>"""Return the sum of x and y."""</code> on line 2.
</p></example>
<references>
<li>Python PEP 8: <a href="http://www.python.org/dev/peps/pep-0008/#documentation-strings">Documentation strings</a>.</li>
<li>Python PEP 257: <a href="http://www.python.org/dev/peps/pep-0257">Documentation string conventions
</a>.</li>
</references>
</qhelp>