-
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.
Add documentation for flake8-quotes rules (#2650)
- Loading branch information
1 parent
367f115
commit a9aa96b
Showing
10 changed files
with
192 additions
and
8 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
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
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
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,23 @@ | ||
# avoid-quote-escape (Q003) | ||
|
||
Derived from the **flake8-quotes** linter. | ||
|
||
Autofix is always available. | ||
|
||
### What it does | ||
Checks for strings that include escaped quotes, and suggests changing | ||
the quote style to avoid the need to escape them. | ||
|
||
### Why is this bad? | ||
It's preferable to avoid escaped quotes in strings. By changing the | ||
outer quote style, you can avoid escaping inner quotes. | ||
|
||
### Example | ||
```python | ||
foo = 'bar\'s' | ||
``` | ||
|
||
Use instead: | ||
```python | ||
foo = "bar's" | ||
``` |
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,27 @@ | ||
# bad-quotes-docstring (Q002) | ||
|
||
Derived from the **flake8-quotes** linter. | ||
|
||
Autofix is always available. | ||
|
||
### What it does | ||
Checks for docstrings that use single quotes or double quotes, depending on the value of the [`docstring-quotes`](https://github.com/charliermarsh/ruff#docstring-quotes) | ||
setting. | ||
|
||
### Why is this bad? | ||
Consistency is good. Use either single or double quotes for docstring | ||
strings, but be consistent. | ||
|
||
### Example | ||
```python | ||
''' | ||
bar | ||
''' | ||
``` | ||
|
||
Assuming `docstring-quotes` is set to `double`, use instead: | ||
```python | ||
""" | ||
bar | ||
""" | ||
``` |
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 @@ | ||
# bad-quotes-inline-string (Q000) | ||
|
||
Derived from the **flake8-quotes** linter. | ||
|
||
Autofix is always available. | ||
|
||
### What it does | ||
Checks for inline strings that use single quotes or double quotes, | ||
depending on the value of the [`inline-quotes`](https://github.com/charliermarsh/ruff#inline-quotes) | ||
setting. | ||
|
||
### Why is this bad? | ||
Consistency is good. Use either single or double quotes for inline | ||
strings, but be consistent. | ||
|
||
### Example | ||
```python | ||
foo = 'bar' | ||
``` | ||
|
||
Assuming `inline-quotes` is set to `double`, use instead: | ||
```python | ||
foo = "bar" | ||
``` |
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 @@ | ||
# bad-quotes-multiline-string (Q001) | ||
|
||
Derived from the **flake8-quotes** linter. | ||
|
||
Autofix is always available. | ||
|
||
### What it does | ||
Checks for multiline strings that use single quotes or double quotes, | ||
depending on the value of the [`multiline-quotes`](https://github.com/charliermarsh/ruff#multiline-quotes) | ||
setting. | ||
|
||
### Why is this bad? | ||
Consistency is good. Use either single or double quotes for multiline | ||
strings, but be consistent. | ||
|
||
### Example | ||
```python | ||
foo = ''' | ||
bar | ||
''' | ||
``` | ||
|
||
Assuming `multiline-quotes` is set to `double`, use instead: | ||
```python | ||
foo = """ | ||
bar | ||
""" | ||
``` |