@@ -9,17 +9,17 @@ use ruff_text_size::Ranged;
9
9
use crate :: { checkers:: ast:: Checker , settings:: LinterSettings } ;
10
10
11
11
/// ## What it does
12
- /// Checks for non-literal strings being passed to [`markupsafe.Markup`].
12
+ /// Checks for non-literal strings being passed to [`markupsafe.Markup`][markupsafe-markup] .
13
13
///
14
14
/// ## Why is this bad?
15
- /// [`markupsafe.Markup`] does not perform any escaping, so passing dynamic
16
- /// content, like f-strings, variables or interpolated strings will potentially
17
- /// lead to XSS vulnerabilities.
15
+ /// [`markupsafe.Markup`][markupsafe-markup] does not perform any escaping,
16
+ /// so passing dynamic content, like f-strings, variables or interpolated strings
17
+ /// will potentially lead to XSS vulnerabilities.
18
18
///
19
- /// Instead you should interpolate the [`markupsafe. Markup`] object.
19
+ /// Instead you should interpolate the ` Markup` object.
20
20
///
21
21
/// Using [`lint.ruff.extend-markup-names`] additional objects can be
22
- /// treated like [`markupsafe. Markup`] .
22
+ /// treated like ` Markup`.
23
23
///
24
24
/// This rule was originally inspired by [flake8-markupsafe] but doesn't carve
25
25
/// out any exceptions for i18n related calls by default.
@@ -72,7 +72,7 @@ use crate::{checkers::ast::Checker, settings::LinterSettings};
72
72
/// - [MarkupSafe](https://pypi.org/project/MarkupSafe/)
73
73
/// - [`markupsafe.Markup`](https://markupsafe.palletsprojects.com/en/stable/escaping/#markupsafe.Markup)
74
74
///
75
- /// [markupsafe.Markup ]: https://markupsafe.palletsprojects.com/en/stable/escaping/#markupsafe.Markup
75
+ /// [markupsafe-markup ]: https://markupsafe.palletsprojects.com/en/stable/escaping/#markupsafe.Markup
76
76
/// [flake8-markupsafe]: https://github.com/vmagamedov/flake8-markupsafe
77
77
#[ derive( ViolationMetadata ) ]
78
78
pub ( crate ) struct UnsafeMarkupUse {
@@ -87,9 +87,7 @@ impl Violation for UnsafeMarkupUse {
87
87
}
88
88
}
89
89
90
- /// Checks for unsafe calls to `[markupsafe.Markup]`.
91
- ///
92
- /// [markupsafe.Markup]: https://markupsafe.palletsprojects.com/en/stable/escaping/#markupsafe.Markup
90
+ /// RUF035
93
91
pub ( crate ) fn unsafe_markup_call ( checker : & Checker , call : & ExprCall ) {
94
92
if checker. settings . ruff . extend_markup_names . is_empty ( )
95
93
&& !( checker. semantic ( ) . seen_module ( Modules :: MARKUPSAFE )
0 commit comments