Skip to content

Commit 1037bec

Browse files
ntBreMichaReiser
authored andcommitted
[flake8-bandit] Stabilize unsafe-markup-use (S704) (#16643)
Summary -- Stabilizes S704, which is also being recoded from RUF035 in 0.10. Test Plan -- Existing tests with `PreviewMode` removed from the settings. There was one issue closed on 2024-12-20 calling the rule noisy and asking for a config option, but the option was added and then there were no more issues or PRs.
1 parent 1b789e3 commit 1037bec

3 files changed

Lines changed: 2 additions & 4 deletions

File tree

crates/ruff_linter/src/codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
690690
(Flake8Bandit, "612") => (RuleGroup::Stable, rules::flake8_bandit::rules::LoggingConfigInsecureListen),
691691
(Flake8Bandit, "701") => (RuleGroup::Stable, rules::flake8_bandit::rules::Jinja2AutoescapeFalse),
692692
(Flake8Bandit, "702") => (RuleGroup::Stable, rules::flake8_bandit::rules::MakoTemplates),
693-
(Flake8Bandit, "704") => (RuleGroup::Preview, rules::flake8_bandit::rules::UnsafeMarkupUse),
693+
(Flake8Bandit, "704") => (RuleGroup::Stable, rules::flake8_bandit::rules::UnsafeMarkupUse),
694694

695695
// flake8-boolean-trap
696696
(Flake8BooleanTrap, "001") => (RuleGroup::Stable, rules::flake8_boolean_trap::rules::BooleanTypeHintPositionalArgument),

crates/ruff_linter/src/rules/flake8_bandit/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ mod tests {
8787
#[test_case(Rule::DjangoExtra, Path::new("S610.py"))]
8888
#[test_case(Rule::DjangoRawSql, Path::new("S611.py"))]
8989
#[test_case(Rule::TarfileUnsafeMembers, Path::new("S202.py"))]
90+
#[test_case(Rule::UnsafeMarkupUse, Path::new("S704.py"))]
9091
fn rules(rule_code: Rule, path: &Path) -> Result<()> {
9192
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
9293
let diagnostics = test_path(
@@ -103,7 +104,6 @@ mod tests {
103104
#[test_case(Rule::SuspiciousURLOpenUsage, Path::new("S310.py"))]
104105
#[test_case(Rule::SuspiciousNonCryptographicRandomUsage, Path::new("S311.py"))]
105106
#[test_case(Rule::SuspiciousTelnetUsage, Path::new("S312.py"))]
106-
#[test_case(Rule::UnsafeMarkupUse, Path::new("S704.py"))]
107107
fn preview_rules(rule_code: Rule, path: &Path) -> Result<()> {
108108
let snapshot = format!(
109109
"preview__{}_{}",
@@ -136,7 +136,6 @@ mod tests {
136136
extend_markup_names: vec!["webhelpers.html.literal".to_string()],
137137
..Default::default()
138138
},
139-
preview: PreviewMode::Enabled,
140139
..LinterSettings::for_rule(rule_code)
141140
},
142141
)?;
@@ -158,7 +157,6 @@ mod tests {
158157
allowed_markup_calls: vec!["bleach.clean".to_string()],
159158
..Default::default()
160159
},
161-
preview: PreviewMode::Enabled,
162160
..LinterSettings::for_rule(rule_code)
163161
},
164162
)?;

crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__preview__S704_S704.py.snap renamed to crates/ruff_linter/src/rules/flake8_bandit/snapshots/ruff_linter__rules__flake8_bandit__tests__S704_S704.py.snap

File renamed without changes.

0 commit comments

Comments
 (0)