Skip to content

Commit

Permalink
revert diagnostic location
Browse files Browse the repository at this point in the history
  • Loading branch information
dylwil3 committed Dec 16, 2024
1 parent 0387824 commit 9760bc8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub(crate) fn capitalized(checker: &mut Checker, docstring: &Docstring) {
first_word: first_word.to_string(),
capitalized_word: capitalized_word.to_string(),
},
TextRange::at(body.start() + leading_whitespace_len, first_word.text_len()),
docstring.range(),
);

diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs
---
D403.py:2:8: D403 [*] First word of the docstring should be capitalized: `this` -> `This`
D403.py:2:5: D403 [*] First word of the docstring should be capitalized: `this` -> `This`
|
1 | def bad_function():
2 | """this docstring is not capitalized"""
| ^^^^ D403
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D403
3 |
4 | def good_function():
|
Expand All @@ -19,11 +19,11 @@ D403.py:2:8: D403 [*] First word of the docstring should be capitalized: `this`
4 4 | def good_function():
5 5 | """This docstring is capitalized."""

D403.py:30:8: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
D403.py:30:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
29 | def single_word():
30 | """singleword."""
| ^^^^^^^^^^ D403
| ^^^^^^^^^^^^^^^^^ D403
31 |
32 | def single_word_no_dot():
|
Expand All @@ -39,11 +39,11 @@ D403.py:30:8: D403 [*] First word of the docstring should be capitalized: `singl
32 32 | def single_word_no_dot():
33 33 | """singleword"""

D403.py:33:8: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
D403.py:33:5: D403 [*] First word of the docstring should be capitalized: `singleword` -> `Singleword`
|
32 | def single_word_no_dot():
33 | """singleword"""
| ^^^^^^^^^^ D403
| ^^^^^^^^^^^^^^^^ D403
34 |
35 | def first_word_lots_of_whitespace():
|
Expand All @@ -59,12 +59,19 @@ D403.py:33:8: D403 [*] First word of the docstring should be capitalized: `singl
35 35 | def first_word_lots_of_whitespace():
36 36 | """
D403.py:40:5: D403 [*] First word of the docstring should be capitalized: `here` -> `Here`
D403.py:36:5: D403 [*] First word of the docstring should be capitalized: `here` -> `Here`
|
40 | here is the start of my docstring!
| ^^^^ D403
41 |
42 | What do you think?
35 | def first_word_lots_of_whitespace():
36 | """
| _____^
37 | |
38 | |
39 | |
40 | | here is the start of my docstring!
41 | |
42 | | What do you think?
43 | | """
| |_______^ D403
|
= help: Capitalize `here` to `Here`

Expand Down

0 comments on commit 9760bc8

Please sign in to comment.