Skip to content

Commit e4a9f61

Browse files
committed
merge lp:~dreid/twistedchecker/blank-lines-before-more-fields
2 parents 1424958 + 4e45027 commit e4a9f61

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

twistedchecker/checkers/docstring.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ def _checkBlankLineBeforeEpytext(self, node_type, node, linenoDocstring):
207207
@param linenoDocstring: linenumber of docstring
208208
"""
209209
# Check whether there is a blank line before epytext markups.
210-
patternEpytext = (r"\n *@(param|type|return|returns|rtype)"
210+
patternEpytext = (r"\n *@(param|type|return|returns|rtype|ivar|cvar"
211+
r"|raises|raise)"
211212
r"\s*[a-zA-Z0-9_]*\s*\:")
212213
matchedEpytext = re.search(patternEpytext, node.doc)
213214
if matchedEpytext:

twistedchecker/functionaltests/docstring_pass.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,40 @@ def f(self):
6262
A method returns nothing.
6363
"""
6464
return
65+
66+
67+
68+
class Bar(self):
69+
"""
70+
A cvar is recognized as being the start of epytext markup.
71+
72+
@cvar foo: bar baz
73+
@type foo: bax
74+
"""
75+
76+
def a(self):
77+
"""
78+
A raises field is recognized as being the start of epytext markup.
79+
80+
@raises FoobarException: An exception.
81+
@returns: C{int}
82+
"""
83+
84+
def b(self):
85+
"""
86+
A raise (because we are inconsistent about stuff) should also be
87+
recognized as the start of epytext markup.
88+
89+
@raise BarException: Another exception.
90+
@returns: C{int}
91+
"""
92+
93+
94+
95+
class Baz(self):
96+
"""
97+
An ivar is recognized as being the start of epytext markup.
98+
99+
@ivar foo: bar baz
100+
@type foo: bax
101+
"""

0 commit comments

Comments
 (0)