From 2236b4bd5905f8402da36e271a420151726d88d5 Mon Sep 17 00:00:00 2001 From: Harutaka Kawamura Date: Tue, 17 Jan 2023 01:12:43 +0900 Subject: [PATCH] Add backticks to B904's message (#1914) This PR adds backticks to B904's message to improve readability. Without backticks: image With backticks: image --- README.md | 2 +- src/violations.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0eb8a54524..a343686611 100644 --- a/README.md +++ b/README.md @@ -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` | | | 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 | | -| 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 | | ### flake8-builtins (A) diff --git a/src/violations.rs b/src/violations.rs index 379f73abcd..a62a0f42d3 100644 --- a/src/violations.rs +++ b/src/violations.rs @@ -1781,8 +1781,8 @@ define_violation!( ); impl Violation for RaiseWithoutFromInsideExcept { fn message(&self) -> String { - "Within an except clause, raise exceptions with raise ... from err or raise ... from None \ - to distinguish them from errors in exception handling" + "Within an except clause, raise exceptions with `raise ... from err` or `raise ... from \ + None` to distinguish them from errors in exception handling" .to_string() }