Tweak capitalization of B021 message (#4350)

This commit is contained in:
Charlie Marsh 2023-05-10 11:59:00 -04:00 committed by GitHub
parent 6d6d7abf70
commit ccdee55e6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions

View file

@ -13,8 +13,7 @@ impl Violation for FStringDocstring {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
format!( format!(
"f-string used as docstring. This will be interpreted by python as a joined string \ "f-string used as docstring. Python will interpret this as a joined string, rather than a docstring."
rather than a docstring."
) )
} }
} }

View file

@ -1,7 +1,7 @@
--- ---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs source: crates/ruff/src/rules/flake8_bugbear/mod.rs
--- ---
B021.py:1:1: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:1:1: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
1 | / f""" 1 | / f"""
2 | | Should emit: 2 | | Should emit:
@ -12,63 +12,63 @@ B021.py:1:1: B021 f-string used as docstring. This will be interpreted by python
6 | VARIABLE = "world" 6 | VARIABLE = "world"
| |
B021.py:14:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:14:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
14 | def foo2(): 14 | def foo2():
15 | f"""hello {VARIABLE}!""" 15 | f"""hello {VARIABLE}!"""
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021 | ^^^^^^^^^^^^^^^^^^^^^^^^ B021
| |
B021.py:22:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:22:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
22 | class bar2: 22 | class bar2:
23 | f"""hello {VARIABLE}!""" 23 | f"""hello {VARIABLE}!"""
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021 | ^^^^^^^^^^^^^^^^^^^^^^^^ B021
| |
B021.py:30:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:30:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
30 | def foo2(): 30 | def foo2():
31 | f"""hello {VARIABLE}!""" 31 | f"""hello {VARIABLE}!"""
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021 | ^^^^^^^^^^^^^^^^^^^^^^^^ B021
| |
B021.py:38:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:38:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
38 | class bar2: 38 | class bar2:
39 | f"""hello {VARIABLE}!""" 39 | f"""hello {VARIABLE}!"""
| ^^^^^^^^^^^^^^^^^^^^^^^^ B021 | ^^^^^^^^^^^^^^^^^^^^^^^^ B021
| |
B021.py:46:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:46:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
46 | def foo2(): 46 | def foo2():
47 | f"hello {VARIABLE}!" 47 | f"hello {VARIABLE}!"
| ^^^^^^^^^^^^^^^^^^^^ B021 | ^^^^^^^^^^^^^^^^^^^^ B021
| |
B021.py:54:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:54:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
54 | class bar2: 54 | class bar2:
55 | f"hello {VARIABLE}!" 55 | f"hello {VARIABLE}!"
| ^^^^^^^^^^^^^^^^^^^^ B021 | ^^^^^^^^^^^^^^^^^^^^ B021
| |
B021.py:62:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:62:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
62 | def foo2(): 62 | def foo2():
63 | f"hello {VARIABLE}!" 63 | f"hello {VARIABLE}!"
| ^^^^^^^^^^^^^^^^^^^^ B021 | ^^^^^^^^^^^^^^^^^^^^ B021
| |
B021.py:70:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:70:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
70 | class bar2: 70 | class bar2:
71 | f"hello {VARIABLE}!" 71 | f"hello {VARIABLE}!"
| ^^^^^^^^^^^^^^^^^^^^ B021 | ^^^^^^^^^^^^^^^^^^^^ B021
| |
B021.py:74:5: B021 f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring. B021.py:74:5: B021 f-string used as docstring. Python will interpret this as a joined string, rather than a docstring.
| |
74 | def baz(): 74 | def baz():
75 | f"""I'm probably a docstring: {VARIABLE}!""" 75 | f"""I'm probably a docstring: {VARIABLE}!"""