Add backticks to B904's message (#1914)

This PR adds backticks to B904's message to improve readability.


Without backticks:

<img width="1480" alt="image" src="https://user-images.githubusercontent.com/17039389/212682457-71f13de9-e3dd-4ead-a82b-98e5b60653c2.png">

With backticks:

<img width="1480" alt="image" src="https://user-images.githubusercontent.com/17039389/212682775-36868401-b63e-47d1-ae25-b43b61866b6c.png">
This commit is contained in:
Harutaka Kawamura 2023-01-17 01:12:43 +09:00 committed by GitHub
parent fbf311f7d5
commit 2236b4bd59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -842,7 +842,7 @@ For more, see [flake8-bugbear](https://pypi.org/project/flake8-bugbear/22.10.27/
| B025 | DuplicateTryBlockException | try-except block with duplicate exception `Exception` | | | B025 | DuplicateTryBlockException | try-except block with duplicate exception `Exception` | |
| B026 | StarArgUnpackingAfterKeywordArg | Star-arg unpacking after a keyword argument is strongly discouraged | | | B026 | StarArgUnpackingAfterKeywordArg | Star-arg unpacking after a keyword argument is strongly discouraged | |
| B027 | EmptyMethodWithoutAbstractDecorator | `...` is an empty method in an abstract base class, but has no abstract decorator | | | B027 | EmptyMethodWithoutAbstractDecorator | `...` is an empty method in an abstract base class, but has no abstract decorator | |
| B904 | RaiseWithoutFromInsideExcept | Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling | | | B904 | RaiseWithoutFromInsideExcept | Within an except clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling | |
| B905 | ZipWithoutExplicitStrict | `zip()` without an explicit `strict=` parameter | | | B905 | ZipWithoutExplicitStrict | `zip()` without an explicit `strict=` parameter | |
### flake8-builtins (A) ### flake8-builtins (A)

View File

@ -1781,8 +1781,8 @@ define_violation!(
); );
impl Violation for RaiseWithoutFromInsideExcept { impl Violation for RaiseWithoutFromInsideExcept {
fn message(&self) -> String { fn message(&self) -> String {
"Within an except clause, raise exceptions with raise ... from err or raise ... from None \ "Within an except clause, raise exceptions with `raise ... from err` or `raise ... from \
to distinguish them from errors in exception handling" None` to distinguish them from errors in exception handling"
.to_string() .to_string()
} }