@@ -7,16 +7,12 @@ use ruff_text_size::Ranged;
7
7
8
8
use crate :: Locator ;
9
9
use crate :: checkers:: ast:: Checker ;
10
- use crate :: preview:: is_raise_exception_byte_string_enabled;
11
10
use crate :: registry:: Rule ;
12
11
use crate :: { Edit , Fix , FixAvailability , Violation } ;
13
12
14
13
/// ## What it does
15
14
/// Checks for the use of string literals in exception constructors.
16
15
///
17
- /// In [preview], this rule checks for byte string literals in
18
- /// exception constructors.
19
- ///
20
16
/// ## Why is this bad?
21
17
/// Python includes the `raise` in the default traceback (and formatters
22
18
/// like Rich and IPython do too).
@@ -51,8 +47,6 @@ use crate::{Edit, Fix, FixAvailability, Violation};
51
47
/// raise RuntimeError(msg)
52
48
/// RuntimeError: 'Some value' is incorrect
53
49
/// ```
54
- ///
55
- /// [preview]: https://docs.astral.sh/ruff/preview/
56
50
#[ derive( ViolationMetadata ) ]
57
51
pub ( crate ) struct RawStringInException ;
58
52
@@ -218,9 +212,7 @@ pub(crate) fn string_in_exception(checker: &Checker, stmt: &Stmt, exc: &Expr) {
218
212
// Check for byte string literals.
219
213
Expr :: BytesLiteral ( ast:: ExprBytesLiteral { value : bytes, .. } ) => {
220
214
if checker. settings ( ) . rules . enabled ( Rule :: RawStringInException ) {
221
- if bytes. len ( ) >= checker. settings ( ) . flake8_errmsg . max_string_length
222
- && is_raise_exception_byte_string_enabled ( checker. settings ( ) )
223
- {
215
+ if bytes. len ( ) >= checker. settings ( ) . flake8_errmsg . max_string_length {
224
216
let mut diagnostic =
225
217
checker. report_diagnostic ( RawStringInException , first. range ( ) ) ;
226
218
if let Some ( indentation) = whitespace:: indentation ( checker. source ( ) , stmt) {
0 commit comments