-
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.
Respect Q00* ignores in flake8-quotes rules
- Loading branch information
1 parent
67f0f61
commit cdaf1df
Showing
6 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
crates/ruff_linter/resources/test/fixtures/flake8_quotes/doubles_all.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,7 @@ | ||
"""This is a docstring.""" | ||
|
||
this_is_an_inline_string = "double quote string" | ||
|
||
this_is_a_multiline_string = """ | ||
double quote string | ||
""" |
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
18 changes: 18 additions & 0 deletions
18
...es/snapshots/ruff_linter__rules__flake8_quotes__tests__only_docstring_doubles_all.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/flake8_quotes/mod.rs | ||
--- | ||
doubles_all.py:1:1: Q002 [*] Double quote docstring found but single quotes preferred | ||
| | ||
1 | """This is a docstring.""" | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Q002 | ||
2 | | ||
3 | this_is_an_inline_string = "double quote string" | ||
| | ||
= help: Replace double quotes docstring with single quotes | ||
|
||
ℹ Safe fix | ||
1 |-"""This is a docstring.""" | ||
1 |+'''This is a docstring.''' | ||
2 2 | | ||
3 3 | this_is_an_inline_string = "double quote string" | ||
4 4 | |
22 changes: 22 additions & 0 deletions
22
...uotes/snapshots/ruff_linter__rules__flake8_quotes__tests__only_inline_doubles_all.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,22 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs | ||
--- | ||
doubles_all.py:3:28: Q000 [*] Double quotes found but single quotes preferred | ||
| | ||
1 | """This is a docstring.""" | ||
2 | | ||
3 | this_is_an_inline_string = "double quote string" | ||
| ^^^^^^^^^^^^^^^^^^^^^ Q000 | ||
4 | | ||
5 | this_is_a_multiline_string = """ | ||
| | ||
= help: Replace double quotes with single quotes | ||
|
||
ℹ Safe fix | ||
1 1 | """This is a docstring.""" | ||
2 2 | | ||
3 |-this_is_an_inline_string = "double quote string" | ||
3 |+this_is_an_inline_string = 'double quote string' | ||
4 4 | | ||
5 5 | this_is_a_multiline_string = """ | ||
6 6 | double quote string |
24 changes: 24 additions & 0 deletions
24
...es/snapshots/ruff_linter__rules__flake8_quotes__tests__only_multiline_doubles_all.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/flake8_quotes/mod.rs | ||
--- | ||
doubles_all.py:5:30: Q001 [*] Double quote multiline found but single quotes preferred | ||
| | ||
3 | this_is_an_inline_string = "double quote string" | ||
4 | | ||
5 | this_is_a_multiline_string = """ | ||
| ______________________________^ | ||
6 | | double quote string | ||
7 | | """ | ||
| |___^ Q001 | ||
| | ||
= help: Replace double multiline quotes with single quotes | ||
|
||
ℹ Safe fix | ||
2 2 | | ||
3 3 | this_is_an_inline_string = "double quote string" | ||
4 4 | | ||
5 |-this_is_a_multiline_string = """ | ||
5 |+this_is_a_multiline_string = ''' | ||
6 6 | double quote string | ||
7 |-""" | ||
7 |+''' |