Reword H404 description to match check
The check only checks that a multiline docstring starts without a newline. The message "should start with a summary" is misleading reviewers, as can be seen in e.g. https://review.openstack.org/#/c/40114/ The "check for summary at beginning being less than 80 chars and end with punctation" needs to be moved to a new hacking check to preserve compatibility. Change-Id: I694b0dc55706ccf8ada9bb132cc7efb3c49cd0d6
This commit is contained in:
parent
6e1404cb22
commit
57e14d627a
@ -584,10 +584,10 @@ def hacking_docstring_multiline_end(physical_line, previous_logical, tokens):
|
|||||||
|
|
||||||
@flake8ext
|
@flake8ext
|
||||||
def hacking_docstring_multiline_start(physical_line, previous_logical, tokens):
|
def hacking_docstring_multiline_start(physical_line, previous_logical, tokens):
|
||||||
r"""Check multi line docstring start with summary.
|
r"""Check multi line docstring starts immediately with summary.
|
||||||
|
|
||||||
OpenStack HACKING guide recommendation for docstring:
|
OpenStack HACKING guide recommendation for docstring:
|
||||||
Docstring should start with A multi line docstring has a one-line summary
|
Docstring should start with a one-line summary, less than 80 characters.
|
||||||
|
|
||||||
Okay: '''foobar\nfoo\nbar\n'''
|
Okay: '''foobar\nfoo\nbar\n'''
|
||||||
Okay: def foo():\n a = '''\nnot\na docstring\n'''
|
Okay: def foo():\n a = '''\nnot\na docstring\n'''
|
||||||
@ -599,7 +599,7 @@ def hacking_docstring_multiline_start(physical_line, previous_logical, tokens):
|
|||||||
if len(tokens) == 0 and pos != -1 and len(physical_line) == pos + 4:
|
if len(tokens) == 0 and pos != -1 and len(physical_line) == pos + 4:
|
||||||
if physical_line.strip() in START_DOCSTRING_TRIPLE:
|
if physical_line.strip() in START_DOCSTRING_TRIPLE:
|
||||||
return (pos, "H404: multi line docstring "
|
return (pos, "H404: multi line docstring "
|
||||||
"should start with a summary")
|
"should start without a leading new line")
|
||||||
|
|
||||||
|
|
||||||
@flake8ext
|
@flake8ext
|
||||||
|
Loading…
Reference in New Issue
Block a user