Skip to content

Commit

Permalink
added some more test cases to cover examples reported in astral-sh#13167
Browse files Browse the repository at this point in the history
  • Loading branch information
my1e5 committed Dec 20, 2024
1 parent 61effe6 commit 658af48
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 13 deletions.
40 changes: 38 additions & 2 deletions crates/ruff_linter/resources/test/fixtures/pydocstyle/D403.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,48 @@ def first_word_lots_of_whitespace():
What do you think?
"""

def single_word_then_newline():
def single_word_newline():
"""singleword
"""

def single_word_on_second_line():
def single_word_dot_newline():
"""singleword.
"""

def single_word_second_line():
"""
singleword
"""

def single_word_dot_second_line():
"""
singleword.
"""

def single_word_then_more_text():
"""singleword
This is more text.
"""

def single_word_dot_then_more_text():
"""singleword.
This is more text.
"""

def single_word_second_line_then_more_text():
"""
singleword
This is more text.
"""

def single_word_dot_second_line_then_more_text():
"""
singleword.
This is more text.
"""
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ D403.py:36:5: D403 [*] First word of the docstring should be capitalized: `here`
43 | | """
| |_______^ D403
44 |
45 | def single_word_then_newline():
45 | def single_word_newline():
|
= help: Capitalize `here` to `Here`

Expand All @@ -90,21 +90,21 @@ D403.py:36:5: D403 [*] First word of the docstring should be capitalized: `here`
D403.py:46:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
45 | def single_word_then_newline():
45 | def single_word_newline():
46 | """singleword
| _____^
47 | |
48 | | """
| |_______^ D403
49 |
50 | def single_word_on_second_line():
50 | def single_word_dot_newline():
|
= help: Capitalize `singleword` to `Singleword`

Safe fix
43 43 | """
44 44 |
45 45 | def single_word_then_newline():
45 45 | def single_word_newline():
46 |- """singleword
46 |+ """Singleword
47 47 |
Expand All @@ -113,19 +113,165 @@ D403.py:46:5: D403 [*] First word of the docstring should be capitalized: `singl

D403.py:51:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
50 | def single_word_on_second_line():
51 | """
50 | def single_word_dot_newline():
51 | """singleword.
| _____^
52 | | singleword
52 | |
53 | | """
| |_______^ D403
54 |
55 | def single_word_second_line():
|
= help: Capitalize `singleword` to `Singleword`

Safe fix
48 48 | """
49 49 |
50 50 | def single_word_on_second_line():
51 51 | """
52 |- singleword
52 |+ Singleword
50 50 | def single_word_dot_newline():
51 |- """singleword.
51 |+ """Singleword.
52 52 |
53 53 | """
54 54 |

D403.py:56:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
55 | def single_word_second_line():
56 | """
| _____^
57 | | singleword
58 | | """
| |_______^ D403
59 |
60 | def single_word_dot_second_line():
|
= help: Capitalize `singleword` to `Singleword`

Safe fix
54 54 |
55 55 | def single_word_second_line():
56 56 | """
57 |- singleword
57 |+ Singleword
58 58 | """
59 59 |
60 60 | def single_word_dot_second_line():

D403.py:61:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
60 | def single_word_dot_second_line():
61 | """
| _____^
62 | | singleword.
63 | | """
| |_______^ D403
64 |
65 | def single_word_then_more_text():
|
= help: Capitalize `singleword` to `Singleword`

Safe fix
59 59 |
60 60 | def single_word_dot_second_line():
61 61 | """
62 |- singleword.
62 |+ Singleword.
63 63 | """
64 64 |
65 65 | def single_word_then_more_text():

D403.py:66:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
65 | def single_word_then_more_text():
66 | """singleword
| _____^
67 | |
68 | | This is more text.
69 | | """
| |_______^ D403
70 |
71 | def single_word_dot_then_more_text():
|
= help: Capitalize `singleword` to `Singleword`

Safe fix
63 63 | """
64 64 |
65 65 | def single_word_then_more_text():
66 |- """singleword
66 |+ """Singleword
67 67 |
68 68 | This is more text.
69 69 | """
D403.py:72:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
71 | def single_word_dot_then_more_text():
72 | """singleword.
| _____^
73 | |
74 | | This is more text.
75 | | """
| |_______^ D403
76 |
77 | def single_word_second_line_then_more_text():
|
= help: Capitalize `singleword` to `Singleword`

Safe fix
69 69 | """
70 70 |
71 71 | def single_word_dot_then_more_text():
72 |- """singleword.
72 |+ """Singleword.
73 73 |
74 74 | This is more text.
75 75 | """
D403.py:78:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
77 | def single_word_second_line_then_more_text():
78 | """
| _____^
79 | | singleword
80 | |
81 | | This is more text.
82 | | """
| |_______^ D403
83 |
84 | def single_word_dot_second_line_then_more_text():
|
= help: Capitalize `singleword` to `Singleword`

Safe fix
76 76 |
77 77 | def single_word_second_line_then_more_text():
78 78 | """
79 |- singleword
79 |+ Singleword
80 80 |
81 81 | This is more text.
82 82 | """
D403.py:85:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
84 | def single_word_dot_second_line_then_more_text():
85 | """
| _____^
86 | | singleword.
87 | |
88 | | This is more text.
89 | | """
| |_______^ D403
|
= help: Capitalize `singleword` to `Singleword`

Safe fix
83 83 |
84 84 | def single_word_dot_second_line_then_more_text():
85 85 | """
86 |- singleword.
86 |+ Singleword.
87 87 |
88 88 | This is more text.
89 89 | """

0 comments on commit 658af48

Please sign in to comment.