-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Add fix for `D301` ## Test Plan `cargo test` and manually
- Loading branch information
1 parent
195c000
commit dda4ced
Showing
4 changed files
with
39 additions
and
31 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
27 changes: 11 additions & 16 deletions
27
...nter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D.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 |
---|---|---|
@@ -1,28 +1,23 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs | ||
--- | ||
D.py:328:5: D301 Use `r"""` if any backslashes in a docstring | ||
| | ||
326 | @expect('D301: Use r""" if any backslashes in a docstring') | ||
327 | def single_quotes_raw_uppercase_backslash(): | ||
328 | R'Sum\mary.' | ||
| ^^^^^^^^^^^^ D301 | ||
| | ||
|
||
D.py:333:5: D301 Use `r"""` if any backslashes in a docstring | ||
D.py:333:5: D301 [*] Use `r"""` if any backslashes in a docstring | ||
| | ||
331 | @expect('D301: Use r""" if any backslashes in a docstring') | ||
332 | def double_quotes_backslash(): | ||
333 | """Sum\\mary.""" | ||
| ^^^^^^^^^^^^^^^^ D301 | ||
| | ||
= help: Add `r` prefix | ||
|
||
D.py:338:5: D301 Use `r"""` if any backslashes in a docstring | ||
| | ||
336 | @expect('D301: Use r""" if any backslashes in a docstring') | ||
337 | def double_quotes_backslash_uppercase(): | ||
338 | R"""Sum\\mary.""" | ||
| ^^^^^^^^^^^^^^^^^ D301 | ||
| | ||
ℹ Suggested fix | ||
330 330 | | ||
331 331 | @expect('D301: Use r""" if any backslashes in a docstring') | ||
332 332 | def double_quotes_backslash(): | ||
333 |- """Sum\\mary.""" | ||
333 |+ r"""Sum\\mary.""" | ||
334 334 | | ||
335 335 | | ||
336 336 | @expect('D301: Use r""" if any backslashes in a docstring') | ||
|
||
|
16 changes: 9 additions & 7 deletions
16
...r/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D301_D301.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 |
---|---|---|
@@ -1,18 +1,20 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pydocstyle/mod.rs | ||
--- | ||
D301.py:2:5: D301 Use `r"""` if any backslashes in a docstring | ||
D301.py:2:5: D301 [*] Use `r"""` if any backslashes in a docstring | ||
| | ||
1 | def double_quotes_backslash(): | ||
2 | """Sum\\mary.""" | ||
| ^^^^^^^^^^^^^^^^ D301 | ||
| | ||
= help: Add `r` prefix | ||
|
||
D301.py:10:5: D301 Use `r"""` if any backslashes in a docstring | ||
| | ||
9 | def double_quotes_backslash_uppercase(): | ||
10 | R"""Sum\\mary.""" | ||
| ^^^^^^^^^^^^^^^^^ D301 | ||
| | ||
ℹ Suggested fix | ||
1 1 | def double_quotes_backslash(): | ||
2 |- """Sum\\mary.""" | ||
2 |+ r"""Sum\\mary.""" | ||
3 3 | | ||
4 4 | | ||
5 5 | def double_quotes_backslash_raw(): | ||
|
||
|