-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc7feb6
commit 8cd1d0a
Showing
9 changed files
with
352 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
crates/ruff_linter/resources/test/fixtures/pydoclint/DOC402_google.py
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,68 @@ | ||
# DOC402 | ||
def foo(num: int) -> str: | ||
""" | ||
Do something | ||
Args: | ||
num (int): A number | ||
""" | ||
yield 'test' | ||
|
||
|
||
# OK | ||
def foo(num: int) -> str: | ||
""" | ||
Do something | ||
Args: | ||
num (int): A number | ||
Yields: | ||
str: A string | ||
""" | ||
yield 'test' | ||
|
||
|
||
class Bar: | ||
|
||
# OK | ||
def foo(self) -> str: | ||
""" | ||
Do something | ||
Args: | ||
num (int): A number | ||
Yields: | ||
str: A string | ||
""" | ||
yield 'test' | ||
|
||
|
||
# DOC402 | ||
def bar(self) -> str: | ||
""" | ||
Do something | ||
Args: | ||
num (int): A number | ||
""" | ||
yield 'test' | ||
|
||
|
||
# OK | ||
def test(): | ||
"""Do something.""" | ||
# DOC402 | ||
def nested(): | ||
"""Do something nested.""" | ||
yield 5 | ||
|
||
print("I never yield") | ||
|
||
|
||
# DOC402 | ||
def test(): | ||
"""Do something.""" | ||
yield from range(10) | ||
|
62 changes: 62 additions & 0 deletions
62
crates/ruff_linter/resources/test/fixtures/pydoclint/DOC402_numpy.py
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,62 @@ | ||
# DOC402 | ||
def foo(num: int) -> str: | ||
""" | ||
Do something | ||
Parameters | ||
---------- | ||
num : int | ||
A number | ||
""" | ||
yield 'test' | ||
|
||
|
||
# OK | ||
def foo(num: int) -> str: | ||
""" | ||
Do something | ||
Parameters | ||
---------- | ||
num : int | ||
A number | ||
Yields | ||
------- | ||
str | ||
A string | ||
""" | ||
yield 'test' | ||
|
||
|
||
class Bar: | ||
|
||
# OK | ||
def foo(self) -> str: | ||
""" | ||
Do something | ||
Parameters | ||
---------- | ||
num : int | ||
A number | ||
Yields | ||
------- | ||
str | ||
A string | ||
""" | ||
yield 'test' | ||
|
||
|
||
# DOC402 | ||
def bar(self) -> str: | ||
""" | ||
Do something | ||
Parameters | ||
---------- | ||
num : int | ||
A number | ||
""" | ||
yield 'test' |
50 changes: 50 additions & 0 deletions
50
crates/ruff_linter/resources/test/fixtures/pydoclint/DOC403_google.py
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,50 @@ | ||
# OK | ||
def foo(num: int) -> str: | ||
""" | ||
Do something | ||
Args: | ||
num (int): A number | ||
""" | ||
print('test') | ||
|
||
|
||
# DOC403 | ||
def foo(num: int) -> str: | ||
""" | ||
Do something | ||
Args: | ||
num (int): A number | ||
Yields: | ||
str: A string | ||
""" | ||
print('test') | ||
|
||
|
||
class Bar: | ||
|
||
# DOC403 | ||
def foo(self) -> str: | ||
""" | ||
Do something | ||
Args: | ||
num (int): A number | ||
Yields: | ||
str: A string | ||
""" | ||
print('test') | ||
|
||
|
||
# OK | ||
def bar(self) -> str: | ||
""" | ||
Do something | ||
Args: | ||
num (int): A number | ||
""" | ||
print('test') |
62 changes: 62 additions & 0 deletions
62
crates/ruff_linter/resources/test/fixtures/pydoclint/DOC403_numpy.py
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,62 @@ | ||
# OK | ||
def foo(num: int) -> str: | ||
""" | ||
Do something | ||
Parameters | ||
---------- | ||
num : int | ||
A number | ||
""" | ||
print('test') | ||
|
||
|
||
# DOC403 | ||
def foo(num: int) -> str: | ||
""" | ||
Do something | ||
Parameters | ||
---------- | ||
num : int | ||
A number | ||
Yields | ||
------- | ||
str | ||
A string | ||
""" | ||
print('test') | ||
|
||
|
||
class Bar: | ||
|
||
# DOC403 | ||
def foo(self) -> str: | ||
""" | ||
Do something | ||
Parameters | ||
---------- | ||
num : int | ||
A number | ||
Yields | ||
------- | ||
str | ||
A string | ||
""" | ||
print('test') | ||
|
||
|
||
# OK | ||
def bar(self) -> str: | ||
""" | ||
Do something | ||
Parameters | ||
---------- | ||
num : int | ||
A number | ||
""" | ||
print('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
24 changes: 24 additions & 0 deletions
24
...s/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_google.py.snap
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,24 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pydoclint/mod.rs | ||
--- | ||
DOC403_google.py:20:1: DOC403 Docstring should not have a yields section because the function doesn't yield anything | ||
| | ||
18 | num (int): A number | ||
19 | | ||
20 | / Yields: | ||
21 | | str: A string | ||
22 | | """ | ||
| |____^ DOC403 | ||
23 | print('test') | ||
| | ||
|
||
DOC403_google.py:36:1: DOC403 Docstring should not have a yields section because the function doesn't yield anything | ||
| | ||
34 | num (int): A number | ||
35 | | ||
36 | / Yields: | ||
37 | | str: A string | ||
38 | | """ | ||
| |________^ DOC403 | ||
39 | print('test') | ||
| |
28 changes: 28 additions & 0 deletions
28
...ts/ruff_linter__rules__pydoclint__tests__docstring-extraneous-yields_DOC403_numpy.py.snap
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,28 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pydoclint/mod.rs | ||
--- | ||
DOC403_numpy.py:24:1: DOC403 Docstring should not have a yields section because the function doesn't yield anything | ||
| | ||
22 | A number | ||
23 | | ||
24 | / Yields | ||
25 | | ------- | ||
26 | | str | ||
27 | | A string | ||
28 | | """ | ||
| |____^ DOC403 | ||
29 | print('test') | ||
| | ||
|
||
DOC403_numpy.py:44:1: DOC403 Docstring should not have a yields section because the function doesn't yield anything | ||
| | ||
42 | A number | ||
43 | | ||
44 | / Yields | ||
45 | | ------- | ||
46 | | str | ||
47 | | A string | ||
48 | | """ | ||
| |________^ DOC403 | ||
49 | print('test') | ||
| |
36 changes: 36 additions & 0 deletions
36
...hots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_google.py.snap
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,36 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pydoclint/mod.rs | ||
--- | ||
DOC402_google.py:9:5: DOC402 `yield` is not documented in docstring | ||
| | ||
7 | num (int): A number | ||
8 | """ | ||
9 | yield 'test' | ||
| ^^^^^^^^^^^^ DOC402 | ||
| | ||
|
||
DOC402_google.py:50:9: DOC402 `yield` is not documented in docstring | ||
| | ||
48 | num (int): A number | ||
49 | """ | ||
50 | yield 'test' | ||
| ^^^^^^^^^^^^ DOC402 | ||
| | ||
|
||
DOC402_google.py:59:9: DOC402 `yield` is not documented in docstring | ||
| | ||
57 | def nested(): | ||
58 | """Do something nested.""" | ||
59 | yield 5 | ||
| ^^^^^^^ DOC402 | ||
60 | | ||
61 | print("I never yield") | ||
| | ||
|
||
DOC402_google.py:67:5: DOC402 `yield` is not documented in docstring | ||
| | ||
65 | def test(): | ||
66 | """Do something.""" | ||
67 | yield from range(10) | ||
| ^^^^^^^^^^^^^^^^^^^^ DOC402 | ||
| |
18 changes: 18 additions & 0 deletions
18
...shots/ruff_linter__rules__pydoclint__tests__docstring-missing-yields_DOC402_numpy.py.snap
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,18 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pydoclint/mod.rs | ||
--- | ||
DOC402_numpy.py:11:5: DOC402 `yield` is not documented in docstring | ||
| | ||
9 | A number | ||
10 | """ | ||
11 | yield 'test' | ||
| ^^^^^^^^^^^^ DOC402 | ||
| | ||
|
||
DOC402_numpy.py:62:9: DOC402 `yield` is not documented in docstring | ||
| | ||
60 | A number | ||
61 | """ | ||
62 | yield 'test' | ||
| ^^^^^^^^^^^^ DOC402 | ||
| |