Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
B021: f-string used as docstring. (#230)
* B021: f-string used as docstring. * Update README.rst * Update bugbear.py Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com> * There are more docstrings than just triple double quotes! Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
- Loading branch information
Showing
4 changed files
with
115 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
""" | ||
Should emit: | ||
B021 - on lines 14, 22, 30, 38, 46, 54, 62, 70, 73 | ||
""" | ||
|
||
VARIABLE = "world" | ||
|
||
|
||
def foo1(): | ||
"""hello world!""" | ||
|
||
|
||
def foo2(): | ||
f"""hello {VARIABLE}!""" | ||
|
||
|
||
class bar1: | ||
"""hello world!""" | ||
|
||
|
||
class bar2: | ||
f"""hello {VARIABLE}!""" | ||
|
||
|
||
def foo1(): | ||
"""hello world!""" | ||
|
||
|
||
def foo2(): | ||
f"""hello {VARIABLE}!""" | ||
|
||
|
||
class bar1: | ||
"""hello world!""" | ||
|
||
|
||
class bar2: | ||
f"""hello {VARIABLE}!""" | ||
|
||
|
||
def foo1(): | ||
"hello world!" | ||
|
||
|
||
def foo2(): | ||
f"hello {VARIABLE}!" | ||
|
||
|
||
class bar1: | ||
"hello world!" | ||
|
||
|
||
class bar2: | ||
f"hello {VARIABLE}!" | ||
|
||
|
||
def foo1(): | ||
"hello world!" | ||
|
||
|
||
def foo2(): | ||
f"hello {VARIABLE}!" | ||
|
||
|
||
class bar1: | ||
"hello world!" | ||
|
||
|
||
class bar2: | ||
f"hello {VARIABLE}!" | ||
|
||
|
||
def baz(): | ||
f"""I'm probably a docstring: {VARIABLE}!""" | ||
print(f"""I'm a normal string""") | ||
f"""Don't detect me!""" |
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