-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
when this option in set to ``True`` this will ignore the warning. Allowing docstrings to start with params. Add setting ``indent_size``. Add subsequent test case.
- Loading branch information
1 parent
49200f4
commit 7ad62fb
Showing
15 changed files
with
209 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
tests/documentation/test_files/DocumentationStyleBear/bad_file.py.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
def hello_there(x): | ||
def improper_indents(indents): | ||
""" | ||
hello and no following empty lines | ||
:param x: | ||
Contains improper indents and no following empty line below. | ||
:param indents: | ||
5 space indent | ||
just a second test | ||
4 space indent | ||
|
||
:return: | ||
3 space indent | ||
following lines are 4 space indented | ||
4 space indent | ||
""" | ||
return None |
10 changes: 5 additions & 5 deletions
10
tests/documentation/test_files/DocumentationStyleBear/bad_file.py.test.correct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
def hello_there(x): | ||
def improper_indents(indents): | ||
""" | ||
hello and no following empty lines | ||
Contains improper indents and no following empty line below. | ||
|
||
:param x: | ||
:param indents: | ||
5 space indent | ||
just a second test | ||
4 space indent | ||
:return: | ||
3 space indent | ||
following lines are 4 space indented | ||
4 space indent | ||
""" | ||
return None |
24 changes: 15 additions & 9 deletions
24
tests/documentation/test_files/DocumentationStyleBear/bad_file2.py.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
def x(): | ||
return 55 | ||
def docstring_missing(): | ||
return None | ||
|
||
|
||
def qr(): | ||
def docstring_testcase(dummy): | ||
""" | ||
this is heavy | ||
Improper 3 indents. | ||
|
||
:param x: | ||
ss | ||
:return:abc"""; return 88 | ||
:param dummy: | ||
dummy description | ||
:return:nothing""" return None | ||
|
||
|
||
def w(): | ||
""" Hello world """ | ||
def docstring_singleliner(): | ||
""" This is singleliner docstring. """ | ||
|
||
|
||
def docstring_inline(): | ||
""" | ||
Docstring followed by an inline docstring. | ||
""" # This is inline docstring |
26 changes: 16 additions & 10 deletions
26
tests/documentation/test_files/DocumentationStyleBear/bad_file2.py.test.correct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
def x(): | ||
return 55 | ||
def docstring_missing(): | ||
return None | ||
|
||
|
||
def qr(): | ||
def docstring_testcase(dummy): | ||
""" | ||
this is heavy | ||
Improper 3 indents. | ||
|
||
:param x: | ||
ss | ||
:param dummy: | ||
dummy description | ||
:return: | ||
abc | ||
"""; return 88 | ||
nothing | ||
""" return None | ||
|
||
|
||
def w(): | ||
def docstring_singleliner(): | ||
""" | ||
Hello world | ||
This is singleliner docstring. | ||
""" | ||
|
||
|
||
def docstring_inline(): | ||
""" | ||
Docstring followed by an inline docstring. | ||
""" # This is inline docstring |
52 changes: 49 additions & 3 deletions
52
tests/documentation/test_files/DocumentationStyleBear/bad_file3.py.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,49 @@ | ||
""" | ||
:param t:xyz | ||
:return:123""" | ||
def docstring_missing_description(dummy): | ||
""" | ||
:param dummy:dummy description | ||
:return:nothing""" | ||
return None | ||
|
||
|
||
class docstring_class_testcase(dummy): | ||
""" | ||
Example docstring class. | ||
:param dummy:dummy description | ||
:return:nothing | ||
""" | ||
|
||
def docstring_memberfunction(self, dummy): | ||
""" | ||
This is a member function. | ||
:param dummy:dummy description | ||
:return:nothing | ||
""" | ||
return None | ||
return None | ||
|
||
|
||
class docstring_if_indented(): | ||
"""This is if indented function example.""" | ||
|
||
if 1 != 0: | ||
def hello_planet(self): | ||
""" | ||
This is `if` indented block function. | ||
""" | ||
else: | ||
def hello_venus(self): | ||
"""This is `if` indented block function.""" | ||
|
||
|
||
def docstring_inner_function(dummy): | ||
""" | ||
This is docstring inner function example. | ||
:param dummy: dummy description | ||
""" | ||
def check_directory(dummy): | ||
""" | ||
This is the inner function. | ||
:param dummy: dummy description | ||
:return: nothing | ||
""" | ||
return None |
73 changes: 67 additions & 6 deletions
73
tests/documentation/test_files/DocumentationStyleBear/bad_file3.py.test.correct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,67 @@ | ||
""" | ||
:param t: | ||
xyz | ||
:return: | ||
123 | ||
""" | ||
def docstring_missing_description(dummy): | ||
""" | ||
:param dummy: | ||
dummy description | ||
:return: | ||
nothing | ||
""" | ||
return None | ||
|
||
|
||
class docstring_class_testcase(dummy): | ||
""" | ||
Example docstring class. | ||
|
||
:param dummy: | ||
dummy description | ||
:return: | ||
nothing | ||
""" | ||
|
||
def docstring_memberfunction(self, dummy): | ||
""" | ||
This is a member function. | ||
|
||
:param dummy: | ||
dummy description | ||
:return: | ||
nothing | ||
""" | ||
return None | ||
return None | ||
|
||
|
||
class docstring_if_indented(): | ||
""" | ||
This is if indented function example. | ||
""" | ||
|
||
if 1 != 0: | ||
def hello_planet(self): | ||
""" | ||
This is `if` indented block function. | ||
""" | ||
else: | ||
def hello_venus(self): | ||
""" | ||
This is `if` indented block function. | ||
""" | ||
|
||
|
||
def docstring_inner_function(dummy): | ||
""" | ||
This is docstring inner function example. | ||
|
||
:param dummy: | ||
dummy description | ||
""" | ||
def check_directory(dummy): | ||
""" | ||
This is the inner function. | ||
|
||
:param dummy: | ||
dummy description | ||
:return: | ||
nothing | ||
""" | ||
return None |
2 changes: 1 addition & 1 deletion
2
tests/documentation/test_files/DocumentationStyleBear/bad_file4.py.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
def myfunc(a, b, x): | ||
def docstring_missing_descriptions(a, b, x): | ||
""" | ||
|
||
:param a:slope | ||
|
2 changes: 1 addition & 1 deletion
2
tests/documentation/test_files/DocumentationStyleBear/bad_file4.py.test.correct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
def myfunc(a, b, x): | ||
def docstring_missing_descriptions(a, b, x): | ||
""" | ||
|
||
:param a: | ||
|
7 changes: 4 additions & 3 deletions
7
tests/documentation/test_files/DocumentationStyleBear/bad_file5.py.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
def empty(): | ||
def docstring_improper_alignment(): | ||
""" | ||
first line not correctly aligned. | ||
First line not correctly aligned. | ||
But second can be aligned differently. | ||
Tabs are used here instead of spaces. | ||
|
||
:param x: | ||
:return: | ||
"""; return 88 | ||
""" return None |
7 changes: 4 additions & 3 deletions
7
tests/documentation/test_files/DocumentationStyleBear/bad_file5.py.test.correct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
def empty(): | ||
def docstring_improper_alignment(): | ||
""" | ||
first line not correctly aligned. | ||
First line not correctly aligned. | ||
But second can be aligned differently. | ||
Tabs are used here instead of spaces. | ||
|
||
:param x: | ||
:return: | ||
"""; return 88 | ||
""" return None |
14 changes: 7 additions & 7 deletions
14
tests/documentation/test_files/DocumentationStyleBear/good_file.py.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
def hello_there(x): | ||
def docstring_accepted(dummy): | ||
""" | ||
hello | ||
This is the accepted standard of a docstring. | ||
|
||
:param x: | ||
4 space indent | ||
just a second test | ||
:param dummy: | ||
first line description | ||
second line description | ||
:return: | ||
4 space indent | ||
following lines are 4 space indented | ||
first line description | ||
second line description | ||
""" | ||
return None |
8 changes: 4 additions & 4 deletions
8
tests/documentation/test_files/DocumentationStyleBear/good_file2.py.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
def empty(): | ||
def docstring_missing_descriptions(dummy): | ||
""" | ||
this is heavy | ||
This contains missing descriptions of parsed metadata. | ||
|
||
:param x: | ||
:param dummy: | ||
:return: | ||
"""; return 88 | ||
""" return None |
6 changes: 6 additions & 0 deletions
6
tests/documentation/test_files/DocumentationStyleBear/good_file3.py.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def docstring_missing_description(dummy): | ||
""" | ||
:param dummy: | ||
a function starting with `param` | ||
in this case allow_missing_func_desc = True | ||
""" |