From d01969c974a29372f5d4269a17ea2b6ea00d8ef2 Mon Sep 17 00:00:00 2001 From: Evan Rittenhouse Date: Mon, 2 Oct 2023 17:05:01 -0500 Subject: [PATCH 01/28] Update CLI to respect fix applicability --- crates/ruff_cli/src/args.rs | 11 +- crates/ruff_cli/src/cache.rs | 6 +- crates/ruff_cli/src/commands/check.rs | 2 +- crates/ruff_cli/src/diagnostics.rs | 288 ++++++++++--------- crates/ruff_cli/src/lib.rs | 27 +- crates/ruff_cli/src/printer.rs | 107 +++++-- crates/ruff_cli/tests/integration_test.rs | 307 ++++++++++++++++----- crates/ruff_diagnostics/src/fix.rs | 30 +- crates/ruff_linter/src/fix/mod.rs | 22 +- crates/ruff_linter/src/linter.rs | 4 +- crates/ruff_linter/src/settings/flags.rs | 20 +- crates/ruff_linter/src/test.rs | 7 +- crates/ruff_workspace/src/configuration.rs | 4 + crates/ruff_workspace/src/options.rs | 9 + crates/ruff_workspace/src/settings.rs | 3 + docs/configuration.md | 2 + ruff.schema.json | 9 +- 17 files changed, 594 insertions(+), 264 deletions(-) diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff_cli/src/args.rs index 28581fb92090a4..831419b8649de3 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff_cli/src/args.rs @@ -72,7 +72,6 @@ pub enum Command { // The `Parser` derive is for ruff_dev, for ruff_cli `Args` would be sufficient #[derive(Clone, Debug, clap::Parser)] -#[allow(clippy::struct_excessive_bools)] pub struct CheckCommand { /// List of files or directories to check. pub files: Vec, @@ -80,7 +79,10 @@ pub struct CheckCommand { /// Use `--no-fix` to disable. #[arg(long, overrides_with("no_fix"))] fix: bool, - #[clap(long, overrides_with("fix"), hide = true)] + /// Attempt to automatically fix both automatic and suggested lint violations. + #[arg(long, overrides_with_all(["fix", "no_fix"]))] + fix_suggested: bool, + #[clap(long, overrides_with_all(["fix", "fix_suggested"]), hide = true)] no_fix: bool, /// Show violations with source code. /// Use `--no-show-source` to disable. @@ -497,6 +499,7 @@ impl CheckCommand { cache_dir: self.cache_dir, fix: resolve_bool_arg(self.fix, self.no_fix), fix_only: resolve_bool_arg(self.fix_only, self.no_fix_only), + fix_suggested: Some(self.fix_suggested), force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude), output_format: self.output_format.or(self.format), show_fixes: resolve_bool_arg(self.show_fixes, self.no_show_fixes), @@ -599,6 +602,7 @@ pub struct CliOverrides { pub cache_dir: Option, pub fix: Option, pub fix_only: Option, + pub fix_suggested: Option, pub force_exclude: Option, pub output_format: Option, pub show_fixes: Option, @@ -624,6 +628,9 @@ impl ConfigurationTransformer for CliOverrides { if let Some(fix_only) = &self.fix_only { config.fix_only = Some(*fix_only); } + if self.fix_suggested.is_some() { + config.fix_suggested = self.fix_suggested; + } config.lint.rule_selections.push(RuleSelection { select: self.select.clone(), ignore: self diff --git a/crates/ruff_cli/src/cache.rs b/crates/ruff_cli/src/cache.rs index 3a2b851451f6ea..b48593e52795db 100644 --- a/crates/ruff_cli/src/cache.rs +++ b/crates/ruff_cli/src/cache.rs @@ -409,7 +409,7 @@ mod tests { &settings.linter, Some(&cache), flags::Noqa::Enabled, - flags::FixMode::Generate, + flags::FixMode::Generate(flags::SuggestedFixes::Apply), ) .unwrap(); if diagnostics @@ -454,7 +454,7 @@ mod tests { &settings.linter, Some(&cache), flags::Noqa::Enabled, - flags::FixMode::Generate, + flags::FixMode::Generate(flags::SuggestedFixes::Apply), ) .unwrap(); } @@ -711,7 +711,7 @@ mod tests { &self.settings.linter, Some(cache), flags::Noqa::Enabled, - flags::FixMode::Generate, + flags::FixMode::Generate(flags::SuggestedFixes::Apply), ) } } diff --git a/crates/ruff_cli/src/commands/check.rs b/crates/ruff_cli/src/commands/check.rs index f19c8d80d4c11c..28012af5ffcb28 100644 --- a/crates/ruff_cli/src/commands/check.rs +++ b/crates/ruff_cli/src/commands/check.rs @@ -284,7 +284,7 @@ mod test { &CliOverrides::default(), flags::Cache::Disabled, flags::Noqa::Disabled, - flags::FixMode::Generate, + flags::FixMode::Generate(flags::SuggestedFixes::Apply), ) .unwrap(); let mut output = Vec::new(); diff --git a/crates/ruff_cli/src/diagnostics.rs b/crates/ruff_cli/src/diagnostics.rs index d3dea9f56aeba7..b0c336b7c62bd4 100644 --- a/crates/ruff_cli/src/diagnostics.rs +++ b/crates/ruff_cli/src/diagnostics.rs @@ -241,96 +241,110 @@ pub(crate) fn lint_path( error: parse_error, }, fixed, - ) = if matches!(fix_mode, flags::FixMode::Apply | flags::FixMode::Diff) { - if let Ok(FixerResult { - result, - transformed, - fixed, - }) = lint_fix(path, package, noqa, settings, &source_kind, source_type) - { - if !fixed.is_empty() { - match fix_mode { - flags::FixMode::Apply => match transformed.as_ref() { - SourceKind::Python(transformed) => { - write(path, transformed.as_bytes())?; - } - SourceKind::IpyNotebook(notebook) => { - let mut writer = BufWriter::new(File::create(path)?); - notebook.write(&mut writer)?; - } - }, - flags::FixMode::Diff => { - match transformed.as_ref() { + ) = match fix_mode { + flags::FixMode::Apply(fix_suggested) | flags::FixMode::Diff(fix_suggested) => { + if let Ok(FixerResult { + result, + transformed, + fixed, + }) = lint_fix( + path, + package, + noqa, + settings, + &source_kind, + source_type, + fix_suggested, + ) { + if !fixed.is_empty() { + match fix_mode { + flags::FixMode::Apply(_) => match transformed.as_ref() { SourceKind::Python(transformed) => { - let mut stdout = io::stdout().lock(); - TextDiff::from_lines(source_kind.source_code(), transformed) - .unified_diff() - .header(&fs::relativize_path(path), &fs::relativize_path(path)) - .to_writer(&mut stdout)?; - stdout.write_all(b"\n")?; - stdout.flush()?; + write(path, transformed.as_bytes())?; } - SourceKind::IpyNotebook(dest_notebook) => { - // We need to load the notebook again, since we might've - // mutated it. - let src_notebook = source_kind.as_ipy_notebook().unwrap(); - let mut stdout = io::stdout().lock(); - // Cell indices are 1-based. - for ((idx, src_cell), dest_cell) in (1u32..) - .zip(src_notebook.cells().iter()) - .zip(dest_notebook.cells().iter()) - { - let (Cell::Code(src_code_cell), Cell::Code(dest_code_cell)) = - (src_cell, dest_cell) - else { - continue; - }; - TextDiff::from_lines( - &src_code_cell.source.to_string(), - &dest_code_cell.source.to_string(), - ) - .unified_diff() - // Jupyter notebook cells don't necessarily have a newline - // at the end. For example, - // - // ```python - // print("hello") - // ``` - // - // For a cell containing the above code, there'll only be one line, - // and it won't have a newline at the end. If it did, there'd be - // two lines, and the second line would be empty: - // - // ```python - // print("hello") - // - // ``` - .missing_newline_hint(false) - .header( - &format!("{}:cell {}", &fs::relativize_path(path), idx), - &format!("{}:cell {}", &fs::relativize_path(path), idx), - ) - .to_writer(&mut stdout)?; + SourceKind::IpyNotebook(notebook) => { + let mut writer = BufWriter::new(File::create(path)?); + notebook.write(&mut writer)?; + } + }, + flags::FixMode::Diff(_) => { + match transformed.as_ref() { + SourceKind::Python(transformed) => { + let mut stdout = io::stdout().lock(); + TextDiff::from_lines(source_kind.source_code(), transformed) + .unified_diff() + .header( + &fs::relativize_path(path), + &fs::relativize_path(path), + ) + .to_writer(&mut stdout)?; + stdout.write_all(b"\n")?; + stdout.flush()?; + } + SourceKind::IpyNotebook(dest_notebook) => { + // We need to load the notebook again, since we might've + // mutated it. + let src_notebook = source_kind.as_ipy_notebook().unwrap(); + let mut stdout = io::stdout().lock(); + for ((idx, src_cell), dest_cell) in src_notebook + .cells() + .iter() + .enumerate() + .zip(dest_notebook.cells().iter()) + { + let (Cell::Code(src_code_cell), Cell::Code(dest_code_cell)) = + (src_cell, dest_cell) + else { + continue; + }; + TextDiff::from_lines( + &src_code_cell.source.to_string(), + &dest_code_cell.source.to_string(), + ) + .unified_diff() + // Jupyter notebook cells don't necessarily have a newline + // at the end. For example, + // + // ```python + // print("hello") + // ``` + // + // For a cell containing the above code, there'll only be one line, + // and it won't have a newline at the end. If it did, there'd be + // two lines, and the second line would be empty: + // + // ```python + // print("hello") + // + // ``` + .missing_newline_hint(false) + .header( + &format!("{}:cell {}", &fs::relativize_path(path), idx), + &format!("{}:cell {}", &fs::relativize_path(path), idx), + ) + .to_writer(&mut stdout)?; + } + stdout.write_all(b"\n")?; + stdout.flush()?; } - stdout.write_all(b"\n")?; - stdout.flush()?; } } + flags::FixMode::Generate(_) => {} } - flags::FixMode::Generate => {} } + (result, fixed) + } else { + // If we fail to fix, lint the original source code. + let result = lint_only(path, package, settings, noqa, &source_kind, source_type); + let fixed = FxHashMap::default(); + (result, fixed) } - (result, fixed) - } else { - // If we fail to fix, lint the original source code. + } + flags::FixMode::Generate(_) => { let result = lint_only(path, package, settings, noqa, &source_kind, source_type); let fixed = FxHashMap::default(); (result, fixed) } - } else { - let result = lint_only(path, package, settings, noqa, &source_kind, source_type); - let fixed = FxHashMap::default(); - (result, fixed) }; let imports = imports.unwrap_or_default(); @@ -392,7 +406,7 @@ pub(crate) fn lint_stdin( }; // Extract the sources from the file. - let source_kind = match SourceKind::from_source_code(contents, source_type) { + let source_kind = match SourceKind::from_source_code(contents.clone(), source_type) { Ok(Some(source_kind)) => source_kind, Ok(None) => return Ok(Diagnostics::default()), Err(err) => { @@ -407,49 +421,70 @@ pub(crate) fn lint_stdin( error: parse_error, }, fixed, - ) = if matches!(fix_mode, flags::FixMode::Apply | flags::FixMode::Diff) { - if let Ok(FixerResult { - result, - transformed, - fixed, - }) = lint_fix( - path.unwrap_or_else(|| Path::new("-")), - package, - noqa, - &settings.linter, - &source_kind, - source_type, - ) { - match fix_mode { - flags::FixMode::Apply => { - // Write the contents to stdout, regardless of whether any errors were fixed. - transformed.write(&mut io::stdout().lock())?; - } - flags::FixMode::Diff => { - // But only write a diff if it's non-empty. - if !fixed.is_empty() { - let text_diff = TextDiff::from_lines( - source_kind.source_code(), - transformed.source_code(), - ); - let mut unified_diff = text_diff.unified_diff(); - if let Some(path) = path { - unified_diff - .header(&fs::relativize_path(path), &fs::relativize_path(path)); - } + ) = match fix_mode { + flags::FixMode::Apply(fix_suggested) | flags::FixMode::Diff(fix_suggested) => { + if let Ok(FixerResult { + result, + transformed, + fixed, + }) = lint_fix( + path.unwrap_or_else(|| Path::new("-")), + package, + noqa, + &settings.linter, + &source_kind, + source_type, + fix_suggested, + ) { + match fix_mode { + flags::FixMode::Apply(_) => { + // Write the contents to stdout, regardless of whether any errors were fixed. + io::stdout().write_all(transformed.source_code().as_bytes())?; + } + flags::FixMode::Diff(_) => { + // But only write a diff if it's non-empty. + if !fixed.is_empty() { + let text_diff = TextDiff::from_lines( + source_kind.source_code(), + transformed.source_code(), + ); + let mut unified_diff = text_diff.unified_diff(); + if let Some(path) = path { + unified_diff + .header(&fs::relativize_path(path), &fs::relativize_path(path)); + } - let mut stdout = io::stdout().lock(); - unified_diff.to_writer(&mut stdout)?; - stdout.write_all(b"\n")?; - stdout.flush()?; + let mut stdout = io::stdout().lock(); + unified_diff.to_writer(&mut stdout)?; + stdout.write_all(b"\n")?; + stdout.flush()?; + } } + flags::FixMode::Generate(_) => {} } - flags::FixMode::Generate => {} - } - (result, fixed) - } else { - // If we fail to fix, lint the original source code. + (result, fixed) + } else { + // If we fail to fix, lint the original source code. + let result = lint_only( + path.unwrap_or_else(|| Path::new("-")), + package, + &settings.linter, + noqa, + &source_kind, + source_type, + ); + let fixed = FxHashMap::default(); + + // Write the contents to stdout anyway. + if fix_mode.is_apply() { + io::stdout().write_all(contents.as_bytes())?; + } + + (result, fixed) + } + } + flags::FixMode::Generate(_) => { let result = lint_only( path.unwrap_or_else(|| Path::new("-")), package, @@ -459,25 +494,8 @@ pub(crate) fn lint_stdin( source_type, ); let fixed = FxHashMap::default(); - - // Write the contents to stdout anyway. - if fix_mode.is_apply() { - source_kind.write(&mut io::stdout().lock())?; - } - (result, fixed) } - } else { - let result = lint_only( - path.unwrap_or_else(|| Path::new("-")), - package, - &settings.linter, - noqa, - &source_kind, - source_type, - ); - let fixed = FxHashMap::default(); - (result, fixed) }; let imports = imports.unwrap_or_default(); diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index f9dbb164df0d35..2397aa8ee81cbe 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -10,7 +10,7 @@ use log::warn; use notify::{recommended_watcher, RecursiveMode, Watcher}; use ruff_linter::logging::{set_up_logging, LogLevel}; -use ruff_linter::settings::flags; +use ruff_linter::settings::flags::{FixMode, SuggestedFixes}; use ruff_linter::settings::types::SerializationFormat; use ruff_linter::{fs, warn_user, warn_user_once}; use ruff_workspace::Settings; @@ -228,6 +228,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { let Settings { fix, fix_only, + fix_suggested, output_format, show_fixes, show_source, @@ -237,16 +238,28 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { // Fix rules are as follows: // - By default, generate all fixes, but don't apply them to the filesystem. // - If `--fix` or `--fix-only` is set, always apply fixes to the filesystem (or - // print them to stdout, if we're reading from stdin). + // print them to stdout, if we're reading from stdin) for [`Applicability::Automatic`] rules + // only. // - If `--diff` or `--fix-only` are set, don't print any violations (only - // fixes). + // fixes) for [`Applicability::Automatic`] rules only. + // - If `--fix--suggested` is set, the above rules will apply to both [`Applicability::Suggested`] and + // [`Applicability::Automatic`] fixes. + // TODO: can't fix this until @zanieb changes the CLI + let fix_suggested = if fix_suggested { + SuggestedFixes::Apply + } else { + SuggestedFixes::Disable + }; + let fix_mode = if cli.diff { - flags::FixMode::Diff + FixMode::Diff(fix_suggested) } else if fix || fix_only { - flags::FixMode::Apply + FixMode::Apply(fix_suggested) } else { - flags::FixMode::Generate + // We'll always generate all fixes, regardless of [`Applicability`], in `generate` mode + FixMode::Generate(SuggestedFixes::Apply) }; + let cache = !cli.no_cache; let noqa = !cli.ignore_noqa; let mut printer_flags = PrinterFlags::empty(); @@ -382,7 +395,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { // Always try to print violations (the printer itself may suppress output), // unless we're writing fixes via stdin (in which case, the transformed // source code goes to stdout). - if !(is_stdin && matches!(fix_mode, flags::FixMode::Apply | flags::FixMode::Diff)) { + if !(is_stdin && matches!(fix_mode, FixMode::Apply(_) | FixMode::Diff(_))) { if cli.statistics { printer.write_statistics(&diagnostics, &mut writer)?; } else { diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index 7700df97494661..a56d1b2bcfc1db 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -7,6 +7,7 @@ use anyhow::Result; use bitflags::bitflags; use colored::Colorize; use itertools::{iterate, Itertools}; +use ruff_diagnostics::Applicability; use rustc_hash::FxHashMap; use serde::Serialize; @@ -19,7 +20,7 @@ use ruff_linter::message::{ }; use ruff_linter::notify_user; use ruff_linter::registry::{AsRule, Rule}; -use ruff_linter::settings::flags; +use ruff_linter::settings::flags::{self, SuggestedFixes}; use ruff_linter::settings::types::SerializationFormat; use crate::diagnostics::Diagnostics; @@ -118,19 +119,10 @@ impl Printer { writeln!(writer, "Found {remaining} error{s}.")?; } - if show_fix_status(self.fix_mode) { - let num_fixable = diagnostics - .messages - .iter() - .filter(|message| message.fix.is_some()) - .count(); - if num_fixable > 0 { - writeln!( - writer, - "[{}] {num_fixable} potentially fixable with the --fix option.", - "*".cyan(), - )?; - } + let fixables = FixableStatistics::new(diagnostics, self.fix_mode.suggested_fixes()); + + if !fixables.is_empty() { + writeln!(writer, "{}", fixables.violation_string())?; } } else { let fixed = diagnostics @@ -178,6 +170,7 @@ impl Printer { } let context = EmitterContext::new(&diagnostics.notebook_indexes); + let fixables = FixableStatistics::new(diagnostics, self.fix_mode.suggested_fixes()); match self.format { SerializationFormat::Json => { @@ -191,9 +184,9 @@ impl Printer { } SerializationFormat::Text => { TextEmitter::default() - .with_show_fix_status(show_fix_status(self.fix_mode)) - .with_show_fix_diff(self.flags.intersects(Flags::SHOW_FIX_DIFF)) - .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) + .with_show_fix_status(show_fix_status(self.fix_mode, fixables)) + .with_show_fix_diff(self.flags.contains(Flags::SHOW_FIX_DIFF)) + .with_show_source(self.flags.contains(Flags::SHOW_SOURCE)) .emit(writer, &diagnostics.messages, &context)?; if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) { @@ -209,7 +202,7 @@ impl Printer { SerializationFormat::Grouped => { GroupedEmitter::default() .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) - .with_show_fix_status(show_fix_status(self.fix_mode)) + .with_show_fix_status(show_fix_status(self.fix_mode, fixables)) .emit(writer, &diagnostics.messages, &context)?; if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) { @@ -359,6 +352,8 @@ impl Printer { ); } + let fixables = FixableStatistics::new(diagnostics, self.fix_mode.suggested_fixes()); + if !diagnostics.messages.is_empty() { if self.log_level >= LogLevel::Default { writeln!(writer)?; @@ -366,7 +361,7 @@ impl Printer { let context = EmitterContext::new(&diagnostics.notebook_indexes); TextEmitter::default() - .with_show_fix_status(show_fix_status(self.fix_mode)) + .with_show_fix_status(show_fix_status(self.fix_mode, fixables)) .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) .emit(writer, &diagnostics.messages, &context)?; } @@ -390,13 +385,13 @@ fn num_digits(n: usize) -> usize { } /// Return `true` if the [`Printer`] should indicate that a rule is fixable. -const fn show_fix_status(fix_mode: flags::FixMode) -> bool { +fn show_fix_status(fix_mode: flags::FixMode, fixables: FixableStatistics) -> bool { // If we're in application mode, avoid indicating that a rule is fixable. // If the specific violation were truly fixable, it would've been fixed in // this pass! (We're occasionally unable to determine whether a specific // violation is fixable without trying to fix it, so if fix is not // enabled, we may inadvertently indicate that a rule is fixable.) - !fix_mode.is_apply() + (!fix_mode.is_apply()) && fixables.fixes_are_applicable() } fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap) -> Result<()> { @@ -439,3 +434,73 @@ fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap } Ok(()) } + +/// Contains the number of [`Applicability::Automatic`] and [`Applicability::Suggested`] fixes +struct FixableStatistics<'a> { + automatic: u32, + suggested: u32, + apply_suggested: &'a SuggestedFixes, +} + +impl<'a> FixableStatistics<'a> { + fn new(diagnostics: &Diagnostics, apply_suggested: &'a SuggestedFixes) -> Self { + let mut automatic = 0; + let mut suggested = 0; + + for message in &diagnostics.messages { + if let Some(fix) = &message.fix { + if fix.applicability() == Applicability::Suggested { + suggested += 1; + } else if fix.applicability() == Applicability::Automatic { + automatic += 1; + } + } + } + + Self { + automatic, + suggested, + apply_suggested, + } + } + + fn fixes_are_applicable(&self) -> bool { + match self.apply_suggested { + SuggestedFixes::Apply => self.automatic > 0 || self.suggested > 0, + SuggestedFixes::Disable => self.automatic > 0, + } + } + + /// Returns [`true`] if there aren't any fixes to be displayed + fn is_empty(&self) -> bool { + self.automatic == 0 && self.suggested == 0 + } + + /// Build the displayed fix status message depending on the types of the remaining fixes. + fn violation_string(&self) -> String { + let prefix = format!("[{}]", "*".cyan()); + let mut fix_status = prefix; + + if self.automatic > 0 { + fix_status = format!( + "{fix_status} {} potentially fixable with the --fix option.", + self.automatic + ); + } + + if self.suggested > 0 { + let (line_break, extra_prefix) = if self.automatic > 0 { + ("\n", format!("[{}]", "*".cyan())) + } else { + ("", String::new()) + }; + + let total = self.automatic + self.suggested; + fix_status = format!( + "{fix_status}{line_break}{extra_prefix} {total} potentially fixable with the --fix-suggested option." + ); + } + + fix_status + } +} diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index a47a974d8175be..dbf8e82939178f 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -241,81 +241,9 @@ fn stdin_fix_jupyter() { success: true exit_code: 0 ----- stdout ----- - { - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "dccc687c-96e2-4604-b957-a8a89b5bec06", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "id": "19e1b029-f516-4662-a9b9-623b93edac1a", - "metadata": {}, - "source": [ - "Foo" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "cdce7b92-b0fb-4c02-86f6-e233b26fa84f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "e40b33d2-7fe4-46c5-bdf0-8802f3052565", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1\n" - ] - } - ], - "source": [ - "print(1)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a1899bc8-d46f-4ec0-b1d1-e1ca0f04bf60", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.2" - } - }, - "nbformat": 4, - "nbformat_minor": 5 - } + print(1) + + ----- stderr ----- "###); } @@ -869,3 +797,232 @@ fn check_input_from_argfile() -> Result<()> { Ok(()) } + +#[test] +fn displays_fix_applicability_levels() -> Result<()> { + // `--fix` should only apply automatic fixes, but should tell the user about `--fix --unautomatic` if + // there are remaining unautomatic fixes. + // TODO: this should be a failure but we don't have a way to track that + assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format=text", + "--isolated", + "--select", + "F601,UP034", + "--no-cache", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: false + exit_code: 1 + ----- stdout ----- + -:1:14: F601 [*] Dictionary key literal `'a'` repeated + -:2:7: UP034 [*] Avoid extraneous parentheses + Found 2 errors. + [*] 1 potentially fixable with the --fix option. + [*] 2 potentially fixable with the --fix-suggested option. + + ----- stderr ----- + "###); + + Ok(()) +} + +#[test] +fn displays_remaining_suggested_fixes() -> Result<()> { + assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) + .args(["-", "--output-format", "text", "--no-cache", "--isolated", "--select", "F601"]) + .pass_stdin("x = {'a': 1, 'a': 1}\n"), + @r###" + success: false + exit_code: 1 + ----- stdout ----- + -:1:14: F601 [*] Dictionary key literal `'a'` repeated + Found 1 error. + [*] 1 potentially fixable with the --fix-suggested option. + + ----- stderr ----- + "###); + + Ok(()) +} + +#[test] +fn fix_applies_automatic_fixes_only() -> Result<()> { + // `--fix` should only apply automatic fixes. Since we're runnnig in `stdin` mode, output shouldn't + // be printed. + assert_cmd_snapshot!( + Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format", + "text", + "--isolated","--no-cache", + "--select", + "F601,UP034", + "--fix", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: false + exit_code: 1 + ----- stdout ----- + x = {'a': 1, 'a': 1} + print('foo') + + ----- stderr ----- + "###); + + Ok(()) +} + +#[test] +fn fix_applies_automatic_and_suggested_fixes_with_fix_suggested() -> Result<()> { + assert_cmd_snapshot!( + Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format", + "text", + "--isolated","--no-cache", + "--select", + "F601,UP034", + "--fix", + "--fix-suggested", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: false + exit_code: 1 + ----- stdout ----- + -:1:14: F601 [*] Dictionary key literal `'a'` repeated + -:2:7: UP034 [*] Avoid extraneous parentheses + Found 2 errors. + [*] 1 potentially fixable with the --fix option. + [*] 2 potentially fixable with the --fix-suggested option. + + ----- stderr ----- + "###); + + Ok(()) +} + +#[test] +fn diff_shows_automatic_and_suggested_fixes_with_fix_suggested() -> Result<()> { + assert_cmd_snapshot!( + Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format", + "text", + "--isolated","--no-cache", + "--select", + "F601,UP034", + "--diff", + "--fix-suggested", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: false + exit_code: 1 + ----- stdout ----- + @@ -1,2 +1,2 @@ + -x = {'a': 1, 'a': 1} + -print(('foo')) + +x = {'a': 1} + +print('foo') + + + ----- stderr ----- + "### + ); + + Ok(()) +} + +#[test] +fn diff_shows_automatic_fixes_only() -> Result<()> { + assert_cmd_snapshot!( + Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format", + "text", + "--isolated","--no-cache", + "--select", + "F601,UP034", + "--diff", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: false + exit_code: 1 + ----- stdout ----- + @@ -1,2 +1,2 @@ + x = {'a': 1, 'a': 1} + -print(('foo')) + +print('foo') + + + ----- stderr ----- + "### + ); + + Ok(()) +} + +#[test] +fn fix_only_applies_automatic_and_suggested_fixes_with_fix_suggested() -> Result<()> { + assert_cmd_snapshot!( + Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format", + "text", + "--isolated","--no-cache", + "--select", + "F601,UP034", + "--fix-only", + "--fix-suggested", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: true + exit_code: 0 + ----- stdout ----- + x = {'a': 1} + print('foo') + + ----- stderr ----- + "###); + + Ok(()) +} + +#[test] +fn fix_only_applies_automatic_fixes_only() -> Result<()> { + assert_cmd_snapshot!( + Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format", + "text", + "--isolated","--no-cache", + "--select", + "F601,UP034", + "--fix-only", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: true + exit_code: 0 + ----- stdout ----- + x = {'a': 1, 'a': 1} + print('foo') + + ----- stderr ----- + "###); + + Ok(()) +} diff --git a/crates/ruff_diagnostics/src/fix.rs b/crates/ruff_diagnostics/src/fix.rs index 7456e82b7e4e32..8db635392f86dd 100644 --- a/crates/ruff_diagnostics/src/fix.rs +++ b/crates/ruff_diagnostics/src/fix.rs @@ -5,27 +5,30 @@ use ruff_text_size::{Ranged, TextSize}; use crate::edit::Edit; -/// Indicates confidence in the correctness of a suggested fix. +/// Indicates confidence in the correctness of a suggested fix. Rust internally allows comparison +/// of enum values based on their order (see Rust's [enum +/// documentation](https://doc.rust-lang.org/reference/items/enumerations.html)). This allows us to +/// apply [`Fix`]es based on their [`Applicability`]. #[derive(Default, Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum Applicability { - /// The fix is definitely what the user intended, or maintains the exact meaning of the code. - /// This fix should be automatically applied. - Automatic, - - /// The fix may be what the user intended, but it is uncertain. - /// The fix should result in valid code if it is applied. - /// The fix can be applied with user opt-in. - Suggested, - /// The fix has a good chance of being incorrect or the code be incomplete. /// The fix may result in invalid code if it is applied. /// The fix should only be manually applied by the user. Manual, - /// The applicability of the fix is unknown. + /// The applicability of the fix is unknown or not relevant. #[default] Unspecified, + + /// The fix may be what the user intended, but it is uncertain. + /// The fix should result in valid code if it is applied. + /// The fix can be applied with user opt-in. + Suggested, + + /// The fix is definitely what the user intended, or maintains the exact meaning of the code. + /// This fix should be automatically applied. + Automatic, } /// Indicates the level of isolation required to apply a fix. @@ -162,4 +165,9 @@ impl Fix { self.isolation_level = isolation; self } + + /// Return [`true`] if this [`Fix`] should be applied with a given [`Applicability`]. + pub fn is_applied(&self, applicability: Applicability) -> bool { + self.applicability >= applicability + } } diff --git a/crates/ruff_linter/src/fix/mod.rs b/crates/ruff_linter/src/fix/mod.rs index 563fac9e8396c2..aa626d8992649b 100644 --- a/crates/ruff_linter/src/fix/mod.rs +++ b/crates/ruff_linter/src/fix/mod.rs @@ -4,11 +4,12 @@ use std::collections::BTreeSet; use ruff_text_size::{Ranged, TextLen, TextRange, TextSize}; use rustc_hash::{FxHashMap, FxHashSet}; -use ruff_diagnostics::{Diagnostic, Edit, Fix, IsolationLevel, SourceMap}; +use ruff_diagnostics::{Applicability, Diagnostic, Edit, Fix, IsolationLevel, SourceMap}; use ruff_source_file::Locator; use crate::linter::FixTable; use crate::registry::{AsRule, Rule}; +use crate::settings::flags::SuggestedFixes; pub(crate) mod codemods; pub(crate) mod edits; @@ -24,10 +25,25 @@ pub(crate) struct FixResult { } /// Auto-fix errors in a file, and write the fixed source code to disk. -pub(crate) fn fix_file(diagnostics: &[Diagnostic], locator: &Locator) -> Option { +pub(crate) fn fix_file( + diagnostics: &[Diagnostic], + locator: &Locator, + fix_suggested: SuggestedFixes, +) -> Option { let mut with_fixes = diagnostics .iter() - .filter(|diag| diag.fix.is_some()) + .filter(|diag| { + let Some(ref fix) = diag.fix else { + return false; + }; + + // change this + if matches!(fix_suggested, SuggestedFixes::Apply) { + fix.applicability() >= Applicability::Suggested + } else { + fix.applicability() == Applicability::Automatic + } + }) .peekable(); if with_fixes.peek().is_none() { diff --git a/crates/ruff_linter/src/linter.rs b/crates/ruff_linter/src/linter.rs index 69b466cbb3d3b4..66ad1fb0bd4c04 100644 --- a/crates/ruff_linter/src/linter.rs +++ b/crates/ruff_linter/src/linter.rs @@ -415,6 +415,7 @@ fn diagnostics_to_messages( /// Generate `Diagnostic`s from source code content, iteratively fixing /// until stable. +#[allow(clippy::too_many_arguments)] pub fn lint_fix<'a>( path: &Path, package: Option<&Path>, @@ -422,6 +423,7 @@ pub fn lint_fix<'a>( settings: &LinterSettings, source_kind: &'a SourceKind, source_type: PySourceType, + fix_suggested: flags::SuggestedFixes, ) -> Result> { let mut transformed = Cow::Borrowed(source_kind); @@ -494,7 +496,7 @@ pub fn lint_fix<'a>( code: fixed_contents, fixes: applied, source_map, - }) = fix_file(&result.data.0, &locator) + }) = fix_file(&result.data.0, &locator, fix_suggested) { if iterations < MAX_ITERATIONS { // Count the number of fixed errors. diff --git a/crates/ruff_linter/src/settings/flags.rs b/crates/ruff_linter/src/settings/flags.rs index a1ce403194c83d..244db27d9d4635 100644 --- a/crates/ruff_linter/src/settings/flags.rs +++ b/crates/ruff_linter/src/settings/flags.rs @@ -1,8 +1,24 @@ #[derive(Debug, Copy, Clone, Hash, is_macro::Is)] pub enum FixMode { - Generate, + Generate(SuggestedFixes), + Apply(SuggestedFixes), + Diff(SuggestedFixes), +} + +impl FixMode { + pub fn suggested_fixes(&self) -> &SuggestedFixes { + match self { + FixMode::Generate(suggested) => suggested, + FixMode::Apply(suggested) => suggested, + FixMode::Diff(suggested) => suggested, + } + } +} + +#[derive(Debug, Copy, Clone, Hash, is_macro::Is)] +pub enum SuggestedFixes { Apply, - Diff, + Disable, } #[derive(Debug, Copy, Clone, Hash, result_like::BoolLike)] diff --git a/crates/ruff_linter/src/test.rs b/crates/ruff_linter/src/test.rs index 75de40cd2e0d7c..208c0ec01835ea 100644 --- a/crates/ruff_linter/src/test.rs +++ b/crates/ruff_linter/src/test.rs @@ -155,8 +155,11 @@ pub(crate) fn test_contents<'a>( code: fixed_contents, source_map, .. - }) = fix_file(&diagnostics, &Locator::new(transformed.source_code())) - { + }) = fix_file( + &diagnostics, + &Locator::new(transformed.source_code()), + flags::SuggestedFixes::Apply, + ) { if iterations < max_iterations() { iterations += 1; } else { diff --git a/crates/ruff_workspace/src/configuration.rs b/crates/ruff_workspace/src/configuration.rs index ad350a33463550..ac3971c00cccb6 100644 --- a/crates/ruff_workspace/src/configuration.rs +++ b/crates/ruff_workspace/src/configuration.rs @@ -63,6 +63,7 @@ pub struct Configuration { pub cache_dir: Option, pub extend: Option, pub fix: Option, + pub fix_suggested: Option, pub fix_only: Option, pub output_format: Option, pub preview: Option, @@ -136,6 +137,7 @@ impl Configuration { .clone() .unwrap_or_else(|| cache_dir(project_root)), fix: self.fix.unwrap_or(false), + fix_suggested: self.fix_suggested.unwrap_or(false), fix_only: self.fix_only.unwrap_or(false), output_format: self.output_format.unwrap_or_default(), show_fixes: self.show_fixes.unwrap_or(false), @@ -365,6 +367,7 @@ impl Configuration { }), fix: options.fix, fix_only: options.fix_only, + fix_suggested: options.fix_suggested, output_format: options.output_format.or_else(|| { options .format @@ -418,6 +421,7 @@ impl Configuration { include: self.include.or(config.include), fix: self.fix.or(config.fix), fix_only: self.fix_only.or(config.fix_only), + fix_suggested: self.fix_suggested.or(config.fix_suggested), output_format: self.output_format.or(config.output_format), force_exclude: self.force_exclude.or(config.force_exclude), line_length: self.line_length.or(config.line_length), diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index a376aea45ff116..23ff6b466c47b6 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -89,9 +89,18 @@ pub struct Options { /// Enable fix behavior by-default when running `ruff` (overridden /// by the `--fix` and `--no-fix` command-line flags). + /// Only includes automatic fixes unless `--fix-suggested` is provided. #[option(default = "false", value_type = "bool", example = "fix = true")] pub fix: Option, + /// Enable application of suggested fixes. + #[option( + default = "false", + value_type = "bool", + example = "fix-suggested = true" + )] + pub fix_suggested: Option, + /// Like `fix`, but disables reporting on leftover violation. Implies `fix`. #[option(default = "false", value_type = "bool", example = "fix-only = true")] pub fix_only: Option, diff --git a/crates/ruff_workspace/src/settings.rs b/crates/ruff_workspace/src/settings.rs index 0e069a58c01dd1..80a7538b0021c6 100644 --- a/crates/ruff_workspace/src/settings.rs +++ b/crates/ruff_workspace/src/settings.rs @@ -17,6 +17,8 @@ pub struct Settings { #[cache_key(ignore)] pub fix: bool, #[cache_key(ignore)] + pub fix_suggested: bool, + #[cache_key(ignore)] pub fix_only: bool, #[cache_key(ignore)] pub output_format: SerializationFormat, @@ -36,6 +38,7 @@ impl Default for Settings { Self { cache_dir: cache_dir(project_root), fix: false, + fix_suggested: false, fix_only: false, output_format: SerializationFormat::default(), show_fixes: false, diff --git a/docs/configuration.md b/docs/configuration.md index e97374b62014af..dbe568dcc2bd4e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -194,6 +194,8 @@ Arguments: Options: --fix Attempt to automatically fix lint violations. Use `--no-fix` to disable + --fix-suggested + Attempt to automatically fix both automatic and suggested lint violations --show-source Show violations with source code. Use `--no-show-source` to disable --show-fixes diff --git a/ruff.schema.json b/ruff.schema.json index 20199a2bd93046..c657da23afc141 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -128,7 +128,7 @@ } }, "fix": { - "description": "Enable fix behavior by-default when running `ruff` (overridden by the `--fix` and `--no-fix` command-line flags).", + "description": "Enable fix behavior by-default when running `ruff` (overridden by the `--fix` and `--no-fix` command-line flags). Only includes automatic fixes unless `--fix-suggested` is provided.", "type": [ "boolean", "null" @@ -141,6 +141,13 @@ "null" ] }, + "fix-suggested": { + "description": "Enable application of suggested fixes.", + "type": [ + "boolean", + "null" + ] + }, "fixable": { "description": "A list of rule codes or prefixes to consider fixable. By default, all rules are considered fixable.", "type": [ From 74acdf5a22d5763a478e6fef1b06905866e1f579 Mon Sep 17 00:00:00 2001 From: Zanie Date: Mon, 2 Oct 2023 17:43:24 -0500 Subject: [PATCH 02/28] Fixups for CI --- crates/ruff_cli/src/args.rs | 1 + crates/ruff_cli/src/commands/check_stdin.rs | 2 +- crates/ruff_cli/src/diagnostics.rs | 4 +-- crates/ruff_cli/src/printer.rs | 8 +++--- crates/ruff_cli/tests/integration_test.rs | 32 ++++++--------------- 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff_cli/src/args.rs index 831419b8649de3..f59cb623c61319 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff_cli/src/args.rs @@ -72,6 +72,7 @@ pub enum Command { // The `Parser` derive is for ruff_dev, for ruff_cli `Args` would be sufficient #[derive(Clone, Debug, clap::Parser)] +#[allow(clippy::struct_excessive_bools)] pub struct CheckCommand { /// List of files or directories to check. pub files: Vec, diff --git a/crates/ruff_cli/src/commands/check_stdin.rs b/crates/ruff_cli/src/commands/check_stdin.rs index ab15f61439f438..2641bedd686021 100644 --- a/crates/ruff_cli/src/commands/check_stdin.rs +++ b/crates/ruff_cli/src/commands/check_stdin.rs @@ -30,7 +30,7 @@ pub(crate) fn check_stdin( let mut diagnostics = lint_stdin( filename, package_root, - stdin, + &stdin, &pyproject_config.settings, noqa, fix_mode, diff --git a/crates/ruff_cli/src/diagnostics.rs b/crates/ruff_cli/src/diagnostics.rs index b0c336b7c62bd4..f098c8ee14fe1c 100644 --- a/crates/ruff_cli/src/diagnostics.rs +++ b/crates/ruff_cli/src/diagnostics.rs @@ -395,7 +395,7 @@ pub(crate) fn lint_path( pub(crate) fn lint_stdin( path: Option<&Path>, package: Option<&Path>, - contents: String, + contents: &str, settings: &Settings, noqa: flags::Noqa, fix_mode: flags::FixMode, @@ -406,7 +406,7 @@ pub(crate) fn lint_stdin( }; // Extract the sources from the file. - let source_kind = match SourceKind::from_source_code(contents.clone(), source_type) { + let source_kind = match SourceKind::from_source_code(contents.to_string(), source_type) { Ok(Some(source_kind)) => source_kind, Ok(None) => return Ok(Diagnostics::default()), Err(err) => { diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index a56d1b2bcfc1db..6793c45cfd0352 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -184,7 +184,7 @@ impl Printer { } SerializationFormat::Text => { TextEmitter::default() - .with_show_fix_status(show_fix_status(self.fix_mode, fixables)) + .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) .with_show_fix_diff(self.flags.contains(Flags::SHOW_FIX_DIFF)) .with_show_source(self.flags.contains(Flags::SHOW_SOURCE)) .emit(writer, &diagnostics.messages, &context)?; @@ -202,7 +202,7 @@ impl Printer { SerializationFormat::Grouped => { GroupedEmitter::default() .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) - .with_show_fix_status(show_fix_status(self.fix_mode, fixables)) + .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) .emit(writer, &diagnostics.messages, &context)?; if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) { @@ -361,7 +361,7 @@ impl Printer { let context = EmitterContext::new(&diagnostics.notebook_indexes); TextEmitter::default() - .with_show_fix_status(show_fix_status(self.fix_mode, fixables)) + .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) .emit(writer, &diagnostics.messages, &context)?; } @@ -385,7 +385,7 @@ fn num_digits(n: usize) -> usize { } /// Return `true` if the [`Printer`] should indicate that a rule is fixable. -fn show_fix_status(fix_mode: flags::FixMode, fixables: FixableStatistics) -> bool { +fn show_fix_status(fix_mode: flags::FixMode, fixables: &FixableStatistics) -> bool { // If we're in application mode, avoid indicating that a rule is fixable. // If the specific violation were truly fixable, it would've been fixed in // this pass! (We're occasionally unable to determine whether a specific diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index dbf8e82939178f..06acd742972ef9 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -799,7 +799,7 @@ fn check_input_from_argfile() -> Result<()> { } #[test] -fn displays_fix_applicability_levels() -> Result<()> { +fn displays_fix_applicability_levels() { // `--fix` should only apply automatic fixes, but should tell the user about `--fix --unautomatic` if // there are remaining unautomatic fixes. // TODO: this should be a failure but we don't have a way to track that @@ -825,12 +825,10 @@ fn displays_fix_applicability_levels() -> Result<()> { ----- stderr ----- "###); - - Ok(()) } #[test] -fn displays_remaining_suggested_fixes() -> Result<()> { +fn displays_remaining_suggested_fixes() { assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) .args(["-", "--output-format", "text", "--no-cache", "--isolated", "--select", "F601"]) .pass_stdin("x = {'a': 1, 'a': 1}\n"), @@ -844,12 +842,10 @@ fn displays_remaining_suggested_fixes() -> Result<()> { ----- stderr ----- "###); - - Ok(()) } #[test] -fn fix_applies_automatic_fixes_only() -> Result<()> { +fn fix_applies_automatic_fixes_only() { // `--fix` should only apply automatic fixes. Since we're runnnig in `stdin` mode, output shouldn't // be printed. assert_cmd_snapshot!( @@ -873,12 +869,10 @@ fn fix_applies_automatic_fixes_only() -> Result<()> { ----- stderr ----- "###); - - Ok(()) } #[test] -fn fix_applies_automatic_and_suggested_fixes_with_fix_suggested() -> Result<()> { +fn fix_applies_automatic_and_suggested_fixes_with_fix_suggested() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -904,12 +898,10 @@ fn fix_applies_automatic_and_suggested_fixes_with_fix_suggested() -> Result<()> ----- stderr ----- "###); - - Ok(()) } #[test] -fn diff_shows_automatic_and_suggested_fixes_with_fix_suggested() -> Result<()> { +fn diff_shows_automatic_and_suggested_fixes_with_fix_suggested() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -937,12 +929,10 @@ fn diff_shows_automatic_and_suggested_fixes_with_fix_suggested() -> Result<()> { ----- stderr ----- "### ); - - Ok(()) } #[test] -fn diff_shows_automatic_fixes_only() -> Result<()> { +fn diff_shows_automatic_fixes_only() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -968,12 +958,10 @@ fn diff_shows_automatic_fixes_only() -> Result<()> { ----- stderr ----- "### ); - - Ok(()) } #[test] -fn fix_only_applies_automatic_and_suggested_fixes_with_fix_suggested() -> Result<()> { +fn fix_only_applies_automatic_and_suggested_fixes_with_fix_suggested() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -996,12 +984,10 @@ fn fix_only_applies_automatic_and_suggested_fixes_with_fix_suggested() -> Result ----- stderr ----- "###); - - Ok(()) } #[test] -fn fix_only_applies_automatic_fixes_only() -> Result<()> { +fn fix_only_applies_automatic_fixes_only() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -1023,6 +1009,4 @@ fn fix_only_applies_automatic_fixes_only() -> Result<()> { ----- stderr ----- "###); - - Ok(()) } From 85b5efe141f9106779e0b4a4659522bee75a0acf Mon Sep 17 00:00:00 2001 From: Zanie Date: Mon, 2 Oct 2023 20:14:57 -0500 Subject: [PATCH 03/28] Update CLI documentation for fixes --- crates/ruff_cli/src/args.rs | 10 +++++----- docs/configuration.md | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff_cli/src/args.rs index f59cb623c61319..acd797595f895e 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff_cli/src/args.rs @@ -76,11 +76,11 @@ pub enum Command { pub struct CheckCommand { /// List of files or directories to check. pub files: Vec, - /// Attempt to automatically fix lint violations. - /// Use `--no-fix` to disable. + /// Apply automatic fixes to resolve lint violations. + /// Use `--no-fix` to disable or `--fix-suggested` to include suggested fixes. #[arg(long, overrides_with("no_fix"))] fix: bool, - /// Attempt to automatically fix both automatic and suggested lint violations. + /// Apply automatic and suggested fixes to resolve lint violations. #[arg(long, overrides_with_all(["fix", "no_fix"]))] fix_suggested: bool, #[clap(long, overrides_with_all(["fix", "fix_suggested"]), hide = true)] @@ -103,8 +103,8 @@ pub struct CheckCommand { /// Run in watch mode by re-running whenever files change. #[arg(short, long)] pub watch: bool, - /// Fix any fixable lint violations, but don't report on leftover violations. Implies `--fix`. - /// Use `--no-fix-only` to disable. + /// Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. + /// Use `--no-fix-only` to disable or `--fix-suggested` to include suggested fixes. #[arg(long, overrides_with("no_fix_only"))] fix_only: bool, #[clap(long, overrides_with("fix_only"), hide = true)] diff --git a/docs/configuration.md b/docs/configuration.md index dbe568dcc2bd4e..daab96b9a183d6 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -193,9 +193,9 @@ Arguments: Options: --fix - Attempt to automatically fix lint violations. Use `--no-fix` to disable + Apply automatic fixes to resolve lint violations. Use `--no-fix` to disable or `--fix-suggested` to include suggested fixes --fix-suggested - Attempt to automatically fix both automatic and suggested lint violations + Apply automatic and suggested fixes to resolve lint violations --show-source Show violations with source code. Use `--no-show-source` to disable --show-fixes @@ -205,7 +205,7 @@ Options: -w, --watch Run in watch mode by re-running whenever files change --fix-only - Fix any fixable lint violations, but don't report on leftover violations. Implies `--fix`. Use `--no-fix-only` to disable + Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. Use `--no-fix-only` to disable or `--fix-suggested` to include suggested fixes --ignore-noqa Ignore any `# noqa` comments --output-format From 7c05fb5d664b2b8d05cf4c44d611c860010ab668 Mon Sep 17 00:00:00 2001 From: Zanie Date: Mon, 2 Oct 2023 20:17:04 -0500 Subject: [PATCH 04/28] Use `self.flags.intersects` consistently --- crates/ruff_cli/src/printer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index 6793c45cfd0352..642fc526e84e85 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -185,8 +185,8 @@ impl Printer { SerializationFormat::Text => { TextEmitter::default() .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) - .with_show_fix_diff(self.flags.contains(Flags::SHOW_FIX_DIFF)) - .with_show_source(self.flags.contains(Flags::SHOW_SOURCE)) + .with_show_fix_diff(self.flags.intersects(Flags::SHOW_FIX_DIFF)) + .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) .emit(writer, &diagnostics.messages, &context)?; if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) { From 87def5860591efd3896342ebee43974c68ac0e2b Mon Sep 17 00:00:00 2001 From: Zanie Date: Mon, 2 Oct 2023 20:19:41 -0500 Subject: [PATCH 05/28] Revert change to notebook cell iteration --- crates/ruff_cli/src/diagnostics.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/ruff_cli/src/diagnostics.rs b/crates/ruff_cli/src/diagnostics.rs index f098c8ee14fe1c..49d3dad2c32838 100644 --- a/crates/ruff_cli/src/diagnostics.rs +++ b/crates/ruff_cli/src/diagnostics.rs @@ -286,10 +286,9 @@ pub(crate) fn lint_path( // mutated it. let src_notebook = source_kind.as_ipy_notebook().unwrap(); let mut stdout = io::stdout().lock(); - for ((idx, src_cell), dest_cell) in src_notebook - .cells() - .iter() - .enumerate() + // Cell indices are 1-based. + for ((idx, src_cell), dest_cell) in (1u32..) + .zip(src_notebook.cells().iter()) .zip(dest_notebook.cells().iter()) { let (Cell::Code(src_code_cell), Cell::Code(dest_code_cell)) = From 657783343562d951909d41efcaf8d8d696a9725c Mon Sep 17 00:00:00 2001 From: Zanie Date: Mon, 2 Oct 2023 20:20:52 -0500 Subject: [PATCH 06/28] Remove stale todo from test --- crates/ruff_cli/tests/integration_test.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index 06acd742972ef9..a9d4d9f634e46c 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -800,9 +800,8 @@ fn check_input_from_argfile() -> Result<()> { #[test] fn displays_fix_applicability_levels() { - // `--fix` should only apply automatic fixes, but should tell the user about `--fix --unautomatic` if - // there are remaining unautomatic fixes. - // TODO: this should be a failure but we don't have a way to track that + // `--fix` should only apply automatic fixes, but should tell the user about `--fix-suggested` if + // there are remaining fixes. assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) .args([ "-", From d004ddc6747d82eaf5cf7b251e14b69cc8c0210b Mon Sep 17 00:00:00 2001 From: Zanie Date: Mon, 2 Oct 2023 20:27:42 -0500 Subject: [PATCH 07/28] Cleanup internal commentary on the fix rules --- crates/ruff_cli/src/lib.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index 2397aa8ee81cbe..b1d3be072fccb4 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -237,14 +237,12 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { // Fix rules are as follows: // - By default, generate all fixes, but don't apply them to the filesystem. - // - If `--fix` or `--fix-only` is set, always apply fixes to the filesystem (or - // print them to stdout, if we're reading from stdin) for [`Applicability::Automatic`] rules - // only. - // - If `--diff` or `--fix-only` are set, don't print any violations (only - // fixes) for [`Applicability::Automatic`] rules only. - // - If `--fix--suggested` is set, the above rules will apply to both [`Applicability::Suggested`] and - // [`Applicability::Automatic`] fixes. - // TODO: can't fix this until @zanieb changes the CLI + // - If `--fix` or `--fix-only` is set, apply applicable fixes to the filesystem (or + // print them to stdout, if we're reading from stdin). + // - If `--diff` or `--fix-only` are set, don't print any violations (only applicable fixes) + // - By default, applicable fixes only include [`Applicablility::Automatic`], but if + // `--fix--suggested` is set, then [`Applicablility::Suggested`] fixes are included. + let fix_suggested = if fix_suggested { SuggestedFixes::Apply } else { @@ -256,7 +254,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { } else if fix || fix_only { FixMode::Apply(fix_suggested) } else { - // We'll always generate all fixes, regardless of [`Applicability`], in `generate` mode + // Always generate all fixes, regardless of [`Applicability`], in `generate` mode FixMode::Generate(SuggestedFixes::Apply) }; From 96b8ce18c831d1b5821fb349a3d4817096642dc5 Mon Sep 17 00:00:00 2001 From: Zanie Date: Mon, 2 Oct 2023 20:38:27 -0500 Subject: [PATCH 08/28] Refactor `fix_file` implementation to use `Fix.applies` https://github.com/astral-sh/ruff/pull/5119#discussion_r1265224831 --- crates/ruff_diagnostics/src/fix.rs | 4 ++-- crates/ruff_linter/src/fix/mod.rs | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/ruff_diagnostics/src/fix.rs b/crates/ruff_diagnostics/src/fix.rs index 8db635392f86dd..6c623087a6141c 100644 --- a/crates/ruff_diagnostics/src/fix.rs +++ b/crates/ruff_diagnostics/src/fix.rs @@ -166,8 +166,8 @@ impl Fix { self } - /// Return [`true`] if this [`Fix`] should be applied with a given [`Applicability`]. - pub fn is_applied(&self, applicability: Applicability) -> bool { + /// Return [`true`] if this [`Fix`] should be applied with at a given [`Applicability`]. + pub fn applies(&self, applicability: Applicability) -> bool { self.applicability >= applicability } } diff --git a/crates/ruff_linter/src/fix/mod.rs b/crates/ruff_linter/src/fix/mod.rs index aa626d8992649b..49e9ce90c37786 100644 --- a/crates/ruff_linter/src/fix/mod.rs +++ b/crates/ruff_linter/src/fix/mod.rs @@ -24,25 +24,25 @@ pub(crate) struct FixResult { pub(crate) source_map: SourceMap, } -/// Auto-fix errors in a file, and write the fixed source code to disk. +/// Fix errors in a file, and write the fixed source code to disk. pub(crate) fn fix_file( diagnostics: &[Diagnostic], locator: &Locator, fix_suggested: SuggestedFixes, ) -> Option { + let required_applicability = if fix_suggested.is_apply() { + Applicability::Suggested + } else { + Applicability::Automatic + }; + let mut with_fixes = diagnostics .iter() - .filter(|diag| { - let Some(ref fix) = diag.fix else { - return false; - }; - - // change this - if matches!(fix_suggested, SuggestedFixes::Apply) { - fix.applicability() >= Applicability::Suggested - } else { - fix.applicability() == Applicability::Automatic - } + .filter(|diagnostic| { + diagnostic + .fix + .as_ref() + .map_or(false, |fix| fix.applies(required_applicability)) }) .peekable(); From 9949fa0daf88fcb46a8e103a2469c70e7971dee8 Mon Sep 17 00:00:00 2001 From: Zanie Date: Mon, 2 Oct 2023 21:58:44 -0500 Subject: [PATCH 09/28] Use different symbols for fix messages depending on applicability Refactors `violation_string` as well --- crates/ruff_cli/src/printer.rs | 44 +++++++++++------------ crates/ruff_cli/tests/integration_test.rs | 28 +++++++-------- crates/ruff_diagnostics/src/fix.rs | 10 ++++++ crates/ruff_linter/src/message/text.rs | 4 ++- 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index 642fc526e84e85..d96f67603b4730 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -478,29 +478,27 @@ impl<'a> FixableStatistics<'a> { /// Build the displayed fix status message depending on the types of the remaining fixes. fn violation_string(&self) -> String { - let prefix = format!("[{}]", "*".cyan()); - let mut fix_status = prefix; - - if self.automatic > 0 { - fix_status = format!( - "{fix_status} {} potentially fixable with the --fix option.", - self.automatic - ); - } - - if self.suggested > 0 { - let (line_break, extra_prefix) = if self.automatic > 0 { - ("\n", format!("[{}]", "*".cyan())) - } else { - ("", String::new()) - }; - - let total = self.automatic + self.suggested; - fix_status = format!( - "{fix_status}{line_break}{extra_prefix} {total} potentially fixable with the --fix-suggested option." - ); + let automatic_prefix = format!("[{}]", Applicability::Automatic.symbol().cyan()); + let suggested_prefix = format!("[{}]", Applicability::Suggested.symbol().cyan()); + + if self.automatic > 0 && self.suggested > 0 { + format!( + "{automatic_prefix} {} fixable with the --fix option.\n\ + {suggested_prefix} {} potentially fixable with the --fix-suggested option.", + self.automatic, self.suggested + ) + } else if self.automatic > 0 { + format!( + "{automatic_prefix} {} fixable with the --fix option.", + self.automatic, + ) + } else if self.suggested > 0 { + format!( + "{suggested_prefix} {} potentially fixable with the --fix-suggested option.", + self.suggested + ) + } else { + String::new() } - - fix_status } } diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index a9d4d9f634e46c..b0945bc537250e 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -46,16 +46,16 @@ fn stdin_success() { fn stdin_error() { assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) .args(STDIN_BASE_OPTIONS) - .pass_stdin("import os\n"), @r#" + .pass_stdin("import os\n"), @r###" success: false exit_code: 1 ----- stdout ----- -:1:8: F401 [*] `os` imported but unused Found 1 error. - [*] 1 potentially fixable with the --fix option. + [*] 1 fixable with the --fix option. ----- stderr ----- - "#); + "###); } #[test] @@ -69,7 +69,7 @@ fn stdin_filename() { ----- stdout ----- F401.py:1:8: F401 [*] `os` imported but unused Found 1 error. - [*] 1 potentially fixable with the --fix option. + [*] 1 fixable with the --fix option. ----- stderr ----- "###); @@ -87,7 +87,7 @@ fn stdin_source_type_py() { ----- stdout ----- TCH.py:1:8: F401 [*] `os` imported but unused Found 1 error. - [*] 1 potentially fixable with the --fix option. + [*] 1 fixable with the --fix option. ----- stderr ----- "###); @@ -789,7 +789,7 @@ fn check_input_from_argfile() -> Result<()> { ----- stdout ----- /path/to/a.py:1:8: F401 [*] `os` imported but unused Found 1 error. - [*] 1 potentially fixable with the --fix option. + [*] 1 fixable with the --fix option. ----- stderr ----- "###); @@ -816,11 +816,11 @@ fn displays_fix_applicability_levels() { success: false exit_code: 1 ----- stdout ----- - -:1:14: F601 [*] Dictionary key literal `'a'` repeated + -:1:14: F601 [**] Dictionary key literal `'a'` repeated -:2:7: UP034 [*] Avoid extraneous parentheses Found 2 errors. - [*] 1 potentially fixable with the --fix option. - [*] 2 potentially fixable with the --fix-suggested option. + [*] 1 fixable with the --fix option. + [**] 1 potentially fixable with the --fix-suggested option. ----- stderr ----- "###); @@ -835,9 +835,9 @@ fn displays_remaining_suggested_fixes() { success: false exit_code: 1 ----- stdout ----- - -:1:14: F601 [*] Dictionary key literal `'a'` repeated + -:1:14: F601 [**] Dictionary key literal `'a'` repeated Found 1 error. - [*] 1 potentially fixable with the --fix-suggested option. + [**] 1 potentially fixable with the --fix-suggested option. ----- stderr ----- "###); @@ -889,11 +889,11 @@ fn fix_applies_automatic_and_suggested_fixes_with_fix_suggested() { success: false exit_code: 1 ----- stdout ----- - -:1:14: F601 [*] Dictionary key literal `'a'` repeated + -:1:14: F601 [**] Dictionary key literal `'a'` repeated -:2:7: UP034 [*] Avoid extraneous parentheses Found 2 errors. - [*] 1 potentially fixable with the --fix option. - [*] 2 potentially fixable with the --fix-suggested option. + [*] 1 fixable with the --fix option. + [**] 1 potentially fixable with the --fix-suggested option. ----- stderr ----- "###); diff --git a/crates/ruff_diagnostics/src/fix.rs b/crates/ruff_diagnostics/src/fix.rs index 6c623087a6141c..b724d6e178e11f 100644 --- a/crates/ruff_diagnostics/src/fix.rs +++ b/crates/ruff_diagnostics/src/fix.rs @@ -31,6 +31,16 @@ pub enum Applicability { Automatic, } +impl Applicability { + pub fn symbol(&self) -> &'static str { + match self { + Self::Automatic => "*", + Self::Suggested => "**", + _ => "*", + } + } +} + /// Indicates the level of isolation required to apply a fix. #[derive(Default, Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] diff --git a/crates/ruff_linter/src/message/text.rs b/crates/ruff_linter/src/message/text.rs index ee22415d4a47a8..c3c2111ac9628e 100644 --- a/crates/ruff_linter/src/message/text.rs +++ b/crates/ruff_linter/src/message/text.rs @@ -141,11 +141,13 @@ impl Display for RuleCodeAndBody<'_> { let kind = &self.message.kind; if self.show_fix_status && self.message.fix.is_some() { + let indicator = self.message.fix.as_ref().unwrap().applicability().symbol(); + write!( f, "{code} {fix}{body}", code = kind.rule().noqa_code().to_string().red().bold(), - fix = format_args!("[{}] ", "*".cyan()), + fix = format_args!("[{}] ", indicator.cyan()), body = kind.body, ) } else { From ee903bf16800c1a75f32dc9f2cce889f31728597 Mon Sep 17 00:00:00 2001 From: Zanie Date: Tue, 3 Oct 2023 12:16:01 -0500 Subject: [PATCH 10/28] Update snapshots to reflect changes in fix messages --- crates/ruff_cli/tests/lint.rs | 8 +- ...__message__grouped__tests__fix_status.snap | 4 +- ...ter__message__text__tests__fix_status.snap | 4 +- ...__flake8_annotations__tests__defaults.snap | 4 +- ..._annotations__tests__mypy_init_return.snap | 6 +- ...otations__tests__simple_magic_methods.snap | 28 ++--- ...__flake8_bugbear__tests__B007_B007.py.snap | 8 +- ...ke8_bugbear__tests__B009_B009_B010.py.snap | 34 +++--- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 12 +-- ...__flake8_bugbear__tests__B011_B011.py.snap | 4 +- ...8_comprehensions__tests__C400_C400.py.snap | 4 +- ...8_comprehensions__tests__C401_C401.py.snap | 26 ++--- ...8_comprehensions__tests__C402_C402.py.snap | 26 ++--- ...8_comprehensions__tests__C403_C403.py.snap | 18 ++-- ...8_comprehensions__tests__C404_C404.py.snap | 20 ++-- ...8_comprehensions__tests__C405_C405.py.snap | 40 +++---- ...8_comprehensions__tests__C406_C406.py.snap | 8 +- ...8_comprehensions__tests__C408_C408.py.snap | 32 +++--- ...low_dict_calls_with_keyword_arguments.snap | 10 +- ...8_comprehensions__tests__C409_C409.py.snap | 10 +- ...8_comprehensions__tests__C410_C410.py.snap | 8 +- ...8_comprehensions__tests__C411_C411.py.snap | 2 +- ...8_comprehensions__tests__C413_C413.py.snap | 20 ++-- ...8_comprehensions__tests__C414_C414.py.snap | 48 ++++----- ...8_comprehensions__tests__C416_C416.py.snap | 14 +-- ...8_comprehensions__tests__C417_C417.py.snap | 36 +++---- ...8_comprehensions__tests__C418_C418.py.snap | 8 +- ...8_comprehensions__tests__C419_C419.py.snap | 14 +-- ...__rules__flake8_errmsg__tests__custom.snap | 14 +-- ...rules__flake8_errmsg__tests__defaults.snap | 18 ++-- ...8_import_conventions__tests__defaults.snap | 26 ++--- ...ke8_import_conventions__tests__tricky.snap | 2 +- ...ake8_logging__tests__LOG001_LOG001.py.snap | 4 +- ...ake8_logging__tests__LOG002_LOG002.py.snap | 8 +- ...ake8_logging__tests__LOG009_LOG009.py.snap | 4 +- ...__flake8_pie__tests__PIE794_PIE794.py.snap | 8 +- ...__flake8_pie__tests__PIE810_PIE810.py.snap | 10 +- ..._flake8_pyi__tests__PYI010_PYI010.pyi.snap | 6 +- ..._flake8_pyi__tests__PYI011_PYI011.pyi.snap | 36 +++---- ..._flake8_pyi__tests__PYI014_PYI014.pyi.snap | 26 ++--- ..._flake8_pyi__tests__PYI015_PYI015.pyi.snap | 22 ++-- ...__flake8_pyi__tests__PYI025_PYI025.py.snap | 4 +- ..._flake8_pyi__tests__PYI025_PYI025.pyi.snap | 10 +- ..._flake8_pyi__tests__PYI026_PYI026.pyi.snap | 10 +- ..._flake8_pyi__tests__PYI053_PYI053.pyi.snap | 10 +- ..._flake8_pyi__tests__PYI054_PYI054.pyi.snap | 16 +-- ...e8_pyi__tests__py38_PYI026_PYI026.pyi.snap | 10 +- ...es__flake8_pytest_style__tests__PT003.snap | 16 +-- ...flake8_pytest_style__tests__PT006_csv.snap | 4 +- ...e8_pytest_style__tests__PT006_default.snap | 20 ++-- ...lake8_pytest_style__tests__PT006_list.snap | 16 +-- ...es__flake8_pytest_style__tests__PT009.snap | 58 +++++----- ...es__flake8_pytest_style__tests__PT014.snap | 16 +-- ...es__flake8_pytest_style__tests__PT018.snap | 30 +++--- ...es__flake8_pytest_style__tests__PT026.snap | 4 +- ...__flake8_pytest_style__tests__PT027_0.snap | 16 +-- ...__flake8_pytest_style__tests__PT027_1.snap | 2 +- ...lake8_return__tests__RET503_RET503.py.snap | 40 +++---- ...lake8_return__tests__RET504_RET504.py.snap | 22 ++-- ...ke8_simplify__tests__SIM101_SIM101.py.snap | 14 +-- ...ke8_simplify__tests__SIM102_SIM102.py.snap | 24 ++--- ...ke8_simplify__tests__SIM103_SIM103.py.snap | 8 +- ...8_simplify__tests__SIM105_SIM105_0.py.snap | 18 ++-- ...8_simplify__tests__SIM105_SIM105_1.py.snap | 2 +- ...8_simplify__tests__SIM105_SIM105_2.py.snap | 2 +- ...8_simplify__tests__SIM105_SIM105_4.py.snap | 2 +- ...ke8_simplify__tests__SIM108_SIM108.py.snap | 6 +- ...ke8_simplify__tests__SIM109_SIM109.py.snap | 8 +- ...ke8_simplify__tests__SIM110_SIM110.py.snap | 22 ++-- ...ke8_simplify__tests__SIM110_SIM111.py.snap | 24 ++--- ...ke8_simplify__tests__SIM112_SIM112.py.snap | 6 +- ...ke8_simplify__tests__SIM117_SIM117.py.snap | 20 ++-- ...ke8_simplify__tests__SIM118_SIM118.py.snap | 38 +++---- ...ke8_simplify__tests__SIM202_SIM202.py.snap | 6 +- ...ke8_simplify__tests__SIM208_SIM208.py.snap | 10 +- ...ke8_simplify__tests__SIM210_SIM210.py.snap | 8 +- ...ke8_simplify__tests__SIM211_SIM211.py.snap | 6 +- ...ke8_simplify__tests__SIM212_SIM212.py.snap | 4 +- ...ke8_simplify__tests__SIM220_SIM220.py.snap | 6 +- ...ke8_simplify__tests__SIM221_SIM221.py.snap | 6 +- ...ke8_simplify__tests__SIM222_SIM222.py.snap | 102 +++++++++--------- ...ke8_simplify__tests__SIM223_SIM223.py.snap | 98 ++++++++--------- ...ke8_simplify__tests__SIM401_SIM401.py.snap | 12 +-- ...ts__tests__ban_parent_imports_package.snap | 12 +-- ..._type_checking__tests__exempt_modules.snap | 2 +- ...ke8_type_checking__tests__import_from.snap | 2 +- ...ests__import_from_type_checking_block.snap | 2 +- ...ype_checking__tests__multiple_members.snap | 4 +- ...sts__multiple_modules_different_types.snap | 4 +- ...ng__tests__multiple_modules_same_type.snap | 4 +- ...ype_checking__tests__no_typing_import.snap | 2 +- ...rt-in-type-checking-block_TCH004_1.py.snap | 2 +- ...t-in-type-checking-block_TCH004_11.py.snap | 2 +- ...t-in-type-checking-block_TCH004_12.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_2.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_4.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_5.py.snap | 6 +- ...rt-in-type-checking-block_TCH004_9.py.snap | 4 +- ...k_runtime_evaluated_base_classes_1.py.snap | 6 +- ...ock_runtime_evaluated_decorators_1.py.snap | 6 +- ...__flake8_type_checking__tests__strict.snap | 16 +-- ...ests__type_checking_block_after_usage.snap | 2 +- ...g__tests__type_checking_block_comment.snap | 2 +- ...ng__tests__type_checking_block_inline.snap | 2 +- ...__tests__type_checking_block_own_line.snap | 2 +- ...ing-only-first-party-import_TCH001.py.snap | 2 +- ...nly-standard-library-import_TCH003.py.snap | 2 +- ...t_runtime_evaluated_base_classes_3.py.snap | 2 +- ...ort_runtime_evaluated_decorators_3.py.snap | 2 +- ...ing-only-third-party-import_TCH002.py.snap | 18 ++-- ...t_runtime_evaluated_base_classes_2.py.snap | 4 +- ...ort_runtime_evaluated_decorators_2.py.snap | 2 +- ...ing-only-third-party-import_strict.py.snap | 4 +- ...s__typing_import_after_package_import.snap | 2 +- ...__typing_import_before_package_import.snap | 2 +- ...rules__flynt__tests__FLY002_FLY002.py.snap | 14 +-- ...__numpy-deprecated-function_NPY003.py.snap | 20 ++-- ...numpy-deprecated-type-alias_NPY001.py.snap | 14 +-- ...es__pandas_vet__tests__PD002_PD002.py.snap | 14 +-- ..._rules__pandas_vet__tests__PD002_fail.snap | 2 +- ...__perflint__tests__PERF102_PERF102.py.snap | 24 ++--- ...les__pycodestyle__tests__E711_E711.py.snap | 20 ++-- ...les__pycodestyle__tests__E712_E712.py.snap | 26 ++--- ...les__pycodestyle__tests__E731_E731.py.snap | 26 ++--- ...pycodestyle__tests__constant_literals.snap | 8 +- ...__rules__pydocstyle__tests__D200_D.py.snap | 6 +- ...ules__pydocstyle__tests__D200_D200.py.snap | 2 +- ...__rules__pydocstyle__tests__D400_D.py.snap | 34 +++--- ...ules__pydocstyle__tests__D400_D400.py.snap | 24 ++--- ...__rules__pydocstyle__tests__D415_D.py.snap | 32 +++--- ...__rules__pydocstyle__tests__d209_d400.snap | 2 +- ..._rules__pyflakes__tests__F601_F601.py.snap | 16 +-- ..._rules__pyflakes__tests__F602_F602.py.snap | 12 +-- ...ules__pyflakes__tests__F841_F841_0.py.snap | 16 +-- ...ules__pyflakes__tests__F841_F841_1.py.snap | 4 +- ...ules__pyflakes__tests__F841_F841_3.py.snap | 58 +++++----- ...lakes__tests__f841_dummy_variable_rgx.snap | 20 ++-- ...nt__tests__PLC0414_import_aliasing.py.snap | 16 +-- ...t__tests__PLR1722_sys_exit_alias_0.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_1.py.snap | 8 +- ...__tests__PLR1722_sys_exit_alias_11.py.snap | 2 +- ...__tests__PLR1722_sys_exit_alias_12.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_2.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_3.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_4.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_5.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_6.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_7.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_8.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_9.py.snap | 2 +- ...int__tests__PLW3301_nested_min_max.py.snap | 28 ++--- ...er__rules__pyupgrade__tests__UP005.py.snap | 8 +- ...__rules__pyupgrade__tests__UP006_0.py.snap | 4 +- ...__rules__pyupgrade__tests__UP006_1.py.snap | 2 +- ...__rules__pyupgrade__tests__UP006_3.py.snap | 2 +- ...er__rules__pyupgrade__tests__UP007.py.snap | 34 +++--- ...er__rules__pyupgrade__tests__UP008.py.snap | 10 +- ...er__rules__pyupgrade__tests__UP010.py.snap | 20 ++-- ...er__rules__pyupgrade__tests__UP013.py.snap | 24 ++--- ...er__rules__pyupgrade__tests__UP014.py.snap | 10 +- ...er__rules__pyupgrade__tests__UP020.py.snap | 2 +- ...er__rules__pyupgrade__tests__UP021.py.snap | 6 +- ...er__rules__pyupgrade__tests__UP022.py.snap | 14 +-- ...er__rules__pyupgrade__tests__UP023.py.snap | 20 ++-- ...er__rules__pyupgrade__tests__UP026.py.snap | 52 ++++----- ...er__rules__pyupgrade__tests__UP027.py.snap | 10 +- ...__rules__pyupgrade__tests__UP028_0.py.snap | 26 ++--- ...er__rules__pyupgrade__tests__UP029.py.snap | 8 +- ...__rules__pyupgrade__tests__UP030_0.py.snap | 46 ++++---- ...__rules__pyupgrade__tests__UP031_0.py.snap | 82 +++++++------- ...__rules__pyupgrade__tests__UP032_0.py.snap | 86 +++++++-------- ...__rules__pyupgrade__tests__UP032_1.py.snap | 2 +- ...__rules__pyupgrade__tests__UP032_2.py.snap | 44 ++++---- ...er__rules__pyupgrade__tests__UP035.py.snap | 92 ++++++++-------- ...__rules__pyupgrade__tests__UP036_0.py.snap | 58 +++++----- ...__rules__pyupgrade__tests__UP036_1.py.snap | 26 ++--- ...__rules__pyupgrade__tests__UP036_2.py.snap | 24 ++--- ...__rules__pyupgrade__tests__UP036_3.py.snap | 6 +- ...__rules__pyupgrade__tests__UP036_4.py.snap | 16 +-- ...__rules__pyupgrade__tests__UP036_5.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP038.py.snap | 4 +- ...rade__tests__datetime_utc_alias_py311.snap | 8 +- ...tests__future_annotations_pep_604_p37.snap | 2 +- ...sts__future_annotations_pep_604_py310.snap | 4 +- ...es__refurb__tests__FURB105_FURB105.py.snap | 34 +++--- ...es__refurb__tests__FURB113_FURB113.py.snap | 24 ++--- ...es__refurb__tests__FURB131_FURB131.py.snap | 12 +-- ...es__refurb__tests__FURB132_FURB132.py.snap | 8 +- ...es__refurb__tests__FURB140_FURB140.py.snap | 18 ++-- ...es__refurb__tests__FURB145_FURB145.py.snap | 12 +-- ...es__refurb__tests__FURB148_FURB148.py.snap | 40 +++---- ..._ruff__tests__PY39_RUF013_RUF013_0.py.snap | 44 ++++---- ..._ruff__tests__PY39_RUF013_RUF013_1.py.snap | 2 +- ..._rules__ruff__tests__RUF005_RUF005.py.snap | 30 +++--- ...ules__ruff__tests__RUF013_RUF013_0.py.snap | 44 ++++---- ...ules__ruff__tests__RUF013_RUF013_1.py.snap | 2 +- ..._rules__ruff__tests__RUF015_RUF015.py.snap | 24 ++--- ...ules__ruff__tests__RUF017_RUF017_0.py.snap | 14 +-- ...ules__ruff__tests__RUF017_RUF017_1.py.snap | 2 +- ...ruff_linter__rules__ruff__tests__noqa.snap | 2 +- ..._linter__rules__ruff__tests__ruf100_0.snap | 24 ++--- ..._linter__rules__ruff__tests__ruf100_1.snap | 10 +- ..._linter__rules__ruff__tests__ruf100_2.snap | 2 +- ..._linter__rules__ruff__tests__ruf100_3.snap | 38 +++---- ..._linter__rules__ruff__tests__ruf100_5.snap | 2 +- ...__rules__ruff__tests__ruff_noqa_codes.snap | 2 +- ...rules__ruff__tests__ruff_noqa_invalid.snap | 2 +- ...atops__tests__verbose-raise_TRY201.py.snap | 6 +- ...inter__linter__tests__unused_variable.snap | 8 +- 209 files changed, 1591 insertions(+), 1591 deletions(-) diff --git a/crates/ruff_cli/tests/lint.rs b/crates/ruff_cli/tests/lint.rs index 2cfae9668738cf..220b14ba028cc8 100644 --- a/crates/ruff_cli/tests/lint.rs +++ b/crates/ruff_cli/tests/lint.rs @@ -40,7 +40,7 @@ inline-quotes = "single" -:1:5: B005 Using `.strip()` with multi-character strings is misleading -:1:19: Q000 [*] Double quotes found but single quotes preferred Found 3 errors. - [*] 2 potentially fixable with the --fix option. + [*] 2 fixable with the --fix option. ----- stderr ----- "###); @@ -75,7 +75,7 @@ inline-quotes = "single" -:1:5: B005 Using `.strip()` with multi-character strings is misleading -:1:19: Q000 [*] Double quotes found but single quotes preferred Found 3 errors. - [*] 2 potentially fixable with the --fix option. + [*] 2 fixable with the --fix option. ----- stderr ----- "###); @@ -110,7 +110,7 @@ inline-quotes = "single" -:1:5: B005 Using `.strip()` with multi-character strings is misleading -:1:19: Q000 [*] Double quotes found but single quotes preferred Found 3 errors. - [*] 2 potentially fixable with the --fix option. + [*] 2 fixable with the --fix option. ----- stderr ----- "###); @@ -149,7 +149,7 @@ inline-quotes = "single" -:1:5: B005 Using `.strip()` with multi-character strings is misleading -:1:19: Q000 [*] Double quotes found but single quotes preferred Found 3 errors. - [*] 2 potentially fixable with the --fix option. + [*] 2 fixable with the --fix option. ----- stderr ----- "###); diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status.snap index 453cf1eda49e2b..575ca407106c88 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status.snap @@ -3,14 +3,14 @@ source: crates/ruff_linter/src/message/grouped.rs expression: content --- fib.py: - 1:8 F401 [*] `os` imported but unused + 1:8 F401 [**] `os` imported but unused | 1 | import os | ^^ F401 | = help: Remove unused import: `os` - 6:5 F841 [*] Local variable `x` is assigned to but never used + 6:5 F841 [**] Local variable `x` is assigned to but never used | 4 | def fibonacci(n): 5 | """Compute the nth number in the Fibonacci sequence.""" diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap index a53420329c119c..f79d5b82f84823 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap @@ -2,14 +2,14 @@ source: crates/ruff_linter/src/message/text.rs expression: content --- -fib.py:1:8: F401 [*] `os` imported but unused +fib.py:1:8: F401 [**] `os` imported but unused | 1 | import os | ^^ F401 | = help: Remove unused import: `os` -fib.py:6:5: F841 [*] Local variable `x` is assigned to but never used +fib.py:6:5: F841 [**] Local variable `x` is assigned to but never used | 4 | def fibonacci(n): 5 | """Compute the nth number in the Fibonacci sequence.""" diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap index 46f4faabe2fd89..8c70b0002784f9 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap @@ -242,7 +242,7 @@ annotation_presence.py:154:10: ANN401 Dynamically typed expressions (typing.Any) | ^^^^^^^^^^^^^^^^^^^^^^^^ ANN401 | -annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for special method `__init__` +annotation_presence.py:159:9: ANN204 [**] Missing return type annotation for special method `__init__` | 157 | class Foo: 158 | @decorator() @@ -262,7 +262,7 @@ annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for spec 161 161 | 162 162 | -annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for special method `__init__` +annotation_presence.py:165:9: ANN204 [**] Missing return type annotation for special method `__init__` | 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 164 | class Class: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap index 193ef4f8ba8aca..d4fe71714f3b9e 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__` +mypy_init_return.py:5:9: ANN204 [**] Missing return type annotation for special method `__init__` | 3 | # Error 4 | class Foo: @@ -21,7 +21,7 @@ mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special m 7 7 | 8 8 | -mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__` +mypy_init_return.py:11:9: ANN204 [**] Missing return type annotation for special method `__init__` | 9 | # Error 10 | class Foo: @@ -49,7 +49,7 @@ mypy_init_return.py:40:5: ANN202 Missing return type annotation for private func 41 | ... | -mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__` +mypy_init_return.py:47:9: ANN204 [**] Missing return type annotation for special method `__init__` | 45 | # of a vararg falsely indicated that the function has a typed argument. 46 | class Foo: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap index 8dd48048c65601..a1e0107e631237 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for special method `__str__` +simple_magic_methods.py:2:9: ANN204 [**] Missing return type annotation for special method `__str__` | 1 | class Foo: 2 | def __str__(self): @@ -18,7 +18,7 @@ simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for speci 4 4 | 5 5 | def __repr__(self): -simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__` +simple_magic_methods.py:5:9: ANN204 [**] Missing return type annotation for special method `__repr__` | 3 | ... 4 | @@ -38,7 +38,7 @@ simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for speci 7 7 | 8 8 | def __len__(self): -simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__` +simple_magic_methods.py:8:9: ANN204 [**] Missing return type annotation for special method `__len__` | 6 | ... 7 | @@ -58,7 +58,7 @@ simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for speci 10 10 | 11 11 | def __length_hint__(self): -simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__` +simple_magic_methods.py:11:9: ANN204 [**] Missing return type annotation for special method `__length_hint__` | 9 | ... 10 | @@ -78,7 +78,7 @@ simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for spec 13 13 | 14 14 | def __init__(self): -simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__` +simple_magic_methods.py:14:9: ANN204 [**] Missing return type annotation for special method `__init__` | 12 | ... 13 | @@ -98,7 +98,7 @@ simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for spec 16 16 | 17 17 | def __del__(self): -simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__` +simple_magic_methods.py:17:9: ANN204 [**] Missing return type annotation for special method `__del__` | 15 | ... 16 | @@ -118,7 +118,7 @@ simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for spec 19 19 | 20 20 | def __bool__(self): -simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__` +simple_magic_methods.py:20:9: ANN204 [**] Missing return type annotation for special method `__bool__` | 18 | ... 19 | @@ -138,7 +138,7 @@ simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for spec 22 22 | 23 23 | def __bytes__(self): -simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__` +simple_magic_methods.py:23:9: ANN204 [**] Missing return type annotation for special method `__bytes__` | 21 | ... 22 | @@ -158,7 +158,7 @@ simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for spec 25 25 | 26 26 | def __format__(self, format_spec): -simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__` +simple_magic_methods.py:26:9: ANN204 [**] Missing return type annotation for special method `__format__` | 24 | ... 25 | @@ -178,7 +178,7 @@ simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for spec 28 28 | 29 29 | def __contains__(self, item): -simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__` +simple_magic_methods.py:29:9: ANN204 [**] Missing return type annotation for special method `__contains__` | 27 | ... 28 | @@ -198,7 +198,7 @@ simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for spec 31 31 | 32 32 | def __complex__(self): -simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__` +simple_magic_methods.py:32:9: ANN204 [**] Missing return type annotation for special method `__complex__` | 30 | ... 31 | @@ -218,7 +218,7 @@ simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for spec 34 34 | 35 35 | def __int__(self): -simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__` +simple_magic_methods.py:35:9: ANN204 [**] Missing return type annotation for special method `__int__` | 33 | ... 34 | @@ -238,7 +238,7 @@ simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for spec 37 37 | 38 38 | def __float__(self): -simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__` +simple_magic_methods.py:38:9: ANN204 [**] Missing return type annotation for special method `__float__` | 36 | ... 37 | @@ -258,7 +258,7 @@ simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for spec 40 40 | 41 41 | def __index__(self): -simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__` +simple_magic_methods.py:41:9: ANN204 [**] Missing return type annotation for special method `__index__` | 39 | ... 40 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap index 283f28ee82d05f..f2f81ce37df9f8 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap @@ -11,7 +11,7 @@ B007.py:6:5: B007 Loop control variable `i` not used within loop body | = help: Rename unused `i` to `_i` -B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body +B007.py:18:13: B007 [**] Loop control variable `k` not used within loop body | 16 | for i in range(10): 17 | for j in range(10): @@ -39,7 +39,7 @@ B007.py:30:5: B007 Loop control variable `i` not used within loop body | = help: Rename unused `i` to `_i` -B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body +B007.py:30:13: B007 [**] Loop control variable `k` not used within loop body | 30 | for i, (j, (k, l)) in strange_generator(): # i, k not used | ^ B007 @@ -99,7 +99,7 @@ B007.py:46:10: B007 Loop control variable `bar` may not be used within loop body | = help: Rename unused `bar` to `_bar` -B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body +B007.py:52:14: B007 [**] Loop control variable `bar` not used within loop body | 50 | def f(): 51 | # Fixable. @@ -131,7 +131,7 @@ B007.py:59:14: B007 Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body +B007.py:68:14: B007 [**] Loop control variable `bar` not used within loop body | 66 | def f(): 67 | # Fixable. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap index 1a0d1da89b96b7..2b50b028ef54c0 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:19:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 18 | # Invalid usage 19 | getattr(foo, "bar") @@ -21,7 +21,7 @@ B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute valu 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") -B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:20:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 18 | # Invalid usage 19 | getattr(foo, "bar") @@ -42,7 +42,7 @@ B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute valu 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") -B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:21:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 19 | getattr(foo, "bar") 20 | getattr(foo, "_123abc") @@ -63,7 +63,7 @@ B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute valu 23 23 | getattr(foo, r"abc123") 24 24 | _ = lambda x: getattr(x, "bar") -B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:22:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 20 | getattr(foo, "_123abc") 21 | getattr(foo, "__123abc__") @@ -84,7 +84,7 @@ B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute valu 24 24 | _ = lambda x: getattr(x, "bar") 25 25 | if getattr(x, "bar"): -B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:23:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 21 | getattr(foo, "__123abc__") 22 | getattr(foo, "abc123") @@ -105,7 +105,7 @@ B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute valu 25 25 | if getattr(x, "bar"): 26 26 | pass -B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:24:15: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 22 | getattr(foo, "abc123") 23 | getattr(foo, r"abc123") @@ -126,7 +126,7 @@ B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute val 26 26 | pass 27 27 | getattr(1, "real") -B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:25:4: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 23 | getattr(foo, r"abc123") 24 | _ = lambda x: getattr(x, "bar") @@ -147,7 +147,7 @@ B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute valu 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") -B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:27:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 25 | if getattr(x, "bar"): 26 | pass @@ -168,7 +168,7 @@ B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute valu 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") -B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:28:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 26 | pass 27 | getattr(1, "real") @@ -189,7 +189,7 @@ B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute valu 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") -B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:29:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 27 | getattr(1, "real") 28 | getattr(1., "real") @@ -210,7 +210,7 @@ B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute valu 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") -B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:30:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 28 | getattr(1., "real") 29 | getattr(1.0, "real") @@ -231,7 +231,7 @@ B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute valu 32 32 | getattr(x := 1, "real") 33 33 | getattr(x + y, "real") -B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:31:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 29 | getattr(1.0, "real") 30 | getattr(1j, "real") @@ -252,7 +252,7 @@ B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute valu 33 33 | getattr(x + y, "real") 34 34 | getattr("foo" -B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:32:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 30 | getattr(1j, "real") 31 | getattr(True, "real") @@ -273,7 +273,7 @@ B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute valu 34 34 | getattr("foo" 35 35 | "bar", "real") -B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:33:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 31 | getattr(True, "real") 32 | getattr(x := 1, "real") @@ -294,7 +294,7 @@ B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute valu 35 35 | "bar", "real") 36 36 | -B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:34:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 32 | getattr(x := 1, "real") 33 | getattr(x + y, "real") @@ -316,7 +316,7 @@ B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute valu 37 37 | 38 38 | # Valid setattr usage -B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:58:8: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 58 | assert getattr(func, '_rpc')is True @@ -336,7 +336,7 @@ B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute valu 60 60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247 61 61 | getattr(*foo, "bar") -B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:65:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901 65 | / getattr(self. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap index 2945aafb436c95..39b8f2fc278396 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:50:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 49 | # Invalid usage 50 | setattr(foo, "bar", None) @@ -21,7 +21,7 @@ B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute valu 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) -B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:51:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 49 | # Invalid usage 50 | setattr(foo, "bar", None) @@ -42,7 +42,7 @@ B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute valu 53 53 | setattr(foo, "abc123", None) 54 54 | setattr(foo, r"abc123", None) -B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:52:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 50 | setattr(foo, "bar", None) 51 | setattr(foo, "_123abc", None) @@ -63,7 +63,7 @@ B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute valu 54 54 | setattr(foo, r"abc123", None) 55 55 | setattr(foo.bar, r"baz", None) -B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:53:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 51 | setattr(foo, "_123abc", None) 52 | setattr(foo, "__123abc__", None) @@ -84,7 +84,7 @@ B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute valu 55 55 | setattr(foo.bar, r"baz", None) 56 56 | -B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:54:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 52 | setattr(foo, "__123abc__", None) 53 | setattr(foo, "abc123", None) @@ -104,7 +104,7 @@ B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute valu 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 -B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:55:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 53 | setattr(foo, "abc123", None) 54 | setattr(foo, r"abc123", None) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap index 5415cf1eae26b8..0a6c1cb5b3236e 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` +B011.py:8:8: B011 [**] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` | 7 | assert 1 != 2 8 | assert False @@ -20,7 +20,7 @@ B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), r 9 9 | assert 1 != 2, "message" 10 10 | assert False, "message" -B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` +B011.py:10:8: B011 [**] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` | 8 | assert False 9 | assert 1 != 2, "message" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap index 924f9aad1929c8..c4254696705e0f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C400.py:1:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) +C400.py:1:5: C400 [**] Unnecessary generator (rewrite as a `list` comprehension) | 1 | x = list(x for x in range(3)) | ^^^^^^^^^^^^^^^^^^^^^^^^^ C400 @@ -17,7 +17,7 @@ C400.py:1:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) 3 3 | x for x in range(3) 4 4 | ) -C400.py:2:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) +C400.py:2:5: C400 [**] Unnecessary generator (rewrite as a `list` comprehension) | 1 | x = list(x for x in range(3)) 2 | x = list( diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap index a46cb832d29203..08bcff29e8dfce 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C401.py:1:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:1:5: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 1 | x = set(x for x in range(3)) | ^^^^^^^^^^^^^^^^^^^^^^^^ C401 @@ -17,7 +17,7 @@ C401.py:1:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 3 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}" 4 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3))) -C401.py:2:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:2:5: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 1 | x = set(x for x in range(3)) 2 | x = set(x for x in range(3)) @@ -35,7 +35,7 @@ C401.py:2:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 4 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3))) 5 5 | print(f"Hello {set(a for a in range(3))} World") -C401.py:3:8: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:3:8: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 1 | x = set(x for x in range(3)) 2 | x = set(x for x in range(3)) @@ -55,7 +55,7 @@ C401.py:3:8: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 5 5 | print(f"Hello {set(a for a in range(3))} World") 6 6 | -C401.py:4:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:4:17: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 2 | x = set(x for x in range(3)) 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}" @@ -75,7 +75,7 @@ C401.py:4:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 6 6 | 7 7 | -C401.py:5:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:5:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}" 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3))) @@ -94,7 +94,7 @@ C401.py:5:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 7 7 | 8 8 | def f(x): -C401.py:12:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:12:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 12 | print(f'Hello {set(a for a in "abc")} World') | ^^^^^^^^^^^^^^^^^^^^^ C401 @@ -113,7 +113,7 @@ C401.py:12:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 14 14 | print(f"Hello {set(f(a) for a in 'abc')} World") 15 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") -C401.py:13:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:13:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 12 | print(f'Hello {set(a for a in "abc")} World') 13 | print(f"Hello {set(a for a in 'abc')} World") @@ -133,7 +133,7 @@ C401.py:13:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 15 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") 16 16 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") -C401.py:14:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:14:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 12 | print(f'Hello {set(a for a in "abc")} World') 13 | print(f"Hello {set(a for a in 'abc')} World") @@ -154,7 +154,7 @@ C401.py:14:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 16 16 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") 17 17 | -C401.py:15:10: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:15:10: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 13 | print(f"Hello {set(a for a in 'abc')} World") 14 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -174,7 +174,7 @@ C401.py:15:10: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 17 17 | 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space -C401.py:15:34: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:15:34: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 13 | print(f"Hello {set(a for a in 'abc')} World") 14 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -194,7 +194,7 @@ C401.py:15:34: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 17 17 | 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space -C401.py:16:11: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:16:11: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 14 | print(f"Hello {set(f(a) for a in 'abc')} World") 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -215,7 +215,7 @@ C401.py:16:11: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space 19 19 | # around the set comprehension. -C401.py:16:35: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:16:35: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 14 | print(f"Hello {set(f(a) for a in 'abc')} World") 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -236,7 +236,7 @@ C401.py:16:35: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space 19 19 | # around the set comprehension. -C401.py:20:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:20:12: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) | 18 | # The fix generated for this diagnostic is incorrect, as we add additional space 19 | # around the set comprehension. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap index 86d9bacc139336..5dcb97a323bb76 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:1:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 1 | dict((x, x) for x in range(3)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 @@ -17,7 +17,7 @@ C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 3 3 | (x, x) for x in range(3) 4 4 | ) -C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:2:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 1 | dict((x, x) for x in range(3)) 2 | / dict( @@ -41,7 +41,7 @@ C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 6 6 | y = f'{dict((x, x) for x in range(3))}' 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') -C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:6:8: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 4 | ) 5 | dict(((x, x) for x in range(3)), z=3) @@ -62,7 +62,7 @@ C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') -C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:7:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 5 | dict(((x, x) for x in range(3)), z=3) 6 | y = f'{dict((x, x) for x in range(3))}' @@ -83,7 +83,7 @@ C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:8:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 6 | y = f'{dict((x, x) for x in range(3))}' 7 | print(f'Hello {dict((x, x) for x in range(3))} World') @@ -104,7 +104,7 @@ C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | -C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:9:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 7 | print(f'Hello {dict((x, x) for x in range(3))} World') 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") @@ -124,7 +124,7 @@ C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 11 11 | 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' -C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:10:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 | print(f'Hello {dict((x, x) for x in "abc")} World') @@ -145,7 +145,7 @@ C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' -C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:12:4: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 | @@ -165,7 +165,7 @@ C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 14 14 | 15 15 | def f(x): -C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:12:37: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 | @@ -185,7 +185,7 @@ C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension 14 14 | 15 15 | def f(x): -C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:13:5: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' @@ -205,7 +205,7 @@ C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) 15 15 | def f(x): 16 16 | return x -C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:13:38: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' @@ -225,7 +225,7 @@ C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension 15 15 | def f(x): 16 16 | return x -C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:18:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 16 | return x 17 | @@ -246,7 +246,7 @@ C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension 20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 21 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) -C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:21:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) | 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap index 9091d9352bbb33..dc91926640913a 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:1:5: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 1 | s = set([x for x in range(3)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ C403 @@ -17,7 +17,7 @@ C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr 3 3 | [x for x in range(3)] 4 4 | ) -C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:2:5: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 1 | s = set([x for x in range(3)]) 2 | s = set( @@ -42,7 +42,7 @@ C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr 6 6 | s = f"{set([x for x in 'ab'])}" 7 7 | s = f'{set([x for x in "ab"])}' -C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:6:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 4 | ) 5 | @@ -62,7 +62,7 @@ C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr 8 8 | 9 9 | def f(x): -C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:7:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 6 | s = f"{set([x for x in 'ab'])}" 7 | s = f'{set([x for x in "ab"])}' @@ -82,7 +82,7 @@ C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` compr 9 9 | def f(x): 10 10 | return x -C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:12:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 10 | return x 11 | @@ -103,7 +103,7 @@ C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:14:9: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 12 | s = f"{set([f(x) for x in 'ab'])}" 13 | @@ -121,7 +121,7 @@ C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp 14 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab']) }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:14:34: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 12 | s = f"{set([f(x) for x in 'ab'])}" 13 | @@ -139,7 +139,7 @@ C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` com 14 |+s = f"{ set([x for x in 'ab']) | {x for x in 'ab'} }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:15:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" @@ -154,7 +154,7 @@ C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comp 15 |-s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" 15 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab'])}" -C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:15:33: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap index d5bfe8a3a9ab58..88626167096680 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:1:1: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 1 | dict([(i, i) for i in range(3)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 @@ -16,7 +16,7 @@ C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp 3 3 | 4 4 | def f(x): -C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:7:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 5 | return x 6 | @@ -37,7 +37,7 @@ C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:8:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 7 | f'{dict([(s,s) for s in "ab"])}' 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -57,7 +57,7 @@ C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | -C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:9:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 7 | f'{dict([(s,s) for s in "ab"])}' 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -77,7 +77,7 @@ C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comp 11 11 | 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' -C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:10:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 8 | f"{dict([(s,s) for s in 'ab'])}" 9 | f"{dict([(s, s) for s in 'ab'])}" @@ -98,7 +98,7 @@ C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' -C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:12:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 | @@ -118,7 +118,7 @@ C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:12:34: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 | @@ -138,7 +138,7 @@ C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:13:5: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' @@ -158,7 +158,7 @@ C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` com 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) -C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:13:35: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' @@ -178,7 +178,7 @@ C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` co 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) -C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:16:14: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap index 1ae0f55d0d505c..2ed3481b2f58a4 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:1:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 1 | set([1, 2]) | ^^^^^^^^^^^ C405 @@ -17,7 +17,7 @@ C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 3 3 | set([]) 4 4 | set(()) -C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:2:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) | 1 | set([1, 2]) 2 | set((1, 2)) @@ -35,7 +35,7 @@ C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 4 4 | set(()) 5 5 | set() -C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:3:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 1 | set([1, 2]) 2 | set((1, 2)) @@ -55,7 +55,7 @@ C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 5 5 | set() 6 6 | set((1,)) -C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:4:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) | 2 | set((1, 2)) 3 | set([]) @@ -77,7 +77,7 @@ C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 7 7 | set(( 8 8 | 1, -C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:6:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) | 4 | set(()) 5 | set() @@ -98,7 +98,7 @@ C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 8 8 | 1, 9 9 | )) -C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:7:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) | 5 | set() 6 | set((1,)) @@ -124,7 +124,7 @@ C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 11 11 | 1, 12 12 | ]) -C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:10:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 8 | 1, 9 | )) @@ -150,7 +150,7 @@ C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 14 14 | (1,) 15 15 | ) -C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:13:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) | 11 | 1, 12 | ]) @@ -175,7 +175,7 @@ C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) 17 15 | [1,] 18 16 | ) -C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:16:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 14 | (1,) 15 | ) @@ -200,7 +200,7 @@ C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 20 18 | f"{set(['a', 'b'])}" 21 19 | f'{set(["a", "b"])}' -C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:19:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 17 | [1,] 18 | ) @@ -221,7 +221,7 @@ C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 21 21 | f'{set(["a", "b"])}' 22 22 | -C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:20:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 18 | ) 19 | f"{set([1,2,3])}" @@ -241,7 +241,7 @@ C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" -C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:21:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 19 | f"{set([1,2,3])}" 20 | f"{set(['a', 'b'])}" @@ -262,7 +262,7 @@ C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" -C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:23:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 21 | f'{set(["a", "b"])}' 22 | @@ -283,7 +283,7 @@ C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:23:22: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 21 | f'{set(["a", "b"])}' 22 | @@ -304,7 +304,7 @@ C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:24:5: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -323,7 +323,7 @@ C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:24:23: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -342,7 +342,7 @@ C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:25:6: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -360,7 +360,7 @@ C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 |+f"a { {'a', 'b'} - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:25:24: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -378,7 +378,7 @@ C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 25 |+f"a {set(['a', 'b']) - {'a'} } b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:26:7: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 | f"a {set(['a', 'b']) - set(['a'])} b" @@ -394,7 +394,7 @@ C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) 26 |-f"a { set(['a', 'b']) - set(['a']) } b" 26 |+f"a { {'a', 'b'} - set(['a']) } b" -C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:26:25: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) | 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 | f"a {set(['a', 'b']) - set(['a'])} b" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap index f8983c16830b55..3fc6d154f78299 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) +C406.py:1:6: C406 [**] Unnecessary `list` literal (rewrite as a `dict` literal) | 1 | d1 = dict([(1, 2)]) | ^^^^^^^^^^^^^^ C406 @@ -17,7 +17,7 @@ C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) 3 3 | d3 = dict([]) 4 4 | d4 = dict(()) -C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) +C406.py:2:6: C406 [**] Unnecessary `tuple` literal (rewrite as a `dict` literal) | 1 | d1 = dict([(1, 2)]) 2 | d2 = dict(((1, 2),)) @@ -35,7 +35,7 @@ C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) 4 4 | d4 = dict(()) 5 5 | d5 = dict() -C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) +C406.py:3:6: C406 [**] Unnecessary `list` literal (rewrite as a `dict` literal) | 1 | d1 = dict([(1, 2)]) 2 | d2 = dict(((1, 2),)) @@ -54,7 +54,7 @@ C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) 4 4 | d4 = dict(()) 5 5 | d5 = dict() -C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) +C406.py:4:6: C406 [**] Unnecessary `tuple` literal (rewrite as a `dict` literal) | 2 | d2 = dict(((1, 2),)) 3 | d3 = dict([]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap index 09904c22e26504..1a1897481a4bb1 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) +C408.py:1:5: C408 [**] Unnecessary `tuple` call (rewrite as a literal) | 1 | t = tuple() | ^^^^^^^ C408 @@ -17,7 +17,7 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) 3 3 | d1 = dict() 4 4 | d2 = dict(a=1) -C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) +C408.py:2:5: C408 [**] Unnecessary `list` call (rewrite as a literal) | 1 | t = tuple() 2 | l = list() @@ -35,7 +35,7 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) 4 4 | d2 = dict(a=1) 5 5 | d3 = dict(**d2) -C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:3:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 1 | t = tuple() 2 | l = list() @@ -55,7 +55,7 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 5 5 | d3 = dict(**d2) 6 6 | -C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:4:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 2 | l = list() 3 | d1 = dict() @@ -75,7 +75,7 @@ C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 6 6 | 7 7 | -C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:14:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 12 | a = list() 13 | @@ -96,7 +96,7 @@ C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" -C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:15:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -116,7 +116,7 @@ C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 17 17 | f"a {dict()} b" 18 18 | -C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:16:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -136,7 +136,7 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" -C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:17:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 15 | f'{dict(x="y")}' 16 | f"{dict()}" @@ -157,7 +157,7 @@ C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" -C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:19:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 17 | f"a {dict()} b" 18 | @@ -178,7 +178,7 @@ C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:19:18: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 17 | f"a {dict()} b" 18 | @@ -199,7 +199,7 @@ C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:20:5: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -218,7 +218,7 @@ C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:20:19: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -237,7 +237,7 @@ C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:21:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -255,7 +255,7 @@ C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 21 |+f"a { {'x': 'y'} | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:21:20: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -273,7 +273,7 @@ C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) 21 |+f"a {dict(x='y') | {'y': 'z'} } b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:22:7: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 20 | f"{ dict(x='y') | dict(y='z') }" 21 | f"a {dict(x='y') | dict(y='z')} b" @@ -289,7 +289,7 @@ C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) 22 |-f"a { dict(x='y') | dict(y='z') } b" 22 |+f"a { {'x': 'y'} | dict(y='z') } b" -C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:22:21: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 20 | f"{ dict(x='y') | dict(y='z') }" 21 | f"a {dict(x='y') | dict(y='z')} b" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap index 7032a8c4511f4f..5f4c704cd4d3e3 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) +C408.py:1:5: C408 [**] Unnecessary `tuple` call (rewrite as a literal) | 1 | t = tuple() | ^^^^^^^ C408 @@ -17,7 +17,7 @@ C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) 3 3 | d1 = dict() 4 4 | d2 = dict(a=1) -C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) +C408.py:2:5: C408 [**] Unnecessary `list` call (rewrite as a literal) | 1 | t = tuple() 2 | l = list() @@ -35,7 +35,7 @@ C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) 4 4 | d2 = dict(a=1) 5 5 | d3 = dict(**d2) -C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:3:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 1 | t = tuple() 2 | l = list() @@ -55,7 +55,7 @@ C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) 5 5 | d3 = dict(**d2) 6 6 | -C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:16:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -75,7 +75,7 @@ C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" -C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) +C408.py:17:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) | 15 | f'{dict(x="y")}' 16 | f"{dict()}" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap index 962bd5c19a88c9..455b0d3ccff73f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +C409.py:1:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 1 | t1 = tuple([]) | ^^^^^^^^^ C409 @@ -17,7 +17,7 @@ C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 3 3 | t3 = tuple((1, 2)) 4 4 | t4 = tuple([ -C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +C409.py:2:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 1 | t1 = tuple([]) 2 | t2 = tuple([1, 2]) @@ -35,7 +35,7 @@ C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 4 4 | t4 = tuple([ 5 5 | 1, -C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +C409.py:3:6: C409 [**] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | 1 | t1 = tuple([]) 2 | t2 = tuple([1, 2]) @@ -55,7 +55,7 @@ C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove th 5 5 | 1, 6 6 | 2 -C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +C409.py:4:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 2 | t2 = tuple([1, 2]) 3 | t3 = tuple((1, 2)) @@ -84,7 +84,7 @@ C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as 9 9 | (1, 2) 10 10 | ) -C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +C409.py:8:6: C409 [**] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | 6 | 2 7 | ]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap index 997e8547578aa4..a448f1e5f312c3 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) +C410.py:1:6: C410 [**] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | 1 | l1 = list([1, 2]) | ^^^^^^^^^^^^ C410 @@ -17,7 +17,7 @@ C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the 3 3 | l3 = list([]) 4 4 | l4 = list(()) -C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) +C410.py:2:6: C410 [**] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) | 1 | l1 = list([1, 2]) 2 | l2 = list((1, 2)) @@ -34,7 +34,7 @@ C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as 3 3 | l3 = list([]) 4 4 | l4 = list(()) -C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) +C410.py:3:6: C410 [**] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | 1 | l1 = list([1, 2]) 2 | l2 = list((1, 2)) @@ -51,7 +51,7 @@ C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the 3 |+l3 = [] 4 4 | l4 = list(()) -C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) +C410.py:4:6: C410 [**] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) | 2 | l2 = list((1, 2)) 3 | l3 = list([]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap index 1878f091a7ced0..15fff6b2d3b01c 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C411.py:2:1: C411 [*] Unnecessary `list` call (remove the outer call to `list()`) +C411.py:2:1: C411 [**] Unnecessary `list` call (remove the outer call to `list()`) | 1 | x = [1, 2, 3] 2 | list([i for i in x]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap index ae89b1802aa2ec..0c5bdbf331c586 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap @@ -21,7 +21,7 @@ C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()` 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) -C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:4:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 2 | list(x) 3 | list(sorted(x)) @@ -42,7 +42,7 @@ C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` 6 6 | reversed(sorted(x, reverse=True)) 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) -C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:5:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 3 | list(sorted(x)) 4 | reversed(sorted(x)) @@ -63,7 +63,7 @@ C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) -C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:6:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 4 | reversed(sorted(x)) 5 | reversed(sorted(x, key=lambda e: e)) @@ -84,7 +84,7 @@ C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 9 | reversed(sorted(x, reverse=False)) -C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:7:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 5 | reversed(sorted(x, key=lambda e: e)) 6 | reversed(sorted(x, reverse=True)) @@ -105,7 +105,7 @@ C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` 9 9 | reversed(sorted(x, reverse=False)) 10 10 | reversed(sorted(x, reverse=x)) -C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:8:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 6 | reversed(sorted(x, reverse=True)) 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) @@ -126,7 +126,7 @@ C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` 10 10 | reversed(sorted(x, reverse=x)) 11 11 | reversed(sorted(x, reverse=not x)) -C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:9:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) @@ -147,7 +147,7 @@ C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` 11 11 | reversed(sorted(x, reverse=not x)) 12 12 | -C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:10:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 | reversed(sorted(x, reverse=False)) @@ -167,7 +167,7 @@ C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 -C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:11:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 9 | reversed(sorted(x, reverse=False)) 10 | reversed(sorted(x, reverse=x)) @@ -188,7 +188,7 @@ C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 14 | reversed(sorted(i for i in range(42))) -C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:14:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 | reversed(sorted(i for i in range(42))) @@ -207,7 +207,7 @@ C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` 16 16 | 17 17 | -C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` +C413.py:15:1: C413 [**] Unnecessary `reversed` call around `sorted()` | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 | reversed(sorted(i for i in range(42))) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap index 396a8d26ab0eb5..a13cdbe849508f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C414.py:2:1: C414 [*] Unnecessary `list` call within `list()` +C414.py:2:1: C414 [**] Unnecessary `list` call within `list()` | 1 | x = [1, 2, 3] 2 | list(list(x)) @@ -19,7 +19,7 @@ C414.py:2:1: C414 [*] Unnecessary `list` call within `list()` 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) -C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` +C414.py:3:1: C414 [**] Unnecessary `tuple` call within `list()` | 1 | x = [1, 2, 3] 2 | list(list(x)) @@ -39,7 +39,7 @@ C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) -C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` +C414.py:4:1: C414 [**] Unnecessary `list` call within `tuple()` | 2 | list(list(x)) 3 | list(tuple(x)) @@ -60,7 +60,7 @@ C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` 6 6 | set(set(x)) 7 7 | set(list(x)) -C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` +C414.py:5:1: C414 [**] Unnecessary `tuple` call within `tuple()` | 3 | list(tuple(x)) 4 | tuple(list(x)) @@ -81,7 +81,7 @@ C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` 7 7 | set(list(x)) 8 8 | set(tuple(x)) -C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` +C414.py:6:1: C414 [**] Unnecessary `set` call within `set()` | 4 | tuple(list(x)) 5 | tuple(tuple(x)) @@ -102,7 +102,7 @@ C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) -C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` +C414.py:7:1: C414 [**] Unnecessary `list` call within `set()` | 5 | tuple(tuple(x)) 6 | set(set(x)) @@ -123,7 +123,7 @@ C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) -C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` +C414.py:8:1: C414 [**] Unnecessary `tuple` call within `set()` | 6 | set(set(x)) 7 | set(list(x)) @@ -144,7 +144,7 @@ C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) -C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` +C414.py:9:1: C414 [**] Unnecessary `sorted` call within `set()` | 7 | set(list(x)) 8 | set(tuple(x)) @@ -165,7 +165,7 @@ C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) -C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` +C414.py:10:1: C414 [**] Unnecessary `sorted` call within `set()` | 8 | set(tuple(x)) 9 | set(sorted(x)) @@ -186,7 +186,7 @@ C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) -C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` +C414.py:11:1: C414 [**] Unnecessary `reversed` call within `set()` | 9 | set(sorted(x)) 10 | set(sorted(x, key=lambda y: y)) @@ -207,7 +207,7 @@ C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) -C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` +C414.py:12:1: C414 [**] Unnecessary `list` call within `sorted()` | 10 | set(sorted(x, key=lambda y: y)) 11 | set(reversed(x)) @@ -228,7 +228,7 @@ C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) -C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` +C414.py:13:1: C414 [**] Unnecessary `tuple` call within `sorted()` | 11 | set(reversed(x)) 12 | sorted(list(x)) @@ -249,7 +249,7 @@ C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 16 | sorted(sorted(x, reverse=True), reverse=True) -C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` +C414.py:14:1: C414 [**] Unnecessary `sorted` call within `sorted()` | 12 | sorted(list(x)) 13 | sorted(tuple(x)) @@ -270,7 +270,7 @@ C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` 16 16 | sorted(sorted(x, reverse=True), reverse=True) 17 17 | sorted(reversed(x)) -C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` +C414.py:15:1: C414 [**] Unnecessary `sorted` call within `sorted()` | 13 | sorted(tuple(x)) 14 | sorted(sorted(x)) @@ -291,7 +291,7 @@ C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` 17 17 | sorted(reversed(x)) 18 18 | sorted(list(x), key=lambda y: y) -C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` +C414.py:16:1: C414 [**] Unnecessary `sorted` call within `sorted()` | 14 | sorted(sorted(x)) 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) @@ -312,7 +312,7 @@ C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` 18 18 | sorted(list(x), key=lambda y: y) 19 19 | tuple( -C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` +C414.py:17:1: C414 [**] Unnecessary `reversed` call within `sorted()` | 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 | sorted(sorted(x, reverse=True), reverse=True) @@ -333,7 +333,7 @@ C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` 19 19 | tuple( 20 20 | list( -C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` +C414.py:18:1: C414 [**] Unnecessary `list` call within `sorted()` | 16 | sorted(sorted(x, reverse=True), reverse=True) 17 | sorted(reversed(x)) @@ -354,7 +354,7 @@ C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` 20 20 | list( 21 21 | [x, 3, "hell"\ -C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` +C414.py:19:1: C414 [**] Unnecessary `list` call within `tuple()` | 17 | sorted(reversed(x)) 18 | sorted(list(x), key=lambda y: y) @@ -383,7 +383,7 @@ C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` 25 23 | set(set()) 26 24 | set(list()) -C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` +C414.py:25:1: C414 [**] Unnecessary `set` call within `set()` | 23 | ) 24 | ) @@ -404,7 +404,7 @@ C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` 27 27 | set(tuple()) 28 28 | sorted(reversed()) -C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` +C414.py:26:1: C414 [**] Unnecessary `list` call within `set()` | 24 | ) 25 | set(set()) @@ -425,7 +425,7 @@ C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` 28 28 | sorted(reversed()) 29 29 | -C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` +C414.py:27:1: C414 [**] Unnecessary `tuple` call within `set()` | 25 | set(set()) 26 | set(list()) @@ -445,7 +445,7 @@ C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` 29 29 | 30 30 | # Nested sorts with differing keyword arguments. Not flagged. -C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` +C414.py:28:1: C414 [**] Unnecessary `reversed` call within `sorted()` | 26 | set(list()) 27 | set(tuple()) @@ -466,7 +466,7 @@ C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` 30 30 | # Nested sorts with differing keyword arguments. Not flagged. 31 31 | sorted(sorted(x, key=lambda y: y)) -C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` +C414.py:37:27: C414 [**] Unnecessary `list` call within `sorted()` | 36 | # Preserve trailing comments. 37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( @@ -492,7 +492,7 @@ C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` 40 40 | # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx 41 41 | key=lambda xxxxx: xxxxx or "", -C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` +C414.py:44:27: C414 [**] Unnecessary `list` call within `sorted()` | 42 | ) 43 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap index f7ea1bfbbc3dcb..d95dd77ae3e6c8 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) +C416.py:6:1: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`) | 4 | d = {"a": 1, "b": 2, "c": 3} 5 | @@ -22,7 +22,7 @@ C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) 8 8 | {k: v for k, v in y} 9 9 | {k: v for k, v in d.items()} -C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) +C416.py:7:1: C416 [**] Unnecessary `set` comprehension (rewrite using `set()`) | 6 | [i for i in x] 7 | {i for i in x} @@ -42,7 +42,7 @@ C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) 9 9 | {k: v for k, v in d.items()} 10 10 | [(k, v) for k, v in d.items()] -C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) +C416.py:8:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`) | 6 | [i for i in x] 7 | {i for i in x} @@ -63,7 +63,7 @@ C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) 10 10 | [(k, v) for k, v in d.items()] 11 11 | {k: (a, b) for k, (a, b) in d.items()} -C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) +C416.py:9:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`) | 7 | {i for i in x} 8 | {k: v for k, v in y} @@ -84,7 +84,7 @@ C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) 11 11 | {k: (a, b) for k, (a, b) in d.items()} 12 12 | -C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) +C416.py:10:1: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`) | 8 | {k: v for k, v in y} 9 | {k: v for k, v in d.items()} @@ -104,7 +104,7 @@ C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) 12 12 | 13 13 | [i for i, in z] -C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) +C416.py:11:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`) | 9 | {k: v for k, v in d.items()} 10 | [(k, v) for k, v in d.items()] @@ -125,7 +125,7 @@ C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) 13 13 | [i for i, in z] 14 14 | [i for i, j in y] -C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) +C416.py:24:70: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`) | 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196 24 | any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap index 1418d486ed6185..f17e79e70c8819 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:3:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 1 | # Errors. 2 | nums = [1, 2, 3] @@ -21,7 +21,7 @@ C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express 5 5 | list(map(lambda x: x * 2, nums)) 6 6 | set(map(lambda x: x % 2 == 0, nums)) -C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:4:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 2 | nums = [1, 2, 3] 3 | map(lambda x: x + 1, nums) @@ -42,7 +42,7 @@ C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express 6 6 | set(map(lambda x: x % 2 == 0, nums)) 7 7 | dict(map(lambda v: (v, v**2), nums)) -C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension) +C417.py:5:1: C417 [**] Unnecessary `map` usage (rewrite using a `list` comprehension) | 3 | map(lambda x: x + 1, nums) 4 | map(lambda x: str(x), nums) @@ -63,7 +63,7 @@ C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehens 7 7 | dict(map(lambda v: (v, v**2), nums)) 8 8 | dict(map(lambda v: [v, v**2], nums)) -C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension) +C417.py:6:1: C417 [**] Unnecessary `map` usage (rewrite using a `set` comprehension) | 4 | map(lambda x: str(x), nums) 5 | list(map(lambda x: x * 2, nums)) @@ -84,7 +84,7 @@ C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehensi 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) -C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) +C417.py:7:1: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 5 | list(map(lambda x: x * 2, nums)) 6 | set(map(lambda x: x % 2 == 0, nums)) @@ -105,7 +105,7 @@ C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) -C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) +C417.py:8:1: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 6 | set(map(lambda x: x % 2 == 0, nums)) 7 | dict(map(lambda v: (v, v**2), nums)) @@ -126,7 +126,7 @@ C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehens 10 10 | map(lambda _: 3.0, nums) 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) -C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:9:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 7 | dict(map(lambda v: (v, v**2), nums)) 8 | dict(map(lambda v: [v, v**2], nums)) @@ -147,7 +147,7 @@ C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator express 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 12 | all(map(lambda v: isinstance(v, dict), nums)) -C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:10:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 8 | dict(map(lambda v: [v, v**2], nums)) 9 | map(lambda: "const", nums) @@ -168,7 +168,7 @@ C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 12 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 13 | filter(func, map(lambda v: v, nums)) -C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:11:13: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 9 | map(lambda: "const", nums) 10 | map(lambda _: 3.0, nums) @@ -189,7 +189,7 @@ C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expre 13 13 | filter(func, map(lambda v: v, nums)) 14 14 | list(map(lambda x, y: x * y, nums)) -C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:12:5: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 10 | map(lambda _: 3.0, nums) 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) @@ -210,7 +210,7 @@ C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 14 14 | list(map(lambda x, y: x * y, nums)) 15 15 | -C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:13:14: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 | all(map(lambda v: isinstance(v, dict), nums)) @@ -230,7 +230,7 @@ C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expre 15 15 | 16 16 | # When inside f-string, then the fix should be surrounded by whitespace -C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension) +C417.py:14:1: C417 [**] Unnecessary `map` usage (rewrite using a `list` comprehension) | 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 | filter(func, map(lambda v: v, nums)) @@ -251,7 +251,7 @@ C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehen 16 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" -C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension) +C417.py:17:8: C417 [**] Unnecessary `map` usage (rewrite using a `set` comprehension) | 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" @@ -270,7 +270,7 @@ C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehens 19 19 | 20 20 | # False negatives. -C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) +C417.py:18:8: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" @@ -291,7 +291,7 @@ C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehen 20 20 | # False negatives. 21 21 | map(lambda x=2, y=1: x + y, nums, nums) -C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:36:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 35 | # Error: the `x` is overridden by the inner lambda. 36 | map(lambda x: lambda x: x, range(4)) @@ -311,7 +311,7 @@ C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 38 38 | # Ok because of the default parameters, and variadic arguments. 39 39 | map(lambda x=1: x, nums) -C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:47:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 | map(lambda x: x, y if y else z) @@ -330,7 +330,7 @@ C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 48 48 | map(lambda x: x, (y if y else z)) 49 49 | map(lambda x: x, (x, y, z)) -C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:48:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 | map(lambda x: x, y if y else z) @@ -348,7 +348,7 @@ C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expres 48 |+(x for x in (y if y else z)) 49 49 | map(lambda x: x, (x, y, z)) -C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:49:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) | 47 | map(lambda x: x, y if y else z) 48 | map(lambda x: x, (y if y else z)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap index 301da13fcdfd54..905cc34bbfdf1a 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) +C418.py:1:1: C418 [**] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) | 1 | dict({}) | ^^^^^^^^ C418 @@ -17,7 +17,7 @@ C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the 3 3 | dict({'x': 1 for x in range(10)}) 4 4 | dict( -C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) +C418.py:2:1: C418 [**] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) | 1 | dict({}) 2 | dict({'a': 1}) @@ -35,7 +35,7 @@ C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the 4 4 | dict( 5 5 | {'x': 1 for x in range(10)} -C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) +C418.py:3:1: C418 [**] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) | 1 | dict({}) 2 | dict({'a': 1}) @@ -55,7 +55,7 @@ C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remov 5 5 | {'x': 1 for x in range(10)} 6 6 | ) -C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) +C418.py:4:1: C418 [**] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) | 2 | dict({'a': 1}) 3 | dict({'x': 1 for x in range(10)}) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap index 611f4aac47e8f0..391c4c17b5546b 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C419.py:1:5: C419 [*] Unnecessary list comprehension. +C419.py:1:5: C419 [**] Unnecessary list comprehension. | 1 | any([x.id for x in bar]) | ^^^^^^^^^^^^^^^^^^^ C419 @@ -17,7 +17,7 @@ C419.py:1:5: C419 [*] Unnecessary list comprehension. 3 3 | any( # first comment 4 4 | [x.id for x in bar], # second comment -C419.py:2:5: C419 [*] Unnecessary list comprehension. +C419.py:2:5: C419 [**] Unnecessary list comprehension. | 1 | any([x.id for x in bar]) 2 | all([x.id for x in bar]) @@ -35,7 +35,7 @@ C419.py:2:5: C419 [*] Unnecessary list comprehension. 4 4 | [x.id for x in bar], # second comment 5 5 | ) # third comment -C419.py:4:5: C419 [*] Unnecessary list comprehension. +C419.py:4:5: C419 [**] Unnecessary list comprehension. | 2 | all([x.id for x in bar]) 3 | any( # first comment @@ -56,7 +56,7 @@ C419.py:4:5: C419 [*] Unnecessary list comprehension. 6 6 | all( # first comment 7 7 | [x.id for x in bar], # second comment -C419.py:7:5: C419 [*] Unnecessary list comprehension. +C419.py:7:5: C419 [**] Unnecessary list comprehension. | 5 | ) # third comment 6 | all( # first comment @@ -77,7 +77,7 @@ C419.py:7:5: C419 [*] Unnecessary list comprehension. 9 9 | any({x.id for x in bar}) 10 10 | -C419.py:9:5: C419 [*] Unnecessary list comprehension. +C419.py:9:5: C419 [**] Unnecessary list comprehension. | 7 | [x.id for x in bar], # second comment 8 | ) # third comment @@ -98,7 +98,7 @@ C419.py:9:5: C419 [*] Unnecessary list comprehension. 11 11 | # OK 12 12 | all(x.id for x in bar) -C419.py:24:5: C419 [*] Unnecessary list comprehension. +C419.py:24:5: C419 [**] Unnecessary list comprehension. | 22 | # Special comment handling 23 | any( @@ -133,7 +133,7 @@ C419.py:24:5: C419 [*] Unnecessary list comprehension. 31 30 | ) 32 31 | -C419.py:35:5: C419 [*] Unnecessary list comprehension. +C419.py:35:5: C419 [**] Unnecessary list comprehension. | 33 | # Weird case where the function call, opening bracket, and comment are all 34 | # on the same line. diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap index d9722404823c55..ce7eedda001d3b 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs --- -EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variable first +EM.py:5:24: EM101 [**] Exception must not use a string literal, assign to variable first | 4 | def f_a(): 5 | raise RuntimeError("This is an example exception") @@ -20,7 +20,7 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl 7 8 | 8 9 | def f_a_short(): -EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first +EM.py:18:24: EM102 [**] Exception must not use an f-string literal, assign to variable first | 16 | def f_b(): 17 | example = "example" @@ -40,7 +40,7 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var 20 21 | 21 22 | def f_c(): -EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first +EM.py:22:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first | 21 | def f_c(): 22 | raise RuntimeError("This is an {example} exception".format(example="example")) @@ -68,7 +68,7 @@ EM.py:32:24: EM101 Exception must not use a string literal, assign to variable f | = help: Assign to variable; remove string literal -EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first +EM.py:39:24: EM101 [**] Exception must not use a string literal, assign to variable first | 37 | msg = "hello" 38 | @@ -96,7 +96,7 @@ EM.py:46:28: EM101 Exception must not use a string literal, assign to variable f | = help: Assign to variable; remove string literal -EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first +EM.py:51:28: EM101 [**] Exception must not use a string literal, assign to variable first | 49 | def f_fix_indentation_check(foo): 50 | if foo: @@ -118,7 +118,7 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab 53 54 | if foo == "foo": 54 55 | raise RuntimeError(f"This is an exception: {foo}") -EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first +EM.py:54:32: EM102 [**] Exception must not use an f-string literal, assign to variable first | 52 | else: 53 | if foo == "foo": @@ -139,7 +139,7 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var 56 57 | 57 58 | -EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first +EM.py:55:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first | 53 | if foo == "foo": 54 | raise RuntimeError(f"This is an exception: {foo}") diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap index 03784c23fcc1ff..a76e5193b7408d 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs --- -EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variable first +EM.py:5:24: EM101 [**] Exception must not use a string literal, assign to variable first | 4 | def f_a(): 5 | raise RuntimeError("This is an example exception") @@ -20,7 +20,7 @@ EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variabl 7 8 | 8 9 | def f_a_short(): -EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variable first +EM.py:9:24: EM101 [**] Exception must not use a string literal, assign to variable first | 8 | def f_a_short(): 9 | raise RuntimeError("Error") @@ -39,7 +39,7 @@ EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variabl 11 12 | 12 13 | def f_a_empty(): -EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variable first +EM.py:13:24: EM101 [**] Exception must not use a string literal, assign to variable first | 12 | def f_a_empty(): 13 | raise RuntimeError("") @@ -58,7 +58,7 @@ EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variab 15 16 | 16 17 | def f_b(): -EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first +EM.py:18:24: EM102 [**] Exception must not use an f-string literal, assign to variable first | 16 | def f_b(): 17 | example = "example" @@ -78,7 +78,7 @@ EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to var 20 21 | 21 22 | def f_c(): -EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first +EM.py:22:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first | 21 | def f_c(): 22 | raise RuntimeError("This is an {example} exception".format(example="example")) @@ -106,7 +106,7 @@ EM.py:32:24: EM101 Exception must not use a string literal, assign to variable f | = help: Assign to variable; remove string literal -EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first +EM.py:39:24: EM101 [**] Exception must not use a string literal, assign to variable first | 37 | msg = "hello" 38 | @@ -134,7 +134,7 @@ EM.py:46:28: EM101 Exception must not use a string literal, assign to variable f | = help: Assign to variable; remove string literal -EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first +EM.py:51:28: EM101 [**] Exception must not use a string literal, assign to variable first | 49 | def f_fix_indentation_check(foo): 50 | if foo: @@ -156,7 +156,7 @@ EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variab 53 54 | if foo == "foo": 54 55 | raise RuntimeError(f"This is an exception: {foo}") -EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first +EM.py:54:32: EM102 [**] Exception must not use an f-string literal, assign to variable first | 52 | else: 53 | if foo == "foo": @@ -177,7 +177,7 @@ EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to var 56 57 | 57 58 | -EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first +EM.py:55:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first | 53 | if foo == "foo": 54 | raise RuntimeError(f"This is an exception: {foo}") diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap index 848b339416991e..08e073cad421aa 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -defaults.py:6:12: ICN001 [*] `altair` should be imported as `alt` +defaults.py:6:12: ICN001 [**] `altair` should be imported as `alt` | 5 | def unconventional(): 6 | import altair @@ -32,7 +32,7 @@ defaults.py:7:12: ICN001 `matplotlib.pyplot` should be imported as `plt` | = help: Alias `matplotlib.pyplot` to `plt` -defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np` +defaults.py:8:12: ICN001 [**] `numpy` should be imported as `np` | 6 | import altair 7 | import matplotlib.pyplot @@ -53,7 +53,7 @@ defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np` 10 10 | import seaborn 11 11 | import tkinter -defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` +defaults.py:9:12: ICN001 [**] `pandas` should be imported as `pd` | 7 | import matplotlib.pyplot 8 | import numpy @@ -74,7 +74,7 @@ defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` 11 11 | import tkinter 12 12 | import networkx -defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` +defaults.py:10:12: ICN001 [**] `seaborn` should be imported as `sns` | 8 | import numpy 9 | import pandas @@ -95,7 +95,7 @@ defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` 12 12 | import networkx 13 13 | -defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` +defaults.py:11:12: ICN001 [**] `tkinter` should be imported as `tk` | 9 | import pandas 10 | import seaborn @@ -115,7 +115,7 @@ defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` 13 13 | 14 14 | -defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` +defaults.py:12:12: ICN001 [**] `networkx` should be imported as `nx` | 10 | import seaborn 11 | import tkinter @@ -134,7 +134,7 @@ defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` 14 14 | 15 15 | def unconventional_aliases(): -defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` +defaults.py:16:22: ICN001 [**] `altair` should be imported as `alt` | 15 | def unconventional_aliases(): 16 | import altair as altr @@ -154,7 +154,7 @@ defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` 18 18 | import numpy as nmp 19 19 | import pandas as pdas -defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` +defaults.py:17:33: ICN001 [**] `matplotlib.pyplot` should be imported as `plt` | 15 | def unconventional_aliases(): 16 | import altair as altr @@ -175,7 +175,7 @@ defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn -defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` +defaults.py:18:21: ICN001 [**] `numpy` should be imported as `np` | 16 | import altair as altr 17 | import matplotlib.pyplot as plot @@ -196,7 +196,7 @@ defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` 20 20 | import seaborn as sbrn 21 21 | import tkinter as tkr -defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` +defaults.py:19:22: ICN001 [**] `pandas` should be imported as `pd` | 17 | import matplotlib.pyplot as plot 18 | import numpy as nmp @@ -217,7 +217,7 @@ defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` 21 21 | import tkinter as tkr 22 22 | import networkx as nxy -defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` +defaults.py:20:23: ICN001 [**] `seaborn` should be imported as `sns` | 18 | import numpy as nmp 19 | import pandas as pdas @@ -238,7 +238,7 @@ defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` 22 22 | import networkx as nxy 23 23 | -defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` +defaults.py:21:23: ICN001 [**] `tkinter` should be imported as `tk` | 19 | import pandas as pdas 20 | import seaborn as sbrn @@ -258,7 +258,7 @@ defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` 23 23 | 24 24 | def conventional_aliases(): -defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` +defaults.py:22:24: ICN001 [**] `networkx` should be imported as `nx` | 20 | import seaborn as sbrn 21 | import tkinter as tkr diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap index 2078183e505c37..252120ec89f60f 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -tricky.py:7:16: ICN001 [*] `pandas` should be imported as `pd` +tricky.py:7:16: ICN001 [**] `pandas` should be imported as `pd` | 5 | try: 6 | global pandas diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap index c7ee37c94cd0d0..89848002abf6e8 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers +LOG001.py:3:1: LOG001 [**] Use `logging.getLogger()` to instantiate loggers | 1 | import logging 2 | @@ -20,7 +20,7 @@ LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers 4 4 | logging.Logger() 5 5 | logging.getLogger(__name__) -LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers +LOG001.py:4:1: LOG001 [**] Use `logging.getLogger()` to instantiate loggers | 3 | logging.Logger(__name__) 4 | logging.Logger() diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap index e208e94121730c..97d557a0e4ede4 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()` +LOG002.py:11:11: LOG002 [**] Use `__name__` with `logging.getLogger()` | 10 | # LOG002 11 | getLogger(__file__) @@ -20,7 +20,7 @@ LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()` 13 13 | 14 14 | logging.getLogger(__cached__) -LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` +LOG002.py:12:24: LOG002 [**] Use `__name__` with `logging.getLogger()` | 10 | # LOG002 11 | getLogger(__file__) @@ -41,7 +41,7 @@ LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` 14 14 | logging.getLogger(__cached__) 15 15 | getLogger(name=__cached__) -LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` +LOG002.py:14:19: LOG002 [**] Use `__name__` with `logging.getLogger()` | 12 | logging.getLogger(name=__file__) 13 | @@ -61,7 +61,7 @@ LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` 16 16 | 17 17 | -LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` +LOG002.py:15:16: LOG002 [**] Use `__name__` with `logging.getLogger()` | 14 | logging.getLogger(__cached__) 15 | getLogger(name=__cached__) diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap index a31c6a2b1c3026..cdb3eea8da60b0 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -LOG009.py:3:1: LOG009 [*] Use of undocumented `logging.WARN` constant +LOG009.py:3:1: LOG009 [**] Use of undocumented `logging.WARN` constant | 1 | import logging 2 | @@ -20,7 +20,7 @@ LOG009.py:3:1: LOG009 [*] Use of undocumented `logging.WARN` constant 5 5 | 6 6 | from logging import WARN, WARNING -LOG009.py:8:1: LOG009 [*] Use of undocumented `logging.WARN` constant +LOG009.py:8:1: LOG009 [**] Use of undocumented `logging.WARN` constant | 6 | from logging import WARN, WARNING 7 | diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap index d67d3cfe87648a..f4d83912bcb455 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times +PIE794.py:4:5: PIE794 [**] Class field `name` is defined multiple times | 2 | name = StringField() 3 | # .... @@ -21,7 +21,7 @@ PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times 6 5 | def remove(self) -> None: 7 6 | ... -PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times +PIE794.py:13:5: PIE794 [**] Class field `name` is defined multiple times | 11 | name: str = StringField() 12 | # .... @@ -41,7 +41,7 @@ PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times 15 14 | def foo(self) -> None: 16 15 | ... -PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times +PIE794.py:23:5: PIE794 [**] Class field `bar` is defined multiple times | 21 | foo: bool = BooleanField() 22 | # ... @@ -59,7 +59,7 @@ PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times 25 24 | 26 25 | class User(BaseModel): -PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times +PIE794.py:40:5: PIE794 [**] Class field `bar` is defined multiple times | 38 | foo: bool = BooleanField() 39 | # ... diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap index a889297249da7f..7c92f7fc64a966 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple` +PIE810.py:2:1: PIE810 [**] Call `startswith` once with a `tuple` | 1 | # error 2 | obj.startswith("foo") or obj.startswith("bar") @@ -19,7 +19,7 @@ PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple` 4 4 | obj.endswith("foo") or obj.endswith("bar") 5 5 | # error -PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` +PIE810.py:4:1: PIE810 [**] Call `endswith` once with a `tuple` | 2 | obj.startswith("foo") or obj.startswith("bar") 3 | # error @@ -40,7 +40,7 @@ PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` 6 6 | obj.startswith(foo) or obj.startswith(bar) 7 7 | # error -PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` +PIE810.py:6:1: PIE810 [**] Call `startswith` once with a `tuple` | 4 | obj.endswith("foo") or obj.endswith("bar") 5 | # error @@ -61,7 +61,7 @@ PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` 8 8 | obj.startswith(foo) or obj.startswith("foo") 9 9 | # error -PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` +PIE810.py:8:1: PIE810 [**] Call `startswith` once with a `tuple` | 6 | obj.startswith(foo) or obj.startswith(bar) 7 | # error @@ -82,7 +82,7 @@ PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` 10 10 | obj.endswith(foo) or obj.startswith(foo) or obj.startswith("foo") 11 11 | -PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` +PIE810.py:10:1: PIE810 [**] Call `startswith` once with a `tuple` | 8 | obj.startswith(foo) or obj.startswith("foo") 9 | # error diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap index b68bdf828cfc92..9d9b9f1b047ba3 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...` +PYI010.pyi:6:5: PYI010 [**] Function body must contain only `...` | 5 | def buzz(): 6 | print("buzz") # ERROR PYI010 @@ -21,7 +21,7 @@ PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...` 8 8 | def foo2(): 9 9 | 123 # ERROR PYI010 -PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` +PYI010.pyi:9:5: PYI010 [**] Function body must contain only `...` | 8 | def foo2(): 9 | 123 # ERROR PYI010 @@ -41,7 +41,7 @@ PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` 11 11 | def bizz(): 12 12 | x = 123 # ERROR PYI010 -PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` +PYI010.pyi:12:5: PYI010 [**] Function body must contain only `...` | 11 | def bizz(): 12 | x = 123 # ERROR PYI010 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap index b883a369b29150..7ad588162d68d4 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:10:14: PYI011 [**] Only simple default values allowed for typed arguments | 8 | def f12( 9 | x, @@ -22,7 +22,7 @@ PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed argume 12 12 | def f11(*, x: str = "x") -> None: ... # OK 13 13 | def f13( -PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:38:9: PYI011 [**] Only simple default values allowed for typed arguments | 36 | x: dict[ 37 | int, int @@ -50,7 +50,7 @@ PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed argumen 43 40 | def f153( 44 41 | x: list[ -PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:46:9: PYI011 [**] Only simple default values allowed for typed arguments | 44 | x: list[ 45 | int @@ -96,7 +96,7 @@ PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed argumen 60 48 | def f154( 61 49 | x: tuple[ -PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:63:9: PYI011 [**] Only simple default values allowed for typed arguments | 61 | x: tuple[ 62 | str, tuple[str, ...] @@ -124,7 +124,7 @@ PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed argumen 68 65 | def f141( 69 66 | x: list[ -PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:71:9: PYI011 [**] Only simple default values allowed for typed arguments | 69 | x: list[ 70 | int @@ -150,7 +150,7 @@ PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed argumen 75 73 | def f142( 76 74 | x: list[ -PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:78:9: PYI011 [**] Only simple default values allowed for typed arguments | 76 | x: list[ 77 | int @@ -176,7 +176,7 @@ PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed argumen 82 80 | def f16( 83 81 | x: frozenset[ -PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:85:9: PYI011 [**] Only simple default values allowed for typed arguments | 83 | x: frozenset[ 84 | bytes @@ -202,7 +202,7 @@ PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed argumen 89 87 | def f17( 90 88 | x: str = "foo" # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:90:14: PYI011 [**] Only simple default values allowed for typed arguments | 88 | ) -> None: ... 89 | def f17( @@ -226,7 +226,7 @@ PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed argume 93 92 | def f18( 94 93 | x: str = b"foo" # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:94:14: PYI011 [**] Only simple default values allowed for typed arguments | 92 | ) -> None: ... 93 | def f18( @@ -250,7 +250,7 @@ PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed argume 97 96 | def f19( 98 97 | x: object = "foo" # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:98:17: PYI011 [**] Only simple default values allowed for typed arguments | 96 | ) -> None: ... 97 | def f19( @@ -274,7 +274,7 @@ PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed argume 101 100 | def f20( 102 101 | x: int = 5 -PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:102:14: PYI011 [**] Only simple default values allowed for typed arguments | 100 | ) -> None: ... 101 | def f20( @@ -298,7 +298,7 @@ PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed argum 105 104 | def f21( 106 105 | x: complex = 3j -PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:106:18: PYI011 [**] Only simple default values allowed for typed arguments | 104 | ) -> None: ... 105 | def f21( @@ -322,7 +322,7 @@ PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed argum 109 108 | def f22( 110 109 | x: complex = -42.5j # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:110:18: PYI011 [**] Only simple default values allowed for typed arguments | 108 | ) -> None: ... 109 | def f22( @@ -346,7 +346,7 @@ PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed argum 113 112 | def f23( 114 113 | x: bool = True, # OK -PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:138:16: PYI011 [**] Only simple default values allowed for typed arguments | 136 | ) -> None: ... 137 | def f31( @@ -367,7 +367,7 @@ PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed argum 140 140 | def f32( 141 141 | x: float = np.inf, # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:141:16: PYI011 [**] Only simple default values allowed for typed arguments | 139 | ) -> None: ... 140 | def f32( @@ -388,7 +388,7 @@ PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed argum 143 143 | def f33( 144 144 | x: float = math.nan, # OK -PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:147:16: PYI011 [**] Only simple default values allowed for typed arguments | 145 | ) -> None: ... 146 | def f34( @@ -409,7 +409,7 @@ PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed argum 149 149 | def f35( 150 150 | x: complex = math.inf # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:150:18: PYI011 [**] Only simple default values allowed for typed arguments | 148 | ) -> None: ... 149 | def f35( @@ -433,7 +433,7 @@ PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed argum 153 152 | def f36( 154 153 | *, -PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed arguments +PYI011.pyi:159:14: PYI011 [**] Only simple default values allowed for typed arguments | 157 | def f37( 158 | *, diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap index f16400fffca02c..ff1de2843e87ea 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:3:7: PYI014 [**] Only simple default values allowed for arguments | 1 | def f12( 2 | x, @@ -21,7 +21,7 @@ PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments 5 5 | def f11(*, x="x") -> None: ... # OK 6 6 | def f13( -PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:29:7: PYI014 [**] Only simple default values allowed for arguments | 27 | def f151(x={1: 2}) -> None: ... 28 | def f152( @@ -49,7 +49,7 @@ PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments 34 31 | def f153( 35 32 | x=[ # Error PYI014 -PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:35:7: PYI014 [**] Only simple default values allowed for arguments | 33 | ) -> None: ... 34 | def f153( @@ -95,7 +95,7 @@ PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments 49 37 | def f154( 50 38 | x=( # Error PYI014 -PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:50:7: PYI014 [**] Only simple default values allowed for arguments | 48 | ) -> None: ... 49 | def f154( @@ -123,7 +123,7 @@ PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments 55 52 | def f141( 56 53 | x=[*range(10)], # Error PYI014 -PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:56:7: PYI014 [**] Only simple default values allowed for arguments | 54 | ) -> None: ... 55 | def f141( @@ -144,7 +144,7 @@ PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments 58 58 | def f142( 59 59 | x=list(range(10)), # Error PYI014 -PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:59:7: PYI014 [**] Only simple default values allowed for arguments | 57 | ) -> None: ... 58 | def f142( @@ -165,7 +165,7 @@ PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments 61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 62 | def f17( -PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:61:11: PYI014 [**] Only simple default values allowed for arguments | 59 | x=list(range(10)), # Error PYI014 60 | ) -> None: ... @@ -186,7 +186,7 @@ PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments 63 63 | x="foo" + "bar", # Error PYI014 64 64 | ) -> None: ... -PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:63:7: PYI014 [**] Only simple default values allowed for arguments | 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 | def f17( @@ -207,7 +207,7 @@ PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments 65 65 | def f18( 66 66 | x=b"foo" + b"bar", # Error PYI014 -PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:66:7: PYI014 [**] Only simple default values allowed for arguments | 64 | ) -> None: ... 65 | def f18( @@ -228,7 +228,7 @@ PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments 68 68 | def f19( 69 69 | x="foo" + 4, # Error PYI014 -PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:69:7: PYI014 [**] Only simple default values allowed for arguments | 67 | ) -> None: ... 68 | def f19( @@ -249,7 +249,7 @@ PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments 71 71 | def f20( 72 72 | x=5 + 5, # Error PYI014 -PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:72:7: PYI014 [**] Only simple default values allowed for arguments | 70 | ) -> None: ... 71 | def f20( @@ -270,7 +270,7 @@ PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments 74 74 | def f21( 75 75 | x=3j - 3j, # Error PYI014 -PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:75:7: PYI014 [**] Only simple default values allowed for arguments | 73 | ) -> None: ... 74 | def f21( @@ -291,7 +291,7 @@ PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments 77 77 | def f22( 78 78 | x=-42.5j + 4.3j, # Error PYI014 -PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments +PYI014.pyi:78:7: PYI014 [**] Only simple default values allowed for arguments | 76 | ) -> None: ... 77 | def f22( diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap index a083c72f1b07e9..0f39d6cdc1781a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:44:23: PYI015 [**] Only simple default values allowed for assignments | 43 | # We *should* emit Y015 for more complex default values 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -21,7 +21,7 @@ PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments -PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:45:23: PYI015 [**] Only simple default values allowed for assignments | 43 | # We *should* emit Y015 for more complex default values 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -42,7 +42,7 @@ PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments -PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:46:23: PYI015 [**] Only simple default values allowed for assignments | 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments @@ -63,7 +63,7 @@ PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments -PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:47:26: PYI015 [**] Only simple default values allowed for assignments | 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments @@ -84,7 +84,7 @@ PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments -PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:48:47: PYI015 [**] Only simple default values allowed for assignments | 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments @@ -105,7 +105,7 @@ PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node -PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:49:31: PYI015 [**] Only simple default values allowed for assignments | 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments @@ -126,7 +126,7 @@ PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments -PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:50:37: PYI015 [**] Only simple default values allowed for assignments | 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments @@ -147,7 +147,7 @@ PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments -PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:52:28: PYI015 [**] Only simple default values allowed for assignments | 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node @@ -168,7 +168,7 @@ PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments 54 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments -PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:53:11: PYI015 [**] Only simple default values allowed for assignments | 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments @@ -189,7 +189,7 @@ PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments 56 56 | -PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:54:11: PYI015 [**] Only simple default values allowed for assignments | 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments @@ -209,7 +209,7 @@ PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments 56 56 | 57 57 | # We shouldn't emit Y015 within functions -PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments +PYI015.pyi:55:11: PYI015 [**] Only simple default values allowed for assignments | 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap index 2bebd50a8dc7f1..6dfbae238029c8 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI025.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.py:10:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 9 | def f(): 10 | from collections.abc import Set # PYI025 @@ -19,7 +19,7 @@ PYI025.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` 12 12 | 13 13 | def f(): -PYI025.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.py:14:51: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 13 | def f(): 14 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap index 51afedd7f8bf5b..eddc77c2f84d03 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI025.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:8:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 7 | def f(): 8 | from collections.abc import Set # PYI025 @@ -21,7 +21,7 @@ PYI025.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` 10 10 | def f(): 11 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 -PYI025.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:11:51: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 10 | def f(): 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 @@ -41,7 +41,7 @@ PYI025.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet 13 13 | def f(): 14 14 | """Test: local symbol renaming.""" -PYI025.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:16:37: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 14 | """Test: local symbol renaming.""" 15 | if True: @@ -76,7 +76,7 @@ PYI025.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet 29 29 | def Set(): 30 30 | pass -PYI025.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:33:29: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 31 | print(Set) 32 | @@ -119,7 +119,7 @@ PYI025.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet 42 42 | def f(): 43 43 | """Test: nonlocal symbol renaming.""" -PYI025.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:44:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 42 | def f(): 43 | """Test: nonlocal symbol renaming.""" diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap index b4c117f2ecf495..9b4336a552813b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` +PYI026.pyi:3:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` | 1 | from typing import Literal, Any 2 | @@ -22,7 +22,7 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: 5 5 | Foo = Literal["foo"] 6 6 | IntOrStr = int | str -PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` +PYI026.pyi:4:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -43,7 +43,7 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Optiona 6 6 | IntOrStr = int | str 7 7 | AliasNone = None -PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` +PYI026.pyi:5:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -66,7 +66,7 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: Ty 7 7 | AliasNone = None 8 8 | -PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` +PYI026.pyi:6:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` | 4 | OptionalStr = typing.Optional[str] 5 | Foo = Literal["foo"] @@ -89,7 +89,7 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrSt 8 8 | 9 9 | NewAny: typing.TypeAlias = Any -PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` +PYI026.pyi:7:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` | 5 | Foo = Literal["foo"] 6 | IntOrStr = int | str diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap index 5b9f3aa1a13323..7488435b6245e7 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI053.pyi:3:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:3:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted | 1 | def f1(x: str = "50 character stringggggggggggggggggggggggggggggggg") -> None: ... # OK 2 | def f2( @@ -21,7 +21,7 @@ PYI053.pyi:3:14: PYI053 [*] String and bytes literals longer than 50 characters 5 5 | def f3( 6 6 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK -PYI053.pyi:9:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:9:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted | 7 | ) -> None: ... 8 | def f4( @@ -42,7 +42,7 @@ PYI053.pyi:9:14: PYI053 [*] String and bytes literals longer than 50 characters 11 11 | def f5( 12 12 | x: bytes = b"50 character byte stringgggggggggggggggggggggggggg", # OK -PYI053.pyi:21:16: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:21:16: PYI053 [**] String and bytes literals longer than 50 characters are not permitted | 19 | ) -> None: ... 20 | def f8( @@ -62,7 +62,7 @@ PYI053.pyi:21:16: PYI053 [*] String and bytes literals longer than 50 characters 23 23 | 24 24 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK -PYI053.pyi:26:12: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:26:12: PYI053 [**] String and bytes literals longer than 50 characters are not permitted | 24 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK 25 | @@ -83,7 +83,7 @@ PYI053.pyi:26:12: PYI053 [*] String and bytes literals longer than 50 characters 28 28 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 29 29 | -PYI053.pyi:30:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:30:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted | 28 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 29 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap index 7db8611cad8e8f..7739a08fa8e974 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:2:16: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted | 1 | field01: int = 0xFFFFFFFF 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 @@ -19,7 +19,7 @@ PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer 4 4 | field04: int = -0xFFFFFFFFF # Error: PYI054 5 5 | -PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:4:17: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted | 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 3 | field03: int = -0xFFFFFFFF @@ -40,7 +40,7 @@ PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer 6 6 | field05: int = 1234567890 7 7 | field06: int = 12_456_890 -PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:8:16: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted | 6 | field05: int = 1234567890 7 | field06: int = 12_456_890 @@ -61,7 +61,7 @@ PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer 10 10 | field09: int = -234_567_890 # Error: PYI054 11 11 | -PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:10:17: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted | 8 | field07: int = 12345678901 # Error: PYI054 9 | field08: int = -1234567801 @@ -82,7 +82,7 @@ PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longe 12 12 | field10: float = 123.456789 13 13 | field11: float = 123.4567890 # Error: PYI054 -PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:13:18: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted | 12 | field10: float = 123.456789 13 | field11: float = 123.4567890 # Error: PYI054 @@ -102,7 +102,7 @@ PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longe 15 15 | field13: float = -123.567_890 # Error: PYI054 16 16 | -PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:15:19: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted | 13 | field11: float = 123.4567890 # Error: PYI054 14 | field12: float = -123.456789 @@ -123,7 +123,7 @@ PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longe 17 17 | field14: complex = 1e1234567j 18 18 | field15: complex = 1e12345678j # Error: PYI054 -PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:18:20: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted | 17 | field14: complex = 1e1234567j 18 | field15: complex = 1e12345678j # Error: PYI054 @@ -142,7 +142,7 @@ PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longe 19 19 | field16: complex = -1e1234567j 20 20 | field17: complex = 1e123456789j # Error: PYI054 -PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:20:20: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted | 18 | field15: complex = 1e12345678j # Error: PYI054 19 | field16: complex = -1e1234567j diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap index f8db4ff1b26124..c961b4bc0c325e 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` +PYI026.pyi:3:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` | 1 | from typing import Literal, Any 2 | @@ -22,7 +22,7 @@ PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 5 6 | Foo = Literal["foo"] 6 7 | IntOrStr = int | str -PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` +PYI026.pyi:4:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -43,7 +43,7 @@ PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 6 7 | IntOrStr = int | str 7 8 | AliasNone = None -PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` +PYI026.pyi:5:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -66,7 +66,7 @@ PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 7 8 | AliasNone = None 8 9 | -PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` +PYI026.pyi:6:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` | 4 | OptionalStr = typing.Optional[str] 5 | Foo = Literal["foo"] @@ -89,7 +89,7 @@ PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g 8 9 | 9 10 | NewAny: typing.TypeAlias = Any -PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` +PYI026.pyi:7:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` | 5 | Foo = Literal["foo"] 6 | IntOrStr = int | str diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap index ceb7e0f5b16328..1ce38d70571ab4 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:14:17: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` | 14 | @pytest.fixture(scope="function") | ^^^^^^^^^^^^^^^^ PT003 @@ -20,7 +20,7 @@ PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 16 16 | ... 17 17 | -PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:19:17: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` | 19 | @pytest.fixture(scope="function", name="my_fixture") | ^^^^^^^^^^^^^^^^ PT003 @@ -39,7 +39,7 @@ PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 21 21 | ... 22 22 | -PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:24:36: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` | 24 | @pytest.fixture(name="my_fixture", scope="function") | ^^^^^^^^^^^^^^^^ PT003 @@ -58,7 +58,7 @@ PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 26 26 | ... 27 27 | -PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:29:36: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` | 29 | @pytest.fixture(name="my_fixture", scope="function", **kwargs) | ^^^^^^^^^^^^^^^^ PT003 @@ -77,7 +77,7 @@ PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 31 31 | ... 32 32 | -PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:37:31: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` | 35 | # tests the general case as we use a helper function that should 36 | # work for all cases. @@ -98,7 +98,7 @@ PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 39 39 | ... 40 40 | -PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:43:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` | 42 | @pytest.fixture( 43 | scope="function", @@ -117,7 +117,7 @@ PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 45 44 | ) 46 45 | def error_multiple_args(): -PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:52:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` | 50 | @pytest.fixture( 51 | name="my_fixture", @@ -137,7 +137,7 @@ PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` 54 53 | def error_multiple_args(): 55 54 | ... -PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:66:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` | 64 | # another comment ,) 65 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap index 1399986a40c656..fe881db1ddda1f 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT006.py:24:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv` +PT006.py:24:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv` | 24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ PT006 @@ -39,7 +39,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 31 31 | ... 32 32 | -PT006.py:34:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv` +PT006.py:34:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv` | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ PT006 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap index c9e8b5e0c50016..3beec6ca92d639 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:9:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ PT006 @@ -20,7 +20,7 @@ PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expec 11 11 | ... 12 12 | -PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:14:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -39,7 +39,7 @@ PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 16 16 | ... 17 17 | -PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:19:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ PT006 @@ -77,7 +77,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 31 31 | ... 32 32 | -PT006.py:34:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:34:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ PT006 @@ -115,7 +115,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 41 41 | ... 42 42 | -PT006.py:44:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:44:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) | ^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -134,7 +134,7 @@ PT006.py:44:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 46 46 | ... 47 47 | -PT006.py:49:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:49:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3]) | ^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -153,7 +153,7 @@ PT006.py:49:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 51 51 | ... 52 52 | -PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:54:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -172,7 +172,7 @@ PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 56 56 | ... 57 57 | -PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:59:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -191,7 +191,7 @@ PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 61 61 | ... 62 62 | -PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:64:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -210,7 +210,7 @@ PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 66 66 | ... 67 67 | -PT006.py:69:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:69:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^ PT006 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap index bdce72095b1a4c..5d65f77d6536bf 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:9:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ PT006 @@ -20,7 +20,7 @@ PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expec 11 11 | ... 12 12 | -PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:14:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -39,7 +39,7 @@ PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 16 16 | ... 17 17 | -PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:19:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ PT006 @@ -58,7 +58,7 @@ PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 21 21 | ... 22 22 | -PT006.py:24:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:24:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ PT006 @@ -115,7 +115,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 41 41 | ... 42 42 | -PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:54:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -134,7 +134,7 @@ PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 56 56 | ... 57 57 | -PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:59:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -153,7 +153,7 @@ PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 61 61 | ... 62 62 | -PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:64:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -172,7 +172,7 @@ PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 66 66 | ... 67 67 | -PT006.py:69:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:69:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^ PT006 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap index 9b4b7fc1e426a8..6e1cbcde1b2682 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:11:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` | 9 | expr = 1 10 | msg = "Must be True" @@ -22,7 +22,7 @@ PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 13 13 | self.assertTrue(expr, msg) # Error 14 14 | self.assertTrue(expr=expr, msg=msg) # Error -PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:12:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` | 10 | msg = "Must be True" 11 | self.assertTrue(expr) # Error @@ -43,7 +43,7 @@ PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 14 14 | self.assertTrue(expr=expr, msg=msg) # Error 15 15 | self.assertTrue(msg=msg, expr=expr) # Error -PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:13:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` | 11 | self.assertTrue(expr) # Error 12 | self.assertTrue(expr=expr) # Error @@ -64,7 +64,7 @@ PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 15 15 | self.assertTrue(msg=msg, expr=expr) # Error 16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable -PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:14:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` | 12 | self.assertTrue(expr=expr) # Error 13 | self.assertTrue(expr, msg) # Error @@ -85,7 +85,7 @@ PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable 17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable -PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:15:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` | 13 | self.assertTrue(expr, msg) # Error 14 | self.assertTrue(expr=expr, msg=msg) # Error @@ -183,7 +183,7 @@ PT009.py:25:16: PT009 Use a regular `assert` instead of unittest-style `assertEq | = help: Replace `assertEqual(...)` with `assert ...` -PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertFalse` +PT009.py:28:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertFalse` | 27 | def test_assert_false(self): 28 | self.assertFalse(True) # Error @@ -203,7 +203,7 @@ PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 30 30 | def test_assert_equal(self): 31 31 | self.assertEqual(1, 2) # Error -PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertEqual` +PT009.py:31:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertEqual` | 30 | def test_assert_equal(self): 31 | self.assertEqual(1, 2) # Error @@ -223,7 +223,7 @@ PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 33 33 | def test_assert_not_equal(self): 34 34 | self.assertNotEqual(1, 1) # Error -PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotEqual` +PT009.py:34:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotEqual` | 33 | def test_assert_not_equal(self): 34 | self.assertNotEqual(1, 1) # Error @@ -243,7 +243,7 @@ PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 36 36 | def test_assert_greater(self): 37 37 | self.assertGreater(1, 2) # Error -PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreater` +PT009.py:37:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertGreater` | 36 | def test_assert_greater(self): 37 | self.assertGreater(1, 2) # Error @@ -263,7 +263,7 @@ PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 39 39 | def test_assert_greater_equal(self): 40 40 | self.assertGreaterEqual(1, 2) # Error -PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreaterEqual` +PT009.py:40:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertGreaterEqual` | 39 | def test_assert_greater_equal(self): 40 | self.assertGreaterEqual(1, 2) # Error @@ -283,7 +283,7 @@ PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 42 42 | def test_assert_less(self): 43 43 | self.assertLess(2, 1) # Error -PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLess` +PT009.py:43:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertLess` | 42 | def test_assert_less(self): 43 | self.assertLess(2, 1) # Error @@ -303,7 +303,7 @@ PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 45 45 | def test_assert_less_equal(self): 46 46 | self.assertLessEqual(1, 2) # Error -PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLessEqual` +PT009.py:46:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertLessEqual` | 45 | def test_assert_less_equal(self): 46 | self.assertLessEqual(1, 2) # Error @@ -323,7 +323,7 @@ PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 48 48 | def test_assert_in(self): 49 49 | self.assertIn(1, [2, 3]) # Error -PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIn` +PT009.py:49:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIn` | 48 | def test_assert_in(self): 49 | self.assertIn(1, [2, 3]) # Error @@ -343,7 +343,7 @@ PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 51 51 | def test_assert_not_in(self): 52 52 | self.assertNotIn(2, [2, 3]) # Error -PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIn` +PT009.py:52:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotIn` | 51 | def test_assert_not_in(self): 52 | self.assertNotIn(2, [2, 3]) # Error @@ -363,7 +363,7 @@ PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 54 54 | def test_assert_is_none(self): 55 55 | self.assertIsNone(0) # Error -PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNone` +PT009.py:55:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNone` | 54 | def test_assert_is_none(self): 55 | self.assertIsNone(0) # Error @@ -383,7 +383,7 @@ PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 57 57 | def test_assert_is_not_none(self): 58 58 | self.assertIsNotNone(0) # Error -PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNotNone` +PT009.py:58:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNotNone` | 57 | def test_assert_is_not_none(self): 58 | self.assertIsNotNone(0) # Error @@ -403,7 +403,7 @@ PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 60 60 | def test_assert_is(self): 61 61 | self.assertIs([], []) # Error -PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIs` +PT009.py:61:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIs` | 60 | def test_assert_is(self): 61 | self.assertIs([], []) # Error @@ -423,7 +423,7 @@ PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 63 63 | def test_assert_is_not(self): 64 64 | self.assertIsNot(1, 1) # Error -PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNot` +PT009.py:64:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNot` | 63 | def test_assert_is_not(self): 64 | self.assertIsNot(1, 1) # Error @@ -443,7 +443,7 @@ PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 66 66 | def test_assert_is_instance(self): 67 67 | self.assertIsInstance(1, str) # Error -PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsInstance` +PT009.py:67:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsInstance` | 66 | def test_assert_is_instance(self): 67 | self.assertIsInstance(1, str) # Error @@ -463,7 +463,7 @@ PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 69 69 | def test_assert_is_not_instance(self): 70 70 | self.assertNotIsInstance(1, int) # Error -PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIsInstance` +PT009.py:70:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotIsInstance` | 69 | def test_assert_is_not_instance(self): 70 | self.assertNotIsInstance(1, int) # Error @@ -483,7 +483,7 @@ PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 72 72 | def test_assert_regex(self): 73 73 | self.assertRegex("abc", r"def") # Error -PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegex` +PT009.py:73:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertRegex` | 72 | def test_assert_regex(self): 73 | self.assertRegex("abc", r"def") # Error @@ -503,7 +503,7 @@ PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 75 75 | def test_assert_not_regex(self): 76 76 | self.assertNotRegex("abc", r"abc") # Error -PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex` +PT009.py:76:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotRegex` | 75 | def test_assert_not_regex(self): 76 | self.assertNotRegex("abc", r"abc") # Error @@ -523,7 +523,7 @@ PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 78 78 | def test_assert_regexp_matches(self): 79 79 | self.assertRegexpMatches("abc", r"def") # Error -PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegexpMatches` +PT009.py:79:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertRegexpMatches` | 78 | def test_assert_regexp_matches(self): 79 | self.assertRegexpMatches("abc", r"def") # Error @@ -543,7 +543,7 @@ PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 81 81 | def test_assert_not_regexp_matches(self): 82 82 | self.assertNotRegex("abc", r"abc") # Error -PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex` +PT009.py:82:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotRegex` | 81 | def test_assert_not_regexp_matches(self): 82 | self.assertNotRegex("abc", r"abc") # Error @@ -563,7 +563,7 @@ PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `asser 84 84 | def test_fail_if(self): 85 85 | self.failIf("abc") # Error -PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIf` +PT009.py:85:9: PT009 [**] Use a regular `assert` instead of unittest-style `failIf` | 84 | def test_fail_if(self): 85 | self.failIf("abc") # Error @@ -583,7 +583,7 @@ PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI 87 87 | def test_fail_unless(self): 88 88 | self.failUnless("abc") # Error -PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnless` +PT009.py:88:9: PT009 [**] Use a regular `assert` instead of unittest-style `failUnless` | 87 | def test_fail_unless(self): 88 | self.failUnless("abc") # Error @@ -603,7 +603,7 @@ PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU 90 90 | def test_fail_unless_equal(self): 91 91 | self.failUnlessEqual(1, 2) # Error -PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnlessEqual` +PT009.py:91:9: PT009 [**] Use a regular `assert` instead of unittest-style `failUnlessEqual` | 90 | def test_fail_unless_equal(self): 91 | self.failUnlessEqual(1, 2) # Error @@ -623,7 +623,7 @@ PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failU 93 93 | def test_fail_if_equal(self): 94 94 | self.failIfEqual(1, 2) # Error -PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIfEqual` +PT009.py:94:9: PT009 [**] Use a regular `assert` instead of unittest-style `failIfEqual` | 93 | def test_fail_if_equal(self): 94 | self.failIfEqual(1, 2) # Error @@ -641,7 +641,7 @@ PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failI 96 96 | 97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 -PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:98:2: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` | 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 98 | (self.assertTrue( diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap index 2e05167b05b057..eb0a428b93070f 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:4:35: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 4 | @pytest.mark.parametrize("x", [1, 1, 2]) | ^ PT014 @@ -20,7 +20,7 @@ PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.para 6 6 | ... 7 7 | -PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:14:35: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ PT014 @@ -39,7 +39,7 @@ PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 16 16 | ... 17 17 | -PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` +PT014.py:14:41: PT014 [**] Duplicate of test case at index 2 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ PT014 @@ -58,7 +58,7 @@ PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.par 16 16 | ... 17 17 | -PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` +PT014.py:14:44: PT014 [**] Duplicate of test case at index 2 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ PT014 @@ -88,7 +88,7 @@ PT014.py:24:9: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametr | = help: Remove duplicate test case -PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:32:39: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) | ^ PT014 @@ -107,7 +107,7 @@ PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 34 34 | ... 35 35 | -PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:32:48: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) | ^ PT014 @@ -126,7 +126,7 @@ PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 34 34 | ... 35 35 | -PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:42:10: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 40 | a, 41 | b, @@ -146,7 +146,7 @@ PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.par 44 43 | ((a)), 45 44 | ], -PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:44:11: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 42 | (a), 43 | c, diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap index a656a5c666f59e..9b30576ed2281b 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:14:5: PT018 [**] Assertion should be broken down into multiple parts | 13 | def test_error(): 14 | assert something and something_else @@ -22,7 +22,7 @@ PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts 16 17 | assert something and not something_else 17 18 | assert something and (something_else or something_third) -PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:15:5: PT018 [**] Assertion should be broken down into multiple parts | 13 | def test_error(): 14 | assert something and something_else @@ -44,7 +44,7 @@ PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts 17 18 | assert something and (something_else or something_third) 18 19 | assert not something and something_else -PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:16:5: PT018 [**] Assertion should be broken down into multiple parts | 14 | assert something and something_else 15 | assert something and something_else and something_third @@ -66,7 +66,7 @@ PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts 18 19 | assert not something and something_else 19 20 | assert not (something or something_else) -PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:17:5: PT018 [**] Assertion should be broken down into multiple parts | 15 | assert something and something_else and something_third 16 | assert something and not something_else @@ -88,7 +88,7 @@ PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts 19 20 | assert not (something or something_else) 20 21 | assert not (something or something_else or something_third) -PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:18:5: PT018 [**] Assertion should be broken down into multiple parts | 16 | assert something and not something_else 17 | assert something and (something_else or something_third) @@ -110,7 +110,7 @@ PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts 20 21 | assert not (something or something_else or something_third) 21 22 | assert something and something_else == """error -PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:19:5: PT018 [**] Assertion should be broken down into multiple parts | 17 | assert something and (something_else or something_third) 18 | assert not something and something_else @@ -132,7 +132,7 @@ PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts 21 22 | assert something and something_else == """error 22 23 | message -PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:20:5: PT018 [**] Assertion should be broken down into multiple parts | 18 | assert not something and something_else 19 | assert not (something or something_else) @@ -154,7 +154,7 @@ PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts 22 23 | message 23 24 | """ -PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:21:5: PT018 [**] Assertion should be broken down into multiple parts | 19 | assert not (something or something_else) 20 | assert not (something or something_else or something_third) @@ -179,7 +179,7 @@ PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts 23 24 | """ 24 25 | assert ( -PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:24:5: PT018 [**] Assertion should be broken down into multiple parts | 22 | message 23 | """ @@ -210,7 +210,7 @@ PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts 28 28 | message 29 29 | """ -PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:33:5: PT018 [**] Assertion should be broken down into multiple parts | 32 | # recursive case 33 | assert not (a or not (b or c)) @@ -230,7 +230,7 @@ PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts 35 36 | 36 37 | # detected, but no fix for messages -PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:34:5: PT018 [**] Assertion should be broken down into multiple parts | 32 | # recursive case 33 | assert not (a or not (b or c)) @@ -282,7 +282,7 @@ PT018.py:40:5: PT018 Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:44:1: PT018 [**] Assertion should be broken down into multiple parts | 43 | assert something # OK 44 | assert something and something_else # Error @@ -302,7 +302,7 @@ PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts 46 47 | 47 48 | -PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:45:1: PT018 [**] Assertion should be broken down into multiple parts | 43 | assert something # OK 44 | assert something and something_else # Error @@ -351,7 +351,7 @@ PT018.py:54:9: PT018 Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:59:5: PT018 [**] Assertion should be broken down into multiple parts | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7143 58 | def test_parenthesized_not(): @@ -380,7 +380,7 @@ PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts 65 67 | assert (not ( 66 68 | self.find_graph_output(node.output[0]) -PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts +PT018.py:65:5: PT018 [**] Assertion should be broken down into multiple parts | 63 | ) 64 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap index 4bf726cece5838..7c3be1d128baef 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters +PT026.py:19:1: PT026 [**] Useless `pytest.mark.usefixtures` without parameters | 19 | @pytest.mark.usefixtures() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PT026 @@ -20,7 +20,7 @@ PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters 21 21 | pass 22 22 | -PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters +PT026.py:24:1: PT026 [**] Useless `pytest.mark.usefixtures` without parameters | 24 | @pytest.mark.usefixtures | ^^^^^^^^^^^^^^^^^^^^^^^^ PT026 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap index dd48d601634ba9..b92f47ea146775 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises` +PT027_0.py:6:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises` | 4 | class Test(unittest.TestCase): 5 | def test_errors(self): @@ -25,7 +25,7 @@ PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert 8 9 | with self.assertRaises(expected_exception=ValueError): 9 10 | raise ValueError -PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises` +PT027_0.py:8:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises` | 6 | with self.assertRaises(ValueError): 7 | raise ValueError @@ -50,7 +50,7 @@ PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assert 10 11 | 11 12 | with self.failUnlessRaises(ValueError): -PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failUnlessRaises` +PT027_0.py:11:14: PT027 [**] Use `pytest.raises` instead of unittest-style `failUnlessRaises` | 9 | raise ValueError 10 | @@ -76,7 +76,7 @@ PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failU 13 14 | 14 15 | with self.assertRaisesRegex(ValueError, "test"): -PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +PT027_0.py:14:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 12 | raise ValueError 13 | @@ -102,7 +102,7 @@ PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 16 17 | 17 18 | with self.assertRaisesRegex(ValueError, expected_regex="test"): -PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +PT027_0.py:17:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 15 | raise ValueError("test") 16 | @@ -128,7 +128,7 @@ PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 19 20 | 20 21 | with self.assertRaisesRegex( -PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +PT027_0.py:20:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 18 | raise ValueError("test") 19 | @@ -157,7 +157,7 @@ PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 24 23 | 25 24 | with self.assertRaisesRegex( -PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +PT027_0.py:25:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 23 | raise ValueError("test") 24 | @@ -186,7 +186,7 @@ PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `asser 29 28 | 30 29 | with self.assertRaisesRegexp(ValueError, "test"): -PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp` +PT027_0.py:30:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp` | 28 | raise ValueError("test") 29 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap index 3886db7a54d0cf..abe0aca3025fe8 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT027_1.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises` +PT027_1.py:11:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises` | 10 | def test_errors(self): 11 | with self.assertRaises(ValueError): diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap index c3a4baa5697fe6..425ce133a45e63 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET503.py:20:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:20:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 18 | # if/elif/else 19 | def x(y): @@ -22,7 +22,7 @@ RET503.py:20:5: RET503 [*] Missing explicit `return` at the end of function able 23 24 | 24 25 | -RET503.py:27:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:27:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 25 | def x(y): 26 | if not y: @@ -42,7 +42,7 @@ RET503.py:27:9: RET503 [*] Missing explicit `return` at the end of function able 29 30 | return 2 30 31 | -RET503.py:36:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:36:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 34 | return 1 35 | @@ -60,7 +60,7 @@ RET503.py:36:5: RET503 [*] Missing explicit `return` at the end of function able 38 39 | 39 40 | # for -RET503.py:41:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:41:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 39 | # for 40 | def x(y): @@ -82,7 +82,7 @@ RET503.py:41:5: RET503 [*] Missing explicit `return` at the end of function able 45 46 | 46 47 | -RET503.py:52:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:52:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 50 | return i 51 | else: @@ -100,7 +100,7 @@ RET503.py:52:9: RET503 [*] Missing explicit `return` at the end of function able 54 55 | 55 56 | # A nonexistent function -RET503.py:59:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:59:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 57 | if x > 0: 58 | return False @@ -118,7 +118,7 @@ RET503.py:59:5: RET503 [*] Missing explicit `return` at the end of function able 61 62 | 62 63 | # A function that does return the control -RET503.py:66:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:66:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 64 | if x > 0: 65 | return False @@ -136,7 +136,7 @@ RET503.py:66:5: RET503 [*] Missing explicit `return` at the end of function able 68 69 | 69 70 | ### -RET503.py:82:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:82:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 80 | # last line in while loop 81 | def x(y): @@ -158,7 +158,7 @@ RET503.py:82:5: RET503 [*] Missing explicit `return` at the end of function able 87 88 | 88 89 | # exclude empty functions -RET503.py:113:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:113:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 111 | # return value within loop 112 | def bar1(x, y, z): @@ -180,7 +180,7 @@ RET503.py:113:5: RET503 [*] Missing explicit `return` at the end of function abl 118 119 | 119 120 | def bar3(x, y, z): -RET503.py:120:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:120:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 119 | def bar3(x, y, z): 120 | for i in x: @@ -204,7 +204,7 @@ RET503.py:120:5: RET503 [*] Missing explicit `return` at the end of function abl 128 129 | 129 130 | def bar1(x, y, z): -RET503.py:130:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:130:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 129 | def bar1(x, y, z): 130 | for i in x: @@ -225,7 +225,7 @@ RET503.py:130:5: RET503 [*] Missing explicit `return` at the end of function abl 135 136 | 136 137 | def bar3(x, y, z): -RET503.py:137:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:137:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 136 | def bar3(x, y, z): 137 | for i in x: @@ -249,7 +249,7 @@ RET503.py:137:5: RET503 [*] Missing explicit `return` at the end of function abl 145 146 | 146 147 | def prompts(self, foo): -RET503.py:274:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:274:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 272 | return False 273 | @@ -269,7 +269,7 @@ RET503.py:274:5: RET503 [*] Missing explicit `return` at the end of function abl 277 278 | 278 279 | def while_true(): -RET503.py:291:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:291:13: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 289 | return 1 290 | case 1: @@ -287,7 +287,7 @@ RET503.py:291:13: RET503 [*] Missing explicit `return` at the end of function ab 293 294 | 294 295 | def foo(baz: str) -> str: -RET503.py:300:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:300:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 298 | def end_of_statement(): 299 | def example(): @@ -307,7 +307,7 @@ RET503.py:300:9: RET503 [*] Missing explicit `return` at the end of function abl 303 304 | 304 305 | def example(): -RET503.py:305:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:305:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 304 | def example(): 305 | if True: @@ -326,7 +326,7 @@ RET503.py:305:9: RET503 [*] Missing explicit `return` at the end of function abl 308 309 | 309 310 | def example(): -RET503.py:310:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:310:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 309 | def example(): 310 | if True: @@ -345,7 +345,7 @@ RET503.py:310:9: RET503 [*] Missing explicit `return` at the end of function abl 313 314 | 314 315 | def example(): -RET503.py:315:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:315:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 314 | def example(): 315 | if True: @@ -364,7 +364,7 @@ RET503.py:315:9: RET503 [*] Missing explicit `return` at the end of function abl 318 319 | 319 320 | def example(): -RET503.py:320:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:320:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 319 | def example(): 320 | if True: @@ -384,7 +384,7 @@ RET503.py:320:9: RET503 [*] Missing explicit `return` at the end of function abl 324 325 | 325 326 | def end_of_file(): -RET503.py:328:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:328:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value | 326 | if False: 327 | return 1 diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap index c9bcc8798437da..1910570dfd4970 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` statement +RET504.py:6:12: RET504 [**] Unnecessary assignment to `a` before `return` statement | 4 | def x(): 5 | a = 1 @@ -21,7 +21,7 @@ RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` stateme 8 7 | 9 8 | # Can be refactored false positives -RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return` statement +RET504.py:23:12: RET504 [**] Unnecessary assignment to `formatted` before `return` statement | 21 | # clean up after any blank components 22 | formatted = formatted.replace("()", "").replace(" ", " ").strip() @@ -41,7 +41,7 @@ RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return 25 24 | 26 25 | # https://github.com/afonasev/flake8-return/issues/47#issue-641117366 -RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement +RET504.py:246:12: RET504 [**] Unnecessary assignment to `queryset` before `return` statement | 244 | queryset = Model.filter(a=1) 245 | queryset = queryset.filter(c=3) @@ -61,7 +61,7 @@ RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return 248 247 | 249 248 | def get_queryset(): -RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement +RET504.py:251:12: RET504 [**] Unnecessary assignment to `queryset` before `return` statement | 249 | def get_queryset(): 250 | queryset = Model.filter(a=1) @@ -81,7 +81,7 @@ RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return 253 252 | 254 253 | # Function arguments -RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` statement +RET504.py:269:12: RET504 [**] Unnecessary assignment to `val` before `return` statement | 267 | return val 268 | val = 1 @@ -101,7 +101,7 @@ RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` sta 271 270 | 272 271 | def str_to_bool(val): -RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` statement +RET504.py:321:12: RET504 [**] Unnecessary assignment to `x` before `return` statement | 319 | with open("foo.txt", "r") as f: 320 | x = f.read() @@ -121,7 +121,7 @@ RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` state 323 322 | 324 323 | def foo(): -RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` statement +RET504.py:342:12: RET504 [**] Unnecessary assignment to `b` before `return` statement | 340 | a = 1 341 | b=a @@ -141,7 +141,7 @@ RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` state 344 343 | 345 344 | def foo(): -RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` statement +RET504.py:348:12: RET504 [**] Unnecessary assignment to `b` before `return` statement | 346 | a = 1 347 | b =a @@ -161,7 +161,7 @@ RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` state 350 349 | 351 350 | def foo(): -RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` statement +RET504.py:354:12: RET504 [**] Unnecessary assignment to `b` before `return` statement | 352 | a = 1 353 | b= a @@ -181,7 +181,7 @@ RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` state 356 355 | 357 356 | def foo(): -RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` statement +RET504.py:359:12: RET504 [**] Unnecessary assignment to `a` before `return` statement | 357 | def foo(): 358 | a = 1 # Comment @@ -201,7 +201,7 @@ RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` state 361 360 | 362 361 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 -RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` statement +RET504.py:365:12: RET504 [**] Unnecessary assignment to `D` before `return` statement | 363 | def mavko_debari(P_kbar): 364 | D=0.4853881 + 3.6006116*P - 0.0117368*(P-1.3822)**2 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap index 1368303ffa0b85..a58e3afc10dfc7 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:1:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call | 1 | if isinstance(a, int) or isinstance(a, float): # SIM101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 @@ -16,7 +16,7 @@ SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing 3 3 | 4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 -SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:4:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing 6 6 | 7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 -SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:7:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call | 5 | pass 6 | @@ -56,7 +56,7 @@ SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sing 9 9 | 10 10 | if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101 -SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:10:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call | 8 | pass 9 | @@ -76,7 +76,7 @@ SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 12 12 | 13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 -SIM101.py:13:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:13:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call | 11 | pass 12 | @@ -96,7 +96,7 @@ SIM101.py:13:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 15 15 | 16 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 -SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:16:5: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call | 14 | pass 15 | @@ -116,7 +116,7 @@ SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a sin 18 18 | 19 19 | if isinstance(a.b, int) or isinstance(a.b, float): # SIM101 -SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge into a single call +SIM101.py:19:4: SIM101 [**] Multiple `isinstance` calls for expression, merge into a single call | 17 | pass 18 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap index 8f373fc0be83eb..9816b463c6bdd9 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:2:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 1 | # SIM102 2 | / if a: @@ -22,7 +22,7 @@ SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta 6 5 | # SIM102 7 6 | if a: -SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:7:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 6 | # SIM102 7 | / if a: @@ -48,7 +48,7 @@ SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` sta 12 11 | # SIM102 13 12 | if a: -SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:8:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 6 | # SIM102 7 | if a: @@ -73,7 +73,7 @@ SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` sta 12 11 | # SIM102 13 12 | if a: -SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:15:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 13 | if a: 14 | pass @@ -108,7 +108,7 @@ SIM102.py:20:1: SIM102 Use a single `if` statement instead of nested `if` statem | = help: Combine `if` statements using `and` -SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:26:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 25 | # SIM102 26 | / if a: @@ -134,7 +134,7 @@ SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` st 31 30 | # OK 32 31 | if a: -SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:51:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 49 | while x > 0: 50 | # SIM102 @@ -172,7 +172,7 @@ SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` st 64 63 | 65 64 | -SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:67:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 66 | # SIM102 67 | / if x > 0: @@ -208,7 +208,7 @@ SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` st 80 79 | 81 80 | while x > 0: -SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:83:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 81 | while x > 0: 82 | # SIM102 @@ -239,7 +239,7 @@ SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` st 89 88 | # SIM102 (auto-fixable) 90 89 | if node.module012345678: -SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:90:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 89 | # SIM102 (auto-fixable) 90 | / if node.module012345678: @@ -280,7 +280,7 @@ SIM102.py:97:1: SIM102 Use a single `if` statement instead of nested `if` statem | = help: Combine `if` statements using `and` -SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:106:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161 105 | if a: @@ -306,7 +306,7 @@ SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` s 110 109 | print("elif") 111 110 | -SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:132:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 130 | if a: 131 | # SIM 102 @@ -332,7 +332,7 @@ SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` s 136 135 | print("bar") 137 136 | -SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements +SIM102.py:165:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements | 163 | if a: 164 | pass diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap index b6eb3af562a5b2..7cb2d25a7c644e 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM103.py:3:5: SIM103 [*] Return the condition `a` directly +SIM103.py:3:5: SIM103 [**] Return the condition `a` directly | 1 | def f(): 2 | # SIM103 @@ -26,7 +26,7 @@ SIM103.py:3:5: SIM103 [*] Return the condition `a` directly 8 5 | 9 6 | def f(): -SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly +SIM103.py:11:5: SIM103 [**] Return the condition `a == b` directly | 9 | def f(): 10 | # SIM103 @@ -52,7 +52,7 @@ SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly 16 13 | 17 14 | def f(): -SIM103.py:21:5: SIM103 [*] Return the condition `b` directly +SIM103.py:21:5: SIM103 [**] Return the condition `b` directly | 19 | if a: 20 | return 1 @@ -78,7 +78,7 @@ SIM103.py:21:5: SIM103 [*] Return the condition `b` directly 26 23 | 27 24 | def f(): -SIM103.py:32:9: SIM103 [*] Return the condition `b` directly +SIM103.py:32:9: SIM103 [**] Return the condition `b` directly | 30 | return 1 31 | else: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap index 747d835818013f..6e4c1bbb4117ab 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +SIM105_0.py:6:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 5 | # SIM105 6 | / try: @@ -28,7 +28,7 @@ SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `tr 11 10 | 12 11 | # SIM105 -SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:13:1: SIM105 [**] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | 12 | # SIM105 13 | / try: @@ -59,7 +59,7 @@ SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst 18 17 | # SIM105 19 18 | try: -SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:19:1: SIM105 [**] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | 18 | # SIM105 19 | / try: @@ -90,7 +90,7 @@ SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` inst 24 23 | # SIM105 25 24 | try: -SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass` +SIM105_0.py:25:1: SIM105 [**] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass` | 24 | # SIM105 25 | / try: @@ -121,7 +121,7 @@ SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `tr 30 29 | # SIM105 31 30 | try: -SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass` +SIM105_0.py:31:1: SIM105 [**] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass` | 30 | # SIM105 31 | / try: @@ -152,7 +152,7 @@ SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead 36 35 | # OK 37 36 | try: -SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +SIM105_0.py:85:5: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 83 | def with_ellipsis(): 84 | # OK @@ -197,7 +197,7 @@ SIM105_0.py:100:5: SIM105 Use `contextlib.suppress(ValueError, OSError)` instead | = help: Replace with `contextlib.suppress(ValueError, OSError)` -SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:117:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | 115 | # Regression test for: https://github.com/astral-sh/ruff/issues/7123 116 | def write_models(directory, Models): @@ -230,7 +230,7 @@ SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try 122 121 | try: os.makedirs(model_dir); 123 122 | except OSError: -SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:122:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | 120 | pass; 121 | @@ -261,7 +261,7 @@ SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try 126 125 | try: os.makedirs(model_dir); 127 126 | except OSError: -SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:126:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | 124 | pass; 125 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap index e7eba1d76e002d..67e13ee2fd6a23 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM105_1.py:5:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +SIM105_1.py:5:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 4 | # SIM105 5 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap index adf563480a1c48..33d9b3270ff19b 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM105_2.py:10:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +SIM105_2.py:10:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 9 | # SIM105 10 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap index 8f221aa111e300..1558a8c3f26488 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM105_4.py:2:1: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass` +SIM105_4.py:2:1: SIM105 [**] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass` | 1 | #!/usr/bin/env python 2 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap index c4aad0339a2597..e6e680041aa087 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block +SIM108.py:2:1: SIM108 [**] Use ternary operator `b = c if a else d` instead of `if`-`else`-block | 1 | # SIM108 2 | / if a: @@ -25,7 +25,7 @@ SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `i 7 4 | # OK 8 5 | b = c if a else d -SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block +SIM108.py:30:5: SIM108 [**] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block | 28 | pass 29 | else: @@ -64,7 +64,7 @@ SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead o | = help: Replace `if`-`else`-block with `abc = x if x > 0 else -x` -SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block +SIM108.py:82:1: SIM108 [**] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block | 81 | # SIM108 82 | / if a: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap index fd8700afbae49a..ff368751e50ddb 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons +SIM109.py:2:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons | 1 | # SIM109 2 | if a == b or a == c: @@ -18,7 +18,7 @@ SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari 4 4 | 5 5 | # SIM109 -SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons +SIM109.py:6:5: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons | 5 | # SIM109 6 | if (a == b or a == c) and None: @@ -37,7 +37,7 @@ SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality compari 8 8 | 9 9 | # SIM109 -SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons +SIM109.py:10:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons | 9 | # SIM109 10 | if a == b or a == c or None: @@ -56,7 +56,7 @@ SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality compar 12 12 | 13 13 | # SIM109 -SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons +SIM109.py:14:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons | 13 | # SIM109 14 | if a == b or None or a == c: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap index 1473e4bfdaab31..04c611b6211c90 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:3:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 1 | def f(): 2 | # SIM110 @@ -26,7 +26,7 @@ SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o 8 5 | 9 6 | def f(): -SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM110.py:25:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 23 | def f(): 24 | # SIM111 @@ -52,7 +52,7 @@ SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 30 27 | 31 28 | def f(): -SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop +SIM110.py:33:5: SIM110 [**] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop | 31 | def f(): 32 | # SIM111 @@ -78,7 +78,7 @@ SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst 38 35 | 39 36 | def f(): -SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:55:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 53 | def f(): 54 | # SIM110 @@ -106,7 +106,7 @@ SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 61 57 | 62 58 | def f(): -SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM110.py:64:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 62 | def f(): 63 | # SIM111 @@ -134,7 +134,7 @@ SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 70 66 | 71 67 | def f(): -SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:73:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 71 | def f(): 72 | # SIM110 @@ -163,7 +163,7 @@ SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 79 75 | 80 76 | -SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM110.py:83:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 81 | def f(): 82 | # SIM111 @@ -218,7 +218,7 @@ SIM110.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead | = help: Replace with `return all(not check(x) for x in iterable)` -SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:144:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 143 | # SIM110 144 | for x in iterable: @@ -243,7 +243,7 @@ SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 149 146 | 150 147 | def f(): -SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM110.py:154:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 153 | # SIM111 154 | for x in iterable: @@ -268,7 +268,7 @@ SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins 159 156 | 160 157 | def f(): -SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop +SIM110.py:162:5: SIM110 [**] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop | 160 | def f(): 161 | # SIM110 @@ -294,7 +294,7 @@ SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ 167 164 | 168 165 | def f(): -SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:184:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 182 | async def f(): 183 | # SIM110 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap index 85c7002246f5de..72708ef64db805 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM111.py:3:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 1 | def f(): 2 | # SIM110 @@ -26,7 +26,7 @@ SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead o 8 5 | 9 6 | def f(): -SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM111.py:25:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 23 | def f(): 24 | # SIM111 @@ -52,7 +52,7 @@ SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 30 27 | 31 28 | def f(): -SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop +SIM111.py:33:5: SIM110 [**] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop | 31 | def f(): 32 | # SIM111 @@ -78,7 +78,7 @@ SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` inst 38 35 | 39 36 | def f(): -SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM111.py:55:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 53 | def f(): 54 | # SIM110 @@ -106,7 +106,7 @@ SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 61 57 | 62 58 | def f(): -SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM111.py:64:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 62 | def f(): 63 | # SIM111 @@ -134,7 +134,7 @@ SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` inst 70 66 | 71 67 | def f(): -SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM111.py:73:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 71 | def f(): 72 | # SIM110 @@ -163,7 +163,7 @@ SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 79 75 | 80 76 | -SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM111.py:83:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 81 | def f(): 82 | # SIM111 @@ -218,7 +218,7 @@ SIM111.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead | = help: Replace with `return all(not check(x) for x in iterable)` -SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM111.py:144:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop | 143 | # SIM110 144 | for x in iterable: @@ -243,7 +243,7 @@ SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead 149 146 | 150 147 | def f(): -SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM111.py:154:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 153 | # SIM111 154 | for x in iterable: @@ -268,7 +268,7 @@ SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` ins 159 156 | 160 157 | def f(): -SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead of `for` loop +SIM111.py:162:5: SIM110 [**] Use `return all(x in y for x in iterable)` instead of `for` loop | 160 | def f(): 161 | # SIM111 @@ -294,7 +294,7 @@ SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead o 167 164 | 168 165 | def f(): -SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead of `for` loop +SIM111.py:170:5: SIM110 [**] Use `return all(x <= y for x in iterable)` instead of `for` loop | 168 | def f(): 169 | # SIM111 @@ -320,7 +320,7 @@ SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead o 175 172 | 176 173 | def f(): -SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` instead of `for` loop +SIM111.py:178:5: SIM110 [**] Use `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` instead of `for` loop | 176 | def f(): 177 | # SIM111 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap index f19564b2160d0f..088585b0898f4a 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` +SIM112.py:4:12: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo` | 3 | # Bad 4 | os.environ['foo'] @@ -65,7 +65,7 @@ SIM112.py:12:22: SIM112 Use capitalized environment variable `FOO` instead of `f | = help: Replace `foo` with `FOO` -SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` +SIM112.py:14:18: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo` | 12 | env = os.environ.get('foo') 13 | @@ -96,7 +96,7 @@ SIM112.py:16:26: SIM112 Use capitalized environment variable `FOO` instead of `f | = help: Replace `foo` with `FOO` -SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` +SIM112.py:19:22: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo` | 17 | pass 18 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap index bbc83f3ed4cd62..3fa77b36d4947a 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:2:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 1 | # SIM117 2 | / with A() as a: @@ -22,7 +22,7 @@ SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts i 6 5 | # SIM117 7 6 | with A(): -SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:7:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 6 | # SIM117 7 | / with A(): @@ -59,7 +59,7 @@ SIM117.py:13:1: SIM117 Use a single `with` statement with multiple contexts inst | = help: Combine `with` statements -SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:19:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 18 | # SIM117 19 | / with A() as a: @@ -85,7 +85,7 @@ SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts 24 23 | # OK 25 24 | with A() as a: -SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:47:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 46 | # SIM117 47 | / async with A() as a: @@ -108,7 +108,7 @@ SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts 51 50 | while True: 52 51 | # SIM117 -SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:53:5: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 51 | while True: 52 | # SIM117 @@ -146,7 +146,7 @@ SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts 66 65 | 67 66 | # SIM117 -SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:68:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 67 | # SIM117 68 | / with ( @@ -173,7 +173,7 @@ SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts 75 74 | # SIM117 76 75 | with A() as a: -SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:76:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 75 | # SIM117 76 | / with A() as a: @@ -205,7 +205,7 @@ SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts 83 82 | # SIM117 84 83 | with ( -SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:84:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 83 | # SIM117 84 | / with ( @@ -239,7 +239,7 @@ SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts 94 91 | # SIM117 (auto-fixable) 95 92 | with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: -SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:95:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 94 | # SIM117 (auto-fixable) 95 | / with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: @@ -284,7 +284,7 @@ SIM117.py:106:5: SIM117 Use a single `with` statement with multiple contexts ins | = help: Combine `with` statements -SIM117.py:126:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:126:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements | 125 | # SIM117 126 | / with A() as a: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap index a95f8029662891..22018f1b504ac9 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM118.py:1:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:1:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 1 | key in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^ SIM118 @@ -17,7 +17,7 @@ SIM118.py:1:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 3 3 | key not in obj.keys() # SIM118 4 4 | -SIM118.py:3:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` +SIM118.py:3:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()` | 1 | key in obj.keys() # SIM118 2 | @@ -37,7 +37,7 @@ SIM118.py:3:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys 5 5 | foo["bar"] in obj.keys() # SIM118 6 6 | -SIM118.py:5:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:5:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 3 | key not in obj.keys() # SIM118 4 | @@ -58,7 +58,7 @@ SIM118.py:5:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 7 7 | foo["bar"] not in obj.keys() # SIM118 8 8 | -SIM118.py:7:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` +SIM118.py:7:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()` | 5 | foo["bar"] in obj.keys() # SIM118 6 | @@ -79,7 +79,7 @@ SIM118.py:7:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys 9 9 | foo['bar'] in obj.keys() # SIM118 10 10 | -SIM118.py:9:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:9:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 7 | foo["bar"] not in obj.keys() # SIM118 8 | @@ -100,7 +100,7 @@ SIM118.py:9:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 11 11 | foo['bar'] not in obj.keys() # SIM118 12 12 | -SIM118.py:11:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` +SIM118.py:11:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()` | 9 | foo['bar'] in obj.keys() # SIM118 10 | @@ -121,7 +121,7 @@ SIM118.py:11:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key 13 13 | foo() in obj.keys() # SIM118 14 14 | -SIM118.py:13:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:13:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 11 | foo['bar'] not in obj.keys() # SIM118 12 | @@ -142,7 +142,7 @@ SIM118.py:13:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 15 15 | foo() not in obj.keys() # SIM118 16 16 | -SIM118.py:15:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` +SIM118.py:15:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()` | 13 | foo() in obj.keys() # SIM118 14 | @@ -163,7 +163,7 @@ SIM118.py:15:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.key 17 17 | for key in obj.keys(): # SIM118 18 18 | pass -SIM118.py:17:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:17:5: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 15 | foo() not in obj.keys() # SIM118 16 | @@ -183,7 +183,7 @@ SIM118.py:17:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 19 19 | 20 20 | for key in list(obj.keys()): -SIM118.py:24:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:24:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 22 | del obj[key] 23 | @@ -204,7 +204,7 @@ SIM118.py:24:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 26 26 | {k for k in obj.keys()} # SIM118 27 27 | -SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:26:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 24 | [k for k in obj.keys()] # SIM118 25 | @@ -225,7 +225,7 @@ SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 28 28 | {k: k for k in obj.keys()} # SIM118 29 29 | -SIM118.py:28:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:28:11: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 26 | {k for k in obj.keys()} # SIM118 27 | @@ -246,7 +246,7 @@ SIM118.py:28:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 30 30 | (k for k in obj.keys()) # SIM118 31 31 | -SIM118.py:30:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:30:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 28 | {k: k for k in obj.keys()} # SIM118 29 | @@ -267,7 +267,7 @@ SIM118.py:30:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 32 32 | key in (obj or {}).keys() # SIM118 33 33 | -SIM118.py:32:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:32:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 30 | (k for k in obj.keys()) # SIM118 31 | @@ -288,7 +288,7 @@ SIM118.py:32:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 34 34 | (key) in (obj or {}).keys() # SIM118 35 35 | -SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:34:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 32 | key in (obj or {}).keys() # SIM118 33 | @@ -309,7 +309,7 @@ SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 36 36 | from typing import KeysView 37 37 | -SIM118.py:48:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:48:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 47 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 48 | key in obj.keys()and foo @@ -329,7 +329,7 @@ SIM118.py:48:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 50 50 | key in (obj.keys())and foo 51 51 | -SIM118.py:49:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:49:2: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 47 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 48 | key in obj.keys()and foo @@ -349,7 +349,7 @@ SIM118.py:49:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 51 51 | 52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 -SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:50:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 48 | key in obj.keys()and foo 49 | (key in obj.keys())and foo @@ -370,7 +370,7 @@ SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` 52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 53 53 | for key in ( -SIM118.py:53:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:53:5: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` | 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 53 | for key in ( diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap index 739679e4deb3c3..ee135fa5e61ca7 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b` +SIM202.py:2:4: SIM202 [**] Use `a == b` instead of `not a != b` | 1 | # SIM202 2 | if not a != b: @@ -18,7 +18,7 @@ SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b` 4 4 | 5 5 | # SIM202 -SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` +SIM202.py:6:4: SIM202 [**] Use `a == b + c` instead of `not a != b + c` | 5 | # SIM202 6 | if not a != (b + c): @@ -37,7 +37,7 @@ SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` 8 8 | 9 9 | # SIM202 -SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` +SIM202.py:10:4: SIM202 [**] Use `a + b == c` instead of `not a + b != c` | 9 | # SIM202 10 | if not (a + b) != c: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap index f1b5030c024dd2..2642af806aa749 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` +SIM208.py:1:4: SIM208 [**] Use `a` instead of `not (not a)` | 1 | if not (not a): # SIM208 | ^^^^^^^^^^^ SIM208 @@ -16,7 +16,7 @@ SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` 3 3 | 4 4 | if not (not (a == b)): # SIM208 -SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` +SIM208.py:4:4: SIM208 [**] Use `a == b` instead of `not (not a == b)` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` 6 6 | 7 7 | if not a: # OK -SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` +SIM208.py:16:5: SIM208 [**] Use `b` instead of `not (not b)` | 14 | pass 15 | @@ -57,7 +57,7 @@ SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` 18 18 | f(not not a) # SIM208 19 19 | -SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` +SIM208.py:18:3: SIM208 [**] Use `a` instead of `not (not a)` | 16 | a = not not b # SIM208 17 | @@ -78,7 +78,7 @@ SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` 20 20 | if 1 + (not (not a)): # SIM208 21 21 | pass -SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` +SIM208.py:20:9: SIM208 [**] Use `a` instead of `not (not a)` | 18 | f(not not a) # SIM208 19 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap index 7f7cfde237e166..5cf1126fcb3d6c 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` +SIM210.py:1:5: SIM210 [**] Use `bool(...)` instead of `True if ... else False` | 1 | a = True if b else False # SIM210 | ^^^^^^^^^^^^^^^^^^^^ SIM210 @@ -17,7 +17,7 @@ SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` 3 3 | a = True if b != c else False # SIM210 4 4 | -SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` +SIM210.py:3:5: SIM210 [**] Remove unnecessary `True if ... else False` | 1 | a = True if b else False # SIM210 2 | @@ -37,7 +37,7 @@ SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` 5 5 | a = True if b + c else False # SIM210 6 6 | -SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` +SIM210.py:5:5: SIM210 [**] Use `bool(...)` instead of `True if ... else False` | 3 | a = True if b != c else False # SIM210 4 | @@ -67,7 +67,7 @@ SIM210.py:15:9: SIM210 Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -SIM210.py:19:11: SIM210 [*] Remove unnecessary `True if ... else False` +SIM210.py:19:11: SIM210 [**] Remove unnecessary `True if ... else False` | 18 | # Regression test for: https://github.com/astral-sh/ruff/issues/7076 19 | samesld = True if (psl.privatesuffix(urlparse(response.url).netloc) == diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap index 359b5384bc06a3..f4e1fb522d568c 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` +SIM211.py:1:5: SIM211 [**] Use `not ...` instead of `False if ... else True` | 1 | a = False if b else True # SIM211 | ^^^^^^^^^^^^^^^^^^^^ SIM211 @@ -17,7 +17,7 @@ SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` 3 3 | a = False if b != c else True # SIM211 4 4 | -SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` +SIM211.py:3:5: SIM211 [**] Use `not ...` instead of `False if ... else True` | 1 | a = False if b else True # SIM211 2 | @@ -37,7 +37,7 @@ SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` 5 5 | a = False if b + c else True # SIM211 6 6 | -SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` +SIM211.py:5:5: SIM211 [**] Use `not ...` instead of `False if ... else True` | 3 | a = False if b != c else True # SIM211 4 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap index 956cc50036d1eb..348bbad9bfe420 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a` +SIM212.py:1:5: SIM212 [**] Use `a if a else b` instead of `b if not a else a` | 1 | c = b if not a else a # SIM212 | ^^^^^^^^^^^^^^^^^ SIM212 @@ -17,7 +17,7 @@ SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a` 3 3 | c = b + c if not a else a # SIM212 4 4 | -SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a else a` +SIM212.py:3:5: SIM212 [**] Use `a if a else b + c` instead of `b + c if not a else a` | 1 | c = b if not a else a # SIM212 2 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap index bf50be10507e3c..03c2374031d428 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` +SIM220.py:1:4: SIM220 [**] Use `False` instead of `a and not a` | 1 | if a and not a: | ^^^^^^^^^^^ SIM220 @@ -16,7 +16,7 @@ SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` 3 3 | 4 4 | if (a and not a) and b: -SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` +SIM220.py:4:5: SIM220 [**] Use `False` instead of `a and not a` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` 6 6 | 7 7 | if (a and not a) or b: -SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` +SIM220.py:7:5: SIM220 [**] Use `False` instead of `a and not a` | 5 | pass 6 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap index cb3d53dfe77227..3472e669bf8a17 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` +SIM221.py:1:4: SIM221 [**] Use `True` instead of `a or not a` | 1 | if a or not a: | ^^^^^^^^^^ SIM221 @@ -16,7 +16,7 @@ SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` 3 3 | 4 4 | if (a or not a) or b: -SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` +SIM221.py:4:5: SIM221 [**] Use `True` instead of `a or not a` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` 6 6 | 7 7 | if (a or not a) and b: -SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` +SIM221.py:7:5: SIM221 [**] Use `True` instead of `a or not a` | 5 | pass 6 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap index 02d93e42fc0398..d07375d8d3298e 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:1:4: SIM222 [**] Use `True` instead of `... or True` | 1 | if a or True: # SIM222 | ^^^^^^^^^ SIM222 @@ -16,7 +16,7 @@ SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` 3 3 | 4 4 | if (a or b) or True: # SIM222 -SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:4:4: SIM222 [**] Use `True` instead of `... or True` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` 6 6 | 7 7 | if a or (b or True): # SIM222 -SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:7:10: SIM222 [**] Use `True` instead of `... or True` | 5 | pass 6 | @@ -56,7 +56,7 @@ SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` 9 9 | 10 10 | if a and True: # OK -SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` +SIM222.py:24:16: SIM222 [**] Use `True` instead of `True or ...` | 22 | pass 23 | @@ -76,7 +76,7 @@ SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` 26 26 | 27 27 | if True or f() or a or g() or b: # SIM222 -SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` +SIM222.py:27:4: SIM222 [**] Use `True` instead of `True or ...` | 25 | pass 26 | @@ -96,7 +96,7 @@ SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` 29 29 | 30 30 | if a or True or f() or b or g(): # SIM222 -SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:30:4: SIM222 [**] Use `True` instead of `... or True or ...` | 28 | pass 29 | @@ -116,7 +116,7 @@ SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` 32 32 | 33 33 | -SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:47:6: SIM222 [**] Use `True` instead of `... or True` | 47 | a or "" or True # SIM222 | ^^^^^^^^^^ SIM222 @@ -135,7 +135,7 @@ SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` 49 49 | a or "foo" or True or "bar" # SIM222 50 50 | -SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` +SIM222.py:49:6: SIM222 [**] Use `"foo"` instead of `"foo" or ...` | 47 | a or "" or True # SIM222 48 | @@ -156,7 +156,7 @@ SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` 51 51 | a or 0 or True # SIM222 52 52 | -SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:51:6: SIM222 [**] Use `True` instead of `... or True` | 49 | a or "foo" or True or "bar" # SIM222 50 | @@ -177,7 +177,7 @@ SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` 53 53 | a or 1 or True or 2 # SIM222 54 54 | -SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` +SIM222.py:53:6: SIM222 [**] Use `1` instead of `1 or ...` | 51 | a or 0 or True # SIM222 52 | @@ -198,7 +198,7 @@ SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` 55 55 | a or 0.0 or True # SIM222 56 56 | -SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:55:6: SIM222 [**] Use `True` instead of `... or True` | 53 | a or 1 or True or 2 # SIM222 54 | @@ -219,7 +219,7 @@ SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` 57 57 | a or 0.1 or True or 0.2 # SIM222 58 58 | -SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` +SIM222.py:57:6: SIM222 [**] Use `0.1` instead of `0.1 or ...` | 55 | a or 0.0 or True # SIM222 56 | @@ -240,7 +240,7 @@ SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` 59 59 | a or [] or True # SIM222 60 60 | -SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:59:6: SIM222 [**] Use `True` instead of `... or True` | 57 | a or 0.1 or True or 0.2 # SIM222 58 | @@ -261,7 +261,7 @@ SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` 61 61 | a or list([]) or True # SIM222 62 62 | -SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:61:6: SIM222 [**] Use `True` instead of `... or True` | 59 | a or [] or True # SIM222 60 | @@ -282,7 +282,7 @@ SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` 63 63 | a or [1] or True or [2] # SIM222 64 64 | -SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` +SIM222.py:63:6: SIM222 [**] Use `[1]` instead of `[1] or ...` | 61 | a or list([]) or True # SIM222 62 | @@ -303,7 +303,7 @@ SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` 65 65 | a or list([1]) or True or list([2]) # SIM222 66 66 | -SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` +SIM222.py:65:6: SIM222 [**] Use `list([1])` instead of `list([1]) or ...` | 63 | a or [1] or True or [2] # SIM222 64 | @@ -324,7 +324,7 @@ SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` 67 67 | a or {} or True # SIM222 68 68 | -SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:67:6: SIM222 [**] Use `True` instead of `... or True` | 65 | a or list([1]) or True or list([2]) # SIM222 66 | @@ -345,7 +345,7 @@ SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` 69 69 | a or dict() or True # SIM222 70 70 | -SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:69:6: SIM222 [**] Use `True` instead of `... or True` | 67 | a or {} or True # SIM222 68 | @@ -366,7 +366,7 @@ SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` 71 71 | a or {1: 1} or True or {2: 2} # SIM222 72 72 | -SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` +SIM222.py:71:6: SIM222 [**] Use `{1: 1}` instead of `{1: 1} or ...` | 69 | a or dict() or True # SIM222 70 | @@ -387,7 +387,7 @@ SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` 73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 74 | -SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` +SIM222.py:73:6: SIM222 [**] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | 71 | a or {1: 1} or True or {2: 2} # SIM222 72 | @@ -408,7 +408,7 @@ SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` 75 75 | a or set() or True # SIM222 76 76 | -SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:75:6: SIM222 [**] Use `True` instead of `... or True` | 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 | @@ -429,7 +429,7 @@ SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` 77 77 | a or set(set()) or True # SIM222 78 78 | -SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:77:6: SIM222 [**] Use `True` instead of `... or True` | 75 | a or set() or True # SIM222 76 | @@ -450,7 +450,7 @@ SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` 79 79 | a or {1} or True or {2} # SIM222 80 80 | -SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` +SIM222.py:79:6: SIM222 [**] Use `{1}` instead of `{1} or ...` | 77 | a or set(set()) or True # SIM222 78 | @@ -471,7 +471,7 @@ SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` 81 81 | a or set({1}) or True or set({2}) # SIM222 82 82 | -SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` +SIM222.py:81:6: SIM222 [**] Use `set({1})` instead of `set({1}) or ...` | 79 | a or {1} or True or {2} # SIM222 80 | @@ -492,7 +492,7 @@ SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` 83 83 | a or () or True # SIM222 84 84 | -SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:83:6: SIM222 [**] Use `True` instead of `... or True` | 81 | a or set({1}) or True or set({2}) # SIM222 82 | @@ -513,7 +513,7 @@ SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` 85 85 | a or tuple(()) or True # SIM222 86 86 | -SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:85:6: SIM222 [**] Use `True` instead of `... or True` | 83 | a or () or True # SIM222 84 | @@ -534,7 +534,7 @@ SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` 87 87 | a or (1,) or True or (2,) # SIM222 88 88 | -SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` +SIM222.py:87:6: SIM222 [**] Use `(1,)` instead of `(1,) or ...` | 85 | a or tuple(()) or True # SIM222 86 | @@ -555,7 +555,7 @@ SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` 89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 90 | -SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` +SIM222.py:89:6: SIM222 [**] Use `tuple((1,))` instead of `tuple((1,)) or ...` | 87 | a or (1,) or True or (2,) # SIM222 88 | @@ -576,7 +576,7 @@ SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` 91 91 | a or frozenset() or True # SIM222 92 92 | -SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:91:6: SIM222 [**] Use `True` instead of `... or True` | 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 | @@ -597,7 +597,7 @@ SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` 93 93 | a or frozenset(frozenset()) or True # SIM222 94 94 | -SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` +SIM222.py:93:6: SIM222 [**] Use `True` instead of `... or True` | 91 | a or frozenset() or True # SIM222 92 | @@ -618,7 +618,7 @@ SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` 95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 96 | -SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or ...` +SIM222.py:95:6: SIM222 [**] Use `frozenset({1})` instead of `frozenset({1}) or ...` | 93 | a or frozenset(frozenset()) or True # SIM222 94 | @@ -639,7 +639,7 @@ SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or .. 97 97 | a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222 98 98 | -SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` +SIM222.py:97:6: SIM222 [**] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` | 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 | @@ -658,7 +658,7 @@ SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset 99 99 | 100 100 | # Inside test `a` is simplified. -SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:102:6: SIM222 [**] Use `True` instead of `... or True or ...` | 100 | # Inside test `a` is simplified. 101 | @@ -679,7 +679,7 @@ SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | -SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:104:8: SIM222 [**] Use `True` instead of `... or True or ...` | 102 | bool(a or [1] or True or [2]) # SIM222 103 | @@ -700,7 +700,7 @@ SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` 106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 107 107 | pass -SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:106:5: SIM222 [**] Use `True` instead of `... or True or ...` | 104 | assert a or [1] or True or [2] # SIM222 105 | @@ -720,7 +720,7 @@ SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 -SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:106:35: SIM222 [**] Use `True` instead of `... or True or ...` | 104 | assert a or [1] or True or [2] # SIM222 105 | @@ -740,7 +740,7 @@ SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 -SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:109:6: SIM222 [**] Use `True` instead of `... or True or ...` | 107 | pass 108 | @@ -761,7 +761,7 @@ SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` 111 111 | while a or [1] or True or [2]: # SIM222 112 112 | pass -SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:111:7: SIM222 [**] Use `True` instead of `... or True or ...` | 109 | 0 if a or [1] or True or [2] else 1 # SIM222 110 | @@ -781,7 +781,7 @@ SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` 113 113 | 114 114 | [ -SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:118:8: SIM222 [**] Use `True` instead of `... or True or ...` | 116 | for a in range(10) 117 | for b in range(10) @@ -802,7 +802,7 @@ SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` 120 120 | ] 121 121 | -SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:119:8: SIM222 [**] Use `True` instead of `... or True or ...` | 117 | for b in range(10) 118 | if a or [1] or True or [2] # SIM222 @@ -822,7 +822,7 @@ SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` 121 121 | 122 122 | { -SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:126:8: SIM222 [**] Use `True` instead of `... or True or ...` | 124 | for a in range(10) 125 | for b in range(10) @@ -843,7 +843,7 @@ SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` 128 128 | } 129 129 | -SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:127:8: SIM222 [**] Use `True` instead of `... or True or ...` | 125 | for b in range(10) 126 | if a or [1] or True or [2] # SIM222 @@ -863,7 +863,7 @@ SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` 129 129 | 130 130 | { -SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:134:8: SIM222 [**] Use `True` instead of `... or True or ...` | 132 | for a in range(10) 133 | for b in range(10) @@ -884,7 +884,7 @@ SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` 136 136 | } 137 137 | -SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:135:8: SIM222 [**] Use `True` instead of `... or True or ...` | 133 | for b in range(10) 134 | if a or [1] or True or [2] # SIM222 @@ -904,7 +904,7 @@ SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` 137 137 | 138 138 | ( -SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:142:8: SIM222 [**] Use `True` instead of `... or True or ...` | 140 | for a in range(10) 141 | for b in range(10) @@ -925,7 +925,7 @@ SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` 144 144 | ) 145 145 | -SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` +SIM222.py:143:8: SIM222 [**] Use `True` instead of `... or True or ...` | 141 | for b in range(10) 142 | if a or [1] or True or [2] # SIM222 @@ -945,7 +945,7 @@ SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` 145 145 | 146 146 | # Outside test `a` is not simplified. -SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` +SIM222.py:148:6: SIM222 [**] Use `[1]` instead of `[1] or ...` | 146 | # Outside test `a` is not simplified. 147 | @@ -966,7 +966,7 @@ SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` 150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 151 151 | pass -SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` +SIM222.py:150:10: SIM222 [**] Use `[1]` instead of `[1] or ...` | 148 | a or [1] or True or [2] # SIM222 149 | @@ -986,7 +986,7 @@ SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` 152 152 | 153 153 | if f(a or [1] or True or [2]): # SIM222 -SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` +SIM222.py:153:11: SIM222 [**] Use `[1]` instead of `[1] or ...` | 151 | pass 152 | @@ -1006,7 +1006,7 @@ SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` 155 155 | 156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 -SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...` +SIM222.py:157:30: SIM222 [**] Use `(int, int, int)` instead of `(int, int, int) or ...` | 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 157 | def secondToTime(s0: int) -> (int, int, int) or str: @@ -1025,7 +1025,7 @@ SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) o 159 159 | 160 160 | -SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...` +SIM222.py:161:31: SIM222 [**] Use `(int, int, int)` instead of `(int, int, int) or ...` | 161 | def secondToTime(s0: int) -> ((int, int, int) or str): | ^^^^^^^^^^^^^^^^^^^^^^ SIM222 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap index 4454bf48517976..aecc64139fdbaa 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` +SIM223.py:1:4: SIM223 [**] Use `False` instead of `... and False` | 1 | if a and False: # SIM223 | ^^^^^^^^^^^ SIM223 @@ -16,7 +16,7 @@ SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` 3 3 | 4 4 | if (a or b) and False: # SIM223 -SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` +SIM223.py:4:4: SIM223 [**] Use `False` instead of `... and False` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` 6 6 | 7 7 | if a or (b and False): # SIM223 -SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` +SIM223.py:7:10: SIM223 [**] Use `False` instead of `... and False` | 5 | pass 6 | @@ -56,7 +56,7 @@ SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` 9 9 | 10 10 | if a or False: -SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` +SIM223.py:19:18: SIM223 [**] Use `False` instead of `False and ...` | 17 | pass 18 | @@ -76,7 +76,7 @@ SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` 21 21 | 22 22 | if False and f() and a and g() and b: # SIM223 -SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` +SIM223.py:22:4: SIM223 [**] Use `False` instead of `False and ...` | 20 | pass 21 | @@ -96,7 +96,7 @@ SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` 24 24 | 25 25 | if a and False and f() and b and g(): # SIM223 -SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:25:4: SIM223 [**] Use `False` instead of `... and False and ...` | 23 | pass 24 | @@ -116,7 +116,7 @@ SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` 27 27 | 28 28 | -SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` +SIM223.py:42:7: SIM223 [**] Use `""` instead of `"" and ...` | 42 | a and "" and False # SIM223 | ^^^^^^^^^^^^ SIM223 @@ -135,7 +135,7 @@ SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` 44 44 | a and "foo" and False and "bar" # SIM223 45 45 | -SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:44:7: SIM223 [**] Use `False` instead of `... and False and ...` | 42 | a and "" and False # SIM223 43 | @@ -156,7 +156,7 @@ SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` 46 46 | a and 0 and False # SIM223 47 47 | -SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` +SIM223.py:46:7: SIM223 [**] Use `0` instead of `0 and ...` | 44 | a and "foo" and False and "bar" # SIM223 45 | @@ -177,7 +177,7 @@ SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` 48 48 | a and 1 and False and 2 # SIM223 49 49 | -SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:48:7: SIM223 [**] Use `False` instead of `... and False and ...` | 46 | a and 0 and False # SIM223 47 | @@ -198,7 +198,7 @@ SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` 50 50 | a and 0.0 and False # SIM223 51 51 | -SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` +SIM223.py:50:7: SIM223 [**] Use `0.0` instead of `0.0 and ...` | 48 | a and 1 and False and 2 # SIM223 49 | @@ -219,7 +219,7 @@ SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` 52 52 | a and 0.1 and False and 0.2 # SIM223 53 53 | -SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:52:7: SIM223 [**] Use `False` instead of `... and False and ...` | 50 | a and 0.0 and False # SIM223 51 | @@ -240,7 +240,7 @@ SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` 54 54 | a and [] and False # SIM223 55 55 | -SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` +SIM223.py:54:7: SIM223 [**] Use `[]` instead of `[] and ...` | 52 | a and 0.1 and False and 0.2 # SIM223 53 | @@ -261,7 +261,7 @@ SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` 56 56 | a and list([]) and False # SIM223 57 57 | -SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` +SIM223.py:56:7: SIM223 [**] Use `list([])` instead of `list([]) and ...` | 54 | a and [] and False # SIM223 55 | @@ -282,7 +282,7 @@ SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` 58 58 | a and [1] and False and [2] # SIM223 59 59 | -SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:58:7: SIM223 [**] Use `False` instead of `... and False and ...` | 56 | a and list([]) and False # SIM223 57 | @@ -303,7 +303,7 @@ SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` 60 60 | a and list([1]) and False and list([2]) # SIM223 61 61 | -SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:60:7: SIM223 [**] Use `False` instead of `... and False and ...` | 58 | a and [1] and False and [2] # SIM223 59 | @@ -324,7 +324,7 @@ SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` 62 62 | a and {} and False # SIM223 63 63 | -SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` +SIM223.py:62:7: SIM223 [**] Use `{}` instead of `{} and ...` | 60 | a and list([1]) and False and list([2]) # SIM223 61 | @@ -345,7 +345,7 @@ SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` 64 64 | a and dict() and False # SIM223 65 65 | -SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` +SIM223.py:64:7: SIM223 [**] Use `dict()` instead of `dict() and ...` | 62 | a and {} and False # SIM223 63 | @@ -366,7 +366,7 @@ SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` 66 66 | a and {1: 1} and False and {2: 2} # SIM223 67 67 | -SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:66:7: SIM223 [**] Use `False` instead of `... and False and ...` | 64 | a and dict() and False # SIM223 65 | @@ -387,7 +387,7 @@ SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` 68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 69 | -SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:68:7: SIM223 [**] Use `False` instead of `... and False and ...` | 66 | a and {1: 1} and False and {2: 2} # SIM223 67 | @@ -408,7 +408,7 @@ SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` 70 70 | a and set() and False # SIM223 71 71 | -SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` +SIM223.py:70:7: SIM223 [**] Use `set()` instead of `set() and ...` | 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 | @@ -429,7 +429,7 @@ SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` 72 72 | a and set(set()) and False # SIM223 73 73 | -SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` +SIM223.py:72:7: SIM223 [**] Use `set(set())` instead of `set(set()) and ...` | 70 | a and set() and False # SIM223 71 | @@ -450,7 +450,7 @@ SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` 74 74 | a and {1} and False and {2} # SIM223 75 75 | -SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:74:7: SIM223 [**] Use `False` instead of `... and False and ...` | 72 | a and set(set()) and False # SIM223 73 | @@ -471,7 +471,7 @@ SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` 76 76 | a and set({1}) and False and set({2}) # SIM223 77 77 | -SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:76:7: SIM223 [**] Use `False` instead of `... and False and ...` | 74 | a and {1} and False and {2} # SIM223 75 | @@ -492,7 +492,7 @@ SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` 78 78 | a and () and False # SIM222 79 79 | -SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` +SIM223.py:78:7: SIM223 [**] Use `()` instead of `() and ...` | 76 | a and set({1}) and False and set({2}) # SIM223 77 | @@ -513,7 +513,7 @@ SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` 80 80 | a and tuple(()) and False # SIM222 81 81 | -SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` +SIM223.py:80:7: SIM223 [**] Use `tuple(())` instead of `tuple(()) and ...` | 78 | a and () and False # SIM222 79 | @@ -534,7 +534,7 @@ SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` 82 82 | a and (1,) and False and (2,) # SIM222 83 83 | -SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:82:7: SIM223 [**] Use `False` instead of `... and False and ...` | 80 | a and tuple(()) and False # SIM222 81 | @@ -555,7 +555,7 @@ SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` 84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 85 | -SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:84:7: SIM223 [**] Use `False` instead of `... and False and ...` | 82 | a and (1,) and False and (2,) # SIM222 83 | @@ -576,7 +576,7 @@ SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` 86 86 | a and frozenset() and False # SIM222 87 87 | -SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` +SIM223.py:86:7: SIM223 [**] Use `frozenset()` instead of `frozenset() and ...` | 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 | @@ -597,7 +597,7 @@ SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` 88 88 | a and frozenset(frozenset()) and False # SIM222 89 89 | -SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` +SIM223.py:88:7: SIM223 [**] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` | 86 | a and frozenset() and False # SIM222 87 | @@ -618,7 +618,7 @@ SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(fr 90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 91 | -SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:90:7: SIM223 [**] Use `False` instead of `... and False and ...` | 88 | a and frozenset(frozenset()) and False # SIM222 89 | @@ -639,7 +639,7 @@ SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` 92 92 | a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222 93 93 | -SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:92:7: SIM223 [**] Use `False` instead of `... and False and ...` | 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 | @@ -658,7 +658,7 @@ SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` 94 94 | 95 95 | # Inside test `a` is simplified. -SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:97:6: SIM223 [**] Use `False` instead of `... and False and ...` | 95 | # Inside test `a` is simplified. 96 | @@ -679,7 +679,7 @@ SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` 99 99 | assert a and [] and False and [] # SIM223 100 100 | -SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:99:8: SIM223 [**] Use `False` instead of `... and False and ...` | 97 | bool(a and [] and False and []) # SIM223 98 | @@ -700,7 +700,7 @@ SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` 101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 102 102 | pass -SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:101:5: SIM223 [**] Use `False` instead of `... and False and ...` | 99 | assert a and [] and False and [] # SIM223 100 | @@ -720,7 +720,7 @@ SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 -SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:101:36: SIM223 [**] Use `False` instead of `... and False and ...` | 99 | assert a and [] and False and [] # SIM223 100 | @@ -740,7 +740,7 @@ SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 -SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:104:6: SIM223 [**] Use `False` instead of `... and False and ...` | 102 | pass 103 | @@ -761,7 +761,7 @@ SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` 106 106 | while a and [] and False and []: # SIM223 107 107 | pass -SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:106:7: SIM223 [**] Use `False` instead of `... and False and ...` | 104 | 0 if a and [] and False and [] else 1 # SIM222 105 | @@ -781,7 +781,7 @@ SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` 108 108 | 109 109 | [ -SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:113:8: SIM223 [**] Use `False` instead of `... and False and ...` | 111 | for a in range(10) 112 | for b in range(10) @@ -802,7 +802,7 @@ SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` 115 115 | ] 116 116 | -SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:114:8: SIM223 [**] Use `False` instead of `... and False and ...` | 112 | for b in range(10) 113 | if a and [] and False and [] # SIM223 @@ -822,7 +822,7 @@ SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` 116 116 | 117 117 | { -SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:121:8: SIM223 [**] Use `False` instead of `... and False and ...` | 119 | for a in range(10) 120 | for b in range(10) @@ -843,7 +843,7 @@ SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` 123 123 | } 124 124 | -SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:122:8: SIM223 [**] Use `False` instead of `... and False and ...` | 120 | for b in range(10) 121 | if a and [] and False and [] # SIM223 @@ -863,7 +863,7 @@ SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` 124 124 | 125 125 | { -SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:129:8: SIM223 [**] Use `False` instead of `... and False and ...` | 127 | for a in range(10) 128 | for b in range(10) @@ -884,7 +884,7 @@ SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` 131 131 | } 132 132 | -SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:130:8: SIM223 [**] Use `False` instead of `... and False and ...` | 128 | for b in range(10) 129 | if a and [] and False and [] # SIM223 @@ -904,7 +904,7 @@ SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` 132 132 | 133 133 | ( -SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:137:8: SIM223 [**] Use `False` instead of `... and False and ...` | 135 | for a in range(10) 136 | for b in range(10) @@ -925,7 +925,7 @@ SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` 139 139 | ) 140 140 | -SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` +SIM223.py:138:8: SIM223 [**] Use `False` instead of `... and False and ...` | 136 | for b in range(10) 137 | if a and [] and False and [] # SIM223 @@ -945,7 +945,7 @@ SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` 140 140 | 141 141 | # Outside test `a` is not simplified. -SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` +SIM223.py:143:7: SIM223 [**] Use `[]` instead of `[] and ...` | 141 | # Outside test `a` is not simplified. 142 | @@ -966,7 +966,7 @@ SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` 145 145 | if (a and [] and False and []) == (a and []): # SIM223 146 146 | pass -SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` +SIM223.py:145:11: SIM223 [**] Use `[]` instead of `[] and ...` | 143 | a and [] and False and [] # SIM223 144 | @@ -986,7 +986,7 @@ SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` 147 147 | 148 148 | if f(a and [] and False and []): # SIM223 -SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` +SIM223.py:148:12: SIM223 [**] Use `[]` instead of `[] and ...` | 146 | pass 147 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap index 8c5f552fbc65d6..7e621dbfc1815c 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM401.py:6:1: SIM401 [*] Use `var = a_dict.get(key, "default1")` instead of an `if` block +SIM401.py:6:1: SIM401 [**] Use `var = a_dict.get(key, "default1")` instead of an `if` block | 5 | # SIM401 (pattern-1) 6 | / if key in a_dict: @@ -27,7 +27,7 @@ SIM401.py:6:1: SIM401 [*] Use `var = a_dict.get(key, "default1")` instead of an 11 8 | # SIM401 (pattern-2) 12 9 | if key not in a_dict: -SIM401.py:12:1: SIM401 [*] Use `var = a_dict.get(key, "default2")` instead of an `if` block +SIM401.py:12:1: SIM401 [**] Use `var = a_dict.get(key, "default2")` instead of an `if` block | 11 | # SIM401 (pattern-2) 12 | / if key not in a_dict: @@ -53,7 +53,7 @@ SIM401.py:12:1: SIM401 [*] Use `var = a_dict.get(key, "default2")` instead of an 17 14 | # OK (default contains effect) 18 15 | if key in a_dict: -SIM401.py:24:1: SIM401 [*] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block +SIM401.py:24:1: SIM401 [**] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block | 23 | # SIM401 (complex expression in key) 24 | / if keys[idx] in a_dict: @@ -79,7 +79,7 @@ SIM401.py:24:1: SIM401 [*] Use `var = a_dict.get(keys[idx], "default")` instead 29 26 | # SIM401 (complex expression in dict) 30 27 | if key in dicts[idx]: -SIM401.py:30:1: SIM401 [*] Use `var = dicts[idx].get(key, "default")` instead of an `if` block +SIM401.py:30:1: SIM401 [**] Use `var = dicts[idx].get(key, "default")` instead of an `if` block | 29 | # SIM401 (complex expression in dict) 30 | / if key in dicts[idx]: @@ -105,7 +105,7 @@ SIM401.py:30:1: SIM401 [*] Use `var = dicts[idx].get(key, "default")` instead of 35 32 | # SIM401 (complex expression in var) 36 33 | if key in a_dict: -SIM401.py:36:1: SIM401 [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789")` instead of an `if` block +SIM401.py:36:1: SIM401 [**] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789")` instead of an `if` block | 35 | # SIM401 (complex expression in var) 36 | / if key in a_dict: @@ -131,7 +131,7 @@ SIM401.py:36:1: SIM401 [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6 41 38 | # SIM401 42 39 | if foo(): -SIM401.py:45:5: SIM401 [*] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block +SIM401.py:45:5: SIM401 [**] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block | 43 | pass 44 | else: diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap index db5e80f0a7bc45..62d9b1f21a2704 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap @@ -12,7 +12,7 @@ application.py:5:1: TID252 Relative imports from parent modules are banned | = help: Replace relative imports from parent modules with absolute imports -application.py:6:1: TID252 [*] Relative imports from parent modules are banned +application.py:6:1: TID252 [**] Relative imports from parent modules are banned | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -32,7 +32,7 @@ application.py:6:1: TID252 [*] Relative imports from parent modules are banned 8 8 | from .. import server 9 9 | from . import logger, models -application.py:6:1: TID252 [*] Relative imports from parent modules are banned +application.py:6:1: TID252 [**] Relative imports from parent modules are banned | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -52,7 +52,7 @@ application.py:6:1: TID252 [*] Relative imports from parent modules are banned 8 8 | from .. import server 9 9 | from . import logger, models -application.py:6:1: TID252 [*] Relative imports from parent modules are banned +application.py:6:1: TID252 [**] Relative imports from parent modules are banned | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -72,7 +72,7 @@ application.py:6:1: TID252 [*] Relative imports from parent modules are banned 8 8 | from .. import server 9 9 | from . import logger, models -application.py:7:1: TID252 [*] Relative imports from parent modules are banned +application.py:7:1: TID252 [**] Relative imports from parent modules are banned | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -93,7 +93,7 @@ application.py:7:1: TID252 [*] Relative imports from parent modules are banned 9 9 | from . import logger, models 10 10 | from ..protocol.UpperCaseModule import some_function -application.py:8:1: TID252 [*] Relative imports from parent modules are banned +application.py:8:1: TID252 [**] Relative imports from parent modules are banned | 6 | from ..protocol import commands, definitions, responses 7 | from ..server import example @@ -113,7 +113,7 @@ application.py:8:1: TID252 [*] Relative imports from parent modules are banned 9 9 | from . import logger, models 10 10 | from ..protocol.UpperCaseModule import some_function -application.py:10:1: TID252 [*] Relative imports from parent modules are banned +application.py:10:1: TID252 [**] Relative imports from parent modules are banned | 8 | from .. import server 9 | from . import logger, models diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap index e80bedfc54de90..38efb07aeb4971 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -exempt_modules.py:14:12: TCH002 [*] Move third-party import `flask` into a type-checking block +exempt_modules.py:14:12: TCH002 [**] Move third-party import `flask` into a type-checking block | 13 | def f(): 14 | import flask diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap index 1b427e0f3a0851..cba1ab76cbb8be 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:5:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +:5:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block | 4 | from pandas import ( 5 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap index ac5b0d17f97c55..7780df061523bd 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:7:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +:7:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap index 4256b3199e1cef..56c08f0a1c507e 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:7:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +:7:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame @@ -29,7 +29,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 11 13 | def f(x: DataFrame, y: Series): 12 14 | pass -:8:5: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block +:8:5: TCH002 [**] Move third-party import `pandas.Series` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap index c293b6fe552cb8..2ad2c7c0521d70 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:8: TCH003 [*] Move standard library import `os` into a type-checking block +:6:8: TCH003 [**] Move standard library import `os` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | @@ -25,7 +25,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 11 | def f(x: os, y: pandas): 9 12 | pass -:6:12: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:12: TCH002 [**] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap index fa23f5d87a8478..0d8c2c4fe86dd4 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:8: TCH003 [*] Move standard library import `os` into a type-checking block +:6:8: TCH003 [**] Move standard library import `os` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | @@ -24,7 +24,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 10 | def f(x: os, y: sys): 9 11 | pass -:6:12: TCH003 [*] Move standard library import `sys` into a type-checking block +:6:12: TCH003 [**] Move standard library import `sys` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap index 16a94fdcad49cf..a4b8dda5ca0d98 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:4:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:4:18: TCH002 [**] Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations 3 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap index ce1d06b0cfa7f7..9730b3f358bcd5 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_1.py:4:26: TCH004 [*] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting. +TCH004_1.py:4:26: TCH004 [**] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from datetime import datetime diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap index 66a8bb5b574e02..a08f402c3dff89 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_11.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TCH004_11.py:4:24: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap index 2e6d2751e9ba56..23fcfab5ac807b 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_12.py:6:33: TCH004 [*] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. +TCH004_12.py:6:33: TCH004 [**] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. | 5 | if TYPE_CHECKING: 6 | from collections.abc import Callable diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap index b2090156ef9b68..f429eb190d1cdd 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_2.py:4:26: TCH004 [*] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting. +TCH004_2.py:4:26: TCH004 [**] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from datetime import date diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap index 1a3ecb0c2cf348..cd6eb25d5d6fbe 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_4.py:4:24: TCH004 [*] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting. +TCH004_4.py:4:24: TCH004 [**] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Any diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap index 4bded770e5b7d5..7e76ac7e8b5e06 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TCH004_5.py:4:24: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set @@ -20,7 +20,7 @@ TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking bloc 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): -TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. +TCH004_5.py:4:30: TCH004 [**] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set @@ -39,7 +39,7 @@ TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): -TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. +TCH004_5.py:4:40: TCH004 [**] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap index 3af36dde409ab0..090725192c9c3a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. +TCH004_9.py:4:24: TCH004 [**] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict @@ -22,7 +22,7 @@ TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking blo 6 7 | x: Tuple 7 8 | -TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TCH004_9.py:4:31: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap index 263990b605feda..e8bd62a5573a62 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:10:12: TCH004 [**] Move import `datetime` out of type-checking block. Import is used for more than type hinting. | 9 | if TYPE_CHECKING: 10 | import datetime # TCH004 @@ -22,7 +22,7 @@ runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out 12 12 | 13 13 | import pandas # TCH004 -runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:11:23: TCH004 [**] Move import `array.array` out of type-checking block. Import is used for more than type hinting. | 9 | if TYPE_CHECKING: 10 | import datetime # TCH004 @@ -46,7 +46,7 @@ runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` 13 13 | import pandas # TCH004 14 14 | import pyproj -runtime_evaluated_base_classes_1.py:13:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:13:12: TCH004 [**] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | 11 | from array import array # TCH004 12 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap index c472d3f9d84b44..1de54e8835307d 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:12:12: TCH004 [**] Move import `datetime` out of type-checking block. Import is used for more than type hinting. | 11 | if TYPE_CHECKING: 12 | import datetime # TCH004 @@ -22,7 +22,7 @@ runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out o 14 14 | 15 15 | import pandas # TCH004 -runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:13:23: TCH004 [**] Move import `array.array` out of type-checking block. Import is used for more than type hinting. | 11 | if TYPE_CHECKING: 12 | import datetime # TCH004 @@ -46,7 +46,7 @@ runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` ou 15 15 | import pandas # TCH004 16 16 | import pyproj -runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:15:12: TCH004 [**] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | 13 | from array import array # TCH004 14 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict.snap index 835a51bce361ca..fb86ccfd84dd34 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -strict.py:27:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking block +strict.py:27:21: TCH002 [**] Move third-party import `pkg.A` into a type-checking block | 25 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 26 | import pkg @@ -30,7 +30,7 @@ strict.py:27:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking 29 32 | def test(value: A): 30 33 | return pkg.B() -strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking block +strict.py:35:21: TCH002 [**] Move third-party import `pkg.A` into a type-checking block | 33 | def f(): 34 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. @@ -60,7 +60,7 @@ strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking 37 41 | def test(value: A): 38 42 | return B() -strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-checking block +strict.py:54:25: TCH002 [**] Move third-party import `pkg.bar.A` into a type-checking block | 52 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime 53 | import pkg @@ -89,7 +89,7 @@ strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-chec 56 59 | def test(value: A): 57 60 | return pkg.B() -strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking block +strict.py:62:12: TCH002 [**] Move third-party import `pkg` into a type-checking block | 60 | def f(): 61 | # In un-strict mode, this shouldn't raise an error, since `pkg.bar` is used at runtime. @@ -117,7 +117,7 @@ strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 64 67 | 65 68 | def test(value: pkg.A): -strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block +strict.py:71:23: TCH002 [**] Move third-party import `pkg.foo` into a type-checking block | 69 | def f(): 70 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. @@ -145,7 +145,7 @@ strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checki 73 76 | 74 77 | def test(value: F.Foo): -strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking block +strict.py:80:12: TCH002 [**] Move third-party import `pkg` into a type-checking block | 78 | def f(): 79 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. @@ -173,7 +173,7 @@ strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 82 85 | 83 86 | def test(value: pkg.A): -strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking block +strict.py:91:12: TCH002 [**] Move third-party import `pkg` into a type-checking block | 89 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is 90 | # testing the implementation. @@ -201,7 +201,7 @@ strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 93 96 | 94 97 | def test(value: pkg.A): -strict.py:101:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block +strict.py:101:23: TCH002 [**] Move third-party import `pkg.foo` into a type-checking block | 99 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 100 | import pkg.bar as B diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap index f97e331017f9e0..11ad5c07d9cba3 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap index d554a00b1621a3..307c8de85f3e9b 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap index 027b2a6826b09b..244270feda3061 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap index 60a5c92f63d5b7..8e5df1614ef24d 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap index 8a486f94ba8d17..4afe967b32bc18 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH001.py:20:19: TCH001 [*] Move application import `.TYP001` into a type-checking block +TCH001.py:20:19: TCH001 [**] Move application import `.TYP001` into a type-checking block | 19 | def f(): 20 | from . import TYP001 diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap index f1e2a0bfe2f664..3bc3fa77b9acd5 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH003.py:8:12: TCH003 [*] Move standard library import `os` into a type-checking block +TCH003.py:8:12: TCH003 [**] Move standard library import `os` into a type-checking block | 7 | def f(): 8 | import os diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap index 8e151b89dab2bb..ab3abd21a4744f 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_base_classes_3.py:5:18: TCH003 [*] Move standard library import `uuid.UUID` into a type-checking block +runtime_evaluated_base_classes_3.py:5:18: TCH003 [**] Move standard library import `uuid.UUID` into a type-checking block | 3 | import datetime 4 | import pathlib diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap index 99dade0f9976cc..aa680d7ea3970a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_decorators_3.py:6:18: TCH003 [*] Move standard library import `uuid.UUID` into a type-checking block +runtime_evaluated_decorators_3.py:6:18: TCH003 [**] Move standard library import `uuid.UUID` into a type-checking block | 4 | from array import array 5 | from dataclasses import dataclass diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap index 5f1ea76784cf13..f82ba61f9ba26f 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH002.py:5:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +TCH002.py:5:22: TCH002 [**] Move third-party import `pandas` into a type-checking block | 4 | def f(): 5 | import pandas as pd # TCH002 @@ -25,7 +25,7 @@ TCH002.py:5:22: TCH002 [*] Move third-party import `pandas` into a type-checking 7 10 | x: pd.DataFrame 8 11 | -TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +TCH002.py:11:24: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block | 10 | def f(): 11 | from pandas import DataFrame # TCH002 @@ -53,7 +53,7 @@ TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 13 16 | x: DataFrame 14 17 | -TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +TCH002.py:17:37: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block | 16 | def f(): 17 | from pandas import DataFrame as df # TCH002 @@ -81,7 +81,7 @@ TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 19 22 | x: df 20 23 | -TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +TCH002.py:23:22: TCH002 [**] Move third-party import `pandas` into a type-checking block | 22 | def f(): 23 | import pandas as pd # TCH002 @@ -109,7 +109,7 @@ TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 25 28 | x: pd.DataFrame = 1 26 29 | -TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +TCH002.py:29:24: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block | 28 | def f(): 29 | from pandas import DataFrame # TCH002 @@ -137,7 +137,7 @@ TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 31 34 | x: DataFrame = 2 32 35 | -TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +TCH002.py:35:37: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block | 34 | def f(): 35 | from pandas import DataFrame as df # TCH002 @@ -165,7 +165,7 @@ TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 37 40 | x: df = 3 38 41 | -TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +TCH002.py:41:22: TCH002 [**] Move third-party import `pandas` into a type-checking block | 40 | def f(): 41 | import pandas as pd # TCH002 @@ -193,7 +193,7 @@ TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 43 46 | x: "pd.DataFrame" = 1 44 47 | -TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +TCH002.py:47:22: TCH002 [**] Move third-party import `pandas` into a type-checking block | 46 | def f(): 47 | import pandas as pd # TCH002 @@ -221,7 +221,7 @@ TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 49 52 | x = dict["pd.DataFrame", "pd.DataFrame"] 50 53 | -TCH002.py:172:24: TCH002 [*] Move third-party import `module.Member` into a type-checking block +TCH002.py:172:24: TCH002 [**] Move third-party import `module.Member` into a type-checking block | 170 | global Member 171 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap index ac865d383c7747..a51fa68aa2609d 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_base_classes_2.py:3:21: TCH002 [*] Move third-party import `geopandas` into a type-checking block +runtime_evaluated_base_classes_2.py:3:21: TCH002 [**] Move third-party import `geopandas` into a type-checking block | 1 | from __future__ import annotations 2 | @@ -29,7 +29,7 @@ runtime_evaluated_base_classes_2.py:3:21: TCH002 [*] Move third-party import `ge 10 13 | 11 14 | class A(BaseModel): -runtime_evaluated_base_classes_2.py:5:8: TCH002 [*] Move third-party import `pyproj` into a type-checking block +runtime_evaluated_base_classes_2.py:5:8: TCH002 [**] Move third-party import `pyproj` into a type-checking block | 3 | import geopandas as gpd # TCH002 4 | import pydantic diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap index dafbc94d64aa82..ec04ff48847e33 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_decorators_2.py:10:8: TCH002 [*] Move third-party import `numpy` into a type-checking block +runtime_evaluated_decorators_2.py:10:8: TCH002 [**] Move third-party import `numpy` into a type-checking block | 8 | from attrs import frozen 9 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap index 496d0f55877f31..d98282d1feda99 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-checking block +strict.py:54:25: TCH002 [**] Move third-party import `pkg.bar.A` into a type-checking block | 52 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime 53 | import pkg @@ -30,7 +30,7 @@ strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-chec 56 59 | def test(value: A): 57 60 | return pkg.B() -strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking block +strict.py:91:12: TCH002 [**] Move third-party import `pkg` into a type-checking block | 89 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is 90 | # testing the implementation. diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap index df0299e8a79c22..dd024a9860b04b 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:4:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:4:18: TCH002 [**] Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations 3 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap index 361042da6bc491..21773db16365f3 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap index 17ac7a8ef9812e..25c204a99da9fb 100644 --- a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap +++ b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flynt/mod.rs --- -FLY002.py:5:7: FLY002 [*] Consider `f"{a} World"` instead of string join +FLY002.py:5:7: FLY002 [**] Consider `f"{a} World"` instead of string join | 4 | a = "Hello" 5 | ok1 = " ".join([a, " World"]) # OK @@ -21,7 +21,7 @@ FLY002.py:5:7: FLY002 [*] Consider `f"{a} World"` instead of string join 7 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally -FLY002.py:6:7: FLY002 [*] Consider `f"Finally, {a} World"` instead of string join +FLY002.py:6:7: FLY002 [**] Consider `f"Finally, {a} World"` instead of string join | 4 | a = "Hello" 5 | ok1 = " ".join([a, " World"]) # OK @@ -42,7 +42,7 @@ FLY002.py:6:7: FLY002 [*] Consider `f"Finally, {a} World"` instead of string joi 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) -FLY002.py:7:7: FLY002 [*] Consider `"1x2x3"` instead of string join +FLY002.py:7:7: FLY002 [**] Consider `"1x2x3"` instead of string join | 5 | ok1 = " ".join([a, " World"]) # OK 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK @@ -63,7 +63,7 @@ FLY002.py:7:7: FLY002 [*] Consider `"1x2x3"` instead of string join 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) 10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) -FLY002.py:8:7: FLY002 [*] Consider `f"{1}y{2}y{3}"` instead of string join +FLY002.py:8:7: FLY002 [**] Consider `f"{1}y{2}y{3}"` instead of string join | 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK 7 | ok3 = "x".join(("1", "2", "3")) # OK @@ -84,7 +84,7 @@ FLY002.py:8:7: FLY002 [*] Consider `f"{1}y{2}y{3}"` instead of string join 10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) 11 11 | -FLY002.py:9:7: FLY002 [*] Consider `f"{random()}a{random()}"` instead of string join +FLY002.py:9:7: FLY002 [**] Consider `f"{random()}a{random()}"` instead of string join | 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally @@ -104,7 +104,7 @@ FLY002.py:9:7: FLY002 [*] Consider `f"{random()}a{random()}"` instead of string 11 11 | 12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) -FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` instead of string join +FLY002.py:10:7: FLY002 [**] Consider `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` instead of string join | 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) @@ -125,7 +125,7 @@ FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_ 12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) 13 13 | nok2 = a.join(["1", "2", "3"]) # Not OK (not a static joiner) -FLY002.py:23:11: FLY002 [*] Consider `f"{url}{filename}"` instead of string join +FLY002.py:23:11: FLY002 [**] Consider `f"{url}{filename}"` instead of string join | 21 | # Regression test for: https://github.com/astral-sh/ruff/issues/7197 22 | def create_file_public_url(url, filename): diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap index 1d8aa9dc02fdc1..973a498d92cd29 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -NPY003.py:4:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead +NPY003.py:4:5: NPY003 [**] `np.round_` is deprecated; use `np.round` instead | 2 | import numpy as np 3 | @@ -22,7 +22,7 @@ NPY003.py:4:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead 6 6 | np.cumproduct(np.random.rand(5, 5)) 7 7 | np.sometrue(np.random.rand(5, 5)) -NPY003.py:5:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead +NPY003.py:5:5: NPY003 [**] `np.product` is deprecated; use `np.prod` instead | 4 | np.round_(np.random.rand(5, 5), 2) 5 | np.product(np.random.rand(5, 5)) @@ -42,7 +42,7 @@ NPY003.py:5:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead 7 7 | np.sometrue(np.random.rand(5, 5)) 8 8 | np.alltrue(np.random.rand(5, 5)) -NPY003.py:6:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instead +NPY003.py:6:5: NPY003 [**] `np.cumproduct` is deprecated; use `np.cumprod` instead | 4 | np.round_(np.random.rand(5, 5), 2) 5 | np.product(np.random.rand(5, 5)) @@ -63,7 +63,7 @@ NPY003.py:6:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instea 8 8 | np.alltrue(np.random.rand(5, 5)) 9 9 | -NPY003.py:7:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead +NPY003.py:7:5: NPY003 [**] `np.sometrue` is deprecated; use `np.any` instead | 5 | np.product(np.random.rand(5, 5)) 6 | np.cumproduct(np.random.rand(5, 5)) @@ -83,7 +83,7 @@ NPY003.py:7:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead 9 9 | 10 10 | -NPY003.py:8:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead +NPY003.py:8:5: NPY003 [**] `np.alltrue` is deprecated; use `np.all` instead | 6 | np.cumproduct(np.random.rand(5, 5)) 7 | np.sometrue(np.random.rand(5, 5)) @@ -102,7 +102,7 @@ NPY003.py:8:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead 10 10 | 11 11 | def func(): -NPY003.py:14:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead +NPY003.py:14:5: NPY003 [**] `np.round_` is deprecated; use `np.round` instead | 12 | from numpy import round_, product, cumproduct, sometrue, alltrue 13 | @@ -128,7 +128,7 @@ NPY003.py:14:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead 16 17 | cumproduct(np.random.rand(5, 5)) 17 18 | sometrue(np.random.rand(5, 5)) -NPY003.py:15:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead +NPY003.py:15:5: NPY003 [**] `np.product` is deprecated; use `np.prod` instead | 14 | round_(np.random.rand(5, 5), 2) 15 | product(np.random.rand(5, 5)) @@ -153,7 +153,7 @@ NPY003.py:15:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead 17 18 | sometrue(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -NPY003.py:16:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instead +NPY003.py:16:5: NPY003 [**] `np.cumproduct` is deprecated; use `np.cumprod` instead | 14 | round_(np.random.rand(5, 5), 2) 15 | product(np.random.rand(5, 5)) @@ -178,7 +178,7 @@ NPY003.py:16:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` inste 17 18 | sometrue(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -NPY003.py:17:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead +NPY003.py:17:5: NPY003 [**] `np.sometrue` is deprecated; use `np.any` instead | 15 | product(np.random.rand(5, 5)) 16 | cumproduct(np.random.rand(5, 5)) @@ -201,7 +201,7 @@ NPY003.py:17:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead 18 |+ any(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -NPY003.py:18:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead +NPY003.py:18:5: NPY003 [**] `np.alltrue` is deprecated; use `np.all` instead | 16 | cumproduct(np.random.rand(5, 5)) 17 | sometrue(np.random.rand(5, 5)) diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap index f83b5e3a322c5b..f729fcf052c38b 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -NPY001.py:6:1: NPY001 [*] Type alias `np.bool` is deprecated, replace with builtin type +NPY001.py:6:1: NPY001 [**] Type alias `np.bool` is deprecated, replace with builtin type | 5 | # Error 6 | npy.bool @@ -20,7 +20,7 @@ NPY001.py:6:1: NPY001 [*] Type alias `np.bool` is deprecated, replace with built 8 8 | 9 9 | if dtype == np.object: -NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type +NPY001.py:7:1: NPY001 [**] Type alias `np.int` is deprecated, replace with builtin type | 5 | # Error 6 | npy.bool @@ -41,7 +41,7 @@ NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builti 9 9 | if dtype == np.object: 10 10 | ... -NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type +NPY001.py:9:13: NPY001 [**] Type alias `np.object` is deprecated, replace with builtin type | 7 | npy.int 8 | @@ -61,7 +61,7 @@ NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with bu 11 11 | 12 12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.long]) -NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type +NPY001.py:12:72: NPY001 [**] Type alias `np.int` is deprecated, replace with builtin type | 10 | ... 11 | @@ -82,7 +82,7 @@ NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with buil 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], -NPY001.py:12:80: NPY001 [*] Type alias `np.long` is deprecated, replace with builtin type +NPY001.py:12:80: NPY001 [**] Type alias `np.long` is deprecated, replace with builtin type | 10 | ... 11 | @@ -103,7 +103,7 @@ NPY001.py:12:80: NPY001 [*] Type alias `np.long` is deprecated, replace with bui 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], -NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type +NPY001.py:17:11: NPY001 [**] Type alias `np.object` is deprecated, replace with builtin type | 15 | data=[[1, 2, 3]], 16 | columns=["a", "b", "c"], @@ -123,7 +123,7 @@ NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with b 19 19 | 20 20 | _ = arr.astype(np.int) -NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type +NPY001.py:20:16: NPY001 [**] Type alias `np.int` is deprecated, replace with builtin type | 18 | ) 19 | diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap index 8fd8323c46ecdf..6ebfce7b4c231e 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -PD002.py:5:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:5:23: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior | 3 | x = pd.DataFrame() 4 | @@ -22,7 +22,7 @@ PD002.py:5:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 7 7 | x.y.drop(["a"], axis=1, inplace=True) 8 8 | -PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:7:25: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior | 5 | x.drop(["a"], axis=1, inplace=True) 6 | @@ -43,7 +43,7 @@ PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 9 9 | x["y"].drop(["a"], axis=1, inplace=True) 10 10 | -PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:9:28: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior | 7 | x.y.drop(["a"], axis=1, inplace=True) 8 | @@ -64,7 +64,7 @@ PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 11 11 | x.drop( 12 12 | inplace=True, -PD002.py:12:5: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:12:5: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior | 11 | x.drop( 12 | inplace=True, @@ -85,7 +85,7 @@ PD002.py:12:5: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 14 13 | axis=1, 15 14 | ) -PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:19:9: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior | 17 | if True: 18 | x.drop( @@ -107,7 +107,7 @@ PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent b 21 20 | axis=1, 22 21 | ) -PD002.py:24:33: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:24:33: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior | 22 | ) 23 | @@ -158,7 +158,7 @@ PD002.py:28:38: PD002 `inplace=True` should be avoided; it has inconsistent beha | = help: Assign to variable; remove `inplace` arg -PD002.py:33:24: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:33:24: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior | 31 | torch.m.ReLU(inplace=True) # safe because this isn't a pandas call 32 | diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap index d88f95e11436c5..00de5c1c668961 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -:4:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior +:4:23: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap index f38200c0dec33e..2cd54164805b25 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs --- -PERF102.py:5:21: PERF102 [*] When using only the values of a dict use the `values()` method +PERF102.py:5:21: PERF102 [**] When using only the values of a dict use the `values()` method | 4 | def f(): 5 | for _, value in some_dict.items(): # PERF102 @@ -20,7 +20,7 @@ PERF102.py:5:21: PERF102 [*] When using only the values of a dict use the `value 7 7 | 8 8 | -PERF102.py:10:19: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:10:19: PERF102 [**] When using only the keys of a dict use the `keys()` method | 9 | def f(): 10 | for key, _ in some_dict.items(): # PERF102 @@ -39,7 +39,7 @@ PERF102.py:10:19: PERF102 [*] When using only the keys of a dict use the `keys() 12 12 | 13 13 | -PERF102.py:15:30: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:15:30: PERF102 [**] When using only the keys of a dict use the `keys()` method | 14 | def f(): 15 | for weird_arg_name, _ in some_dict.items(): # PERF102 @@ -58,7 +58,7 @@ PERF102.py:15:30: PERF102 [*] When using only the keys of a dict use the `keys() 17 17 | 18 18 | -PERF102.py:20:25: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:20:25: PERF102 [**] When using only the keys of a dict use the `keys()` method | 19 | def f(): 20 | for name, (_, _) in some_dict.items(): # PERF102 @@ -77,7 +77,7 @@ PERF102.py:20:25: PERF102 [*] When using only the keys of a dict use the `keys() 22 22 | 23 23 | -PERF102.py:30:30: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:30:30: PERF102 [**] When using only the keys of a dict use the `keys()` method | 29 | def f(): 30 | for (key1, _), (_, _) in some_dict.items(): # PERF102 @@ -96,7 +96,7 @@ PERF102.py:30:30: PERF102 [*] When using only the keys of a dict use the `keys() 32 32 | 33 33 | -PERF102.py:35:36: PERF102 [*] When using only the values of a dict use the `values()` method +PERF102.py:35:36: PERF102 [**] When using only the values of a dict use the `values()` method | 34 | def f(): 35 | for (_, (_, _)), (value, _) in some_dict.items(): # PERF102 @@ -115,7 +115,7 @@ PERF102.py:35:36: PERF102 [*] When using only the values of a dict use the `valu 37 37 | 38 38 | -PERF102.py:50:32: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:50:32: PERF102 [**] When using only the keys of a dict use the `keys()` method | 49 | def f(): 50 | for ((_, key2), (_, _)) in some_dict.items(): # PERF102 @@ -134,7 +134,7 @@ PERF102.py:50:32: PERF102 [*] When using only the keys of a dict use the `keys() 52 52 | 53 53 | -PERF102.py:85:25: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:85:25: PERF102 [**] When using only the keys of a dict use the `keys()` method | 84 | def f(): 85 | for name, (_, _) in (some_function()).items(): # PERF102 @@ -153,7 +153,7 @@ PERF102.py:85:25: PERF102 [*] When using only the keys of a dict use the `keys() 87 87 | 88 88 | -PERF102.py:90:25: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:90:25: PERF102 [**] When using only the keys of a dict use the `keys()` method | 89 | def f(): 90 | for name, (_, _) in (some_function().some_attribute).items(): # PERF102 @@ -172,7 +172,7 @@ PERF102.py:90:25: PERF102 [*] When using only the keys of a dict use the `keys() 92 92 | 93 93 | -PERF102.py:95:31: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:95:31: PERF102 [**] When using only the keys of a dict use the `keys()` method | 94 | def f(): 95 | for name, unused_value in some_dict.items(): # PERF102 @@ -191,7 +191,7 @@ PERF102.py:95:31: PERF102 [*] When using only the keys of a dict use the `keys() 97 97 | 98 98 | -PERF102.py:100:31: PERF102 [*] When using only the values of a dict use the `values()` method +PERF102.py:100:31: PERF102 [**] When using only the values of a dict use the `values()` method | 99 | def f(): 100 | for unused_name, value in some_dict.items(): # PERF102 @@ -210,7 +210,7 @@ PERF102.py:100:31: PERF102 [*] When using only the values of a dict use the `val 102 102 | 103 103 | -PERF102.py:106:16: PERF102 [*] When using only the keys of a dict use the `keys()` method +PERF102.py:106:16: PERF102 [**] When using only the keys of a dict use the `keys()` method | 104 | # Regression test for: https://github.com/astral-sh/ruff/issues/7097 105 | def _create_context(name_to_value): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap index 0929543ee6c8a7..226cd3007a5d9b 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E711.py:2:11: E711 [*] Comparison to `None` should be `cond is None` +E711.py:2:11: E711 [**] Comparison to `None` should be `cond is None` | 1 | #: E711 2 | if res == None: @@ -19,7 +19,7 @@ E711.py:2:11: E711 [*] Comparison to `None` should be `cond is None` 4 4 | #: E711 5 5 | if res != None: -E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` +E711.py:5:11: E711 [**] Comparison to `None` should be `cond is not None` | 3 | pass 4 | #: E711 @@ -40,7 +40,7 @@ E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` 7 7 | #: E711 8 8 | if None == res: -E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` +E711.py:8:4: E711 [**] Comparison to `None` should be `cond is None` | 6 | pass 7 | #: E711 @@ -61,7 +61,7 @@ E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` 10 10 | #: E711 11 11 | if None != res: -E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` +E711.py:11:4: E711 [**] Comparison to `None` should be `cond is not None` | 9 | pass 10 | #: E711 @@ -82,7 +82,7 @@ E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` 13 13 | #: E711 14 14 | if res[1] == None: -E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` +E711.py:14:14: E711 [**] Comparison to `None` should be `cond is None` | 12 | pass 13 | #: E711 @@ -103,7 +103,7 @@ E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` 16 16 | #: E711 17 17 | if res[1] != None: -E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` +E711.py:17:14: E711 [**] Comparison to `None` should be `cond is not None` | 15 | pass 16 | #: E711 @@ -124,7 +124,7 @@ E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` 19 19 | #: E711 20 20 | if None != res[1]: -E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` +E711.py:20:4: E711 [**] Comparison to `None` should be `cond is not None` | 18 | pass 19 | #: E711 @@ -145,7 +145,7 @@ E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` 22 22 | #: E711 23 23 | if None == res[1]: -E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` +E711.py:23:4: E711 [**] Comparison to `None` should be `cond is None` | 21 | pass 22 | #: E711 @@ -165,7 +165,7 @@ E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` 25 25 | 26 26 | if x == None != None: -E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` +E711.py:26:9: E711 [**] Comparison to `None` should be `cond is None` | 24 | pass 25 | @@ -185,7 +185,7 @@ E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` 28 28 | 29 29 | #: Okay -E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` +E711.py:26:17: E711 [**] Comparison to `None` should be `cond is not None` | 24 | pass 25 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap index 6f4b23c2defc4c..bcfce5f35e2f28 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E712.py:2:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:2:11: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` | 1 | #: E712 2 | if res == True: @@ -19,7 +19,7 @@ E712.py:2:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond 4 4 | #: E712 5 5 | if res != False: -E712.py:5:11: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:` +E712.py:5:11: E712 [**] Comparison to `False` should be `cond is not False` or `if cond:` | 3 | pass 4 | #: E712 @@ -40,7 +40,7 @@ E712.py:5:11: E712 [*] Comparison to `False` should be `cond is not False` or `i 7 7 | #: E712 8 8 | if True != res: -E712.py:8:4: E712 [*] Comparison to `True` should be `cond is not True` or `if not cond:` +E712.py:8:4: E712 [**] Comparison to `True` should be `cond is not True` or `if not cond:` | 6 | pass 7 | #: E712 @@ -61,7 +61,7 @@ E712.py:8:4: E712 [*] Comparison to `True` should be `cond is not True` or `if n 10 10 | #: E712 11 11 | if False == res: -E712.py:11:4: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:` +E712.py:11:4: E712 [**] Comparison to `False` should be `cond is False` or `if not cond:` | 9 | pass 10 | #: E712 @@ -82,7 +82,7 @@ E712.py:11:4: E712 [*] Comparison to `False` should be `cond is False` or `if no 13 13 | #: E712 14 14 | if res[1] == True: -E712.py:14:14: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:14:14: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` | 12 | pass 13 | #: E712 @@ -103,7 +103,7 @@ E712.py:14:14: E712 [*] Comparison to `True` should be `cond is True` or `if con 16 16 | #: E712 17 17 | if res[1] != False: -E712.py:17:14: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:` +E712.py:17:14: E712 [**] Comparison to `False` should be `cond is not False` or `if cond:` | 15 | pass 16 | #: E712 @@ -124,7 +124,7 @@ E712.py:17:14: E712 [*] Comparison to `False` should be `cond is not False` or ` 19 19 | #: E712 20 20 | var = 1 if cond == True else -1 if cond == False else cond -E712.py:20:20: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:20:20: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` | 18 | pass 19 | #: E712 @@ -145,7 +145,7 @@ E712.py:20:20: E712 [*] Comparison to `True` should be `cond is True` or `if con 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass -E712.py:20:44: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:` +E712.py:20:44: E712 [**] Comparison to `False` should be `cond is False` or `if not cond:` | 18 | pass 19 | #: E712 @@ -166,7 +166,7 @@ E712.py:20:44: E712 [*] Comparison to `False` should be `cond is False` or `if n 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass -E712.py:22:5: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:22:5: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` | 20 | var = 1 if cond == True else -1 if cond == False else cond 21 | #: E712 @@ -186,7 +186,7 @@ E712.py:22:5: E712 [*] Comparison to `True` should be `cond is True` or `if cond 24 24 | 25 25 | if res == True != False: -E712.py:25:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:25:11: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` | 23 | pass 24 | @@ -206,7 +206,7 @@ E712.py:25:11: E712 [*] Comparison to `True` should be `cond is True` or `if con 27 27 | 28 28 | if(True) == TrueElement or x == TrueElement: -E712.py:25:19: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:` +E712.py:25:19: E712 [**] Comparison to `False` should be `cond is not False` or `if cond:` | 23 | pass 24 | @@ -226,7 +226,7 @@ E712.py:25:19: E712 [*] Comparison to `False` should be `cond is not False` or ` 27 27 | 28 28 | if(True) == TrueElement or x == TrueElement: -E712.py:28:4: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:28:4: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` | 26 | pass 27 | @@ -246,7 +246,7 @@ E712.py:28:4: E712 [*] Comparison to `True` should be `cond is True` or `if cond 30 30 | 31 31 | if (yield i) == True: -E712.py:31:17: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:31:17: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` | 29 | pass 30 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap index ce00ec0a9a768c..55ec0c4b1b6277 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E731.py:3:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:3:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 1 | def scope(): 2 | # E731 @@ -20,7 +20,7 @@ E731.py:3:5: E731 [*] Do not assign a `lambda` expression, use a `def` 5 6 | 6 7 | def scope(): -E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:8:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 6 | def scope(): 7 | # E731 @@ -40,7 +40,7 @@ E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` 10 11 | 11 12 | def scope(): -E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:14:9: E731 [**] Do not assign a `lambda` expression, use a `def` | 12 | # E731 13 | while False: @@ -60,7 +60,7 @@ E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` 16 17 | 17 18 | def scope(): -E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:19:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 17 | def scope(): 18 | # E731 @@ -80,7 +80,7 @@ E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` 21 22 | 22 23 | def scope(): -E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:24:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 22 | def scope(): 23 | # E731 @@ -182,7 +182,7 @@ E731.py:75:9: E731 [*] Do not assign a `lambda` expression, use a `def` 77 78 | 78 79 | -E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:86:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 84 | # ParamSpec cannot be used in this context, so do not preserve the annotation. 85 | P = ParamSpec("P") @@ -202,7 +202,7 @@ E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` 88 89 | 89 90 | def scope(): -E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:94:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 92 | from typing import Callable 93 | @@ -222,7 +222,7 @@ E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` 96 97 | 97 98 | def scope(): -E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:102:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 100 | from typing import Callable 101 | @@ -242,7 +242,7 @@ E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` 104 105 | 105 106 | def scope(): -E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:110:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 108 | from typing import Callable 109 | @@ -262,7 +262,7 @@ E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` 112 113 | 113 114 | # Let's use the `Callable` type from `collections.abc` instead. -E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:119:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 117 | from collections.abc import Callable 118 | @@ -282,7 +282,7 @@ E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` 121 122 | 122 123 | def scope(): -E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:127:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 125 | from collections.abc import Callable 126 | @@ -302,7 +302,7 @@ E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` 129 130 | 130 131 | def scope(): -E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:135:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 133 | from collections.abc import Callable 134 | @@ -362,7 +362,7 @@ E731.py:140:5: E731 [*] Do not assign a `lambda` expression, use a `def` 142 143 | 143 144 | # Regression test for: https://github.com/astral-sh/ruff/issues/7141 -E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:147:5: E731 [**] Do not assign a `lambda` expression, use a `def` | 145 | # E731 146 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap index e8a55ce2fbb6e2..1a6d1eca9a4b49 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap @@ -106,7 +106,7 @@ constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass -constant_literals.py:14:4: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:` +constant_literals.py:14:4: E712 [**] Comparison to `False` should be `cond is False` or `if not cond:` | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 | pass @@ -127,7 +127,7 @@ constant_literals.py:14:4: E712 [*] Comparison to `False` should be `cond is Fal 16 16 | if None == False: # E711, E712 (fix) 17 17 | pass -constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is None` +constant_literals.py:14:13: E711 [**] Comparison to `None` should be `cond is None` | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 | pass @@ -148,7 +148,7 @@ constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is Non 16 16 | if None == False: # E711, E712 (fix) 17 17 | pass -constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None` +constant_literals.py:16:4: E711 [**] Comparison to `None` should be `cond is None` | 14 | if False == None: # E711, E712 (fix) 15 | pass @@ -168,7 +168,7 @@ constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None 18 18 | 19 19 | ### -constant_literals.py:16:12: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:` +constant_literals.py:16:12: E712 [**] Comparison to `False` should be `cond is False` or `if not cond:` | 14 | if False == None: # E711, E712 (fix) 15 | pass diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap index 2e9ab57a982b68..20568a3cc22d32 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D.py:129:5: D200 [*] One-line docstring should fit on one line +D.py:129:5: D200 [**] One-line docstring should fit on one line | 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 | def asdlkfasd(): @@ -25,7 +25,7 @@ D.py:129:5: D200 [*] One-line docstring should fit on one line 133 131 | 134 132 | @expect('D201: No blank lines allowed before function docstring (found 1)') -D.py:597:5: D200 [*] One-line docstring should fit on one line +D.py:597:5: D200 [**] One-line docstring should fit on one line | 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 | def one_liner(): @@ -49,7 +49,7 @@ D.py:597:5: D200 [*] One-line docstring should fit on one line 601 599 | 602 600 | @expect('D200: One-line docstring should fit on one line with quotes ' -D.py:606:5: D200 [*] One-line docstring should fit on one line +D.py:606:5: D200 [**] One-line docstring should fit on one line | 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 | def one_liner(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap index d4f68ce602e277..bcbf0c4182f3ef 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap @@ -11,7 +11,7 @@ D200.py:2:5: D200 One-line docstring should fit on one line | = help: Reformat to one line -D200.py:7:5: D200 [*] One-line docstring should fit on one line +D200.py:7:5: D200 [**] One-line docstring should fit on one line | 6 | def func(): 7 | """\\ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap index 7d0eafb11dffba..ba5be6e1cb6bb2 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D.py:355:5: D400 [*] First line should end with a period +D.py:355:5: D400 [**] First line should end with a period | 353 | "or exclamation point (not 'y')") 354 | def lwnlkjl(): @@ -20,7 +20,7 @@ D.py:355:5: D400 [*] First line should end with a period 357 357 | 358 358 | @expect("D401: First line should be in imperative mood " -D.py:406:25: D400 [*] First line should end with a period +D.py:406:25: D400 [**] First line should end with a period | 404 | @expect("D415: First line should end with a period, question mark," 405 | " or exclamation point (not 'r')") @@ -39,7 +39,7 @@ D.py:406:25: D400 [*] First line should end with a period 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 -D.py:410:5: D400 [*] First line should end with a period +D.py:410:5: D400 [**] First line should end with a period | 409 | def ignored_decorator(func): # noqa: D400,D401,D415 410 | """Runs something""" @@ -59,7 +59,7 @@ D.py:410:5: D400 [*] First line should end with a period 412 412 | pass 413 413 | -D.py:416:5: D400 [*] First line should end with a period +D.py:416:5: D400 [**] First line should end with a period | 415 | def decorator_for_test(func): # noqa: D400,D401,D415 416 | """Runs something""" @@ -79,7 +79,7 @@ D.py:416:5: D400 [*] First line should end with a period 418 418 | pass 419 419 | -D.py:422:35: D400 [*] First line should end with a period +D.py:422:35: D400 [**] First line should end with a period | 421 | @ignored_decorator 422 | def oneliner_ignored_decorator(): """One liner""" @@ -97,7 +97,7 @@ D.py:422:35: D400 [*] First line should end with a period 424 424 | 425 425 | @decorator_for_test -D.py:429:49: D400 [*] First line should end with a period +D.py:429:49: D400 [**] First line should end with a period | 427 | @expect("D415: First line should end with a period, question mark," 428 | " or exclamation point (not 'r')") @@ -116,7 +116,7 @@ D.py:429:49: D400 [*] First line should end with a period 431 431 | 432 432 | @decorator_for_test -D.py:470:5: D400 [*] First line should end with a period +D.py:470:5: D400 [**] First line should end with a period | 468 | "or exclamation point (not 'g')") 469 | def docstring_bad(): @@ -136,7 +136,7 @@ D.py:470:5: D400 [*] First line should end with a period 472 472 | 473 473 | -D.py:475:5: D400 [*] First line should end with a period +D.py:475:5: D400 [**] First line should end with a period | 474 | def docstring_bad_ignore_all(): # noqa 475 | """Runs something""" @@ -155,7 +155,7 @@ D.py:475:5: D400 [*] First line should end with a period 477 477 | 478 478 | -D.py:480:5: D400 [*] First line should end with a period +D.py:480:5: D400 [**] First line should end with a period | 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 480 | """Runs something""" @@ -174,7 +174,7 @@ D.py:480:5: D400 [*] First line should end with a period 482 482 | 483 483 | -D.py:487:5: D400 [*] First line should end with a period +D.py:487:5: D400 [**] First line should end with a period | 485 | "(perhaps 'Run', not 'Runs')") 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -194,7 +194,7 @@ D.py:487:5: D400 [*] First line should end with a period 489 489 | 490 490 | -D.py:514:5: D400 [*] First line should end with a period +D.py:514:5: D400 [**] First line should end with a period | 513 | def valid_google_string(): # noqa: D400 514 | """Test a valid something!""" @@ -212,7 +212,7 @@ D.py:514:5: D400 [*] First line should end with a period 516 516 | 517 517 | @expect("D415: First line should end with a period, question mark, " -D.py:520:5: D400 [*] First line should end with a period +D.py:520:5: D400 [**] First line should end with a period | 518 | "or exclamation point (not 'g')") 519 | def bad_google_string(): # noqa: D400 @@ -231,7 +231,7 @@ D.py:520:5: D400 [*] First line should end with a period 522 522 | 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class -D.py:581:5: D400 [*] First line should end with a period +D.py:581:5: D400 [**] First line should end with a period | 579 | "or exclamation point (not '\"')") 580 | def endswith_quote(): @@ -250,7 +250,7 @@ D.py:581:5: D400 [*] First line should end with a period 583 583 | 584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' -D.py:615:5: D400 [*] First line should end with a period +D.py:615:5: D400 [**] First line should end with a period | 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 | def one_liner(): @@ -272,7 +272,7 @@ D.py:615:5: D400 [*] First line should end with a period 617 617 | """ 618 618 | -D.py:639:17: D400 [*] First line should end with a period +D.py:639:17: D400 [**] First line should end with a period | 639 | class SameLine: """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D400 @@ -291,7 +291,7 @@ D.py:639:17: D400 [*] First line should end with a period 641 641 | def same_line(): """This is a docstring on the same line""" 642 642 | -D.py:641:18: D400 [*] First line should end with a period +D.py:641:18: D400 [**] First line should end with a period | 639 | class SameLine: """This is a docstring on the same line""" 640 | @@ -310,7 +310,7 @@ D.py:641:18: D400 [*] First line should end with a period 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): -D.py:664:5: D400 [*] First line should end with a period +D.py:664:5: D400 [**] First line should end with a period | 663 | def newline_after_closing_quote(self): 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap index 4404e556416780..0bb03df8de9187 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D400.py:2:5: D400 [*] First line should end with a period +D400.py:2:5: D400 [**] First line should end with a period | 1 | def f(): 2 | "Here's a line without a period" @@ -18,7 +18,7 @@ D400.py:2:5: D400 [*] First line should end with a period 4 4 | 5 5 | -D400.py:7:5: D400 [*] First line should end with a period +D400.py:7:5: D400 [**] First line should end with a period | 6 | def f(): 7 | """Here's a line without a period""" @@ -37,7 +37,7 @@ D400.py:7:5: D400 [*] First line should end with a period 9 9 | 10 10 | -D400.py:12:5: D400 [*] First line should end with a period +D400.py:12:5: D400 [**] First line should end with a period | 11 | def f(): 12 | """ @@ -60,7 +60,7 @@ D400.py:12:5: D400 [*] First line should end with a period 16 16 | ... 17 17 | -D400.py:20:5: D400 [*] First line should end with a period +D400.py:20:5: D400 [**] First line should end with a period | 19 | def f(): 20 | """Here's a line without a period""" @@ -79,7 +79,7 @@ D400.py:20:5: D400 [*] First line should end with a period 22 22 | 23 23 | -D400.py:25:5: D400 [*] First line should end with a period +D400.py:25:5: D400 [**] First line should end with a period | 24 | def f(): 25 | """ @@ -101,7 +101,7 @@ D400.py:25:5: D400 [*] First line should end with a period 29 29 | 30 30 | -D400.py:32:5: D400 [*] First line should end with a period +D400.py:32:5: D400 [**] First line should end with a period | 31 | def f(): 32 | """ @@ -123,7 +123,7 @@ D400.py:32:5: D400 [*] First line should end with a period 36 36 | 37 37 | -D400.py:39:5: D400 [*] First line should end with a period +D400.py:39:5: D400 [**] First line should end with a period | 38 | def f(): 39 | r"Here's a line without a period" @@ -142,7 +142,7 @@ D400.py:39:5: D400 [*] First line should end with a period 41 41 | 42 42 | -D400.py:44:5: D400 [*] First line should end with a period +D400.py:44:5: D400 [**] First line should end with a period | 43 | def f(): 44 | r"""Here's a line without a period""" @@ -161,7 +161,7 @@ D400.py:44:5: D400 [*] First line should end with a period 46 46 | 47 47 | -D400.py:49:5: D400 [*] First line should end with a period +D400.py:49:5: D400 [**] First line should end with a period | 48 | def f(): 49 | r""" @@ -184,7 +184,7 @@ D400.py:49:5: D400 [*] First line should end with a period 53 53 | ... 54 54 | -D400.py:57:5: D400 [*] First line should end with a period +D400.py:57:5: D400 [**] First line should end with a period | 56 | def f(): 57 | r"""Here's a line without a period""" @@ -203,7 +203,7 @@ D400.py:57:5: D400 [*] First line should end with a period 59 59 | 60 60 | -D400.py:62:5: D400 [*] First line should end with a period +D400.py:62:5: D400 [**] First line should end with a period | 61 | def f(): 62 | r""" @@ -225,7 +225,7 @@ D400.py:62:5: D400 [*] First line should end with a period 66 66 | 67 67 | -D400.py:69:5: D400 [*] First line should end with a period +D400.py:69:5: D400 [**] First line should end with a period | 68 | def f(): 69 | r""" diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap index 3bdc949e58ea59..4cac0b7d927fa4 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D.py:355:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:355:5: D415 [**] First line should end with a period, question mark, or exclamation point | 353 | "or exclamation point (not 'y')") 354 | def lwnlkjl(): @@ -20,7 +20,7 @@ D.py:355:5: D415 [*] First line should end with a period, question mark, or excl 357 357 | 358 358 | @expect("D401: First line should be in imperative mood " -D.py:406:25: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:406:25: D415 [**] First line should end with a period, question mark, or exclamation point | 404 | @expect("D415: First line should end with a period, question mark," 405 | " or exclamation point (not 'r')") @@ -39,7 +39,7 @@ D.py:406:25: D415 [*] First line should end with a period, question mark, or exc 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 -D.py:410:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:410:5: D415 [**] First line should end with a period, question mark, or exclamation point | 409 | def ignored_decorator(func): # noqa: D400,D401,D415 410 | """Runs something""" @@ -59,7 +59,7 @@ D.py:410:5: D415 [*] First line should end with a period, question mark, or excl 412 412 | pass 413 413 | -D.py:416:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:416:5: D415 [**] First line should end with a period, question mark, or exclamation point | 415 | def decorator_for_test(func): # noqa: D400,D401,D415 416 | """Runs something""" @@ -79,7 +79,7 @@ D.py:416:5: D415 [*] First line should end with a period, question mark, or excl 418 418 | pass 419 419 | -D.py:422:35: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:422:35: D415 [**] First line should end with a period, question mark, or exclamation point | 421 | @ignored_decorator 422 | def oneliner_ignored_decorator(): """One liner""" @@ -97,7 +97,7 @@ D.py:422:35: D415 [*] First line should end with a period, question mark, or exc 424 424 | 425 425 | @decorator_for_test -D.py:429:49: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:429:49: D415 [**] First line should end with a period, question mark, or exclamation point | 427 | @expect("D415: First line should end with a period, question mark," 428 | " or exclamation point (not 'r')") @@ -116,7 +116,7 @@ D.py:429:49: D415 [*] First line should end with a period, question mark, or exc 431 431 | 432 432 | @decorator_for_test -D.py:470:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:470:5: D415 [**] First line should end with a period, question mark, or exclamation point | 468 | "or exclamation point (not 'g')") 469 | def docstring_bad(): @@ -136,7 +136,7 @@ D.py:470:5: D415 [*] First line should end with a period, question mark, or excl 472 472 | 473 473 | -D.py:475:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:475:5: D415 [**] First line should end with a period, question mark, or exclamation point | 474 | def docstring_bad_ignore_all(): # noqa 475 | """Runs something""" @@ -155,7 +155,7 @@ D.py:475:5: D415 [*] First line should end with a period, question mark, or excl 477 477 | 478 478 | -D.py:480:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:480:5: D415 [**] First line should end with a period, question mark, or exclamation point | 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 480 | """Runs something""" @@ -174,7 +174,7 @@ D.py:480:5: D415 [*] First line should end with a period, question mark, or excl 482 482 | 483 483 | -D.py:487:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:487:5: D415 [**] First line should end with a period, question mark, or exclamation point | 485 | "(perhaps 'Run', not 'Runs')") 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -194,7 +194,7 @@ D.py:487:5: D415 [*] First line should end with a period, question mark, or excl 489 489 | 490 490 | -D.py:520:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:520:5: D415 [**] First line should end with a period, question mark, or exclamation point | 518 | "or exclamation point (not 'g')") 519 | def bad_google_string(): # noqa: D400 @@ -213,7 +213,7 @@ D.py:520:5: D415 [*] First line should end with a period, question mark, or excl 522 522 | 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class -D.py:581:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:581:5: D415 [**] First line should end with a period, question mark, or exclamation point | 579 | "or exclamation point (not '\"')") 580 | def endswith_quote(): @@ -232,7 +232,7 @@ D.py:581:5: D415 [*] First line should end with a period, question mark, or excl 583 583 | 584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' -D.py:615:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:615:5: D415 [**] First line should end with a period, question mark, or exclamation point | 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 | def one_liner(): @@ -254,7 +254,7 @@ D.py:615:5: D415 [*] First line should end with a period, question mark, or excl 617 617 | """ 618 618 | -D.py:639:17: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:639:17: D415 [**] First line should end with a period, question mark, or exclamation point | 639 | class SameLine: """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D415 @@ -273,7 +273,7 @@ D.py:639:17: D415 [*] First line should end with a period, question mark, or exc 641 641 | def same_line(): """This is a docstring on the same line""" 642 642 | -D.py:641:18: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:641:18: D415 [**] First line should end with a period, question mark, or exclamation point | 639 | class SameLine: """This is a docstring on the same line""" 640 | @@ -292,7 +292,7 @@ D.py:641:18: D415 [*] First line should end with a period, question mark, or exc 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): -D.py:664:5: D415 [*] First line should end with a period, question mark, or exclamation point +D.py:664:5: D415 [**] First line should end with a period, question mark, or exclamation point | 663 | def newline_after_closing_quote(self): 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap index 17a4753d2b8818..e74aa5ad1045a3 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap @@ -18,7 +18,7 @@ D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a se 3 |+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua 4 |+ """ -D209_D400.py:2:5: D400 [*] First line should end with a period +D209_D400.py:2:5: D400 [**] First line should end with a period | 1 | def lorem(): 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap index f1d52d7d3430f6..23c456dd6ae96a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap @@ -66,7 +66,7 @@ F601.py:17:5: F601 Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -F601.py:18:5: F601 [*] Dictionary key literal `"a"` repeated +F601.py:18:5: F601 [**] Dictionary key literal `"a"` repeated | 16 | "a": 2, 17 | "a": 3, @@ -107,7 +107,7 @@ F601.py:24:5: F601 Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -F601.py:25:5: F601 [*] Dictionary key literal `"a"` repeated +F601.py:25:5: F601 [**] Dictionary key literal `"a"` repeated | 23 | "a": 2, 24 | "a": 3, @@ -137,7 +137,7 @@ F601.py:26:5: F601 Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -F601.py:31:5: F601 [*] Dictionary key literal `"a"` repeated +F601.py:31:5: F601 [**] Dictionary key literal `"a"` repeated | 29 | x = { 30 | "a": 1, @@ -211,7 +211,7 @@ F601.py:43:5: F601 Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated +F601.py:45:5: F601 [**] Dictionary key literal `"a"` repeated | 43 | "a": 3, 44 | a: 3, @@ -231,7 +231,7 @@ F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated 47 46 | } 48 47 | -F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated +F601.py:49:14: F601 [**] Dictionary key literal `"a"` repeated | 47 | } 48 | @@ -251,7 +251,7 @@ F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated 51 51 | 52 52 | x = { -F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated +F601.py:50:22: F601 [**] Dictionary key literal `"a"` repeated | 49 | x = {"a": 1, "a": 1} 50 | x = {"a": 1, "b": 2, "a": 1} @@ -281,7 +281,7 @@ F601.py:54:5: F601 Dictionary key literal `('a', 'b')` repeated | = help: Remove repeated key literal `('a', 'b')` -F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated +F601.py:58:19: F601 [**] Dictionary key literal `"x"` repeated | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 58 | t={"x":"test123", "x":("test123")} @@ -300,7 +300,7 @@ F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated 59 59 | 60 60 | t={"x":("test123"), "x":"test123"} -F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated +F601.py:60:21: F601 [**] Dictionary key literal `"x"` repeated | 58 | t={"x":"test123", "x":("test123")} 59 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap index 378346592ac378..f166f2a5e5c0a8 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap @@ -34,7 +34,7 @@ F602.py:12:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:13:5: F602 [*] Dictionary key `a` repeated +F602.py:13:5: F602 [**] Dictionary key `a` repeated | 11 | a: 2, 12 | a: 3, @@ -75,7 +75,7 @@ F602.py:19:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:20:5: F602 [*] Dictionary key `a` repeated +F602.py:20:5: F602 [**] Dictionary key `a` repeated | 18 | a: 2, 19 | a: 3, @@ -105,7 +105,7 @@ F602.py:21:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:26:5: F602 [*] Dictionary key `a` repeated +F602.py:26:5: F602 [**] Dictionary key `a` repeated | 24 | x = { 25 | a: 1, @@ -157,7 +157,7 @@ F602.py:29:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:35:5: F602 [*] Dictionary key `a` repeated +F602.py:35:5: F602 [**] Dictionary key `a` repeated | 33 | a: 1, 34 | "a": 1, @@ -209,7 +209,7 @@ F602.py:41:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:44:12: F602 [*] Dictionary key `a` repeated +F602.py:44:12: F602 [**] Dictionary key `a` repeated | 42 | } 43 | @@ -227,7 +227,7 @@ F602.py:44:12: F602 [*] Dictionary key `a` repeated 44 |+x = {a: 1} 45 45 | x = {a: 1, b: 2, a: 1} -F602.py:45:18: F602 [*] Dictionary key `a` repeated +F602.py:45:18: F602 [**] Dictionary key `a` repeated | 44 | x = {a: 1, a: 1} 45 | x = {a: 1, b: 2, a: 1} diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap index e3f2fc6d0237ef..f09809aa5b7350 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap @@ -20,7 +20,7 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used 5 5 | 6 6 | -F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used +F841_0.py:16:5: F841 [**] Local variable `z` is assigned to but never used | 14 | x = 1 15 | y = 2 @@ -39,7 +39,7 @@ F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used 18 18 | 19 19 | def f(): -F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used +F841_0.py:20:5: F841 [**] Local variable `foo` is assigned to but never used | 19 | def f(): 20 | foo = (1, 2) @@ -79,7 +79,7 @@ F841_0.py:21:9: F841 Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used +F841_0.py:26:14: F841 [**] Local variable `baz` is assigned to but never used | 24 | (c, d) = bar 25 | @@ -98,7 +98,7 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used 28 28 | 29 29 | def f(): -F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used +F841_0.py:51:9: F841 [**] Local variable `b` is assigned to but never used | 49 | def c(): 50 | # F841 @@ -119,7 +119,7 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used 53 53 | def d(): 54 54 | nonlocal b -F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used +F841_0.py:79:26: F841 [**] Local variable `my_file` is assigned to but never used | 78 | def f(): 79 | with open("file") as my_file, open("") as ((this, that)): @@ -138,7 +138,7 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used 81 81 | 82 82 | -F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used +F841_0.py:85:25: F841 [**] Local variable `my_file` is assigned to but never used | 83 | def f(): 84 | with ( @@ -159,7 +159,7 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used 87 87 | ): 88 88 | print("hello") -F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used +F841_0.py:102:5: F841 [**] Local variable `msg3` is assigned to but never used | 100 | msg1 = "Hello, world!" 101 | msg2 = "Hello, world!" @@ -179,7 +179,7 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used 104 103 | case 1: 105 104 | print(msg1) -F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used +F841_0.py:115:5: F841 [**] Local variable `Baz` is assigned to but never used | 113 | Foo = enum.Enum("Foo", "A B") 114 | Bar = enum.Enum("Bar", "A B") diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap index 21aec0a0e51aeb..835d65f1c1517a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap @@ -17,7 +17,7 @@ F841_1.py:6:8: F841 Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used +F841_1.py:16:14: F841 [**] Local variable `coords` is assigned to but never used | 15 | def f(): 16 | (x, y) = coords = 1, 2 # this triggers F841 on coords @@ -35,7 +35,7 @@ F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used 18 18 | 19 19 | def f(): -F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used +F841_1.py:20:5: F841 [**] Local variable `coords` is assigned to but never used | 19 | def f(): 20 | coords = (x, y) = 1, 2 # this triggers F841 on coords diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap index 7527c4e2cd8462..37d9cbaec3b74a 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -F841_3.py:5:5: F841 [*] Local variable `x` is assigned to but never used +F841_3.py:5:5: F841 [**] Local variable `x` is assigned to but never used | 4 | def f(): 5 | x = 1 @@ -19,7 +19,7 @@ F841_3.py:5:5: F841 [*] Local variable `x` is assigned to but never used 7 6 | 8 7 | z = 3 -F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used +F841_3.py:6:5: F841 [**] Local variable `y` is assigned to but never used | 4 | def f(): 5 | x = 1 @@ -39,7 +39,7 @@ F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used 8 7 | z = 3 9 8 | print(z) -F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used +F841_3.py:13:5: F841 [**] Local variable `x` is assigned to but never used | 12 | def f(): 13 | x: int = 1 @@ -57,7 +57,7 @@ F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used 15 14 | 16 15 | z: int = 3 -F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used +F841_3.py:14:5: F841 [**] Local variable `y` is assigned to but never used | 12 | def f(): 13 | x: int = 1 @@ -77,7 +77,7 @@ F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used 16 15 | z: int = 3 17 16 | print(z) -F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used +F841_3.py:21:19: F841 [**] Local variable `x1` is assigned to but never used | 20 | def f(): 21 | with foo() as x1: @@ -96,7 +96,7 @@ F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used 23 23 | 24 24 | with foo() as (x2, y2): -F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used +F841_3.py:27:20: F841 [**] Local variable `x3` is assigned to but never used | 25 | pass 26 | @@ -116,7 +116,7 @@ F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used 29 29 | 30 30 | -F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used +F841_3.py:27:33: F841 [**] Local variable `y3` is assigned to but never used | 25 | pass 26 | @@ -136,7 +136,7 @@ F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used 29 29 | 30 30 | -F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used +F841_3.py:27:46: F841 [**] Local variable `z3` is assigned to but never used | 25 | pass 26 | @@ -176,7 +176,7 @@ F841_3.py:32:10: F841 Local variable `y1` is assigned to but never used | = help: Remove assignment to unused variable `y1` -F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used +F841_3.py:33:16: F841 [**] Local variable `coords2` is assigned to but never used | 31 | def f(): 32 | (x1, y1) = (1, 2) @@ -196,7 +196,7 @@ F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used 35 35 | 36 36 | -F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used +F841_3.py:34:5: F841 [**] Local variable `coords3` is assigned to but never used | 32 | (x1, y1) = (1, 2) 33 | (x2, y2) = coords2 = (1, 2) @@ -255,7 +255,7 @@ F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used 47 47 | 48 48 | -F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used +F841_3.py:50:5: F841 [**] Local variable `x` is assigned to but never used | 49 | def f(a, b): 50 | x = ( @@ -275,7 +275,7 @@ F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used 52 52 | if a is not None 53 53 | else b -F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used +F841_3.py:56:5: F841 [**] Local variable `y` is assigned to but never used | 54 | ) 55 | @@ -296,7 +296,7 @@ F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used 59 58 | 60 59 | def f(a, b): -F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used +F841_3.py:61:5: F841 [**] Local variable `x` is assigned to but never used | 60 | def f(a, b): 61 | x = ( @@ -319,7 +319,7 @@ F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used 67 62 | y = \ 68 63 | a if a is not None else b -F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used +F841_3.py:67:5: F841 [**] Local variable `y` is assigned to but never used | 65 | ) 66 | @@ -339,7 +339,7 @@ F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used 70 68 | 71 69 | def f(): -F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used +F841_3.py:72:24: F841 [**] Local variable `cm` is assigned to but never used | 71 | def f(): 72 | with Nested(m) as (cm): @@ -358,7 +358,7 @@ F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used 74 74 | 75 75 | -F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used +F841_3.py:77:25: F841 [**] Local variable `cm` is assigned to but never used | 76 | def f(): 77 | with (Nested(m) as (cm),): @@ -377,7 +377,7 @@ F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used 79 79 | 80 80 | -F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used +F841_3.py:87:26: F841 [**] Local variable `cm` is assigned to but never used | 86 | def f(): 87 | with (Nested(m)) as (cm): @@ -396,7 +396,7 @@ F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used 89 89 | 90 90 | -F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used +F841_3.py:92:5: F841 [**] Local variable `toplevel` is assigned to but never used | 91 | def f(): 92 | toplevel = tt = lexer.get_token() @@ -416,7 +416,7 @@ F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used 94 94 | break 95 95 | -F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used +F841_3.py:98:5: F841 [**] Local variable `toplevel` is assigned to but never used | 97 | def f(): 98 | toplevel = tt = lexer.get_token() @@ -434,7 +434,7 @@ F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used 100 100 | 101 101 | def f(): -F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used +F841_3.py:98:16: F841 [**] Local variable `tt` is assigned to but never used | 97 | def f(): 98 | toplevel = tt = lexer.get_token() @@ -452,7 +452,7 @@ F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used 100 100 | 101 101 | def f(): -F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never used +F841_3.py:102:5: F841 [**] Local variable `toplevel` is assigned to but never used | 101 | def f(): 102 | toplevel = (a, b) = lexer.get_token() @@ -470,7 +470,7 @@ F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never use 104 104 | 105 105 | def f(): -F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never used +F841_3.py:106:14: F841 [**] Local variable `toplevel` is assigned to but never used | 105 | def f(): 106 | (a, b) = toplevel = lexer.get_token() @@ -488,7 +488,7 @@ F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never us 108 108 | 109 109 | def f(): -F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never used +F841_3.py:110:5: F841 [**] Local variable `toplevel` is assigned to but never used | 109 | def f(): 110 | toplevel = tt = 1 @@ -506,7 +506,7 @@ F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never use 112 112 | 113 113 | def f(provided: int) -> int: -F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used +F841_3.py:110:16: F841 [**] Local variable `tt` is assigned to but never used | 109 | def f(): 110 | toplevel = tt = 1 @@ -604,7 +604,7 @@ F841_3.py:155:17: F841 [*] Local variable `e` is assigned to but never used 157 157 | 158 158 | -F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used +F841_3.py:160:5: F841 [**] Local variable `x` is assigned to but never used | 159 | def f(): 160 | x = 1 @@ -622,7 +622,7 @@ F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used 162 161 | 163 162 | -F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used +F841_3.py:161:5: F841 [**] Local variable `y` is assigned to but never used | 159 | def f(): 160 | x = 1 @@ -640,7 +640,7 @@ F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used 163 162 | 164 163 | def f(): -F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used +F841_3.py:165:5: F841 [**] Local variable `x` is assigned to but never used | 164 | def f(): 165 | x = 1 @@ -659,7 +659,7 @@ F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used 167 166 | y = 2 168 167 | -F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used +F841_3.py:167:5: F841 [**] Local variable `y` is assigned to but never used | 165 | x = 1 166 | @@ -677,7 +677,7 @@ F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used 169 168 | 170 169 | def f(): -F841_3.py:173:6: F841 [*] Local variable `x` is assigned to but never used +F841_3.py:173:6: F841 [**] Local variable `x` is assigned to but never used | 171 | (x) = foo() 172 | ((x)) = foo() diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap index c117fdff6e54dd..bb00f6126bc00d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap @@ -20,7 +20,7 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used 5 5 | 6 6 | -F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used +F841_0.py:20:5: F841 [**] Local variable `foo` is assigned to but never used | 19 | def f(): 20 | foo = (1, 2) @@ -60,7 +60,7 @@ F841_0.py:21:9: F841 Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used +F841_0.py:26:14: F841 [**] Local variable `baz` is assigned to but never used | 24 | (c, d) = bar 25 | @@ -79,7 +79,7 @@ F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used 28 28 | 29 29 | def f(): -F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used +F841_0.py:35:5: F841 [**] Local variable `_` is assigned to but never used | 34 | def f(): 35 | _ = 1 @@ -98,7 +98,7 @@ F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used 37 36 | _discarded = 1 38 37 | -F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used +F841_0.py:36:5: F841 [**] Local variable `__` is assigned to but never used | 34 | def f(): 35 | _ = 1 @@ -117,7 +117,7 @@ F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used 38 37 | 39 38 | -F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never used +F841_0.py:37:5: F841 [**] Local variable `_discarded` is assigned to but never used | 35 | _ = 1 36 | __ = 1 @@ -135,7 +135,7 @@ F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never us 39 38 | 40 39 | a = 1 -F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used +F841_0.py:51:9: F841 [**] Local variable `b` is assigned to but never used | 49 | def c(): 50 | # F841 @@ -156,7 +156,7 @@ F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used 53 53 | def d(): 54 54 | nonlocal b -F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used +F841_0.py:79:26: F841 [**] Local variable `my_file` is assigned to but never used | 78 | def f(): 79 | with open("file") as my_file, open("") as ((this, that)): @@ -175,7 +175,7 @@ F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used 81 81 | 82 82 | -F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used +F841_0.py:85:25: F841 [**] Local variable `my_file` is assigned to but never used | 83 | def f(): 84 | with ( @@ -196,7 +196,7 @@ F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used 87 87 | ): 88 88 | print("hello") -F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used +F841_0.py:102:5: F841 [**] Local variable `msg3` is assigned to but never used | 100 | msg1 = "Hello, world!" 101 | msg2 = "Hello, world!" @@ -216,7 +216,7 @@ F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used 104 103 | case 1: 105 104 | print(msg1) -F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used +F841_0.py:115:5: F841 [**] Local variable `Baz` is assigned to but never used | 113 | Foo = enum.Enum("Foo", "A B") 114 | Bar = enum.Enum("Bar", "A B") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap index 800e9671d8799e..44a778a7b88a08 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -import_aliasing.py:6:8: PLC0414 [*] Import alias does not rename original package +import_aliasing.py:6:8: PLC0414 [**] Import alias does not rename original package | 4 | # 2. consider-using-from-import 5 | @@ -22,7 +22,7 @@ import_aliasing.py:6:8: PLC0414 [*] Import alias does not rename original packag 8 8 | from collections import OrderedDict as o_dict 9 9 | import os.path as path # [consider-using-from-import] -import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original package +import_aliasing.py:7:25: PLC0414 [**] Import alias does not rename original package | 6 | import collections as collections # [useless-import-alias] 7 | from collections import OrderedDict as OrderedDict # [useless-import-alias] @@ -42,7 +42,7 @@ import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original packa 9 9 | import os.path as path # [consider-using-from-import] 10 10 | import os.path as p -import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original package +import_aliasing.py:16:15: PLC0414 [**] Import alias does not rename original package | 14 | import os as OS 15 | from sys import version @@ -63,7 +63,7 @@ import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original pack 18 18 | from . import bar 19 19 | from ..foo import bar as bar # [useless-import-alias] -import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original package +import_aliasing.py:19:19: PLC0414 [**] Import alias does not rename original package | 17 | from . import bar as Bar 18 | from . import bar @@ -84,7 +84,7 @@ import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original pack 21 21 | from ..foo.bar import foobar as anotherfoobar 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] -import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original package +import_aliasing.py:20:23: PLC0414 [**] Import alias does not rename original package | 18 | from . import bar 19 | from ..foo import bar as bar # [useless-import-alias] @@ -105,7 +105,7 @@ import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original pack 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] 23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] -import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original package +import_aliasing.py:22:15: PLC0414 [**] Import alias does not rename original package | 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] 21 | from ..foo.bar import foobar as anotherfoobar @@ -126,7 +126,7 @@ import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original pack 24 24 | from . import foo as bar, foo2 as bar2 25 25 | from foo.bar import foobar as foobar # [useless-import-alias] -import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original package +import_aliasing.py:23:27: PLC0414 [**] Import alias does not rename original package | 21 | from ..foo.bar import foobar as anotherfoobar 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] @@ -147,7 +147,7 @@ import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original pack 25 25 | from foo.bar import foobar as foobar # [useless-import-alias] 26 26 | from foo.bar import foobar as foo -import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original package +import_aliasing.py:25:21: PLC0414 [**] Import alias does not rename original package | 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] 24 | from . import foo as bar, foo2 as bar2 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap index 397b48cabc19a4..d794ebe58d6a1f 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_0.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_0.py:1:1: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | exit(0) | ^^^^ PLR1722 @@ -17,7 +17,7 @@ sys_exit_alias_0.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 3 4 | 4 5 | -sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_0.py:2:1: PLR1722 [**] Use `sys.exit()` instead of `quit` | 1 | exit(0) 2 | quit(0) @@ -34,7 +34,7 @@ sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 4 5 | 5 6 | def main(): -sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_0.py:6:5: PLR1722 [**] Use `sys.exit()` instead of `exit` | 5 | def main(): 6 | exit(2) @@ -54,7 +54,7 @@ sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 7 |+ sys.exit(2) 7 8 | quit(2) -sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_0.py:7:5: PLR1722 [**] Use `sys.exit()` instead of `quit` | 5 | def main(): 6 | exit(2) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap index aa9c93714b984d..1499b196df99e5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_1.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_1.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | import sys 2 | @@ -20,7 +20,7 @@ sys_exit_alias_1.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_1.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -38,7 +38,7 @@ sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_1.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` | 7 | def main(): 8 | exit(1) @@ -57,7 +57,7 @@ sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 10 10 | 11 11 | -sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_1.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap index 0fd61d5d82d151..fd65bba2841db8 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_11.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_11.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | from sys import * 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap index 24108309b0394a..36e0562dd2a252 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_12.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_12.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | import os \ 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap index 18c4cb9aceb542..7f4ed3ae677f13 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_2.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_2.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | import sys as sys2 2 | @@ -20,7 +20,7 @@ sys_exit_alias_2.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_2.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -38,7 +38,7 @@ sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_2.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` | 7 | def main(): 8 | exit(1) @@ -55,7 +55,7 @@ sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 8 |+ sys2.exit(1) 9 9 | quit(1) -sys_exit_alias_2.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_2.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap index 183ad4c91030d1..c787537c00f6be 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_3.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_3.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -19,7 +19,7 @@ sys_exit_alias_3.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_3.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap index 8b17e1511902fd..0492396b9e850e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_4.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_4.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | from sys import exit as exit2 2 | @@ -20,7 +20,7 @@ sys_exit_alias_4.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_4.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -38,7 +38,7 @@ sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_4.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` | 7 | def main(): 8 | exit(1) @@ -55,7 +55,7 @@ sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 8 |+ exit2(1) 9 9 | quit(1) -sys_exit_alias_4.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_4.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap index 80b8423a352d9e..0bd1350a3c8d51 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_5.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_5.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | from sys import * 2 | @@ -21,7 +21,7 @@ sys_exit_alias_5.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 5 6 | 6 7 | -sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_5.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -40,7 +40,7 @@ sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` 6 7 | 7 8 | def main(): -sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_5.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` | 7 | def main(): 8 | exit(1) @@ -62,7 +62,7 @@ sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` 9 |+ sys.exit(1) 9 10 | quit(1) -sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_5.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap index b257b7b923dbaa..48e652154f5d6d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_6.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_6.py:1:1: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | exit(0) | ^^^^ PLR1722 @@ -17,7 +17,7 @@ sys_exit_alias_6.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` 3 4 | 4 5 | -sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` +sys_exit_alias_6.py:2:1: PLR1722 [**] Use `sys.exit()` instead of `quit` | 1 | exit(0) 2 | quit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap index 5d64c2ee631939..c2400160908aa5 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_7.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_7.py:2:5: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | def main(): 2 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap index fa796c091fa4bb..d71599d72ccee4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_8.py:5:5: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_8.py:5:5: PLR1722 [**] Use `sys.exit()` instead of `exit` | 4 | def main(): 5 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap index 99d5f3389fc3a1..344032ff81c71c 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_9.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` +sys_exit_alias_9.py:2:5: PLR1722 [**] Use `sys.exit()` instead of `exit` | 1 | def main(): 2 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap index 268f805ab852bd..3bd813c3a11a50 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -nested_min_max.py:2:1: PLW3301 [*] Nested `min` calls can be flattened +nested_min_max.py:2:1: PLW3301 [**] Nested `min` calls can be flattened | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -19,7 +19,7 @@ nested_min_max.py:2:1: PLW3301 [*] Nested `min` calls can be flattened 4 4 | min(1, foo("a", "b"), min(3, 4)) 5 5 | min(1, max(2, 3)) -nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened +nested_min_max.py:3:1: PLW3301 [**] Nested `min` calls can be flattened | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -39,7 +39,7 @@ nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) -nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened +nested_min_max.py:3:8: PLW3301 [**] Nested `min` calls can be flattened | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -59,7 +59,7 @@ nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) -nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened +nested_min_max.py:4:1: PLW3301 [**] Nested `min` calls can be flattened | 2 | min(1, min(2, 3)) 3 | min(1, min(2, min(3, 4))) @@ -80,7 +80,7 @@ nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) -nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened +nested_min_max.py:7:1: PLW3301 [**] Nested `max` calls can be flattened | 5 | min(1, max(2, 3)) 6 | max(1, 2, 3) @@ -101,7 +101,7 @@ nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened 9 9 | max(1, foo("a", "b"), max(3, 4)) 10 10 | -nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened +nested_min_max.py:8:1: PLW3301 [**] Nested `max` calls can be flattened | 6 | max(1, 2, 3) 7 | max(1, max(2, 3)) @@ -121,7 +121,7 @@ nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened 10 10 | 11 11 | # These should not trigger; we do not flag cases with keyword args. -nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened +nested_min_max.py:8:8: PLW3301 [**] Nested `max` calls can be flattened | 6 | max(1, 2, 3) 7 | max(1, max(2, 3)) @@ -141,7 +141,7 @@ nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened 10 10 | 11 11 | # These should not trigger; we do not flag cases with keyword args. -nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened +nested_min_max.py:9:1: PLW3301 [**] Nested `max` calls can be flattened | 7 | max(1, max(2, 3)) 8 | max(1, max(2, max(3, 4))) @@ -162,7 +162,7 @@ nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened 11 11 | # These should not trigger; we do not flag cases with keyword args. 12 12 | min(1, min(2, 3), key=test) -nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened +nested_min_max.py:15:1: PLW3301 [**] Nested `min` calls can be flattened | 13 | min(1, min(2, 3, key=test)) 14 | # This will still trigger, to merge the calls without keyword args. @@ -196,7 +196,7 @@ nested_min_max.py:18:1: PLW3301 Nested `min` calls can be flattened | = help: Flatten nested `min` calls -nested_min_max.py:24:1: PLW3301 [*] Nested `min` calls can be flattened +nested_min_max.py:24:1: PLW3301 [**] Nested `min` calls can be flattened | 23 | # Handle iterable expressions. 24 | min(1, min(a)) @@ -216,7 +216,7 @@ nested_min_max.py:24:1: PLW3301 [*] Nested `min` calls can be flattened 26 26 | max(1, max(a)) 27 27 | max(1, max(i for i in range(10))) -nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened +nested_min_max.py:25:1: PLW3301 [**] Nested `min` calls can be flattened | 23 | # Handle iterable expressions. 24 | min(1, min(a)) @@ -237,7 +237,7 @@ nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened 27 27 | max(1, max(i for i in range(10))) 28 28 | -nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened +nested_min_max.py:26:1: PLW3301 [**] Nested `max` calls can be flattened | 24 | min(1, min(a)) 25 | min(1, min(i for i in range(10))) @@ -257,7 +257,7 @@ nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened 28 28 | 29 29 | tuples_list = [ -nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened +nested_min_max.py:27:1: PLW3301 [**] Nested `max` calls can be flattened | 25 | min(1, min(i for i in range(10))) 26 | max(1, max(a)) @@ -278,7 +278,7 @@ nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened 29 29 | tuples_list = [ 30 30 | (1, 2), -nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened +nested_min_max.py:41:1: PLW3301 [**] Nested `max` calls can be flattened | 40 | # Starred argument should be copied as it is. 41 | max(1, max(*a)) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap index eb262e352161d8..8bf07be8bf2655 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP005.py:6:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` +UP005.py:6:9: UP005 [**] `assertEquals` is deprecated, use `assertEqual` | 4 | class Suite(unittest.TestCase): 5 | def test(self) -> None: @@ -22,7 +22,7 @@ UP005.py:6:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` 8 8 | self.assertEqual(3, 4) 9 9 | self.failUnlessAlmostEqual(1, 1.1) -UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` +UP005.py:7:9: UP005 [**] `assertEquals` is deprecated, use `assertEqual` | 5 | def test(self) -> None: 6 | self.assertEquals (1, 2) @@ -43,7 +43,7 @@ UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` 9 9 | self.failUnlessAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") -UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmostEqual` +UP005.py:9:9: UP005 [**] `failUnlessAlmostEqual` is deprecated, use `assertAlmostEqual` | 7 | self.assertEquals(1, 2) 8 | self.assertEqual(3, 4) @@ -61,7 +61,7 @@ UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmost 9 |+ self.assertAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") -UP005.py:10:9: UP005 [*] `assertNotRegexpMatches` is deprecated, use `assertNotRegex` +UP005.py:10:9: UP005 [**] `assertNotRegexpMatches` is deprecated, use `assertNotRegex` | 8 | self.assertEqual(3, 4) 9 | self.failUnlessAlmostEqual(1, 1.1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap index c102b6d608464e..e86ec8dc6fb45a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap @@ -231,7 +231,7 @@ UP006_0.py:57:10: UP006 Use `list` instead of `List` for type annotation | = help: Replace with `list` -UP006_0.py:61:10: UP006 [*] Use `collections.deque` instead of `typing.Deque` for type annotation +UP006_0.py:61:10: UP006 [**] Use `collections.deque` instead of `typing.Deque` for type annotation | 61 | def f(x: typing.Deque[str]) -> None: | ^^^^^^^^^^^^ UP006 @@ -257,7 +257,7 @@ UP006_0.py:61:10: UP006 [*] Use `collections.deque` instead of `typing.Deque` fo 63 64 | 64 65 | -UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +UP006_0.py:65:10: UP006 [**] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation | 65 | def f(x: typing.DefaultDict[str, str]) -> None: | ^^^^^^^^^^^^^^^^^^ UP006 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap index 1cf174112856e7..39ac97bd668062 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP006_1.py:9:10: UP006 [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +UP006_1.py:9:10: UP006 [**] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation | 9 | def f(x: typing.DefaultDict[str, str]) -> None: | ^^^^^^^^^^^^^^^^^^ UP006 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap index 58ea6c2c8acc4e..ed18b6bf6e1d2f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP006_3.py:7:11: UP006 [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +UP006_3.py:7:11: UP006 [**] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation | 7 | def f(x: "typing.DefaultDict[str, str]") -> None: | ^^^^^^^^^^^^^^^^^^ UP006 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap index 9f97cb06324d5c..03966d2beb552f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP007.py:6:10: UP007 [*] Use `X | Y` for type annotations +UP007.py:6:10: UP007 [**] Use `X | Y` for type annotations | 6 | def f(x: Optional[str]) -> None: | ^^^^^^^^^^^^^ UP007 @@ -19,7 +19,7 @@ UP007.py:6:10: UP007 [*] Use `X | Y` for type annotations 8 8 | 9 9 | -UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations +UP007.py:10:10: UP007 [**] Use `X | Y` for type annotations | 10 | def f(x: typing.Optional[str]) -> None: | ^^^^^^^^^^^^^^^^^^^^ UP007 @@ -37,7 +37,7 @@ UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations 12 12 | 13 13 | -UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations +UP007.py:14:10: UP007 [**] Use `X | Y` for type annotations | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -55,7 +55,7 @@ UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations 16 16 | 17 17 | -UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations +UP007.py:14:26: UP007 [**] Use `X | Y` for type annotations | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: | ^^^^^^^^^^^^^^^^^^^ UP007 @@ -73,7 +73,7 @@ UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations 16 16 | 17 17 | -UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations +UP007.py:18:10: UP007 [**] Use `X | Y` for type annotations | 18 | def f(x: typing.Union[str, int]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -91,7 +91,7 @@ UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations 20 20 | 21 21 | -UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations +UP007.py:22:10: UP007 [**] Use `X | Y` for type annotations | 22 | def f(x: typing.Union[(str, int)]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -109,7 +109,7 @@ UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations 24 24 | 25 25 | -UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations +UP007.py:26:10: UP007 [**] Use `X | Y` for type annotations | 26 | def f(x: typing.Union[(str, int), float]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -127,7 +127,7 @@ UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations 28 28 | 29 29 | -UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations +UP007.py:30:10: UP007 [**] Use `X | Y` for type annotations | 30 | def f(x: typing.Union[(int,)]) -> None: | ^^^^^^^^^^^^^^^^^^^^ UP007 @@ -145,7 +145,7 @@ UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations 32 32 | 33 33 | -UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations +UP007.py:34:10: UP007 [**] Use `X | Y` for type annotations | 34 | def f(x: typing.Union[()]) -> None: | ^^^^^^^^^^^^^^^^ UP007 @@ -163,7 +163,7 @@ UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations 36 36 | 37 37 | -UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations +UP007.py:38:11: UP007 [**] Use `X | Y` for type annotations | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -181,7 +181,7 @@ UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations 40 40 | 41 41 | -UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations +UP007.py:38:27: UP007 [**] Use `X | Y` for type annotations | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: | ^^^^^^^^^^^^^^^^^^^ UP007 @@ -199,7 +199,7 @@ UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations 40 40 | 41 41 | -UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations +UP007.py:42:11: UP007 [**] Use `X | Y` for type annotations | 42 | def f(x: "typing.Union[str, int]") -> None: | ^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -217,7 +217,7 @@ UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations 44 44 | 45 45 | -UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations +UP007.py:55:8: UP007 [**] Use `X | Y` for type annotations | 54 | def f() -> None: 55 | x: Optional[str] @@ -258,7 +258,7 @@ UP007.py:58:9: UP007 Use `X | Y` for type annotations | = help: Convert to `X | Y` -UP007.py:60:8: UP007 [*] Use `X | Y` for type annotations +UP007.py:60:8: UP007 [**] Use `X | Y` for type annotations | 58 | x = Union[str, int] 59 | x = Union["str", "int"] @@ -278,7 +278,7 @@ UP007.py:60:8: UP007 [*] Use `X | Y` for type annotations 62 62 | 63 63 | -UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations +UP007.py:61:8: UP007 [**] Use `X | Y` for type annotations | 59 | x = Union["str", "int"] 60 | x: Union[str, int] @@ -369,7 +369,7 @@ UP007.py:96:10: UP007 Use `X | Y` for type annotations | = help: Convert to `X | Y` -UP007.py:102:28: UP007 [*] Use `X | Y` for type annotations +UP007.py:102:28: UP007 [**] Use `X | Y` for type annotations | 100 | # Regression test for: https://github.com/astral-sh/ruff/issues/7131 101 | class ServiceRefOrValue: @@ -395,7 +395,7 @@ UP007.py:102:28: UP007 [*] Use `X | Y` for type annotations 107 104 | 108 105 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 -UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations +UP007.py:110:28: UP007 [**] Use `X | Y` for type annotations | 108 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 109 | class ServiceRefOrValue: diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap index 0ff5607820a4ce..289cefd4d35ef3 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` +UP008.py:17:23: UP008 [**] Use `super()` instead of `super(__class__, self)` | 16 | def wrong(self): 17 | parent = super(Child, self) # wrong @@ -21,7 +21,7 @@ UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` 19 19 | super( 20 20 | Child, -UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` +UP008.py:18:14: UP008 [**] Use `super()` instead of `super(__class__, self)` | 16 | def wrong(self): 17 | parent = super(Child, self) # wrong @@ -42,7 +42,7 @@ UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 20 20 | Child, 21 21 | self, -UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` +UP008.py:19:14: UP008 [**] Use `super()` instead of `super(__class__, self)` | 17 | parent = super(Child, self) # wrong 18 | super(Child, self).method # wrong @@ -68,7 +68,7 @@ UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 24 21 | 25 22 | class BaseClass: -UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` +UP008.py:36:14: UP008 [**] Use `super()` instead of `super(__class__, self)` | 34 | class MyClass(BaseClass): 35 | def normal(self): @@ -88,7 +88,7 @@ UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` 38 38 | 39 39 | def different_argument(self, other): -UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` +UP008.py:50:18: UP008 [**] Use `super()` instead of `super(__class__, self)` | 49 | def inner_argument(self): 50 | super(MyClass, self).f() # can use super() diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap index e6ec10b65009ff..2f5b2a665711ef 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP010.py:1:1: UP010 [*] Unnecessary `__future__` imports `generators`, `nested_scopes` for target Python version +UP010.py:1:1: UP010 [**] Unnecessary `__future__` imports `generators`, `nested_scopes` for target Python version | 1 | from __future__ import nested_scopes, generators | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP010 @@ -16,7 +16,7 @@ UP010.py:1:1: UP010 [*] Unnecessary `__future__` imports `generators`, `nested_s 3 2 | from __future__ import absolute_import, division 4 3 | from __future__ import generator_stop -UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `with_statement` for target Python version +UP010.py:2:1: UP010 [**] Unnecessary `__future__` imports `unicode_literals`, `with_statement` for target Python version | 1 | from __future__ import nested_scopes, generators 2 | from __future__ import with_statement, unicode_literals @@ -33,7 +33,7 @@ UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `wi 4 3 | from __future__ import generator_stop 5 4 | from __future__ import print_function, generator_stop -UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `division` for target Python version +UP010.py:3:1: UP010 [**] Unnecessary `__future__` imports `absolute_import`, `division` for target Python version | 1 | from __future__ import nested_scopes, generators 2 | from __future__ import with_statement, unicode_literals @@ -52,7 +52,7 @@ UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `div 5 4 | from __future__ import print_function, generator_stop 6 5 | from __future__ import invalid_module, generators -UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version +UP010.py:4:1: UP010 [**] Unnecessary `__future__` import `generator_stop` for target Python version | 2 | from __future__ import with_statement, unicode_literals 3 | from __future__ import absolute_import, division @@ -72,7 +72,7 @@ UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar 6 5 | from __future__ import invalid_module, generators 7 6 | -UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `print_function` for target Python version +UP010.py:5:1: UP010 [**] Unnecessary `__future__` imports `generator_stop`, `print_function` for target Python version | 3 | from __future__ import absolute_import, division 4 | from __future__ import generator_stop @@ -91,7 +91,7 @@ UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `prin 7 6 | 8 7 | if True: -UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target Python version +UP010.py:6:1: UP010 [**] Unnecessary `__future__` import `generators` for target Python version | 4 | from __future__ import generator_stop 5 | from __future__ import print_function, generator_stop @@ -112,7 +112,7 @@ UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target 8 8 | if True: 9 9 | from __future__ import generator_stop -UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version +UP010.py:9:5: UP010 [**] Unnecessary `__future__` import `generator_stop` for target Python version | 8 | if True: 9 | from __future__ import generator_stop @@ -130,7 +130,7 @@ UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for tar 11 10 | 12 11 | if True: -UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target Python version +UP010.py:10:5: UP010 [**] Unnecessary `__future__` import `generators` for target Python version | 8 | if True: 9 | from __future__ import generator_stop @@ -150,7 +150,7 @@ UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target 12 11 | if True: 13 12 | from __future__ import generator_stop -UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version +UP010.py:13:5: UP010 [**] Unnecessary `__future__` import `generator_stop` for target Python version | 12 | if True: 13 | from __future__ import generator_stop @@ -166,7 +166,7 @@ UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for ta 13 |- from __future__ import generator_stop 14 13 | from __future__ import invalid_module, generators -UP010.py:14:5: UP010 [*] Unnecessary `__future__` import `generators` for target Python version +UP010.py:14:5: UP010 [**] Unnecessary `__future__` import `generators` for target Python version | 12 | if True: 13 | from __future__ import generator_stop diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap index 7f6103fcdb1166..8a5057c2923fa1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP013.py:5:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:5:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 4 | # dict literal 5 | MyType = TypedDict("MyType", {"a": int, "b": str}) @@ -23,7 +23,7 @@ UP013.py:5:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy 7 9 | # dict call 8 10 | MyType = TypedDict("MyType", dict(a=int, b=str)) -UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:8:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 7 | # dict call 8 | MyType = TypedDict("MyType", dict(a=int, b=str)) @@ -45,7 +45,7 @@ UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class sy 10 12 | # kwargs 11 13 | MyType = TypedDict("MyType", a=int, b=str) -UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:11:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 10 | # kwargs 11 | MyType = TypedDict("MyType", a=int, b=str) @@ -67,7 +67,7 @@ UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 13 15 | # Empty TypedDict 14 16 | MyType = TypedDict("MyType") -UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:14:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 13 | # Empty TypedDict 14 | MyType = TypedDict("MyType") @@ -88,7 +88,7 @@ UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 16 17 | # Literal values 17 18 | MyType = TypedDict("MyType", {"a": "hello"}) -UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:17:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 16 | # Literal values 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -108,7 +108,7 @@ UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 19 20 | 20 21 | # NotRequired -UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:18:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 16 | # Literal values 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -130,7 +130,7 @@ UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 20 21 | # NotRequired 21 22 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) -UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:21:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 20 | # NotRequired 21 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) @@ -151,7 +151,7 @@ UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 23 24 | # total 24 25 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) -UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:24:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 23 | # total 24 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) @@ -173,7 +173,7 @@ UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 26 28 | # using Literal type 27 29 | MyType = TypedDict("MyType", {"key": Literal["value"]}) -UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:27:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 26 | # using Literal type 27 | MyType = TypedDict("MyType", {"key": Literal["value"]}) @@ -194,7 +194,7 @@ UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 29 30 | # using namespace TypedDict 30 31 | MyType = typing.TypedDict("MyType", {"key": int}) -UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:30:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 29 | # using namespace TypedDict 30 | MyType = typing.TypedDict("MyType", {"key": int}) @@ -215,7 +215,7 @@ UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 32 33 | # invalid identifiers (OK) 33 34 | MyType = TypedDict("MyType", {"in": int, "x-y": int}) -UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:40:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 39 | # Empty dict literal 40 | MyType = TypedDict("MyType", {}) @@ -236,7 +236,7 @@ UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class s 42 43 | # Empty dict call 43 44 | MyType = TypedDict("MyType", dict()) -UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:43:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax | 42 | # Empty dict call 43 | MyType = TypedDict("MyType", dict()) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap index f7e9dd895e6270..e13aad4bd109cf 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP014.py:5:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:5:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax | 4 | # with complex annotations 5 | MyType = NamedTuple("MyType", [("a", int), ("b", tuple[str, ...])]) @@ -23,7 +23,7 @@ UP014.py:5:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s 7 9 | # with namespace 8 10 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) -UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:8:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax | 7 | # with namespace 8 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) @@ -45,7 +45,7 @@ UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class s 10 12 | # invalid identifiers (OK) 11 13 | MyType = NamedTuple("MyType", [("x-y", int), ("b", tuple[str, ...])]) -UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:14:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax | 13 | # no fields 14 | MyType = typing.NamedTuple("MyType") @@ -66,7 +66,7 @@ UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 16 17 | # empty fields 17 18 | MyType = typing.NamedTuple("MyType", []) -UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:17:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax | 16 | # empty fields 17 | MyType = typing.NamedTuple("MyType", []) @@ -87,7 +87,7 @@ UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class 19 20 | # keywords 20 21 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) -UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:20:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax | 19 | # keywords 20 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap index 6638a8cc904a74..896e53d7cd5736 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP020.py:3:6: UP020 [*] Use builtin `open` +UP020.py:3:6: UP020 [**] Use builtin `open` | 1 | import io 2 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap index 484e53f1d84aab..0f6be39f186317 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP021.py:5:25: UP021 [*] `universal_newlines` is deprecated, use `text` +UP021.py:5:25: UP021 [**] `universal_newlines` is deprecated, use `text` | 4 | # Errors 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -21,7 +21,7 @@ UP021.py:5:25: UP021 [*] `universal_newlines` is deprecated, use `text` 7 7 | run(["foo"], universal_newlines=True, check=False) 8 8 | -UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` +UP021.py:6:25: UP021 [**] `universal_newlines` is deprecated, use `text` | 4 | # Errors 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -41,7 +41,7 @@ UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` 8 8 | 9 9 | # OK -UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` +UP021.py:7:14: UP021 [**] `universal_newlines` is deprecated, use `text` | 5 | subprocess.run(["foo"], universal_newlines=True, check=True) 6 | subprocess.run(["foo"], universal_newlines=True, text=True) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap index 186db762542e54..8b37f71834e5eb 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP022.py:4:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:4:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 2 | import subprocess 3 | @@ -22,7 +22,7 @@ UP022.py:4:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, 6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 7 | -UP022.py:6:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:6:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 5 | @@ -43,7 +43,7 @@ UP022.py:6:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, 8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 9 | -UP022.py:8:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:8:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 | @@ -64,7 +64,7 @@ UP022.py:8:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, 10 10 | output = subprocess.run( 11 11 | ["foo"], stdout=subprocess.PIPE, check=True, stderr=subprocess.PIPE -UP022.py:10:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:10:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 | @@ -88,7 +88,7 @@ UP022.py:10:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, 13 13 | 14 14 | output = subprocess.run( -UP022.py:14:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:14:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 12 | ) 13 | @@ -112,7 +112,7 @@ UP022.py:14:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, 17 17 | 18 18 | output = subprocess.run( -UP022.py:18:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:18:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 16 | ) 17 | @@ -144,7 +144,7 @@ UP022.py:18:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, 24 23 | encoding="utf-8", 25 24 | close_fds=True, -UP022.py:29:14: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:29:14: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 28 | if output: 29 | output = subprocess.run( diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap index 6944c7925b1758..37cbfe306959a2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:2:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 1 | # These two imports have something after cElementTree, so they should be fixed. 2 | from xml.etree.cElementTree import XML, Element, SubElement @@ -18,7 +18,7 @@ UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 4 4 | 5 5 | # Weird spacing should not cause issues. -UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:3:8: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 1 | # These two imports have something after cElementTree, so they should be fixed. 2 | from xml.etree.cElementTree import XML, Element, SubElement @@ -38,7 +38,7 @@ UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 5 5 | # Weird spacing should not cause issues. 6 6 | from xml.etree.cElementTree import XML -UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:6:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 5 | # Weird spacing should not cause issues. 6 | from xml.etree.cElementTree import XML @@ -57,7 +57,7 @@ UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 8 8 | 9 9 | # Multi line imports should also work fine. -UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:7:11: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 5 | # Weird spacing should not cause issues. 6 | from xml.etree.cElementTree import XML @@ -78,7 +78,7 @@ UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 9 9 | # Multi line imports should also work fine. 10 10 | from xml.etree.cElementTree import ( -UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:10:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 9 | # Multi line imports should also work fine. 10 | / from xml.etree.cElementTree import ( @@ -102,7 +102,7 @@ UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 12 12 | Element, 13 13 | SubElement, -UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:16:12: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 14 | ) 15 | if True: @@ -122,7 +122,7 @@ UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 18 18 | 19 19 | from xml.etree import cElementTree as ET -UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:17:27: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 15 | if True: 16 | import xml.etree.cElementTree as ET @@ -143,7 +143,7 @@ UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 19 19 | from xml.etree import cElementTree as ET 20 20 | -UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:19:23: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 17 | from xml.etree import cElementTree as CET 18 | @@ -164,7 +164,7 @@ UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 21 21 | import contextlib, xml.etree.cElementTree as ET 22 22 | -UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:21:20: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 19 | from xml.etree import cElementTree as ET 20 | @@ -185,7 +185,7 @@ UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` 23 23 | # This should fix the second, but not the first invocation. 24 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET -UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` +UP023.py:24:32: UP023 [**] `cElementTree` is deprecated, use `ElementTree` | 23 | # This should fix the second, but not the first invocation. 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap index fb8ecac7ec0a9b..b4c6a9b54ffced 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:3:12: UP026 [**] `mock` is deprecated, use `unittest.mock` | 1 | # Error (`from unittest import mock`) 2 | if True: @@ -21,7 +21,7 @@ UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 5 5 | # Error (`from unittest import mock`) 6 6 | if True: -UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:7:12: UP026 [**] `mock` is deprecated, use `unittest.mock` | 5 | # Error (`from unittest import mock`) 6 | if True: @@ -43,7 +43,7 @@ UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 9 10 | # Error (`from unittest.mock import *`) 10 11 | if True: -UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:11:5: UP026 [**] `mock` is deprecated, use `unittest.mock` | 9 | # Error (`from unittest.mock import *`) 10 | if True: @@ -64,7 +64,7 @@ UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` 13 13 | # Error (`from unittest import mock`) 14 14 | import mock.mock -UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:14:8: UP026 [**] `mock` is deprecated, use `unittest.mock` | 13 | # Error (`from unittest import mock`) 14 | import mock.mock @@ -84,7 +84,7 @@ UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 16 16 | # Error (`from unittest import mock`) 17 17 | import contextlib, mock, sys -UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:17:20: UP026 [**] `mock` is deprecated, use `unittest.mock` | 16 | # Error (`from unittest import mock`) 17 | import contextlib, mock, sys @@ -105,7 +105,7 @@ UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` 19 20 | # Error (`from unittest import mock`) 20 21 | import mock, sys -UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:20:8: UP026 [**] `mock` is deprecated, use `unittest.mock` | 19 | # Error (`from unittest import mock`) 20 | import mock, sys @@ -125,7 +125,7 @@ UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 22 23 | 23 24 | # Error (`from unittest import mock`) -UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:24:1: UP026 [**] `mock` is deprecated, use `unittest.mock` | 23 | # Error (`from unittest import mock`) 24 | from mock import mock @@ -145,7 +145,7 @@ UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 26 26 | # Error (keep trailing comma) 27 27 | from mock import ( -UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:27:1: UP026 [**] `mock` is deprecated, use `unittest.mock` | 26 | # Error (keep trailing comma) 27 | / from mock import ( @@ -176,7 +176,7 @@ UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 34 34 | a, 35 35 | b, -UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:33:1: UP026 [**] `mock` is deprecated, use `unittest.mock` | 31 | c, 32 | ) @@ -208,7 +208,7 @@ UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 40 40 | # Error (avoid trailing comma) 41 41 | from mock import ( -UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:41:1: UP026 [**] `mock` is deprecated, use `unittest.mock` | 40 | # Error (avoid trailing comma) 41 | / from mock import ( @@ -239,7 +239,7 @@ UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 48 48 | a, 49 49 | b, -UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:47:1: UP026 [**] `mock` is deprecated, use `unittest.mock` | 45 | c 46 | ) @@ -272,7 +272,7 @@ UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 54 54 | from mock import a, b, c, mock 55 55 | -UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:53:1: UP026 [**] `mock` is deprecated, use `unittest.mock` | 51 | mock 52 | ) @@ -293,7 +293,7 @@ UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 55 56 | 56 57 | if True: -UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:54:1: UP026 [**] `mock` is deprecated, use `unittest.mock` | 52 | ) 53 | from mock import mock, a, b, c @@ -315,7 +315,7 @@ UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 56 57 | if True: 57 58 | if False: -UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:58:9: UP026 [**] `mock` is deprecated, use `unittest.mock` | 56 | if True: 57 | if False: @@ -348,7 +348,7 @@ UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` 65 65 | # OK 66 66 | import os, io -UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:69:8: UP026 [**] `mock` is deprecated, use `unittest.mock` | 68 | # Error (`from unittest import mock`) 69 | import mock, mock @@ -369,7 +369,7 @@ UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo -UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:69:14: UP026 [**] `mock` is deprecated, use `unittest.mock` | 68 | # Error (`from unittest import mock`) 69 | import mock, mock @@ -390,7 +390,7 @@ UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo -UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:72:8: UP026 [**] `mock` is deprecated, use `unittest.mock` | 71 | # Error (`from unittest import mock as foo`) 72 | import mock as foo @@ -410,7 +410,7 @@ UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` 74 74 | # Error (`from unittest import mock as foo`) 75 75 | from mock import mock as foo -UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:75:1: UP026 [**] `mock` is deprecated, use `unittest.mock` | 74 | # Error (`from unittest import mock as foo`) 75 | from mock import mock as foo @@ -430,7 +430,7 @@ UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. -UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:79:12: UP026 [**] `mock` is deprecated, use `unittest.mock` | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -453,7 +453,7 @@ UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:79:25: UP026 [**] `mock` is deprecated, use `unittest.mock` | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -476,7 +476,7 @@ UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:79:38: UP026 [**] `mock` is deprecated, use `unittest.mock` | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -499,7 +499,7 @@ UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:82:12: UP026 [**] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -522,7 +522,7 @@ UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:82:25: UP026 [**] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -545,7 +545,7 @@ UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:82:38: UP026 [**] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -568,7 +568,7 @@ UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:86:5: UP026 [**] `mock` is deprecated, use `unittest.mock` | 84 | if True: 85 | # This should yield multiple, aliased imports. @@ -589,7 +589,7 @@ UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` 88 90 | 89 91 | # OK. -UP026.py:93:5: UP026 [*] `mock` is deprecated, use `unittest.mock` +UP026.py:93:5: UP026 [**] `mock` is deprecated, use `unittest.mock` | 92 | # Error (`mock.Mock()`). 93 | x = mock.mock.Mock() diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap index db56ed7f7d5934..95eaadcfa13310 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP027.py:2:17: UP027 [*] Replace unpacked list comprehension with a generator expression +UP027.py:2:17: UP027 [**] Replace unpacked list comprehension with a generator expression | 1 | # Should change 2 | foo, bar, baz = [fn(x) for x in items] @@ -19,7 +19,7 @@ UP027.py:2:17: UP027 [*] Replace unpacked list comprehension with a generator ex 4 4 | foo, bar, baz =[fn(x) for x in items] 5 5 | -UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator expression +UP027.py:4:16: UP027 [**] Replace unpacked list comprehension with a generator expression | 2 | foo, bar, baz = [fn(x) for x in items] 3 | @@ -40,7 +40,7 @@ UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator ex 6 6 | foo, bar, baz = [fn(x) for x in items] 7 7 | -UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator expression +UP027.py:6:26: UP027 [**] Replace unpacked list comprehension with a generator expression | 4 | foo, bar, baz =[fn(x) for x in items] 5 | @@ -61,7 +61,7 @@ UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator ex 8 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 9 | -UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator expression +UP027.py:8:17: UP027 [**] Replace unpacked list comprehension with a generator expression | 6 | foo, bar, baz = [fn(x) for x in items] 7 | @@ -82,7 +82,7 @@ UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator ex 10 10 | foo, bar, baz = [ 11 11 | fn(x) -UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator expression +UP027.py:10:17: UP027 [**] Replace unpacked list comprehension with a generator expression | 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap index 12c38221bfd00c..555ee3158a2477 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:2:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 1 | def f(): 2 | for x in y: @@ -20,7 +20,7 @@ UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 5 4 | 6 5 | def g(): -UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:7:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 6 | def g(): 7 | for x, y in z: @@ -41,7 +41,7 @@ UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 10 9 | 11 10 | def h(): -UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:12:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 11 | def h(): 12 | for x in [1, 2, 3]: @@ -62,7 +62,7 @@ UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 15 14 | 16 15 | def i(): -UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:17:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 16 | def i(): 17 | for x in {x for x in y}: @@ -83,7 +83,7 @@ UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 20 19 | 21 20 | def j(): -UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:22:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 21 | def j(): 22 | for x in (1, 2, 3): @@ -104,7 +104,7 @@ UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 25 24 | 26 25 | def k(): -UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:27:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 26 | def k(): 27 | for x, y in {3: "x", 6: "y"}: @@ -125,7 +125,7 @@ UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 30 29 | 31 30 | def f(): # Comment one\n' -UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:33:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 31 | def f(): # Comment one\n' 32 | # Comment two\n' @@ -159,7 +159,7 @@ UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 41 39 | 42 40 | -UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:44:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 43 | def f(): 44 | for x, y in [{3: (3, [44, "long ss"]), 6: "y"}]: @@ -180,7 +180,7 @@ UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 47 46 | 48 47 | def f(): -UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:49:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 48 | def f(): 49 | for x, y in z(): @@ -203,7 +203,7 @@ UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 52 51 | def f(): 53 52 | def func(): -UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:55:9: UP028 [**] Replace `yield` over `for` loop with `yield from` | 53 | def func(): 54 | # This comment is preserved\n' @@ -229,7 +229,7 @@ UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` 59 57 | # Comment\n' 60 58 | def g(): -UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:67:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 65 | for x in y: 66 | yield x @@ -251,7 +251,7 @@ UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 70 69 | 71 70 | def f(): -UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:72:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 71 | def f(): 72 | for x, y in z(): @@ -273,7 +273,7 @@ UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` 75 74 | 76 75 | -UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` +UP028_0.py:79:5: UP028 [**] Replace `yield` over `for` loop with `yield from` | 77 | # Regression test for: https://github.com/astral-sh/ruff/issues/7103 78 | def _serve_method(fn): diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap index f094fbd50c3a62..100e3da5260fa1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP029.py:1:1: UP029 [*] Unnecessary builtin import: `*` +UP029.py:1:1: UP029 [**] Unnecessary builtin import: `*` | 1 | from builtins import * | ^^^^^^^^^^^^^^^^^^^^^^ UP029 @@ -16,7 +16,7 @@ UP029.py:1:1: UP029 [*] Unnecessary builtin import: `*` 3 2 | from builtins import str as _str 4 3 | from six.moves import filter, zip, zip_longest -UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` +UP029.py:2:1: UP029 [**] Unnecessary builtin imports: `ascii`, `bytes` | 1 | from builtins import * 2 | from builtins import ascii, bytes, compile @@ -34,7 +34,7 @@ UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` 4 4 | from six.moves import filter, zip, zip_longest 5 5 | from io import open -UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` +UP029.py:4:1: UP029 [**] Unnecessary builtin imports: `filter`, `zip` | 2 | from builtins import ascii, bytes, compile 3 | from builtins import str as _str @@ -55,7 +55,7 @@ UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` 6 6 | import io 7 7 | import six -UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` +UP029.py:5:1: UP029 [**] Unnecessary builtin import: `open` | 3 | from builtins import str as _str 4 | from six.moves import filter, zip, zip_longest diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap index 58595ab3a73cbc..b0d847cac9a711 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:3:1: UP030 [**] Use implicit references for positional format fields | 1 | # Invalid calls; errors expected. 2 | @@ -21,7 +21,7 @@ UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields 5 5 | "a {3} complicated {1} string with {0} {2}".format( 6 6 | "first", "second", "third", "fourth" -UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:5:1: UP030 [**] Use implicit references for positional format fields | 3 | "{0}" "{1}" "{2}".format(1, 2, 3) 4 | @@ -46,7 +46,7 @@ UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields 8 8 | 9 9 | '{0}'.format(1) -UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:9:1: UP030 [**] Use implicit references for positional format fields | 7 | ) 8 | @@ -67,7 +67,7 @@ UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields 11 11 | '{0:x}'.format(30) 12 12 | -UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:11:1: UP030 [**] Use implicit references for positional format fields | 9 | '{0}'.format(1) 10 | @@ -88,7 +88,7 @@ UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields 13 13 | x = '{0}'.format(1) 14 14 | -UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields +UP030_0.py:13:5: UP030 [**] Use implicit references for positional format fields | 11 | '{0:x}'.format(30) 12 | @@ -109,7 +109,7 @@ UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields 15 15 | '''{0}\n{1}\n'''.format(1, 2) 16 16 | -UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:15:1: UP030 [**] Use implicit references for positional format fields | 13 | x = '{0}'.format(1) 14 | @@ -130,7 +130,7 @@ UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields 17 17 | x = "foo {0}" \ 18 18 | "bar {1}".format(1, 2) -UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields +UP030_0.py:17:5: UP030 [**] Use implicit references for positional format fields | 15 | '''{0}\n{1}\n'''.format(1, 2) 16 | @@ -155,7 +155,7 @@ UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields 20 20 | ("{0}").format(1) 21 21 | -UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:20:1: UP030 [**] Use implicit references for positional format fields | 18 | "bar {1}".format(1, 2) 19 | @@ -176,7 +176,7 @@ UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields 22 22 | "\N{snowman} {0}".format(1) 23 23 | -UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:22:1: UP030 [**] Use implicit references for positional format fields | 20 | ("{0}").format(1) 21 | @@ -197,7 +197,7 @@ UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields 24 24 | print( 25 25 | 'foo{0}' -UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields +UP030_0.py:25:5: UP030 [**] Use implicit references for positional format fields | 24 | print( 25 | 'foo{0}' @@ -220,7 +220,7 @@ UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields 28 28 | 29 29 | print( -UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields +UP030_0.py:30:5: UP030 [**] Use implicit references for positional format fields | 29 | print( 30 | 'foo{0}' # ohai\n" @@ -254,7 +254,7 @@ UP030_0.py:34:1: UP030 Use implicit references for positional format fields | = help: Remove explicit positional indices -UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:39:1: UP030 [**] Use implicit references for positional format fields | 37 | kwargs = {x: x for x in range(10)} 38 | @@ -275,7 +275,7 @@ UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields 41 41 | "{0}".format(**kwargs) 42 42 | -UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:41:1: UP030 [**] Use implicit references for positional format fields | 39 | "{0}".format(*args) 40 | @@ -296,7 +296,7 @@ UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields 43 43 | "{0}_{1}".format(*args) 44 44 | -UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:43:1: UP030 [**] Use implicit references for positional format fields | 41 | "{0}".format(**kwargs) 42 | @@ -317,7 +317,7 @@ UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields 45 45 | "{0}_{1}".format(1, *args) 46 46 | -UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:45:1: UP030 [**] Use implicit references for positional format fields | 43 | "{0}_{1}".format(*args) 44 | @@ -338,7 +338,7 @@ UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields 47 47 | "{0}_{1}".format(1, 2, *args) 48 48 | -UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:47:1: UP030 [**] Use implicit references for positional format fields | 45 | "{0}_{1}".format(1, *args) 46 | @@ -359,7 +359,7 @@ UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields 49 49 | "{0}_{1}".format(*args, 1, 2) 50 50 | -UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:49:1: UP030 [**] Use implicit references for positional format fields | 47 | "{0}_{1}".format(1, 2, *args) 48 | @@ -380,7 +380,7 @@ UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields 51 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 52 | -UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:51:1: UP030 [**] Use implicit references for positional format fields | 49 | "{0}_{1}".format(*args, 1, 2) 50 | @@ -401,7 +401,7 @@ UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields 53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 54 | -UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:53:1: UP030 [**] Use implicit references for positional format fields | 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 | @@ -422,7 +422,7 @@ UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields 55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 56 | -UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:55:1: UP030 [**] Use implicit references for positional format fields | 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 | @@ -443,7 +443,7 @@ UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields 57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 58 | -UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:57:1: UP030 [**] Use implicit references for positional format fields | 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 | @@ -464,7 +464,7 @@ UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields 59 59 | "{1}_{0}".format(1, 2, *args) 60 60 | -UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:59:1: UP030 [**] Use implicit references for positional format fields | 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 | @@ -484,7 +484,7 @@ UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields 60 60 | 61 61 | "{1}_{0}".format(1, 2) -UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields +UP030_0.py:61:1: UP030 [**] Use implicit references for positional format fields | 59 | "{1}_{0}".format(1, 2, *args) 60 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap index 45ed171e744b43..58751746014ae5 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:4:7: UP031 [**] Use format specifiers instead of percent format | 3 | # UP031 4 | print('%s %s' % (a, b)) @@ -21,7 +21,7 @@ UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format 6 6 | print('%s%s' % (a, b)) 7 7 | -UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:6:7: UP031 [**] Use format specifiers instead of percent format | 4 | print('%s %s' % (a, b)) 5 | @@ -42,7 +42,7 @@ UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format 8 8 | print("trivial" % ()) 9 9 | -UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:8:7: UP031 [**] Use format specifiers instead of percent format | 6 | print('%s%s' % (a, b)) 7 | @@ -63,7 +63,7 @@ UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format 10 10 | print("%s" % ("simple",)) 11 11 | -UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:10:7: UP031 [**] Use format specifiers instead of percent format | 8 | print("trivial" % ()) 9 | @@ -84,7 +84,7 @@ UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format 12 12 | print("%s" % ("%s" % ("nested",),)) 13 13 | -UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:12:7: UP031 [**] Use format specifiers instead of percent format | 10 | print("%s" % ("simple",)) 11 | @@ -105,7 +105,7 @@ UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | -UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:12:15: UP031 [**] Use format specifiers instead of percent format | 10 | print("%s" % ("simple",)) 11 | @@ -126,7 +126,7 @@ UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | -UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:14:7: UP031 [**] Use format specifiers instead of percent format | 12 | print("%s" % ("%s" % ("nested",),)) 13 | @@ -147,7 +147,7 @@ UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format 16 16 | print("%f" % (15,)) 17 17 | -UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:16:7: UP031 [**] Use format specifiers instead of percent format | 14 | print("%s%% percent" % (15,)) 15 | @@ -168,7 +168,7 @@ UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format 18 18 | print("%.f" % (15,)) 19 19 | -UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:18:7: UP031 [**] Use format specifiers instead of percent format | 16 | print("%f" % (15,)) 17 | @@ -189,7 +189,7 @@ UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format 20 20 | print("%.3f" % (15,)) 21 21 | -UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:20:7: UP031 [**] Use format specifiers instead of percent format | 18 | print("%.f" % (15,)) 19 | @@ -210,7 +210,7 @@ UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format 22 22 | print("%3f" % (15,)) 23 23 | -UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:22:7: UP031 [**] Use format specifiers instead of percent format | 20 | print("%.3f" % (15,)) 21 | @@ -231,7 +231,7 @@ UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format 24 24 | print("%-5f" % (5,)) 25 25 | -UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:24:7: UP031 [**] Use format specifiers instead of percent format | 22 | print("%3f" % (15,)) 23 | @@ -252,7 +252,7 @@ UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format 26 26 | print("%9f" % (5,)) 27 27 | -UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:26:7: UP031 [**] Use format specifiers instead of percent format | 24 | print("%-5f" % (5,)) 25 | @@ -273,7 +273,7 @@ UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format 28 28 | print("%#o" % (123,)) 29 29 | -UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:28:7: UP031 [**] Use format specifiers instead of percent format | 26 | print("%9f" % (5,)) 27 | @@ -294,7 +294,7 @@ UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format 30 30 | print("brace {} %s" % (1,)) 31 31 | -UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:30:7: UP031 [**] Use format specifiers instead of percent format | 28 | print("%#o" % (123,)) 29 | @@ -315,7 +315,7 @@ UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format 32 32 | print( 33 33 | "%s" % ( -UP031_0.py:33:3: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:33:3: UP031 [**] Use format specifiers instead of percent format | 32 | print( 33 | "%s" % ( @@ -337,7 +337,7 @@ UP031_0.py:33:3: UP031 [*] Use format specifiers instead of percent format 35 35 | ) 36 36 | ) -UP031_0.py:38:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:38:7: UP031 [**] Use format specifiers instead of percent format | 36 | ) 37 | @@ -358,7 +358,7 @@ UP031_0.py:38:7: UP031 [*] Use format specifiers instead of percent format 40 40 | print("%(k)s" % {"k": "v"}) 41 41 | -UP031_0.py:40:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:40:7: UP031 [**] Use format specifiers instead of percent format | 38 | print("foo %s " % (x,)) 39 | @@ -379,7 +379,7 @@ UP031_0.py:40:7: UP031 [*] Use format specifiers instead of percent format 42 42 | print("%(k)s" % { 43 43 | "k": "v", -UP031_0.py:42:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:42:7: UP031 [**] Use format specifiers instead of percent format | 40 | print("%(k)s" % {"k": "v"}) 41 | @@ -410,7 +410,7 @@ UP031_0.py:42:7: UP031 [*] Use format specifiers instead of percent format 47 47 | print("%(to_list)s" % {"to_list": []}) 48 48 | -UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:47:7: UP031 [**] Use format specifiers instead of percent format | 45 | }) 46 | @@ -431,7 +431,7 @@ UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format 49 49 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 50 50 | -UP031_0.py:49:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:49:7: UP031 [**] Use format specifiers instead of percent format | 47 | print("%(to_list)s" % {"to_list": []}) 48 | @@ -452,7 +452,7 @@ UP031_0.py:49:7: UP031 [*] Use format specifiers instead of percent format 51 51 | print("%(ab)s" % {"a" "b": 1}) 52 52 | -UP031_0.py:51:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:51:7: UP031 [**] Use format specifiers instead of percent format | 49 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 50 | @@ -473,7 +473,7 @@ UP031_0.py:51:7: UP031 [*] Use format specifiers instead of percent format 53 53 | print("%(a)s" % {"a" : 1}) 54 54 | -UP031_0.py:53:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:53:7: UP031 [**] Use format specifiers instead of percent format | 51 | print("%(ab)s" % {"a" "b": 1}) 52 | @@ -494,7 +494,7 @@ UP031_0.py:53:7: UP031 [*] Use format specifiers instead of percent format 55 55 | print(( 56 56 | "foo %s " -UP031_0.py:56:5: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:56:5: UP031 [**] Use format specifiers instead of percent format | 55 | print(( 56 | "foo %s " @@ -517,7 +517,7 @@ UP031_0.py:56:5: UP031 [*] Use format specifiers instead of percent format 59 59 | 60 60 | print( -UP031_0.py:61:5: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:61:5: UP031 [**] Use format specifiers instead of percent format | 60 | print( 61 | "foo %(foo)s " @@ -540,7 +540,7 @@ UP031_0.py:61:5: UP031 [*] Use format specifiers instead of percent format 64 64 | 65 65 | bar = {"bar": y} -UP031_0.py:67:5: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:67:5: UP031 [**] Use format specifiers instead of percent format | 65 | bar = {"bar": y} 66 | print( @@ -564,7 +564,7 @@ UP031_0.py:67:5: UP031 [*] Use format specifiers instead of percent format 70 70 | 71 71 | print("%s \N{snowman}" % (a,)) -UP031_0.py:71:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:71:7: UP031 [**] Use format specifiers instead of percent format | 69 | ) 70 | @@ -585,7 +585,7 @@ UP031_0.py:71:7: UP031 [*] Use format specifiers instead of percent format 73 73 | print("%(foo)s \N{snowman}" % {"foo": 1}) 74 74 | -UP031_0.py:73:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:73:7: UP031 [**] Use format specifiers instead of percent format | 71 | print("%s \N{snowman}" % (a,)) 72 | @@ -606,7 +606,7 @@ UP031_0.py:73:7: UP031 [*] Use format specifiers instead of percent format 75 75 | print(("foo %s " "bar %s") % (x, y)) 76 76 | -UP031_0.py:75:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:75:7: UP031 [**] Use format specifiers instead of percent format | 73 | print("%(foo)s \N{snowman}" % {"foo": 1}) 74 | @@ -627,7 +627,7 @@ UP031_0.py:75:7: UP031 [*] Use format specifiers instead of percent format 77 77 | # Single-value expressions 78 78 | print('Hello %s' % "World") -UP031_0.py:78:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:78:7: UP031 [**] Use format specifiers instead of percent format | 77 | # Single-value expressions 78 | print('Hello %s' % "World") @@ -647,7 +647,7 @@ UP031_0.py:78:7: UP031 [*] Use format specifiers instead of percent format 80 80 | print('Hello %s (%s)' % bar) 81 81 | print('Hello %s (%s)' % bar.baz) -UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:79:7: UP031 [**] Use format specifiers instead of percent format | 77 | # Single-value expressions 78 | print('Hello %s' % "World") @@ -668,7 +668,7 @@ UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format 81 81 | print('Hello %s (%s)' % bar.baz) 82 82 | print('Hello %s (%s)' % bar['bop']) -UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:80:7: UP031 [**] Use format specifiers instead of percent format | 78 | print('Hello %s' % "World") 79 | print('Hello %s' % f"World") @@ -689,7 +689,7 @@ UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format 82 82 | print('Hello %s (%s)' % bar['bop']) 83 83 | print('Hello %(arg)s' % bar) -UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:81:7: UP031 [**] Use format specifiers instead of percent format | 79 | print('Hello %s' % f"World") 80 | print('Hello %s (%s)' % bar) @@ -710,7 +710,7 @@ UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format 83 83 | print('Hello %(arg)s' % bar) 84 84 | print('Hello %(arg)s' % bar.baz) -UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:82:7: UP031 [**] Use format specifiers instead of percent format | 80 | print('Hello %s (%s)' % bar) 81 | print('Hello %s (%s)' % bar.baz) @@ -731,7 +731,7 @@ UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format 84 84 | print('Hello %(arg)s' % bar.baz) 85 85 | print('Hello %(arg)s' % bar['bop']) -UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:83:7: UP031 [**] Use format specifiers instead of percent format | 81 | print('Hello %s (%s)' % bar.baz) 82 | print('Hello %s (%s)' % bar['bop']) @@ -752,7 +752,7 @@ UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format 85 85 | print('Hello %(arg)s' % bar['bop']) 86 86 | -UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:84:7: UP031 [**] Use format specifiers instead of percent format | 82 | print('Hello %s (%s)' % bar['bop']) 83 | print('Hello %(arg)s' % bar) @@ -772,7 +772,7 @@ UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format 86 86 | 87 87 | # Hanging modulos -UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:85:7: UP031 [**] Use format specifiers instead of percent format | 83 | print('Hello %(arg)s' % bar) 84 | print('Hello %(arg)s' % bar.baz) @@ -793,7 +793,7 @@ UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format 87 87 | # Hanging modulos 88 88 | ( -UP031_0.py:88:1: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:88:1: UP031 [**] Use format specifiers instead of percent format | 87 | # Hanging modulos 88 | / ( @@ -820,7 +820,7 @@ UP031_0.py:88:1: UP031 [*] Use format specifiers instead of percent format 93 93 | ( 94 94 | "foo %(foo)s " -UP031_0.py:93:1: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:93:1: UP031 [**] Use format specifiers instead of percent format | 91 | ) % (x, y) 92 | @@ -848,7 +848,7 @@ UP031_0.py:93:1: UP031 [*] Use format specifiers instead of percent format 98 98 | ( 99 99 | """foo %s""" -UP031_0.py:99:5: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:99:5: UP031 [**] Use format specifiers instead of percent format | 98 | ( 99 | """foo %s""" @@ -870,7 +870,7 @@ UP031_0.py:99:5: UP031 [*] Use format specifiers instead of percent format 102 101 | 103 102 | ( -UP031_0.py:104:5: UP031 [*] Use format specifiers instead of percent format +UP031_0.py:104:5: UP031 [**] Use format specifiers instead of percent format | 103 | ( 104 | """ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap index 8771bfd691ac23..51b045dc87c335 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:5:1: UP032 [**] Use f-string instead of `format` call | 3 | ### 4 | @@ -22,7 +22,7 @@ UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call 7 7 | "{1} {0}".format(a, b) 8 8 | -UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:7:1: UP032 [**] Use f-string instead of `format` call | 5 | "{} {}".format(a, b) 6 | @@ -43,7 +43,7 @@ UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call 9 9 | "{0} {1} {0}".format(a, b) 10 10 | -UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:9:1: UP032 [**] Use f-string instead of `format` call | 7 | "{1} {0}".format(a, b) 8 | @@ -64,7 +64,7 @@ UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call 11 11 | "{x.y}".format(x=z) 12 12 | -UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:11:1: UP032 [**] Use f-string instead of `format` call | 9 | "{0} {1} {0}".format(a, b) 10 | @@ -85,7 +85,7 @@ UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call 13 13 | "{x} {y} {x}".format(x=a, y=b) 14 14 | -UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:13:1: UP032 [**] Use f-string instead of `format` call | 11 | "{x.y}".format(x=z) 12 | @@ -106,7 +106,7 @@ UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call 15 15 | "{.x} {.y}".format(a, b) 16 16 | -UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:15:1: UP032 [**] Use f-string instead of `format` call | 13 | "{x} {y} {x}".format(x=a, y=b) 14 | @@ -127,7 +127,7 @@ UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call 17 17 | "{} {}".format(a.b, c.d) 18 18 | -UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:17:1: UP032 [**] Use f-string instead of `format` call | 15 | "{.x} {.y}".format(a, b) 16 | @@ -148,7 +148,7 @@ UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call 19 19 | "{}".format(a()) 20 20 | -UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:19:1: UP032 [**] Use f-string instead of `format` call | 17 | "{} {}".format(a.b, c.d) 18 | @@ -169,7 +169,7 @@ UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call 21 21 | "{}".format(a.b()) 22 22 | -UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:21:1: UP032 [**] Use f-string instead of `format` call | 19 | "{}".format(a()) 20 | @@ -190,7 +190,7 @@ UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call 23 23 | "{}".format(a.b().c()) 24 24 | -UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:23:1: UP032 [**] Use f-string instead of `format` call | 21 | "{}".format(a.b()) 22 | @@ -211,7 +211,7 @@ UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call 25 25 | "hello {}!".format(name) 26 26 | -UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:25:1: UP032 [**] Use f-string instead of `format` call | 23 | "{}".format(a.b().c()) 24 | @@ -232,7 +232,7 @@ UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{}{b}{}".format(a, c, b=b) 28 28 | -UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:27:1: UP032 [**] Use f-string instead of `format` call | 25 | "hello {}!".format(name) 26 | @@ -253,7 +253,7 @@ UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call 29 29 | "{}".format(0x0) 30 30 | -UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:29:1: UP032 [**] Use f-string instead of `format` call | 27 | "{}{b}{}".format(a, c, b=b) 28 | @@ -274,7 +274,7 @@ UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call 31 31 | "{} {}".format(a, b) 32 32 | -UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:31:1: UP032 [**] Use f-string instead of `format` call | 29 | "{}".format(0x0) 30 | @@ -295,7 +295,7 @@ UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call 33 33 | """{} {}""".format(a, b) 34 34 | -UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:33:1: UP032 [**] Use f-string instead of `format` call | 31 | "{} {}".format(a, b) 32 | @@ -316,7 +316,7 @@ UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call 35 35 | "foo{}".format(1) 36 36 | -UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:35:1: UP032 [**] Use f-string instead of `format` call | 33 | """{} {}""".format(a, b) 34 | @@ -337,7 +337,7 @@ UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call 37 37 | r"foo{}".format(1) 38 38 | -UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:37:1: UP032 [**] Use f-string instead of `format` call | 35 | "foo{}".format(1) 36 | @@ -358,7 +358,7 @@ UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call 39 39 | x = "{a}".format(a=1) 40 40 | -UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call +UP032_0.py:39:5: UP032 [**] Use f-string instead of `format` call | 37 | r"foo{}".format(1) 38 | @@ -379,7 +379,7 @@ UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call 41 41 | print("foo {} ".format(x)) 42 42 | -UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call +UP032_0.py:41:7: UP032 [**] Use f-string instead of `format` call | 39 | x = "{a}".format(a=1) 40 | @@ -400,7 +400,7 @@ UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call 43 43 | "{a[b]}".format(a=a) 44 44 | -UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:43:1: UP032 [**] Use f-string instead of `format` call | 41 | print("foo {} ".format(x)) 42 | @@ -421,7 +421,7 @@ UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call 45 45 | "{a.a[b]}".format(a=a) 46 46 | -UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:45:1: UP032 [**] Use f-string instead of `format` call | 43 | "{a[b]}".format(a=a) 44 | @@ -442,7 +442,7 @@ UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call 47 47 | "{}{{}}{}".format(escaped, y) 48 48 | -UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:47:1: UP032 [**] Use f-string instead of `format` call | 45 | "{a.a[b]}".format(a=a) 46 | @@ -463,7 +463,7 @@ UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call 49 49 | "{}".format(a) 50 50 | -UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:49:1: UP032 [**] Use f-string instead of `format` call | 47 | "{}{{}}{}".format(escaped, y) 48 | @@ -484,7 +484,7 @@ UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call 51 51 | '({}={{0!e}})'.format(a) 52 52 | -UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:51:1: UP032 [**] Use f-string instead of `format` call | 49 | "{}".format(a) 50 | @@ -505,7 +505,7 @@ UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call 53 53 | "{[b]}".format(a) 54 54 | -UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:53:1: UP032 [**] Use f-string instead of `format` call | 51 | '({}={{0!e}})'.format(a) 52 | @@ -526,7 +526,7 @@ UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call 55 55 | '{[b]}'.format(a) 56 56 | -UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:55:1: UP032 [**] Use f-string instead of `format` call | 53 | "{[b]}".format(a) 54 | @@ -547,7 +547,7 @@ UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call 57 57 | """{[b]}""".format(a) 58 58 | -UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:57:1: UP032 [**] Use f-string instead of `format` call | 55 | '{[b]}'.format(a) 56 | @@ -568,7 +568,7 @@ UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call 59 59 | '''{[b]}'''.format(a) 60 60 | -UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:59:1: UP032 [**] Use f-string instead of `format` call | 57 | """{[b]}""".format(a) 58 | @@ -589,7 +589,7 @@ UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call 61 61 | "{}".format( 62 62 | 1 -UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:61:1: UP032 [**] Use f-string instead of `format` call | 59 | '''{[b]}'''.format(a) 60 | @@ -614,7 +614,7 @@ UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call 65 63 | "123456789 {}".format( 66 64 | 1111111111111111111111111111111111111111111111111111111111111111111111111, -UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:65:1: UP032 [**] Use f-string instead of `format` call | 63 | ) 64 | @@ -639,7 +639,7 @@ UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call 69 67 | """ 70 68 | {} -UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:69:1: UP032 [**] Use f-string instead of `format` call | 67 | ) 68 | @@ -665,7 +665,7 @@ UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call 73 73 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """ 74 74 | {} -UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call +UP032_0.py:73:85: UP032 [**] Use f-string instead of `format` call | 71 | """.format(1) 72 | @@ -697,7 +697,7 @@ UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call 79 77 | "{a}" "{b}".format(a=1, b=1) 80 78 | -UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:79:1: UP032 [**] Use f-string instead of `format` call | 77 | ) 78 | @@ -718,7 +718,7 @@ UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call 81 81 | ( 82 82 | "{a}" -UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:81:1: UP032 [**] Use f-string instead of `format` call | 79 | "{a}" "{b}".format(a=1, b=1) 80 | @@ -746,7 +746,7 @@ UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call 86 86 | ( 87 87 | "{a}" -UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:86:1: UP032 [**] Use f-string instead of `format` call | 84 | ).format(a=1, b=1) 85 | @@ -778,7 +778,7 @@ UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call 93 93 | ( 94 94 | ( -UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call +UP032_0.py:94:5: UP032 [**] Use f-string instead of `format` call | 93 | ( 94 | ( @@ -812,7 +812,7 @@ UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call 103 103 | 104 104 | ( -UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:104:1: UP032 [**] Use f-string instead of `format` call | 102 | ) 103 | @@ -837,7 +837,7 @@ UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call 109 109 | 110 110 | def d(osname, version, release): -UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call +UP032_0.py:111:11: UP032 [**] Use f-string instead of `format` call | 110 | def d(osname, version, release): 111 | return"{}-{}.{}".format(osname, version, release) @@ -855,7 +855,7 @@ UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call 113 113 | 114 114 | def e(): -UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call +UP032_0.py:115:10: UP032 [**] Use f-string instead of `format` call | 114 | def e(): 115 | yield"{}".format(1) @@ -873,7 +873,7 @@ UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call 117 117 | 118 118 | assert"{}".format(1) -UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call +UP032_0.py:118:7: UP032 [**] Use f-string instead of `format` call | 118 | assert"{}".format(1) | ^^^^^^^^^^^^^^ UP032 @@ -890,7 +890,7 @@ UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call 120 120 | 121 121 | async def c(): -UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call +UP032_0.py:122:12: UP032 [**] Use f-string instead of `format` call | 121 | async def c(): 122 | return "{}".format(await 3) @@ -908,7 +908,7 @@ UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call 124 124 | 125 125 | async def c(): -UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call +UP032_0.py:126:12: UP032 [**] Use f-string instead of `format` call | 125 | async def c(): 126 | return "{}".format(1 + await 3) @@ -926,7 +926,7 @@ UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call 128 128 | 129 129 | "{}".format(1 * 2) -UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call +UP032_0.py:129:1: UP032 [**] Use f-string instead of `format` call | 129 | "{}".format(1 * 2) | ^^^^^^^^^^^^^^^^^^ UP032 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap index 1d879bf62a1ec0..4c9b55db80c815 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP032_1.py:1:1: UP032 [*] Use f-string instead of `format` call +UP032_1.py:1:1: UP032 [**] Use f-string instead of `format` call | 1 | "{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. | ^^^^^^^^^^^^^^^^^^^^ UP032 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap index 5751783cf76ab2..0dbb9b0d745d5f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP032_2.py:2:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:2:1: UP032 [**] Use f-string instead of `format` call | 1 | # Errors 2 | "{.real}".format(1) @@ -19,7 +19,7 @@ UP032_2.py:2:1: UP032 [*] Use f-string instead of `format` call 4 4 | "{a.real}".format(a=1) 5 5 | -UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:3:1: UP032 [**] Use f-string instead of `format` call | 1 | # Errors 2 | "{.real}".format(1) @@ -38,7 +38,7 @@ UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call 5 5 | 6 6 | "{.real}".format(1.0) -UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:4:1: UP032 [**] Use f-string instead of `format` call | 2 | "{.real}".format(1) 3 | "{0.real}".format(1) @@ -59,7 +59,7 @@ UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call 6 6 | "{.real}".format(1.0) 7 7 | "{0.real}".format(1.0) -UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:6:1: UP032 [**] Use f-string instead of `format` call | 4 | "{a.real}".format(a=1) 5 | @@ -80,7 +80,7 @@ UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call 8 8 | "{a.real}".format(a=1.0) 9 9 | -UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:7:1: UP032 [**] Use f-string instead of `format` call | 6 | "{.real}".format(1.0) 7 | "{0.real}".format(1.0) @@ -99,7 +99,7 @@ UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call 9 9 | 10 10 | "{.real}".format(1j) -UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:8:1: UP032 [**] Use f-string instead of `format` call | 6 | "{.real}".format(1.0) 7 | "{0.real}".format(1.0) @@ -120,7 +120,7 @@ UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call 10 10 | "{.real}".format(1j) 11 11 | "{0.real}".format(1j) -UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:10:1: UP032 [**] Use f-string instead of `format` call | 8 | "{a.real}".format(a=1.0) 9 | @@ -141,7 +141,7 @@ UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call 12 12 | "{a.real}".format(a=1j) 13 13 | -UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:11:1: UP032 [**] Use f-string instead of `format` call | 10 | "{.real}".format(1j) 11 | "{0.real}".format(1j) @@ -160,7 +160,7 @@ UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call 13 13 | 14 14 | "{.real}".format(0b01) -UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:12:1: UP032 [**] Use f-string instead of `format` call | 10 | "{.real}".format(1j) 11 | "{0.real}".format(1j) @@ -181,7 +181,7 @@ UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call 14 14 | "{.real}".format(0b01) 15 15 | "{0.real}".format(0b01) -UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:14:1: UP032 [**] Use f-string instead of `format` call | 12 | "{a.real}".format(a=1j) 13 | @@ -202,7 +202,7 @@ UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call 16 16 | "{a.real}".format(a=0b01) 17 17 | -UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:15:1: UP032 [**] Use f-string instead of `format` call | 14 | "{.real}".format(0b01) 15 | "{0.real}".format(0b01) @@ -221,7 +221,7 @@ UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call 17 17 | 18 18 | "{}".format(1 + 2) -UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:16:1: UP032 [**] Use f-string instead of `format` call | 14 | "{.real}".format(0b01) 15 | "{0.real}".format(0b01) @@ -242,7 +242,7 @@ UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) -UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:18:1: UP032 [**] Use f-string instead of `format` call | 16 | "{a.real}".format(a=0b01) 17 | @@ -263,7 +263,7 @@ UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call 20 20 | "{}".format({1, 2}) 21 21 | "{}".format({1: 2, 3: 4}) -UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:19:1: UP032 [**] Use f-string instead of `format` call | 18 | "{}".format(1 + 2) 19 | "{}".format([1, 2]) @@ -283,7 +283,7 @@ UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call 21 21 | "{}".format({1: 2, 3: 4}) 22 22 | "{}".format((i for i in range(2))) -UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:20:1: UP032 [**] Use f-string instead of `format` call | 18 | "{}".format(1 + 2) 19 | "{}".format([1, 2]) @@ -304,7 +304,7 @@ UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call 22 22 | "{}".format((i for i in range(2))) 23 23 | -UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:21:1: UP032 [**] Use f-string instead of `format` call | 19 | "{}".format([1, 2]) 20 | "{}".format({1, 2}) @@ -324,7 +324,7 @@ UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call 23 23 | 24 24 | "{.real}".format(1 + 2) -UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:22:1: UP032 [**] Use f-string instead of `format` call | 20 | "{}".format({1, 2}) 21 | "{}".format({1: 2, 3: 4}) @@ -345,7 +345,7 @@ UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) -UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:24:1: UP032 [**] Use f-string instead of `format` call | 22 | "{}".format((i for i in range(2))) 23 | @@ -366,7 +366,7 @@ UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call 26 26 | "{.real}".format({1, 2}) 27 27 | "{.real}".format({1: 2, 3: 4}) -UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:25:1: UP032 [**] Use f-string instead of `format` call | 24 | "{.real}".format(1 + 2) 25 | "{.real}".format([1, 2]) @@ -386,7 +386,7 @@ UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) -UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:26:1: UP032 [**] Use f-string instead of `format` call | 24 | "{.real}".format(1 + 2) 25 | "{.real}".format([1, 2]) @@ -406,7 +406,7 @@ UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) -UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:27:1: UP032 [**] Use f-string instead of `format` call | 25 | "{.real}".format([1, 2]) 26 | "{.real}".format({1, 2}) @@ -424,7 +424,7 @@ UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call 27 |+f"{({1: 2, 3: 4}).real}" 28 28 | "{}".format((i for i in range(2))) -UP032_2.py:28:1: UP032 [*] Use f-string instead of `format` call +UP032_2.py:28:1: UP032 [**] Use f-string instead of `format` call | 26 | "{.real}".format({1, 2}) 27 | "{.real}".format({1: 2, 3: 4}) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap index 4f8c750737ee2e..ac70395f62ac41 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:2:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 1 | # UP035 2 | from collections import Mapping @@ -19,7 +19,7 @@ UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 4 4 | from collections import Mapping as MAP 5 5 | -UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:4:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 2 | from collections import Mapping 3 | @@ -40,7 +40,7 @@ UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 6 6 | from collections import Mapping, Sequence 7 7 | -UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` +UP035.py:6:1: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Sequence` | 4 | from collections import Mapping as MAP 5 | @@ -61,7 +61,7 @@ UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Seque 8 8 | from collections import Counter, Mapping 9 9 | -UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:8:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 6 | from collections import Mapping, Sequence 7 | @@ -83,7 +83,7 @@ UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 10 11 | from collections import (Counter, Mapping) 11 12 | -UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:10:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 8 | from collections import Counter, Mapping 9 | @@ -105,7 +105,7 @@ UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 12 13 | from collections import (Counter, 13 14 | Mapping) -UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:12:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 10 | from collections import (Counter, Mapping) 11 | @@ -129,7 +129,7 @@ UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 15 15 | from collections import Counter, \ 16 16 | Mapping -UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:15:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 13 | Mapping) 14 | @@ -153,7 +153,7 @@ UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 18 18 | from collections import Counter, Mapping, Sequence 19 19 | -UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` +UP035.py:18:1: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Sequence` | 16 | Mapping 17 | @@ -175,7 +175,7 @@ UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequ 20 21 | from collections import Mapping as mapping, Counter 21 22 | -UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:20:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 18 | from collections import Counter, Mapping, Sequence 19 | @@ -197,7 +197,7 @@ UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 22 23 | if True: 23 24 | from collections import Mapping, Counter -UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:23:5: UP035 [**] Import from `collections.abc` instead: `Mapping` | 22 | if True: 23 | from collections import Mapping, Counter @@ -218,7 +218,7 @@ UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` 25 26 | if True: 26 27 | if True: -UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:28:5: UP035 [**] Import from `collections.abc` instead: `Mapping` | 26 | if True: 27 | pass @@ -240,7 +240,7 @@ UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` 30 31 | if True: from collections import Mapping 31 32 | -UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:30:10: UP035 [**] Import from `collections.abc` instead: `Mapping` | 28 | from collections import Mapping, Counter 29 | @@ -261,7 +261,7 @@ UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` 32 32 | import os 33 33 | from collections import Counter, Mapping -UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:33:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 32 | import os 33 | from collections import Counter, Mapping @@ -281,7 +281,7 @@ UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 35 36 | 36 37 | if True: -UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Callable` +UP035.py:37:5: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Callable` | 36 | if True: 37 | from collections import ( @@ -311,7 +311,7 @@ UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Call 44 43 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager 45 44 | -UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` +UP035.py:44:1: UP035 [**] Import from `collections.abc` instead: `Callable` | 42 | ) 43 | @@ -333,7 +333,7 @@ UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) -UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` +UP035.py:44:1: UP035 [**] Import from `collections` instead: `OrderedDict` | 42 | ) 43 | @@ -355,7 +355,7 @@ UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) -UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` +UP035.py:44:1: UP035 [**] Import from `re` instead: `Match`, `Pattern` | 42 | ) 43 | @@ -429,7 +429,7 @@ UP035.py:50:1: UP035 `typing.ContextManager` is deprecated, use `contextlib.Abst 52 | from typing_extensions import OrderedDict | -UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` +UP035.py:51:1: UP035 [**] Import from `collections` instead: `OrderedDict` | 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 | from typing import ContextManager @@ -450,7 +450,7 @@ UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` 53 53 | from typing import Callable 54 54 | from typing import ByteString -UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` +UP035.py:52:1: UP035 [**] Import from `typing` instead: `OrderedDict` | 50 | from typing import ContextManager 51 | from typing import OrderedDict @@ -471,7 +471,7 @@ UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` 54 54 | from typing import ByteString 55 55 | from typing import Container -UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` +UP035.py:53:1: UP035 [**] Import from `collections.abc` instead: `Callable` | 51 | from typing import OrderedDict 52 | from typing_extensions import OrderedDict @@ -492,7 +492,7 @@ UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` 55 55 | from typing import Container 56 56 | from typing import Hashable -UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` +UP035.py:54:1: UP035 [**] Import from `collections.abc` instead: `ByteString` | 52 | from typing_extensions import OrderedDict 53 | from typing import Callable @@ -513,7 +513,7 @@ UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` 56 56 | from typing import Hashable 57 57 | from typing import ItemsView -UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` +UP035.py:55:1: UP035 [**] Import from `collections.abc` instead: `Container` | 53 | from typing import Callable 54 | from typing import ByteString @@ -534,7 +534,7 @@ UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` 57 57 | from typing import ItemsView 58 58 | from typing import Iterable -UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` +UP035.py:56:1: UP035 [**] Import from `collections.abc` instead: `Hashable` | 54 | from typing import ByteString 55 | from typing import Container @@ -555,7 +555,7 @@ UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` 58 58 | from typing import Iterable 59 59 | from typing import Iterator -UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` +UP035.py:57:1: UP035 [**] Import from `collections.abc` instead: `ItemsView` | 55 | from typing import Container 56 | from typing import Hashable @@ -576,7 +576,7 @@ UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` 59 59 | from typing import Iterator 60 60 | from typing import KeysView -UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` +UP035.py:58:1: UP035 [**] Import from `collections.abc` instead: `Iterable` | 56 | from typing import Hashable 57 | from typing import ItemsView @@ -597,7 +597,7 @@ UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` 60 60 | from typing import KeysView 61 61 | from typing import Mapping -UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` +UP035.py:59:1: UP035 [**] Import from `collections.abc` instead: `Iterator` | 57 | from typing import ItemsView 58 | from typing import Iterable @@ -618,7 +618,7 @@ UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` 61 61 | from typing import Mapping 62 62 | from typing import MappingView -UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` +UP035.py:60:1: UP035 [**] Import from `collections.abc` instead: `KeysView` | 58 | from typing import Iterable 59 | from typing import Iterator @@ -639,7 +639,7 @@ UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping -UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` +UP035.py:61:1: UP035 [**] Import from `collections.abc` instead: `Mapping` | 59 | from typing import Iterator 60 | from typing import KeysView @@ -660,7 +660,7 @@ UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence -UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` +UP035.py:62:1: UP035 [**] Import from `collections.abc` instead: `MappingView` | 60 | from typing import KeysView 61 | from typing import Mapping @@ -681,7 +681,7 @@ UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet -UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` +UP035.py:63:1: UP035 [**] Import from `collections.abc` instead: `MutableMapping` | 61 | from typing import Mapping 62 | from typing import MappingView @@ -702,7 +702,7 @@ UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` 65 65 | from typing import MutableSet 66 66 | from typing import Sequence -UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence` +UP035.py:64:1: UP035 [**] Import from `collections.abc` instead: `MutableSequence` | 62 | from typing import MappingView 63 | from typing import MutableMapping @@ -723,7 +723,7 @@ UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence 66 66 | from typing import Sequence 67 67 | from typing import Sized -UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` +UP035.py:65:1: UP035 [**] Import from `collections.abc` instead: `MutableSet` | 63 | from typing import MutableMapping 64 | from typing import MutableSequence @@ -744,7 +744,7 @@ UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` 67 67 | from typing import Sized 68 68 | from typing import ValuesView -UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` +UP035.py:66:1: UP035 [**] Import from `collections.abc` instead: `Sequence` | 64 | from typing import MutableSequence 65 | from typing import MutableSet @@ -765,7 +765,7 @@ UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable -UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` +UP035.py:67:1: UP035 [**] Import from `collections.abc` instead: `Sized` | 65 | from typing import MutableSet 66 | from typing import Sequence @@ -786,7 +786,7 @@ UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator -UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` +UP035.py:68:1: UP035 [**] Import from `collections.abc` instead: `ValuesView` | 66 | from typing import Sequence 67 | from typing import Sized @@ -807,7 +807,7 @@ UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable -UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` +UP035.py:69:1: UP035 [**] Import from `collections.abc` instead: `Awaitable` | 67 | from typing import Sized 68 | from typing import ValuesView @@ -828,7 +828,7 @@ UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine -UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` +UP035.py:70:1: UP035 [**] Import from `collections.abc` instead: `AsyncIterator` | 68 | from typing import ValuesView 69 | from typing import Awaitable @@ -849,7 +849,7 @@ UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` 72 72 | from typing import Coroutine 73 73 | from typing import Collection -UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` +UP035.py:71:1: UP035 [**] Import from `collections.abc` instead: `AsyncIterable` | 69 | from typing import Awaitable 70 | from typing import AsyncIterator @@ -870,7 +870,7 @@ UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator -UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` +UP035.py:72:1: UP035 [**] Import from `collections.abc` instead: `Coroutine` | 70 | from typing import AsyncIterator 71 | from typing import AsyncIterable @@ -891,7 +891,7 @@ UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible -UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` +UP035.py:73:1: UP035 [**] Import from `collections.abc` instead: `Collection` | 71 | from typing import AsyncIterable 72 | from typing import Coroutine @@ -912,7 +912,7 @@ UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` 75 75 | from typing import Reversible 76 76 | from typing import Generator -UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` +UP035.py:74:1: UP035 [**] Import from `collections.abc` instead: `AsyncGenerator` | 72 | from typing import Coroutine 73 | from typing import Collection @@ -933,7 +933,7 @@ UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` 76 76 | from typing import Generator 77 77 | from typing import Callable -UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` +UP035.py:75:1: UP035 [**] Import from `collections.abc` instead: `Reversible` | 73 | from typing import Collection 74 | from typing import AsyncGenerator @@ -954,7 +954,7 @@ UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` 77 77 | from typing import Callable 78 78 | from typing import cast -UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` +UP035.py:76:1: UP035 [**] Import from `collections.abc` instead: `Generator` | 74 | from typing import AsyncGenerator 75 | from typing import Reversible @@ -975,7 +975,7 @@ UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` 78 78 | from typing import cast 79 79 | -UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` +UP035.py:77:1: UP035 [**] Import from `collections.abc` instead: `Callable` | 75 | from typing import Reversible 76 | from typing import Generator @@ -995,7 +995,7 @@ UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` 79 79 | 80 80 | # OK -UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` +UP035.py:87:1: UP035 [**] Import from `typing` instead: `NamedTuple` | 86 | # Ok: `typing_extensions` contains backported improvements. 87 | from typing_extensions import NamedTuple @@ -1015,7 +1015,7 @@ UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` 89 89 | # Ok: `typing_extensions` supports `frozen_default` (backported from 3.12). 90 90 | from typing_extensions import dataclass_transform -UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` +UP035.py:90:1: UP035 [**] Import from `typing` instead: `dataclass_transform` | 89 | # Ok: `typing_extensions` supports `frozen_default` (backported from 3.12). 90 | from typing_extensions import dataclass_transform diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap index 6d66d23ef17be9..385b374ffe6aee 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:3:4: UP036 [**] Version block is outdated for minimum Python version | 1 | import sys 2 | @@ -24,7 +24,7 @@ UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version 8 5 | if sys.version_info < (3,0): 9 6 | if True: -UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:8:4: UP036 [**] Version block is outdated for minimum Python version | 6 | print("py3") 7 | @@ -51,7 +51,7 @@ UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version 16 10 | if sys.version_info < (3,0): print("PY2!") 17 11 | else: print("PY3!") -UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:16:4: UP036 [**] Version block is outdated for minimum Python version | 14 | print("py3") 15 | @@ -72,7 +72,7 @@ UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version 19 18 | if True: 20 19 | if sys.version_info < (3,0): -UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:20:8: UP036 [**] Version block is outdated for minimum Python version | 19 | if True: 20 | if sys.version_info < (3,0): @@ -95,7 +95,7 @@ UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version 25 22 | if sys.version_info < (3,0): print(1 if True else 3) 26 23 | else: -UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:25:4: UP036 [**] Version block is outdated for minimum Python version | 23 | print("PY3") 24 | @@ -118,7 +118,7 @@ UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version 29 27 | if sys.version_info < (3,0): 30 28 | def f(): -UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:29:4: UP036 [**] Version block is outdated for minimum Python version | 27 | print("py3") 28 | @@ -147,7 +147,7 @@ UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version 37 33 | if sys.version_info > (3,0): 38 34 | print("py3") -UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:37:4: UP036 [**] Version block is outdated for minimum Python version | 35 | print("This the next") 36 | @@ -171,7 +171,7 @@ UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version 42 39 | 43 40 | x = 1 -UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:45:4: UP036 [**] Version block is outdated for minimum Python version | 43 | x = 1 44 | @@ -195,7 +195,7 @@ UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version 50 47 | 51 48 | x = 1 -UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:53:4: UP036 [**] Version block is outdated for minimum Python version | 51 | x = 1 52 | @@ -216,7 +216,7 @@ UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version 56 55 | if sys.version_info > (3,): 57 56 | print("py3") -UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:56:4: UP036 [**] Version block is outdated for minimum Python version | 54 | else: print("py2") 55 | @@ -240,7 +240,7 @@ UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version 61 58 | if True: 62 59 | if sys.version_info > (3,): -UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:62:8: UP036 [**] Version block is outdated for minimum Python version | 61 | if True: 62 | if sys.version_info > (3,): @@ -263,7 +263,7 @@ UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version 67 64 | if sys.version_info < (3,): 68 65 | print("py2") -UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:67:4: UP036 [**] Version block is outdated for minimum Python version | 65 | print("py2") 66 | @@ -287,7 +287,7 @@ UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version 72 69 | def f(): 73 70 | if sys.version_info < (3,0): -UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:73:8: UP036 [**] Version block is outdated for minimum Python version | 72 | def f(): 73 | if sys.version_info < (3,0): @@ -313,7 +313,7 @@ UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version 81 75 | 82 76 | class C: -UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:86:8: UP036 [**] Version block is outdated for minimum Python version | 84 | pass 85 | @@ -340,7 +340,7 @@ UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version 93 89 | def h(): 94 90 | pass -UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:97:8: UP036 [**] Version block is outdated for minimum Python version | 96 | if True: 97 | if sys.version_info < (3,0): @@ -363,7 +363,7 @@ UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version 102 99 | # comment 103 100 | -UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:104:4: UP036 [**] Version block is outdated for minimum Python version | 102 | # comment 103 | @@ -396,7 +396,7 @@ UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version 115 109 | if True: 116 110 | if sys.version_info > (3,): -UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:116:8: UP036 [**] Version block is outdated for minimum Python version | 115 | if True: 116 | if sys.version_info > (3,): @@ -417,7 +417,7 @@ UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version 119 118 | print(2+3) 120 119 | -UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:122:8: UP036 [**] Version block is outdated for minimum Python version | 121 | if True: 122 | if sys.version_info > (3,): print(3) @@ -437,7 +437,7 @@ UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version 124 124 | if True: 125 125 | if sys.version_info > (3,): -UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:125:8: UP036 [**] Version block is outdated for minimum Python version | 124 | if True: 125 | if sys.version_info > (3,): @@ -457,7 +457,7 @@ UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version 128 127 | 129 128 | if True: -UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:130:8: UP036 [**] Version block is outdated for minimum Python version | 129 | if True: 130 | if sys.version_info <= (3, 0): @@ -485,7 +485,7 @@ UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version 139 136 | 140 137 | if sys.version_info <= (3, 0): -UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:140:4: UP036 [**] Version block is outdated for minimum Python version | 140 | if sys.version_info <= (3, 0): | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 @@ -512,7 +512,7 @@ UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version 149 146 | 150 147 | if sys.version_info > (3,0): -UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:150:4: UP036 [**] Version block is outdated for minimum Python version | 150 | if sys.version_info > (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 @@ -546,7 +546,7 @@ UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version 163 162 | if sys.version_info > (3, 0): expected_error = \ 164 163 | [] -UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:163:4: UP036 [**] Version block is outdated for minimum Python version | 161 | "this for some reason") 162 | @@ -566,7 +566,7 @@ UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version 165 165 | 166 166 | if sys.version_info > (3, 0): expected_error = [] -UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:166:4: UP036 [**] Version block is outdated for minimum Python version | 164 | [] 165 | @@ -587,7 +587,7 @@ UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version 168 168 | if sys.version_info > (3, 0): \ 169 169 | expected_error = [] -UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:168:4: UP036 [**] Version block is outdated for minimum Python version | 166 | if sys.version_info > (3, 0): expected_error = [] 167 | @@ -608,7 +608,7 @@ UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version 171 170 | if True: 172 171 | if sys.version_info > (3, 0): expected_error = \ -UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:172:8: UP036 [**] Version block is outdated for minimum Python version | 171 | if True: 172 | if sys.version_info > (3, 0): expected_error = \ @@ -627,7 +627,7 @@ UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version 174 174 | 175 175 | if True: -UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:176:8: UP036 [**] Version block is outdated for minimum Python version | 175 | if True: 176 | if sys.version_info > (3, 0): expected_error = [] @@ -647,7 +647,7 @@ UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version 178 178 | if True: 179 179 | if sys.version_info > (3, 0): \ -UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:179:8: UP036 [**] Version block is outdated for minimum Python version | 178 | if True: 179 | if sys.version_info > (3, 0): \ @@ -665,7 +665,7 @@ UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version 181 180 | 182 181 | if sys.version_info < (3,12): -UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version +UP036_0.py:182:4: UP036 [**] Version block is outdated for minimum Python version | 180 | expected_error = [] 181 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap index 2a585cc3f9c97d..1326eb2f4dbb47 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:3:4: UP036 [**] Version block is outdated for minimum Python version | 1 | import sys 2 | @@ -24,7 +24,7 @@ UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version 8 5 | if sys.version_info < (3,): 9 6 | 2 -UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:8:4: UP036 [**] Version block is outdated for minimum Python version | 6 | 3 7 | @@ -48,7 +48,7 @@ UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version 13 10 | if sys.version_info < (3,0): 14 11 | 2 -UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:13:4: UP036 [**] Version block is outdated for minimum Python version | 11 | 3 12 | @@ -72,7 +72,7 @@ UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version 18 15 | if sys.version_info == 3: 19 16 | 3 -UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:18:4: UP036 [**] Version block is outdated for minimum Python version | 16 | 3 17 | @@ -96,7 +96,7 @@ UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version 23 20 | if sys.version_info > (3,): 24 21 | 3 -UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:23:4: UP036 [**] Version block is outdated for minimum Python version | 21 | 2 22 | @@ -120,7 +120,7 @@ UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version 28 25 | if sys.version_info >= (3,): 29 26 | 3 -UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:28:4: UP036 [**] Version block is outdated for minimum Python version | 26 | 2 27 | @@ -144,7 +144,7 @@ UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version 33 30 | from sys import version_info 34 31 | -UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:35:4: UP036 [**] Version block is outdated for minimum Python version | 33 | from sys import version_info 34 | @@ -168,7 +168,7 @@ UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version 40 37 | if True: 41 38 | print(1) -UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:42:6: UP036 [**] Version block is outdated for minimum Python version | 40 | if True: 41 | print(1) @@ -189,7 +189,7 @@ UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version 45 43 | print(3) 46 44 | -UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:49:6: UP036 [**] Version block is outdated for minimum Python version | 47 | if True: 48 | print(1) @@ -213,7 +213,7 @@ UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version 54 52 | if True: 55 53 | print(1) -UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:56:6: UP036 [**] Version block is outdated for minimum Python version | 54 | if True: 55 | print(1) @@ -233,7 +233,7 @@ UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version 58 58 | 59 59 | def f(): -UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:62:10: UP036 [**] Version block is outdated for minimum Python version | 60 | if True: 61 | print(1) @@ -253,7 +253,7 @@ UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version 64 64 | 65 65 | if True: -UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:67:6: UP036 [**] Version block is outdated for minimum Python version | 65 | if True: 66 | print(1) @@ -274,7 +274,7 @@ UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version 70 68 | print(3) 71 69 | -UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version +UP036_1.py:75:10: UP036 [**] Version block is outdated for minimum Python version | 73 | if True: 74 | print(1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap index 8e8332bdd9ebf2..631af594dc981e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:4:4: UP036 [**] Version block is outdated for minimum Python version | 2 | from sys import version_info 3 | @@ -25,7 +25,7 @@ UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version 9 6 | if version_info > (3, 5): 10 7 | 3+6 -UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:9:4: UP036 [**] Version block is outdated for minimum Python version | 7 | 3-5 8 | @@ -49,7 +49,7 @@ UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version 14 11 | if sys.version_info >= (3,6): 15 12 | 3+6 -UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:14:4: UP036 [**] Version block is outdated for minimum Python version | 12 | 3-5 13 | @@ -73,7 +73,7 @@ UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version 19 16 | if version_info >= (3,6): 20 17 | 3+6 -UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:19:4: UP036 [**] Version block is outdated for minimum Python version | 17 | 3-5 18 | @@ -97,7 +97,7 @@ UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version 24 21 | if sys.version_info < (3,6): 25 22 | 3-5 -UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:24:4: UP036 [**] Version block is outdated for minimum Python version | 22 | 3-5 23 | @@ -121,7 +121,7 @@ UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version 29 26 | if sys.version_info <= (3,5): 30 27 | 3-5 -UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:29:4: UP036 [**] Version block is outdated for minimum Python version | 27 | 3+6 28 | @@ -145,7 +145,7 @@ UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version 34 31 | if sys.version_info <= (3, 5): 35 32 | 3-5 -UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:34:4: UP036 [**] Version block is outdated for minimum Python version | 32 | 3+6 33 | @@ -169,7 +169,7 @@ UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version 39 36 | if sys.version_info >= (3, 5): 40 37 | pass -UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:39:4: UP036 [**] Version block is outdated for minimum Python version | 37 | 3+6 38 | @@ -190,7 +190,7 @@ UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version 42 41 | if sys.version_info < (3,0): 43 42 | pass -UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:42:4: UP036 [**] Version block is outdated for minimum Python version | 40 | pass 41 | @@ -210,7 +210,7 @@ UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version 45 43 | if True: 46 44 | if sys.version_info < (3,0): -UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:46:8: UP036 [**] Version block is outdated for minimum Python version | 45 | if True: 46 | if sys.version_info < (3,0): @@ -230,7 +230,7 @@ UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version 49 48 | if sys.version_info < (3,0): 50 49 | pass -UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:49:4: UP036 [**] Version block is outdated for minimum Python version | 47 | pass 48 | @@ -253,7 +253,7 @@ UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version 53 51 | 54 52 | if sys.version_info > (3,): -UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version +UP036_2.py:54:4: UP036 [**] Version block is outdated for minimum Python version | 52 | pass 53 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap index d38cfd8b0bf2a1..589e8af691bef0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_3.py:3:15: UP036 [*] Version block is outdated for minimum Python version +UP036_3.py:3:15: UP036 [**] Version block is outdated for minimum Python version | 1 | import sys 2 | @@ -30,7 +30,7 @@ UP036_3.py:3:15: UP036 [*] Version block is outdated for minimum Python version 12 7 | if False: 13 8 | if sys.version_info < (3,0): -UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version +UP036_3.py:13:19: UP036 [**] Version block is outdated for minimum Python version | 12 | if False: 13 | if sys.version_info < (3,0): @@ -59,7 +59,7 @@ UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version 22 17 | 23 18 | if sys.version_info < (3,0): print("PY2!") -UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version +UP036_3.py:23:15: UP036 [**] Version block is outdated for minimum Python version | 23 | if sys.version_info < (3,0): print("PY2!") | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap index 28701a4d0a3b30..0d5b8438eb156a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_4.py:4:8: UP036 [*] Version block is outdated for minimum Python version +UP036_4.py:4:8: UP036 [**] Version block is outdated for minimum Python version | 3 | if True: 4 | if sys.version_info < (3, 3): @@ -21,7 +21,7 @@ UP036_4.py:4:8: UP036 [*] Version block is outdated for minimum Python version 7 6 | 8 7 | if True: -UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version +UP036_4.py:11:10: UP036 [**] Version block is outdated for minimum Python version | 9 | if foo: 10 | print() @@ -42,7 +42,7 @@ UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version 14 13 | if True: 15 14 | if foo: -UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version +UP036_4.py:17:10: UP036 [**] Version block is outdated for minimum Python version | 15 | if foo: 16 | print() @@ -63,7 +63,7 @@ UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version 20 18 | cmd = [sys.executable, "-m", "test", "-j0"] 21 19 | -UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version +UP036_4.py:24:10: UP036 [**] Version block is outdated for minimum Python version | 22 | if foo: 23 | print() @@ -84,7 +84,7 @@ UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version 27 26 | if sys.version_info < (3, 3): 28 27 | cmd = [sys.executable, "-m", "test.regrtest"] -UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version +UP036_4.py:27:8: UP036 [**] Version block is outdated for minimum Python version | 25 | cmd = [sys.executable, "-m", "test.regrtest"] 26 | @@ -104,7 +104,7 @@ UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version 30 28 | if foo: 31 29 | print() -UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version +UP036_4.py:32:10: UP036 [**] Version block is outdated for minimum Python version | 30 | if foo: 31 | print() @@ -125,7 +125,7 @@ UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version 35 33 | cmd = [sys.executable, "-m", "test", "-j0"] 36 34 | -UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version +UP036_4.py:37:8: UP036 [**] Version block is outdated for minimum Python version | 35 | cmd = [sys.executable, "-m", "test", "-j0"] 36 | @@ -149,7 +149,7 @@ UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version 42 39 | if sys.version_info < (3, 3): 43 40 | cmd = [sys.executable, "-m", "test.regrtest"] -UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version +UP036_4.py:42:8: UP036 [**] Version block is outdated for minimum Python version | 40 | cmd = [sys.executable, "-m", "test", "-j0"] 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap index f4a5ed27874b29..c66b462506abd9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version +UP036_5.py:3:4: UP036 [**] Version block is outdated for minimum Python version | 1 | import sys 2 | @@ -31,7 +31,7 @@ UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version 15 5 | 16 6 | import sys -UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version +UP036_5.py:18:4: UP036 [**] Version block is outdated for minimum Python version | 16 | import sys 17 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap index dcba7e8fcff569..f678cc9fdf49f0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP038.py:1:1: UP038 [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` +UP038.py:1:1: UP038 [**] Use `X | Y` in `isinstance` call instead of `(X, Y)` | 1 | isinstance(1, (int, float)) # UP038 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP038 @@ -16,7 +16,7 @@ UP038.py:1:1: UP038 [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` 3 3 | 4 4 | isinstance(1, int) # OK -UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` +UP038.py:2:1: UP038 [**] Use `X | Y` in `issubclass` call instead of `(X, Y)` | 1 | isinstance(1, (int, float)) # UP038 2 | issubclass("yes", (int, float, str)) # UP038 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap index 3cde3025383daa..db36d46d4d5e94 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP017.py:7:7: UP017 [*] Use `datetime.UTC` alias +UP017.py:7:7: UP017 [**] Use `datetime.UTC` alias | 6 | print(datetime.timezone(-1)) 7 | print(timezone.utc) @@ -20,7 +20,7 @@ UP017.py:7:7: UP017 [*] Use `datetime.UTC` alias 9 9 | 10 10 | print(datetime.timezone.utc) -UP017.py:8:7: UP017 [*] Use `datetime.UTC` alias +UP017.py:8:7: UP017 [**] Use `datetime.UTC` alias | 6 | print(datetime.timezone(-1)) 7 | print(timezone.utc) @@ -41,7 +41,7 @@ UP017.py:8:7: UP017 [*] Use `datetime.UTC` alias 10 10 | print(datetime.timezone.utc) 11 11 | print(dt.timezone.utc) -UP017.py:10:7: UP017 [*] Use `datetime.UTC` alias +UP017.py:10:7: UP017 [**] Use `datetime.UTC` alias | 8 | print(tz.utc) 9 | @@ -59,7 +59,7 @@ UP017.py:10:7: UP017 [*] Use `datetime.UTC` alias 10 |+print(datetime.UTC) 11 11 | print(dt.timezone.utc) -UP017.py:11:7: UP017 [*] Use `datetime.UTC` alias +UP017.py:11:7: UP017 [**] Use `datetime.UTC` alias | 10 | print(datetime.timezone.utc) 11 | print(dt.timezone.utc) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap index 6c62e6ffb7f60c..eea6bdc5c485dc 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations +future_annotations.py:40:4: UP007 [**] Use `X | Y` for type annotations | 40 | x: Optional[int] = None | ^^^^^^^^^^^^^ UP007 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap index c9e4008d7aac7f..6d50e8a5de3de2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations +future_annotations.py:40:4: UP007 [**] Use `X | Y` for type annotations | 40 | x: Optional[int] = None | ^^^^^^^^^^^^^ UP007 @@ -19,7 +19,7 @@ future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations 41 41 | 42 42 | MyList: TypeAlias = Union[List[int], List[str]] -future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations +future_annotations.py:42:21: UP007 [**] Use `X | Y` for type annotations | 40 | x: Optional[int] = None 41 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap index ebec270762c4c2..27229b18aa2230 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB105.py:3:1: FURB105 [*] Unnecessary empty string passed to `print` +FURB105.py:3:1: FURB105 [**] Unnecessary empty string passed to `print` | 1 | # Errors. 2 | @@ -21,7 +21,7 @@ FURB105.py:3:1: FURB105 [*] Unnecessary empty string passed to `print` 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") -FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:4:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 3 | print("") 4 | print("", sep=",") @@ -41,7 +41,7 @@ FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") -FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` +FURB105.py:5:1: FURB105 [**] Unnecessary empty string passed to `print` | 3 | print("") 4 | print("", sep=",") @@ -62,7 +62,7 @@ FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` 7 7 | print(sep="") 8 8 | print("", sep="") -FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:6:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 4 | print("", sep=",") 5 | print("", end="bar") @@ -83,7 +83,7 @@ FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 8 8 | print("", sep="") 9 9 | print("", "", sep="") -FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` +FURB105.py:7:1: FURB105 [**] Unnecessary separator passed to `print` | 5 | print("", end="bar") 6 | print("", sep=",", end="bar") @@ -104,7 +104,7 @@ FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") -FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:8:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 6 | print("", sep=",", end="bar") 7 | print(sep="") @@ -125,7 +125,7 @@ FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") -FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:9:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 7 | print(sep="") 8 | print("", sep="") @@ -146,7 +146,7 @@ FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `pr 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") -FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:10:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 8 | print("", sep="") 9 | print("", "", sep="") @@ -167,7 +167,7 @@ FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `p 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") -FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:11:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 9 | print("", "", sep="") 10 | print("", "", sep="", end="") @@ -188,7 +188,7 @@ FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `p 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") -FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:12:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 10 | print("", "", sep="", end="") 11 | print("", "", sep="", end="bar") @@ -209,7 +209,7 @@ FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `p 14 14 | print("", "foo", sep="") 15 15 | print("foo", "", sep="") -FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` +FURB105.py:13:1: FURB105 [**] Unnecessary separator passed to `print` | 11 | print("", "", sep="", end="bar") 12 | print("", sep="", end="bar") @@ -230,7 +230,7 @@ FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` 15 15 | print("foo", "", sep="") 16 16 | print("foo", "", "bar", sep="") -FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:14:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 12 | print("", sep="", end="bar") 13 | print(sep="", end="bar") @@ -251,7 +251,7 @@ FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `p 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) -FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `print` +FURB105.py:15:1: FURB105 [**] Unnecessary empty string and separator passed to `print` | 13 | print(sep="", end="bar") 14 | print("", "foo", sep="") @@ -272,7 +272,7 @@ FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `p 17 17 | print("", *args) 18 18 | print("", *args, sep="") -FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` +FURB105.py:16:1: FURB105 [**] Unnecessary empty string passed to `print` | 14 | print("", "foo", sep="") 15 | print("foo", "", sep="") @@ -293,7 +293,7 @@ FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` 18 18 | print("", *args, sep="") 19 19 | print("", **kwargs) -FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` +FURB105.py:18:1: FURB105 [**] Unnecessary empty string passed to `print` | 16 | print("foo", "", "bar", sep="") 17 | print("", *args) @@ -314,7 +314,7 @@ FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` 20 20 | print(sep="\t") 21 21 | -FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` +FURB105.py:19:1: FURB105 [**] Unnecessary empty string passed to `print` | 17 | print("", *args) 18 | print("", *args, sep="") @@ -334,7 +334,7 @@ FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` 21 21 | 22 22 | # OK. -FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` +FURB105.py:20:1: FURB105 [**] Unnecessary separator passed to `print` | 18 | print("", *args, sep="") 19 | print("", **kwargs) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap index 4ce5ab6cd5a6ad..fd34207d7a1a2f 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB113.py:23:1: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +FURB113.py:23:1: FURB113 [**] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | 22 | # FURB113 23 | / nums.append(1) @@ -22,7 +22,7 @@ FURB113.py:23:1: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal 26 25 | 27 26 | -FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` +FURB113.py:29:1: FURB113 [**] Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` | 28 | # FURB113 29 | / nums3.append(1) @@ -43,7 +43,7 @@ FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly ca 32 31 | 33 32 | -FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` +FURB113.py:35:1: FURB113 [**] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` | 34 | # FURB113 35 | / nums4.append(1) @@ -106,7 +106,7 @@ FURB113.py:53:1: FURB113 Use `nums3.extend((1, 2))` instead of repeatedly callin | = help: Replace with `nums3.extend((1, 2))` -FURB113.py:56:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` +FURB113.py:56:1: FURB113 [**] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` | 54 | nums.append(3) 55 | # FURB113 @@ -129,7 +129,7 @@ FURB113.py:56:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly ca 59 58 | pass 60 59 | -FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` +FURB113.py:62:1: FURB113 [**] Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | 61 | # FURB113 62 | / nums.append(1) @@ -151,7 +151,7 @@ FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly 66 64 | 67 65 | if True: -FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +FURB113.py:69:5: FURB113 [**] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | 67 | if True: 68 | # FURB113 @@ -173,7 +173,7 @@ FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly cal 72 71 | 73 72 | if True: -FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +FURB113.py:75:5: FURB113 [**] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | 73 | if True: 74 | # FURB113 @@ -209,7 +209,7 @@ FURB113.py:82:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly call | = help: Replace with `nums.extend((1, 2, 3))` -FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:90:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 88 | def yes_one(x: list[int]): 89 | # FURB113 @@ -231,7 +231,7 @@ FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin 93 92 | 94 93 | def yes_two(x: List[int]): -FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:96:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 94 | def yes_two(x: List[int]): 95 | # FURB113 @@ -253,7 +253,7 @@ FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly callin 99 98 | 100 99 | def yes_three(*, x: list[int]): -FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:102:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 100 | def yes_three(*, x: list[int]): 101 | # FURB113 @@ -275,7 +275,7 @@ FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calli 105 104 | 106 105 | def yes_four(x: list[int], /): -FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:108:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 106 | def yes_four(x: list[int], /): 107 | # FURB113 @@ -310,7 +310,7 @@ FURB113.py:114:5: FURB113 Use `x.extend((1, 2, 3))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2, 3))` -FURB113.py:122:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:122:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 120 | def yes_six(x: list): 121 | # FURB113 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap index 14ad4d9c3cf9a3..53835ec8c180e5 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB131.py:11:1: FURB131 [*] Prefer `clear` over deleting a full slice +FURB131.py:11:1: FURB131 [**] Prefer `clear` over deleting a full slice | 10 | # FURB131 11 | del nums[:] @@ -19,7 +19,7 @@ FURB131.py:11:1: FURB131 [*] Prefer `clear` over deleting a full slice 13 13 | 14 14 | # FURB131 -FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice +FURB131.py:15:1: FURB131 [**] Prefer `clear` over deleting a full slice | 14 | # FURB131 15 | del names[:] @@ -53,7 +53,7 @@ FURB131.py:23:1: FURB131 Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -FURB131.py:28:5: FURB131 [*] Prefer `clear` over deleting a full slice +FURB131.py:28:5: FURB131 [**] Prefer `clear` over deleting a full slice | 26 | def yes_one(x: list[int]): 27 | # FURB131 @@ -72,7 +72,7 @@ FURB131.py:28:5: FURB131 [*] Prefer `clear` over deleting a full slice 30 30 | 31 31 | def yes_two(x: dict[int, str]): -FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice +FURB131.py:33:5: FURB131 [**] Prefer `clear` over deleting a full slice | 31 | def yes_two(x: dict[int, str]): 32 | # FURB131 @@ -91,7 +91,7 @@ FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice 35 35 | 36 36 | def yes_three(x: List[int]): -FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice +FURB131.py:38:5: FURB131 [**] Prefer `clear` over deleting a full slice | 36 | def yes_three(x: List[int]): 37 | # FURB131 @@ -110,7 +110,7 @@ FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice 40 40 | 41 41 | def yes_four(x: Dict[int, str]): -FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice +FURB131.py:43:5: FURB131 [**] Prefer `clear` over deleting a full slice | 41 | def yes_four(x: Dict[int, str]): 42 | # FURB131 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap index 25c2e3746bb26d..7e21ec3d7bd8ba 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB132.py:12:1: FURB132 [*] Use `s.discard("x")` instead of check and `remove` +FURB132.py:12:1: FURB132 [**] Use `s.discard("x")` instead of check and `remove` | 11 | # FURB132 12 | / if "x" in s: @@ -21,7 +21,7 @@ FURB132.py:12:1: FURB132 [*] Use `s.discard("x")` instead of check and `remove` 15 14 | 16 15 | # FURB132 -FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` +FURB132.py:22:1: FURB132 [**] Use `s3.discard("x")` instead of check and `remove` | 21 | # FURB132 22 | / if "x" in s3: @@ -41,7 +41,7 @@ FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` 25 24 | 26 25 | var = "y" -FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` +FURB132.py:28:1: FURB132 [**] Use `s.discard(var)` instead of check and `remove` | 26 | var = "y" 27 | # FURB132 @@ -62,7 +62,7 @@ FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` 31 30 | 32 31 | if f"{var}:{var}" in s: -FURB132.py:32:1: FURB132 [*] Use `s.discard(f"{var}:{var}")` instead of check and `remove` +FURB132.py:32:1: FURB132 [**] Use `s.discard(f"{var}:{var}")` instead of check and `remove` | 32 | / if f"{var}:{var}" in s: 33 | | s.remove(f"{var}:{var}") diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap index 89541187db04b7..52811c0d0e9ca0 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB140.py:7:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:7:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 6 | # FURB140 7 | [print(x, y) for x, y in zipped()] @@ -25,7 +25,7 @@ FURB140.py:7:1: FURB140 [*] Use `itertools.starmap` instead of the generator 9 10 | # FURB140 10 11 | (print(x, y) for x, y in zipped()) -FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:10:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 9 | # FURB140 10 | (print(x, y) for x, y in zipped()) @@ -50,7 +50,7 @@ FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator 12 13 | # FURB140 13 14 | {print(x, y) for x, y in zipped()} -FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:13:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 12 | # FURB140 13 | {print(x, y) for x, y in zipped()} @@ -73,7 +73,7 @@ FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator 15 16 | 16 17 | from itertools import starmap as sm -FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:19:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 18 | # FURB140 19 | [print(x, y) for x, y in zipped()] @@ -93,7 +93,7 @@ FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator 21 21 | # FURB140 22 22 | (print(x, y) for x, y in zipped()) -FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:22:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 21 | # FURB140 22 | (print(x, y) for x, y in zipped()) @@ -113,7 +113,7 @@ FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator 24 24 | # FURB140 25 25 | {print(x, y) for x, y in zipped()} -FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:25:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 24 | # FURB140 25 | {print(x, y) for x, y in zipped()} @@ -133,7 +133,7 @@ FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 -FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:29:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 27 | # FURB140 (check it still flags starred arguments). 28 | # See https://github.com/astral-sh/ruff/issues/7636 @@ -154,7 +154,7 @@ FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator 31 31 | {foo(*t) for t in [(85, 60), (100, 80)]} 32 32 | -FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:30:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 28 | # See https://github.com/astral-sh/ruff/issues/7636 29 | [foo(*t) for t in [(85, 60), (100, 80)]] @@ -174,7 +174,7 @@ FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator 32 32 | 33 33 | # Non-errors. -FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator +FURB140.py:31:1: FURB140 [**] Use `itertools.starmap` instead of the generator | 29 | [foo(*t) for t in [(85, 60), (100, 80)]] 30 | (foo(*t) for t in [(85, 60), (100, 80)]) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap index 742f089ebf25d3..7247ad82bcd758 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB145.py:4:5: FURB145 [*] Prefer `copy` method over slicing +FURB145.py:4:5: FURB145 [**] Prefer `copy` method over slicing | 3 | # Errors. 4 | a = l[:] @@ -21,7 +21,7 @@ FURB145.py:4:5: FURB145 [*] Prefer `copy` method over slicing 6 6 | d, e = l[:], 1 7 7 | m = l[::] -FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing +FURB145.py:5:11: FURB145 [**] Prefer `copy` method over slicing | 3 | # Errors. 4 | a = l[:] @@ -42,7 +42,7 @@ FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing 7 7 | m = l[::] 8 8 | l[:] -FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing +FURB145.py:6:8: FURB145 [**] Prefer `copy` method over slicing | 4 | a = l[:] 5 | b, c = 1, l[:] @@ -63,7 +63,7 @@ FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing 8 8 | l[:] 9 9 | print(l[:]) -FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing +FURB145.py:7:5: FURB145 [**] Prefer `copy` method over slicing | 5 | b, c = 1, l[:] 6 | d, e = l[:], 1 @@ -84,7 +84,7 @@ FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing 9 9 | print(l[:]) 10 10 | -FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing +FURB145.py:8:1: FURB145 [**] Prefer `copy` method over slicing | 6 | d, e = l[:], 1 7 | m = l[::] @@ -104,7 +104,7 @@ FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing 10 10 | 11 11 | # False negatives. -FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing +FURB145.py:9:7: FURB145 [**] Prefer `copy` method over slicing | 7 | m = l[::] 8 | l[:] diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap index a64560382bb591..fac8fc566037b2 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:14:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 13 | # Errors 14 | for index, _ in enumerate(books): @@ -20,7 +20,7 @@ FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 16 16 | 17 17 | for index, _ in enumerate(books, start=0): -FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:17:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 15 | print(index) 16 | @@ -40,7 +40,7 @@ FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 19 19 | 20 20 | for index, _ in enumerate(books, 0): -FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:20:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 18 | print(index) 19 | @@ -100,7 +100,7 @@ FURB148.py:32:17: FURB148 `enumerate` value is unused, use `for x in range(len(y | = help: Replace with `range(len(...))` -FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:35:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 33 | print(book) 34 | @@ -120,7 +120,7 @@ FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 37 37 | 38 38 | for _, book in enumerate(books, start=0): -FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:38:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 36 | print(book) 37 | @@ -140,7 +140,7 @@ FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 40 40 | 41 41 | for _, book in enumerate(books, 0): -FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:41:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 39 | print(book) 40 | @@ -160,7 +160,7 @@ FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 43 43 | 44 44 | for _, book in enumerate(books, start=1): -FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:44:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 42 | print(book) 43 | @@ -180,7 +180,7 @@ FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 46 46 | 47 47 | for _, book in enumerate(books, 1): -FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:47:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 45 | print(book) 46 | @@ -200,7 +200,7 @@ FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 49 49 | 50 50 | for _, book in enumerate(books, start=x): -FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:50:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 48 | print(book) 49 | @@ -220,7 +220,7 @@ FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 52 52 | 53 53 | for _, book in enumerate(books, x): -FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:53:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 51 | print(book) 52 | @@ -240,7 +240,7 @@ FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 55 55 | 56 56 | for index, (_, _) in enumerate(books): -FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:56:22: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 54 | print(book) 55 | @@ -260,7 +260,7 @@ FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(l 58 58 | 59 59 | for (_, _), book in enumerate(books): -FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:59:21: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 57 | print(index) 58 | @@ -280,7 +280,7 @@ FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 61 61 | 62 62 | for(index, _)in enumerate(books): -FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:62:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 60 | print(book) 61 | @@ -300,7 +300,7 @@ FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 64 64 | 65 65 | for(index), _ in enumerate(books): -FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:65:18: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 63 | print(index) 64 | @@ -320,7 +320,7 @@ FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(l 67 67 | 68 68 | for index, _ in enumerate(books_and_authors): -FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:68:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 66 | print(index) 67 | @@ -340,7 +340,7 @@ FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 70 70 | 71 71 | for _, book in enumerate(books_and_authors): -FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:71:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 69 | print(index) 70 | @@ -360,7 +360,7 @@ FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 73 73 | 74 74 | for index, _ in enumerate(books_set): -FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:74:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 72 | print(book) 73 | @@ -380,7 +380,7 @@ FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 76 76 | 77 77 | for _, book in enumerate(books_set): -FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:77:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 75 | print(index) 76 | @@ -400,7 +400,7 @@ FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` inst 79 79 | 80 80 | for index, _ in enumerate(books_tuple): -FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:80:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead | 78 | print(book) 79 | @@ -420,7 +420,7 @@ FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(l 82 82 | 83 83 | for _, book in enumerate(books_tuple): -FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead +FURB148.py:83:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead | 81 | print(index) 82 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap index f472f1f9f2eaf4..f9c83b5aabbae0 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF013_0.py:21:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:21:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 21 | def f(arg: int = None): # RUF013 | ^^^ RUF013 @@ -19,7 +19,7 @@ RUF013_0.py:21:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 23 23 | 24 24 | -RUF013_0.py:25:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:25:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 25 | def f(arg: str = None): # RUF013 | ^^^ RUF013 @@ -37,7 +37,7 @@ RUF013_0.py:25:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 27 27 | 28 28 | -RUF013_0.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:29:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 29 | def f(arg: typing.List[str] = None): # RUF013 | ^^^^^^^^^^^^^^^^ RUF013 @@ -55,7 +55,7 @@ RUF013_0.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 31 31 | 32 32 | -RUF013_0.py:33:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:33:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 33 | def f(arg: Tuple[str] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -73,7 +73,7 @@ RUF013_0.py:33:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 35 35 | 36 36 | -RUF013_0.py:71:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:71:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 71 | def f(arg: Union = None): # RUF013 | ^^^^^ RUF013 @@ -91,7 +91,7 @@ RUF013_0.py:71:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 73 73 | 74 74 | -RUF013_0.py:75:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:75:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 75 | def f(arg: Union[int] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -109,7 +109,7 @@ RUF013_0.py:75:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 77 77 | 78 78 | -RUF013_0.py:79:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:79:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 79 | def f(arg: Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^ RUF013 @@ -127,7 +127,7 @@ RUF013_0.py:79:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 81 81 | 82 82 | -RUF013_0.py:83:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:83:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 83 | def f(arg: typing.Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -145,7 +145,7 @@ RUF013_0.py:83:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 85 85 | 86 86 | -RUF013_0.py:102:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:102:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 102 | def f(arg: int | float = None): # RUF013 | ^^^^^^^^^^^ RUF013 @@ -163,7 +163,7 @@ RUF013_0.py:102:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 104 104 | 105 105 | -RUF013_0.py:106:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:106:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 106 | def f(arg: int | float | str | bytes = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -181,7 +181,7 @@ RUF013_0.py:106:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 108 108 | 109 109 | -RUF013_0.py:125:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:125:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 125 | def f(arg: Literal[1] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -199,7 +199,7 @@ RUF013_0.py:125:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 127 127 | 128 128 | -RUF013_0.py:129:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:129:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 129 | def f(arg: Literal[1, "foo"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^ RUF013 @@ -217,7 +217,7 @@ RUF013_0.py:129:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 131 131 | 132 132 | -RUF013_0.py:133:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:133:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 133 | def f(arg: typing.Literal[1, "foo", True] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -235,7 +235,7 @@ RUF013_0.py:133:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 135 135 | 136 136 | -RUF013_0.py:152:22: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:152:22: RUF013 [**] PEP 484 prohibits implicit `Optional` | 152 | def f(arg: Annotated[int, ...] = None): # RUF013 | ^^^ RUF013 @@ -253,7 +253,7 @@ RUF013_0.py:152:22: RUF013 [*] PEP 484 prohibits implicit `Optional` 154 154 | 155 155 | -RUF013_0.py:156:32: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:156:32: RUF013 [**] PEP 484 prohibits implicit `Optional` | 156 | def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 | ^^^^^^^^^ RUF013 @@ -271,7 +271,7 @@ RUF013_0.py:156:32: RUF013 [*] PEP 484 prohibits implicit `Optional` 158 158 | 159 159 | -RUF013_0.py:172:11: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:172:11: RUF013 [**] PEP 484 prohibits implicit `Optional` | 171 | def f( 172 | arg1: int = None, # RUF013 @@ -291,7 +291,7 @@ RUF013_0.py:172:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 174 174 | arg3: Literal[1, 2, 3] = None, # RUF013 175 175 | ): -RUF013_0.py:173:11: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:173:11: RUF013 [**] PEP 484 prohibits implicit `Optional` | 171 | def f( 172 | arg1: int = None, # RUF013 @@ -312,7 +312,7 @@ RUF013_0.py:173:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 175 175 | ): 176 176 | pass -RUF013_0.py:174:11: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:174:11: RUF013 [**] PEP 484 prohibits implicit `Optional` | 172 | arg1: int = None, # RUF013 173 | arg2: Union[int, float] = None, # RUF013 @@ -333,7 +333,7 @@ RUF013_0.py:174:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 176 176 | pass 177 177 | -RUF013_0.py:202:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:202:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 202 | def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -351,7 +351,7 @@ RUF013_0.py:202:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 204 204 | 205 205 | -RUF013_0.py:209:13: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:209:13: RUF013 [**] PEP 484 prohibits implicit `Optional` | 209 | def f(arg: "int" = None): # RUF013 | ^^^ RUF013 @@ -369,7 +369,7 @@ RUF013_0.py:209:13: RUF013 [*] PEP 484 prohibits implicit `Optional` 211 211 | 212 212 | -RUF013_0.py:213:13: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:213:13: RUF013 [**] PEP 484 prohibits implicit `Optional` | 213 | def f(arg: "str" = None): # RUF013 | ^^^ RUF013 @@ -395,7 +395,7 @@ RUF013_0.py:217:12: RUF013 PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -RUF013_0.py:225:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:225:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 225 | def f(arg: Union["int", "str"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^ RUF013 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap index 6647c659483723..330d1d707476bb 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_1.py:4:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 4 | def f(arg: int = None): # RUF011 | ^^^ RUF013 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap index baf307a873ffe8..505c6f6ba86ec0 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap @@ -42,7 +42,7 @@ RUF005.py:16:10: RUF005 Consider `[*first, 4, 5, 6]` instead of concatenation | = help: Replace with `[*first, 4, 5, 6]` -RUF005.py:39:7: RUF005 [*] Consider `[1, 2, 3, *foo]` instead of concatenation +RUF005.py:39:7: RUF005 [**] Consider `[1, 2, 3, *foo]` instead of concatenation | 38 | foo = [4, 5, 6] 39 | bar = [1, 2, 3] + foo @@ -62,7 +62,7 @@ RUF005.py:39:7: RUF005 [*] Consider `[1, 2, 3, *foo]` instead of concatenation 41 41 | quux = (7, 8, 9) + zoob 42 42 | spam = quux + (10, 11, 12) -RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation +RUF005.py:41:8: RUF005 [**] Consider `(7, 8, 9, *zoob)` instead of concatenation | 39 | bar = [1, 2, 3] + foo 40 | zoob = tuple(bar) @@ -83,7 +83,7 @@ RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] -RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenation +RUF005.py:42:8: RUF005 [**] Consider `(*quux, 10, 11, 12)` instead of concatenation | 40 | zoob = tuple(bar) 41 | quux = (7, 8, 9) + zoob @@ -104,7 +104,7 @@ RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenati 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() -RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenation +RUF005.py:44:8: RUF005 [**] Consider `[*spom, 13, 14, 15]` instead of concatenation | 42 | spam = quux + (10, 11, 12) 43 | spom = list(spam) @@ -125,7 +125,7 @@ RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenati 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words -RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concatenation +RUF005.py:45:13: RUF005 [**] Consider `("we all say", *yay())` instead of concatenation | 43 | spom = list(spam) 44 | eggs = spom + [13, 14, 15] @@ -146,7 +146,7 @@ RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concate 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | -RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of concatenation +RUF005.py:46:14: RUF005 [**] Consider `("we all think", *Fun().yay())` instead of concatenation | 44 | eggs = spom + [13, 14, 15] 45 | elatement = ("we all say",) + yay() @@ -166,7 +166,7 @@ RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of 48 48 | 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) -RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of concatenation +RUF005.py:47:16: RUF005 [**] Consider `("we all feel", *Fun.words)` instead of concatenation | 45 | elatement = ("we all say",) + yay() 46 | excitement = ("we all think",) + Fun().yay() @@ -187,7 +187,7 @@ RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of co 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 50 | -RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation +RUF005.py:49:9: RUF005 [**] Consider iterable unpacking instead of concatenation | 47 | astonishment = ("we all feel",) + Fun.words 48 | @@ -208,7 +208,7 @@ RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation 51 51 | baz = () + zoob 52 52 | -RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of concatenation +RUF005.py:49:39: RUF005 [**] Consider `("yes", "no", "pants", *zoob)` instead of concatenation | 47 | astonishment = ("we all feel",) + Fun.words 48 | @@ -229,7 +229,7 @@ RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of 51 51 | baz = () + zoob 52 52 | -RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation +RUF005.py:51:7: RUF005 [**] Consider `(*zoob,)` instead of concatenation | 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 | @@ -250,7 +250,7 @@ RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation 53 53 | [] + foo + [ 54 54 | ] -RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation +RUF005.py:53:1: RUF005 [**] Consider `[*foo]` instead of concatenation | 51 | baz = () + zoob 52 | @@ -273,7 +273,7 @@ RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation 56 55 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 56 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) -RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation +RUF005.py:56:15: RUF005 [**] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation | 54 | ] 55 | @@ -294,7 +294,7 @@ RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, pa 58 58 | b = a + [2, 3] + [4] 59 59 | -RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation +RUF005.py:57:21: RUF005 [**] Consider iterable unpacking instead of concatenation | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -313,7 +313,7 @@ RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation 59 59 | 60 60 | # Uses the non-preferred quote style, which should be retained. -RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation +RUF005.py:58:5: RUF005 [**] Consider `[*a, 2, 3, 4]` instead of concatenation | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -334,7 +334,7 @@ RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation 60 60 | # Uses the non-preferred quote style, which should be retained. 61 61 | f"{a() + ['b']}" -RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation +RUF005.py:61:4: RUF005 [**] Consider `[*a(), 'b']` instead of concatenation | 60 | # Uses the non-preferred quote style, which should be retained. 61 | f"{a() + ['b']}" diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap index 10634c0520c031..ad642299b6ef94 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF013_0.py:21:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:21:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 21 | def f(arg: int = None): # RUF013 | ^^^ RUF013 @@ -19,7 +19,7 @@ RUF013_0.py:21:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 23 23 | 24 24 | -RUF013_0.py:25:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:25:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 25 | def f(arg: str = None): # RUF013 | ^^^ RUF013 @@ -37,7 +37,7 @@ RUF013_0.py:25:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 27 27 | 28 28 | -RUF013_0.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:29:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 29 | def f(arg: typing.List[str] = None): # RUF013 | ^^^^^^^^^^^^^^^^ RUF013 @@ -55,7 +55,7 @@ RUF013_0.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 31 31 | 32 32 | -RUF013_0.py:33:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:33:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 33 | def f(arg: Tuple[str] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -73,7 +73,7 @@ RUF013_0.py:33:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 35 35 | 36 36 | -RUF013_0.py:71:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:71:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 71 | def f(arg: Union = None): # RUF013 | ^^^^^ RUF013 @@ -91,7 +91,7 @@ RUF013_0.py:71:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 73 73 | 74 74 | -RUF013_0.py:75:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:75:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 75 | def f(arg: Union[int] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -109,7 +109,7 @@ RUF013_0.py:75:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 77 77 | 78 78 | -RUF013_0.py:79:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:79:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 79 | def f(arg: Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^ RUF013 @@ -127,7 +127,7 @@ RUF013_0.py:79:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 81 81 | 82 82 | -RUF013_0.py:83:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:83:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 83 | def f(arg: typing.Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -145,7 +145,7 @@ RUF013_0.py:83:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 85 85 | 86 86 | -RUF013_0.py:102:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:102:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 102 | def f(arg: int | float = None): # RUF013 | ^^^^^^^^^^^ RUF013 @@ -163,7 +163,7 @@ RUF013_0.py:102:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 104 104 | 105 105 | -RUF013_0.py:106:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:106:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 106 | def f(arg: int | float | str | bytes = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -181,7 +181,7 @@ RUF013_0.py:106:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 108 108 | 109 109 | -RUF013_0.py:125:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:125:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 125 | def f(arg: Literal[1] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -199,7 +199,7 @@ RUF013_0.py:125:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 127 127 | 128 128 | -RUF013_0.py:129:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:129:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 129 | def f(arg: Literal[1, "foo"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^ RUF013 @@ -217,7 +217,7 @@ RUF013_0.py:129:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 131 131 | 132 132 | -RUF013_0.py:133:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:133:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 133 | def f(arg: typing.Literal[1, "foo", True] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -235,7 +235,7 @@ RUF013_0.py:133:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 135 135 | 136 136 | -RUF013_0.py:152:22: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:152:22: RUF013 [**] PEP 484 prohibits implicit `Optional` | 152 | def f(arg: Annotated[int, ...] = None): # RUF013 | ^^^ RUF013 @@ -253,7 +253,7 @@ RUF013_0.py:152:22: RUF013 [*] PEP 484 prohibits implicit `Optional` 154 154 | 155 155 | -RUF013_0.py:156:32: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:156:32: RUF013 [**] PEP 484 prohibits implicit `Optional` | 156 | def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 | ^^^^^^^^^ RUF013 @@ -271,7 +271,7 @@ RUF013_0.py:156:32: RUF013 [*] PEP 484 prohibits implicit `Optional` 158 158 | 159 159 | -RUF013_0.py:172:11: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:172:11: RUF013 [**] PEP 484 prohibits implicit `Optional` | 171 | def f( 172 | arg1: int = None, # RUF013 @@ -291,7 +291,7 @@ RUF013_0.py:172:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 174 174 | arg3: Literal[1, 2, 3] = None, # RUF013 175 175 | ): -RUF013_0.py:173:11: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:173:11: RUF013 [**] PEP 484 prohibits implicit `Optional` | 171 | def f( 172 | arg1: int = None, # RUF013 @@ -312,7 +312,7 @@ RUF013_0.py:173:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 175 175 | ): 176 176 | pass -RUF013_0.py:174:11: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:174:11: RUF013 [**] PEP 484 prohibits implicit `Optional` | 172 | arg1: int = None, # RUF013 173 | arg2: Union[int, float] = None, # RUF013 @@ -333,7 +333,7 @@ RUF013_0.py:174:11: RUF013 [*] PEP 484 prohibits implicit `Optional` 176 176 | pass 177 177 | -RUF013_0.py:202:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:202:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 202 | def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -351,7 +351,7 @@ RUF013_0.py:202:12: RUF013 [*] PEP 484 prohibits implicit `Optional` 204 204 | 205 205 | -RUF013_0.py:209:13: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:209:13: RUF013 [**] PEP 484 prohibits implicit `Optional` | 209 | def f(arg: "int" = None): # RUF013 | ^^^ RUF013 @@ -369,7 +369,7 @@ RUF013_0.py:209:13: RUF013 [*] PEP 484 prohibits implicit `Optional` 211 211 | 212 212 | -RUF013_0.py:213:13: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:213:13: RUF013 [**] PEP 484 prohibits implicit `Optional` | 213 | def f(arg: "str" = None): # RUF013 | ^^^ RUF013 @@ -395,7 +395,7 @@ RUF013_0.py:217:12: RUF013 PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -RUF013_0.py:225:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_0.py:225:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 225 | def f(arg: Union["int", "str"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^ RUF013 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap index df81fc0f7faf57..11c785db98c124 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` +RUF013_1.py:4:12: RUF013 [**] PEP 484 prohibits implicit `Optional` | 4 | def f(arg: int = None): # RUF011 | ^^^ RUF013 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap index 6e7933a4116267..5224dc2ed9e3ed 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF015.py:4:1: RUF015 [*] Prefer `next(iter(x))` over single element slice +RUF015.py:4:1: RUF015 [**] Prefer `next(iter(x))` over single element slice | 3 | # RUF015 4 | list(x)[0] @@ -21,7 +21,7 @@ RUF015.py:4:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 6 6 | list(i for i in x)[0] 7 7 | [i for i in x][0] -RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice +RUF015.py:5:1: RUF015 [**] Prefer `next(iter(x))` over single element slice | 3 | # RUF015 4 | list(x)[0] @@ -42,7 +42,7 @@ RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 7 7 | [i for i in x][0] 8 8 | -RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice +RUF015.py:6:1: RUF015 [**] Prefer `next(iter(x))` over single element slice | 4 | list(x)[0] 5 | tuple(x)[0] @@ -62,7 +62,7 @@ RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 8 8 | 9 9 | # OK (not indexing (solely) the first element) -RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice +RUF015.py:7:1: RUF015 [**] Prefer `next(iter(x))` over single element slice | 5 | tuple(x)[0] 6 | list(i for i in x)[0] @@ -83,7 +83,7 @@ RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice 9 9 | # OK (not indexing (solely) the first element) 10 10 | list(x) -RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element slice +RUF015.py:29:1: RUF015 [**] Prefer `next(i + 1 for i in x)` over single element slice | 28 | # RUF015 (doesn't mirror the underlying list) 29 | [i + 1 for i in x][0] @@ -103,7 +103,7 @@ RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element s 31 31 | [(i, i + 1) for i in x][0] 32 32 | -RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single element slice +RUF015.py:30:1: RUF015 [**] Prefer `next(i for i in x if i > 5)` over single element slice | 28 | # RUF015 (doesn't mirror the underlying list) 29 | [i + 1 for i in x][0] @@ -123,7 +123,7 @@ RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single elem 32 32 | 33 33 | # RUF015 (multiple generators) -RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single element slice +RUF015.py:31:1: RUF015 [**] Prefer `next((i, i + 1) for i in x)` over single element slice | 29 | [i + 1 for i in x][0] 30 | [i for i in x if i > 5][0] @@ -144,7 +144,7 @@ RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single elem 33 33 | # RUF015 (multiple generators) 34 34 | y = range(10) -RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over single element slice +RUF015.py:35:1: RUF015 [**] Prefer `next(i + j for i in x for j in y)` over single element slice | 33 | # RUF015 (multiple generators) 34 | y = range(10) @@ -165,7 +165,7 @@ RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over singl 37 37 | # RUF015 38 38 | list(range(10))[0] -RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element slice +RUF015.py:38:1: RUF015 [**] Prefer `next(iter(range(10)))` over single element slice | 37 | # RUF015 38 | list(range(10))[0] @@ -185,7 +185,7 @@ RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element sl 40 40 | list(x["y"])[0] 41 41 | -RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice +RUF015.py:39:1: RUF015 [**] Prefer `next(iter(x.y))` over single element slice | 37 | # RUF015 38 | list(range(10))[0] @@ -205,7 +205,7 @@ RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice 41 41 | 42 42 | # RUF015 (multi-line) -RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice +RUF015.py:40:1: RUF015 [**] Prefer `next(iter(x["y"]))` over single element slice | 38 | list(range(10))[0] 39 | list(x.y)[0] @@ -226,7 +226,7 @@ RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice 42 42 | # RUF015 (multi-line) 43 43 | revision_heads_map_ast = [ -RUF015.py:43:26: RUF015 [*] Prefer `next(...)` over single element slice +RUF015.py:43:26: RUF015 [**] Prefer `next(...)` over single element slice | 42 | # RUF015 (multi-line) 43 | revision_heads_map_ast = [ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap index 3d30ebbcbbbe6e..5bf23f636f0e64 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF017_0.py:5:1: RUF017 [*] Avoid quadratic list summation +RUF017_0.py:5:1: RUF017 [**] Avoid quadratic list summation | 4 | # RUF017 5 | sum([x, y], start=[]) @@ -24,7 +24,7 @@ RUF017_0.py:5:1: RUF017 [*] Avoid quadratic list summation 7 9 | sum([[1, 2, 3], [4, 5, 6]], start=[]) 8 10 | sum([[1, 2, 3], [4, 5, 6]], []) -RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation +RUF017_0.py:6:1: RUF017 [**] Avoid quadratic list summation | 4 | # RUF017 5 | sum([x, y], start=[]) @@ -49,7 +49,7 @@ RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation 8 10 | sum([[1, 2, 3], [4, 5, 6]], []) 9 11 | sum([[1, 2, 3], [4, 5, 6]], -RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation +RUF017_0.py:7:1: RUF017 [**] Avoid quadratic list summation | 5 | sum([x, y], start=[]) 6 | sum([x, y], []) @@ -75,7 +75,7 @@ RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation 9 11 | sum([[1, 2, 3], [4, 5, 6]], 10 12 | []) -RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation +RUF017_0.py:8:1: RUF017 [**] Avoid quadratic list summation | 6 | sum([x, y], []) 7 | sum([[1, 2, 3], [4, 5, 6]], start=[]) @@ -102,7 +102,7 @@ RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation 10 12 | []) 11 13 | -RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation +RUF017_0.py:9:1: RUF017 [**] Avoid quadratic list summation | 7 | sum([[1, 2, 3], [4, 5, 6]], start=[]) 8 | sum([[1, 2, 3], [4, 5, 6]], []) @@ -131,7 +131,7 @@ RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation 12 13 | # OK 13 14 | sum([x, y]) -RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation +RUF017_0.py:21:5: RUF017 [**] Avoid quadratic list summation | 19 | import functools, operator 20 | @@ -150,7 +150,7 @@ RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation 23 23 | 24 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 -RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation +RUF017_0.py:26:5: RUF017 [**] Avoid quadratic list summation | 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 25 | def func(): diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap index 65bb00fdeb0d04..8f9bc4fe7aa13e 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF017_1.py:1:1: RUF017 [*] Avoid quadratic list summation +RUF017_1.py:1:1: RUF017 [**] Avoid quadratic list summation | 1 | sum((factor.dims for factor in bases), []) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF017 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap index 17d3c4a376fbc1..12a5e6ce36e243 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -noqa.py:23:5: F841 [*] Local variable `I` is assigned to but never used +noqa.py:23:5: F841 [**] Local variable `I` is assigned to but never used | 21 | def f(): 22 | # Only `E741` should be ignored by the `noqa`. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap index d1842091b0d9ca..0c153033654183 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive +RUF100_0.py:9:12: RUF100 [**] Unused blanket `noqa` directive | 8 | # Invalid 9 | c = 1 # noqa @@ -20,7 +20,7 @@ RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive 11 11 | 12 12 | # Invalid -RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_0.py:13:12: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 12 | # Invalid 13 | d = 1 # noqa: E501 @@ -40,7 +40,7 @@ RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) 15 15 | # Invalid 16 16 | d = 1 # noqa: F841, E501 -RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) +RUF100_0.py:16:12: RUF100 [**] Unused `noqa` directive (unused: `F841`, `E501`) | 15 | # Invalid 16 | d = 1 # noqa: F841, E501 @@ -60,7 +60,7 @@ RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) 18 18 | # Invalid (and unimplemented or not enabled) 19 19 | d = 1 # noqa: F841, W191, F821 -RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) +RUF100_0.py:19:12: RUF100 [**] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) | 18 | # Invalid (and unimplemented or not enabled) 19 | d = 1 # noqa: F841, W191, F821 @@ -80,7 +80,7 @@ RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; n 21 21 | # Invalid (but external) 22 22 | d = 1 # noqa: F841, V101 -RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) +RUF100_0.py:22:12: RUF100 [**] Unused `noqa` directive (unused: `F841`) | 21 | # Invalid (but external) 22 | d = 1 # noqa: F841, V101 @@ -100,7 +100,7 @@ RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) 24 24 | # fmt: off 25 25 | # Invalid - no space before # -RUF100_0.py:26:10: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_0.py:26:10: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 24 | # fmt: off 25 | # Invalid - no space before # @@ -121,7 +121,7 @@ RUF100_0.py:26:10: RUF100 [*] Unused `noqa` directive (unused: `E501`) 28 28 | # Invalid - many spaces before # 29 29 | d = 1 # noqa: E501 -RUF100_0.py:29:5: F841 [*] Local variable `d` is assigned to but never used +RUF100_0.py:29:5: F841 [**] Local variable `d` is assigned to but never used | 28 | # Invalid - many spaces before # 29 | d = 1 # noqa: E501 @@ -139,7 +139,7 @@ RUF100_0.py:29:5: F841 [*] Local variable `d` is assigned to but never used 31 30 | 32 31 | -RUF100_0.py:29:33: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_0.py:29:33: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 28 | # Invalid - many spaces before # 29 | d = 1 # noqa: E501 @@ -158,7 +158,7 @@ RUF100_0.py:29:33: RUF100 [*] Unused `noqa` directive (unused: `E501`) 31 31 | 32 32 | -RUF100_0.py:55:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) +RUF100_0.py:55:6: RUF100 [**] Unused `noqa` directive (unused: `F841`) | 54 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 55 | """ # noqa: E501, F841 @@ -178,7 +178,7 @@ RUF100_0.py:55:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) 57 57 | # Invalid 58 58 | _ = """Lorem ipsum dolor sit amet. -RUF100_0.py:63:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_0.py:63:6: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 62 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 63 | """ # noqa: E501 @@ -198,7 +198,7 @@ RUF100_0.py:63:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) 65 65 | # Invalid 66 66 | _ = """Lorem ipsum dolor sit amet. -RUF100_0.py:71:6: RUF100 [*] Unused blanket `noqa` directive +RUF100_0.py:71:6: RUF100 [**] Unused blanket `noqa` directive | 70 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 71 | """ # noqa @@ -245,7 +245,7 @@ RUF100_0.py:90:89: E501 Line too long (89 > 88 characters) | ^ E501 | -RUF100_0.py:90:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) +RUF100_0.py:90:92: RUF100 [**] Unused `noqa` directive (unused: `F401`) | 88 | print(sys.path) 89 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap index 288d46d007d67a..4735ed8cb91a40 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap @@ -22,7 +22,7 @@ RUF100_1.py:37:9: F401 [*] `typing.Union` imported but unused 40 39 | 41 40 | def f(): -RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) +RUF100_1.py:52:20: RUF100 [**] Unused `noqa` directive (unused: `F401`) | 50 | # This should ignore the error, but the inner noqa should be marked as unused. 51 | from typing import ( # noqa: F401 @@ -42,7 +42,7 @@ RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) 54 54 | 55 55 | -RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) +RUF100_1.py:59:20: RUF100 [**] Unused `noqa` directive (unused: `F401`) | 57 | # This should ignore the error, but the inner noqa should be marked as unused. 58 | from typing import ( # noqa @@ -62,7 +62,7 @@ RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) 61 61 | 62 62 | -RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) +RUF100_1.py:66:16: RUF100 [**] Unused `noqa` directive (non-enabled: `F501`) | 64 | # This should ignore the error, but mark F501 as unused. 65 | from typing import ( # noqa: F401 @@ -82,7 +82,7 @@ RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) 68 68 | 69 69 | -RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) +RUF100_1.py:72:27: RUF100 [**] Unused `noqa` directive (non-enabled: `F501`) | 70 | def f(): 71 | # This should ignore the error, but mark F501 as unused. @@ -135,7 +135,7 @@ RUF100_1.py:89:35: F401 [*] `typing.AwaitableGenerator` imported but unused 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ pass # noqa: F501 -RUF100_1.py:89:55: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) +RUF100_1.py:89:55: RUF100 [**] Unused `noqa` directive (non-enabled: `F501`) | 87 | def f(): 88 | # This should mark F501 as unused. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap index 3de393b1c95a4a..90e13752ec1b9e 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF100_2.py:1:19: RUF100 [*] Unused `noqa` directive (unused: `F401`) +RUF100_2.py:1:19: RUF100 [**] Unused `noqa` directive (unused: `F401`) | 1 | import itertools # noqa: F401 | ^^^^^^^^^^^^ RUF100 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap index f7c08b2403df8d..9ad710e1886dfe 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF100_3.py:1:1: RUF100 [*] Unused blanket `noqa` directive +RUF100_3.py:1:1: RUF100 [**] Unused blanket `noqa` directive | 1 | # noqa | ^^^^^^ RUF100 @@ -16,7 +16,7 @@ RUF100_3.py:1:1: RUF100 [*] Unused blanket `noqa` directive 3 2 | print() # noqa 4 3 | print() # noqa # comment -RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive +RUF100_3.py:2:1: RUF100 [**] Unused blanket `noqa` directive | 1 | # noqa 2 | # noqa # comment @@ -34,7 +34,7 @@ RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment -RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive +RUF100_3.py:3:10: RUF100 [**] Unused blanket `noqa` directive | 1 | # noqa 2 | # noqa # comment @@ -54,7 +54,7 @@ RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive 5 5 | print() # noqa # comment 6 6 | print() # noqa comment -RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive +RUF100_3.py:4:10: RUF100 [**] Unused blanket `noqa` directive | 2 | # noqa # comment 3 | print() # noqa @@ -75,7 +75,7 @@ RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive 6 6 | print() # noqa comment 7 7 | print() # noqa comment -RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive +RUF100_3.py:5:10: RUF100 [**] Unused blanket `noqa` directive | 3 | print() # noqa 4 | print() # noqa # comment @@ -96,7 +96,7 @@ RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive 7 7 | print() # noqa comment 8 8 | print(a) # noqa -RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive +RUF100_3.py:6:10: RUF100 [**] Unused blanket `noqa` directive | 4 | print() # noqa # comment 5 | print() # noqa # comment @@ -117,7 +117,7 @@ RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive 8 8 | print(a) # noqa 9 9 | print(a) # noqa # comment -RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive +RUF100_3.py:7:10: RUF100 [**] Unused blanket `noqa` directive | 5 | print() # noqa # comment 6 | print() # noqa comment @@ -138,7 +138,7 @@ RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive 9 9 | print(a) # noqa # comment 10 10 | print(a) # noqa # comment -RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:14:1: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) | 12 | print(a) # noqa comment 13 | @@ -158,7 +158,7 @@ RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 16 15 | print() # noqa: E501, F821 17 16 | print() # noqa: E501, F821 # comment -RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:15:1: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) | 14 | # noqa: E501, F821 15 | # noqa: E501, F821 # comment @@ -178,7 +178,7 @@ RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment -RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:16:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) | 14 | # noqa: E501, F821 15 | # noqa: E501, F821 # comment @@ -199,7 +199,7 @@ RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment -RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:17:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) | 15 | # noqa: E501, F821 # comment 16 | print() # noqa: E501, F821 @@ -220,7 +220,7 @@ RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment -RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:18:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) | 16 | print() # noqa: E501, F821 17 | print() # noqa: E501, F821 # comment @@ -241,7 +241,7 @@ RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 -RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:19:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) | 17 | print() # noqa: E501, F821 # comment 18 | print() # noqa: E501, F821 # comment @@ -262,7 +262,7 @@ RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment -RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:20:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) | 18 | print() # noqa: E501, F821 # comment 19 | print() # noqa: E501, F821 comment @@ -283,7 +283,7 @@ RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment -RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:21:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 19 | print() # noqa: E501, F821 comment 20 | print() # noqa: E501, F821 comment @@ -304,7 +304,7 @@ RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 23 23 | print(a) # noqa: E501, F821 # comment 24 24 | print(a) # noqa: E501, F821 comment -RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:22:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 20 | print() # noqa: E501, F821 comment 21 | print(a) # noqa: E501, F821 @@ -325,7 +325,7 @@ RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment -RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:23:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 21 | print(a) # noqa: E501, F821 22 | print(a) # noqa: E501, F821 # comment @@ -345,7 +345,7 @@ RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment -RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:24:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 22 | print(a) # noqa: E501, F821 # comment 23 | print(a) # noqa: E501, F821 # comment @@ -363,7 +363,7 @@ RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) 24 |+print(a) # noqa: F821 comment 25 25 | print(a) # noqa: E501, F821 comment -RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:25:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 23 | print(a) # noqa: E501, F821 # comment 24 | print(a) # noqa: E501, F821 comment diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap index 0808aaab058fe8..3dc0b89b463b46 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap @@ -33,7 +33,7 @@ RUF100_5.py:11:1: ERA001 [*] Found commented-out code 10 10 | 11 |-#import os # noqa: E501 -RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) +RUF100_5.py:11:13: RUF100 [**] Unused `noqa` directive (unused: `E501`) | 11 | #import os # noqa: E501 | ^^^^^^^^^^^^ RUF100 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap index 974eba08c4e831..dc5cd3af52a6a0 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -ruff_noqa_codes.py:8:5: F841 [*] Local variable `x` is assigned to but never used +ruff_noqa_codes.py:8:5: F841 [**] Local variable `x` is assigned to but never used | 7 | def f(): 8 | x = 1 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap index c267b245b6535a..94ba2d975e9478 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap @@ -14,7 +14,7 @@ ruff_noqa_invalid.py:1:8: F401 [*] `os` imported but unused 3 2 | 4 3 | def f(): -ruff_noqa_invalid.py:5:5: F841 [*] Local variable `x` is assigned to but never used +ruff_noqa_invalid.py:5:5: F841 [**] Local variable `x` is assigned to but never used | 4 | def f(): 5 | x = 1 diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap index 6a15b3815f265a..a793b8bce48741 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -TRY201.py:20:15: TRY201 [*] Use `raise` without specifying exception name +TRY201.py:20:15: TRY201 [**] Use `raise` without specifying exception name | 18 | except MyException as e: 19 | logger.exception("process failed") @@ -20,7 +20,7 @@ TRY201.py:20:15: TRY201 [*] Use `raise` without specifying exception name 22 22 | 23 23 | def good(): -TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name +TRY201.py:63:19: TRY201 [**] Use `raise` without specifying exception name | 61 | logger.exception("process failed") 62 | if True: @@ -39,7 +39,7 @@ TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name 65 65 | 66 66 | def bad_that_needs_recursion_2(): -TRY201.py:74:23: TRY201 [*] Use `raise` without specifying exception name +TRY201.py:74:23: TRY201 [**] Use `raise` without specifying exception name | 73 | def foo(): 74 | raise e diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap index 24253dc073ad8b..be0132e57dbbde 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/linter.rs --- -unused_variable.ipynb:cell 1:2:5: F841 [*] Local variable `foo1` is assigned to but never used +unused_variable.ipynb:cell 1:2:5: F841 [**] Local variable `foo1` is assigned to but never used | 1 | def f(): 2 | foo1 = %matplotlib --list @@ -18,7 +18,7 @@ unused_variable.ipynb:cell 1:2:5: F841 [*] Local variable `foo1` is assigned to 4 4 | def f(): 5 5 | bar1 = !pwd -unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to but never used +unused_variable.ipynb:cell 1:3:5: F841 [**] Local variable `foo2` is assigned to but never used | 1 | def f(): 2 | foo1 = %matplotlib --list @@ -36,7 +36,7 @@ unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to 5 5 | bar1 = !pwd 6 6 | bar2: str = !pwd -unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to but never used +unused_variable.ipynb:cell 2:2:5: F841 [**] Local variable `bar1` is assigned to but never used | 1 | def f(): 2 | bar1 = !pwd @@ -53,7 +53,7 @@ unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to 5 |+ !pwd 6 6 | bar2: str = !pwd -unused_variable.ipynb:cell 2:3:5: F841 [*] Local variable `bar2` is assigned to but never used +unused_variable.ipynb:cell 2:3:5: F841 [**] Local variable `bar2` is assigned to but never used | 1 | def f(): 2 | bar1 = !pwd From b24d9dd004cb846d172be54de99503e4c47bcb02 Mon Sep 17 00:00:00 2001 From: Zanie Date: Wed, 4 Oct 2023 10:16:47 -0500 Subject: [PATCH 11/28] Remove comment detailing ordering --- crates/ruff_diagnostics/src/fix.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/ruff_diagnostics/src/fix.rs b/crates/ruff_diagnostics/src/fix.rs index b724d6e178e11f..7daa2fbb913eb1 100644 --- a/crates/ruff_diagnostics/src/fix.rs +++ b/crates/ruff_diagnostics/src/fix.rs @@ -5,10 +5,7 @@ use ruff_text_size::{Ranged, TextSize}; use crate::edit::Edit; -/// Indicates confidence in the correctness of a suggested fix. Rust internally allows comparison -/// of enum values based on their order (see Rust's [enum -/// documentation](https://doc.rust-lang.org/reference/items/enumerations.html)). This allows us to -/// apply [`Fix`]es based on their [`Applicability`]. +/// Indicates confidence in the correctness of a proposed fix. #[derive(Default, Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum Applicability { From a5ef7d67f57d9136d885d862ec2a983b30306777 Mon Sep 17 00:00:00 2001 From: Zanie Date: Wed, 4 Oct 2023 11:10:52 -0500 Subject: [PATCH 12/28] Refactor `RuleCodeAndBody.fmt` to avoid using `unwrap` --- crates/ruff_linter/src/message/text.rs | 36 ++++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/crates/ruff_linter/src/message/text.rs b/crates/ruff_linter/src/message/text.rs index c3c2111ac9628e..9825570cc97de3 100644 --- a/crates/ruff_linter/src/message/text.rs +++ b/crates/ruff_linter/src/message/text.rs @@ -140,24 +140,26 @@ impl Display for RuleCodeAndBody<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let kind = &self.message.kind; - if self.show_fix_status && self.message.fix.is_some() { - let indicator = self.message.fix.as_ref().unwrap().applicability().symbol(); + if let Some(fix) = self.message.fix.as_ref() { + if self.show_fix_status { + let indicator = fix.applicability().symbol(); + + return write!( + f, + "{code} {fix}{body}", + code = kind.rule().noqa_code().to_string().red().bold(), + fix = format_args!("[{}] ", indicator.cyan()), + body = kind.body, + ); + } + }; - write!( - f, - "{code} {fix}{body}", - code = kind.rule().noqa_code().to_string().red().bold(), - fix = format_args!("[{}] ", indicator.cyan()), - body = kind.body, - ) - } else { - write!( - f, - "{code} {body}", - code = kind.rule().noqa_code().to_string().red().bold(), - body = kind.body, - ) - } + write!( + f, + "{code} {body}", + code = kind.rule().noqa_code().to_string().red().bold(), + body = kind.body, + ) } } From cb6c25e3a9468b1d593696e9bf747521ea9a8e7f Mon Sep 17 00:00:00 2001 From: Zanie Date: Wed, 4 Oct 2023 11:14:26 -0500 Subject: [PATCH 13/28] Do not display fixes with manual applicability --- crates/ruff_linter/src/message/text.rs | 27 ++++++----- ...s__eradicate__tests__ERA001_ERA001.py.snap | 16 +++---- ...flake8_bugbear__tests__B006_B006_1.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_2.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_3.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_4.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_5.py.snap | 26 +++++------ ...flake8_bugbear__tests__B006_B006_6.py.snap | 2 +- ...flake8_bugbear__tests__B006_B006_7.py.snap | 2 +- ...ke8_bugbear__tests__B006_B006_B008.py.snap | 46 +++++++++---------- ...extend_immutable_calls_arg_annotation.snap | 2 +- ...les__pycodestyle__tests__E731_E731.py.snap | 12 ++--- ..._linter__rules__ruff__tests__ruf100_5.snap | 4 +- 13 files changed, 74 insertions(+), 71 deletions(-) diff --git a/crates/ruff_linter/src/message/text.rs b/crates/ruff_linter/src/message/text.rs index 9825570cc97de3..b0a50d684f5946 100644 --- a/crates/ruff_linter/src/message/text.rs +++ b/crates/ruff_linter/src/message/text.rs @@ -7,6 +7,7 @@ use annotate_snippets::snippet::{Annotation, AnnotationType, Slice, Snippet, Sou use bitflags::bitflags; use colored::Colorize; +use ruff_diagnostics::Applicability; use ruff_notebook::NotebookIndex; use ruff_source_file::{OneIndexed, SourceLocation}; use ruff_text_size::{Ranged, TextRange, TextSize}; @@ -139,18 +140,20 @@ pub(super) struct RuleCodeAndBody<'a> { impl Display for RuleCodeAndBody<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let kind = &self.message.kind; - - if let Some(fix) = self.message.fix.as_ref() { - if self.show_fix_status { - let indicator = fix.applicability().symbol(); - - return write!( - f, - "{code} {fix}{body}", - code = kind.rule().noqa_code().to_string().red().bold(), - fix = format_args!("[{}] ", indicator.cyan()), - body = kind.body, - ); + if self.show_fix_status { + if let Some(fix) = self.message.fix.as_ref() { + // Do not display an indicator for manual fixes + if fix.applicability() > Applicability::Manual { + let indicator = fix.applicability().symbol(); + + return write!( + f, + "{code} {fix}{body}", + code = kind.rule().noqa_code().to_string().red().bold(), + fix = format_args!("[{}] ", indicator.cyan()), + body = kind.body, + ); + } } }; diff --git a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap index c33d3b09789787..ae9b9588724c8c 100644 --- a/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap +++ b/crates/ruff_linter/src/rules/eradicate/snapshots/ruff_linter__rules__eradicate__tests__ERA001_ERA001.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/eradicate/mod.rs --- -ERA001.py:1:1: ERA001 [*] Found commented-out code +ERA001.py:1:1: ERA001 Found commented-out code | 1 | #import os | ^^^^^^^^^^ ERA001 @@ -16,7 +16,7 @@ ERA001.py:1:1: ERA001 [*] Found commented-out code 3 2 | #a = 3 4 3 | a = 4 -ERA001.py:2:1: ERA001 [*] Found commented-out code +ERA001.py:2:1: ERA001 Found commented-out code | 1 | #import os 2 | # from foo import junk @@ -33,7 +33,7 @@ ERA001.py:2:1: ERA001 [*] Found commented-out code 4 3 | a = 4 5 4 | #foo(1, 2, 3) -ERA001.py:3:1: ERA001 [*] Found commented-out code +ERA001.py:3:1: ERA001 Found commented-out code | 1 | #import os 2 | # from foo import junk @@ -52,7 +52,7 @@ ERA001.py:3:1: ERA001 [*] Found commented-out code 5 4 | #foo(1, 2, 3) 6 5 | -ERA001.py:5:1: ERA001 [*] Found commented-out code +ERA001.py:5:1: ERA001 Found commented-out code | 3 | #a = 3 4 | a = 4 @@ -72,7 +72,7 @@ ERA001.py:5:1: ERA001 [*] Found commented-out code 7 6 | def foo(x, y, z): 8 7 | content = 1 # print('hello') -ERA001.py:13:5: ERA001 [*] Found commented-out code +ERA001.py:13:5: ERA001 Found commented-out code | 11 | # This is a real comment. 12 | # # This is a (nested) comment. @@ -91,7 +91,7 @@ ERA001.py:13:5: ERA001 [*] Found commented-out code 15 14 | 16 15 | #import os # noqa: ERA001 -ERA001.py:21:5: ERA001 [*] Found commented-out code +ERA001.py:21:5: ERA001 Found commented-out code | 19 | class A(): 20 | pass @@ -109,7 +109,7 @@ ERA001.py:21:5: ERA001 [*] Found commented-out code 23 22 | 24 23 | dictionary = { -ERA001.py:26:5: ERA001 [*] Found commented-out code +ERA001.py:26:5: ERA001 Found commented-out code | 24 | dictionary = { 25 | # "key1": 123, # noqa: ERA001 @@ -129,7 +129,7 @@ ERA001.py:26:5: ERA001 [*] Found commented-out code 28 27 | } 29 28 | -ERA001.py:27:5: ERA001 [*] Found commented-out code +ERA001.py:27:5: ERA001 Found commented-out code | 25 | # "key1": 123, # noqa: ERA001 26 | # "key2": 456, diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap index 5bf88bfe614de8..35b0a379d0b5bc 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_1.py:3:22: B006 [*] Do not use mutable data structures for argument defaults +B006_1.py:3:22: B006 Do not use mutable data structures for argument defaults | 1 | # Docstring followed by a newline 2 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap index 5cf776a5985f93..c925bc5c88a8a1 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_2.py:4:22: B006 [*] Do not use mutable data structures for argument defaults +B006_2.py:4:22: B006 Do not use mutable data structures for argument defaults | 2 | # Regression test for https://github.com/astral-sh/ruff/issues/7155 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap index aed13094fb8042..2c821d54165614 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_3.py:4:22: B006 [*] Do not use mutable data structures for argument defaults +B006_3.py:4:22: B006 Do not use mutable data structures for argument defaults | 4 | def foobar(foor, bar={}): | ^^ B006 diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap index d1452087066df9..bc73ff2c98b22b 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_4.py:7:26: B006 [*] Do not use mutable data structures for argument defaults +B006_4.py:7:26: B006 Do not use mutable data structures for argument defaults | 6 | class FormFeedIndent: 7 | def __init__(self, a=[]): diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap index d741dc3258eba5..85fce0a1884205 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_5.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_5.py:5:49: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:5:49: B006 Do not use mutable data structures for argument defaults | 5 | def import_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -22,7 +22,7 @@ B006_5.py:5:49: B006 [*] Do not use mutable data structures for argument default 8 10 | 9 11 | def import_module_with_values_wrong(value: dict[str, str] = {}): -B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:9:61: B006 Do not use mutable data structures for argument defaults | 9 | def import_module_with_values_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -44,7 +44,7 @@ B006_5.py:9:61: B006 [*] Do not use mutable data structures for argument default 13 15 | 14 16 | -B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:15:50: B006 Do not use mutable data structures for argument defaults | 15 | def import_modules_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -68,7 +68,7 @@ B006_5.py:15:50: B006 [*] Do not use mutable data structures for argument defaul 20 22 | 21 23 | def from_import_module_wrong(value: dict[str, str] = {}): -B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:21:54: B006 Do not use mutable data structures for argument defaults | 21 | def from_import_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -89,7 +89,7 @@ B006_5.py:21:54: B006 [*] Do not use mutable data structures for argument defaul 24 26 | 25 27 | def from_imports_module_wrong(value: dict[str, str] = {}): -B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:25:55: B006 Do not use mutable data structures for argument defaults | 25 | def from_imports_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -112,7 +112,7 @@ B006_5.py:25:55: B006 [*] Do not use mutable data structures for argument defaul 29 31 | 30 32 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}): -B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:30:66: B006 Do not use mutable data structures for argument defaults | 30 | def import_and_from_imports_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -135,7 +135,7 @@ B006_5.py:30:66: B006 [*] Do not use mutable data structures for argument defaul 34 36 | 35 37 | def import_docstring_module_wrong(value: dict[str, str] = {}): -B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:35:59: B006 Do not use mutable data structures for argument defaults | 35 | def import_docstring_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -158,7 +158,7 @@ B006_5.py:35:59: B006 [*] Do not use mutable data structures for argument defaul 39 41 | 40 42 | def import_module_wrong(value: dict[str, str] = {}): -B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:40:49: B006 Do not use mutable data structures for argument defaults | 40 | def import_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -181,7 +181,7 @@ B006_5.py:40:49: B006 [*] Do not use mutable data structures for argument defaul 44 46 | 45 47 | def import_module_wrong(value: dict[str, str] = {}): -B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:45:49: B006 Do not use mutable data structures for argument defaults | 45 | def import_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -203,7 +203,7 @@ B006_5.py:45:49: B006 [*] Do not use mutable data structures for argument defaul 48 50 | 49 51 | -B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:50:49: B006 Do not use mutable data structures for argument defaults | 50 | def import_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -226,7 +226,7 @@ B006_5.py:50:49: B006 [*] Do not use mutable data structures for argument defaul 54 56 | 55 57 | def import_module_wrong(value: dict[str, str] = {}): -B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:55:49: B006 Do not use mutable data structures for argument defaults | 55 | def import_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -247,7 +247,7 @@ B006_5.py:55:49: B006 [*] Do not use mutable data structures for argument defaul 58 60 | 59 61 | def import_module_wrong(value: dict[str, str] = {}): -B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:59:49: B006 Do not use mutable data structures for argument defaults | 59 | def import_module_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -267,7 +267,7 @@ B006_5.py:59:49: B006 [*] Do not use mutable data structures for argument defaul 61 63 | 62 64 | -B006_5.py:63:49: B006 [*] Do not use mutable data structures for argument defaults +B006_5.py:63:49: B006 Do not use mutable data structures for argument defaults | 63 | def import_module_wrong(value: dict[str, str] = {}): | ^^ B006 diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap index f1af067d82f64f..f858253ec8d072 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_6.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_6.py:4:22: B006 [*] Do not use mutable data structures for argument defaults +B006_6.py:4:22: B006 Do not use mutable data structures for argument defaults | 2 | # Same as B006_2.py, but import instead of docstring 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap index fbe42a7285e853..b5418395f5505c 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_7.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_7.py:4:22: B006 [*] Do not use mutable data structures for argument defaults +B006_7.py:4:22: B006 Do not use mutable data structures for argument defaults | 2 | # Same as B006_3.py, but import instead of docstring 3 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap index 6f868ac491c64e..2f8e3285bb24a2 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B006_B006_B008.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_B008.py:63:25: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:63:25: B006 Do not use mutable data structures for argument defaults | 63 | def this_is_wrong(value=[1, 2, 3]): | ^^^^^^^^^ B006 @@ -21,7 +21,7 @@ B006_B008.py:63:25: B006 [*] Do not use mutable data structures for argument def 65 67 | 66 68 | -B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:67:30: B006 Do not use mutable data structures for argument defaults | 67 | def this_is_also_wrong(value={}): | ^^ B006 @@ -41,7 +41,7 @@ B006_B008.py:67:30: B006 [*] Do not use mutable data structures for argument def 69 71 | 70 72 | -B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:73:52: B006 Do not use mutable data structures for argument defaults | 71 | class Foo: 72 | @staticmethod @@ -63,7 +63,7 @@ B006_B008.py:73:52: B006 [*] Do not use mutable data structures for argument def 75 77 | 76 78 | -B006_B008.py:77:31: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:77:31: B006 Do not use mutable data structures for argument defaults | 77 | def multiline_arg_wrong(value={ | _______________________________^ @@ -97,7 +97,7 @@ B006_B008.py:82:36: B006 Do not use mutable data structures for argument default | = help: Replace with `None`; initialize within function -B006_B008.py:85:20: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:85:20: B006 Do not use mutable data structures for argument defaults | 85 | def and_this(value=set()): | ^^^^^ B006 @@ -117,7 +117,7 @@ B006_B008.py:85:20: B006 [*] Do not use mutable data structures for argument def 87 89 | 88 90 | -B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:89:20: B006 Do not use mutable data structures for argument defaults | 89 | def this_too(value=collections.OrderedDict()): | ^^^^^^^^^^^^^^^^^^^^^^^^^ B006 @@ -137,7 +137,7 @@ B006_B008.py:89:20: B006 [*] Do not use mutable data structures for argument def 91 93 | 92 94 | -B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:93:32: B006 Do not use mutable data structures for argument defaults | 93 | async def async_this_too(value=collections.defaultdict()): | ^^^^^^^^^^^^^^^^^^^^^^^^^ B006 @@ -157,7 +157,7 @@ B006_B008.py:93:32: B006 [*] Do not use mutable data structures for argument def 95 97 | 96 98 | -B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:97:26: B006 Do not use mutable data structures for argument defaults | 97 | def dont_forget_me(value=collections.deque()): | ^^^^^^^^^^^^^^^^^^^ B006 @@ -177,7 +177,7 @@ B006_B008.py:97:26: B006 [*] Do not use mutable data structures for argument def 99 101 | 100 102 | -B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:102:46: B006 Do not use mutable data structures for argument defaults | 101 | # N.B. we're also flagging the function call in the comprehension 102 | def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]): @@ -198,7 +198,7 @@ B006_B008.py:102:46: B006 [*] Do not use mutable data structures for argument de 104 106 | 105 107 | -B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:106:46: B006 Do not use mutable data structures for argument defaults | 106 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}): | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B006 @@ -218,7 +218,7 @@ B006_B008.py:106:46: B006 [*] Do not use mutable data structures for argument de 108 110 | 109 111 | -B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:110:45: B006 Do not use mutable data structures for argument defaults | 110 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}): | ^^^^^^^^^^^^^^^^^^^^^^^^ B006 @@ -238,7 +238,7 @@ B006_B008.py:110:45: B006 [*] Do not use mutable data structures for argument de 112 114 | 113 115 | -B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:114:33: B006 Do not use mutable data structures for argument defaults | 114 | def kwonlyargs_mutable(*, value=[]): | ^^ B006 @@ -258,7 +258,7 @@ B006_B008.py:114:33: B006 [*] Do not use mutable data structures for argument de 116 118 | 117 119 | -B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:239:20: B006 Do not use mutable data structures for argument defaults | 237 | # B006 and B008 238 | # We should handle arbitrary nesting of these B008. @@ -280,7 +280,7 @@ B006_B008.py:239:20: B006 [*] Do not use mutable data structures for argument de 241 243 | 242 244 | -B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:276:27: B006 Do not use mutable data structures for argument defaults | 275 | def mutable_annotations( 276 | a: list[int] | None = [], @@ -306,7 +306,7 @@ B006_B008.py:276:27: B006 [*] Do not use mutable data structures for argument de 282 284 | 283 285 | -B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:277:35: B006 Do not use mutable data structures for argument defaults | 275 | def mutable_annotations( 276 | a: list[int] | None = [], @@ -332,7 +332,7 @@ B006_B008.py:277:35: B006 [*] Do not use mutable data structures for argument de 282 284 | 283 285 | -B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:278:62: B006 Do not use mutable data structures for argument defaults | 276 | a: list[int] | None = [], 277 | b: Optional[Dict[int, int]] = {}, @@ -357,7 +357,7 @@ B006_B008.py:278:62: B006 [*] Do not use mutable data structures for argument de 282 284 | 283 285 | -B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:279:80: B006 Do not use mutable data structures for argument defaults | 277 | b: Optional[Dict[int, int]] = {}, 278 | c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(), @@ -381,7 +381,7 @@ B006_B008.py:279:80: B006 [*] Do not use mutable data structures for argument de 282 284 | 283 285 | -B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:284:52: B006 Do not use mutable data structures for argument defaults | 284 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -402,7 +402,7 @@ B006_B008.py:284:52: B006 [*] Do not use mutable data structures for argument de 287 289 | 288 290 | def single_line_func_wrong(value: dict[str, str] = {}): -B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:288:52: B006 Do not use mutable data structures for argument defaults | 288 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -424,7 +424,7 @@ B006_B008.py:288:52: B006 [*] Do not use mutable data structures for argument de 291 293 | 292 294 | -B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:293:52: B006 Do not use mutable data structures for argument defaults | 293 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -444,7 +444,7 @@ B006_B008.py:293:52: B006 [*] Do not use mutable data structures for argument de 295 297 | 296 298 | -B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:297:52: B006 Do not use mutable data structures for argument defaults | 297 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ B006 @@ -465,7 +465,7 @@ B006_B008.py:297:52: B006 [*] Do not use mutable data structures for argument de 299 301 | ... 300 302 | -B006_B008.py:302:52: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:302:52: B006 Do not use mutable data structures for argument defaults | 302 | def single_line_func_wrong(value: dict[str, str] = { | ____________________________________________________^ @@ -500,7 +500,7 @@ B006_B008.py:308:52: B006 Do not use mutable data structures for argument defaul | = help: Replace with `None`; initialize within function -B006_B008.py:313:52: B006 [*] Do not use mutable data structures for argument defaults +B006_B008.py:313:52: B006 Do not use mutable data structures for argument defaults | 313 | def single_line_func_wrong(value: dict[str, str] = {}): | ^^ B006 diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap index d191804dd6772c..82d3a1f8a543f5 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__extend_immutable_calls_arg_annotation.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B006_extended.py:17:55: B006 [*] Do not use mutable data structures for argument defaults +B006_extended.py:17:55: B006 Do not use mutable data structures for argument defaults | 17 | def error_due_to_missing_import(foo: ImmutableTypeA = []): | ^^ B006 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap index 55ec0c4b1b6277..4bc66847d9620d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap @@ -100,7 +100,7 @@ E731.py:24:5: E731 [**] Do not assign a `lambda` expression, use a `def` 26 27 | 27 28 | def scope(): -E731.py:57:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:57:5: E731 Do not assign a `lambda` expression, use a `def` | 55 | class Scope: 56 | # E731 @@ -120,7 +120,7 @@ E731.py:57:5: E731 [*] Do not assign a `lambda` expression, use a `def` 59 60 | 60 61 | class Scope: -E731.py:64:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:64:5: E731 Do not assign a `lambda` expression, use a `def` | 63 | # E731 64 | f: Callable[[int], int] = lambda x: 2 * x @@ -139,7 +139,7 @@ E731.py:64:5: E731 [*] Do not assign a `lambda` expression, use a `def` 66 67 | 67 68 | def scope(): -E731.py:73:9: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:73:9: E731 Do not assign a `lambda` expression, use a `def` | 71 | x: Callable[[int], int] 72 | if True: @@ -161,7 +161,7 @@ E731.py:73:9: E731 [*] Do not assign a `lambda` expression, use a `def` 75 76 | x = lambda: 2 76 77 | return x -E731.py:75:9: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` | 73 | x = lambda: 1 74 | else: @@ -322,7 +322,7 @@ E731.py:135:5: E731 [**] Do not assign a `lambda` expression, use a `def` 137 138 | 138 139 | class TemperatureScales(Enum): -E731.py:139:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:139:5: E731 Do not assign a `lambda` expression, use a `def` | 138 | class TemperatureScales(Enum): 139 | CELSIUS = (lambda deg_c: deg_c) @@ -342,7 +342,7 @@ E731.py:139:5: E731 [*] Do not assign a `lambda` expression, use a `def` 141 142 | 142 143 | -E731.py:140:5: E731 [*] Do not assign a `lambda` expression, use a `def` +E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` | 138 | class TemperatureScales(Enum): 139 | CELSIUS = (lambda deg_c: deg_c) diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap index 3dc0b89b463b46..67c85f4452042e 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF100_5.py:7:5: ERA001 [*] Found commented-out code +RUF100_5.py:7:5: ERA001 Found commented-out code | 5 | # "key1": 123, # noqa: ERA001 6 | # "key2": 456, # noqa @@ -20,7 +20,7 @@ RUF100_5.py:7:5: ERA001 [*] Found commented-out code 9 8 | 10 9 | -RUF100_5.py:11:1: ERA001 [*] Found commented-out code +RUF100_5.py:11:1: ERA001 Found commented-out code | 11 | #import os # noqa: E501 | ^^^^^^^^^^^^^^^^^^^^^^^^ ERA001 From 86833400ef5d8741db37c71b0f5186bf35be488a Mon Sep 17 00:00:00 2001 From: Zanie Date: Wed, 4 Oct 2023 11:38:46 -0500 Subject: [PATCH 14/28] Rename `--suggested-fix` to `--unsafe-fixes` and fix interaction with `--fix` --- crates/ruff_cli/src/args.rs | 22 ++++----- crates/ruff_cli/src/cache.rs | 6 +-- crates/ruff_cli/src/commands/check.rs | 2 +- crates/ruff_cli/src/diagnostics.rs | 8 +-- crates/ruff_cli/src/lib.rs | 16 +++--- crates/ruff_cli/src/printer.rs | 14 +++--- crates/ruff_cli/tests/integration_test.rs | 57 ++++++++++++---------- crates/ruff_linter/src/fix/mod.rs | 6 +-- crates/ruff_linter/src/linter.rs | 4 +- crates/ruff_linter/src/settings/flags.rs | 14 +++--- crates/ruff_linter/src/test.rs | 2 +- crates/ruff_workspace/src/configuration.rs | 8 +-- crates/ruff_workspace/src/options.rs | 6 +-- crates/ruff_workspace/src/settings.rs | 4 +- docs/configuration.md | 8 +-- ruff.schema.json | 16 +++--- 16 files changed, 98 insertions(+), 95 deletions(-) diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff_cli/src/args.rs index acd797595f895e..51fe9bf2e27c48 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff_cli/src/args.rs @@ -76,14 +76,14 @@ pub enum Command { pub struct CheckCommand { /// List of files or directories to check. pub files: Vec, - /// Apply automatic fixes to resolve lint violations. - /// Use `--no-fix` to disable or `--fix-suggested` to include suggested fixes. + /// Apply fixes to resolve lint violations. + /// Use `--no-fix` to disable or `--unsafe-fixes` to include suggested fixes. #[arg(long, overrides_with("no_fix"))] fix: bool, - /// Apply automatic and suggested fixes to resolve lint violations. - #[arg(long, overrides_with_all(["fix", "no_fix"]))] - fix_suggested: bool, - #[clap(long, overrides_with_all(["fix", "fix_suggested"]), hide = true)] + /// Apply unsafe fixes to resolve lint violations. + #[arg(long)] + unsafe_fixes: bool, + #[clap(long, overrides_with_all(["fix"]), hide = true)] no_fix: bool, /// Show violations with source code. /// Use `--no-show-source` to disable. @@ -104,7 +104,7 @@ pub struct CheckCommand { #[arg(short, long)] pub watch: bool, /// Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. - /// Use `--no-fix-only` to disable or `--fix-suggested` to include suggested fixes. + /// Use `--no-fix-only` to disable or `--unsafe-fixes` to include suggested fixes. #[arg(long, overrides_with("no_fix_only"))] fix_only: bool, #[clap(long, overrides_with("fix_only"), hide = true)] @@ -500,7 +500,7 @@ impl CheckCommand { cache_dir: self.cache_dir, fix: resolve_bool_arg(self.fix, self.no_fix), fix_only: resolve_bool_arg(self.fix_only, self.no_fix_only), - fix_suggested: Some(self.fix_suggested), + unsafe_fixes: Some(self.unsafe_fixes), force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude), output_format: self.output_format.or(self.format), show_fixes: resolve_bool_arg(self.show_fixes, self.no_show_fixes), @@ -603,7 +603,7 @@ pub struct CliOverrides { pub cache_dir: Option, pub fix: Option, pub fix_only: Option, - pub fix_suggested: Option, + pub unsafe_fixes: Option, pub force_exclude: Option, pub output_format: Option, pub show_fixes: Option, @@ -629,8 +629,8 @@ impl ConfigurationTransformer for CliOverrides { if let Some(fix_only) = &self.fix_only { config.fix_only = Some(*fix_only); } - if self.fix_suggested.is_some() { - config.fix_suggested = self.fix_suggested; + if self.unsafe_fixes.is_some() { + config.unsafe_fixes = self.unsafe_fixes; } config.lint.rule_selections.push(RuleSelection { select: self.select.clone(), diff --git a/crates/ruff_cli/src/cache.rs b/crates/ruff_cli/src/cache.rs index b48593e52795db..16a2172c21883a 100644 --- a/crates/ruff_cli/src/cache.rs +++ b/crates/ruff_cli/src/cache.rs @@ -409,7 +409,7 @@ mod tests { &settings.linter, Some(&cache), flags::Noqa::Enabled, - flags::FixMode::Generate(flags::SuggestedFixes::Apply), + flags::FixMode::Generate(flags::UnsafeFixes::Enabled), ) .unwrap(); if diagnostics @@ -454,7 +454,7 @@ mod tests { &settings.linter, Some(&cache), flags::Noqa::Enabled, - flags::FixMode::Generate(flags::SuggestedFixes::Apply), + flags::FixMode::Generate(flags::UnsafeFixes::Enabled), ) .unwrap(); } @@ -711,7 +711,7 @@ mod tests { &self.settings.linter, Some(cache), flags::Noqa::Enabled, - flags::FixMode::Generate(flags::SuggestedFixes::Apply), + flags::FixMode::Generate(flags::UnsafeFixes::Enabled), ) } } diff --git a/crates/ruff_cli/src/commands/check.rs b/crates/ruff_cli/src/commands/check.rs index 28012af5ffcb28..c4f35bbb4fb346 100644 --- a/crates/ruff_cli/src/commands/check.rs +++ b/crates/ruff_cli/src/commands/check.rs @@ -284,7 +284,7 @@ mod test { &CliOverrides::default(), flags::Cache::Disabled, flags::Noqa::Disabled, - flags::FixMode::Generate(flags::SuggestedFixes::Apply), + flags::FixMode::Generate(flags::UnsafeFixes::Enabled), ) .unwrap(); let mut output = Vec::new(); diff --git a/crates/ruff_cli/src/diagnostics.rs b/crates/ruff_cli/src/diagnostics.rs index 49d3dad2c32838..89b4ba3344bc02 100644 --- a/crates/ruff_cli/src/diagnostics.rs +++ b/crates/ruff_cli/src/diagnostics.rs @@ -242,7 +242,7 @@ pub(crate) fn lint_path( }, fixed, ) = match fix_mode { - flags::FixMode::Apply(fix_suggested) | flags::FixMode::Diff(fix_suggested) => { + flags::FixMode::Apply(unsafe_fixes) | flags::FixMode::Diff(unsafe_fixes) => { if let Ok(FixerResult { result, transformed, @@ -254,7 +254,7 @@ pub(crate) fn lint_path( settings, &source_kind, source_type, - fix_suggested, + unsafe_fixes, ) { if !fixed.is_empty() { match fix_mode { @@ -421,7 +421,7 @@ pub(crate) fn lint_stdin( }, fixed, ) = match fix_mode { - flags::FixMode::Apply(fix_suggested) | flags::FixMode::Diff(fix_suggested) => { + flags::FixMode::Apply(unsafe_fixes) | flags::FixMode::Diff(unsafe_fixes) => { if let Ok(FixerResult { result, transformed, @@ -433,7 +433,7 @@ pub(crate) fn lint_stdin( &settings.linter, &source_kind, source_type, - fix_suggested, + unsafe_fixes, ) { match fix_mode { flags::FixMode::Apply(_) => { diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index b1d3be072fccb4..9f7df380154828 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -10,7 +10,7 @@ use log::warn; use notify::{recommended_watcher, RecursiveMode, Watcher}; use ruff_linter::logging::{set_up_logging, LogLevel}; -use ruff_linter::settings::flags::{FixMode, SuggestedFixes}; +use ruff_linter::settings::flags::{FixMode, UnsafeFixes}; use ruff_linter::settings::types::SerializationFormat; use ruff_linter::{fs, warn_user, warn_user_once}; use ruff_workspace::Settings; @@ -228,7 +228,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { let Settings { fix, fix_only, - fix_suggested, + unsafe_fixes, output_format, show_fixes, show_source, @@ -243,19 +243,19 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { // - By default, applicable fixes only include [`Applicablility::Automatic`], but if // `--fix--suggested` is set, then [`Applicablility::Suggested`] fixes are included. - let fix_suggested = if fix_suggested { - SuggestedFixes::Apply + let unsafe_fixes = if unsafe_fixes { + UnsafeFixes::Enabled } else { - SuggestedFixes::Disable + UnsafeFixes::Disabled }; let fix_mode = if cli.diff { - FixMode::Diff(fix_suggested) + FixMode::Diff(unsafe_fixes) } else if fix || fix_only { - FixMode::Apply(fix_suggested) + FixMode::Apply(unsafe_fixes) } else { // Always generate all fixes, regardless of [`Applicability`], in `generate` mode - FixMode::Generate(SuggestedFixes::Apply) + FixMode::Generate(UnsafeFixes::Enabled) }; let cache = !cli.no_cache; diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index d96f67603b4730..ad837ab2809367 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -20,7 +20,7 @@ use ruff_linter::message::{ }; use ruff_linter::notify_user; use ruff_linter::registry::{AsRule, Rule}; -use ruff_linter::settings::flags::{self, SuggestedFixes}; +use ruff_linter::settings::flags::{self, UnsafeFixes}; use ruff_linter::settings::types::SerializationFormat; use crate::diagnostics::Diagnostics; @@ -439,11 +439,11 @@ fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap struct FixableStatistics<'a> { automatic: u32, suggested: u32, - apply_suggested: &'a SuggestedFixes, + apply_suggested: &'a UnsafeFixes, } impl<'a> FixableStatistics<'a> { - fn new(diagnostics: &Diagnostics, apply_suggested: &'a SuggestedFixes) -> Self { + fn new(diagnostics: &Diagnostics, apply_suggested: &'a UnsafeFixes) -> Self { let mut automatic = 0; let mut suggested = 0; @@ -466,8 +466,8 @@ impl<'a> FixableStatistics<'a> { fn fixes_are_applicable(&self) -> bool { match self.apply_suggested { - SuggestedFixes::Apply => self.automatic > 0 || self.suggested > 0, - SuggestedFixes::Disable => self.automatic > 0, + UnsafeFixes::Enabled => self.automatic > 0 || self.suggested > 0, + UnsafeFixes::Disabled => self.automatic > 0, } } @@ -484,7 +484,7 @@ impl<'a> FixableStatistics<'a> { if self.automatic > 0 && self.suggested > 0 { format!( "{automatic_prefix} {} fixable with the --fix option.\n\ - {suggested_prefix} {} potentially fixable with the --fix-suggested option.", + {suggested_prefix} {} potentially fixable with the --unsafe-fixes option.", self.automatic, self.suggested ) } else if self.automatic > 0 { @@ -494,7 +494,7 @@ impl<'a> FixableStatistics<'a> { ) } else if self.suggested > 0 { format!( - "{suggested_prefix} {} potentially fixable with the --fix-suggested option.", + "{suggested_prefix} {} potentially fixable with the --unsafe-fixes option.", self.suggested ) } else { diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index b0945bc537250e..b81028a23f60c6 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -800,7 +800,7 @@ fn check_input_from_argfile() -> Result<()> { #[test] fn displays_fix_applicability_levels() { - // `--fix` should only apply automatic fixes, but should tell the user about `--fix-suggested` if + // `--fix` should only apply safe fixes, but should tell the user about `--unsafe-fixes` if // there are remaining fixes. assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -820,14 +820,14 @@ fn displays_fix_applicability_levels() { -:2:7: UP034 [*] Avoid extraneous parentheses Found 2 errors. [*] 1 fixable with the --fix option. - [**] 1 potentially fixable with the --fix-suggested option. + [**] 1 potentially fixable with the --unsafe-fixes option. ----- stderr ----- "###); } #[test] -fn displays_remaining_suggested_fixes() { +fn displays_remaining_unsafe_fixes() { assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) .args(["-", "--output-format", "text", "--no-cache", "--isolated", "--select", "F601"]) .pass_stdin("x = {'a': 1, 'a': 1}\n"), @@ -837,15 +837,15 @@ fn displays_remaining_suggested_fixes() { ----- stdout ----- -:1:14: F601 [**] Dictionary key literal `'a'` repeated Found 1 error. - [**] 1 potentially fixable with the --fix-suggested option. + [**] 1 potentially fixable with the --unsafe-fixes option. ----- stderr ----- "###); } #[test] -fn fix_applies_automatic_fixes_only() { - // `--fix` should only apply automatic fixes. Since we're runnnig in `stdin` mode, output shouldn't +fn fix_applies_safe_fixes_only() { + // `--fix` should only apply safe fixes. Since we're runnnig in `stdin` mode, output shouldn't // be printed. assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) @@ -853,7 +853,8 @@ fn fix_applies_automatic_fixes_only() { "-", "--output-format", "text", - "--isolated","--no-cache", + "--isolated", + "--no-cache", "--select", "F601,UP034", "--fix", @@ -871,47 +872,46 @@ fn fix_applies_automatic_fixes_only() { } #[test] -fn fix_applies_automatic_and_suggested_fixes_with_fix_suggested() { +fn fix_applies_safe_and_unsafe_fixes_with_unsafe_fixes() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ "-", "--output-format", "text", - "--isolated","--no-cache", + "--isolated", + "--no-cache", "--select", "F601,UP034", "--fix", - "--fix-suggested", + "--unsafe-fixes", ]) .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), @r###" - success: false - exit_code: 1 + success: true + exit_code: 0 ----- stdout ----- - -:1:14: F601 [**] Dictionary key literal `'a'` repeated - -:2:7: UP034 [*] Avoid extraneous parentheses - Found 2 errors. - [*] 1 fixable with the --fix option. - [**] 1 potentially fixable with the --fix-suggested option. + x = {'a': 1} + print('foo') ----- stderr ----- "###); } #[test] -fn diff_shows_automatic_and_suggested_fixes_with_fix_suggested() { +fn diff_shows_safe_and_unsafe_fixes_with_unsafe_fixes() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ "-", "--output-format", "text", - "--isolated","--no-cache", + "--isolated", + "--no-cache", "--select", "F601,UP034", "--diff", - "--fix-suggested", + "--unsafe-fixes", ]) .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), @r###" @@ -931,14 +931,15 @@ fn diff_shows_automatic_and_suggested_fixes_with_fix_suggested() { } #[test] -fn diff_shows_automatic_fixes_only() { +fn diff_shows_safe_fixes_only() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ "-", "--output-format", "text", - "--isolated","--no-cache", + "--isolated", + "--no-cache", "--select", "F601,UP034", "--diff", @@ -960,18 +961,19 @@ fn diff_shows_automatic_fixes_only() { } #[test] -fn fix_only_applies_automatic_and_suggested_fixes_with_fix_suggested() { +fn fix_only_applies_safe_and_unsafe_fixes_with_unsafe_fixes() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ "-", "--output-format", "text", - "--isolated","--no-cache", + "--isolated", + "--no-cache", "--select", "F601,UP034", "--fix-only", - "--fix-suggested", + "--unsafe-fixes", ]) .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), @r###" @@ -986,14 +988,15 @@ fn fix_only_applies_automatic_and_suggested_fixes_with_fix_suggested() { } #[test] -fn fix_only_applies_automatic_fixes_only() { +fn fix_only_applies_safe_fixes_only() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ "-", "--output-format", "text", - "--isolated","--no-cache", + "--isolated", + "--no-cache", "--select", "F601,UP034", "--fix-only", diff --git a/crates/ruff_linter/src/fix/mod.rs b/crates/ruff_linter/src/fix/mod.rs index 49e9ce90c37786..bc449e4948dbf8 100644 --- a/crates/ruff_linter/src/fix/mod.rs +++ b/crates/ruff_linter/src/fix/mod.rs @@ -9,7 +9,7 @@ use ruff_source_file::Locator; use crate::linter::FixTable; use crate::registry::{AsRule, Rule}; -use crate::settings::flags::SuggestedFixes; +use crate::settings::flags::UnsafeFixes; pub(crate) mod codemods; pub(crate) mod edits; @@ -28,9 +28,9 @@ pub(crate) struct FixResult { pub(crate) fn fix_file( diagnostics: &[Diagnostic], locator: &Locator, - fix_suggested: SuggestedFixes, + unsafe_fixes: UnsafeFixes, ) -> Option { - let required_applicability = if fix_suggested.is_apply() { + let required_applicability = if unsafe_fixes.is_enabled() { Applicability::Suggested } else { Applicability::Automatic diff --git a/crates/ruff_linter/src/linter.rs b/crates/ruff_linter/src/linter.rs index 66ad1fb0bd4c04..6543f5123ce9f3 100644 --- a/crates/ruff_linter/src/linter.rs +++ b/crates/ruff_linter/src/linter.rs @@ -423,7 +423,7 @@ pub fn lint_fix<'a>( settings: &LinterSettings, source_kind: &'a SourceKind, source_type: PySourceType, - fix_suggested: flags::SuggestedFixes, + unsafe_fixes: flags::UnsafeFixes, ) -> Result> { let mut transformed = Cow::Borrowed(source_kind); @@ -496,7 +496,7 @@ pub fn lint_fix<'a>( code: fixed_contents, fixes: applied, source_map, - }) = fix_file(&result.data.0, &locator, fix_suggested) + }) = fix_file(&result.data.0, &locator, unsafe_fixes) { if iterations < MAX_ITERATIONS { // Count the number of fixed errors. diff --git a/crates/ruff_linter/src/settings/flags.rs b/crates/ruff_linter/src/settings/flags.rs index 244db27d9d4635..b6d24441e04409 100644 --- a/crates/ruff_linter/src/settings/flags.rs +++ b/crates/ruff_linter/src/settings/flags.rs @@ -1,12 +1,12 @@ #[derive(Debug, Copy, Clone, Hash, is_macro::Is)] pub enum FixMode { - Generate(SuggestedFixes), - Apply(SuggestedFixes), - Diff(SuggestedFixes), + Generate(UnsafeFixes), + Apply(UnsafeFixes), + Diff(UnsafeFixes), } impl FixMode { - pub fn suggested_fixes(&self) -> &SuggestedFixes { + pub fn suggested_fixes(&self) -> &UnsafeFixes { match self { FixMode::Generate(suggested) => suggested, FixMode::Apply(suggested) => suggested, @@ -16,9 +16,9 @@ impl FixMode { } #[derive(Debug, Copy, Clone, Hash, is_macro::Is)] -pub enum SuggestedFixes { - Apply, - Disable, +pub enum UnsafeFixes { + Enabled, + Disabled, } #[derive(Debug, Copy, Clone, Hash, result_like::BoolLike)] diff --git a/crates/ruff_linter/src/test.rs b/crates/ruff_linter/src/test.rs index 208c0ec01835ea..e12dd2a137cd5f 100644 --- a/crates/ruff_linter/src/test.rs +++ b/crates/ruff_linter/src/test.rs @@ -158,7 +158,7 @@ pub(crate) fn test_contents<'a>( }) = fix_file( &diagnostics, &Locator::new(transformed.source_code()), - flags::SuggestedFixes::Apply, + flags::UnsafeFixes::Enabled, ) { if iterations < max_iterations() { iterations += 1; diff --git a/crates/ruff_workspace/src/configuration.rs b/crates/ruff_workspace/src/configuration.rs index ac3971c00cccb6..47734ff415efb5 100644 --- a/crates/ruff_workspace/src/configuration.rs +++ b/crates/ruff_workspace/src/configuration.rs @@ -63,7 +63,7 @@ pub struct Configuration { pub cache_dir: Option, pub extend: Option, pub fix: Option, - pub fix_suggested: Option, + pub unsafe_fixes: Option, pub fix_only: Option, pub output_format: Option, pub preview: Option, @@ -137,7 +137,7 @@ impl Configuration { .clone() .unwrap_or_else(|| cache_dir(project_root)), fix: self.fix.unwrap_or(false), - fix_suggested: self.fix_suggested.unwrap_or(false), + unsafe_fixes: self.unsafe_fixes.unwrap_or(false), fix_only: self.fix_only.unwrap_or(false), output_format: self.output_format.unwrap_or_default(), show_fixes: self.show_fixes.unwrap_or(false), @@ -367,7 +367,7 @@ impl Configuration { }), fix: options.fix, fix_only: options.fix_only, - fix_suggested: options.fix_suggested, + unsafe_fixes: options.unsafe_fixes, output_format: options.output_format.or_else(|| { options .format @@ -421,7 +421,7 @@ impl Configuration { include: self.include.or(config.include), fix: self.fix.or(config.fix), fix_only: self.fix_only.or(config.fix_only), - fix_suggested: self.fix_suggested.or(config.fix_suggested), + unsafe_fixes: self.unsafe_fixes.or(config.unsafe_fixes), output_format: self.output_format.or(config.output_format), force_exclude: self.force_exclude.or(config.force_exclude), line_length: self.line_length.or(config.line_length), diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index 23ff6b466c47b6..c9e0037a33b8e0 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -89,7 +89,7 @@ pub struct Options { /// Enable fix behavior by-default when running `ruff` (overridden /// by the `--fix` and `--no-fix` command-line flags). - /// Only includes automatic fixes unless `--fix-suggested` is provided. + /// Only includes automatic fixes unless `--unsafe-fixes` is provided. #[option(default = "false", value_type = "bool", example = "fix = true")] pub fix: Option, @@ -97,9 +97,9 @@ pub struct Options { #[option( default = "false", value_type = "bool", - example = "fix-suggested = true" + example = "unsafe-fixes = true" )] - pub fix_suggested: Option, + pub unsafe_fixes: Option, /// Like `fix`, but disables reporting on leftover violation. Implies `fix`. #[option(default = "false", value_type = "bool", example = "fix-only = true")] diff --git a/crates/ruff_workspace/src/settings.rs b/crates/ruff_workspace/src/settings.rs index 80a7538b0021c6..12319c7cc8177e 100644 --- a/crates/ruff_workspace/src/settings.rs +++ b/crates/ruff_workspace/src/settings.rs @@ -17,7 +17,7 @@ pub struct Settings { #[cache_key(ignore)] pub fix: bool, #[cache_key(ignore)] - pub fix_suggested: bool, + pub unsafe_fixes: bool, #[cache_key(ignore)] pub fix_only: bool, #[cache_key(ignore)] @@ -38,7 +38,7 @@ impl Default for Settings { Self { cache_dir: cache_dir(project_root), fix: false, - fix_suggested: false, + unsafe_fixes: false, fix_only: false, output_format: SerializationFormat::default(), show_fixes: false, diff --git a/docs/configuration.md b/docs/configuration.md index daab96b9a183d6..bdfa0d7b9aa682 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -193,9 +193,9 @@ Arguments: Options: --fix - Apply automatic fixes to resolve lint violations. Use `--no-fix` to disable or `--fix-suggested` to include suggested fixes - --fix-suggested - Apply automatic and suggested fixes to resolve lint violations + Apply fixes to resolve lint violations. Use `--no-fix` to disable or `--unsafe-fixes` to include suggested fixes + --unsafe-fixes + Apply unsafe fixes to resolve lint violations --show-source Show violations with source code. Use `--no-show-source` to disable --show-fixes @@ -205,7 +205,7 @@ Options: -w, --watch Run in watch mode by re-running whenever files change --fix-only - Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. Use `--no-fix-only` to disable or `--fix-suggested` to include suggested fixes + Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. Use `--no-fix-only` to disable or `--unsafe-fixes` to include suggested fixes --ignore-noqa Ignore any `# noqa` comments --output-format diff --git a/ruff.schema.json b/ruff.schema.json index c657da23afc141..5befc9f6c5e1a0 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -128,7 +128,7 @@ } }, "fix": { - "description": "Enable fix behavior by-default when running `ruff` (overridden by the `--fix` and `--no-fix` command-line flags). Only includes automatic fixes unless `--fix-suggested` is provided.", + "description": "Enable fix behavior by-default when running `ruff` (overridden by the `--fix` and `--no-fix` command-line flags). Only includes automatic fixes unless `--unsafe-fixes` is provided.", "type": [ "boolean", "null" @@ -141,13 +141,6 @@ "null" ] }, - "fix-suggested": { - "description": "Enable application of suggested fixes.", - "type": [ - "boolean", - "null" - ] - }, "fixable": { "description": "A list of rule codes or prefixes to consider fixable. By default, all rules are considered fixable.", "type": [ @@ -644,6 +637,13 @@ "items": { "$ref": "#/definitions/RuleSelector" } + }, + "unsafe-fixes": { + "description": "Enable application of suggested fixes.", + "type": [ + "boolean", + "null" + ] } }, "additionalProperties": false, From d3f0558b0000f34c078d04f7ec5b0b68d1f63c6e Mon Sep 17 00:00:00 2001 From: Zanie Date: Wed, 4 Oct 2023 13:24:40 -0500 Subject: [PATCH 15/28] Improve messaging around unsafe fixes --- crates/ruff_cli/src/args.rs | 2 +- crates/ruff_cli/src/lib.rs | 5 +- crates/ruff_cli/src/printer.rs | 119 ++++++++++++---------- crates/ruff_cli/tests/integration_test.rs | 9 +- crates/ruff_diagnostics/src/fix.rs | 7 +- crates/ruff_linter/src/message/grouped.rs | 6 +- crates/ruff_linter/src/message/text.rs | 39 +++++-- crates/ruff_linter/src/settings/flags.rs | 2 +- crates/ruff_linter/src/test.rs | 2 + docs/configuration.md | 2 +- 10 files changed, 121 insertions(+), 72 deletions(-) diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff_cli/src/args.rs index 51fe9bf2e27c48..e75cf47cf3bb90 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff_cli/src/args.rs @@ -80,7 +80,7 @@ pub struct CheckCommand { /// Use `--no-fix` to disable or `--unsafe-fixes` to include suggested fixes. #[arg(long, overrides_with("no_fix"))] fix: bool, - /// Apply unsafe fixes to resolve lint violations. + /// Include fixes that may not retain the original intent of the code. #[arg(long)] unsafe_fixes: bool, #[clap(long, overrides_with_all(["fix"]), hide = true)] diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index 9f7df380154828..24d74ff57a1f87 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -241,7 +241,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { // print them to stdout, if we're reading from stdin). // - If `--diff` or `--fix-only` are set, don't print any violations (only applicable fixes) // - By default, applicable fixes only include [`Applicablility::Automatic`], but if - // `--fix--suggested` is set, then [`Applicablility::Suggested`] fixes are included. + // `--unsafe-fixes` is set, then [`Applicablility::Suggested`] fixes are included. let unsafe_fixes = if unsafe_fixes { UnsafeFixes::Enabled @@ -270,6 +270,9 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { if show_source { printer_flags |= PrinterFlags::SHOW_SOURCE; } + if unsafe_fixes.is_enabled() { + printer_flags |= PrinterFlags::SHOW_UNSAFE_FIXES; + } if cli.ecosystem_ci { warn_user!( "The formatting of fixes emitted by this option is a work-in-progress, subject to \ diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index ad837ab2809367..ca2880ffa38ba8 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -20,7 +20,7 @@ use ruff_linter::message::{ }; use ruff_linter::notify_user; use ruff_linter::registry::{AsRule, Rule}; -use ruff_linter::settings::flags::{self, UnsafeFixes}; +use ruff_linter::settings::flags::{self}; use ruff_linter::settings::types::SerializationFormat; use crate::diagnostics::Diagnostics; @@ -36,6 +36,8 @@ bitflags! { const SHOW_FIX_SUMMARY = 0b0000_0100; /// Whether to show a diff of each fixed violation when emitting diagnostics. const SHOW_FIX_DIFF = 0b0000_1000; + /// Whether to include unsafe fixes when emitting diagnostics. + const SHOW_UNSAFE_FIXES = 0b0001_0000; } } @@ -119,10 +121,12 @@ impl Printer { writeln!(writer, "Found {remaining} error{s}.")?; } - let fixables = FixableStatistics::new(diagnostics, self.fix_mode.suggested_fixes()); - - if !fixables.is_empty() { - writeln!(writer, "{}", fixables.violation_string())?; + let fixables = FixableStatistics::new( + diagnostics, + self.flags.intersects(Flags::SHOW_UNSAFE_FIXES), + ); + if let Some(violation_message) = fixables.violation_string() { + writeln!(writer, "{violation_message}")?; } } else { let fixed = diagnostics @@ -170,7 +174,8 @@ impl Printer { } let context = EmitterContext::new(&diagnostics.notebook_indexes); - let fixables = FixableStatistics::new(diagnostics, self.fix_mode.suggested_fixes()); + let fixables = + FixableStatistics::new(diagnostics, self.flags.intersects(Flags::SHOW_UNSAFE_FIXES)); match self.format { SerializationFormat::Json => { @@ -187,6 +192,7 @@ impl Printer { .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) .with_show_fix_diff(self.flags.intersects(Flags::SHOW_FIX_DIFF)) .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) + .with_show_unsafe_fixes(self.flags.intersects(Flags::SHOW_UNSAFE_FIXES)) .emit(writer, &diagnostics.messages, &context)?; if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) { @@ -352,7 +358,8 @@ impl Printer { ); } - let fixables = FixableStatistics::new(diagnostics, self.fix_mode.suggested_fixes()); + let fixables = + FixableStatistics::new(diagnostics, self.flags.intersects(Flags::SHOW_UNSAFE_FIXES)); if !diagnostics.messages.is_empty() { if self.log_level >= LogLevel::Default { @@ -363,6 +370,7 @@ impl Printer { TextEmitter::default() .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) + .with_show_unsafe_fixes(self.flags.intersects(Flags::SHOW_UNSAFE_FIXES)) .emit(writer, &diagnostics.messages, &context)?; } writer.flush()?; @@ -391,7 +399,7 @@ fn show_fix_status(fix_mode: flags::FixMode, fixables: &FixableStatistics) -> bo // this pass! (We're occasionally unable to determine whether a specific // violation is fixable without trying to fix it, so if fix is not // enabled, we may inadvertently indicate that a rule is fixable.) - (!fix_mode.is_apply()) && fixables.fixes_are_applicable() + (!fix_mode.is_apply()) && fixables.any_fixes_applicable() } fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap) -> Result<()> { @@ -436,69 +444,78 @@ fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap } /// Contains the number of [`Applicability::Automatic`] and [`Applicability::Suggested`] fixes -struct FixableStatistics<'a> { - automatic: u32, - suggested: u32, - apply_suggested: &'a UnsafeFixes, +struct FixableStatistics { + safe_count: u32, + unsafe_count: u32, + show_unsafe_fixes: bool, } -impl<'a> FixableStatistics<'a> { - fn new(diagnostics: &Diagnostics, apply_suggested: &'a UnsafeFixes) -> Self { - let mut automatic = 0; - let mut suggested = 0; +impl FixableStatistics { + fn new(diagnostics: &Diagnostics, show_unsafe_fixes: bool) -> Self { + let mut safe_count = 0; + let mut unsafe_count = 0; for message in &diagnostics.messages { if let Some(fix) = &message.fix { if fix.applicability() == Applicability::Suggested { - suggested += 1; + unsafe_count += 1; } else if fix.applicability() == Applicability::Automatic { - automatic += 1; + safe_count += 1; } } } Self { - automatic, - suggested, - apply_suggested, + safe_count, + unsafe_count, + show_unsafe_fixes, } } - fn fixes_are_applicable(&self) -> bool { - match self.apply_suggested { - UnsafeFixes::Enabled => self.automatic > 0 || self.suggested > 0, - UnsafeFixes::Disabled => self.automatic > 0, + fn any_fixes_applicable(&self) -> bool { + if self.show_unsafe_fixes { + self.safe_count > 0 || self.unsafe_count > 0 + } else { + self.safe_count > 0 } } - /// Returns [`true`] if there aren't any fixes to be displayed - fn is_empty(&self) -> bool { - self.automatic == 0 && self.suggested == 0 - } - /// Build the displayed fix status message depending on the types of the remaining fixes. - fn violation_string(&self) -> String { - let automatic_prefix = format!("[{}]", Applicability::Automatic.symbol().cyan()); - let suggested_prefix = format!("[{}]", Applicability::Suggested.symbol().cyan()); - - if self.automatic > 0 && self.suggested > 0 { - format!( - "{automatic_prefix} {} fixable with the --fix option.\n\ - {suggested_prefix} {} potentially fixable with the --unsafe-fixes option.", - self.automatic, self.suggested - ) - } else if self.automatic > 0 { - format!( - "{automatic_prefix} {} fixable with the --fix option.", - self.automatic, - ) - } else if self.suggested > 0 { - format!( - "{suggested_prefix} {} potentially fixable with the --unsafe-fixes option.", - self.suggested - ) + fn violation_string(&self) -> Option { + let fix_prefix = format!("[{}]", Applicability::Automatic.symbol().cyan()); + + if self.show_unsafe_fixes { + let fixable_count = self.safe_count + self.unsafe_count; + if fixable_count > 0 { + Some(format!( + "{fix_prefix} {fixable_count} fixable with the --fix option.", + )) + } else { + None + } } else { - String::new() + if self.safe_count > 0 && self.unsafe_count > 0 { + let es = if self.unsafe_count == 1 { "" } else { "es" }; + Some( + format!( + "{fix_prefix} {} fixable with the --fix option ({} hidden fix{es} can be enabled with the --unsafe-fixes option).", + self.safe_count, self.unsafe_count + ) + ) + } else if self.safe_count > 0 { + Some(format!( + "{fix_prefix} {} fixable with the --fix option.", + self.safe_count, + )) + } else if self.unsafe_count > 0 { + let es = if self.unsafe_count == 1 { "" } else { "es" }; + Some(format!( + "{} hidden fix{es} can be enabled with the --unsafe-fixes option.", + self.unsafe_count + )) + } else { + None + } } } } diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index b81028a23f60c6..e16b9bee37b022 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -816,11 +816,10 @@ fn displays_fix_applicability_levels() { success: false exit_code: 1 ----- stdout ----- - -:1:14: F601 [**] Dictionary key literal `'a'` repeated + -:1:14: F601 Dictionary key literal `'a'` repeated -:2:7: UP034 [*] Avoid extraneous parentheses Found 2 errors. - [*] 1 fixable with the --fix option. - [**] 1 potentially fixable with the --unsafe-fixes option. + [*] 1 fixable with the --fix option (1 hidden fix can be enabled with the --unsafe-fixes option). ----- stderr ----- "###); @@ -835,9 +834,9 @@ fn displays_remaining_unsafe_fixes() { success: false exit_code: 1 ----- stdout ----- - -:1:14: F601 [**] Dictionary key literal `'a'` repeated + -:1:14: F601 Dictionary key literal `'a'` repeated Found 1 error. - [**] 1 potentially fixable with the --unsafe-fixes option. + 1 hidden fix can be enabled with the --unsafe-fixes option. ----- stderr ----- "###); diff --git a/crates/ruff_diagnostics/src/fix.rs b/crates/ruff_diagnostics/src/fix.rs index 7daa2fbb913eb1..66adc5b8c75788 100644 --- a/crates/ruff_diagnostics/src/fix.rs +++ b/crates/ruff_diagnostics/src/fix.rs @@ -30,11 +30,8 @@ pub enum Applicability { impl Applicability { pub fn symbol(&self) -> &'static str { - match self { - Self::Automatic => "*", - Self::Suggested => "**", - _ => "*", - } + // Uses a constant for now for all kinds but we can match self and use different symbols + "*" } } diff --git a/crates/ruff_linter/src/message/grouped.rs b/crates/ruff_linter/src/message/grouped.rs index 41e3f52cd118f5..f5c2d5b48a3867 100644 --- a/crates/ruff_linter/src/message/grouped.rs +++ b/crates/ruff_linter/src/message/grouped.rs @@ -18,6 +18,7 @@ use crate::message::{ pub struct GroupedEmitter { show_fix_status: bool, show_source: bool, + show_unsafe_fixes: bool, } impl GroupedEmitter { @@ -68,6 +69,7 @@ impl Emitter for GroupedEmitter { notebook_index: context.notebook_index(message.filename()), message, show_fix_status: self.show_fix_status, + show_unsafe_fixes: self.show_unsafe_fixes, show_source: self.show_source, row_length, column_length, @@ -89,6 +91,7 @@ impl Emitter for GroupedEmitter { struct DisplayGroupedMessage<'a> { message: MessageWithLocation<'a>, show_fix_status: bool, + show_unsafe_fixes: bool, show_source: bool, row_length: NonZeroUsize, column_length: NonZeroUsize, @@ -138,7 +141,8 @@ impl Display for DisplayGroupedMessage<'_> { ), code_and_body = RuleCodeAndBody { message, - show_fix_status: self.show_fix_status + show_fix_status: self.show_fix_status, + show_unsafe_fixes: self.show_unsafe_fixes }, )?; diff --git a/crates/ruff_linter/src/message/text.rs b/crates/ruff_linter/src/message/text.rs index b0a50d684f5946..b1e5a31f1a8e71 100644 --- a/crates/ruff_linter/src/message/text.rs +++ b/crates/ruff_linter/src/message/text.rs @@ -22,11 +22,13 @@ bitflags! { #[derive(Default)] struct EmitterFlags: u8 { /// Whether to show the fix status of a diagnostic. - const SHOW_FIX_STATUS = 0b0000_0001; + const SHOW_FIX_STATUS = 0b0000_0001; /// Whether to show the diff of a fix, for diagnostics that have a fix. - const SHOW_FIX_DIFF = 0b0000_0010; + const SHOW_FIX_DIFF = 0b0000_0010; /// Whether to show the source code of a diagnostic. - const SHOW_SOURCE = 0b0000_0100; + const SHOW_SOURCE = 0b0000_0100; + /// Whether to show unsafe fixes. + const SHOW_UNSAFE_FIXES = 0b0000_1000; } } @@ -54,6 +56,13 @@ impl TextEmitter { self.flags.set(EmitterFlags::SHOW_SOURCE, show_source); self } + + #[must_use] + pub fn with_show_unsafe_fixes(mut self, show_unsafe_fixes: bool) -> Self { + self.flags + .set(EmitterFlags::SHOW_UNSAFE_FIXES, show_unsafe_fixes); + self + } } impl Emitter for TextEmitter { @@ -106,7 +115,8 @@ impl Emitter for TextEmitter { sep = ":".cyan(), code_and_body = RuleCodeAndBody { message, - show_fix_status: self.flags.intersects(EmitterFlags::SHOW_FIX_STATUS) + show_fix_status: self.flags.intersects(EmitterFlags::SHOW_FIX_STATUS), + show_unsafe_fixes: self.flags.intersects(EmitterFlags::SHOW_UNSAFE_FIXES) } )?; @@ -135,6 +145,7 @@ impl Emitter for TextEmitter { pub(super) struct RuleCodeAndBody<'a> { pub(crate) message: &'a Message, pub(crate) show_fix_status: bool, + pub(crate) show_unsafe_fixes: bool, } impl Display for RuleCodeAndBody<'_> { @@ -142,8 +153,13 @@ impl Display for RuleCodeAndBody<'_> { let kind = &self.message.kind; if self.show_fix_status { if let Some(fix) = self.message.fix.as_ref() { - // Do not display an indicator for manual fixes - if fix.applicability() > Applicability::Manual { + let required_applicability = if self.show_unsafe_fixes { + Applicability::Suggested + } else { + Applicability::Automatic + }; + // Do not display an indicator for unapplicable fixes + if fix.applies(required_applicability) { let indicator = fix.applicability().symbol(); return write!( @@ -366,4 +382,15 @@ mod tests { assert_snapshot!(content); } + + #[test] + fn fix_status_unsafe() { + let mut emitter = TextEmitter::default() + .with_show_fix_status(true) + .with_show_source(true) + .with_show_unsafe_fixes(true); + let content = capture_emitter_output(&mut emitter, &create_messages()); + + assert_snapshot!(content); + } } diff --git a/crates/ruff_linter/src/settings/flags.rs b/crates/ruff_linter/src/settings/flags.rs index b6d24441e04409..a41b9226314bd8 100644 --- a/crates/ruff_linter/src/settings/flags.rs +++ b/crates/ruff_linter/src/settings/flags.rs @@ -6,7 +6,7 @@ pub enum FixMode { } impl FixMode { - pub fn suggested_fixes(&self) -> &UnsafeFixes { + pub fn unsafe_fixes(&self) -> &UnsafeFixes { match self { FixMode::Generate(suggested) => suggested, FixMode::Apply(suggested) => suggested, diff --git a/crates/ruff_linter/src/test.rs b/crates/ruff_linter/src/test.rs index e12dd2a137cd5f..c3c5793db0f14a 100644 --- a/crates/ruff_linter/src/test.rs +++ b/crates/ruff_linter/src/test.rs @@ -297,6 +297,7 @@ pub(crate) fn print_jupyter_messages( .with_show_fix_status(true) .with_show_fix_diff(true) .with_show_source(true) + .with_show_unsafe_fixes(true) .emit( &mut output, messages, @@ -317,6 +318,7 @@ pub(crate) fn print_messages(messages: &[Message]) -> String { .with_show_fix_status(true) .with_show_fix_diff(true) .with_show_source(true) + .with_show_unsafe_fixes(true) .emit( &mut output, messages, diff --git a/docs/configuration.md b/docs/configuration.md index bdfa0d7b9aa682..3ed52745dd87e2 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -195,7 +195,7 @@ Options: --fix Apply fixes to resolve lint violations. Use `--no-fix` to disable or `--unsafe-fixes` to include suggested fixes --unsafe-fixes - Apply unsafe fixes to resolve lint violations + Include fixes that may not retain the original intent of the code --show-source Show violations with source code. Use `--no-show-source` to disable --show-fixes From d35d68d0c8f5b95b6bc39e4102ec5d0fdd14b5ba Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 14:40:52 -0500 Subject: [PATCH 16/28] Refactor `UnsafeFixes` out of `FixMode` --- crates/ruff_cli/src/args.rs | 14 ++- crates/ruff_cli/src/cache.rs | 10 +- crates/ruff_cli/src/commands/check.rs | 18 +++- crates/ruff_cli/src/diagnostics.rs | 26 ++--- crates/ruff_cli/src/lib.rs | 19 ++-- crates/ruff_diagnostics/src/fix.rs | 2 +- crates/ruff_linter/src/fix/mod.rs | 2 +- crates/ruff_linter/src/linter.rs | 3 +- ...__message__grouped__tests__fix_status.snap | 4 +- ...ter__message__text__tests__fix_status.snap | 4 +- ...__flake8_annotations__tests__defaults.snap | 4 +- ..._annotations__tests__mypy_init_return.snap | 6 +- ...otations__tests__simple_magic_methods.snap | 28 ++--- ...__flake8_bugbear__tests__B007_B007.py.snap | 8 +- ...ke8_bugbear__tests__B009_B009_B010.py.snap | 34 +++--- ...ke8_bugbear__tests__B010_B009_B010.py.snap | 12 +-- ...__flake8_bugbear__tests__B011_B011.py.snap | 4 +- ...8_comprehensions__tests__C400_C400.py.snap | 4 +- ...8_comprehensions__tests__C401_C401.py.snap | 26 ++--- ...8_comprehensions__tests__C402_C402.py.snap | 26 ++--- ...8_comprehensions__tests__C403_C403.py.snap | 18 ++-- ...8_comprehensions__tests__C404_C404.py.snap | 20 ++-- ...8_comprehensions__tests__C405_C405.py.snap | 40 +++---- ...8_comprehensions__tests__C406_C406.py.snap | 8 +- ...8_comprehensions__tests__C408_C408.py.snap | 32 +++--- ...low_dict_calls_with_keyword_arguments.snap | 10 +- ...8_comprehensions__tests__C409_C409.py.snap | 10 +- ...8_comprehensions__tests__C410_C410.py.snap | 8 +- ...8_comprehensions__tests__C411_C411.py.snap | 2 +- ...8_comprehensions__tests__C413_C413.py.snap | 20 ++-- ...8_comprehensions__tests__C414_C414.py.snap | 48 ++++----- ...8_comprehensions__tests__C416_C416.py.snap | 14 +-- ...8_comprehensions__tests__C417_C417.py.snap | 36 +++---- ...8_comprehensions__tests__C418_C418.py.snap | 8 +- ...8_comprehensions__tests__C419_C419.py.snap | 14 +-- ...__rules__flake8_errmsg__tests__custom.snap | 14 +-- ...rules__flake8_errmsg__tests__defaults.snap | 18 ++-- ...8_import_conventions__tests__defaults.snap | 26 ++--- ...ke8_import_conventions__tests__tricky.snap | 2 +- ...ake8_logging__tests__LOG001_LOG001.py.snap | 4 +- ...ake8_logging__tests__LOG002_LOG002.py.snap | 8 +- ...ake8_logging__tests__LOG009_LOG009.py.snap | 4 +- ...__flake8_pie__tests__PIE794_PIE794.py.snap | 8 +- ...__flake8_pie__tests__PIE810_PIE810.py.snap | 10 +- ..._flake8_pyi__tests__PYI010_PYI010.pyi.snap | 6 +- ..._flake8_pyi__tests__PYI011_PYI011.pyi.snap | 36 +++---- ..._flake8_pyi__tests__PYI014_PYI014.pyi.snap | 26 ++--- ..._flake8_pyi__tests__PYI015_PYI015.pyi.snap | 22 ++-- ...__flake8_pyi__tests__PYI025_PYI025.py.snap | 4 +- ..._flake8_pyi__tests__PYI025_PYI025.pyi.snap | 10 +- ..._flake8_pyi__tests__PYI026_PYI026.pyi.snap | 10 +- ..._flake8_pyi__tests__PYI053_PYI053.pyi.snap | 10 +- ..._flake8_pyi__tests__PYI054_PYI054.pyi.snap | 16 +-- ...e8_pyi__tests__py38_PYI026_PYI026.pyi.snap | 10 +- ...es__flake8_pytest_style__tests__PT003.snap | 16 +-- ...flake8_pytest_style__tests__PT006_csv.snap | 4 +- ...e8_pytest_style__tests__PT006_default.snap | 20 ++-- ...lake8_pytest_style__tests__PT006_list.snap | 16 +-- ...es__flake8_pytest_style__tests__PT009.snap | 58 +++++----- ...es__flake8_pytest_style__tests__PT014.snap | 16 +-- ...es__flake8_pytest_style__tests__PT018.snap | 30 +++--- ...es__flake8_pytest_style__tests__PT026.snap | 4 +- ...__flake8_pytest_style__tests__PT027_0.snap | 16 +-- ...__flake8_pytest_style__tests__PT027_1.snap | 2 +- ...lake8_return__tests__RET503_RET503.py.snap | 40 +++---- ...lake8_return__tests__RET504_RET504.py.snap | 22 ++-- ...ke8_simplify__tests__SIM101_SIM101.py.snap | 14 +-- ...ke8_simplify__tests__SIM102_SIM102.py.snap | 24 ++--- ...ke8_simplify__tests__SIM103_SIM103.py.snap | 8 +- ...8_simplify__tests__SIM105_SIM105_0.py.snap | 18 ++-- ...8_simplify__tests__SIM105_SIM105_1.py.snap | 2 +- ...8_simplify__tests__SIM105_SIM105_2.py.snap | 2 +- ...8_simplify__tests__SIM105_SIM105_4.py.snap | 2 +- ...ke8_simplify__tests__SIM108_SIM108.py.snap | 6 +- ...ke8_simplify__tests__SIM109_SIM109.py.snap | 8 +- ...ke8_simplify__tests__SIM110_SIM110.py.snap | 22 ++-- ...ke8_simplify__tests__SIM110_SIM111.py.snap | 24 ++--- ...ke8_simplify__tests__SIM112_SIM112.py.snap | 6 +- ...ke8_simplify__tests__SIM117_SIM117.py.snap | 20 ++-- ...ke8_simplify__tests__SIM118_SIM118.py.snap | 38 +++---- ...ke8_simplify__tests__SIM202_SIM202.py.snap | 6 +- ...ke8_simplify__tests__SIM208_SIM208.py.snap | 10 +- ...ke8_simplify__tests__SIM210_SIM210.py.snap | 8 +- ...ke8_simplify__tests__SIM211_SIM211.py.snap | 6 +- ...ke8_simplify__tests__SIM212_SIM212.py.snap | 4 +- ...ke8_simplify__tests__SIM220_SIM220.py.snap | 6 +- ...ke8_simplify__tests__SIM221_SIM221.py.snap | 6 +- ...ke8_simplify__tests__SIM222_SIM222.py.snap | 102 +++++++++--------- ...ke8_simplify__tests__SIM223_SIM223.py.snap | 98 ++++++++--------- ...ke8_simplify__tests__SIM401_SIM401.py.snap | 12 +-- ...ts__tests__ban_parent_imports_package.snap | 12 +-- ..._type_checking__tests__exempt_modules.snap | 2 +- ...ke8_type_checking__tests__import_from.snap | 2 +- ...ests__import_from_type_checking_block.snap | 2 +- ...ype_checking__tests__multiple_members.snap | 4 +- ...sts__multiple_modules_different_types.snap | 4 +- ...ng__tests__multiple_modules_same_type.snap | 4 +- ...ype_checking__tests__no_typing_import.snap | 2 +- ...rt-in-type-checking-block_TCH004_1.py.snap | 2 +- ...t-in-type-checking-block_TCH004_11.py.snap | 2 +- ...t-in-type-checking-block_TCH004_12.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_2.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_4.py.snap | 2 +- ...rt-in-type-checking-block_TCH004_5.py.snap | 6 +- ...rt-in-type-checking-block_TCH004_9.py.snap | 4 +- ...k_runtime_evaluated_base_classes_1.py.snap | 6 +- ...ock_runtime_evaluated_decorators_1.py.snap | 6 +- ...__flake8_type_checking__tests__strict.snap | 16 +-- ...ests__type_checking_block_after_usage.snap | 2 +- ...g__tests__type_checking_block_comment.snap | 2 +- ...ng__tests__type_checking_block_inline.snap | 2 +- ...__tests__type_checking_block_own_line.snap | 2 +- ...ing-only-first-party-import_TCH001.py.snap | 2 +- ...nly-standard-library-import_TCH003.py.snap | 2 +- ...t_runtime_evaluated_base_classes_3.py.snap | 2 +- ...ort_runtime_evaluated_decorators_3.py.snap | 2 +- ...ing-only-third-party-import_TCH002.py.snap | 18 ++-- ...t_runtime_evaluated_base_classes_2.py.snap | 4 +- ...ort_runtime_evaluated_decorators_2.py.snap | 2 +- ...ing-only-third-party-import_strict.py.snap | 4 +- ...s__typing_import_after_package_import.snap | 2 +- ...__typing_import_before_package_import.snap | 2 +- ...rules__flynt__tests__FLY002_FLY002.py.snap | 14 +-- ...__numpy-deprecated-function_NPY003.py.snap | 20 ++-- ...numpy-deprecated-type-alias_NPY001.py.snap | 14 +-- ...es__pandas_vet__tests__PD002_PD002.py.snap | 14 +-- ..._rules__pandas_vet__tests__PD002_fail.snap | 2 +- ...__perflint__tests__PERF102_PERF102.py.snap | 24 ++--- ...les__pycodestyle__tests__E711_E711.py.snap | 20 ++-- ...les__pycodestyle__tests__E712_E712.py.snap | 26 ++--- ...les__pycodestyle__tests__E731_E731.py.snap | 26 ++--- ...pycodestyle__tests__constant_literals.snap | 8 +- ...__rules__pydocstyle__tests__D200_D.py.snap | 6 +- ...ules__pydocstyle__tests__D200_D200.py.snap | 2 +- ...__rules__pydocstyle__tests__D400_D.py.snap | 34 +++--- ...ules__pydocstyle__tests__D400_D400.py.snap | 24 ++--- ...__rules__pydocstyle__tests__D415_D.py.snap | 32 +++--- ...__rules__pydocstyle__tests__d209_d400.snap | 2 +- ..._rules__pyflakes__tests__F601_F601.py.snap | 16 +-- ..._rules__pyflakes__tests__F602_F602.py.snap | 12 +-- ...ules__pyflakes__tests__F841_F841_0.py.snap | 16 +-- ...ules__pyflakes__tests__F841_F841_1.py.snap | 4 +- ...ules__pyflakes__tests__F841_F841_3.py.snap | 58 +++++----- ...lakes__tests__f841_dummy_variable_rgx.snap | 20 ++-- ...nt__tests__PLC0414_import_aliasing.py.snap | 16 +-- ...t__tests__PLR1722_sys_exit_alias_0.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_1.py.snap | 8 +- ...__tests__PLR1722_sys_exit_alias_11.py.snap | 2 +- ...__tests__PLR1722_sys_exit_alias_12.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_2.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_3.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_4.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_5.py.snap | 8 +- ...t__tests__PLR1722_sys_exit_alias_6.py.snap | 4 +- ...t__tests__PLR1722_sys_exit_alias_7.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_8.py.snap | 2 +- ...t__tests__PLR1722_sys_exit_alias_9.py.snap | 2 +- ...int__tests__PLW3301_nested_min_max.py.snap | 28 ++--- ...er__rules__pyupgrade__tests__UP005.py.snap | 8 +- ...__rules__pyupgrade__tests__UP006_0.py.snap | 4 +- ...__rules__pyupgrade__tests__UP006_1.py.snap | 2 +- ...__rules__pyupgrade__tests__UP006_3.py.snap | 2 +- ...er__rules__pyupgrade__tests__UP007.py.snap | 34 +++--- ...er__rules__pyupgrade__tests__UP008.py.snap | 10 +- ...er__rules__pyupgrade__tests__UP010.py.snap | 20 ++-- ...er__rules__pyupgrade__tests__UP013.py.snap | 24 ++--- ...er__rules__pyupgrade__tests__UP014.py.snap | 10 +- ...er__rules__pyupgrade__tests__UP020.py.snap | 2 +- ...er__rules__pyupgrade__tests__UP021.py.snap | 6 +- ...er__rules__pyupgrade__tests__UP022.py.snap | 14 +-- ...er__rules__pyupgrade__tests__UP023.py.snap | 20 ++-- ...er__rules__pyupgrade__tests__UP026.py.snap | 52 ++++----- ...er__rules__pyupgrade__tests__UP027.py.snap | 10 +- ...__rules__pyupgrade__tests__UP028_0.py.snap | 26 ++--- ...er__rules__pyupgrade__tests__UP029.py.snap | 8 +- ...__rules__pyupgrade__tests__UP030_0.py.snap | 46 ++++---- ...__rules__pyupgrade__tests__UP031_0.py.snap | 82 +++++++------- ...__rules__pyupgrade__tests__UP032_0.py.snap | 86 +++++++-------- ...__rules__pyupgrade__tests__UP032_1.py.snap | 2 +- ...__rules__pyupgrade__tests__UP032_2.py.snap | 44 ++++---- ...er__rules__pyupgrade__tests__UP035.py.snap | 92 ++++++++-------- ...__rules__pyupgrade__tests__UP036_0.py.snap | 58 +++++----- ...__rules__pyupgrade__tests__UP036_1.py.snap | 26 ++--- ...__rules__pyupgrade__tests__UP036_2.py.snap | 24 ++--- ...__rules__pyupgrade__tests__UP036_3.py.snap | 6 +- ...__rules__pyupgrade__tests__UP036_4.py.snap | 16 +-- ...__rules__pyupgrade__tests__UP036_5.py.snap | 4 +- ...er__rules__pyupgrade__tests__UP038.py.snap | 4 +- ...rade__tests__datetime_utc_alias_py311.snap | 8 +- ...tests__future_annotations_pep_604_p37.snap | 2 +- ...sts__future_annotations_pep_604_py310.snap | 4 +- ...es__refurb__tests__FURB105_FURB105.py.snap | 34 +++--- ...es__refurb__tests__FURB113_FURB113.py.snap | 24 ++--- ...es__refurb__tests__FURB131_FURB131.py.snap | 12 +-- ...es__refurb__tests__FURB132_FURB132.py.snap | 8 +- ...es__refurb__tests__FURB140_FURB140.py.snap | 18 ++-- ...es__refurb__tests__FURB145_FURB145.py.snap | 12 +-- ...es__refurb__tests__FURB148_FURB148.py.snap | 40 +++---- ..._ruff__tests__PY39_RUF013_RUF013_0.py.snap | 44 ++++---- ..._ruff__tests__PY39_RUF013_RUF013_1.py.snap | 2 +- ..._rules__ruff__tests__RUF005_RUF005.py.snap | 30 +++--- ...ules__ruff__tests__RUF013_RUF013_0.py.snap | 44 ++++---- ...ules__ruff__tests__RUF013_RUF013_1.py.snap | 2 +- ..._rules__ruff__tests__RUF015_RUF015.py.snap | 24 ++--- ...ules__ruff__tests__RUF017_RUF017_0.py.snap | 14 +-- ...ules__ruff__tests__RUF017_RUF017_1.py.snap | 2 +- ...ruff_linter__rules__ruff__tests__noqa.snap | 2 +- ..._linter__rules__ruff__tests__ruf100_0.snap | 24 ++--- ..._linter__rules__ruff__tests__ruf100_1.snap | 10 +- ..._linter__rules__ruff__tests__ruf100_2.snap | 2 +- ..._linter__rules__ruff__tests__ruf100_3.snap | 38 +++---- ..._linter__rules__ruff__tests__ruf100_5.snap | 2 +- ...__rules__ruff__tests__ruff_noqa_codes.snap | 2 +- ...rules__ruff__tests__ruff_noqa_invalid.snap | 2 +- ...atops__tests__verbose-raise_TRY201.py.snap | 6 +- crates/ruff_linter/src/settings/flags.rs | 22 +--- crates/ruff_linter/src/settings/mod.rs | 1 + crates/ruff_linter/src/settings/types.rs | 19 +++- ...inter__linter__tests__unused_variable.snap | 8 +- crates/ruff_linter/src/test.rs | 3 +- crates/ruff_workspace/src/configuration.rs | 8 +- crates/ruff_workspace/src/options.rs | 2 +- crates/ruff_workspace/src/settings.rs | 8 +- docs/configuration.md | 2 + ruff.schema.json | 2 +- 225 files changed, 1678 insertions(+), 1657 deletions(-) diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff_cli/src/args.rs index e75cf47cf3bb90..4285c77b171aab 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff_cli/src/args.rs @@ -9,6 +9,7 @@ use ruff_linter::logging::LogLevel; use ruff_linter::registry::Rule; use ruff_linter::settings::types::{ FilePattern, PatternPrefixPair, PerFileIgnore, PreviewMode, PythonVersion, SerializationFormat, + UnsafeFixes, }; use ruff_linter::{RuleParser, RuleSelector, RuleSelectorParser}; use ruff_workspace::configuration::{Configuration, RuleSelection}; @@ -80,11 +81,13 @@ pub struct CheckCommand { /// Use `--no-fix` to disable or `--unsafe-fixes` to include suggested fixes. #[arg(long, overrides_with("no_fix"))] fix: bool, - /// Include fixes that may not retain the original intent of the code. - #[arg(long)] - unsafe_fixes: bool, #[clap(long, overrides_with_all(["fix"]), hide = true)] no_fix: bool, + /// Include fixes that may not retain the original intent of the code. + #[arg(long, overrides_with("no_unsafe_fixes"))] + unsafe_fixes: bool, + #[arg(long, overrides_with("unsafe_fixes"))] + no_unsafe_fixes: bool, /// Show violations with source code. /// Use `--no-show-source` to disable. #[arg(long, overrides_with("no_show_source"))] @@ -500,7 +503,8 @@ impl CheckCommand { cache_dir: self.cache_dir, fix: resolve_bool_arg(self.fix, self.no_fix), fix_only: resolve_bool_arg(self.fix_only, self.no_fix_only), - unsafe_fixes: Some(self.unsafe_fixes), + unsafe_fixes: resolve_bool_arg(self.unsafe_fixes, self.no_unsafe_fixes) + .map(UnsafeFixes::from), force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude), output_format: self.output_format.or(self.format), show_fixes: resolve_bool_arg(self.show_fixes, self.no_show_fixes), @@ -603,7 +607,7 @@ pub struct CliOverrides { pub cache_dir: Option, pub fix: Option, pub fix_only: Option, - pub unsafe_fixes: Option, + pub unsafe_fixes: Option, pub force_exclude: Option, pub output_format: Option, pub show_fixes: Option, diff --git a/crates/ruff_cli/src/cache.rs b/crates/ruff_cli/src/cache.rs index 16a2172c21883a..f6595c43370a52 100644 --- a/crates/ruff_cli/src/cache.rs +++ b/crates/ruff_cli/src/cache.rs @@ -338,6 +338,7 @@ pub(crate) fn init(path: &Path) -> Result<()> { #[cfg(test)] mod tests { use filetime::{set_file_mtime, FileTime}; + use ruff_linter::settings::types::UnsafeFixes; use std::env::temp_dir; use std::fs; use std::io; @@ -409,7 +410,8 @@ mod tests { &settings.linter, Some(&cache), flags::Noqa::Enabled, - flags::FixMode::Generate(flags::UnsafeFixes::Enabled), + flags::FixMode::Generate, + UnsafeFixes::Enabled, ) .unwrap(); if diagnostics @@ -454,7 +456,8 @@ mod tests { &settings.linter, Some(&cache), flags::Noqa::Enabled, - flags::FixMode::Generate(flags::UnsafeFixes::Enabled), + flags::FixMode::Generate, + UnsafeFixes::Enabled, ) .unwrap(); } @@ -711,7 +714,8 @@ mod tests { &self.settings.linter, Some(cache), flags::Noqa::Enabled, - flags::FixMode::Generate(flags::UnsafeFixes::Enabled), + flags::FixMode::Generate, + UnsafeFixes::Enabled, ) } } diff --git a/crates/ruff_cli/src/commands/check.rs b/crates/ruff_cli/src/commands/check.rs index c4f35bbb4fb346..121e524ee81498 100644 --- a/crates/ruff_cli/src/commands/check.rs +++ b/crates/ruff_cli/src/commands/check.rs @@ -11,6 +11,7 @@ use itertools::Itertools; use log::{debug, error, warn}; #[cfg(not(target_family = "wasm"))] use rayon::prelude::*; +use ruff_linter::settings::types::UnsafeFixes; use rustc_hash::FxHashMap; use ruff_diagnostics::Diagnostic; @@ -119,7 +120,16 @@ pub(crate) fn check( } }); - lint_path(path, package, &settings.linter, cache, noqa, fix_mode).map_err(|e| { + lint_path( + path, + package, + &settings.linter, + cache, + noqa, + fix_mode, + settings.unsafe_fixes, + ) + .map_err(|e| { (Some(path.to_owned()), { let mut error = e.to_string(); for cause in e.chain() { @@ -199,9 +209,10 @@ fn lint_path( cache: Option<&Cache>, noqa: flags::Noqa, fix_mode: flags::FixMode, + unsafe_fixes: UnsafeFixes, ) -> Result { let result = catch_unwind(|| { - crate::diagnostics::lint_path(path, package, settings, cache, noqa, fix_mode) + crate::diagnostics::lint_path(path, package, settings, cache, noqa, fix_mode, unsafe_fixes) }); match result { @@ -233,6 +244,7 @@ mod test { use std::os::unix::fs::OpenOptionsExt; use anyhow::Result; + use ruff_linter::settings::types::UnsafeFixes; use rustc_hash::FxHashMap; use tempfile::TempDir; @@ -284,7 +296,7 @@ mod test { &CliOverrides::default(), flags::Cache::Disabled, flags::Noqa::Disabled, - flags::FixMode::Generate(flags::UnsafeFixes::Enabled), + flags::FixMode::Generate, ) .unwrap(); let mut output = Vec::new(); diff --git a/crates/ruff_cli/src/diagnostics.rs b/crates/ruff_cli/src/diagnostics.rs index 89b4ba3344bc02..8d2813c5d05bb3 100644 --- a/crates/ruff_cli/src/diagnostics.rs +++ b/crates/ruff_cli/src/diagnostics.rs @@ -21,6 +21,7 @@ use ruff_linter::logging::DisplayParseError; use ruff_linter::message::Message; use ruff_linter::pyproject_toml::lint_pyproject_toml; use ruff_linter::registry::AsRule; +use ruff_linter::settings::types::UnsafeFixes; use ruff_linter::settings::{flags, LinterSettings}; use ruff_linter::source_kind::{SourceError, SourceKind}; use ruff_linter::{fs, IOError, SyntaxError}; @@ -170,6 +171,7 @@ pub(crate) fn lint_path( cache: Option<&Cache>, noqa: flags::Noqa, fix_mode: flags::FixMode, + unsafe_fixes: UnsafeFixes, ) -> Result { // Check the cache. // TODO(charlie): `fixer::Mode::Apply` and `fixer::Mode::Diff` both have @@ -242,7 +244,7 @@ pub(crate) fn lint_path( }, fixed, ) = match fix_mode { - flags::FixMode::Apply(unsafe_fixes) | flags::FixMode::Diff(unsafe_fixes) => { + flags::FixMode::Apply | flags::FixMode::Diff => { if let Ok(FixerResult { result, transformed, @@ -251,14 +253,14 @@ pub(crate) fn lint_path( path, package, noqa, + unsafe_fixes, settings, &source_kind, source_type, - unsafe_fixes, ) { if !fixed.is_empty() { match fix_mode { - flags::FixMode::Apply(_) => match transformed.as_ref() { + flags::FixMode::Apply => match transformed.as_ref() { SourceKind::Python(transformed) => { write(path, transformed.as_bytes())?; } @@ -267,7 +269,7 @@ pub(crate) fn lint_path( notebook.write(&mut writer)?; } }, - flags::FixMode::Diff(_) => { + flags::FixMode::Diff => { match transformed.as_ref() { SourceKind::Python(transformed) => { let mut stdout = io::stdout().lock(); @@ -328,7 +330,7 @@ pub(crate) fn lint_path( } } } - flags::FixMode::Generate(_) => {} + flags::FixMode::Generate => {} } } (result, fixed) @@ -339,7 +341,7 @@ pub(crate) fn lint_path( (result, fixed) } } - flags::FixMode::Generate(_) => { + flags::FixMode::Generate => { let result = lint_only(path, package, settings, noqa, &source_kind, source_type); let fixed = FxHashMap::default(); (result, fixed) @@ -421,7 +423,7 @@ pub(crate) fn lint_stdin( }, fixed, ) = match fix_mode { - flags::FixMode::Apply(unsafe_fixes) | flags::FixMode::Diff(unsafe_fixes) => { + flags::FixMode::Apply | flags::FixMode::Diff => { if let Ok(FixerResult { result, transformed, @@ -430,17 +432,17 @@ pub(crate) fn lint_stdin( path.unwrap_or_else(|| Path::new("-")), package, noqa, + settings.unsafe_fixes, &settings.linter, &source_kind, source_type, - unsafe_fixes, ) { match fix_mode { - flags::FixMode::Apply(_) => { + flags::FixMode::Apply => { // Write the contents to stdout, regardless of whether any errors were fixed. io::stdout().write_all(transformed.source_code().as_bytes())?; } - flags::FixMode::Diff(_) => { + flags::FixMode::Diff => { // But only write a diff if it's non-empty. if !fixed.is_empty() { let text_diff = TextDiff::from_lines( @@ -459,7 +461,7 @@ pub(crate) fn lint_stdin( stdout.flush()?; } } - flags::FixMode::Generate(_) => {} + flags::FixMode::Generate => {} } (result, fixed) @@ -483,7 +485,7 @@ pub(crate) fn lint_stdin( (result, fixed) } } - flags::FixMode::Generate(_) => { + flags::FixMode::Generate => { let result = lint_only( path.unwrap_or_else(|| Path::new("-")), package, diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index 24d74ff57a1f87..f8744d660afcea 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -10,8 +10,8 @@ use log::warn; use notify::{recommended_watcher, RecursiveMode, Watcher}; use ruff_linter::logging::{set_up_logging, LogLevel}; -use ruff_linter::settings::flags::{FixMode, UnsafeFixes}; -use ruff_linter::settings::types::SerializationFormat; +use ruff_linter::settings::flags::FixMode; +use ruff_linter::settings::types::{SerializationFormat, UnsafeFixes}; use ruff_linter::{fs, warn_user, warn_user_once}; use ruff_workspace::Settings; @@ -243,19 +243,12 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { // - By default, applicable fixes only include [`Applicablility::Automatic`], but if // `--unsafe-fixes` is set, then [`Applicablility::Suggested`] fixes are included. - let unsafe_fixes = if unsafe_fixes { - UnsafeFixes::Enabled - } else { - UnsafeFixes::Disabled - }; - let fix_mode = if cli.diff { - FixMode::Diff(unsafe_fixes) + FixMode::Diff } else if fix || fix_only { - FixMode::Apply(unsafe_fixes) + FixMode::Apply } else { - // Always generate all fixes, regardless of [`Applicability`], in `generate` mode - FixMode::Generate(UnsafeFixes::Enabled) + FixMode::Generate }; let cache = !cli.no_cache; @@ -396,7 +389,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { // Always try to print violations (the printer itself may suppress output), // unless we're writing fixes via stdin (in which case, the transformed // source code goes to stdout). - if !(is_stdin && matches!(fix_mode, FixMode::Apply(_) | FixMode::Diff(_))) { + if !(is_stdin && matches!(fix_mode, FixMode::Apply | FixMode::Diff)) { if cli.statistics { printer.write_statistics(&diagnostics, &mut writer)?; } else { diff --git a/crates/ruff_diagnostics/src/fix.rs b/crates/ruff_diagnostics/src/fix.rs index 66adc5b8c75788..51ac2aa2ea6481 100644 --- a/crates/ruff_diagnostics/src/fix.rs +++ b/crates/ruff_diagnostics/src/fix.rs @@ -29,7 +29,7 @@ pub enum Applicability { } impl Applicability { - pub fn symbol(&self) -> &'static str { + pub const fn symbol(&self) -> &'static str { // Uses a constant for now for all kinds but we can match self and use different symbols "*" } diff --git a/crates/ruff_linter/src/fix/mod.rs b/crates/ruff_linter/src/fix/mod.rs index bc449e4948dbf8..f730e32d4bcb2c 100644 --- a/crates/ruff_linter/src/fix/mod.rs +++ b/crates/ruff_linter/src/fix/mod.rs @@ -9,7 +9,7 @@ use ruff_source_file::Locator; use crate::linter::FixTable; use crate::registry::{AsRule, Rule}; -use crate::settings::flags::UnsafeFixes; +use crate::settings::types::UnsafeFixes; pub(crate) mod codemods; pub(crate) mod edits; diff --git a/crates/ruff_linter/src/linter.rs b/crates/ruff_linter/src/linter.rs index 6543f5123ce9f3..9219bfa8ef7748 100644 --- a/crates/ruff_linter/src/linter.rs +++ b/crates/ruff_linter/src/linter.rs @@ -32,6 +32,7 @@ use crate::message::Message; use crate::noqa::add_noqa; use crate::registry::{AsRule, Rule}; use crate::rules::pycodestyle; +use crate::settings::types::UnsafeFixes; use crate::settings::{flags, LinterSettings}; use crate::source_kind::SourceKind; use crate::{directives, fs}; @@ -420,10 +421,10 @@ pub fn lint_fix<'a>( path: &Path, package: Option<&Path>, noqa: flags::Noqa, + unsafe_fixes: UnsafeFixes, settings: &LinterSettings, source_kind: &'a SourceKind, source_type: PySourceType, - unsafe_fixes: flags::UnsafeFixes, ) -> Result> { let mut transformed = Cow::Borrowed(source_kind); diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status.snap index 575ca407106c88..37344ef4884d37 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status.snap @@ -3,14 +3,14 @@ source: crates/ruff_linter/src/message/grouped.rs expression: content --- fib.py: - 1:8 F401 [**] `os` imported but unused + 1:8 F401 `os` imported but unused | 1 | import os | ^^ F401 | = help: Remove unused import: `os` - 6:5 F841 [**] Local variable `x` is assigned to but never used + 6:5 F841 Local variable `x` is assigned to but never used | 4 | def fibonacci(n): 5 | """Compute the nth number in the Fibonacci sequence.""" diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap index f79d5b82f84823..77cd92056a7dee 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status.snap @@ -2,14 +2,14 @@ source: crates/ruff_linter/src/message/text.rs expression: content --- -fib.py:1:8: F401 [**] `os` imported but unused +fib.py:1:8: F401 `os` imported but unused | 1 | import os | ^^ F401 | = help: Remove unused import: `os` -fib.py:6:5: F841 [**] Local variable `x` is assigned to but never used +fib.py:6:5: F841 Local variable `x` is assigned to but never used | 4 | def fibonacci(n): 5 | """Compute the nth number in the Fibonacci sequence.""" diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap index 8c70b0002784f9..46f4faabe2fd89 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__defaults.snap @@ -242,7 +242,7 @@ annotation_presence.py:154:10: ANN401 Dynamically typed expressions (typing.Any) | ^^^^^^^^^^^^^^^^^^^^^^^^ ANN401 | -annotation_presence.py:159:9: ANN204 [**] Missing return type annotation for special method `__init__` +annotation_presence.py:159:9: ANN204 [*] Missing return type annotation for special method `__init__` | 157 | class Foo: 158 | @decorator() @@ -262,7 +262,7 @@ annotation_presence.py:159:9: ANN204 [**] Missing return type annotation for spe 161 161 | 162 162 | -annotation_presence.py:165:9: ANN204 [**] Missing return type annotation for special method `__init__` +annotation_presence.py:165:9: ANN204 [*] Missing return type annotation for special method `__init__` | 163 | # Regression test for: https://github.com/astral-sh/ruff/issues/7711 164 | class Class: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap index d4fe71714f3b9e..193ef4f8ba8aca 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__mypy_init_return.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -mypy_init_return.py:5:9: ANN204 [**] Missing return type annotation for special method `__init__` +mypy_init_return.py:5:9: ANN204 [*] Missing return type annotation for special method `__init__` | 3 | # Error 4 | class Foo: @@ -21,7 +21,7 @@ mypy_init_return.py:5:9: ANN204 [**] Missing return type annotation for special 7 7 | 8 8 | -mypy_init_return.py:11:9: ANN204 [**] Missing return type annotation for special method `__init__` +mypy_init_return.py:11:9: ANN204 [*] Missing return type annotation for special method `__init__` | 9 | # Error 10 | class Foo: @@ -49,7 +49,7 @@ mypy_init_return.py:40:5: ANN202 Missing return type annotation for private func 41 | ... | -mypy_init_return.py:47:9: ANN204 [**] Missing return type annotation for special method `__init__` +mypy_init_return.py:47:9: ANN204 [*] Missing return type annotation for special method `__init__` | 45 | # of a vararg falsely indicated that the function has a typed argument. 46 | class Foo: diff --git a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap index a1e0107e631237..8dd48048c65601 100644 --- a/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap +++ b/crates/ruff_linter/src/rules/flake8_annotations/snapshots/ruff_linter__rules__flake8_annotations__tests__simple_magic_methods.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_annotations/mod.rs --- -simple_magic_methods.py:2:9: ANN204 [**] Missing return type annotation for special method `__str__` +simple_magic_methods.py:2:9: ANN204 [*] Missing return type annotation for special method `__str__` | 1 | class Foo: 2 | def __str__(self): @@ -18,7 +18,7 @@ simple_magic_methods.py:2:9: ANN204 [**] Missing return type annotation for spec 4 4 | 5 5 | def __repr__(self): -simple_magic_methods.py:5:9: ANN204 [**] Missing return type annotation for special method `__repr__` +simple_magic_methods.py:5:9: ANN204 [*] Missing return type annotation for special method `__repr__` | 3 | ... 4 | @@ -38,7 +38,7 @@ simple_magic_methods.py:5:9: ANN204 [**] Missing return type annotation for spec 7 7 | 8 8 | def __len__(self): -simple_magic_methods.py:8:9: ANN204 [**] Missing return type annotation for special method `__len__` +simple_magic_methods.py:8:9: ANN204 [*] Missing return type annotation for special method `__len__` | 6 | ... 7 | @@ -58,7 +58,7 @@ simple_magic_methods.py:8:9: ANN204 [**] Missing return type annotation for spec 10 10 | 11 11 | def __length_hint__(self): -simple_magic_methods.py:11:9: ANN204 [**] Missing return type annotation for special method `__length_hint__` +simple_magic_methods.py:11:9: ANN204 [*] Missing return type annotation for special method `__length_hint__` | 9 | ... 10 | @@ -78,7 +78,7 @@ simple_magic_methods.py:11:9: ANN204 [**] Missing return type annotation for spe 13 13 | 14 14 | def __init__(self): -simple_magic_methods.py:14:9: ANN204 [**] Missing return type annotation for special method `__init__` +simple_magic_methods.py:14:9: ANN204 [*] Missing return type annotation for special method `__init__` | 12 | ... 13 | @@ -98,7 +98,7 @@ simple_magic_methods.py:14:9: ANN204 [**] Missing return type annotation for spe 16 16 | 17 17 | def __del__(self): -simple_magic_methods.py:17:9: ANN204 [**] Missing return type annotation for special method `__del__` +simple_magic_methods.py:17:9: ANN204 [*] Missing return type annotation for special method `__del__` | 15 | ... 16 | @@ -118,7 +118,7 @@ simple_magic_methods.py:17:9: ANN204 [**] Missing return type annotation for spe 19 19 | 20 20 | def __bool__(self): -simple_magic_methods.py:20:9: ANN204 [**] Missing return type annotation for special method `__bool__` +simple_magic_methods.py:20:9: ANN204 [*] Missing return type annotation for special method `__bool__` | 18 | ... 19 | @@ -138,7 +138,7 @@ simple_magic_methods.py:20:9: ANN204 [**] Missing return type annotation for spe 22 22 | 23 23 | def __bytes__(self): -simple_magic_methods.py:23:9: ANN204 [**] Missing return type annotation for special method `__bytes__` +simple_magic_methods.py:23:9: ANN204 [*] Missing return type annotation for special method `__bytes__` | 21 | ... 22 | @@ -158,7 +158,7 @@ simple_magic_methods.py:23:9: ANN204 [**] Missing return type annotation for spe 25 25 | 26 26 | def __format__(self, format_spec): -simple_magic_methods.py:26:9: ANN204 [**] Missing return type annotation for special method `__format__` +simple_magic_methods.py:26:9: ANN204 [*] Missing return type annotation for special method `__format__` | 24 | ... 25 | @@ -178,7 +178,7 @@ simple_magic_methods.py:26:9: ANN204 [**] Missing return type annotation for spe 28 28 | 29 29 | def __contains__(self, item): -simple_magic_methods.py:29:9: ANN204 [**] Missing return type annotation for special method `__contains__` +simple_magic_methods.py:29:9: ANN204 [*] Missing return type annotation for special method `__contains__` | 27 | ... 28 | @@ -198,7 +198,7 @@ simple_magic_methods.py:29:9: ANN204 [**] Missing return type annotation for spe 31 31 | 32 32 | def __complex__(self): -simple_magic_methods.py:32:9: ANN204 [**] Missing return type annotation for special method `__complex__` +simple_magic_methods.py:32:9: ANN204 [*] Missing return type annotation for special method `__complex__` | 30 | ... 31 | @@ -218,7 +218,7 @@ simple_magic_methods.py:32:9: ANN204 [**] Missing return type annotation for spe 34 34 | 35 35 | def __int__(self): -simple_magic_methods.py:35:9: ANN204 [**] Missing return type annotation for special method `__int__` +simple_magic_methods.py:35:9: ANN204 [*] Missing return type annotation for special method `__int__` | 33 | ... 34 | @@ -238,7 +238,7 @@ simple_magic_methods.py:35:9: ANN204 [**] Missing return type annotation for spe 37 37 | 38 38 | def __float__(self): -simple_magic_methods.py:38:9: ANN204 [**] Missing return type annotation for special method `__float__` +simple_magic_methods.py:38:9: ANN204 [*] Missing return type annotation for special method `__float__` | 36 | ... 37 | @@ -258,7 +258,7 @@ simple_magic_methods.py:38:9: ANN204 [**] Missing return type annotation for spe 40 40 | 41 41 | def __index__(self): -simple_magic_methods.py:41:9: ANN204 [**] Missing return type annotation for special method `__index__` +simple_magic_methods.py:41:9: ANN204 [*] Missing return type annotation for special method `__index__` | 39 | ... 40 | diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap index f2f81ce37df9f8..283f28ee82d05f 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B007_B007.py.snap @@ -11,7 +11,7 @@ B007.py:6:5: B007 Loop control variable `i` not used within loop body | = help: Rename unused `i` to `_i` -B007.py:18:13: B007 [**] Loop control variable `k` not used within loop body +B007.py:18:13: B007 [*] Loop control variable `k` not used within loop body | 16 | for i in range(10): 17 | for j in range(10): @@ -39,7 +39,7 @@ B007.py:30:5: B007 Loop control variable `i` not used within loop body | = help: Rename unused `i` to `_i` -B007.py:30:13: B007 [**] Loop control variable `k` not used within loop body +B007.py:30:13: B007 [*] Loop control variable `k` not used within loop body | 30 | for i, (j, (k, l)) in strange_generator(): # i, k not used | ^ B007 @@ -99,7 +99,7 @@ B007.py:46:10: B007 Loop control variable `bar` may not be used within loop body | = help: Rename unused `bar` to `_bar` -B007.py:52:14: B007 [**] Loop control variable `bar` not used within loop body +B007.py:52:14: B007 [*] Loop control variable `bar` not used within loop body | 50 | def f(): 51 | # Fixable. @@ -131,7 +131,7 @@ B007.py:59:14: B007 Loop control variable `bar` not used within loop body | = help: Rename unused `bar` to `_bar` -B007.py:68:14: B007 [**] Loop control variable `bar` not used within loop body +B007.py:68:14: B007 [*] Loop control variable `bar` not used within loop body | 66 | def f(): 67 | # Fixable. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap index 2b50b028ef54c0..1a0d1da89b96b7 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B009_B009_B010.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B009_B010.py:19:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:19:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 18 | # Invalid usage 19 | getattr(foo, "bar") @@ -21,7 +21,7 @@ B009_B010.py:19:1: B009 [**] Do not call `getattr` with a constant attribute val 21 21 | getattr(foo, "__123abc__") 22 22 | getattr(foo, "abc123") -B009_B010.py:20:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:20:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 18 | # Invalid usage 19 | getattr(foo, "bar") @@ -42,7 +42,7 @@ B009_B010.py:20:1: B009 [**] Do not call `getattr` with a constant attribute val 22 22 | getattr(foo, "abc123") 23 23 | getattr(foo, r"abc123") -B009_B010.py:21:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:21:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 19 | getattr(foo, "bar") 20 | getattr(foo, "_123abc") @@ -63,7 +63,7 @@ B009_B010.py:21:1: B009 [**] Do not call `getattr` with a constant attribute val 23 23 | getattr(foo, r"abc123") 24 24 | _ = lambda x: getattr(x, "bar") -B009_B010.py:22:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:22:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 20 | getattr(foo, "_123abc") 21 | getattr(foo, "__123abc__") @@ -84,7 +84,7 @@ B009_B010.py:22:1: B009 [**] Do not call `getattr` with a constant attribute val 24 24 | _ = lambda x: getattr(x, "bar") 25 25 | if getattr(x, "bar"): -B009_B010.py:23:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:23:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 21 | getattr(foo, "__123abc__") 22 | getattr(foo, "abc123") @@ -105,7 +105,7 @@ B009_B010.py:23:1: B009 [**] Do not call `getattr` with a constant attribute val 25 25 | if getattr(x, "bar"): 26 26 | pass -B009_B010.py:24:15: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:24:15: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 22 | getattr(foo, "abc123") 23 | getattr(foo, r"abc123") @@ -126,7 +126,7 @@ B009_B010.py:24:15: B009 [**] Do not call `getattr` with a constant attribute va 26 26 | pass 27 27 | getattr(1, "real") -B009_B010.py:25:4: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:25:4: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 23 | getattr(foo, r"abc123") 24 | _ = lambda x: getattr(x, "bar") @@ -147,7 +147,7 @@ B009_B010.py:25:4: B009 [**] Do not call `getattr` with a constant attribute val 27 27 | getattr(1, "real") 28 28 | getattr(1., "real") -B009_B010.py:27:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:27:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 25 | if getattr(x, "bar"): 26 | pass @@ -168,7 +168,7 @@ B009_B010.py:27:1: B009 [**] Do not call `getattr` with a constant attribute val 29 29 | getattr(1.0, "real") 30 30 | getattr(1j, "real") -B009_B010.py:28:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:28:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 26 | pass 27 | getattr(1, "real") @@ -189,7 +189,7 @@ B009_B010.py:28:1: B009 [**] Do not call `getattr` with a constant attribute val 30 30 | getattr(1j, "real") 31 31 | getattr(True, "real") -B009_B010.py:29:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:29:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 27 | getattr(1, "real") 28 | getattr(1., "real") @@ -210,7 +210,7 @@ B009_B010.py:29:1: B009 [**] Do not call `getattr` with a constant attribute val 31 31 | getattr(True, "real") 32 32 | getattr(x := 1, "real") -B009_B010.py:30:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:30:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 28 | getattr(1., "real") 29 | getattr(1.0, "real") @@ -231,7 +231,7 @@ B009_B010.py:30:1: B009 [**] Do not call `getattr` with a constant attribute val 32 32 | getattr(x := 1, "real") 33 33 | getattr(x + y, "real") -B009_B010.py:31:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:31:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 29 | getattr(1.0, "real") 30 | getattr(1j, "real") @@ -252,7 +252,7 @@ B009_B010.py:31:1: B009 [**] Do not call `getattr` with a constant attribute val 33 33 | getattr(x + y, "real") 34 34 | getattr("foo" -B009_B010.py:32:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:32:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 30 | getattr(1j, "real") 31 | getattr(True, "real") @@ -273,7 +273,7 @@ B009_B010.py:32:1: B009 [**] Do not call `getattr` with a constant attribute val 34 34 | getattr("foo" 35 35 | "bar", "real") -B009_B010.py:33:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:33:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 31 | getattr(True, "real") 32 | getattr(x := 1, "real") @@ -294,7 +294,7 @@ B009_B010.py:33:1: B009 [**] Do not call `getattr` with a constant attribute val 35 35 | "bar", "real") 36 36 | -B009_B010.py:34:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:34:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 32 | getattr(x := 1, "real") 33 | getattr(x + y, "real") @@ -316,7 +316,7 @@ B009_B010.py:34:1: B009 [**] Do not call `getattr` with a constant attribute val 37 37 | 38 38 | # Valid setattr usage -B009_B010.py:58:8: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:58:8: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 58 | assert getattr(func, '_rpc')is True @@ -336,7 +336,7 @@ B009_B010.py:58:8: B009 [**] Do not call `getattr` with a constant attribute val 60 60 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1732387247 61 61 | getattr(*foo, "bar") -B009_B010.py:65:1: B009 [**] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:65:1: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access. | 64 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1739800901 65 | / getattr(self. diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap index 39b8f2fc278396..2945aafb436c95 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B010_B009_B010.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B009_B010.py:50:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:50:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 49 | # Invalid usage 50 | setattr(foo, "bar", None) @@ -21,7 +21,7 @@ B009_B010.py:50:1: B010 [**] Do not call `setattr` with a constant attribute val 52 52 | setattr(foo, "__123abc__", None) 53 53 | setattr(foo, "abc123", None) -B009_B010.py:51:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:51:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 49 | # Invalid usage 50 | setattr(foo, "bar", None) @@ -42,7 +42,7 @@ B009_B010.py:51:1: B010 [**] Do not call `setattr` with a constant attribute val 53 53 | setattr(foo, "abc123", None) 54 54 | setattr(foo, r"abc123", None) -B009_B010.py:52:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:52:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 50 | setattr(foo, "bar", None) 51 | setattr(foo, "_123abc", None) @@ -63,7 +63,7 @@ B009_B010.py:52:1: B010 [**] Do not call `setattr` with a constant attribute val 54 54 | setattr(foo, r"abc123", None) 55 55 | setattr(foo.bar, r"baz", None) -B009_B010.py:53:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:53:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 51 | setattr(foo, "_123abc", None) 52 | setattr(foo, "__123abc__", None) @@ -84,7 +84,7 @@ B009_B010.py:53:1: B010 [**] Do not call `setattr` with a constant attribute val 55 55 | setattr(foo.bar, r"baz", None) 56 56 | -B009_B010.py:54:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:54:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 52 | setattr(foo, "__123abc__", None) 53 | setattr(foo, "abc123", None) @@ -104,7 +104,7 @@ B009_B010.py:54:1: B010 [**] Do not call `setattr` with a constant attribute val 56 56 | 57 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458885 -B009_B010.py:55:1: B010 [**] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. +B009_B010.py:55:1: B010 [*] Do not call `setattr` with a constant attribute value. It is not any safer than normal property access. | 53 | setattr(foo, "abc123", None) 54 | setattr(foo, r"abc123", None) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap index 0a6c1cb5b3236e..5415cf1eae26b8 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap +++ b/crates/ruff_linter/src/rules/flake8_bugbear/snapshots/ruff_linter__rules__flake8_bugbear__tests__B011_B011.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_bugbear/mod.rs --- -B011.py:8:8: B011 [**] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` +B011.py:8:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` | 7 | assert 1 != 2 8 | assert False @@ -20,7 +20,7 @@ B011.py:8:8: B011 [**] Do not `assert False` (`python -O` removes these calls), 9 9 | assert 1 != 2, "message" 10 10 | assert False, "message" -B011.py:10:8: B011 [**] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` +B011.py:10:8: B011 [*] Do not `assert False` (`python -O` removes these calls), raise `AssertionError()` | 8 | assert False 9 | assert 1 != 2, "message" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap index c4254696705e0f..924f9aad1929c8 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C400_C400.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C400.py:1:5: C400 [**] Unnecessary generator (rewrite as a `list` comprehension) +C400.py:1:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | 1 | x = list(x for x in range(3)) | ^^^^^^^^^^^^^^^^^^^^^^^^^ C400 @@ -17,7 +17,7 @@ C400.py:1:5: C400 [**] Unnecessary generator (rewrite as a `list` comprehension) 3 3 | x for x in range(3) 4 4 | ) -C400.py:2:5: C400 [**] Unnecessary generator (rewrite as a `list` comprehension) +C400.py:2:5: C400 [*] Unnecessary generator (rewrite as a `list` comprehension) | 1 | x = list(x for x in range(3)) 2 | x = list( diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap index 08bcff29e8dfce..a46cb832d29203 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C401_C401.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C401.py:1:5: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:1:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 1 | x = set(x for x in range(3)) | ^^^^^^^^^^^^^^^^^^^^^^^^ C401 @@ -17,7 +17,7 @@ C401.py:1:5: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) 3 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}" 4 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3))) -C401.py:2:5: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:2:5: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 1 | x = set(x for x in range(3)) 2 | x = set(x for x in range(3)) @@ -35,7 +35,7 @@ C401.py:2:5: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) 4 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3))) 5 5 | print(f"Hello {set(a for a in range(3))} World") -C401.py:3:8: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:3:8: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 1 | x = set(x for x in range(3)) 2 | x = set(x for x in range(3)) @@ -55,7 +55,7 @@ C401.py:3:8: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) 5 5 | print(f"Hello {set(a for a in range(3))} World") 6 6 | -C401.py:4:17: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:4:17: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 2 | x = set(x for x in range(3)) 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}" @@ -75,7 +75,7 @@ C401.py:4:17: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) 6 6 | 7 7 | -C401.py:5:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:5:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 3 | y = f"{set(a if a < 6 else 0 for a in range(3))}" 4 | _ = "{}".format(set(a if a < 6 else 0 for a in range(3))) @@ -94,7 +94,7 @@ C401.py:5:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) 7 7 | 8 8 | def f(x): -C401.py:12:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:12:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 12 | print(f'Hello {set(a for a in "abc")} World') | ^^^^^^^^^^^^^^^^^^^^^ C401 @@ -113,7 +113,7 @@ C401.py:12:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension 14 14 | print(f"Hello {set(f(a) for a in 'abc')} World") 15 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") -C401.py:13:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:13:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 12 | print(f'Hello {set(a for a in "abc")} World') 13 | print(f"Hello {set(a for a in 'abc')} World") @@ -133,7 +133,7 @@ C401.py:13:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension 15 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") 16 16 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") -C401.py:14:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:14:16: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 12 | print(f'Hello {set(a for a in "abc")} World') 13 | print(f"Hello {set(a for a in 'abc')} World") @@ -154,7 +154,7 @@ C401.py:14:16: C401 [**] Unnecessary generator (rewrite as a `set` comprehension 16 16 | print(f"{ set(a for a in 'abc') - set(a for a in 'ab') }") 17 17 | -C401.py:15:10: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:15:10: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 13 | print(f"Hello {set(a for a in 'abc')} World") 14 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -174,7 +174,7 @@ C401.py:15:10: C401 [**] Unnecessary generator (rewrite as a `set` comprehension 17 17 | 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space -C401.py:15:34: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:15:34: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 13 | print(f"Hello {set(a for a in 'abc')} World") 14 | print(f"Hello {set(f(a) for a in 'abc')} World") @@ -194,7 +194,7 @@ C401.py:15:34: C401 [**] Unnecessary generator (rewrite as a `set` comprehension 17 17 | 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space -C401.py:16:11: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:16:11: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 14 | print(f"Hello {set(f(a) for a in 'abc')} World") 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -215,7 +215,7 @@ C401.py:16:11: C401 [**] Unnecessary generator (rewrite as a `set` comprehension 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space 19 19 | # around the set comprehension. -C401.py:16:35: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:16:35: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 14 | print(f"Hello {set(f(a) for a in 'abc')} World") 15 | print(f"{set(a for a in 'abc') - set(a for a in 'ab')}") @@ -236,7 +236,7 @@ C401.py:16:35: C401 [**] Unnecessary generator (rewrite as a `set` comprehension 18 18 | # The fix generated for this diagnostic is incorrect, as we add additional space 19 19 | # around the set comprehension. -C401.py:20:12: C401 [**] Unnecessary generator (rewrite as a `set` comprehension) +C401.py:20:12: C401 [*] Unnecessary generator (rewrite as a `set` comprehension) | 18 | # The fix generated for this diagnostic is incorrect, as we add additional space 19 | # around the set comprehension. diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap index 5dcb97a323bb76..86d9bacc139336 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C402_C402.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C402.py:1:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:1:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 1 | dict((x, x) for x in range(3)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C402 @@ -17,7 +17,7 @@ C402.py:1:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) 3 3 | (x, x) for x in range(3) 4 4 | ) -C402.py:2:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:2:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 1 | dict((x, x) for x in range(3)) 2 | / dict( @@ -41,7 +41,7 @@ C402.py:2:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) 6 6 | y = f'{dict((x, x) for x in range(3))}' 7 7 | print(f'Hello {dict((x, x) for x in range(3))} World') -C402.py:6:8: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:6:8: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 4 | ) 5 | dict(((x, x) for x in range(3)), z=3) @@ -62,7 +62,7 @@ C402.py:6:8: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) 8 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') -C402.py:7:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:7:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 5 | dict(((x, x) for x in range(3)), z=3) 6 | y = f'{dict((x, x) for x in range(3))}' @@ -83,7 +83,7 @@ C402.py:7:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension 9 9 | print(f'Hello {dict((x, x) for x in "abc")} World') 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') -C402.py:8:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:8:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 6 | y = f'{dict((x, x) for x in range(3))}' 7 | print(f'Hello {dict((x, x) for x in range(3))} World') @@ -104,7 +104,7 @@ C402.py:8:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension 10 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 11 | -C402.py:9:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:9:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 7 | print(f'Hello {dict((x, x) for x in range(3))} World') 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") @@ -124,7 +124,7 @@ C402.py:9:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension 11 11 | 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' -C402.py:10:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:10:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 8 | print(f"Hello {dict((x, x) for x in 'abc')} World") 9 | print(f'Hello {dict((x, x) for x in "abc")} World') @@ -145,7 +145,7 @@ C402.py:10:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehensio 12 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' -C402.py:12:4: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:12:4: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 | @@ -165,7 +165,7 @@ C402.py:12:4: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension 14 14 | 15 15 | def f(x): -C402.py:12:37: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:12:37: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 10 | print(f'Hello {dict((x,x) for x in "abc")} World') 11 | @@ -185,7 +185,7 @@ C402.py:12:37: C402 [**] Unnecessary generator (rewrite as a `dict` comprehensio 14 14 | 15 15 | def f(x): -C402.py:13:5: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:13:5: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' @@ -205,7 +205,7 @@ C402.py:13:5: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension 15 15 | def f(x): 16 16 | return x -C402.py:13:38: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:13:38: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 12 | f'{dict((x, x) for x in range(3)) | dict((x, x) for x in range(3))}' 13 | f'{ dict((x, x) for x in range(3)) | dict((x, x) for x in range(3)) }' @@ -225,7 +225,7 @@ C402.py:13:38: C402 [**] Unnecessary generator (rewrite as a `dict` comprehensio 15 15 | def f(x): 16 16 | return x -C402.py:18:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:18:16: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 16 | return x 17 | @@ -246,7 +246,7 @@ C402.py:18:16: C402 [**] Unnecessary generator (rewrite as a `dict` comprehensio 20 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 21 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) -C402.py:21:1: C402 [**] Unnecessary generator (rewrite as a `dict` comprehension) +C402.py:21:1: C402 [*] Unnecessary generator (rewrite as a `dict` comprehension) | 20 | # Regression test for: https://github.com/astral-sh/ruff/issues/7086 21 | dict((k,v)for k,v in d.iteritems() if k in only_args) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap index dc91926640913a..9091d9352bbb33 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C403.py:1:5: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:1:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 1 | s = set([x for x in range(3)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ C403 @@ -17,7 +17,7 @@ C403.py:1:5: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comp 3 3 | [x for x in range(3)] 4 4 | ) -C403.py:2:5: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:2:5: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 1 | s = set([x for x in range(3)]) 2 | s = set( @@ -42,7 +42,7 @@ C403.py:2:5: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comp 6 6 | s = f"{set([x for x in 'ab'])}" 7 7 | s = f'{set([x for x in "ab"])}' -C403.py:6:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:6:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 4 | ) 5 | @@ -62,7 +62,7 @@ C403.py:6:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comp 8 8 | 9 9 | def f(x): -C403.py:7:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:7:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 6 | s = f"{set([x for x in 'ab'])}" 7 | s = f'{set([x for x in "ab"])}' @@ -82,7 +82,7 @@ C403.py:7:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comp 9 9 | def f(x): 10 10 | return x -C403.py:12:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:12:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 10 | return x 11 | @@ -103,7 +103,7 @@ C403.py:12:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` com 14 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -C403.py:14:9: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:14:9: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 12 | s = f"{set([f(x) for x in 'ab'])}" 13 | @@ -121,7 +121,7 @@ C403.py:14:9: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` com 14 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab']) }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -C403.py:14:34: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:14:34: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 12 | s = f"{set([f(x) for x in 'ab'])}" 13 | @@ -139,7 +139,7 @@ C403.py:14:34: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` co 14 |+s = f"{ set([x for x in 'ab']) | {x for x in 'ab'} }" 15 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" -C403.py:15:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:15:8: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" @@ -154,7 +154,7 @@ C403.py:15:8: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` com 15 |-s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" 15 |+s = f"{ {x for x in 'ab'} | set([x for x in 'ab'])}" -C403.py:15:33: C403 [**] Unnecessary `list` comprehension (rewrite as a `set` comprehension) +C403.py:15:33: C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension) | 14 | s = f"{ set([x for x in 'ab']) | set([x for x in 'ab']) }" 15 | s = f"{set([x for x in 'ab']) | set([x for x in 'ab'])}" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap index 88626167096680..d5bfe8a3a9ab58 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C404_C404.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C404.py:1:1: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:1:1: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 1 | dict([(i, i) for i in range(3)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C404 @@ -16,7 +16,7 @@ C404.py:1:1: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` com 3 3 | 4 4 | def f(x): -C404.py:7:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:7:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 5 | return x 6 | @@ -37,7 +37,7 @@ C404.py:7:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` com 9 9 | f"{dict([(s, s) for s in 'ab'])}" 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" -C404.py:8:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:8:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 7 | f'{dict([(s,s) for s in "ab"])}' 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -57,7 +57,7 @@ C404.py:8:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` com 10 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 11 | -C404.py:9:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:9:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 7 | f'{dict([(s,s) for s in "ab"])}' 8 | f"{dict([(s,s) for s in 'ab'])}" @@ -77,7 +77,7 @@ C404.py:9:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` com 11 11 | 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' -C404.py:10:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:10:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 8 | f"{dict([(s,s) for s in 'ab'])}" 9 | f"{dict([(s, s) for s in 'ab'])}" @@ -98,7 +98,7 @@ C404.py:10:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` co 12 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' -C404.py:12:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:12:4: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 | @@ -118,7 +118,7 @@ C404.py:12:4: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` co 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -C404.py:12:34: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:12:34: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 10 | f"{dict([(s,f(s)) for s in 'ab'])}" 11 | @@ -138,7 +138,7 @@ C404.py:12:34: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` c 14 14 | 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 -C404.py:13:5: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:13:5: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' @@ -158,7 +158,7 @@ C404.py:13:5: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` co 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) -C404.py:13:35: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:13:35: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 12 | f'{dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"])}' 13 | f'{ dict([(s,s) for s in "ab"]) | dict([(s,s) for s in "ab"]) }' @@ -178,7 +178,7 @@ C404.py:13:35: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` c 15 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) -C404.py:16:14: C404 [**] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) +C404.py:16:14: C404 [*] Unnecessary `list` comprehension (rewrite as a `dict` comprehension) | 15 | # Regression test for: https://github.com/astral-sh/ruff/issues/7087 16 | saved.append(dict([(k, v)for k,v in list(unique_instance.__dict__.items()) if k in [f.name for f in unique_instance._meta.fields]])) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap index 2ed3481b2f58a4..1ae0f55d0d505c 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C405_C405.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C405.py:1:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:1:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 1 | set([1, 2]) | ^^^^^^^^^^^ C405 @@ -17,7 +17,7 @@ C405.py:1:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 3 3 | set([]) 4 4 | set(()) -C405.py:2:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:2:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 1 | set([1, 2]) 2 | set((1, 2)) @@ -35,7 +35,7 @@ C405.py:2:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) 4 4 | set(()) 5 5 | set() -C405.py:3:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:3:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 1 | set([1, 2]) 2 | set((1, 2)) @@ -55,7 +55,7 @@ C405.py:3:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 5 5 | set() 6 6 | set((1,)) -C405.py:4:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:4:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 2 | set((1, 2)) 3 | set([]) @@ -77,7 +77,7 @@ C405.py:4:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) 7 7 | set(( 8 8 | 1, -C405.py:6:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:6:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 4 | set(()) 5 | set() @@ -98,7 +98,7 @@ C405.py:6:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) 8 8 | 1, 9 9 | )) -C405.py:7:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:7:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 5 | set() 6 | set((1,)) @@ -124,7 +124,7 @@ C405.py:7:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) 11 11 | 1, 12 12 | ]) -C405.py:10:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:10:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 8 | 1, 9 | )) @@ -150,7 +150,7 @@ C405.py:10:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 14 14 | (1,) 15 15 | ) -C405.py:13:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) +C405.py:13:1: C405 [*] Unnecessary `tuple` literal (rewrite as a `set` literal) | 11 | 1, 12 | ]) @@ -175,7 +175,7 @@ C405.py:13:1: C405 [**] Unnecessary `tuple` literal (rewrite as a `set` literal) 17 15 | [1,] 18 16 | ) -C405.py:16:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:16:1: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 14 | (1,) 15 | ) @@ -200,7 +200,7 @@ C405.py:16:1: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 20 18 | f"{set(['a', 'b'])}" 21 19 | f'{set(["a", "b"])}' -C405.py:19:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:19:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 17 | [1,] 18 | ) @@ -221,7 +221,7 @@ C405.py:19:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 21 21 | f'{set(["a", "b"])}' 22 22 | -C405.py:20:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:20:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 18 | ) 19 | f"{set([1,2,3])}" @@ -241,7 +241,7 @@ C405.py:20:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 22 22 | 23 23 | f"{set(['a', 'b']) - set(['a'])}" -C405.py:21:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:21:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 19 | f"{set([1,2,3])}" 20 | f"{set(['a', 'b'])}" @@ -262,7 +262,7 @@ C405.py:21:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 23 23 | f"{set(['a', 'b']) - set(['a'])}" 24 24 | f"{ set(['a', 'b']) - set(['a']) }" -C405.py:23:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:23:4: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 21 | f'{set(["a", "b"])}' 22 | @@ -283,7 +283,7 @@ C405.py:23:4: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:23:22: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:23:22: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 21 | f'{set(["a", "b"])}' 22 | @@ -304,7 +304,7 @@ C405.py:23:22: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:24:5: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:24:5: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -323,7 +323,7 @@ C405.py:24:5: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:24:23: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:24:23: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -342,7 +342,7 @@ C405.py:24:23: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 25 25 | f"a {set(['a', 'b']) - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:25:6: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:25:6: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -360,7 +360,7 @@ C405.py:25:6: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 25 |+f"a { {'a', 'b'} - set(['a'])} b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:25:24: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:25:24: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 23 | f"{set(['a', 'b']) - set(['a'])}" 24 | f"{ set(['a', 'b']) - set(['a']) }" @@ -378,7 +378,7 @@ C405.py:25:24: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 25 |+f"a {set(['a', 'b']) - {'a'} } b" 26 26 | f"a { set(['a', 'b']) - set(['a']) } b" -C405.py:26:7: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:26:7: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 | f"a {set(['a', 'b']) - set(['a'])} b" @@ -394,7 +394,7 @@ C405.py:26:7: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) 26 |-f"a { set(['a', 'b']) - set(['a']) } b" 26 |+f"a { {'a', 'b'} - set(['a']) } b" -C405.py:26:25: C405 [**] Unnecessary `list` literal (rewrite as a `set` literal) +C405.py:26:25: C405 [*] Unnecessary `list` literal (rewrite as a `set` literal) | 24 | f"{ set(['a', 'b']) - set(['a']) }" 25 | f"a {set(['a', 'b']) - set(['a'])} b" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap index 3fc6d154f78299..f8983c16830b55 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C406_C406.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C406.py:1:6: C406 [**] Unnecessary `list` literal (rewrite as a `dict` literal) +C406.py:1:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | 1 | d1 = dict([(1, 2)]) | ^^^^^^^^^^^^^^ C406 @@ -17,7 +17,7 @@ C406.py:1:6: C406 [**] Unnecessary `list` literal (rewrite as a `dict` literal) 3 3 | d3 = dict([]) 4 4 | d4 = dict(()) -C406.py:2:6: C406 [**] Unnecessary `tuple` literal (rewrite as a `dict` literal) +C406.py:2:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | 1 | d1 = dict([(1, 2)]) 2 | d2 = dict(((1, 2),)) @@ -35,7 +35,7 @@ C406.py:2:6: C406 [**] Unnecessary `tuple` literal (rewrite as a `dict` literal) 4 4 | d4 = dict(()) 5 5 | d5 = dict() -C406.py:3:6: C406 [**] Unnecessary `list` literal (rewrite as a `dict` literal) +C406.py:3:6: C406 [*] Unnecessary `list` literal (rewrite as a `dict` literal) | 1 | d1 = dict([(1, 2)]) 2 | d2 = dict(((1, 2),)) @@ -54,7 +54,7 @@ C406.py:3:6: C406 [**] Unnecessary `list` literal (rewrite as a `dict` literal) 4 4 | d4 = dict(()) 5 5 | d5 = dict() -C406.py:4:6: C406 [**] Unnecessary `tuple` literal (rewrite as a `dict` literal) +C406.py:4:6: C406 [*] Unnecessary `tuple` literal (rewrite as a `dict` literal) | 2 | d2 = dict(((1, 2),)) 3 | d3 = dict([]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap index 1a1897481a4bb1..09904c22e26504 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C408.py:1:5: C408 [**] Unnecessary `tuple` call (rewrite as a literal) +C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | 1 | t = tuple() | ^^^^^^^ C408 @@ -17,7 +17,7 @@ C408.py:1:5: C408 [**] Unnecessary `tuple` call (rewrite as a literal) 3 3 | d1 = dict() 4 4 | d2 = dict(a=1) -C408.py:2:5: C408 [**] Unnecessary `list` call (rewrite as a literal) +C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | 1 | t = tuple() 2 | l = list() @@ -35,7 +35,7 @@ C408.py:2:5: C408 [**] Unnecessary `list` call (rewrite as a literal) 4 4 | d2 = dict(a=1) 5 5 | d3 = dict(**d2) -C408.py:3:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 1 | t = tuple() 2 | l = list() @@ -55,7 +55,7 @@ C408.py:3:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) 5 5 | d3 = dict(**d2) 6 6 | -C408.py:4:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:4:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 2 | l = list() 3 | d1 = dict() @@ -75,7 +75,7 @@ C408.py:4:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) 6 6 | 7 7 | -C408.py:14:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:14:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 12 | a = list() 13 | @@ -96,7 +96,7 @@ C408.py:14:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) 16 16 | f"{dict()}" 17 17 | f"a {dict()} b" -C408.py:15:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:15:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -116,7 +116,7 @@ C408.py:15:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) 17 17 | f"a {dict()} b" 18 18 | -C408.py:16:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -136,7 +136,7 @@ C408.py:16:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" -C408.py:17:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 15 | f'{dict(x="y")}' 16 | f"{dict()}" @@ -157,7 +157,7 @@ C408.py:17:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) 19 19 | f"{dict(x='y') | dict(y='z')}" 20 20 | f"{ dict(x='y') | dict(y='z') }" -C408.py:19:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:19:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 17 | f"a {dict()} b" 18 | @@ -178,7 +178,7 @@ C408.py:19:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:19:18: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:19:18: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 17 | f"a {dict()} b" 18 | @@ -199,7 +199,7 @@ C408.py:19:18: C408 [**] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:20:5: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:20:5: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -218,7 +218,7 @@ C408.py:20:5: C408 [**] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:20:19: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:20:19: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -237,7 +237,7 @@ C408.py:20:19: C408 [**] Unnecessary `dict` call (rewrite as a literal) 21 21 | f"a {dict(x='y') | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:21:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:21:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -255,7 +255,7 @@ C408.py:21:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) 21 |+f"a { {'x': 'y'} | dict(y='z')} b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:21:20: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:21:20: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 19 | f"{dict(x='y') | dict(y='z')}" 20 | f"{ dict(x='y') | dict(y='z') }" @@ -273,7 +273,7 @@ C408.py:21:20: C408 [**] Unnecessary `dict` call (rewrite as a literal) 21 |+f"a {dict(x='y') | {'y': 'z'} } b" 22 22 | f"a { dict(x='y') | dict(y='z') } b" -C408.py:22:7: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:22:7: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 20 | f"{ dict(x='y') | dict(y='z') }" 21 | f"a {dict(x='y') | dict(y='z')} b" @@ -289,7 +289,7 @@ C408.py:22:7: C408 [**] Unnecessary `dict` call (rewrite as a literal) 22 |-f"a { dict(x='y') | dict(y='z') } b" 22 |+f"a { {'x': 'y'} | dict(y='z') } b" -C408.py:22:21: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:22:21: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 20 | f"{ dict(x='y') | dict(y='z') }" 21 | f"a {dict(x='y') | dict(y='z')} b" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap index 5f4c704cd4d3e3..7032a8c4511f4f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C408_C408.py_allow_dict_calls_with_keyword_arguments.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C408.py:1:5: C408 [**] Unnecessary `tuple` call (rewrite as a literal) +C408.py:1:5: C408 [*] Unnecessary `tuple` call (rewrite as a literal) | 1 | t = tuple() | ^^^^^^^ C408 @@ -17,7 +17,7 @@ C408.py:1:5: C408 [**] Unnecessary `tuple` call (rewrite as a literal) 3 3 | d1 = dict() 4 4 | d2 = dict(a=1) -C408.py:2:5: C408 [**] Unnecessary `list` call (rewrite as a literal) +C408.py:2:5: C408 [*] Unnecessary `list` call (rewrite as a literal) | 1 | t = tuple() 2 | l = list() @@ -35,7 +35,7 @@ C408.py:2:5: C408 [**] Unnecessary `list` call (rewrite as a literal) 4 4 | d2 = dict(a=1) 5 5 | d3 = dict(**d2) -C408.py:3:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:3:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 1 | t = tuple() 2 | l = list() @@ -55,7 +55,7 @@ C408.py:3:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) 5 5 | d3 = dict(**d2) 6 6 | -C408.py:16:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:16:4: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 14 | f"{dict(x='y')}" 15 | f'{dict(x="y")}' @@ -75,7 +75,7 @@ C408.py:16:4: C408 [**] Unnecessary `dict` call (rewrite as a literal) 18 18 | 19 19 | f"{dict(x='y') | dict(y='z')}" -C408.py:17:6: C408 [**] Unnecessary `dict` call (rewrite as a literal) +C408.py:17:6: C408 [*] Unnecessary `dict` call (rewrite as a literal) | 15 | f'{dict(x="y")}' 16 | f"{dict()}" diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap index 455b0d3ccff73f..962bd5c19a88c9 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C409_C409.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C409.py:1:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +C409.py:1:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 1 | t1 = tuple([]) | ^^^^^^^^^ C409 @@ -17,7 +17,7 @@ C409.py:1:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite a 3 3 | t3 = tuple((1, 2)) 4 4 | t4 = tuple([ -C409.py:2:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +C409.py:2:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 1 | t1 = tuple([]) 2 | t2 = tuple([1, 2]) @@ -35,7 +35,7 @@ C409.py:2:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite a 4 4 | t4 = tuple([ 5 5 | 1, -C409.py:3:6: C409 [**] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +C409.py:3:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | 1 | t1 = tuple([]) 2 | t2 = tuple([1, 2]) @@ -55,7 +55,7 @@ C409.py:3:6: C409 [**] Unnecessary `tuple` literal passed to `tuple()` (remove t 5 5 | 1, 6 6 | 2 -C409.py:4:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) +C409.py:4:6: C409 [*] Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal) | 2 | t2 = tuple([1, 2]) 3 | t3 = tuple((1, 2)) @@ -84,7 +84,7 @@ C409.py:4:6: C409 [**] Unnecessary `list` literal passed to `tuple()` (rewrite a 9 9 | (1, 2) 10 10 | ) -C409.py:8:6: C409 [**] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) +C409.py:8:6: C409 [*] Unnecessary `tuple` literal passed to `tuple()` (remove the outer call to `tuple()`) | 6 | 2 7 | ]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap index a448f1e5f312c3..997e8547578aa4 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C410_C410.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C410.py:1:6: C410 [**] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) +C410.py:1:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | 1 | l1 = list([1, 2]) | ^^^^^^^^^^^^ C410 @@ -17,7 +17,7 @@ C410.py:1:6: C410 [**] Unnecessary `list` literal passed to `list()` (remove the 3 3 | l3 = list([]) 4 4 | l4 = list(()) -C410.py:2:6: C410 [**] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) +C410.py:2:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) | 1 | l1 = list([1, 2]) 2 | l2 = list((1, 2)) @@ -34,7 +34,7 @@ C410.py:2:6: C410 [**] Unnecessary `tuple` literal passed to `list()` (rewrite a 3 3 | l3 = list([]) 4 4 | l4 = list(()) -C410.py:3:6: C410 [**] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) +C410.py:3:6: C410 [*] Unnecessary `list` literal passed to `list()` (remove the outer call to `list()`) | 1 | l1 = list([1, 2]) 2 | l2 = list((1, 2)) @@ -51,7 +51,7 @@ C410.py:3:6: C410 [**] Unnecessary `list` literal passed to `list()` (remove the 3 |+l3 = [] 4 4 | l4 = list(()) -C410.py:4:6: C410 [**] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) +C410.py:4:6: C410 [*] Unnecessary `tuple` literal passed to `list()` (rewrite as a `list` literal) | 2 | l2 = list((1, 2)) 3 | l3 = list([]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap index 15fff6b2d3b01c..1878f091a7ced0 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C411_C411.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C411.py:2:1: C411 [**] Unnecessary `list` call (remove the outer call to `list()`) +C411.py:2:1: C411 [*] Unnecessary `list` call (remove the outer call to `list()`) | 1 | x = [1, 2, 3] 2 | list([i for i in x]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap index 0c5bdbf331c586..ae89b1802aa2ec 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C413_C413.py.snap @@ -21,7 +21,7 @@ C413.py:3:1: C413 [*] Unnecessary `list` call around `sorted()` 5 5 | reversed(sorted(x, key=lambda e: e)) 6 6 | reversed(sorted(x, reverse=True)) -C413.py:4:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:4:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 2 | list(x) 3 | list(sorted(x)) @@ -42,7 +42,7 @@ C413.py:4:1: C413 [**] Unnecessary `reversed` call around `sorted()` 6 6 | reversed(sorted(x, reverse=True)) 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) -C413.py:5:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:5:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 3 | list(sorted(x)) 4 | reversed(sorted(x)) @@ -63,7 +63,7 @@ C413.py:5:1: C413 [**] Unnecessary `reversed` call around `sorted()` 7 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) -C413.py:6:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:6:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 4 | reversed(sorted(x)) 5 | reversed(sorted(x, key=lambda e: e)) @@ -84,7 +84,7 @@ C413.py:6:1: C413 [**] Unnecessary `reversed` call around `sorted()` 8 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 9 | reversed(sorted(x, reverse=False)) -C413.py:7:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:7:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 5 | reversed(sorted(x, key=lambda e: e)) 6 | reversed(sorted(x, reverse=True)) @@ -105,7 +105,7 @@ C413.py:7:1: C413 [**] Unnecessary `reversed` call around `sorted()` 9 9 | reversed(sorted(x, reverse=False)) 10 10 | reversed(sorted(x, reverse=x)) -C413.py:8:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:8:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 6 | reversed(sorted(x, reverse=True)) 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) @@ -126,7 +126,7 @@ C413.py:8:1: C413 [**] Unnecessary `reversed` call around `sorted()` 10 10 | reversed(sorted(x, reverse=x)) 11 11 | reversed(sorted(x, reverse=not x)) -C413.py:9:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:9:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 7 | reversed(sorted(x, key=lambda e: e, reverse=True)) 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) @@ -147,7 +147,7 @@ C413.py:9:1: C413 [**] Unnecessary `reversed` call around `sorted()` 11 11 | reversed(sorted(x, reverse=not x)) 12 12 | -C413.py:10:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:10:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 8 | reversed(sorted(x, reverse=True, key=lambda e: e)) 9 | reversed(sorted(x, reverse=False)) @@ -167,7 +167,7 @@ C413.py:10:1: C413 [**] Unnecessary `reversed` call around `sorted()` 12 12 | 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 -C413.py:11:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:11:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 9 | reversed(sorted(x, reverse=False)) 10 | reversed(sorted(x, reverse=x)) @@ -188,7 +188,7 @@ C413.py:11:1: C413 [**] Unnecessary `reversed` call around `sorted()` 13 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 14 | reversed(sorted(i for i in range(42))) -C413.py:14:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:14:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 | reversed(sorted(i for i in range(42))) @@ -207,7 +207,7 @@ C413.py:14:1: C413 [**] Unnecessary `reversed` call around `sorted()` 16 16 | 17 17 | -C413.py:15:1: C413 [**] Unnecessary `reversed` call around `sorted()` +C413.py:15:1: C413 [*] Unnecessary `reversed` call around `sorted()` | 13 | # Regression test for: https://github.com/astral-sh/ruff/issues/7289 14 | reversed(sorted(i for i in range(42))) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap index a13cdbe849508f..396a8d26ab0eb5 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C414_C414.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C414.py:2:1: C414 [**] Unnecessary `list` call within `list()` +C414.py:2:1: C414 [*] Unnecessary `list` call within `list()` | 1 | x = [1, 2, 3] 2 | list(list(x)) @@ -19,7 +19,7 @@ C414.py:2:1: C414 [**] Unnecessary `list` call within `list()` 4 4 | tuple(list(x)) 5 5 | tuple(tuple(x)) -C414.py:3:1: C414 [**] Unnecessary `tuple` call within `list()` +C414.py:3:1: C414 [*] Unnecessary `tuple` call within `list()` | 1 | x = [1, 2, 3] 2 | list(list(x)) @@ -39,7 +39,7 @@ C414.py:3:1: C414 [**] Unnecessary `tuple` call within `list()` 5 5 | tuple(tuple(x)) 6 6 | set(set(x)) -C414.py:4:1: C414 [**] Unnecessary `list` call within `tuple()` +C414.py:4:1: C414 [*] Unnecessary `list` call within `tuple()` | 2 | list(list(x)) 3 | list(tuple(x)) @@ -60,7 +60,7 @@ C414.py:4:1: C414 [**] Unnecessary `list` call within `tuple()` 6 6 | set(set(x)) 7 7 | set(list(x)) -C414.py:5:1: C414 [**] Unnecessary `tuple` call within `tuple()` +C414.py:5:1: C414 [*] Unnecessary `tuple` call within `tuple()` | 3 | list(tuple(x)) 4 | tuple(list(x)) @@ -81,7 +81,7 @@ C414.py:5:1: C414 [**] Unnecessary `tuple` call within `tuple()` 7 7 | set(list(x)) 8 8 | set(tuple(x)) -C414.py:6:1: C414 [**] Unnecessary `set` call within `set()` +C414.py:6:1: C414 [*] Unnecessary `set` call within `set()` | 4 | tuple(list(x)) 5 | tuple(tuple(x)) @@ -102,7 +102,7 @@ C414.py:6:1: C414 [**] Unnecessary `set` call within `set()` 8 8 | set(tuple(x)) 9 9 | set(sorted(x)) -C414.py:7:1: C414 [**] Unnecessary `list` call within `set()` +C414.py:7:1: C414 [*] Unnecessary `list` call within `set()` | 5 | tuple(tuple(x)) 6 | set(set(x)) @@ -123,7 +123,7 @@ C414.py:7:1: C414 [**] Unnecessary `list` call within `set()` 9 9 | set(sorted(x)) 10 10 | set(sorted(x, key=lambda y: y)) -C414.py:8:1: C414 [**] Unnecessary `tuple` call within `set()` +C414.py:8:1: C414 [*] Unnecessary `tuple` call within `set()` | 6 | set(set(x)) 7 | set(list(x)) @@ -144,7 +144,7 @@ C414.py:8:1: C414 [**] Unnecessary `tuple` call within `set()` 10 10 | set(sorted(x, key=lambda y: y)) 11 11 | set(reversed(x)) -C414.py:9:1: C414 [**] Unnecessary `sorted` call within `set()` +C414.py:9:1: C414 [*] Unnecessary `sorted` call within `set()` | 7 | set(list(x)) 8 | set(tuple(x)) @@ -165,7 +165,7 @@ C414.py:9:1: C414 [**] Unnecessary `sorted` call within `set()` 11 11 | set(reversed(x)) 12 12 | sorted(list(x)) -C414.py:10:1: C414 [**] Unnecessary `sorted` call within `set()` +C414.py:10:1: C414 [*] Unnecessary `sorted` call within `set()` | 8 | set(tuple(x)) 9 | set(sorted(x)) @@ -186,7 +186,7 @@ C414.py:10:1: C414 [**] Unnecessary `sorted` call within `set()` 12 12 | sorted(list(x)) 13 13 | sorted(tuple(x)) -C414.py:11:1: C414 [**] Unnecessary `reversed` call within `set()` +C414.py:11:1: C414 [*] Unnecessary `reversed` call within `set()` | 9 | set(sorted(x)) 10 | set(sorted(x, key=lambda y: y)) @@ -207,7 +207,7 @@ C414.py:11:1: C414 [**] Unnecessary `reversed` call within `set()` 13 13 | sorted(tuple(x)) 14 14 | sorted(sorted(x)) -C414.py:12:1: C414 [**] Unnecessary `list` call within `sorted()` +C414.py:12:1: C414 [*] Unnecessary `list` call within `sorted()` | 10 | set(sorted(x, key=lambda y: y)) 11 | set(reversed(x)) @@ -228,7 +228,7 @@ C414.py:12:1: C414 [**] Unnecessary `list` call within `sorted()` 14 14 | sorted(sorted(x)) 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) -C414.py:13:1: C414 [**] Unnecessary `tuple` call within `sorted()` +C414.py:13:1: C414 [*] Unnecessary `tuple` call within `sorted()` | 11 | set(reversed(x)) 12 | sorted(list(x)) @@ -249,7 +249,7 @@ C414.py:13:1: C414 [**] Unnecessary `tuple` call within `sorted()` 15 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 16 | sorted(sorted(x, reverse=True), reverse=True) -C414.py:14:1: C414 [**] Unnecessary `sorted` call within `sorted()` +C414.py:14:1: C414 [*] Unnecessary `sorted` call within `sorted()` | 12 | sorted(list(x)) 13 | sorted(tuple(x)) @@ -270,7 +270,7 @@ C414.py:14:1: C414 [**] Unnecessary `sorted` call within `sorted()` 16 16 | sorted(sorted(x, reverse=True), reverse=True) 17 17 | sorted(reversed(x)) -C414.py:15:1: C414 [**] Unnecessary `sorted` call within `sorted()` +C414.py:15:1: C414 [*] Unnecessary `sorted` call within `sorted()` | 13 | sorted(tuple(x)) 14 | sorted(sorted(x)) @@ -291,7 +291,7 @@ C414.py:15:1: C414 [**] Unnecessary `sorted` call within `sorted()` 17 17 | sorted(reversed(x)) 18 18 | sorted(list(x), key=lambda y: y) -C414.py:16:1: C414 [**] Unnecessary `sorted` call within `sorted()` +C414.py:16:1: C414 [*] Unnecessary `sorted` call within `sorted()` | 14 | sorted(sorted(x)) 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) @@ -312,7 +312,7 @@ C414.py:16:1: C414 [**] Unnecessary `sorted` call within `sorted()` 18 18 | sorted(list(x), key=lambda y: y) 19 19 | tuple( -C414.py:17:1: C414 [**] Unnecessary `reversed` call within `sorted()` +C414.py:17:1: C414 [*] Unnecessary `reversed` call within `sorted()` | 15 | sorted(sorted(x, key=foo, reverse=False), reverse=False, key=foo) 16 | sorted(sorted(x, reverse=True), reverse=True) @@ -333,7 +333,7 @@ C414.py:17:1: C414 [**] Unnecessary `reversed` call within `sorted()` 19 19 | tuple( 20 20 | list( -C414.py:18:1: C414 [**] Unnecessary `list` call within `sorted()` +C414.py:18:1: C414 [*] Unnecessary `list` call within `sorted()` | 16 | sorted(sorted(x, reverse=True), reverse=True) 17 | sorted(reversed(x)) @@ -354,7 +354,7 @@ C414.py:18:1: C414 [**] Unnecessary `list` call within `sorted()` 20 20 | list( 21 21 | [x, 3, "hell"\ -C414.py:19:1: C414 [**] Unnecessary `list` call within `tuple()` +C414.py:19:1: C414 [*] Unnecessary `list` call within `tuple()` | 17 | sorted(reversed(x)) 18 | sorted(list(x), key=lambda y: y) @@ -383,7 +383,7 @@ C414.py:19:1: C414 [**] Unnecessary `list` call within `tuple()` 25 23 | set(set()) 26 24 | set(list()) -C414.py:25:1: C414 [**] Unnecessary `set` call within `set()` +C414.py:25:1: C414 [*] Unnecessary `set` call within `set()` | 23 | ) 24 | ) @@ -404,7 +404,7 @@ C414.py:25:1: C414 [**] Unnecessary `set` call within `set()` 27 27 | set(tuple()) 28 28 | sorted(reversed()) -C414.py:26:1: C414 [**] Unnecessary `list` call within `set()` +C414.py:26:1: C414 [*] Unnecessary `list` call within `set()` | 24 | ) 25 | set(set()) @@ -425,7 +425,7 @@ C414.py:26:1: C414 [**] Unnecessary `list` call within `set()` 28 28 | sorted(reversed()) 29 29 | -C414.py:27:1: C414 [**] Unnecessary `tuple` call within `set()` +C414.py:27:1: C414 [*] Unnecessary `tuple` call within `set()` | 25 | set(set()) 26 | set(list()) @@ -445,7 +445,7 @@ C414.py:27:1: C414 [**] Unnecessary `tuple` call within `set()` 29 29 | 30 30 | # Nested sorts with differing keyword arguments. Not flagged. -C414.py:28:1: C414 [**] Unnecessary `reversed` call within `sorted()` +C414.py:28:1: C414 [*] Unnecessary `reversed` call within `sorted()` | 26 | set(list()) 27 | set(tuple()) @@ -466,7 +466,7 @@ C414.py:28:1: C414 [**] Unnecessary `reversed` call within `sorted()` 30 30 | # Nested sorts with differing keyword arguments. Not flagged. 31 31 | sorted(sorted(x, key=lambda y: y)) -C414.py:37:27: C414 [**] Unnecessary `list` call within `sorted()` +C414.py:37:27: C414 [*] Unnecessary `list` call within `sorted()` | 36 | # Preserve trailing comments. 37 | xxxxxxxxxxx_xxxxx_xxxxx = sorted( @@ -492,7 +492,7 @@ C414.py:37:27: C414 [**] Unnecessary `list` call within `sorted()` 40 40 | # xx xxxx xxxxxxx xxxx xxx xxxxxxxx Nxxx 41 41 | key=lambda xxxxx: xxxxx or "", -C414.py:44:27: C414 [**] Unnecessary `list` call within `sorted()` +C414.py:44:27: C414 [*] Unnecessary `list` call within `sorted()` | 42 | ) 43 | diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap index d95dd77ae3e6c8..f7ea1bfbbc3dcb 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C416_C416.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C416.py:6:1: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`) +C416.py:6:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | 4 | d = {"a": 1, "b": 2, "c": 3} 5 | @@ -22,7 +22,7 @@ C416.py:6:1: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`) 8 8 | {k: v for k, v in y} 9 9 | {k: v for k, v in d.items()} -C416.py:7:1: C416 [**] Unnecessary `set` comprehension (rewrite using `set()`) +C416.py:7:1: C416 [*] Unnecessary `set` comprehension (rewrite using `set()`) | 6 | [i for i in x] 7 | {i for i in x} @@ -42,7 +42,7 @@ C416.py:7:1: C416 [**] Unnecessary `set` comprehension (rewrite using `set()`) 9 9 | {k: v for k, v in d.items()} 10 10 | [(k, v) for k, v in d.items()] -C416.py:8:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`) +C416.py:8:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | 6 | [i for i in x] 7 | {i for i in x} @@ -63,7 +63,7 @@ C416.py:8:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`) 10 10 | [(k, v) for k, v in d.items()] 11 11 | {k: (a, b) for k, (a, b) in d.items()} -C416.py:9:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`) +C416.py:9:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | 7 | {i for i in x} 8 | {k: v for k, v in y} @@ -84,7 +84,7 @@ C416.py:9:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`) 11 11 | {k: (a, b) for k, (a, b) in d.items()} 12 12 | -C416.py:10:1: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`) +C416.py:10:1: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | 8 | {k: v for k, v in y} 9 | {k: v for k, v in d.items()} @@ -104,7 +104,7 @@ C416.py:10:1: C416 [**] Unnecessary `list` comprehension (rewrite using `list()` 12 12 | 13 13 | [i for i, in z] -C416.py:11:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()`) +C416.py:11:1: C416 [*] Unnecessary `dict` comprehension (rewrite using `dict()`) | 9 | {k: v for k, v in d.items()} 10 | [(k, v) for k, v in d.items()] @@ -125,7 +125,7 @@ C416.py:11:1: C416 [**] Unnecessary `dict` comprehension (rewrite using `dict()` 13 13 | [i for i, in z] 14 14 | [i for i, j in y] -C416.py:24:70: C416 [**] Unnecessary `list` comprehension (rewrite using `list()`) +C416.py:24:70: C416 [*] Unnecessary `list` comprehension (rewrite using `list()`) | 23 | # Regression test for: https://github.com/astral-sh/ruff/issues/7196 24 | any(len(symbol_table.get_by_type(symbol_type)) > 0 for symbol_type in[t for t in SymbolType]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap index f17e79e70c8819..1418d486ed6185 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C417_C417.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C417.py:3:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:3:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 1 | # Errors. 2 | nums = [1, 2, 3] @@ -21,7 +21,7 @@ C417.py:3:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expres 5 5 | list(map(lambda x: x * 2, nums)) 6 6 | set(map(lambda x: x % 2 == 0, nums)) -C417.py:4:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:4:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 2 | nums = [1, 2, 3] 3 | map(lambda x: x + 1, nums) @@ -42,7 +42,7 @@ C417.py:4:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expres 6 6 | set(map(lambda x: x % 2 == 0, nums)) 7 7 | dict(map(lambda v: (v, v**2), nums)) -C417.py:5:1: C417 [**] Unnecessary `map` usage (rewrite using a `list` comprehension) +C417.py:5:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension) | 3 | map(lambda x: x + 1, nums) 4 | map(lambda x: str(x), nums) @@ -63,7 +63,7 @@ C417.py:5:1: C417 [**] Unnecessary `map` usage (rewrite using a `list` comprehen 7 7 | dict(map(lambda v: (v, v**2), nums)) 8 8 | dict(map(lambda v: [v, v**2], nums)) -C417.py:6:1: C417 [**] Unnecessary `map` usage (rewrite using a `set` comprehension) +C417.py:6:1: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension) | 4 | map(lambda x: str(x), nums) 5 | list(map(lambda x: x * 2, nums)) @@ -84,7 +84,7 @@ C417.py:6:1: C417 [**] Unnecessary `map` usage (rewrite using a `set` comprehens 8 8 | dict(map(lambda v: [v, v**2], nums)) 9 9 | map(lambda: "const", nums) -C417.py:7:1: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension) +C417.py:7:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 5 | list(map(lambda x: x * 2, nums)) 6 | set(map(lambda x: x % 2 == 0, nums)) @@ -105,7 +105,7 @@ C417.py:7:1: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehen 9 9 | map(lambda: "const", nums) 10 10 | map(lambda _: 3.0, nums) -C417.py:8:1: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension) +C417.py:8:1: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 6 | set(map(lambda x: x % 2 == 0, nums)) 7 | dict(map(lambda v: (v, v**2), nums)) @@ -126,7 +126,7 @@ C417.py:8:1: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehen 10 10 | map(lambda _: 3.0, nums) 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) -C417.py:9:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:9:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 7 | dict(map(lambda v: (v, v**2), nums)) 8 | dict(map(lambda v: [v, v**2], nums)) @@ -147,7 +147,7 @@ C417.py:9:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expres 11 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 12 | all(map(lambda v: isinstance(v, dict), nums)) -C417.py:10:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:10:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 8 | dict(map(lambda v: [v, v**2], nums)) 9 | map(lambda: "const", nums) @@ -168,7 +168,7 @@ C417.py:10:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expre 12 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 13 | filter(func, map(lambda v: v, nums)) -C417.py:11:13: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:11:13: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 9 | map(lambda: "const", nums) 10 | map(lambda _: 3.0, nums) @@ -189,7 +189,7 @@ C417.py:11:13: C417 [**] Unnecessary `map` usage (rewrite using a generator expr 13 13 | filter(func, map(lambda v: v, nums)) 14 14 | list(map(lambda x, y: x * y, nums)) -C417.py:12:5: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:12:5: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 10 | map(lambda _: 3.0, nums) 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) @@ -210,7 +210,7 @@ C417.py:12:5: C417 [**] Unnecessary `map` usage (rewrite using a generator expre 14 14 | list(map(lambda x, y: x * y, nums)) 15 15 | -C417.py:13:14: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:13:14: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 11 | _ = "".join(map(lambda x: x in nums and "1" or "0", range(123))) 12 | all(map(lambda v: isinstance(v, dict), nums)) @@ -230,7 +230,7 @@ C417.py:13:14: C417 [**] Unnecessary `map` usage (rewrite using a generator expr 15 15 | 16 16 | # When inside f-string, then the fix should be surrounded by whitespace -C417.py:14:1: C417 [**] Unnecessary `map` usage (rewrite using a `list` comprehension) +C417.py:14:1: C417 [*] Unnecessary `map` usage (rewrite using a `list` comprehension) | 12 | all(map(lambda v: isinstance(v, dict), nums)) 13 | filter(func, map(lambda v: v, nums)) @@ -251,7 +251,7 @@ C417.py:14:1: C417 [**] Unnecessary `map` usage (rewrite using a `list` comprehe 16 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" -C417.py:17:8: C417 [**] Unnecessary `map` usage (rewrite using a `set` comprehension) +C417.py:17:8: C417 [*] Unnecessary `map` usage (rewrite using a `set` comprehension) | 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" @@ -270,7 +270,7 @@ C417.py:17:8: C417 [**] Unnecessary `map` usage (rewrite using a `set` comprehen 19 19 | 20 20 | # False negatives. -C417.py:18:8: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehension) +C417.py:18:8: C417 [*] Unnecessary `map` usage (rewrite using a `dict` comprehension) | 16 | # When inside f-string, then the fix should be surrounded by whitespace 17 | _ = f"{set(map(lambda x: x % 2 == 0, nums))}" @@ -291,7 +291,7 @@ C417.py:18:8: C417 [**] Unnecessary `map` usage (rewrite using a `dict` comprehe 20 20 | # False negatives. 21 21 | map(lambda x=2, y=1: x + y, nums, nums) -C417.py:36:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:36:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 35 | # Error: the `x` is overridden by the inner lambda. 36 | map(lambda x: lambda x: x, range(4)) @@ -311,7 +311,7 @@ C417.py:36:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expre 38 38 | # Ok because of the default parameters, and variadic arguments. 39 39 | map(lambda x=1: x, nums) -C417.py:47:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:47:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 | map(lambda x: x, y if y else z) @@ -330,7 +330,7 @@ C417.py:47:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expre 48 48 | map(lambda x: x, (y if y else z)) 49 49 | map(lambda x: x, (x, y, z)) -C417.py:48:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:48:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 46 | # Regression test for: https://github.com/astral-sh/ruff/issues/7121 47 | map(lambda x: x, y if y else z) @@ -348,7 +348,7 @@ C417.py:48:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expre 48 |+(x for x in (y if y else z)) 49 49 | map(lambda x: x, (x, y, z)) -C417.py:49:1: C417 [**] Unnecessary `map` usage (rewrite using a generator expression) +C417.py:49:1: C417 [*] Unnecessary `map` usage (rewrite using a generator expression) | 47 | map(lambda x: x, y if y else z) 48 | map(lambda x: x, (y if y else z)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap index 905cc34bbfdf1a..301da13fcdfd54 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C418_C418.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C418.py:1:1: C418 [**] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) +C418.py:1:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) | 1 | dict({}) | ^^^^^^^^ C418 @@ -17,7 +17,7 @@ C418.py:1:1: C418 [**] Unnecessary `dict` literal passed to `dict()` (remove the 3 3 | dict({'x': 1 for x in range(10)}) 4 4 | dict( -C418.py:2:1: C418 [**] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) +C418.py:2:1: C418 [*] Unnecessary `dict` literal passed to `dict()` (remove the outer call to `dict()`) | 1 | dict({}) 2 | dict({'a': 1}) @@ -35,7 +35,7 @@ C418.py:2:1: C418 [**] Unnecessary `dict` literal passed to `dict()` (remove the 4 4 | dict( 5 5 | {'x': 1 for x in range(10)} -C418.py:3:1: C418 [**] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) +C418.py:3:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) | 1 | dict({}) 2 | dict({'a': 1}) @@ -55,7 +55,7 @@ C418.py:3:1: C418 [**] Unnecessary `dict` comprehension passed to `dict()` (remo 5 5 | {'x': 1 for x in range(10)} 6 6 | ) -C418.py:4:1: C418 [**] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) +C418.py:4:1: C418 [*] Unnecessary `dict` comprehension passed to `dict()` (remove the outer call to `dict()`) | 2 | dict({'a': 1}) 3 | dict({'x': 1 for x in range(10)}) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap index 391c4c17b5546b..611f4aac47e8f0 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/snapshots/ruff_linter__rules__flake8_comprehensions__tests__C419_C419.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_comprehensions/mod.rs --- -C419.py:1:5: C419 [**] Unnecessary list comprehension. +C419.py:1:5: C419 [*] Unnecessary list comprehension. | 1 | any([x.id for x in bar]) | ^^^^^^^^^^^^^^^^^^^ C419 @@ -17,7 +17,7 @@ C419.py:1:5: C419 [**] Unnecessary list comprehension. 3 3 | any( # first comment 4 4 | [x.id for x in bar], # second comment -C419.py:2:5: C419 [**] Unnecessary list comprehension. +C419.py:2:5: C419 [*] Unnecessary list comprehension. | 1 | any([x.id for x in bar]) 2 | all([x.id for x in bar]) @@ -35,7 +35,7 @@ C419.py:2:5: C419 [**] Unnecessary list comprehension. 4 4 | [x.id for x in bar], # second comment 5 5 | ) # third comment -C419.py:4:5: C419 [**] Unnecessary list comprehension. +C419.py:4:5: C419 [*] Unnecessary list comprehension. | 2 | all([x.id for x in bar]) 3 | any( # first comment @@ -56,7 +56,7 @@ C419.py:4:5: C419 [**] Unnecessary list comprehension. 6 6 | all( # first comment 7 7 | [x.id for x in bar], # second comment -C419.py:7:5: C419 [**] Unnecessary list comprehension. +C419.py:7:5: C419 [*] Unnecessary list comprehension. | 5 | ) # third comment 6 | all( # first comment @@ -77,7 +77,7 @@ C419.py:7:5: C419 [**] Unnecessary list comprehension. 9 9 | any({x.id for x in bar}) 10 10 | -C419.py:9:5: C419 [**] Unnecessary list comprehension. +C419.py:9:5: C419 [*] Unnecessary list comprehension. | 7 | [x.id for x in bar], # second comment 8 | ) # third comment @@ -98,7 +98,7 @@ C419.py:9:5: C419 [**] Unnecessary list comprehension. 11 11 | # OK 12 12 | all(x.id for x in bar) -C419.py:24:5: C419 [**] Unnecessary list comprehension. +C419.py:24:5: C419 [*] Unnecessary list comprehension. | 22 | # Special comment handling 23 | any( @@ -133,7 +133,7 @@ C419.py:24:5: C419 [**] Unnecessary list comprehension. 31 30 | ) 32 31 | -C419.py:35:5: C419 [**] Unnecessary list comprehension. +C419.py:35:5: C419 [*] Unnecessary list comprehension. | 33 | # Weird case where the function call, opening bracket, and comment are all 34 | # on the same line. diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap index ce7eedda001d3b..d9722404823c55 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__custom.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs --- -EM.py:5:24: EM101 [**] Exception must not use a string literal, assign to variable first +EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variable first | 4 | def f_a(): 5 | raise RuntimeError("This is an example exception") @@ -20,7 +20,7 @@ EM.py:5:24: EM101 [**] Exception must not use a string literal, assign to variab 7 8 | 8 9 | def f_a_short(): -EM.py:18:24: EM102 [**] Exception must not use an f-string literal, assign to variable first +EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first | 16 | def f_b(): 17 | example = "example" @@ -40,7 +40,7 @@ EM.py:18:24: EM102 [**] Exception must not use an f-string literal, assign to va 20 21 | 21 22 | def f_c(): -EM.py:22:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first +EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 21 | def f_c(): 22 | raise RuntimeError("This is an {example} exception".format(example="example")) @@ -68,7 +68,7 @@ EM.py:32:24: EM101 Exception must not use a string literal, assign to variable f | = help: Assign to variable; remove string literal -EM.py:39:24: EM101 [**] Exception must not use a string literal, assign to variable first +EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first | 37 | msg = "hello" 38 | @@ -96,7 +96,7 @@ EM.py:46:28: EM101 Exception must not use a string literal, assign to variable f | = help: Assign to variable; remove string literal -EM.py:51:28: EM101 [**] Exception must not use a string literal, assign to variable first +EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first | 49 | def f_fix_indentation_check(foo): 50 | if foo: @@ -118,7 +118,7 @@ EM.py:51:28: EM101 [**] Exception must not use a string literal, assign to varia 53 54 | if foo == "foo": 54 55 | raise RuntimeError(f"This is an exception: {foo}") -EM.py:54:32: EM102 [**] Exception must not use an f-string literal, assign to variable first +EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first | 52 | else: 53 | if foo == "foo": @@ -139,7 +139,7 @@ EM.py:54:32: EM102 [**] Exception must not use an f-string literal, assign to va 56 57 | 57 58 | -EM.py:55:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first +EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 53 | if foo == "foo": 54 | raise RuntimeError(f"This is an exception: {foo}") diff --git a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap index a76e5193b7408d..03784c23fcc1ff 100644 --- a/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_errmsg/snapshots/ruff_linter__rules__flake8_errmsg__tests__defaults.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_errmsg/mod.rs --- -EM.py:5:24: EM101 [**] Exception must not use a string literal, assign to variable first +EM.py:5:24: EM101 [*] Exception must not use a string literal, assign to variable first | 4 | def f_a(): 5 | raise RuntimeError("This is an example exception") @@ -20,7 +20,7 @@ EM.py:5:24: EM101 [**] Exception must not use a string literal, assign to variab 7 8 | 8 9 | def f_a_short(): -EM.py:9:24: EM101 [**] Exception must not use a string literal, assign to variable first +EM.py:9:24: EM101 [*] Exception must not use a string literal, assign to variable first | 8 | def f_a_short(): 9 | raise RuntimeError("Error") @@ -39,7 +39,7 @@ EM.py:9:24: EM101 [**] Exception must not use a string literal, assign to variab 11 12 | 12 13 | def f_a_empty(): -EM.py:13:24: EM101 [**] Exception must not use a string literal, assign to variable first +EM.py:13:24: EM101 [*] Exception must not use a string literal, assign to variable first | 12 | def f_a_empty(): 13 | raise RuntimeError("") @@ -58,7 +58,7 @@ EM.py:13:24: EM101 [**] Exception must not use a string literal, assign to varia 15 16 | 16 17 | def f_b(): -EM.py:18:24: EM102 [**] Exception must not use an f-string literal, assign to variable first +EM.py:18:24: EM102 [*] Exception must not use an f-string literal, assign to variable first | 16 | def f_b(): 17 | example = "example" @@ -78,7 +78,7 @@ EM.py:18:24: EM102 [**] Exception must not use an f-string literal, assign to va 20 21 | 21 22 | def f_c(): -EM.py:22:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first +EM.py:22:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 21 | def f_c(): 22 | raise RuntimeError("This is an {example} exception".format(example="example")) @@ -106,7 +106,7 @@ EM.py:32:24: EM101 Exception must not use a string literal, assign to variable f | = help: Assign to variable; remove string literal -EM.py:39:24: EM101 [**] Exception must not use a string literal, assign to variable first +EM.py:39:24: EM101 [*] Exception must not use a string literal, assign to variable first | 37 | msg = "hello" 38 | @@ -134,7 +134,7 @@ EM.py:46:28: EM101 Exception must not use a string literal, assign to variable f | = help: Assign to variable; remove string literal -EM.py:51:28: EM101 [**] Exception must not use a string literal, assign to variable first +EM.py:51:28: EM101 [*] Exception must not use a string literal, assign to variable first | 49 | def f_fix_indentation_check(foo): 50 | if foo: @@ -156,7 +156,7 @@ EM.py:51:28: EM101 [**] Exception must not use a string literal, assign to varia 53 54 | if foo == "foo": 54 55 | raise RuntimeError(f"This is an exception: {foo}") -EM.py:54:32: EM102 [**] Exception must not use an f-string literal, assign to variable first +EM.py:54:32: EM102 [*] Exception must not use an f-string literal, assign to variable first | 52 | else: 53 | if foo == "foo": @@ -177,7 +177,7 @@ EM.py:54:32: EM102 [**] Exception must not use an f-string literal, assign to va 56 57 | 57 58 | -EM.py:55:24: EM103 [**] Exception must not use a `.format()` string directly, assign to variable first +EM.py:55:24: EM103 [*] Exception must not use a `.format()` string directly, assign to variable first | 53 | if foo == "foo": 54 | raise RuntimeError(f"This is an exception: {foo}") diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap index 08e073cad421aa..848b339416991e 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__defaults.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -defaults.py:6:12: ICN001 [**] `altair` should be imported as `alt` +defaults.py:6:12: ICN001 [*] `altair` should be imported as `alt` | 5 | def unconventional(): 6 | import altair @@ -32,7 +32,7 @@ defaults.py:7:12: ICN001 `matplotlib.pyplot` should be imported as `plt` | = help: Alias `matplotlib.pyplot` to `plt` -defaults.py:8:12: ICN001 [**] `numpy` should be imported as `np` +defaults.py:8:12: ICN001 [*] `numpy` should be imported as `np` | 6 | import altair 7 | import matplotlib.pyplot @@ -53,7 +53,7 @@ defaults.py:8:12: ICN001 [**] `numpy` should be imported as `np` 10 10 | import seaborn 11 11 | import tkinter -defaults.py:9:12: ICN001 [**] `pandas` should be imported as `pd` +defaults.py:9:12: ICN001 [*] `pandas` should be imported as `pd` | 7 | import matplotlib.pyplot 8 | import numpy @@ -74,7 +74,7 @@ defaults.py:9:12: ICN001 [**] `pandas` should be imported as `pd` 11 11 | import tkinter 12 12 | import networkx -defaults.py:10:12: ICN001 [**] `seaborn` should be imported as `sns` +defaults.py:10:12: ICN001 [*] `seaborn` should be imported as `sns` | 8 | import numpy 9 | import pandas @@ -95,7 +95,7 @@ defaults.py:10:12: ICN001 [**] `seaborn` should be imported as `sns` 12 12 | import networkx 13 13 | -defaults.py:11:12: ICN001 [**] `tkinter` should be imported as `tk` +defaults.py:11:12: ICN001 [*] `tkinter` should be imported as `tk` | 9 | import pandas 10 | import seaborn @@ -115,7 +115,7 @@ defaults.py:11:12: ICN001 [**] `tkinter` should be imported as `tk` 13 13 | 14 14 | -defaults.py:12:12: ICN001 [**] `networkx` should be imported as `nx` +defaults.py:12:12: ICN001 [*] `networkx` should be imported as `nx` | 10 | import seaborn 11 | import tkinter @@ -134,7 +134,7 @@ defaults.py:12:12: ICN001 [**] `networkx` should be imported as `nx` 14 14 | 15 15 | def unconventional_aliases(): -defaults.py:16:22: ICN001 [**] `altair` should be imported as `alt` +defaults.py:16:22: ICN001 [*] `altair` should be imported as `alt` | 15 | def unconventional_aliases(): 16 | import altair as altr @@ -154,7 +154,7 @@ defaults.py:16:22: ICN001 [**] `altair` should be imported as `alt` 18 18 | import numpy as nmp 19 19 | import pandas as pdas -defaults.py:17:33: ICN001 [**] `matplotlib.pyplot` should be imported as `plt` +defaults.py:17:33: ICN001 [*] `matplotlib.pyplot` should be imported as `plt` | 15 | def unconventional_aliases(): 16 | import altair as altr @@ -175,7 +175,7 @@ defaults.py:17:33: ICN001 [**] `matplotlib.pyplot` should be imported as `plt` 19 19 | import pandas as pdas 20 20 | import seaborn as sbrn -defaults.py:18:21: ICN001 [**] `numpy` should be imported as `np` +defaults.py:18:21: ICN001 [*] `numpy` should be imported as `np` | 16 | import altair as altr 17 | import matplotlib.pyplot as plot @@ -196,7 +196,7 @@ defaults.py:18:21: ICN001 [**] `numpy` should be imported as `np` 20 20 | import seaborn as sbrn 21 21 | import tkinter as tkr -defaults.py:19:22: ICN001 [**] `pandas` should be imported as `pd` +defaults.py:19:22: ICN001 [*] `pandas` should be imported as `pd` | 17 | import matplotlib.pyplot as plot 18 | import numpy as nmp @@ -217,7 +217,7 @@ defaults.py:19:22: ICN001 [**] `pandas` should be imported as `pd` 21 21 | import tkinter as tkr 22 22 | import networkx as nxy -defaults.py:20:23: ICN001 [**] `seaborn` should be imported as `sns` +defaults.py:20:23: ICN001 [*] `seaborn` should be imported as `sns` | 18 | import numpy as nmp 19 | import pandas as pdas @@ -238,7 +238,7 @@ defaults.py:20:23: ICN001 [**] `seaborn` should be imported as `sns` 22 22 | import networkx as nxy 23 23 | -defaults.py:21:23: ICN001 [**] `tkinter` should be imported as `tk` +defaults.py:21:23: ICN001 [*] `tkinter` should be imported as `tk` | 19 | import pandas as pdas 20 | import seaborn as sbrn @@ -258,7 +258,7 @@ defaults.py:21:23: ICN001 [**] `tkinter` should be imported as `tk` 23 23 | 24 24 | def conventional_aliases(): -defaults.py:22:24: ICN001 [**] `networkx` should be imported as `nx` +defaults.py:22:24: ICN001 [*] `networkx` should be imported as `nx` | 20 | import seaborn as sbrn 21 | import tkinter as tkr diff --git a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap index 252120ec89f60f..2078183e505c37 100644 --- a/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap +++ b/crates/ruff_linter/src/rules/flake8_import_conventions/snapshots/ruff_linter__rules__flake8_import_conventions__tests__tricky.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_import_conventions/mod.rs --- -tricky.py:7:16: ICN001 [**] `pandas` should be imported as `pd` +tricky.py:7:16: ICN001 [*] `pandas` should be imported as `pd` | 5 | try: 6 | global pandas diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap index 89848002abf6e8..c7ee37c94cd0d0 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG001_LOG001.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -LOG001.py:3:1: LOG001 [**] Use `logging.getLogger()` to instantiate loggers +LOG001.py:3:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | 1 | import logging 2 | @@ -20,7 +20,7 @@ LOG001.py:3:1: LOG001 [**] Use `logging.getLogger()` to instantiate loggers 4 4 | logging.Logger() 5 5 | logging.getLogger(__name__) -LOG001.py:4:1: LOG001 [**] Use `logging.getLogger()` to instantiate loggers +LOG001.py:4:1: LOG001 [*] Use `logging.getLogger()` to instantiate loggers | 3 | logging.Logger(__name__) 4 | logging.Logger() diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap index 97d557a0e4ede4..e208e94121730c 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG002_LOG002.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -LOG002.py:11:11: LOG002 [**] Use `__name__` with `logging.getLogger()` +LOG002.py:11:11: LOG002 [*] Use `__name__` with `logging.getLogger()` | 10 | # LOG002 11 | getLogger(__file__) @@ -20,7 +20,7 @@ LOG002.py:11:11: LOG002 [**] Use `__name__` with `logging.getLogger()` 13 13 | 14 14 | logging.getLogger(__cached__) -LOG002.py:12:24: LOG002 [**] Use `__name__` with `logging.getLogger()` +LOG002.py:12:24: LOG002 [*] Use `__name__` with `logging.getLogger()` | 10 | # LOG002 11 | getLogger(__file__) @@ -41,7 +41,7 @@ LOG002.py:12:24: LOG002 [**] Use `__name__` with `logging.getLogger()` 14 14 | logging.getLogger(__cached__) 15 15 | getLogger(name=__cached__) -LOG002.py:14:19: LOG002 [**] Use `__name__` with `logging.getLogger()` +LOG002.py:14:19: LOG002 [*] Use `__name__` with `logging.getLogger()` | 12 | logging.getLogger(name=__file__) 13 | @@ -61,7 +61,7 @@ LOG002.py:14:19: LOG002 [**] Use `__name__` with `logging.getLogger()` 16 16 | 17 17 | -LOG002.py:15:16: LOG002 [**] Use `__name__` with `logging.getLogger()` +LOG002.py:15:16: LOG002 [*] Use `__name__` with `logging.getLogger()` | 14 | logging.getLogger(__cached__) 15 | getLogger(name=__cached__) diff --git a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap index cdb3eea8da60b0..a31c6a2b1c3026 100644 --- a/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap +++ b/crates/ruff_linter/src/rules/flake8_logging/snapshots/ruff_linter__rules__flake8_logging__tests__LOG009_LOG009.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_logging/mod.rs --- -LOG009.py:3:1: LOG009 [**] Use of undocumented `logging.WARN` constant +LOG009.py:3:1: LOG009 [*] Use of undocumented `logging.WARN` constant | 1 | import logging 2 | @@ -20,7 +20,7 @@ LOG009.py:3:1: LOG009 [**] Use of undocumented `logging.WARN` constant 5 5 | 6 6 | from logging import WARN, WARNING -LOG009.py:8:1: LOG009 [**] Use of undocumented `logging.WARN` constant +LOG009.py:8:1: LOG009 [*] Use of undocumented `logging.WARN` constant | 6 | from logging import WARN, WARNING 7 | diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap index f4d83912bcb455..d67d3cfe87648a 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE794_PIE794.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -PIE794.py:4:5: PIE794 [**] Class field `name` is defined multiple times +PIE794.py:4:5: PIE794 [*] Class field `name` is defined multiple times | 2 | name = StringField() 3 | # .... @@ -21,7 +21,7 @@ PIE794.py:4:5: PIE794 [**] Class field `name` is defined multiple times 6 5 | def remove(self) -> None: 7 6 | ... -PIE794.py:13:5: PIE794 [**] Class field `name` is defined multiple times +PIE794.py:13:5: PIE794 [*] Class field `name` is defined multiple times | 11 | name: str = StringField() 12 | # .... @@ -41,7 +41,7 @@ PIE794.py:13:5: PIE794 [**] Class field `name` is defined multiple times 15 14 | def foo(self) -> None: 16 15 | ... -PIE794.py:23:5: PIE794 [**] Class field `bar` is defined multiple times +PIE794.py:23:5: PIE794 [*] Class field `bar` is defined multiple times | 21 | foo: bool = BooleanField() 22 | # ... @@ -59,7 +59,7 @@ PIE794.py:23:5: PIE794 [**] Class field `bar` is defined multiple times 25 24 | 26 25 | class User(BaseModel): -PIE794.py:40:5: PIE794 [**] Class field `bar` is defined multiple times +PIE794.py:40:5: PIE794 [*] Class field `bar` is defined multiple times | 38 | foo: bool = BooleanField() 39 | # ... diff --git a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap index 7c92f7fc64a966..a889297249da7f 100644 --- a/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pie/snapshots/ruff_linter__rules__flake8_pie__tests__PIE810_PIE810.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pie/mod.rs --- -PIE810.py:2:1: PIE810 [**] Call `startswith` once with a `tuple` +PIE810.py:2:1: PIE810 [*] Call `startswith` once with a `tuple` | 1 | # error 2 | obj.startswith("foo") or obj.startswith("bar") @@ -19,7 +19,7 @@ PIE810.py:2:1: PIE810 [**] Call `startswith` once with a `tuple` 4 4 | obj.endswith("foo") or obj.endswith("bar") 5 5 | # error -PIE810.py:4:1: PIE810 [**] Call `endswith` once with a `tuple` +PIE810.py:4:1: PIE810 [*] Call `endswith` once with a `tuple` | 2 | obj.startswith("foo") or obj.startswith("bar") 3 | # error @@ -40,7 +40,7 @@ PIE810.py:4:1: PIE810 [**] Call `endswith` once with a `tuple` 6 6 | obj.startswith(foo) or obj.startswith(bar) 7 7 | # error -PIE810.py:6:1: PIE810 [**] Call `startswith` once with a `tuple` +PIE810.py:6:1: PIE810 [*] Call `startswith` once with a `tuple` | 4 | obj.endswith("foo") or obj.endswith("bar") 5 | # error @@ -61,7 +61,7 @@ PIE810.py:6:1: PIE810 [**] Call `startswith` once with a `tuple` 8 8 | obj.startswith(foo) or obj.startswith("foo") 9 9 | # error -PIE810.py:8:1: PIE810 [**] Call `startswith` once with a `tuple` +PIE810.py:8:1: PIE810 [*] Call `startswith` once with a `tuple` | 6 | obj.startswith(foo) or obj.startswith(bar) 7 | # error @@ -82,7 +82,7 @@ PIE810.py:8:1: PIE810 [**] Call `startswith` once with a `tuple` 10 10 | obj.endswith(foo) or obj.startswith(foo) or obj.startswith("foo") 11 11 | -PIE810.py:10:1: PIE810 [**] Call `startswith` once with a `tuple` +PIE810.py:10:1: PIE810 [*] Call `startswith` once with a `tuple` | 8 | obj.startswith(foo) or obj.startswith("foo") 9 | # error diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap index 9d9b9f1b047ba3..b68bdf828cfc92 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI010_PYI010.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI010.pyi:6:5: PYI010 [**] Function body must contain only `...` +PYI010.pyi:6:5: PYI010 [*] Function body must contain only `...` | 5 | def buzz(): 6 | print("buzz") # ERROR PYI010 @@ -21,7 +21,7 @@ PYI010.pyi:6:5: PYI010 [**] Function body must contain only `...` 8 8 | def foo2(): 9 9 | 123 # ERROR PYI010 -PYI010.pyi:9:5: PYI010 [**] Function body must contain only `...` +PYI010.pyi:9:5: PYI010 [*] Function body must contain only `...` | 8 | def foo2(): 9 | 123 # ERROR PYI010 @@ -41,7 +41,7 @@ PYI010.pyi:9:5: PYI010 [**] Function body must contain only `...` 11 11 | def bizz(): 12 12 | x = 123 # ERROR PYI010 -PYI010.pyi:12:5: PYI010 [**] Function body must contain only `...` +PYI010.pyi:12:5: PYI010 [*] Function body must contain only `...` | 11 | def bizz(): 12 | x = 123 # ERROR PYI010 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap index 7ad588162d68d4..b883a369b29150 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI011_PYI011.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI011.pyi:10:14: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:10:14: PYI011 [*] Only simple default values allowed for typed arguments | 8 | def f12( 9 | x, @@ -22,7 +22,7 @@ PYI011.pyi:10:14: PYI011 [**] Only simple default values allowed for typed argum 12 12 | def f11(*, x: str = "x") -> None: ... # OK 13 13 | def f13( -PYI011.pyi:38:9: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:38:9: PYI011 [*] Only simple default values allowed for typed arguments | 36 | x: dict[ 37 | int, int @@ -50,7 +50,7 @@ PYI011.pyi:38:9: PYI011 [**] Only simple default values allowed for typed argume 43 40 | def f153( 44 41 | x: list[ -PYI011.pyi:46:9: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:46:9: PYI011 [*] Only simple default values allowed for typed arguments | 44 | x: list[ 45 | int @@ -96,7 +96,7 @@ PYI011.pyi:46:9: PYI011 [**] Only simple default values allowed for typed argume 60 48 | def f154( 61 49 | x: tuple[ -PYI011.pyi:63:9: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:63:9: PYI011 [*] Only simple default values allowed for typed arguments | 61 | x: tuple[ 62 | str, tuple[str, ...] @@ -124,7 +124,7 @@ PYI011.pyi:63:9: PYI011 [**] Only simple default values allowed for typed argume 68 65 | def f141( 69 66 | x: list[ -PYI011.pyi:71:9: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:71:9: PYI011 [*] Only simple default values allowed for typed arguments | 69 | x: list[ 70 | int @@ -150,7 +150,7 @@ PYI011.pyi:71:9: PYI011 [**] Only simple default values allowed for typed argume 75 73 | def f142( 76 74 | x: list[ -PYI011.pyi:78:9: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:78:9: PYI011 [*] Only simple default values allowed for typed arguments | 76 | x: list[ 77 | int @@ -176,7 +176,7 @@ PYI011.pyi:78:9: PYI011 [**] Only simple default values allowed for typed argume 82 80 | def f16( 83 81 | x: frozenset[ -PYI011.pyi:85:9: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:85:9: PYI011 [*] Only simple default values allowed for typed arguments | 83 | x: frozenset[ 84 | bytes @@ -202,7 +202,7 @@ PYI011.pyi:85:9: PYI011 [**] Only simple default values allowed for typed argume 89 87 | def f17( 90 88 | x: str = "foo" # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:90:14: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:90:14: PYI011 [*] Only simple default values allowed for typed arguments | 88 | ) -> None: ... 89 | def f17( @@ -226,7 +226,7 @@ PYI011.pyi:90:14: PYI011 [**] Only simple default values allowed for typed argum 93 92 | def f18( 94 93 | x: str = b"foo" # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:94:14: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:94:14: PYI011 [*] Only simple default values allowed for typed arguments | 92 | ) -> None: ... 93 | def f18( @@ -250,7 +250,7 @@ PYI011.pyi:94:14: PYI011 [**] Only simple default values allowed for typed argum 97 96 | def f19( 98 97 | x: object = "foo" # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:98:17: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:98:17: PYI011 [*] Only simple default values allowed for typed arguments | 96 | ) -> None: ... 97 | def f19( @@ -274,7 +274,7 @@ PYI011.pyi:98:17: PYI011 [**] Only simple default values allowed for typed argum 101 100 | def f20( 102 101 | x: int = 5 -PYI011.pyi:102:14: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:102:14: PYI011 [*] Only simple default values allowed for typed arguments | 100 | ) -> None: ... 101 | def f20( @@ -298,7 +298,7 @@ PYI011.pyi:102:14: PYI011 [**] Only simple default values allowed for typed argu 105 104 | def f21( 106 105 | x: complex = 3j -PYI011.pyi:106:18: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:106:18: PYI011 [*] Only simple default values allowed for typed arguments | 104 | ) -> None: ... 105 | def f21( @@ -322,7 +322,7 @@ PYI011.pyi:106:18: PYI011 [**] Only simple default values allowed for typed argu 109 108 | def f22( 110 109 | x: complex = -42.5j # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:110:18: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:110:18: PYI011 [*] Only simple default values allowed for typed arguments | 108 | ) -> None: ... 109 | def f22( @@ -346,7 +346,7 @@ PYI011.pyi:110:18: PYI011 [**] Only simple default values allowed for typed argu 113 112 | def f23( 114 113 | x: bool = True, # OK -PYI011.pyi:138:16: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:138:16: PYI011 [*] Only simple default values allowed for typed arguments | 136 | ) -> None: ... 137 | def f31( @@ -367,7 +367,7 @@ PYI011.pyi:138:16: PYI011 [**] Only simple default values allowed for typed argu 140 140 | def f32( 141 141 | x: float = np.inf, # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:141:16: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:141:16: PYI011 [*] Only simple default values allowed for typed arguments | 139 | ) -> None: ... 140 | def f32( @@ -388,7 +388,7 @@ PYI011.pyi:141:16: PYI011 [**] Only simple default values allowed for typed argu 143 143 | def f33( 144 144 | x: float = math.nan, # OK -PYI011.pyi:147:16: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:147:16: PYI011 [*] Only simple default values allowed for typed arguments | 145 | ) -> None: ... 146 | def f34( @@ -409,7 +409,7 @@ PYI011.pyi:147:16: PYI011 [**] Only simple default values allowed for typed argu 149 149 | def f35( 150 150 | x: complex = math.inf # Error PYI011 Only simple default values allowed for typed arguments -PYI011.pyi:150:18: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:150:18: PYI011 [*] Only simple default values allowed for typed arguments | 148 | ) -> None: ... 149 | def f35( @@ -433,7 +433,7 @@ PYI011.pyi:150:18: PYI011 [**] Only simple default values allowed for typed argu 153 152 | def f36( 154 153 | *, -PYI011.pyi:159:14: PYI011 [**] Only simple default values allowed for typed arguments +PYI011.pyi:159:14: PYI011 [*] Only simple default values allowed for typed arguments | 157 | def f37( 158 | *, diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap index ff1de2843e87ea..f16400fffca02c 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI014_PYI014.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI014.pyi:3:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:3:7: PYI014 [*] Only simple default values allowed for arguments | 1 | def f12( 2 | x, @@ -21,7 +21,7 @@ PYI014.pyi:3:7: PYI014 [**] Only simple default values allowed for arguments 5 5 | def f11(*, x="x") -> None: ... # OK 6 6 | def f13( -PYI014.pyi:29:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:29:7: PYI014 [*] Only simple default values allowed for arguments | 27 | def f151(x={1: 2}) -> None: ... 28 | def f152( @@ -49,7 +49,7 @@ PYI014.pyi:29:7: PYI014 [**] Only simple default values allowed for arguments 34 31 | def f153( 35 32 | x=[ # Error PYI014 -PYI014.pyi:35:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:35:7: PYI014 [*] Only simple default values allowed for arguments | 33 | ) -> None: ... 34 | def f153( @@ -95,7 +95,7 @@ PYI014.pyi:35:7: PYI014 [**] Only simple default values allowed for arguments 49 37 | def f154( 50 38 | x=( # Error PYI014 -PYI014.pyi:50:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:50:7: PYI014 [*] Only simple default values allowed for arguments | 48 | ) -> None: ... 49 | def f154( @@ -123,7 +123,7 @@ PYI014.pyi:50:7: PYI014 [**] Only simple default values allowed for arguments 55 52 | def f141( 56 53 | x=[*range(10)], # Error PYI014 -PYI014.pyi:56:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:56:7: PYI014 [*] Only simple default values allowed for arguments | 54 | ) -> None: ... 55 | def f141( @@ -144,7 +144,7 @@ PYI014.pyi:56:7: PYI014 [**] Only simple default values allowed for arguments 58 58 | def f142( 59 59 | x=list(range(10)), # Error PYI014 -PYI014.pyi:59:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:59:7: PYI014 [*] Only simple default values allowed for arguments | 57 | ) -> None: ... 58 | def f142( @@ -165,7 +165,7 @@ PYI014.pyi:59:7: PYI014 [**] Only simple default values allowed for arguments 61 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 62 | def f17( -PYI014.pyi:61:11: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:61:11: PYI014 [*] Only simple default values allowed for arguments | 59 | x=list(range(10)), # Error PYI014 60 | ) -> None: ... @@ -186,7 +186,7 @@ PYI014.pyi:61:11: PYI014 [**] Only simple default values allowed for arguments 63 63 | x="foo" + "bar", # Error PYI014 64 64 | ) -> None: ... -PYI014.pyi:63:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:63:7: PYI014 [*] Only simple default values allowed for arguments | 61 | def f16(x=frozenset({b"foo", b"bar", b"baz"})) -> None: ... # Error PYI014 62 | def f17( @@ -207,7 +207,7 @@ PYI014.pyi:63:7: PYI014 [**] Only simple default values allowed for arguments 65 65 | def f18( 66 66 | x=b"foo" + b"bar", # Error PYI014 -PYI014.pyi:66:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:66:7: PYI014 [*] Only simple default values allowed for arguments | 64 | ) -> None: ... 65 | def f18( @@ -228,7 +228,7 @@ PYI014.pyi:66:7: PYI014 [**] Only simple default values allowed for arguments 68 68 | def f19( 69 69 | x="foo" + 4, # Error PYI014 -PYI014.pyi:69:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:69:7: PYI014 [*] Only simple default values allowed for arguments | 67 | ) -> None: ... 68 | def f19( @@ -249,7 +249,7 @@ PYI014.pyi:69:7: PYI014 [**] Only simple default values allowed for arguments 71 71 | def f20( 72 72 | x=5 + 5, # Error PYI014 -PYI014.pyi:72:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:72:7: PYI014 [*] Only simple default values allowed for arguments | 70 | ) -> None: ... 71 | def f20( @@ -270,7 +270,7 @@ PYI014.pyi:72:7: PYI014 [**] Only simple default values allowed for arguments 74 74 | def f21( 75 75 | x=3j - 3j, # Error PYI014 -PYI014.pyi:75:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:75:7: PYI014 [*] Only simple default values allowed for arguments | 73 | ) -> None: ... 74 | def f21( @@ -291,7 +291,7 @@ PYI014.pyi:75:7: PYI014 [**] Only simple default values allowed for arguments 77 77 | def f22( 78 78 | x=-42.5j + 4.3j, # Error PYI014 -PYI014.pyi:78:7: PYI014 [**] Only simple default values allowed for arguments +PYI014.pyi:78:7: PYI014 [*] Only simple default values allowed for arguments | 76 | ) -> None: ... 77 | def f22( diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap index 0f39d6cdc1781a..a083c72f1b07e9 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI015_PYI015.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI015.pyi:44:23: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:44:23: PYI015 [*] Only simple default values allowed for assignments | 43 | # We *should* emit Y015 for more complex default values 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -21,7 +21,7 @@ PYI015.pyi:44:23: PYI015 [**] Only simple default values allowed for assignments 46 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments -PYI015.pyi:45:23: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:45:23: PYI015 [*] Only simple default values allowed for assignments | 43 | # We *should* emit Y015 for more complex default values 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments @@ -42,7 +42,7 @@ PYI015.pyi:45:23: PYI015 [**] Only simple default values allowed for assignments 47 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments -PYI015.pyi:46:23: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:46:23: PYI015 [*] Only simple default values allowed for assignments | 44 | field221: list[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Y015 Only simple default values are allowed for assignments 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments @@ -63,7 +63,7 @@ PYI015.pyi:46:23: PYI015 [**] Only simple default values allowed for assignments 48 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments -PYI015.pyi:47:26: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:47:26: PYI015 [*] Only simple default values allowed for assignments | 45 | field223: list[int] = [*range(10)] # Y015 Only simple default values are allowed for assignments 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments @@ -84,7 +84,7 @@ PYI015.pyi:47:26: PYI015 [**] Only simple default values allowed for assignments 49 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments -PYI015.pyi:48:47: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:48:47: PYI015 [*] Only simple default values allowed for assignments | 46 | field224: list[int] = list(range(10)) # Y015 Only simple default values are allowed for assignments 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments @@ -105,7 +105,7 @@ PYI015.pyi:48:47: PYI015 [**] Only simple default values allowed for assignments 50 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node -PYI015.pyi:49:31: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:49:31: PYI015 [*] Only simple default values allowed for assignments | 47 | field225: list[object] = [{}, 1, 2] # Y015 Only simple default values are allowed for assignments 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments @@ -126,7 +126,7 @@ PYI015.pyi:49:31: PYI015 [**] Only simple default values allowed for assignments 51 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments -PYI015.pyi:50:37: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:50:37: PYI015 [*] Only simple default values allowed for assignments | 48 | field226: tuple[str | tuple[str, ...], ...] = ("foo", ("foo", "bar")) # Y015 Only simple default values are allowed for assignments 49 | field227: dict[str, object] = {"foo": {"foo": "bar"}} # Y015 Only simple default values are allowed for assignments @@ -147,7 +147,7 @@ PYI015.pyi:50:37: PYI015 [**] Only simple default values allowed for assignments 52 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments -PYI015.pyi:52:28: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:52:28: PYI015 [*] Only simple default values allowed for assignments | 50 | field228: dict[str, list[object]] = {"foo": []} # Y015 Only simple default values are allowed for assignments 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node @@ -168,7 +168,7 @@ PYI015.pyi:52:28: PYI015 [**] Only simple default values allowed for assignments 54 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments -PYI015.pyi:53:11: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:53:11: PYI015 [*] Only simple default values allowed for assignments | 51 | # When parsed, this case results in `None` being placed in the `.keys` list for the `ast.Dict` node 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments @@ -189,7 +189,7 @@ PYI015.pyi:53:11: PYI015 [**] Only simple default values allowed for assignments 55 55 | field25 = 5 * 5 # Y015 Only simple default values are allowed for assignments 56 56 | -PYI015.pyi:54:11: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:54:11: PYI015 [*] Only simple default values allowed for assignments | 52 | field229: dict[int, int] = {1: 2, **{3: 4}} # Y015 Only simple default values are allowed for assignments 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments @@ -209,7 +209,7 @@ PYI015.pyi:54:11: PYI015 [**] Only simple default values allowed for assignments 56 56 | 57 57 | # We shouldn't emit Y015 within functions -PYI015.pyi:55:11: PYI015 [**] Only simple default values allowed for assignments +PYI015.pyi:55:11: PYI015 [*] Only simple default values allowed for assignments | 53 | field23 = "foo" + "bar" # Y015 Only simple default values are allowed for assignments 54 | field24 = b"foo" + b"bar" # Y015 Only simple default values are allowed for assignments diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap index 6dfbae238029c8..2bebd50a8dc7f1 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI025.py:10:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.py:10:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 9 | def f(): 10 | from collections.abc import Set # PYI025 @@ -19,7 +19,7 @@ PYI025.py:10:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet 12 12 | 13 13 | def f(): -PYI025.py:14:51: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.py:14:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 13 | def f(): 14 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap index eddc77c2f84d03..51afedd7f8bf5b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI025_PYI025.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI025.pyi:8:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:8:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 7 | def f(): 8 | from collections.abc import Set # PYI025 @@ -21,7 +21,7 @@ PYI025.pyi:8:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet 10 10 | def f(): 11 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 -PYI025.pyi:11:51: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:11:51: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 10 | def f(): 11 | from collections.abc import Container, Sized, Set, ValuesView # PYI025 @@ -41,7 +41,7 @@ PYI025.pyi:11:51: PYI025 [**] Use `from collections.abc import Set as AbstractSe 13 13 | def f(): 14 14 | """Test: local symbol renaming.""" -PYI025.pyi:16:37: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:16:37: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 14 | """Test: local symbol renaming.""" 15 | if True: @@ -76,7 +76,7 @@ PYI025.pyi:16:37: PYI025 [**] Use `from collections.abc import Set as AbstractSe 29 29 | def Set(): 30 30 | pass -PYI025.pyi:33:29: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:33:29: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 31 | print(Set) 32 | @@ -119,7 +119,7 @@ PYI025.pyi:33:29: PYI025 [**] Use `from collections.abc import Set as AbstractSe 42 42 | def f(): 43 43 | """Test: nonlocal symbol renaming.""" -PYI025.pyi:44:33: PYI025 [**] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin +PYI025.pyi:44:33: PYI025 [*] Use `from collections.abc import Set as AbstractSet` to avoid confusion with the `set` builtin | 42 | def f(): 43 | """Test: nonlocal symbol renaming.""" diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap index 9b4336a552813b..b4c117f2ecf495 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI026_PYI026.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI026.pyi:3:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` +PYI026.pyi:3:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` | 1 | from typing import Literal, Any 2 | @@ -22,7 +22,7 @@ PYI026.pyi:3:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `NewAny 5 5 | Foo = Literal["foo"] 6 6 | IntOrStr = int | str -PYI026.pyi:4:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` +PYI026.pyi:4:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -43,7 +43,7 @@ PYI026.pyi:4:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `Option 6 6 | IntOrStr = int | str 7 7 | AliasNone = None -PYI026.pyi:5:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` +PYI026.pyi:5:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -66,7 +66,7 @@ PYI026.pyi:5:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `Foo: T 7 7 | AliasNone = None 8 8 | -PYI026.pyi:6:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` +PYI026.pyi:6:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` | 4 | OptionalStr = typing.Optional[str] 5 | Foo = Literal["foo"] @@ -89,7 +89,7 @@ PYI026.pyi:6:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `IntOrS 8 8 | 9 9 | NewAny: typing.TypeAlias = Any -PYI026.pyi:7:1: PYI026 [**] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` +PYI026.pyi:7:1: PYI026 [*] Use `typing.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` | 5 | Foo = Literal["foo"] 6 | IntOrStr = int | str diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap index 7488435b6245e7..5b9f3aa1a13323 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI053_PYI053.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI053.pyi:3:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:3:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 1 | def f1(x: str = "50 character stringggggggggggggggggggggggggggggggg") -> None: ... # OK 2 | def f2( @@ -21,7 +21,7 @@ PYI053.pyi:3:14: PYI053 [**] String and bytes literals longer than 50 characters 5 5 | def f3( 6 6 | x: str = "50 character stringgggggggggggggggggggggggggggggg\U0001f600", # OK -PYI053.pyi:9:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:9:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 7 | ) -> None: ... 8 | def f4( @@ -42,7 +42,7 @@ PYI053.pyi:9:14: PYI053 [**] String and bytes literals longer than 50 characters 11 11 | def f5( 12 12 | x: bytes = b"50 character byte stringgggggggggggggggggggggggggg", # OK -PYI053.pyi:21:16: PYI053 [**] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:21:16: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 19 | ) -> None: ... 20 | def f8( @@ -62,7 +62,7 @@ PYI053.pyi:21:16: PYI053 [**] String and bytes literals longer than 50 character 23 23 | 24 24 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK -PYI053.pyi:26:12: PYI053 [**] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:26:12: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 24 | foo: str = "50 character stringggggggggggggggggggggggggggggggg" # OK 25 | @@ -83,7 +83,7 @@ PYI053.pyi:26:12: PYI053 [**] String and bytes literals longer than 50 character 28 28 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 29 29 | -PYI053.pyi:30:14: PYI053 [**] String and bytes literals longer than 50 characters are not permitted +PYI053.pyi:30:14: PYI053 [*] String and bytes literals longer than 50 characters are not permitted | 28 | baz: bytes = b"50 character byte stringgggggggggggggggggggggggggg" # OK 29 | diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap index 7739a08fa8e974..7db8611cad8e8f 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__PYI054_PYI054.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI054.pyi:2:16: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:2:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 1 | field01: int = 0xFFFFFFFF 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 @@ -19,7 +19,7 @@ PYI054.pyi:2:16: PYI054 [**] Numeric literals with a string representation longe 4 4 | field04: int = -0xFFFFFFFFF # Error: PYI054 5 5 | -PYI054.pyi:4:17: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:4:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 2 | field02: int = 0xFFFFFFFFF # Error: PYI054 3 | field03: int = -0xFFFFFFFF @@ -40,7 +40,7 @@ PYI054.pyi:4:17: PYI054 [**] Numeric literals with a string representation longe 6 6 | field05: int = 1234567890 7 7 | field06: int = 12_456_890 -PYI054.pyi:8:16: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:8:16: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 6 | field05: int = 1234567890 7 | field06: int = 12_456_890 @@ -61,7 +61,7 @@ PYI054.pyi:8:16: PYI054 [**] Numeric literals with a string representation longe 10 10 | field09: int = -234_567_890 # Error: PYI054 11 11 | -PYI054.pyi:10:17: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:10:17: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 8 | field07: int = 12345678901 # Error: PYI054 9 | field08: int = -1234567801 @@ -82,7 +82,7 @@ PYI054.pyi:10:17: PYI054 [**] Numeric literals with a string representation long 12 12 | field10: float = 123.456789 13 13 | field11: float = 123.4567890 # Error: PYI054 -PYI054.pyi:13:18: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:13:18: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 12 | field10: float = 123.456789 13 | field11: float = 123.4567890 # Error: PYI054 @@ -102,7 +102,7 @@ PYI054.pyi:13:18: PYI054 [**] Numeric literals with a string representation long 15 15 | field13: float = -123.567_890 # Error: PYI054 16 16 | -PYI054.pyi:15:19: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:15:19: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 13 | field11: float = 123.4567890 # Error: PYI054 14 | field12: float = -123.456789 @@ -123,7 +123,7 @@ PYI054.pyi:15:19: PYI054 [**] Numeric literals with a string representation long 17 17 | field14: complex = 1e1234567j 18 18 | field15: complex = 1e12345678j # Error: PYI054 -PYI054.pyi:18:20: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:18:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 17 | field14: complex = 1e1234567j 18 | field15: complex = 1e12345678j # Error: PYI054 @@ -142,7 +142,7 @@ PYI054.pyi:18:20: PYI054 [**] Numeric literals with a string representation long 19 19 | field16: complex = -1e1234567j 20 20 | field17: complex = 1e123456789j # Error: PYI054 -PYI054.pyi:20:20: PYI054 [**] Numeric literals with a string representation longer than ten characters are not permitted +PYI054.pyi:20:20: PYI054 [*] Numeric literals with a string representation longer than ten characters are not permitted | 18 | field15: complex = 1e12345678j # Error: PYI054 19 | field16: complex = -1e1234567j diff --git a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap index c961b4bc0c325e..f8db4ff1b26124 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap +++ b/crates/ruff_linter/src/rules/flake8_pyi/snapshots/ruff_linter__rules__flake8_pyi__tests__py38_PYI026_PYI026.pyi.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs --- -PYI026.pyi:3:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` +PYI026.pyi:3:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `NewAny: TypeAlias = Any` | 1 | from typing import Literal, Any 2 | @@ -22,7 +22,7 @@ PYI026.pyi:3:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e. 5 6 | Foo = Literal["foo"] 6 7 | IntOrStr = int | str -PYI026.pyi:4:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` +PYI026.pyi:4:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `OptionalStr: TypeAlias = typing.Optional[str]` | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -43,7 +43,7 @@ PYI026.pyi:4:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e. 6 7 | IntOrStr = int | str 7 8 | AliasNone = None -PYI026.pyi:5:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` +PYI026.pyi:5:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `Foo: TypeAlias = Literal["foo"]` | 3 | NewAny = Any 4 | OptionalStr = typing.Optional[str] @@ -66,7 +66,7 @@ PYI026.pyi:5:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e. 7 8 | AliasNone = None 8 9 | -PYI026.pyi:6:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` +PYI026.pyi:6:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `IntOrStr: TypeAlias = int | str` | 4 | OptionalStr = typing.Optional[str] 5 | Foo = Literal["foo"] @@ -89,7 +89,7 @@ PYI026.pyi:6:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e. 8 9 | 9 10 | NewAny: typing.TypeAlias = Any -PYI026.pyi:7:1: PYI026 [**] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` +PYI026.pyi:7:1: PYI026 [*] Use `typing_extensions.TypeAlias` for type alias, e.g., `AliasNone: TypeAlias = None` | 5 | Foo = Literal["foo"] 6 | IntOrStr = int | str diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap index 1ce38d70571ab4..ceb7e0f5b16328 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT003.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT003.py:14:17: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:14:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 14 | @pytest.fixture(scope="function") | ^^^^^^^^^^^^^^^^ PT003 @@ -20,7 +20,7 @@ PT003.py:14:17: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` 16 16 | ... 17 17 | -PT003.py:19:17: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:19:17: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 19 | @pytest.fixture(scope="function", name="my_fixture") | ^^^^^^^^^^^^^^^^ PT003 @@ -39,7 +39,7 @@ PT003.py:19:17: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` 21 21 | ... 22 22 | -PT003.py:24:36: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:24:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 24 | @pytest.fixture(name="my_fixture", scope="function") | ^^^^^^^^^^^^^^^^ PT003 @@ -58,7 +58,7 @@ PT003.py:24:36: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` 26 26 | ... 27 27 | -PT003.py:29:36: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:29:36: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 29 | @pytest.fixture(name="my_fixture", scope="function", **kwargs) | ^^^^^^^^^^^^^^^^ PT003 @@ -77,7 +77,7 @@ PT003.py:29:36: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` 31 31 | ... 32 32 | -PT003.py:37:31: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:37:31: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 35 | # tests the general case as we use a helper function that should 36 | # work for all cases. @@ -98,7 +98,7 @@ PT003.py:37:31: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` 39 39 | ... 40 40 | -PT003.py:43:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:43:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 42 | @pytest.fixture( 43 | scope="function", @@ -117,7 +117,7 @@ PT003.py:43:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` 45 44 | ) 46 45 | def error_multiple_args(): -PT003.py:52:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:52:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 50 | @pytest.fixture( 51 | name="my_fixture", @@ -137,7 +137,7 @@ PT003.py:52:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` 54 53 | def error_multiple_args(): 55 54 | ... -PT003.py:66:5: PT003 [**] `scope='function'` is implied in `@pytest.fixture()` +PT003.py:66:5: PT003 [*] `scope='function'` is implied in `@pytest.fixture()` | 64 | # another comment ,) 65 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap index fe881db1ddda1f..1399986a40c656 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT006.py:24:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv` +PT006.py:24:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv` | 24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ PT006 @@ -39,7 +39,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 31 31 | ... 32 32 | -PT006.py:34:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv` +PT006.py:34:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `csv` | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ PT006 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap index 3beec6ca92d639..c9e8b5e0c50016 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_default.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT006.py:9:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ PT006 @@ -20,7 +20,7 @@ PT006.py:9:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expe 11 11 | ... 12 12 | -PT006.py:14:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -39,7 +39,7 @@ PT006.py:14:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 16 16 | ... 17 17 | -PT006.py:19:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ PT006 @@ -77,7 +77,7 @@ PT006.py:29:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 31 31 | ... 32 32 | -PT006.py:34:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:34:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ PT006 @@ -115,7 +115,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 41 41 | ... 42 42 | -PT006.py:44:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:44:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3]) | ^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -134,7 +134,7 @@ PT006.py:44:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 46 46 | ... 47 47 | -PT006.py:49:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:49:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3]) | ^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -153,7 +153,7 @@ PT006.py:49:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 51 51 | ... 52 52 | -PT006.py:54:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -172,7 +172,7 @@ PT006.py:54:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 56 56 | ... 57 57 | -PT006.py:59:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -191,7 +191,7 @@ PT006.py:59:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 61 61 | ... 62 62 | -PT006.py:64:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -210,7 +210,7 @@ PT006.py:64:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 66 66 | ... 67 67 | -PT006.py:69:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` +PT006.py:69:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple` | 69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^ PT006 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap index 5d65f77d6536bf..bdce72095b1a4c 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_list.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT006.py:9:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:9:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ PT006 @@ -20,7 +20,7 @@ PT006.py:9:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expe 11 11 | ... 12 12 | -PT006.py:14:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:14:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -39,7 +39,7 @@ PT006.py:14:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 16 16 | ... 17 17 | -PT006.py:19:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:19:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^ PT006 @@ -58,7 +58,7 @@ PT006.py:19:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 21 21 | ... 22 22 | -PT006.py:24:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:24:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^^^^ PT006 @@ -115,7 +115,7 @@ PT006.py:39:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expe 41 41 | ... 42 42 | -PT006.py:54:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:54:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -134,7 +134,7 @@ PT006.py:54:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 56 56 | ... 57 57 | -PT006.py:59:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:59:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -153,7 +153,7 @@ PT006.py:59:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 61 61 | ... 62 62 | -PT006.py:64:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:64:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006 @@ -172,7 +172,7 @@ PT006.py:64:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, exp 66 66 | ... 67 67 | -PT006.py:69:26: PT006 [**] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` +PT006.py:69:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `list` | 69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)]) | ^^^^^^^^^^^^^^^^^ PT006 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap index 6e1cbcde1b2682..9b4b7fc1e426a8 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT009.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT009.py:11:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:11:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 9 | expr = 1 10 | msg = "Must be True" @@ -22,7 +22,7 @@ PT009.py:11:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 13 13 | self.assertTrue(expr, msg) # Error 14 14 | self.assertTrue(expr=expr, msg=msg) # Error -PT009.py:12:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:12:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 10 | msg = "Must be True" 11 | self.assertTrue(expr) # Error @@ -43,7 +43,7 @@ PT009.py:12:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 14 14 | self.assertTrue(expr=expr, msg=msg) # Error 15 15 | self.assertTrue(msg=msg, expr=expr) # Error -PT009.py:13:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:13:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 11 | self.assertTrue(expr) # Error 12 | self.assertTrue(expr=expr) # Error @@ -64,7 +64,7 @@ PT009.py:13:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 15 15 | self.assertTrue(msg=msg, expr=expr) # Error 16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable -PT009.py:14:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:14:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 12 | self.assertTrue(expr=expr) # Error 13 | self.assertTrue(expr, msg) # Error @@ -85,7 +85,7 @@ PT009.py:14:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 16 16 | self.assertTrue(*(expr, msg)) # Error, unfixable 17 17 | self.assertTrue(**{"expr": expr, "msg": msg}) # Error, unfixable -PT009.py:15:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:15:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 13 | self.assertTrue(expr, msg) # Error 14 | self.assertTrue(expr=expr, msg=msg) # Error @@ -183,7 +183,7 @@ PT009.py:25:16: PT009 Use a regular `assert` instead of unittest-style `assertEq | = help: Replace `assertEqual(...)` with `assert ...` -PT009.py:28:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertFalse` +PT009.py:28:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertFalse` | 27 | def test_assert_false(self): 28 | self.assertFalse(True) # Error @@ -203,7 +203,7 @@ PT009.py:28:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 30 30 | def test_assert_equal(self): 31 31 | self.assertEqual(1, 2) # Error -PT009.py:31:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertEqual` +PT009.py:31:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertEqual` | 30 | def test_assert_equal(self): 31 | self.assertEqual(1, 2) # Error @@ -223,7 +223,7 @@ PT009.py:31:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 33 33 | def test_assert_not_equal(self): 34 34 | self.assertNotEqual(1, 1) # Error -PT009.py:34:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotEqual` +PT009.py:34:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotEqual` | 33 | def test_assert_not_equal(self): 34 | self.assertNotEqual(1, 1) # Error @@ -243,7 +243,7 @@ PT009.py:34:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 36 36 | def test_assert_greater(self): 37 37 | self.assertGreater(1, 2) # Error -PT009.py:37:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertGreater` +PT009.py:37:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreater` | 36 | def test_assert_greater(self): 37 | self.assertGreater(1, 2) # Error @@ -263,7 +263,7 @@ PT009.py:37:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 39 39 | def test_assert_greater_equal(self): 40 40 | self.assertGreaterEqual(1, 2) # Error -PT009.py:40:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertGreaterEqual` +PT009.py:40:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertGreaterEqual` | 39 | def test_assert_greater_equal(self): 40 | self.assertGreaterEqual(1, 2) # Error @@ -283,7 +283,7 @@ PT009.py:40:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 42 42 | def test_assert_less(self): 43 43 | self.assertLess(2, 1) # Error -PT009.py:43:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertLess` +PT009.py:43:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLess` | 42 | def test_assert_less(self): 43 | self.assertLess(2, 1) # Error @@ -303,7 +303,7 @@ PT009.py:43:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 45 45 | def test_assert_less_equal(self): 46 46 | self.assertLessEqual(1, 2) # Error -PT009.py:46:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertLessEqual` +PT009.py:46:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertLessEqual` | 45 | def test_assert_less_equal(self): 46 | self.assertLessEqual(1, 2) # Error @@ -323,7 +323,7 @@ PT009.py:46:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 48 48 | def test_assert_in(self): 49 49 | self.assertIn(1, [2, 3]) # Error -PT009.py:49:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIn` +PT009.py:49:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIn` | 48 | def test_assert_in(self): 49 | self.assertIn(1, [2, 3]) # Error @@ -343,7 +343,7 @@ PT009.py:49:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 51 51 | def test_assert_not_in(self): 52 52 | self.assertNotIn(2, [2, 3]) # Error -PT009.py:52:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotIn` +PT009.py:52:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIn` | 51 | def test_assert_not_in(self): 52 | self.assertNotIn(2, [2, 3]) # Error @@ -363,7 +363,7 @@ PT009.py:52:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 54 54 | def test_assert_is_none(self): 55 55 | self.assertIsNone(0) # Error -PT009.py:55:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNone` +PT009.py:55:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNone` | 54 | def test_assert_is_none(self): 55 | self.assertIsNone(0) # Error @@ -383,7 +383,7 @@ PT009.py:55:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 57 57 | def test_assert_is_not_none(self): 58 58 | self.assertIsNotNone(0) # Error -PT009.py:58:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNotNone` +PT009.py:58:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNotNone` | 57 | def test_assert_is_not_none(self): 58 | self.assertIsNotNone(0) # Error @@ -403,7 +403,7 @@ PT009.py:58:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 60 60 | def test_assert_is(self): 61 61 | self.assertIs([], []) # Error -PT009.py:61:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIs` +PT009.py:61:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIs` | 60 | def test_assert_is(self): 61 | self.assertIs([], []) # Error @@ -423,7 +423,7 @@ PT009.py:61:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 63 63 | def test_assert_is_not(self): 64 64 | self.assertIsNot(1, 1) # Error -PT009.py:64:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsNot` +PT009.py:64:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsNot` | 63 | def test_assert_is_not(self): 64 | self.assertIsNot(1, 1) # Error @@ -443,7 +443,7 @@ PT009.py:64:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 66 66 | def test_assert_is_instance(self): 67 67 | self.assertIsInstance(1, str) # Error -PT009.py:67:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertIsInstance` +PT009.py:67:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertIsInstance` | 66 | def test_assert_is_instance(self): 67 | self.assertIsInstance(1, str) # Error @@ -463,7 +463,7 @@ PT009.py:67:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 69 69 | def test_assert_is_not_instance(self): 70 70 | self.assertNotIsInstance(1, int) # Error -PT009.py:70:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotIsInstance` +PT009.py:70:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotIsInstance` | 69 | def test_assert_is_not_instance(self): 70 | self.assertNotIsInstance(1, int) # Error @@ -483,7 +483,7 @@ PT009.py:70:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 72 72 | def test_assert_regex(self): 73 73 | self.assertRegex("abc", r"def") # Error -PT009.py:73:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertRegex` +PT009.py:73:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegex` | 72 | def test_assert_regex(self): 73 | self.assertRegex("abc", r"def") # Error @@ -503,7 +503,7 @@ PT009.py:73:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 75 75 | def test_assert_not_regex(self): 76 76 | self.assertNotRegex("abc", r"abc") # Error -PT009.py:76:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotRegex` +PT009.py:76:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex` | 75 | def test_assert_not_regex(self): 76 | self.assertNotRegex("abc", r"abc") # Error @@ -523,7 +523,7 @@ PT009.py:76:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 78 78 | def test_assert_regexp_matches(self): 79 79 | self.assertRegexpMatches("abc", r"def") # Error -PT009.py:79:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertRegexpMatches` +PT009.py:79:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertRegexpMatches` | 78 | def test_assert_regexp_matches(self): 79 | self.assertRegexpMatches("abc", r"def") # Error @@ -543,7 +543,7 @@ PT009.py:79:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 81 81 | def test_assert_not_regexp_matches(self): 82 82 | self.assertNotRegex("abc", r"abc") # Error -PT009.py:82:9: PT009 [**] Use a regular `assert` instead of unittest-style `assertNotRegex` +PT009.py:82:9: PT009 [*] Use a regular `assert` instead of unittest-style `assertNotRegex` | 81 | def test_assert_not_regexp_matches(self): 82 | self.assertNotRegex("abc", r"abc") # Error @@ -563,7 +563,7 @@ PT009.py:82:9: PT009 [**] Use a regular `assert` instead of unittest-style `asse 84 84 | def test_fail_if(self): 85 85 | self.failIf("abc") # Error -PT009.py:85:9: PT009 [**] Use a regular `assert` instead of unittest-style `failIf` +PT009.py:85:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIf` | 84 | def test_fail_if(self): 85 | self.failIf("abc") # Error @@ -583,7 +583,7 @@ PT009.py:85:9: PT009 [**] Use a regular `assert` instead of unittest-style `fail 87 87 | def test_fail_unless(self): 88 88 | self.failUnless("abc") # Error -PT009.py:88:9: PT009 [**] Use a regular `assert` instead of unittest-style `failUnless` +PT009.py:88:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnless` | 87 | def test_fail_unless(self): 88 | self.failUnless("abc") # Error @@ -603,7 +603,7 @@ PT009.py:88:9: PT009 [**] Use a regular `assert` instead of unittest-style `fail 90 90 | def test_fail_unless_equal(self): 91 91 | self.failUnlessEqual(1, 2) # Error -PT009.py:91:9: PT009 [**] Use a regular `assert` instead of unittest-style `failUnlessEqual` +PT009.py:91:9: PT009 [*] Use a regular `assert` instead of unittest-style `failUnlessEqual` | 90 | def test_fail_unless_equal(self): 91 | self.failUnlessEqual(1, 2) # Error @@ -623,7 +623,7 @@ PT009.py:91:9: PT009 [**] Use a regular `assert` instead of unittest-style `fail 93 93 | def test_fail_if_equal(self): 94 94 | self.failIfEqual(1, 2) # Error -PT009.py:94:9: PT009 [**] Use a regular `assert` instead of unittest-style `failIfEqual` +PT009.py:94:9: PT009 [*] Use a regular `assert` instead of unittest-style `failIfEqual` | 93 | def test_fail_if_equal(self): 94 | self.failIfEqual(1, 2) # Error @@ -641,7 +641,7 @@ PT009.py:94:9: PT009 [**] Use a regular `assert` instead of unittest-style `fail 96 96 | 97 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 -PT009.py:98:2: PT009 [**] Use a regular `assert` instead of unittest-style `assertTrue` +PT009.py:98:2: PT009 [*] Use a regular `assert` instead of unittest-style `assertTrue` | 97 | # Regression test for: https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722459517 98 | (self.assertTrue( diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap index eb0a428b93070f..2e05167b05b057 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT014.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT014.py:4:35: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:4:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 4 | @pytest.mark.parametrize("x", [1, 1, 2]) | ^ PT014 @@ -20,7 +20,7 @@ PT014.py:4:35: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.par 6 6 | ... 7 7 | -PT014.py:14:35: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:14:35: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ PT014 @@ -39,7 +39,7 @@ PT014.py:14:35: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.pa 16 16 | ... 17 17 | -PT014.py:14:41: PT014 [**] Duplicate of test case at index 2 in `@pytest_mark.parametrize` +PT014.py:14:41: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ PT014 @@ -58,7 +58,7 @@ PT014.py:14:41: PT014 [**] Duplicate of test case at index 2 in `@pytest_mark.pa 16 16 | ... 17 17 | -PT014.py:14:44: PT014 [**] Duplicate of test case at index 2 in `@pytest_mark.parametrize` +PT014.py:14:44: PT014 [*] Duplicate of test case at index 2 in `@pytest_mark.parametrize` | 14 | @pytest.mark.parametrize("x", [a, a, b, b, b, c]) | ^ PT014 @@ -88,7 +88,7 @@ PT014.py:24:9: PT014 Duplicate of test case at index 0 in `@pytest_mark.parametr | = help: Remove duplicate test case -PT014.py:32:39: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:32:39: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) | ^ PT014 @@ -107,7 +107,7 @@ PT014.py:32:39: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.pa 34 34 | ... 35 35 | -PT014.py:32:48: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:32:48: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 32 | @pytest.mark.parametrize("x", [a, b, (a), c, ((a))]) | ^ PT014 @@ -126,7 +126,7 @@ PT014.py:32:48: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.pa 34 34 | ... 35 35 | -PT014.py:42:10: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:42:10: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 40 | a, 41 | b, @@ -146,7 +146,7 @@ PT014.py:42:10: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.pa 44 43 | ((a)), 45 44 | ], -PT014.py:44:11: PT014 [**] Duplicate of test case at index 0 in `@pytest_mark.parametrize` +PT014.py:44:11: PT014 [*] Duplicate of test case at index 0 in `@pytest_mark.parametrize` | 42 | (a), 43 | c, diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap index 9b30576ed2281b..a656a5c666f59e 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT018.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT018.py:14:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:14:5: PT018 [*] Assertion should be broken down into multiple parts | 13 | def test_error(): 14 | assert something and something_else @@ -22,7 +22,7 @@ PT018.py:14:5: PT018 [**] Assertion should be broken down into multiple parts 16 17 | assert something and not something_else 17 18 | assert something and (something_else or something_third) -PT018.py:15:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:15:5: PT018 [*] Assertion should be broken down into multiple parts | 13 | def test_error(): 14 | assert something and something_else @@ -44,7 +44,7 @@ PT018.py:15:5: PT018 [**] Assertion should be broken down into multiple parts 17 18 | assert something and (something_else or something_third) 18 19 | assert not something and something_else -PT018.py:16:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:16:5: PT018 [*] Assertion should be broken down into multiple parts | 14 | assert something and something_else 15 | assert something and something_else and something_third @@ -66,7 +66,7 @@ PT018.py:16:5: PT018 [**] Assertion should be broken down into multiple parts 18 19 | assert not something and something_else 19 20 | assert not (something or something_else) -PT018.py:17:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:17:5: PT018 [*] Assertion should be broken down into multiple parts | 15 | assert something and something_else and something_third 16 | assert something and not something_else @@ -88,7 +88,7 @@ PT018.py:17:5: PT018 [**] Assertion should be broken down into multiple parts 19 20 | assert not (something or something_else) 20 21 | assert not (something or something_else or something_third) -PT018.py:18:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:18:5: PT018 [*] Assertion should be broken down into multiple parts | 16 | assert something and not something_else 17 | assert something and (something_else or something_third) @@ -110,7 +110,7 @@ PT018.py:18:5: PT018 [**] Assertion should be broken down into multiple parts 20 21 | assert not (something or something_else or something_third) 21 22 | assert something and something_else == """error -PT018.py:19:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:19:5: PT018 [*] Assertion should be broken down into multiple parts | 17 | assert something and (something_else or something_third) 18 | assert not something and something_else @@ -132,7 +132,7 @@ PT018.py:19:5: PT018 [**] Assertion should be broken down into multiple parts 21 22 | assert something and something_else == """error 22 23 | message -PT018.py:20:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:20:5: PT018 [*] Assertion should be broken down into multiple parts | 18 | assert not something and something_else 19 | assert not (something or something_else) @@ -154,7 +154,7 @@ PT018.py:20:5: PT018 [**] Assertion should be broken down into multiple parts 22 23 | message 23 24 | """ -PT018.py:21:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:21:5: PT018 [*] Assertion should be broken down into multiple parts | 19 | assert not (something or something_else) 20 | assert not (something or something_else or something_third) @@ -179,7 +179,7 @@ PT018.py:21:5: PT018 [**] Assertion should be broken down into multiple parts 23 24 | """ 24 25 | assert ( -PT018.py:24:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:24:5: PT018 [*] Assertion should be broken down into multiple parts | 22 | message 23 | """ @@ -210,7 +210,7 @@ PT018.py:24:5: PT018 [**] Assertion should be broken down into multiple parts 28 28 | message 29 29 | """ -PT018.py:33:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:33:5: PT018 [*] Assertion should be broken down into multiple parts | 32 | # recursive case 33 | assert not (a or not (b or c)) @@ -230,7 +230,7 @@ PT018.py:33:5: PT018 [**] Assertion should be broken down into multiple parts 35 36 | 36 37 | # detected, but no fix for messages -PT018.py:34:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:34:5: PT018 [*] Assertion should be broken down into multiple parts | 32 | # recursive case 33 | assert not (a or not (b or c)) @@ -282,7 +282,7 @@ PT018.py:40:5: PT018 Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -PT018.py:44:1: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:44:1: PT018 [*] Assertion should be broken down into multiple parts | 43 | assert something # OK 44 | assert something and something_else # Error @@ -302,7 +302,7 @@ PT018.py:44:1: PT018 [**] Assertion should be broken down into multiple parts 46 47 | 47 48 | -PT018.py:45:1: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:45:1: PT018 [*] Assertion should be broken down into multiple parts | 43 | assert something # OK 44 | assert something and something_else # Error @@ -351,7 +351,7 @@ PT018.py:54:9: PT018 Assertion should be broken down into multiple parts | = help: Break down assertion into multiple parts -PT018.py:59:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:59:5: PT018 [*] Assertion should be broken down into multiple parts | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/7143 58 | def test_parenthesized_not(): @@ -380,7 +380,7 @@ PT018.py:59:5: PT018 [**] Assertion should be broken down into multiple parts 65 67 | assert (not ( 66 68 | self.find_graph_output(node.output[0]) -PT018.py:65:5: PT018 [**] Assertion should be broken down into multiple parts +PT018.py:65:5: PT018 [*] Assertion should be broken down into multiple parts | 63 | ) 64 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap index 7c3be1d128baef..4bf726cece5838 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT026.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT026.py:19:1: PT026 [**] Useless `pytest.mark.usefixtures` without parameters +PT026.py:19:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | 19 | @pytest.mark.usefixtures() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ PT026 @@ -20,7 +20,7 @@ PT026.py:19:1: PT026 [**] Useless `pytest.mark.usefixtures` without parameters 21 21 | pass 22 22 | -PT026.py:24:1: PT026 [**] Useless `pytest.mark.usefixtures` without parameters +PT026.py:24:1: PT026 [*] Useless `pytest.mark.usefixtures` without parameters | 24 | @pytest.mark.usefixtures | ^^^^^^^^^^^^^^^^^^^^^^^^ PT026 diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap index b92f47ea146775..dd48d601634ba9 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_0.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT027_0.py:6:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises` +PT027_0.py:6:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises` | 4 | class Test(unittest.TestCase): 5 | def test_errors(self): @@ -25,7 +25,7 @@ PT027_0.py:6:14: PT027 [**] Use `pytest.raises` instead of unittest-style `asser 8 9 | with self.assertRaises(expected_exception=ValueError): 9 10 | raise ValueError -PT027_0.py:8:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises` +PT027_0.py:8:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises` | 6 | with self.assertRaises(ValueError): 7 | raise ValueError @@ -50,7 +50,7 @@ PT027_0.py:8:14: PT027 [**] Use `pytest.raises` instead of unittest-style `asser 10 11 | 11 12 | with self.failUnlessRaises(ValueError): -PT027_0.py:11:14: PT027 [**] Use `pytest.raises` instead of unittest-style `failUnlessRaises` +PT027_0.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `failUnlessRaises` | 9 | raise ValueError 10 | @@ -76,7 +76,7 @@ PT027_0.py:11:14: PT027 [**] Use `pytest.raises` instead of unittest-style `fail 13 14 | 14 15 | with self.assertRaisesRegex(ValueError, "test"): -PT027_0.py:14:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +PT027_0.py:14:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 12 | raise ValueError 13 | @@ -102,7 +102,7 @@ PT027_0.py:14:14: PT027 [**] Use `pytest.raises` instead of unittest-style `asse 16 17 | 17 18 | with self.assertRaisesRegex(ValueError, expected_regex="test"): -PT027_0.py:17:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +PT027_0.py:17:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 15 | raise ValueError("test") 16 | @@ -128,7 +128,7 @@ PT027_0.py:17:14: PT027 [**] Use `pytest.raises` instead of unittest-style `asse 19 20 | 20 21 | with self.assertRaisesRegex( -PT027_0.py:20:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +PT027_0.py:20:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 18 | raise ValueError("test") 19 | @@ -157,7 +157,7 @@ PT027_0.py:20:14: PT027 [**] Use `pytest.raises` instead of unittest-style `asse 24 23 | 25 24 | with self.assertRaisesRegex( -PT027_0.py:25:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` +PT027_0.py:25:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegex` | 23 | raise ValueError("test") 24 | @@ -186,7 +186,7 @@ PT027_0.py:25:14: PT027 [**] Use `pytest.raises` instead of unittest-style `asse 29 28 | 30 29 | with self.assertRaisesRegexp(ValueError, "test"): -PT027_0.py:30:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp` +PT027_0.py:30:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaisesRegexp` | 28 | raise ValueError("test") 29 | diff --git a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap index abe0aca3025fe8..3886db7a54d0cf 100644 --- a/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap +++ b/crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT027_1.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs --- -PT027_1.py:11:14: PT027 [**] Use `pytest.raises` instead of unittest-style `assertRaises` +PT027_1.py:11:14: PT027 [*] Use `pytest.raises` instead of unittest-style `assertRaises` | 10 | def test_errors(self): 11 | with self.assertRaises(ValueError): diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap index 425ce133a45e63..c3a4baa5697fe6 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET503_RET503.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET503.py:20:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:20:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 18 | # if/elif/else 19 | def x(y): @@ -22,7 +22,7 @@ RET503.py:20:5: RET503 [**] Missing explicit `return` at the end of function abl 23 24 | 24 25 | -RET503.py:27:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:27:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 25 | def x(y): 26 | if not y: @@ -42,7 +42,7 @@ RET503.py:27:9: RET503 [**] Missing explicit `return` at the end of function abl 29 30 | return 2 30 31 | -RET503.py:36:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:36:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 34 | return 1 35 | @@ -60,7 +60,7 @@ RET503.py:36:5: RET503 [**] Missing explicit `return` at the end of function abl 38 39 | 39 40 | # for -RET503.py:41:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:41:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 39 | # for 40 | def x(y): @@ -82,7 +82,7 @@ RET503.py:41:5: RET503 [**] Missing explicit `return` at the end of function abl 45 46 | 46 47 | -RET503.py:52:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:52:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 50 | return i 51 | else: @@ -100,7 +100,7 @@ RET503.py:52:9: RET503 [**] Missing explicit `return` at the end of function abl 54 55 | 55 56 | # A nonexistent function -RET503.py:59:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:59:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 57 | if x > 0: 58 | return False @@ -118,7 +118,7 @@ RET503.py:59:5: RET503 [**] Missing explicit `return` at the end of function abl 61 62 | 62 63 | # A function that does return the control -RET503.py:66:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:66:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 64 | if x > 0: 65 | return False @@ -136,7 +136,7 @@ RET503.py:66:5: RET503 [**] Missing explicit `return` at the end of function abl 68 69 | 69 70 | ### -RET503.py:82:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:82:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 80 | # last line in while loop 81 | def x(y): @@ -158,7 +158,7 @@ RET503.py:82:5: RET503 [**] Missing explicit `return` at the end of function abl 87 88 | 88 89 | # exclude empty functions -RET503.py:113:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:113:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 111 | # return value within loop 112 | def bar1(x, y, z): @@ -180,7 +180,7 @@ RET503.py:113:5: RET503 [**] Missing explicit `return` at the end of function ab 118 119 | 119 120 | def bar3(x, y, z): -RET503.py:120:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:120:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 119 | def bar3(x, y, z): 120 | for i in x: @@ -204,7 +204,7 @@ RET503.py:120:5: RET503 [**] Missing explicit `return` at the end of function ab 128 129 | 129 130 | def bar1(x, y, z): -RET503.py:130:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:130:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 129 | def bar1(x, y, z): 130 | for i in x: @@ -225,7 +225,7 @@ RET503.py:130:5: RET503 [**] Missing explicit `return` at the end of function ab 135 136 | 136 137 | def bar3(x, y, z): -RET503.py:137:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:137:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 136 | def bar3(x, y, z): 137 | for i in x: @@ -249,7 +249,7 @@ RET503.py:137:5: RET503 [**] Missing explicit `return` at the end of function ab 145 146 | 146 147 | def prompts(self, foo): -RET503.py:274:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:274:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 272 | return False 273 | @@ -269,7 +269,7 @@ RET503.py:274:5: RET503 [**] Missing explicit `return` at the end of function ab 277 278 | 278 279 | def while_true(): -RET503.py:291:13: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:291:13: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 289 | return 1 290 | case 1: @@ -287,7 +287,7 @@ RET503.py:291:13: RET503 [**] Missing explicit `return` at the end of function a 293 294 | 294 295 | def foo(baz: str) -> str: -RET503.py:300:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:300:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 298 | def end_of_statement(): 299 | def example(): @@ -307,7 +307,7 @@ RET503.py:300:9: RET503 [**] Missing explicit `return` at the end of function ab 303 304 | 304 305 | def example(): -RET503.py:305:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:305:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 304 | def example(): 305 | if True: @@ -326,7 +326,7 @@ RET503.py:305:9: RET503 [**] Missing explicit `return` at the end of function ab 308 309 | 309 310 | def example(): -RET503.py:310:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:310:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 309 | def example(): 310 | if True: @@ -345,7 +345,7 @@ RET503.py:310:9: RET503 [**] Missing explicit `return` at the end of function ab 313 314 | 314 315 | def example(): -RET503.py:315:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:315:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 314 | def example(): 315 | if True: @@ -364,7 +364,7 @@ RET503.py:315:9: RET503 [**] Missing explicit `return` at the end of function ab 318 319 | 319 320 | def example(): -RET503.py:320:9: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:320:9: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 319 | def example(): 320 | if True: @@ -384,7 +384,7 @@ RET503.py:320:9: RET503 [**] Missing explicit `return` at the end of function ab 324 325 | 325 326 | def end_of_file(): -RET503.py:328:5: RET503 [**] Missing explicit `return` at the end of function able to return non-`None` value +RET503.py:328:5: RET503 [*] Missing explicit `return` at the end of function able to return non-`None` value | 326 | if False: 327 | return 1 diff --git a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap index 1910570dfd4970..c9bcc8798437da 100644 --- a/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap +++ b/crates/ruff_linter/src/rules/flake8_return/snapshots/ruff_linter__rules__flake8_return__tests__RET504_RET504.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_return/mod.rs --- -RET504.py:6:12: RET504 [**] Unnecessary assignment to `a` before `return` statement +RET504.py:6:12: RET504 [*] Unnecessary assignment to `a` before `return` statement | 4 | def x(): 5 | a = 1 @@ -21,7 +21,7 @@ RET504.py:6:12: RET504 [**] Unnecessary assignment to `a` before `return` statem 8 7 | 9 8 | # Can be refactored false positives -RET504.py:23:12: RET504 [**] Unnecessary assignment to `formatted` before `return` statement +RET504.py:23:12: RET504 [*] Unnecessary assignment to `formatted` before `return` statement | 21 | # clean up after any blank components 22 | formatted = formatted.replace("()", "").replace(" ", " ").strip() @@ -41,7 +41,7 @@ RET504.py:23:12: RET504 [**] Unnecessary assignment to `formatted` before `retur 25 24 | 26 25 | # https://github.com/afonasev/flake8-return/issues/47#issue-641117366 -RET504.py:246:12: RET504 [**] Unnecessary assignment to `queryset` before `return` statement +RET504.py:246:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement | 244 | queryset = Model.filter(a=1) 245 | queryset = queryset.filter(c=3) @@ -61,7 +61,7 @@ RET504.py:246:12: RET504 [**] Unnecessary assignment to `queryset` before `retur 248 247 | 249 248 | def get_queryset(): -RET504.py:251:12: RET504 [**] Unnecessary assignment to `queryset` before `return` statement +RET504.py:251:12: RET504 [*] Unnecessary assignment to `queryset` before `return` statement | 249 | def get_queryset(): 250 | queryset = Model.filter(a=1) @@ -81,7 +81,7 @@ RET504.py:251:12: RET504 [**] Unnecessary assignment to `queryset` before `retur 253 252 | 254 253 | # Function arguments -RET504.py:269:12: RET504 [**] Unnecessary assignment to `val` before `return` statement +RET504.py:269:12: RET504 [*] Unnecessary assignment to `val` before `return` statement | 267 | return val 268 | val = 1 @@ -101,7 +101,7 @@ RET504.py:269:12: RET504 [**] Unnecessary assignment to `val` before `return` st 271 270 | 272 271 | def str_to_bool(val): -RET504.py:321:12: RET504 [**] Unnecessary assignment to `x` before `return` statement +RET504.py:321:12: RET504 [*] Unnecessary assignment to `x` before `return` statement | 319 | with open("foo.txt", "r") as f: 320 | x = f.read() @@ -121,7 +121,7 @@ RET504.py:321:12: RET504 [**] Unnecessary assignment to `x` before `return` stat 323 322 | 324 323 | def foo(): -RET504.py:342:12: RET504 [**] Unnecessary assignment to `b` before `return` statement +RET504.py:342:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | 340 | a = 1 341 | b=a @@ -141,7 +141,7 @@ RET504.py:342:12: RET504 [**] Unnecessary assignment to `b` before `return` stat 344 343 | 345 344 | def foo(): -RET504.py:348:12: RET504 [**] Unnecessary assignment to `b` before `return` statement +RET504.py:348:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | 346 | a = 1 347 | b =a @@ -161,7 +161,7 @@ RET504.py:348:12: RET504 [**] Unnecessary assignment to `b` before `return` stat 350 349 | 351 350 | def foo(): -RET504.py:354:12: RET504 [**] Unnecessary assignment to `b` before `return` statement +RET504.py:354:12: RET504 [*] Unnecessary assignment to `b` before `return` statement | 352 | a = 1 353 | b= a @@ -181,7 +181,7 @@ RET504.py:354:12: RET504 [**] Unnecessary assignment to `b` before `return` stat 356 355 | 357 356 | def foo(): -RET504.py:359:12: RET504 [**] Unnecessary assignment to `a` before `return` statement +RET504.py:359:12: RET504 [*] Unnecessary assignment to `a` before `return` statement | 357 | def foo(): 358 | a = 1 # Comment @@ -201,7 +201,7 @@ RET504.py:359:12: RET504 [**] Unnecessary assignment to `a` before `return` stat 361 360 | 362 361 | # Regression test for: https://github.com/astral-sh/ruff/issues/7098 -RET504.py:365:12: RET504 [**] Unnecessary assignment to `D` before `return` statement +RET504.py:365:12: RET504 [*] Unnecessary assignment to `D` before `return` statement | 363 | def mavko_debari(P_kbar): 364 | D=0.4853881 + 3.6006116*P - 0.0117368*(P-1.3822)**2 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap index a58e3afc10dfc7..1368303ffa0b85 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM101_SIM101.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM101.py:1:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:1:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 1 | if isinstance(a, int) or isinstance(a, float): # SIM101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SIM101 @@ -16,7 +16,7 @@ SIM101.py:1:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a sin 3 3 | 4 4 | if isinstance(a, (int, float)) or isinstance(a, bool): # SIM101 -SIM101.py:4:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:4:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM101.py:4:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a sin 6 6 | 7 7 | if isinstance(a, int) or isinstance(a, float) or isinstance(b, bool): # SIM101 -SIM101.py:7:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:7:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 5 | pass 6 | @@ -56,7 +56,7 @@ SIM101.py:7:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a sin 9 9 | 10 10 | if isinstance(b, bool) or isinstance(a, int) or isinstance(a, float): # SIM101 -SIM101.py:10:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:10:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 8 | pass 9 | @@ -76,7 +76,7 @@ SIM101.py:10:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a si 12 12 | 13 13 | if isinstance(a, int) or isinstance(b, bool) or isinstance(a, float): # SIM101 -SIM101.py:13:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:13:4: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 11 | pass 12 | @@ -96,7 +96,7 @@ SIM101.py:13:4: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a si 15 15 | 16 16 | if (isinstance(a, int) or isinstance(a, float)) and isinstance(b, bool): # SIM101 -SIM101.py:16:5: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a single call +SIM101.py:16:5: SIM101 [*] Multiple `isinstance` calls for `a`, merge into a single call | 14 | pass 15 | @@ -116,7 +116,7 @@ SIM101.py:16:5: SIM101 [**] Multiple `isinstance` calls for `a`, merge into a si 18 18 | 19 19 | if isinstance(a.b, int) or isinstance(a.b, float): # SIM101 -SIM101.py:19:4: SIM101 [**] Multiple `isinstance` calls for expression, merge into a single call +SIM101.py:19:4: SIM101 [*] Multiple `isinstance` calls for expression, merge into a single call | 17 | pass 18 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap index 9816b463c6bdd9..8f373fc0be83eb 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM102_SIM102.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM102.py:2:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:2:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 1 | # SIM102 2 | / if a: @@ -22,7 +22,7 @@ SIM102.py:2:1: SIM102 [**] Use a single `if` statement instead of nested `if` st 6 5 | # SIM102 7 6 | if a: -SIM102.py:7:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:7:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 6 | # SIM102 7 | / if a: @@ -48,7 +48,7 @@ SIM102.py:7:1: SIM102 [**] Use a single `if` statement instead of nested `if` st 12 11 | # SIM102 13 12 | if a: -SIM102.py:8:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:8:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 6 | # SIM102 7 | if a: @@ -73,7 +73,7 @@ SIM102.py:8:5: SIM102 [**] Use a single `if` statement instead of nested `if` st 12 11 | # SIM102 13 12 | if a: -SIM102.py:15:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:15:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 13 | if a: 14 | pass @@ -108,7 +108,7 @@ SIM102.py:20:1: SIM102 Use a single `if` statement instead of nested `if` statem | = help: Combine `if` statements using `and` -SIM102.py:26:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:26:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 25 | # SIM102 26 | / if a: @@ -134,7 +134,7 @@ SIM102.py:26:1: SIM102 [**] Use a single `if` statement instead of nested `if` s 31 30 | # OK 32 31 | if a: -SIM102.py:51:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:51:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 49 | while x > 0: 50 | # SIM102 @@ -172,7 +172,7 @@ SIM102.py:51:5: SIM102 [**] Use a single `if` statement instead of nested `if` s 64 63 | 65 64 | -SIM102.py:67:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:67:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 66 | # SIM102 67 | / if x > 0: @@ -208,7 +208,7 @@ SIM102.py:67:1: SIM102 [**] Use a single `if` statement instead of nested `if` s 80 79 | 81 80 | while x > 0: -SIM102.py:83:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:83:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 81 | while x > 0: 82 | # SIM102 @@ -239,7 +239,7 @@ SIM102.py:83:5: SIM102 [**] Use a single `if` statement instead of nested `if` s 89 88 | # SIM102 (auto-fixable) 90 89 | if node.module012345678: -SIM102.py:90:1: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:90:1: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 89 | # SIM102 (auto-fixable) 90 | / if node.module012345678: @@ -280,7 +280,7 @@ SIM102.py:97:1: SIM102 Use a single `if` statement instead of nested `if` statem | = help: Combine `if` statements using `and` -SIM102.py:106:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:106:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 104 | # Regression test for https://github.com/apache/airflow/blob/145b16caaa43f0c42bffd97344df916c602cddde/airflow/configuration.py#L1161 105 | if a: @@ -306,7 +306,7 @@ SIM102.py:106:5: SIM102 [**] Use a single `if` statement instead of nested `if` 110 109 | print("elif") 111 110 | -SIM102.py:132:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:132:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 130 | if a: 131 | # SIM 102 @@ -332,7 +332,7 @@ SIM102.py:132:5: SIM102 [**] Use a single `if` statement instead of nested `if` 136 135 | print("bar") 137 136 | -SIM102.py:165:5: SIM102 [**] Use a single `if` statement instead of nested `if` statements +SIM102.py:165:5: SIM102 [*] Use a single `if` statement instead of nested `if` statements | 163 | if a: 164 | pass diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap index 7cb2d25a7c644e..b6eb3af562a5b2 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM103_SIM103.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM103.py:3:5: SIM103 [**] Return the condition `a` directly +SIM103.py:3:5: SIM103 [*] Return the condition `a` directly | 1 | def f(): 2 | # SIM103 @@ -26,7 +26,7 @@ SIM103.py:3:5: SIM103 [**] Return the condition `a` directly 8 5 | 9 6 | def f(): -SIM103.py:11:5: SIM103 [**] Return the condition `a == b` directly +SIM103.py:11:5: SIM103 [*] Return the condition `a == b` directly | 9 | def f(): 10 | # SIM103 @@ -52,7 +52,7 @@ SIM103.py:11:5: SIM103 [**] Return the condition `a == b` directly 16 13 | 17 14 | def f(): -SIM103.py:21:5: SIM103 [**] Return the condition `b` directly +SIM103.py:21:5: SIM103 [*] Return the condition `b` directly | 19 | if a: 20 | return 1 @@ -78,7 +78,7 @@ SIM103.py:21:5: SIM103 [**] Return the condition `b` directly 26 23 | 27 24 | def f(): -SIM103.py:32:9: SIM103 [**] Return the condition `b` directly +SIM103.py:32:9: SIM103 [*] Return the condition `b` directly | 30 | return 1 31 | else: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap index 6e4c1bbb4117ab..747d835818013f 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM105_0.py:6:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +SIM105_0.py:6:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 5 | # SIM105 6 | / try: @@ -28,7 +28,7 @@ SIM105_0.py:6:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `t 11 10 | 12 11 | # SIM105 -SIM105_0.py:13:1: SIM105 [**] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:13:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | 12 | # SIM105 13 | / try: @@ -59,7 +59,7 @@ SIM105_0.py:13:1: SIM105 [**] Use `contextlib.suppress(ValueError, OSError)` ins 18 17 | # SIM105 19 18 | try: -SIM105_0.py:19:1: SIM105 [**] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:19:1: SIM105 [*] Use `contextlib.suppress(ValueError, OSError)` instead of `try`-`except`-`pass` | 18 | # SIM105 19 | / try: @@ -90,7 +90,7 @@ SIM105_0.py:19:1: SIM105 [**] Use `contextlib.suppress(ValueError, OSError)` ins 24 23 | # SIM105 25 24 | try: -SIM105_0.py:25:1: SIM105 [**] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass` +SIM105_0.py:25:1: SIM105 [*] Use `contextlib.suppress(Exception)` instead of `try`-`except`-`pass` | 24 | # SIM105 25 | / try: @@ -121,7 +121,7 @@ SIM105_0.py:25:1: SIM105 [**] Use `contextlib.suppress(Exception)` instead of `t 30 29 | # SIM105 31 30 | try: -SIM105_0.py:31:1: SIM105 [**] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass` +SIM105_0.py:31:1: SIM105 [*] Use `contextlib.suppress(a.Error, b.Error)` instead of `try`-`except`-`pass` | 30 | # SIM105 31 | / try: @@ -152,7 +152,7 @@ SIM105_0.py:31:1: SIM105 [**] Use `contextlib.suppress(a.Error, b.Error)` instea 36 35 | # OK 37 36 | try: -SIM105_0.py:85:5: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +SIM105_0.py:85:5: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 83 | def with_ellipsis(): 84 | # OK @@ -197,7 +197,7 @@ SIM105_0.py:100:5: SIM105 Use `contextlib.suppress(ValueError, OSError)` instead | = help: Replace with `contextlib.suppress(ValueError, OSError)` -SIM105_0.py:117:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:117:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | 115 | # Regression test for: https://github.com/astral-sh/ruff/issues/7123 116 | def write_models(directory, Models): @@ -230,7 +230,7 @@ SIM105_0.py:117:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `tr 122 121 | try: os.makedirs(model_dir); 123 122 | except OSError: -SIM105_0.py:122:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:122:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | 120 | pass; 121 | @@ -261,7 +261,7 @@ SIM105_0.py:122:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `tr 126 125 | try: os.makedirs(model_dir); 127 126 | except OSError: -SIM105_0.py:126:5: SIM105 [**] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` +SIM105_0.py:126:5: SIM105 [*] Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass` | 124 | pass; 125 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap index 67e13ee2fd6a23..e7eba1d76e002d 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM105_1.py:5:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +SIM105_1.py:5:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 4 | # SIM105 5 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap index 33d9b3270ff19b..adf563480a1c48 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM105_2.py:10:1: SIM105 [**] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` +SIM105_2.py:10:1: SIM105 [*] Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass` | 9 | # SIM105 10 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap index 1558a8c3f26488..8f221aa111e300 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM105_SIM105_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM105_4.py:2:1: SIM105 [**] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass` +SIM105_4.py:2:1: SIM105 [*] Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass` | 1 | #!/usr/bin/env python 2 | / try: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap index e6e680041aa087..c4aad0339a2597 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM108_SIM108.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM108.py:2:1: SIM108 [**] Use ternary operator `b = c if a else d` instead of `if`-`else`-block +SIM108.py:2:1: SIM108 [*] Use ternary operator `b = c if a else d` instead of `if`-`else`-block | 1 | # SIM108 2 | / if a: @@ -25,7 +25,7 @@ SIM108.py:2:1: SIM108 [**] Use ternary operator `b = c if a else d` instead of ` 7 4 | # OK 8 5 | b = c if a else d -SIM108.py:30:5: SIM108 [**] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block +SIM108.py:30:5: SIM108 [*] Use ternary operator `b = 1 if a else 2` instead of `if`-`else`-block | 28 | pass 29 | else: @@ -64,7 +64,7 @@ SIM108.py:58:1: SIM108 Use ternary operator `abc = x if x > 0 else -x` instead o | = help: Replace `if`-`else`-block with `abc = x if x > 0 else -x` -SIM108.py:82:1: SIM108 [**] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block +SIM108.py:82:1: SIM108 [*] Use ternary operator `b = "cccccccccccccccccccccccccccccccccß" if a else "ddddddddddddddddddddddddddddddddd💣"` instead of `if`-`else`-block | 81 | # SIM108 82 | / if a: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap index ff368751e50ddb..fd8700afbae49a 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM109_SIM109.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM109.py:2:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons +SIM109.py:2:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | 1 | # SIM109 2 | if a == b or a == c: @@ -18,7 +18,7 @@ SIM109.py:2:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality compar 4 4 | 5 5 | # SIM109 -SIM109.py:6:5: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons +SIM109.py:6:5: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | 5 | # SIM109 6 | if (a == b or a == c) and None: @@ -37,7 +37,7 @@ SIM109.py:6:5: SIM109 [**] Use `a in (b, c)` instead of multiple equality compar 8 8 | 9 9 | # SIM109 -SIM109.py:10:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons +SIM109.py:10:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | 9 | # SIM109 10 | if a == b or a == c or None: @@ -56,7 +56,7 @@ SIM109.py:10:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality compa 12 12 | 13 13 | # SIM109 -SIM109.py:14:4: SIM109 [**] Use `a in (b, c)` instead of multiple equality comparisons +SIM109.py:14:4: SIM109 [*] Use `a in (b, c)` instead of multiple equality comparisons | 13 | # SIM109 14 | if a == b or None or a == c: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap index 04c611b6211c90..1473e4bfdaab31 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM110.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM110.py:3:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 1 | def f(): 2 | # SIM110 @@ -26,7 +26,7 @@ SIM110.py:3:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead 8 5 | 9 6 | def f(): -SIM110.py:25:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM110.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 23 | def f(): 24 | # SIM111 @@ -52,7 +52,7 @@ SIM110.py:25:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` ins 30 27 | 31 28 | def f(): -SIM110.py:33:5: SIM110 [**] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop +SIM110.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop | 31 | def f(): 32 | # SIM111 @@ -78,7 +78,7 @@ SIM110.py:33:5: SIM110 [**] Use `return all(x.is_empty() for x in iterable)` ins 38 35 | 39 36 | def f(): -SIM110.py:55:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 53 | def f(): 54 | # SIM110 @@ -106,7 +106,7 @@ SIM110.py:55:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead 61 57 | 62 58 | def f(): -SIM110.py:64:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM110.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 62 | def f(): 63 | # SIM111 @@ -134,7 +134,7 @@ SIM110.py:64:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` ins 70 66 | 71 67 | def f(): -SIM110.py:73:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 71 | def f(): 72 | # SIM110 @@ -163,7 +163,7 @@ SIM110.py:73:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead 79 75 | 80 76 | -SIM110.py:83:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM110.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 81 | def f(): 82 | # SIM111 @@ -218,7 +218,7 @@ SIM110.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead | = help: Replace with `return all(not check(x) for x in iterable)` -SIM110.py:144:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 143 | # SIM110 144 | for x in iterable: @@ -243,7 +243,7 @@ SIM110.py:144:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instea 149 146 | 150 147 | def f(): -SIM110.py:154:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM110.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 153 | # SIM111 154 | for x in iterable: @@ -268,7 +268,7 @@ SIM110.py:154:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` in 159 156 | 160 157 | def f(): -SIM110.py:162:5: SIM110 [**] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop +SIM110.py:162:5: SIM110 [*] Use `return any(x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ")` instead of `for` loop | 160 | def f(): 161 | # SIM110 @@ -294,7 +294,7 @@ SIM110.py:162:5: SIM110 [**] Use `return any(x.isdigit() for x in "012ß9💣2 167 164 | 168 165 | def f(): -SIM110.py:184:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM110.py:184:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 182 | async def f(): 183 | # SIM110 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap index 72708ef64db805..85c7002246f5de 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM110_SIM111.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM111.py:3:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM111.py:3:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 1 | def f(): 2 | # SIM110 @@ -26,7 +26,7 @@ SIM111.py:3:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead 8 5 | 9 6 | def f(): -SIM111.py:25:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM111.py:25:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 23 | def f(): 24 | # SIM111 @@ -52,7 +52,7 @@ SIM111.py:25:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` ins 30 27 | 31 28 | def f(): -SIM111.py:33:5: SIM110 [**] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop +SIM111.py:33:5: SIM110 [*] Use `return all(x.is_empty() for x in iterable)` instead of `for` loop | 31 | def f(): 32 | # SIM111 @@ -78,7 +78,7 @@ SIM111.py:33:5: SIM110 [**] Use `return all(x.is_empty() for x in iterable)` ins 38 35 | 39 36 | def f(): -SIM111.py:55:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM111.py:55:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 53 | def f(): 54 | # SIM110 @@ -106,7 +106,7 @@ SIM111.py:55:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead 61 57 | 62 58 | def f(): -SIM111.py:64:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM111.py:64:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 62 | def f(): 63 | # SIM111 @@ -134,7 +134,7 @@ SIM111.py:64:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` ins 70 66 | 71 67 | def f(): -SIM111.py:73:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM111.py:73:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 71 | def f(): 72 | # SIM110 @@ -163,7 +163,7 @@ SIM111.py:73:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead 79 75 | 80 76 | -SIM111.py:83:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM111.py:83:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 81 | def f(): 82 | # SIM111 @@ -218,7 +218,7 @@ SIM111.py:134:5: SIM110 Use `return all(not check(x) for x in iterable)` instead | = help: Replace with `return all(not check(x) for x in iterable)` -SIM111.py:144:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instead of `for` loop +SIM111.py:144:5: SIM110 [*] Use `return any(check(x) for x in iterable)` instead of `for` loop | 143 | # SIM110 144 | for x in iterable: @@ -243,7 +243,7 @@ SIM111.py:144:5: SIM110 [**] Use `return any(check(x) for x in iterable)` instea 149 146 | 150 147 | def f(): -SIM111.py:154:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` instead of `for` loop +SIM111.py:154:5: SIM110 [*] Use `return all(not check(x) for x in iterable)` instead of `for` loop | 153 | # SIM111 154 | for x in iterable: @@ -268,7 +268,7 @@ SIM111.py:154:5: SIM110 [**] Use `return all(not check(x) for x in iterable)` in 159 156 | 160 157 | def f(): -SIM111.py:162:5: SIM110 [**] Use `return all(x in y for x in iterable)` instead of `for` loop +SIM111.py:162:5: SIM110 [*] Use `return all(x in y for x in iterable)` instead of `for` loop | 160 | def f(): 161 | # SIM111 @@ -294,7 +294,7 @@ SIM111.py:162:5: SIM110 [**] Use `return all(x in y for x in iterable)` instead 167 164 | 168 165 | def f(): -SIM111.py:170:5: SIM110 [**] Use `return all(x <= y for x in iterable)` instead of `for` loop +SIM111.py:170:5: SIM110 [*] Use `return all(x <= y for x in iterable)` instead of `for` loop | 168 | def f(): 169 | # SIM111 @@ -320,7 +320,7 @@ SIM111.py:170:5: SIM110 [**] Use `return all(x <= y for x in iterable)` instead 175 172 | 176 173 | def f(): -SIM111.py:178:5: SIM110 [**] Use `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` instead of `for` loop +SIM111.py:178:5: SIM110 [*] Use `return all(not x.isdigit() for x in "012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9💣2ℝ9012ß9")` instead of `for` loop | 176 | def f(): 177 | # SIM111 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap index 088585b0898f4a..f19564b2160d0f 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM112_SIM112.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM112.py:4:12: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo` +SIM112.py:4:12: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` | 3 | # Bad 4 | os.environ['foo'] @@ -65,7 +65,7 @@ SIM112.py:12:22: SIM112 Use capitalized environment variable `FOO` instead of `f | = help: Replace `foo` with `FOO` -SIM112.py:14:18: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo` +SIM112.py:14:18: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` | 12 | env = os.environ.get('foo') 13 | @@ -96,7 +96,7 @@ SIM112.py:16:26: SIM112 Use capitalized environment variable `FOO` instead of `f | = help: Replace `foo` with `FOO` -SIM112.py:19:22: SIM112 [**] Use capitalized environment variable `FOO` instead of `foo` +SIM112.py:19:22: SIM112 [*] Use capitalized environment variable `FOO` instead of `foo` | 17 | pass 18 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap index 3fa77b36d4947a..bbc83f3ed4cd62 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM117_SIM117.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM117.py:2:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:2:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 1 | # SIM117 2 | / with A() as a: @@ -22,7 +22,7 @@ SIM117.py:2:1: SIM117 [**] Use a single `with` statement with multiple contexts 6 5 | # SIM117 7 6 | with A(): -SIM117.py:7:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:7:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 6 | # SIM117 7 | / with A(): @@ -59,7 +59,7 @@ SIM117.py:13:1: SIM117 Use a single `with` statement with multiple contexts inst | = help: Combine `with` statements -SIM117.py:19:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:19:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 18 | # SIM117 19 | / with A() as a: @@ -85,7 +85,7 @@ SIM117.py:19:1: SIM117 [**] Use a single `with` statement with multiple contexts 24 23 | # OK 25 24 | with A() as a: -SIM117.py:47:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:47:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 46 | # SIM117 47 | / async with A() as a: @@ -108,7 +108,7 @@ SIM117.py:47:1: SIM117 [**] Use a single `with` statement with multiple contexts 51 50 | while True: 52 51 | # SIM117 -SIM117.py:53:5: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:53:5: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 51 | while True: 52 | # SIM117 @@ -146,7 +146,7 @@ SIM117.py:53:5: SIM117 [**] Use a single `with` statement with multiple contexts 66 65 | 67 66 | # SIM117 -SIM117.py:68:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:68:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 67 | # SIM117 68 | / with ( @@ -173,7 +173,7 @@ SIM117.py:68:1: SIM117 [**] Use a single `with` statement with multiple contexts 75 74 | # SIM117 76 75 | with A() as a: -SIM117.py:76:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:76:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 75 | # SIM117 76 | / with A() as a: @@ -205,7 +205,7 @@ SIM117.py:76:1: SIM117 [**] Use a single `with` statement with multiple contexts 83 82 | # SIM117 84 83 | with ( -SIM117.py:84:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:84:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 83 | # SIM117 84 | / with ( @@ -239,7 +239,7 @@ SIM117.py:84:1: SIM117 [**] Use a single `with` statement with multiple contexts 94 91 | # SIM117 (auto-fixable) 95 92 | with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: -SIM117.py:95:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:95:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 94 | # SIM117 (auto-fixable) 95 | / with A("01ß9💣2ℝ8901ß9💣2ℝ8901ß9💣2ℝ89") as a: @@ -284,7 +284,7 @@ SIM117.py:106:5: SIM117 Use a single `with` statement with multiple contexts ins | = help: Combine `with` statements -SIM117.py:126:1: SIM117 [**] Use a single `with` statement with multiple contexts instead of nested `with` statements +SIM117.py:126:1: SIM117 [*] Use a single `with` statement with multiple contexts instead of nested `with` statements | 125 | # SIM117 126 | / with A() as a: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap index 22018f1b504ac9..a95f8029662891 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM118_SIM118.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM118.py:1:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:1:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 1 | key in obj.keys() # SIM118 | ^^^^^^^^^^^^^^^^^ SIM118 @@ -17,7 +17,7 @@ SIM118.py:1:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 3 3 | key not in obj.keys() # SIM118 4 4 | -SIM118.py:3:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()` +SIM118.py:3:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 1 | key in obj.keys() # SIM118 2 | @@ -37,7 +37,7 @@ SIM118.py:3:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.key 5 5 | foo["bar"] in obj.keys() # SIM118 6 6 | -SIM118.py:5:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:5:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 3 | key not in obj.keys() # SIM118 4 | @@ -58,7 +58,7 @@ SIM118.py:5:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 7 7 | foo["bar"] not in obj.keys() # SIM118 8 8 | -SIM118.py:7:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()` +SIM118.py:7:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 5 | foo["bar"] in obj.keys() # SIM118 6 | @@ -79,7 +79,7 @@ SIM118.py:7:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.key 9 9 | foo['bar'] in obj.keys() # SIM118 10 10 | -SIM118.py:9:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:9:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 7 | foo["bar"] not in obj.keys() # SIM118 8 | @@ -100,7 +100,7 @@ SIM118.py:9:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 11 11 | foo['bar'] not in obj.keys() # SIM118 12 12 | -SIM118.py:11:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()` +SIM118.py:11:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 9 | foo['bar'] in obj.keys() # SIM118 10 | @@ -121,7 +121,7 @@ SIM118.py:11:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.ke 13 13 | foo() in obj.keys() # SIM118 14 14 | -SIM118.py:13:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:13:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 11 | foo['bar'] not in obj.keys() # SIM118 12 | @@ -142,7 +142,7 @@ SIM118.py:13:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 15 15 | foo() not in obj.keys() # SIM118 16 16 | -SIM118.py:15:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.keys()` +SIM118.py:15:1: SIM118 [*] Use `key not in dict` instead of `key not in dict.keys()` | 13 | foo() in obj.keys() # SIM118 14 | @@ -163,7 +163,7 @@ SIM118.py:15:1: SIM118 [**] Use `key not in dict` instead of `key not in dict.ke 17 17 | for key in obj.keys(): # SIM118 18 18 | pass -SIM118.py:17:5: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:17:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 15 | foo() not in obj.keys() # SIM118 16 | @@ -183,7 +183,7 @@ SIM118.py:17:5: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 19 19 | 20 20 | for key in list(obj.keys()): -SIM118.py:24:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:24:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 22 | del obj[key] 23 | @@ -204,7 +204,7 @@ SIM118.py:24:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 26 26 | {k for k in obj.keys()} # SIM118 27 27 | -SIM118.py:26:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:26:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 24 | [k for k in obj.keys()] # SIM118 25 | @@ -225,7 +225,7 @@ SIM118.py:26:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 28 28 | {k: k for k in obj.keys()} # SIM118 29 29 | -SIM118.py:28:11: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:28:11: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 26 | {k for k in obj.keys()} # SIM118 27 | @@ -246,7 +246,7 @@ SIM118.py:28:11: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 30 30 | (k for k in obj.keys()) # SIM118 31 31 | -SIM118.py:30:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:30:8: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 28 | {k: k for k in obj.keys()} # SIM118 29 | @@ -267,7 +267,7 @@ SIM118.py:30:8: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 32 32 | key in (obj or {}).keys() # SIM118 33 33 | -SIM118.py:32:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:32:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 30 | (k for k in obj.keys()) # SIM118 31 | @@ -288,7 +288,7 @@ SIM118.py:32:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 34 34 | (key) in (obj or {}).keys() # SIM118 35 35 | -SIM118.py:34:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:34:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 32 | key in (obj or {}).keys() # SIM118 33 | @@ -309,7 +309,7 @@ SIM118.py:34:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 36 36 | from typing import KeysView 37 37 | -SIM118.py:48:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:48:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 47 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 48 | key in obj.keys()and foo @@ -329,7 +329,7 @@ SIM118.py:48:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 50 50 | key in (obj.keys())and foo 51 51 | -SIM118.py:49:2: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:49:2: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 47 | # Regression test for: https://github.com/astral-sh/ruff/issues/7124 48 | key in obj.keys()and foo @@ -349,7 +349,7 @@ SIM118.py:49:2: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 51 51 | 52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 -SIM118.py:50:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:50:1: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 48 | key in obj.keys()and foo 49 | (key in obj.keys())and foo @@ -370,7 +370,7 @@ SIM118.py:50:1: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` 52 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 53 53 | for key in ( -SIM118.py:53:5: SIM118 [**] Use `key in dict` instead of `key in dict.keys()` +SIM118.py:53:5: SIM118 [*] Use `key in dict` instead of `key in dict.keys()` | 52 | # Regression test for: https://github.com/astral-sh/ruff/issues/7200 53 | for key in ( diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap index ee135fa5e61ca7..739679e4deb3c3 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM202_SIM202.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM202.py:2:4: SIM202 [**] Use `a == b` instead of `not a != b` +SIM202.py:2:4: SIM202 [*] Use `a == b` instead of `not a != b` | 1 | # SIM202 2 | if not a != b: @@ -18,7 +18,7 @@ SIM202.py:2:4: SIM202 [**] Use `a == b` instead of `not a != b` 4 4 | 5 5 | # SIM202 -SIM202.py:6:4: SIM202 [**] Use `a == b + c` instead of `not a != b + c` +SIM202.py:6:4: SIM202 [*] Use `a == b + c` instead of `not a != b + c` | 5 | # SIM202 6 | if not a != (b + c): @@ -37,7 +37,7 @@ SIM202.py:6:4: SIM202 [**] Use `a == b + c` instead of `not a != b + c` 8 8 | 9 9 | # SIM202 -SIM202.py:10:4: SIM202 [**] Use `a + b == c` instead of `not a + b != c` +SIM202.py:10:4: SIM202 [*] Use `a + b == c` instead of `not a + b != c` | 9 | # SIM202 10 | if not (a + b) != c: diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap index 2642af806aa749..f1b5030c024dd2 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM208_SIM208.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM208.py:1:4: SIM208 [**] Use `a` instead of `not (not a)` +SIM208.py:1:4: SIM208 [*] Use `a` instead of `not (not a)` | 1 | if not (not a): # SIM208 | ^^^^^^^^^^^ SIM208 @@ -16,7 +16,7 @@ SIM208.py:1:4: SIM208 [**] Use `a` instead of `not (not a)` 3 3 | 4 4 | if not (not (a == b)): # SIM208 -SIM208.py:4:4: SIM208 [**] Use `a == b` instead of `not (not a == b)` +SIM208.py:4:4: SIM208 [*] Use `a == b` instead of `not (not a == b)` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM208.py:4:4: SIM208 [**] Use `a == b` instead of `not (not a == b)` 6 6 | 7 7 | if not a: # OK -SIM208.py:16:5: SIM208 [**] Use `b` instead of `not (not b)` +SIM208.py:16:5: SIM208 [*] Use `b` instead of `not (not b)` | 14 | pass 15 | @@ -57,7 +57,7 @@ SIM208.py:16:5: SIM208 [**] Use `b` instead of `not (not b)` 18 18 | f(not not a) # SIM208 19 19 | -SIM208.py:18:3: SIM208 [**] Use `a` instead of `not (not a)` +SIM208.py:18:3: SIM208 [*] Use `a` instead of `not (not a)` | 16 | a = not not b # SIM208 17 | @@ -78,7 +78,7 @@ SIM208.py:18:3: SIM208 [**] Use `a` instead of `not (not a)` 20 20 | if 1 + (not (not a)): # SIM208 21 21 | pass -SIM208.py:20:9: SIM208 [**] Use `a` instead of `not (not a)` +SIM208.py:20:9: SIM208 [*] Use `a` instead of `not (not a)` | 18 | f(not not a) # SIM208 19 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap index 5cf1126fcb3d6c..7f7cfde237e166 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM210_SIM210.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM210.py:1:5: SIM210 [**] Use `bool(...)` instead of `True if ... else False` +SIM210.py:1:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | 1 | a = True if b else False # SIM210 | ^^^^^^^^^^^^^^^^^^^^ SIM210 @@ -17,7 +17,7 @@ SIM210.py:1:5: SIM210 [**] Use `bool(...)` instead of `True if ... else False` 3 3 | a = True if b != c else False # SIM210 4 4 | -SIM210.py:3:5: SIM210 [**] Remove unnecessary `True if ... else False` +SIM210.py:3:5: SIM210 [*] Remove unnecessary `True if ... else False` | 1 | a = True if b else False # SIM210 2 | @@ -37,7 +37,7 @@ SIM210.py:3:5: SIM210 [**] Remove unnecessary `True if ... else False` 5 5 | a = True if b + c else False # SIM210 6 6 | -SIM210.py:5:5: SIM210 [**] Use `bool(...)` instead of `True if ... else False` +SIM210.py:5:5: SIM210 [*] Use `bool(...)` instead of `True if ... else False` | 3 | a = True if b != c else False # SIM210 4 | @@ -67,7 +67,7 @@ SIM210.py:15:9: SIM210 Use `bool(...)` instead of `True if ... else False` | = help: Replace with `bool(...) -SIM210.py:19:11: SIM210 [**] Remove unnecessary `True if ... else False` +SIM210.py:19:11: SIM210 [*] Remove unnecessary `True if ... else False` | 18 | # Regression test for: https://github.com/astral-sh/ruff/issues/7076 19 | samesld = True if (psl.privatesuffix(urlparse(response.url).netloc) == diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap index f4e1fb522d568c..359b5384bc06a3 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM211_SIM211.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM211.py:1:5: SIM211 [**] Use `not ...` instead of `False if ... else True` +SIM211.py:1:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | 1 | a = False if b else True # SIM211 | ^^^^^^^^^^^^^^^^^^^^ SIM211 @@ -17,7 +17,7 @@ SIM211.py:1:5: SIM211 [**] Use `not ...` instead of `False if ... else True` 3 3 | a = False if b != c else True # SIM211 4 4 | -SIM211.py:3:5: SIM211 [**] Use `not ...` instead of `False if ... else True` +SIM211.py:3:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | 1 | a = False if b else True # SIM211 2 | @@ -37,7 +37,7 @@ SIM211.py:3:5: SIM211 [**] Use `not ...` instead of `False if ... else True` 5 5 | a = False if b + c else True # SIM211 6 6 | -SIM211.py:5:5: SIM211 [**] Use `not ...` instead of `False if ... else True` +SIM211.py:5:5: SIM211 [*] Use `not ...` instead of `False if ... else True` | 3 | a = False if b != c else True # SIM211 4 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap index 348bbad9bfe420..956cc50036d1eb 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM212_SIM212.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM212.py:1:5: SIM212 [**] Use `a if a else b` instead of `b if not a else a` +SIM212.py:1:5: SIM212 [*] Use `a if a else b` instead of `b if not a else a` | 1 | c = b if not a else a # SIM212 | ^^^^^^^^^^^^^^^^^ SIM212 @@ -17,7 +17,7 @@ SIM212.py:1:5: SIM212 [**] Use `a if a else b` instead of `b if not a else a` 3 3 | c = b + c if not a else a # SIM212 4 4 | -SIM212.py:3:5: SIM212 [**] Use `a if a else b + c` instead of `b + c if not a else a` +SIM212.py:3:5: SIM212 [*] Use `a if a else b + c` instead of `b + c if not a else a` | 1 | c = b if not a else a # SIM212 2 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap index 03c2374031d428..bf50be10507e3c 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM220_SIM220.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM220.py:1:4: SIM220 [**] Use `False` instead of `a and not a` +SIM220.py:1:4: SIM220 [*] Use `False` instead of `a and not a` | 1 | if a and not a: | ^^^^^^^^^^^ SIM220 @@ -16,7 +16,7 @@ SIM220.py:1:4: SIM220 [**] Use `False` instead of `a and not a` 3 3 | 4 4 | if (a and not a) and b: -SIM220.py:4:5: SIM220 [**] Use `False` instead of `a and not a` +SIM220.py:4:5: SIM220 [*] Use `False` instead of `a and not a` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM220.py:4:5: SIM220 [**] Use `False` instead of `a and not a` 6 6 | 7 7 | if (a and not a) or b: -SIM220.py:7:5: SIM220 [**] Use `False` instead of `a and not a` +SIM220.py:7:5: SIM220 [*] Use `False` instead of `a and not a` | 5 | pass 6 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap index 3472e669bf8a17..cb3d53dfe77227 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM221_SIM221.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM221.py:1:4: SIM221 [**] Use `True` instead of `a or not a` +SIM221.py:1:4: SIM221 [*] Use `True` instead of `a or not a` | 1 | if a or not a: | ^^^^^^^^^^ SIM221 @@ -16,7 +16,7 @@ SIM221.py:1:4: SIM221 [**] Use `True` instead of `a or not a` 3 3 | 4 4 | if (a or not a) or b: -SIM221.py:4:5: SIM221 [**] Use `True` instead of `a or not a` +SIM221.py:4:5: SIM221 [*] Use `True` instead of `a or not a` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM221.py:4:5: SIM221 [**] Use `True` instead of `a or not a` 6 6 | 7 7 | if (a or not a) and b: -SIM221.py:7:5: SIM221 [**] Use `True` instead of `a or not a` +SIM221.py:7:5: SIM221 [*] Use `True` instead of `a or not a` | 5 | pass 6 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap index d07375d8d3298e..02d93e42fc0398 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM222_SIM222.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM222.py:1:4: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:1:4: SIM222 [*] Use `True` instead of `... or True` | 1 | if a or True: # SIM222 | ^^^^^^^^^ SIM222 @@ -16,7 +16,7 @@ SIM222.py:1:4: SIM222 [**] Use `True` instead of `... or True` 3 3 | 4 4 | if (a or b) or True: # SIM222 -SIM222.py:4:4: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:4:4: SIM222 [*] Use `True` instead of `... or True` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM222.py:4:4: SIM222 [**] Use `True` instead of `... or True` 6 6 | 7 7 | if a or (b or True): # SIM222 -SIM222.py:7:10: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:7:10: SIM222 [*] Use `True` instead of `... or True` | 5 | pass 6 | @@ -56,7 +56,7 @@ SIM222.py:7:10: SIM222 [**] Use `True` instead of `... or True` 9 9 | 10 10 | if a and True: # OK -SIM222.py:24:16: SIM222 [**] Use `True` instead of `True or ...` +SIM222.py:24:16: SIM222 [*] Use `True` instead of `True or ...` | 22 | pass 23 | @@ -76,7 +76,7 @@ SIM222.py:24:16: SIM222 [**] Use `True` instead of `True or ...` 26 26 | 27 27 | if True or f() or a or g() or b: # SIM222 -SIM222.py:27:4: SIM222 [**] Use `True` instead of `True or ...` +SIM222.py:27:4: SIM222 [*] Use `True` instead of `True or ...` | 25 | pass 26 | @@ -96,7 +96,7 @@ SIM222.py:27:4: SIM222 [**] Use `True` instead of `True or ...` 29 29 | 30 30 | if a or True or f() or b or g(): # SIM222 -SIM222.py:30:4: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:30:4: SIM222 [*] Use `True` instead of `... or True or ...` | 28 | pass 29 | @@ -116,7 +116,7 @@ SIM222.py:30:4: SIM222 [**] Use `True` instead of `... or True or ...` 32 32 | 33 33 | -SIM222.py:47:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:47:6: SIM222 [*] Use `True` instead of `... or True` | 47 | a or "" or True # SIM222 | ^^^^^^^^^^ SIM222 @@ -135,7 +135,7 @@ SIM222.py:47:6: SIM222 [**] Use `True` instead of `... or True` 49 49 | a or "foo" or True or "bar" # SIM222 50 50 | -SIM222.py:49:6: SIM222 [**] Use `"foo"` instead of `"foo" or ...` +SIM222.py:49:6: SIM222 [*] Use `"foo"` instead of `"foo" or ...` | 47 | a or "" or True # SIM222 48 | @@ -156,7 +156,7 @@ SIM222.py:49:6: SIM222 [**] Use `"foo"` instead of `"foo" or ...` 51 51 | a or 0 or True # SIM222 52 52 | -SIM222.py:51:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:51:6: SIM222 [*] Use `True` instead of `... or True` | 49 | a or "foo" or True or "bar" # SIM222 50 | @@ -177,7 +177,7 @@ SIM222.py:51:6: SIM222 [**] Use `True` instead of `... or True` 53 53 | a or 1 or True or 2 # SIM222 54 54 | -SIM222.py:53:6: SIM222 [**] Use `1` instead of `1 or ...` +SIM222.py:53:6: SIM222 [*] Use `1` instead of `1 or ...` | 51 | a or 0 or True # SIM222 52 | @@ -198,7 +198,7 @@ SIM222.py:53:6: SIM222 [**] Use `1` instead of `1 or ...` 55 55 | a or 0.0 or True # SIM222 56 56 | -SIM222.py:55:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:55:6: SIM222 [*] Use `True` instead of `... or True` | 53 | a or 1 or True or 2 # SIM222 54 | @@ -219,7 +219,7 @@ SIM222.py:55:6: SIM222 [**] Use `True` instead of `... or True` 57 57 | a or 0.1 or True or 0.2 # SIM222 58 58 | -SIM222.py:57:6: SIM222 [**] Use `0.1` instead of `0.1 or ...` +SIM222.py:57:6: SIM222 [*] Use `0.1` instead of `0.1 or ...` | 55 | a or 0.0 or True # SIM222 56 | @@ -240,7 +240,7 @@ SIM222.py:57:6: SIM222 [**] Use `0.1` instead of `0.1 or ...` 59 59 | a or [] or True # SIM222 60 60 | -SIM222.py:59:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:59:6: SIM222 [*] Use `True` instead of `... or True` | 57 | a or 0.1 or True or 0.2 # SIM222 58 | @@ -261,7 +261,7 @@ SIM222.py:59:6: SIM222 [**] Use `True` instead of `... or True` 61 61 | a or list([]) or True # SIM222 62 62 | -SIM222.py:61:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:61:6: SIM222 [*] Use `True` instead of `... or True` | 59 | a or [] or True # SIM222 60 | @@ -282,7 +282,7 @@ SIM222.py:61:6: SIM222 [**] Use `True` instead of `... or True` 63 63 | a or [1] or True or [2] # SIM222 64 64 | -SIM222.py:63:6: SIM222 [**] Use `[1]` instead of `[1] or ...` +SIM222.py:63:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | 61 | a or list([]) or True # SIM222 62 | @@ -303,7 +303,7 @@ SIM222.py:63:6: SIM222 [**] Use `[1]` instead of `[1] or ...` 65 65 | a or list([1]) or True or list([2]) # SIM222 66 66 | -SIM222.py:65:6: SIM222 [**] Use `list([1])` instead of `list([1]) or ...` +SIM222.py:65:6: SIM222 [*] Use `list([1])` instead of `list([1]) or ...` | 63 | a or [1] or True or [2] # SIM222 64 | @@ -324,7 +324,7 @@ SIM222.py:65:6: SIM222 [**] Use `list([1])` instead of `list([1]) or ...` 67 67 | a or {} or True # SIM222 68 68 | -SIM222.py:67:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:67:6: SIM222 [*] Use `True` instead of `... or True` | 65 | a or list([1]) or True or list([2]) # SIM222 66 | @@ -345,7 +345,7 @@ SIM222.py:67:6: SIM222 [**] Use `True` instead of `... or True` 69 69 | a or dict() or True # SIM222 70 70 | -SIM222.py:69:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:69:6: SIM222 [*] Use `True` instead of `... or True` | 67 | a or {} or True # SIM222 68 | @@ -366,7 +366,7 @@ SIM222.py:69:6: SIM222 [**] Use `True` instead of `... or True` 71 71 | a or {1: 1} or True or {2: 2} # SIM222 72 72 | -SIM222.py:71:6: SIM222 [**] Use `{1: 1}` instead of `{1: 1} or ...` +SIM222.py:71:6: SIM222 [*] Use `{1: 1}` instead of `{1: 1} or ...` | 69 | a or dict() or True # SIM222 70 | @@ -387,7 +387,7 @@ SIM222.py:71:6: SIM222 [**] Use `{1: 1}` instead of `{1: 1} or ...` 73 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 74 | -SIM222.py:73:6: SIM222 [**] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` +SIM222.py:73:6: SIM222 [*] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` | 71 | a or {1: 1} or True or {2: 2} # SIM222 72 | @@ -408,7 +408,7 @@ SIM222.py:73:6: SIM222 [**] Use `dict({1: 1})` instead of `dict({1: 1}) or ...` 75 75 | a or set() or True # SIM222 76 76 | -SIM222.py:75:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:75:6: SIM222 [*] Use `True` instead of `... or True` | 73 | a or dict({1: 1}) or True or dict({2: 2}) # SIM222 74 | @@ -429,7 +429,7 @@ SIM222.py:75:6: SIM222 [**] Use `True` instead of `... or True` 77 77 | a or set(set()) or True # SIM222 78 78 | -SIM222.py:77:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:77:6: SIM222 [*] Use `True` instead of `... or True` | 75 | a or set() or True # SIM222 76 | @@ -450,7 +450,7 @@ SIM222.py:77:6: SIM222 [**] Use `True` instead of `... or True` 79 79 | a or {1} or True or {2} # SIM222 80 80 | -SIM222.py:79:6: SIM222 [**] Use `{1}` instead of `{1} or ...` +SIM222.py:79:6: SIM222 [*] Use `{1}` instead of `{1} or ...` | 77 | a or set(set()) or True # SIM222 78 | @@ -471,7 +471,7 @@ SIM222.py:79:6: SIM222 [**] Use `{1}` instead of `{1} or ...` 81 81 | a or set({1}) or True or set({2}) # SIM222 82 82 | -SIM222.py:81:6: SIM222 [**] Use `set({1})` instead of `set({1}) or ...` +SIM222.py:81:6: SIM222 [*] Use `set({1})` instead of `set({1}) or ...` | 79 | a or {1} or True or {2} # SIM222 80 | @@ -492,7 +492,7 @@ SIM222.py:81:6: SIM222 [**] Use `set({1})` instead of `set({1}) or ...` 83 83 | a or () or True # SIM222 84 84 | -SIM222.py:83:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:83:6: SIM222 [*] Use `True` instead of `... or True` | 81 | a or set({1}) or True or set({2}) # SIM222 82 | @@ -513,7 +513,7 @@ SIM222.py:83:6: SIM222 [**] Use `True` instead of `... or True` 85 85 | a or tuple(()) or True # SIM222 86 86 | -SIM222.py:85:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:85:6: SIM222 [*] Use `True` instead of `... or True` | 83 | a or () or True # SIM222 84 | @@ -534,7 +534,7 @@ SIM222.py:85:6: SIM222 [**] Use `True` instead of `... or True` 87 87 | a or (1,) or True or (2,) # SIM222 88 88 | -SIM222.py:87:6: SIM222 [**] Use `(1,)` instead of `(1,) or ...` +SIM222.py:87:6: SIM222 [*] Use `(1,)` instead of `(1,) or ...` | 85 | a or tuple(()) or True # SIM222 86 | @@ -555,7 +555,7 @@ SIM222.py:87:6: SIM222 [**] Use `(1,)` instead of `(1,) or ...` 89 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 90 | -SIM222.py:89:6: SIM222 [**] Use `tuple((1,))` instead of `tuple((1,)) or ...` +SIM222.py:89:6: SIM222 [*] Use `tuple((1,))` instead of `tuple((1,)) or ...` | 87 | a or (1,) or True or (2,) # SIM222 88 | @@ -576,7 +576,7 @@ SIM222.py:89:6: SIM222 [**] Use `tuple((1,))` instead of `tuple((1,)) or ...` 91 91 | a or frozenset() or True # SIM222 92 92 | -SIM222.py:91:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:91:6: SIM222 [*] Use `True` instead of `... or True` | 89 | a or tuple((1,)) or True or tuple((2,)) # SIM222 90 | @@ -597,7 +597,7 @@ SIM222.py:91:6: SIM222 [**] Use `True` instead of `... or True` 93 93 | a or frozenset(frozenset()) or True # SIM222 94 94 | -SIM222.py:93:6: SIM222 [**] Use `True` instead of `... or True` +SIM222.py:93:6: SIM222 [*] Use `True` instead of `... or True` | 91 | a or frozenset() or True # SIM222 92 | @@ -618,7 +618,7 @@ SIM222.py:93:6: SIM222 [**] Use `True` instead of `... or True` 95 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 96 | -SIM222.py:95:6: SIM222 [**] Use `frozenset({1})` instead of `frozenset({1}) or ...` +SIM222.py:95:6: SIM222 [*] Use `frozenset({1})` instead of `frozenset({1}) or ...` | 93 | a or frozenset(frozenset()) or True # SIM222 94 | @@ -639,7 +639,7 @@ SIM222.py:95:6: SIM222 [**] Use `frozenset({1})` instead of `frozenset({1}) or . 97 97 | a or frozenset(frozenset({1})) or True or frozenset(frozenset({2})) # SIM222 98 98 | -SIM222.py:97:6: SIM222 [**] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` +SIM222.py:97:6: SIM222 [*] Use `frozenset(frozenset({1}))` instead of `frozenset(frozenset({1})) or ...` | 95 | a or frozenset({1}) or True or frozenset({2}) # SIM222 96 | @@ -658,7 +658,7 @@ SIM222.py:97:6: SIM222 [**] Use `frozenset(frozenset({1}))` instead of `frozense 99 99 | 100 100 | # Inside test `a` is simplified. -SIM222.py:102:6: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:102:6: SIM222 [*] Use `True` instead of `... or True or ...` | 100 | # Inside test `a` is simplified. 101 | @@ -679,7 +679,7 @@ SIM222.py:102:6: SIM222 [**] Use `True` instead of `... or True or ...` 104 104 | assert a or [1] or True or [2] # SIM222 105 105 | -SIM222.py:104:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:104:8: SIM222 [*] Use `True` instead of `... or True or ...` | 102 | bool(a or [1] or True or [2]) # SIM222 103 | @@ -700,7 +700,7 @@ SIM222.py:104:8: SIM222 [**] Use `True` instead of `... or True or ...` 106 106 | if (a or [1] or True or [2]) and (a or [1] or True or [2]): # SIM222 107 107 | pass -SIM222.py:106:5: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:106:5: SIM222 [*] Use `True` instead of `... or True or ...` | 104 | assert a or [1] or True or [2] # SIM222 105 | @@ -720,7 +720,7 @@ SIM222.py:106:5: SIM222 [**] Use `True` instead of `... or True or ...` 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 -SIM222.py:106:35: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:106:35: SIM222 [*] Use `True` instead of `... or True or ...` | 104 | assert a or [1] or True or [2] # SIM222 105 | @@ -740,7 +740,7 @@ SIM222.py:106:35: SIM222 [**] Use `True` instead of `... or True or ...` 108 108 | 109 109 | 0 if a or [1] or True or [2] else 1 # SIM222 -SIM222.py:109:6: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:109:6: SIM222 [*] Use `True` instead of `... or True or ...` | 107 | pass 108 | @@ -761,7 +761,7 @@ SIM222.py:109:6: SIM222 [**] Use `True` instead of `... or True or ...` 111 111 | while a or [1] or True or [2]: # SIM222 112 112 | pass -SIM222.py:111:7: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:111:7: SIM222 [*] Use `True` instead of `... or True or ...` | 109 | 0 if a or [1] or True or [2] else 1 # SIM222 110 | @@ -781,7 +781,7 @@ SIM222.py:111:7: SIM222 [**] Use `True` instead of `... or True or ...` 113 113 | 114 114 | [ -SIM222.py:118:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:118:8: SIM222 [*] Use `True` instead of `... or True or ...` | 116 | for a in range(10) 117 | for b in range(10) @@ -802,7 +802,7 @@ SIM222.py:118:8: SIM222 [**] Use `True` instead of `... or True or ...` 120 120 | ] 121 121 | -SIM222.py:119:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:119:8: SIM222 [*] Use `True` instead of `... or True or ...` | 117 | for b in range(10) 118 | if a or [1] or True or [2] # SIM222 @@ -822,7 +822,7 @@ SIM222.py:119:8: SIM222 [**] Use `True` instead of `... or True or ...` 121 121 | 122 122 | { -SIM222.py:126:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:126:8: SIM222 [*] Use `True` instead of `... or True or ...` | 124 | for a in range(10) 125 | for b in range(10) @@ -843,7 +843,7 @@ SIM222.py:126:8: SIM222 [**] Use `True` instead of `... or True or ...` 128 128 | } 129 129 | -SIM222.py:127:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:127:8: SIM222 [*] Use `True` instead of `... or True or ...` | 125 | for b in range(10) 126 | if a or [1] or True or [2] # SIM222 @@ -863,7 +863,7 @@ SIM222.py:127:8: SIM222 [**] Use `True` instead of `... or True or ...` 129 129 | 130 130 | { -SIM222.py:134:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:134:8: SIM222 [*] Use `True` instead of `... or True or ...` | 132 | for a in range(10) 133 | for b in range(10) @@ -884,7 +884,7 @@ SIM222.py:134:8: SIM222 [**] Use `True` instead of `... or True or ...` 136 136 | } 137 137 | -SIM222.py:135:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:135:8: SIM222 [*] Use `True` instead of `... or True or ...` | 133 | for b in range(10) 134 | if a or [1] or True or [2] # SIM222 @@ -904,7 +904,7 @@ SIM222.py:135:8: SIM222 [**] Use `True` instead of `... or True or ...` 137 137 | 138 138 | ( -SIM222.py:142:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:142:8: SIM222 [*] Use `True` instead of `... or True or ...` | 140 | for a in range(10) 141 | for b in range(10) @@ -925,7 +925,7 @@ SIM222.py:142:8: SIM222 [**] Use `True` instead of `... or True or ...` 144 144 | ) 145 145 | -SIM222.py:143:8: SIM222 [**] Use `True` instead of `... or True or ...` +SIM222.py:143:8: SIM222 [*] Use `True` instead of `... or True or ...` | 141 | for b in range(10) 142 | if a or [1] or True or [2] # SIM222 @@ -945,7 +945,7 @@ SIM222.py:143:8: SIM222 [**] Use `True` instead of `... or True or ...` 145 145 | 146 146 | # Outside test `a` is not simplified. -SIM222.py:148:6: SIM222 [**] Use `[1]` instead of `[1] or ...` +SIM222.py:148:6: SIM222 [*] Use `[1]` instead of `[1] or ...` | 146 | # Outside test `a` is not simplified. 147 | @@ -966,7 +966,7 @@ SIM222.py:148:6: SIM222 [**] Use `[1]` instead of `[1] or ...` 150 150 | if (a or [1] or True or [2]) == (a or [1]): # SIM222 151 151 | pass -SIM222.py:150:10: SIM222 [**] Use `[1]` instead of `[1] or ...` +SIM222.py:150:10: SIM222 [*] Use `[1]` instead of `[1] or ...` | 148 | a or [1] or True or [2] # SIM222 149 | @@ -986,7 +986,7 @@ SIM222.py:150:10: SIM222 [**] Use `[1]` instead of `[1] or ...` 152 152 | 153 153 | if f(a or [1] or True or [2]): # SIM222 -SIM222.py:153:11: SIM222 [**] Use `[1]` instead of `[1] or ...` +SIM222.py:153:11: SIM222 [*] Use `[1]` instead of `[1] or ...` | 151 | pass 152 | @@ -1006,7 +1006,7 @@ SIM222.py:153:11: SIM222 [**] Use `[1]` instead of `[1] or ...` 155 155 | 156 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 -SIM222.py:157:30: SIM222 [**] Use `(int, int, int)` instead of `(int, int, int) or ...` +SIM222.py:157:30: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...` | 156 | # Regression test for: https://github.com/astral-sh/ruff/issues/7099 157 | def secondToTime(s0: int) -> (int, int, int) or str: @@ -1025,7 +1025,7 @@ SIM222.py:157:30: SIM222 [**] Use `(int, int, int)` instead of `(int, int, int) 159 159 | 160 160 | -SIM222.py:161:31: SIM222 [**] Use `(int, int, int)` instead of `(int, int, int) or ...` +SIM222.py:161:31: SIM222 [*] Use `(int, int, int)` instead of `(int, int, int) or ...` | 161 | def secondToTime(s0: int) -> ((int, int, int) or str): | ^^^^^^^^^^^^^^^^^^^^^^ SIM222 diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap index aecc64139fdbaa..4454bf48517976 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM223_SIM223.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM223.py:1:4: SIM223 [**] Use `False` instead of `... and False` +SIM223.py:1:4: SIM223 [*] Use `False` instead of `... and False` | 1 | if a and False: # SIM223 | ^^^^^^^^^^^ SIM223 @@ -16,7 +16,7 @@ SIM223.py:1:4: SIM223 [**] Use `False` instead of `... and False` 3 3 | 4 4 | if (a or b) and False: # SIM223 -SIM223.py:4:4: SIM223 [**] Use `False` instead of `... and False` +SIM223.py:4:4: SIM223 [*] Use `False` instead of `... and False` | 2 | pass 3 | @@ -36,7 +36,7 @@ SIM223.py:4:4: SIM223 [**] Use `False` instead of `... and False` 6 6 | 7 7 | if a or (b and False): # SIM223 -SIM223.py:7:10: SIM223 [**] Use `False` instead of `... and False` +SIM223.py:7:10: SIM223 [*] Use `False` instead of `... and False` | 5 | pass 6 | @@ -56,7 +56,7 @@ SIM223.py:7:10: SIM223 [**] Use `False` instead of `... and False` 9 9 | 10 10 | if a or False: -SIM223.py:19:18: SIM223 [**] Use `False` instead of `False and ...` +SIM223.py:19:18: SIM223 [*] Use `False` instead of `False and ...` | 17 | pass 18 | @@ -76,7 +76,7 @@ SIM223.py:19:18: SIM223 [**] Use `False` instead of `False and ...` 21 21 | 22 22 | if False and f() and a and g() and b: # SIM223 -SIM223.py:22:4: SIM223 [**] Use `False` instead of `False and ...` +SIM223.py:22:4: SIM223 [*] Use `False` instead of `False and ...` | 20 | pass 21 | @@ -96,7 +96,7 @@ SIM223.py:22:4: SIM223 [**] Use `False` instead of `False and ...` 24 24 | 25 25 | if a and False and f() and b and g(): # SIM223 -SIM223.py:25:4: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:25:4: SIM223 [*] Use `False` instead of `... and False and ...` | 23 | pass 24 | @@ -116,7 +116,7 @@ SIM223.py:25:4: SIM223 [**] Use `False` instead of `... and False and ...` 27 27 | 28 28 | -SIM223.py:42:7: SIM223 [**] Use `""` instead of `"" and ...` +SIM223.py:42:7: SIM223 [*] Use `""` instead of `"" and ...` | 42 | a and "" and False # SIM223 | ^^^^^^^^^^^^ SIM223 @@ -135,7 +135,7 @@ SIM223.py:42:7: SIM223 [**] Use `""` instead of `"" and ...` 44 44 | a and "foo" and False and "bar" # SIM223 45 45 | -SIM223.py:44:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:44:7: SIM223 [*] Use `False` instead of `... and False and ...` | 42 | a and "" and False # SIM223 43 | @@ -156,7 +156,7 @@ SIM223.py:44:7: SIM223 [**] Use `False` instead of `... and False and ...` 46 46 | a and 0 and False # SIM223 47 47 | -SIM223.py:46:7: SIM223 [**] Use `0` instead of `0 and ...` +SIM223.py:46:7: SIM223 [*] Use `0` instead of `0 and ...` | 44 | a and "foo" and False and "bar" # SIM223 45 | @@ -177,7 +177,7 @@ SIM223.py:46:7: SIM223 [**] Use `0` instead of `0 and ...` 48 48 | a and 1 and False and 2 # SIM223 49 49 | -SIM223.py:48:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:48:7: SIM223 [*] Use `False` instead of `... and False and ...` | 46 | a and 0 and False # SIM223 47 | @@ -198,7 +198,7 @@ SIM223.py:48:7: SIM223 [**] Use `False` instead of `... and False and ...` 50 50 | a and 0.0 and False # SIM223 51 51 | -SIM223.py:50:7: SIM223 [**] Use `0.0` instead of `0.0 and ...` +SIM223.py:50:7: SIM223 [*] Use `0.0` instead of `0.0 and ...` | 48 | a and 1 and False and 2 # SIM223 49 | @@ -219,7 +219,7 @@ SIM223.py:50:7: SIM223 [**] Use `0.0` instead of `0.0 and ...` 52 52 | a and 0.1 and False and 0.2 # SIM223 53 53 | -SIM223.py:52:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:52:7: SIM223 [*] Use `False` instead of `... and False and ...` | 50 | a and 0.0 and False # SIM223 51 | @@ -240,7 +240,7 @@ SIM223.py:52:7: SIM223 [**] Use `False` instead of `... and False and ...` 54 54 | a and [] and False # SIM223 55 55 | -SIM223.py:54:7: SIM223 [**] Use `[]` instead of `[] and ...` +SIM223.py:54:7: SIM223 [*] Use `[]` instead of `[] and ...` | 52 | a and 0.1 and False and 0.2 # SIM223 53 | @@ -261,7 +261,7 @@ SIM223.py:54:7: SIM223 [**] Use `[]` instead of `[] and ...` 56 56 | a and list([]) and False # SIM223 57 57 | -SIM223.py:56:7: SIM223 [**] Use `list([])` instead of `list([]) and ...` +SIM223.py:56:7: SIM223 [*] Use `list([])` instead of `list([]) and ...` | 54 | a and [] and False # SIM223 55 | @@ -282,7 +282,7 @@ SIM223.py:56:7: SIM223 [**] Use `list([])` instead of `list([]) and ...` 58 58 | a and [1] and False and [2] # SIM223 59 59 | -SIM223.py:58:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:58:7: SIM223 [*] Use `False` instead of `... and False and ...` | 56 | a and list([]) and False # SIM223 57 | @@ -303,7 +303,7 @@ SIM223.py:58:7: SIM223 [**] Use `False` instead of `... and False and ...` 60 60 | a and list([1]) and False and list([2]) # SIM223 61 61 | -SIM223.py:60:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:60:7: SIM223 [*] Use `False` instead of `... and False and ...` | 58 | a and [1] and False and [2] # SIM223 59 | @@ -324,7 +324,7 @@ SIM223.py:60:7: SIM223 [**] Use `False` instead of `... and False and ...` 62 62 | a and {} and False # SIM223 63 63 | -SIM223.py:62:7: SIM223 [**] Use `{}` instead of `{} and ...` +SIM223.py:62:7: SIM223 [*] Use `{}` instead of `{} and ...` | 60 | a and list([1]) and False and list([2]) # SIM223 61 | @@ -345,7 +345,7 @@ SIM223.py:62:7: SIM223 [**] Use `{}` instead of `{} and ...` 64 64 | a and dict() and False # SIM223 65 65 | -SIM223.py:64:7: SIM223 [**] Use `dict()` instead of `dict() and ...` +SIM223.py:64:7: SIM223 [*] Use `dict()` instead of `dict() and ...` | 62 | a and {} and False # SIM223 63 | @@ -366,7 +366,7 @@ SIM223.py:64:7: SIM223 [**] Use `dict()` instead of `dict() and ...` 66 66 | a and {1: 1} and False and {2: 2} # SIM223 67 67 | -SIM223.py:66:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:66:7: SIM223 [*] Use `False` instead of `... and False and ...` | 64 | a and dict() and False # SIM223 65 | @@ -387,7 +387,7 @@ SIM223.py:66:7: SIM223 [**] Use `False` instead of `... and False and ...` 68 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 69 | -SIM223.py:68:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:68:7: SIM223 [*] Use `False` instead of `... and False and ...` | 66 | a and {1: 1} and False and {2: 2} # SIM223 67 | @@ -408,7 +408,7 @@ SIM223.py:68:7: SIM223 [**] Use `False` instead of `... and False and ...` 70 70 | a and set() and False # SIM223 71 71 | -SIM223.py:70:7: SIM223 [**] Use `set()` instead of `set() and ...` +SIM223.py:70:7: SIM223 [*] Use `set()` instead of `set() and ...` | 68 | a and dict({1: 1}) and False and dict({2: 2}) # SIM223 69 | @@ -429,7 +429,7 @@ SIM223.py:70:7: SIM223 [**] Use `set()` instead of `set() and ...` 72 72 | a and set(set()) and False # SIM223 73 73 | -SIM223.py:72:7: SIM223 [**] Use `set(set())` instead of `set(set()) and ...` +SIM223.py:72:7: SIM223 [*] Use `set(set())` instead of `set(set()) and ...` | 70 | a and set() and False # SIM223 71 | @@ -450,7 +450,7 @@ SIM223.py:72:7: SIM223 [**] Use `set(set())` instead of `set(set()) and ...` 74 74 | a and {1} and False and {2} # SIM223 75 75 | -SIM223.py:74:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:74:7: SIM223 [*] Use `False` instead of `... and False and ...` | 72 | a and set(set()) and False # SIM223 73 | @@ -471,7 +471,7 @@ SIM223.py:74:7: SIM223 [**] Use `False` instead of `... and False and ...` 76 76 | a and set({1}) and False and set({2}) # SIM223 77 77 | -SIM223.py:76:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:76:7: SIM223 [*] Use `False` instead of `... and False and ...` | 74 | a and {1} and False and {2} # SIM223 75 | @@ -492,7 +492,7 @@ SIM223.py:76:7: SIM223 [**] Use `False` instead of `... and False and ...` 78 78 | a and () and False # SIM222 79 79 | -SIM223.py:78:7: SIM223 [**] Use `()` instead of `() and ...` +SIM223.py:78:7: SIM223 [*] Use `()` instead of `() and ...` | 76 | a and set({1}) and False and set({2}) # SIM223 77 | @@ -513,7 +513,7 @@ SIM223.py:78:7: SIM223 [**] Use `()` instead of `() and ...` 80 80 | a and tuple(()) and False # SIM222 81 81 | -SIM223.py:80:7: SIM223 [**] Use `tuple(())` instead of `tuple(()) and ...` +SIM223.py:80:7: SIM223 [*] Use `tuple(())` instead of `tuple(()) and ...` | 78 | a and () and False # SIM222 79 | @@ -534,7 +534,7 @@ SIM223.py:80:7: SIM223 [**] Use `tuple(())` instead of `tuple(()) and ...` 82 82 | a and (1,) and False and (2,) # SIM222 83 83 | -SIM223.py:82:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:82:7: SIM223 [*] Use `False` instead of `... and False and ...` | 80 | a and tuple(()) and False # SIM222 81 | @@ -555,7 +555,7 @@ SIM223.py:82:7: SIM223 [**] Use `False` instead of `... and False and ...` 84 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 85 | -SIM223.py:84:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:84:7: SIM223 [*] Use `False` instead of `... and False and ...` | 82 | a and (1,) and False and (2,) # SIM222 83 | @@ -576,7 +576,7 @@ SIM223.py:84:7: SIM223 [**] Use `False` instead of `... and False and ...` 86 86 | a and frozenset() and False # SIM222 87 87 | -SIM223.py:86:7: SIM223 [**] Use `frozenset()` instead of `frozenset() and ...` +SIM223.py:86:7: SIM223 [*] Use `frozenset()` instead of `frozenset() and ...` | 84 | a and tuple((1,)) and False and tuple((2,)) # SIM222 85 | @@ -597,7 +597,7 @@ SIM223.py:86:7: SIM223 [**] Use `frozenset()` instead of `frozenset() and ...` 88 88 | a and frozenset(frozenset()) and False # SIM222 89 89 | -SIM223.py:88:7: SIM223 [**] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` +SIM223.py:88:7: SIM223 [*] Use `frozenset(frozenset())` instead of `frozenset(frozenset()) and ...` | 86 | a and frozenset() and False # SIM222 87 | @@ -618,7 +618,7 @@ SIM223.py:88:7: SIM223 [**] Use `frozenset(frozenset())` instead of `frozenset(f 90 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 91 | -SIM223.py:90:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:90:7: SIM223 [*] Use `False` instead of `... and False and ...` | 88 | a and frozenset(frozenset()) and False # SIM222 89 | @@ -639,7 +639,7 @@ SIM223.py:90:7: SIM223 [**] Use `False` instead of `... and False and ...` 92 92 | a and frozenset(frozenset({1})) and False and frozenset(frozenset({2})) # SIM222 93 93 | -SIM223.py:92:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:92:7: SIM223 [*] Use `False` instead of `... and False and ...` | 90 | a and frozenset({1}) and False and frozenset({2}) # SIM222 91 | @@ -658,7 +658,7 @@ SIM223.py:92:7: SIM223 [**] Use `False` instead of `... and False and ...` 94 94 | 95 95 | # Inside test `a` is simplified. -SIM223.py:97:6: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:97:6: SIM223 [*] Use `False` instead of `... and False and ...` | 95 | # Inside test `a` is simplified. 96 | @@ -679,7 +679,7 @@ SIM223.py:97:6: SIM223 [**] Use `False` instead of `... and False and ...` 99 99 | assert a and [] and False and [] # SIM223 100 100 | -SIM223.py:99:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:99:8: SIM223 [*] Use `False` instead of `... and False and ...` | 97 | bool(a and [] and False and []) # SIM223 98 | @@ -700,7 +700,7 @@ SIM223.py:99:8: SIM223 [**] Use `False` instead of `... and False and ...` 101 101 | if (a and [] and False and []) or (a and [] and False and []): # SIM223 102 102 | pass -SIM223.py:101:5: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:101:5: SIM223 [*] Use `False` instead of `... and False and ...` | 99 | assert a and [] and False and [] # SIM223 100 | @@ -720,7 +720,7 @@ SIM223.py:101:5: SIM223 [**] Use `False` instead of `... and False and ...` 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 -SIM223.py:101:36: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:101:36: SIM223 [*] Use `False` instead of `... and False and ...` | 99 | assert a and [] and False and [] # SIM223 100 | @@ -740,7 +740,7 @@ SIM223.py:101:36: SIM223 [**] Use `False` instead of `... and False and ...` 103 103 | 104 104 | 0 if a and [] and False and [] else 1 # SIM222 -SIM223.py:104:6: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:104:6: SIM223 [*] Use `False` instead of `... and False and ...` | 102 | pass 103 | @@ -761,7 +761,7 @@ SIM223.py:104:6: SIM223 [**] Use `False` instead of `... and False and ...` 106 106 | while a and [] and False and []: # SIM223 107 107 | pass -SIM223.py:106:7: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:106:7: SIM223 [*] Use `False` instead of `... and False and ...` | 104 | 0 if a and [] and False and [] else 1 # SIM222 105 | @@ -781,7 +781,7 @@ SIM223.py:106:7: SIM223 [**] Use `False` instead of `... and False and ...` 108 108 | 109 109 | [ -SIM223.py:113:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:113:8: SIM223 [*] Use `False` instead of `... and False and ...` | 111 | for a in range(10) 112 | for b in range(10) @@ -802,7 +802,7 @@ SIM223.py:113:8: SIM223 [**] Use `False` instead of `... and False and ...` 115 115 | ] 116 116 | -SIM223.py:114:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:114:8: SIM223 [*] Use `False` instead of `... and False and ...` | 112 | for b in range(10) 113 | if a and [] and False and [] # SIM223 @@ -822,7 +822,7 @@ SIM223.py:114:8: SIM223 [**] Use `False` instead of `... and False and ...` 116 116 | 117 117 | { -SIM223.py:121:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:121:8: SIM223 [*] Use `False` instead of `... and False and ...` | 119 | for a in range(10) 120 | for b in range(10) @@ -843,7 +843,7 @@ SIM223.py:121:8: SIM223 [**] Use `False` instead of `... and False and ...` 123 123 | } 124 124 | -SIM223.py:122:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:122:8: SIM223 [*] Use `False` instead of `... and False and ...` | 120 | for b in range(10) 121 | if a and [] and False and [] # SIM223 @@ -863,7 +863,7 @@ SIM223.py:122:8: SIM223 [**] Use `False` instead of `... and False and ...` 124 124 | 125 125 | { -SIM223.py:129:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:129:8: SIM223 [*] Use `False` instead of `... and False and ...` | 127 | for a in range(10) 128 | for b in range(10) @@ -884,7 +884,7 @@ SIM223.py:129:8: SIM223 [**] Use `False` instead of `... and False and ...` 131 131 | } 132 132 | -SIM223.py:130:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:130:8: SIM223 [*] Use `False` instead of `... and False and ...` | 128 | for b in range(10) 129 | if a and [] and False and [] # SIM223 @@ -904,7 +904,7 @@ SIM223.py:130:8: SIM223 [**] Use `False` instead of `... and False and ...` 132 132 | 133 133 | ( -SIM223.py:137:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:137:8: SIM223 [*] Use `False` instead of `... and False and ...` | 135 | for a in range(10) 136 | for b in range(10) @@ -925,7 +925,7 @@ SIM223.py:137:8: SIM223 [**] Use `False` instead of `... and False and ...` 139 139 | ) 140 140 | -SIM223.py:138:8: SIM223 [**] Use `False` instead of `... and False and ...` +SIM223.py:138:8: SIM223 [*] Use `False` instead of `... and False and ...` | 136 | for b in range(10) 137 | if a and [] and False and [] # SIM223 @@ -945,7 +945,7 @@ SIM223.py:138:8: SIM223 [**] Use `False` instead of `... and False and ...` 140 140 | 141 141 | # Outside test `a` is not simplified. -SIM223.py:143:7: SIM223 [**] Use `[]` instead of `[] and ...` +SIM223.py:143:7: SIM223 [*] Use `[]` instead of `[] and ...` | 141 | # Outside test `a` is not simplified. 142 | @@ -966,7 +966,7 @@ SIM223.py:143:7: SIM223 [**] Use `[]` instead of `[] and ...` 145 145 | if (a and [] and False and []) == (a and []): # SIM223 146 146 | pass -SIM223.py:145:11: SIM223 [**] Use `[]` instead of `[] and ...` +SIM223.py:145:11: SIM223 [*] Use `[]` instead of `[] and ...` | 143 | a and [] and False and [] # SIM223 144 | @@ -986,7 +986,7 @@ SIM223.py:145:11: SIM223 [**] Use `[]` instead of `[] and ...` 147 147 | 148 148 | if f(a and [] and False and []): # SIM223 -SIM223.py:148:12: SIM223 [**] Use `[]` instead of `[] and ...` +SIM223.py:148:12: SIM223 [*] Use `[]` instead of `[] and ...` | 146 | pass 147 | diff --git a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap index 7e621dbfc1815c..8c5f552fbc65d6 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap +++ b/crates/ruff_linter/src/rules/flake8_simplify/snapshots/ruff_linter__rules__flake8_simplify__tests__SIM401_SIM401.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_simplify/mod.rs --- -SIM401.py:6:1: SIM401 [**] Use `var = a_dict.get(key, "default1")` instead of an `if` block +SIM401.py:6:1: SIM401 [*] Use `var = a_dict.get(key, "default1")` instead of an `if` block | 5 | # SIM401 (pattern-1) 6 | / if key in a_dict: @@ -27,7 +27,7 @@ SIM401.py:6:1: SIM401 [**] Use `var = a_dict.get(key, "default1")` instead of an 11 8 | # SIM401 (pattern-2) 12 9 | if key not in a_dict: -SIM401.py:12:1: SIM401 [**] Use `var = a_dict.get(key, "default2")` instead of an `if` block +SIM401.py:12:1: SIM401 [*] Use `var = a_dict.get(key, "default2")` instead of an `if` block | 11 | # SIM401 (pattern-2) 12 | / if key not in a_dict: @@ -53,7 +53,7 @@ SIM401.py:12:1: SIM401 [**] Use `var = a_dict.get(key, "default2")` instead of a 17 14 | # OK (default contains effect) 18 15 | if key in a_dict: -SIM401.py:24:1: SIM401 [**] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block +SIM401.py:24:1: SIM401 [*] Use `var = a_dict.get(keys[idx], "default")` instead of an `if` block | 23 | # SIM401 (complex expression in key) 24 | / if keys[idx] in a_dict: @@ -79,7 +79,7 @@ SIM401.py:24:1: SIM401 [**] Use `var = a_dict.get(keys[idx], "default")` instead 29 26 | # SIM401 (complex expression in dict) 30 27 | if key in dicts[idx]: -SIM401.py:30:1: SIM401 [**] Use `var = dicts[idx].get(key, "default")` instead of an `if` block +SIM401.py:30:1: SIM401 [*] Use `var = dicts[idx].get(key, "default")` instead of an `if` block | 29 | # SIM401 (complex expression in dict) 30 | / if key in dicts[idx]: @@ -105,7 +105,7 @@ SIM401.py:30:1: SIM401 [**] Use `var = dicts[idx].get(key, "default")` instead o 35 32 | # SIM401 (complex expression in var) 36 33 | if key in a_dict: -SIM401.py:36:1: SIM401 [**] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789")` instead of an `if` block +SIM401.py:36:1: SIM401 [*] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789ß9💣2ℝ6789")` instead of an `if` block | 35 | # SIM401 (complex expression in var) 36 | / if key in a_dict: @@ -131,7 +131,7 @@ SIM401.py:36:1: SIM401 [**] Use `vars[idx] = a_dict.get(key, "defaultß9💣2ℝ 41 38 | # SIM401 42 39 | if foo(): -SIM401.py:45:5: SIM401 [**] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block +SIM401.py:45:5: SIM401 [*] Use `vars[idx] = a_dict.get(key, "default")` instead of an `if` block | 43 | pass 44 | else: diff --git a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap index 62d9b1f21a2704..db5e80f0a7bc45 100644 --- a/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap +++ b/crates/ruff_linter/src/rules/flake8_tidy_imports/snapshots/ruff_linter__rules__flake8_tidy_imports__tests__ban_parent_imports_package.snap @@ -12,7 +12,7 @@ application.py:5:1: TID252 Relative imports from parent modules are banned | = help: Replace relative imports from parent modules with absolute imports -application.py:6:1: TID252 [**] Relative imports from parent modules are banned +application.py:6:1: TID252 [*] Relative imports from parent modules are banned | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -32,7 +32,7 @@ application.py:6:1: TID252 [**] Relative imports from parent modules are banned 8 8 | from .. import server 9 9 | from . import logger, models -application.py:6:1: TID252 [**] Relative imports from parent modules are banned +application.py:6:1: TID252 [*] Relative imports from parent modules are banned | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -52,7 +52,7 @@ application.py:6:1: TID252 [**] Relative imports from parent modules are banned 8 8 | from .. import server 9 9 | from . import logger, models -application.py:6:1: TID252 [**] Relative imports from parent modules are banned +application.py:6:1: TID252 [*] Relative imports from parent modules are banned | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -72,7 +72,7 @@ application.py:6:1: TID252 [**] Relative imports from parent modules are banned 8 8 | from .. import server 9 9 | from . import logger, models -application.py:7:1: TID252 [**] Relative imports from parent modules are banned +application.py:7:1: TID252 [*] Relative imports from parent modules are banned | 5 | from ....import unknown 6 | from ..protocol import commands, definitions, responses @@ -93,7 +93,7 @@ application.py:7:1: TID252 [**] Relative imports from parent modules are banned 9 9 | from . import logger, models 10 10 | from ..protocol.UpperCaseModule import some_function -application.py:8:1: TID252 [**] Relative imports from parent modules are banned +application.py:8:1: TID252 [*] Relative imports from parent modules are banned | 6 | from ..protocol import commands, definitions, responses 7 | from ..server import example @@ -113,7 +113,7 @@ application.py:8:1: TID252 [**] Relative imports from parent modules are banned 9 9 | from . import logger, models 10 10 | from ..protocol.UpperCaseModule import some_function -application.py:10:1: TID252 [**] Relative imports from parent modules are banned +application.py:10:1: TID252 [*] Relative imports from parent modules are banned | 8 | from .. import server 9 | from . import logger, models diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap index 38efb07aeb4971..e80bedfc54de90 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -exempt_modules.py:14:12: TCH002 [**] Move third-party import `flask` into a type-checking block +exempt_modules.py:14:12: TCH002 [*] Move third-party import `flask` into a type-checking block | 13 | def f(): 14 | import flask diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap index cba1ab76cbb8be..1b427e0f3a0851 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:5:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block +:5:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 4 | from pandas import ( 5 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap index 7780df061523bd..ac5b0d17f97c55 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:7:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block +:7:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap index 56c08f0a1c507e..4256b3199e1cef 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:7:5: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block +:7:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame @@ -29,7 +29,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 11 13 | def f(x: DataFrame, y: Series): 12 14 | pass -:8:5: TCH002 [**] Move third-party import `pandas.Series` into a type-checking block +:8:5: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap index 2ad2c7c0521d70..c293b6fe552cb8 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:8: TCH003 [**] Move standard library import `os` into a type-checking block +:6:8: TCH003 [*] Move standard library import `os` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | @@ -25,7 +25,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 11 | def f(x: os, y: pandas): 9 12 | pass -:6:12: TCH002 [**] Move third-party import `pandas` into a type-checking block +:6:12: TCH002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap index 0d8c2c4fe86dd4..fa23f5d87a8478 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:8: TCH003 [**] Move standard library import `os` into a type-checking block +:6:8: TCH003 [*] Move standard library import `os` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | @@ -24,7 +24,7 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs 8 10 | def f(x: os, y: sys): 9 11 | pass -:6:12: TCH003 [**] Move standard library import `sys` into a type-checking block +:6:12: TCH003 [*] Move standard library import `sys` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap index a4b8dda5ca0d98..16a94fdcad49cf 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:4:18: TCH002 [**] Move third-party import `pandas` into a type-checking block +:4:18: TCH002 [*] Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations 3 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap index 9730b3f358bcd5..ce1d06b0cfa7f7 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_1.py:4:26: TCH004 [**] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting. +TCH004_1.py:4:26: TCH004 [*] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from datetime import datetime diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap index a08f402c3dff89..66a8bb5b574e02 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_11.py:4:24: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TCH004_11.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap index 23fcfab5ac807b..2e6d2751e9ba56 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_12.py:6:33: TCH004 [**] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. +TCH004_12.py:6:33: TCH004 [*] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. | 5 | if TYPE_CHECKING: 6 | from collections.abc import Callable diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap index f429eb190d1cdd..b2090156ef9b68 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_2.py:4:26: TCH004 [**] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting. +TCH004_2.py:4:26: TCH004 [*] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from datetime import date diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap index cd6eb25d5d6fbe..1a3ecb0c2cf348 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_4.py:4:24: TCH004 [**] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting. +TCH004_4.py:4:24: TCH004 [*] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Any diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap index 7e76ac7e8b5e06..4bded770e5b7d5 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_5.py:4:24: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set @@ -20,7 +20,7 @@ TCH004_5.py:4:24: TCH004 [**] Move import `typing.List` out of type-checking blo 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): -TCH004_5.py:4:30: TCH004 [**] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. +TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set @@ -39,7 +39,7 @@ TCH004_5.py:4:30: TCH004 [**] Move import `typing.Sequence` out of type-checking 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): -TCH004_5.py:4:40: TCH004 [**] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. +TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap index 090725192c9c3a..3af36dde409ab0 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH004_9.py:4:24: TCH004 [**] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. +TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict @@ -22,7 +22,7 @@ TCH004_9.py:4:24: TCH004 [**] Move import `typing.Tuple` out of type-checking bl 6 7 | x: Tuple 7 8 | -TCH004_9.py:4:31: TCH004 [**] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap index e8bd62a5573a62..263990b605feda 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_base_classes_1.py:10:12: TCH004 [**] Move import `datetime` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. | 9 | if TYPE_CHECKING: 10 | import datetime # TCH004 @@ -22,7 +22,7 @@ runtime_evaluated_base_classes_1.py:10:12: TCH004 [**] Move import `datetime` ou 12 12 | 13 13 | import pandas # TCH004 -runtime_evaluated_base_classes_1.py:11:23: TCH004 [**] Move import `array.array` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. | 9 | if TYPE_CHECKING: 10 | import datetime # TCH004 @@ -46,7 +46,7 @@ runtime_evaluated_base_classes_1.py:11:23: TCH004 [**] Move import `array.array` 13 13 | import pandas # TCH004 14 14 | import pyproj -runtime_evaluated_base_classes_1.py:13:12: TCH004 [**] Move import `pandas` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:13:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | 11 | from array import array # TCH004 12 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap index 1de54e8835307d..c472d3f9d84b44 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_decorators_1.py:12:12: TCH004 [**] Move import `datetime` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. | 11 | if TYPE_CHECKING: 12 | import datetime # TCH004 @@ -22,7 +22,7 @@ runtime_evaluated_decorators_1.py:12:12: TCH004 [**] Move import `datetime` out 14 14 | 15 15 | import pandas # TCH004 -runtime_evaluated_decorators_1.py:13:23: TCH004 [**] Move import `array.array` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. | 11 | if TYPE_CHECKING: 12 | import datetime # TCH004 @@ -46,7 +46,7 @@ runtime_evaluated_decorators_1.py:13:23: TCH004 [**] Move import `array.array` o 15 15 | import pandas # TCH004 16 16 | import pyproj -runtime_evaluated_decorators_1.py:15:12: TCH004 [**] Move import `pandas` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | 13 | from array import array # TCH004 14 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict.snap index fb86ccfd84dd34..835a51bce361ca 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -strict.py:27:21: TCH002 [**] Move third-party import `pkg.A` into a type-checking block +strict.py:27:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking block | 25 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 26 | import pkg @@ -30,7 +30,7 @@ strict.py:27:21: TCH002 [**] Move third-party import `pkg.A` into a type-checkin 29 32 | def test(value: A): 30 33 | return pkg.B() -strict.py:35:21: TCH002 [**] Move third-party import `pkg.A` into a type-checking block +strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking block | 33 | def f(): 34 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. @@ -60,7 +60,7 @@ strict.py:35:21: TCH002 [**] Move third-party import `pkg.A` into a type-checkin 37 41 | def test(value: A): 38 42 | return B() -strict.py:54:25: TCH002 [**] Move third-party import `pkg.bar.A` into a type-checking block +strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-checking block | 52 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime 53 | import pkg @@ -89,7 +89,7 @@ strict.py:54:25: TCH002 [**] Move third-party import `pkg.bar.A` into a type-che 56 59 | def test(value: A): 57 60 | return pkg.B() -strict.py:62:12: TCH002 [**] Move third-party import `pkg` into a type-checking block +strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | 60 | def f(): 61 | # In un-strict mode, this shouldn't raise an error, since `pkg.bar` is used at runtime. @@ -117,7 +117,7 @@ strict.py:62:12: TCH002 [**] Move third-party import `pkg` into a type-checking 64 67 | 65 68 | def test(value: pkg.A): -strict.py:71:23: TCH002 [**] Move third-party import `pkg.foo` into a type-checking block +strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block | 69 | def f(): 70 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. @@ -145,7 +145,7 @@ strict.py:71:23: TCH002 [**] Move third-party import `pkg.foo` into a type-check 73 76 | 74 77 | def test(value: F.Foo): -strict.py:80:12: TCH002 [**] Move third-party import `pkg` into a type-checking block +strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | 78 | def f(): 79 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. @@ -173,7 +173,7 @@ strict.py:80:12: TCH002 [**] Move third-party import `pkg` into a type-checking 82 85 | 83 86 | def test(value: pkg.A): -strict.py:91:12: TCH002 [**] Move third-party import `pkg` into a type-checking block +strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | 89 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is 90 | # testing the implementation. @@ -201,7 +201,7 @@ strict.py:91:12: TCH002 [**] Move third-party import `pkg` into a type-checking 93 96 | 94 97 | def test(value: pkg.A): -strict.py:101:23: TCH002 [**] Move third-party import `pkg.foo` into a type-checking block +strict.py:101:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block | 99 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 100 | import pkg.bar as B diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap index 11ad5c07d9cba3..f97e331017f9e0 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap index 307c8de85f3e9b..d554a00b1621a3 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap index 244270feda3061..027b2a6826b09b 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap index 8e5df1614ef24d..60a5c92f63d5b7 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap index 4afe967b32bc18..8a486f94ba8d17 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH001.py:20:19: TCH001 [**] Move application import `.TYP001` into a type-checking block +TCH001.py:20:19: TCH001 [*] Move application import `.TYP001` into a type-checking block | 19 | def f(): 20 | from . import TYP001 diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap index 3bc3fa77b9acd5..f1e2a0bfe2f664 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH003.py:8:12: TCH003 [**] Move standard library import `os` into a type-checking block +TCH003.py:8:12: TCH003 [*] Move standard library import `os` into a type-checking block | 7 | def f(): 8 | import os diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap index ab3abd21a4744f..8e151b89dab2bb 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_base_classes_3.py:5:18: TCH003 [**] Move standard library import `uuid.UUID` into a type-checking block +runtime_evaluated_base_classes_3.py:5:18: TCH003 [*] Move standard library import `uuid.UUID` into a type-checking block | 3 | import datetime 4 | import pathlib diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap index aa680d7ea3970a..99dade0f9976cc 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_decorators_3.py:6:18: TCH003 [**] Move standard library import `uuid.UUID` into a type-checking block +runtime_evaluated_decorators_3.py:6:18: TCH003 [*] Move standard library import `uuid.UUID` into a type-checking block | 4 | from array import array 5 | from dataclasses import dataclass diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap index f82ba61f9ba26f..5f1ea76784cf13 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -TCH002.py:5:22: TCH002 [**] Move third-party import `pandas` into a type-checking block +TCH002.py:5:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 4 | def f(): 5 | import pandas as pd # TCH002 @@ -25,7 +25,7 @@ TCH002.py:5:22: TCH002 [**] Move third-party import `pandas` into a type-checkin 7 10 | x: pd.DataFrame 8 11 | -TCH002.py:11:24: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block +TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 10 | def f(): 11 | from pandas import DataFrame # TCH002 @@ -53,7 +53,7 @@ TCH002.py:11:24: TCH002 [**] Move third-party import `pandas.DataFrame` into a t 13 16 | x: DataFrame 14 17 | -TCH002.py:17:37: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block +TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 16 | def f(): 17 | from pandas import DataFrame as df # TCH002 @@ -81,7 +81,7 @@ TCH002.py:17:37: TCH002 [**] Move third-party import `pandas.DataFrame` into a t 19 22 | x: df 20 23 | -TCH002.py:23:22: TCH002 [**] Move third-party import `pandas` into a type-checking block +TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 22 | def f(): 23 | import pandas as pd # TCH002 @@ -109,7 +109,7 @@ TCH002.py:23:22: TCH002 [**] Move third-party import `pandas` into a type-checki 25 28 | x: pd.DataFrame = 1 26 29 | -TCH002.py:29:24: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block +TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 28 | def f(): 29 | from pandas import DataFrame # TCH002 @@ -137,7 +137,7 @@ TCH002.py:29:24: TCH002 [**] Move third-party import `pandas.DataFrame` into a t 31 34 | x: DataFrame = 2 32 35 | -TCH002.py:35:37: TCH002 [**] Move third-party import `pandas.DataFrame` into a type-checking block +TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 34 | def f(): 35 | from pandas import DataFrame as df # TCH002 @@ -165,7 +165,7 @@ TCH002.py:35:37: TCH002 [**] Move third-party import `pandas.DataFrame` into a t 37 40 | x: df = 3 38 41 | -TCH002.py:41:22: TCH002 [**] Move third-party import `pandas` into a type-checking block +TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 40 | def f(): 41 | import pandas as pd # TCH002 @@ -193,7 +193,7 @@ TCH002.py:41:22: TCH002 [**] Move third-party import `pandas` into a type-checki 43 46 | x: "pd.DataFrame" = 1 44 47 | -TCH002.py:47:22: TCH002 [**] Move third-party import `pandas` into a type-checking block +TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checking block | 46 | def f(): 47 | import pandas as pd # TCH002 @@ -221,7 +221,7 @@ TCH002.py:47:22: TCH002 [**] Move third-party import `pandas` into a type-checki 49 52 | x = dict["pd.DataFrame", "pd.DataFrame"] 50 53 | -TCH002.py:172:24: TCH002 [**] Move third-party import `module.Member` into a type-checking block +TCH002.py:172:24: TCH002 [*] Move third-party import `module.Member` into a type-checking block | 170 | global Member 171 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap index a51fa68aa2609d..ac865d383c7747 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_base_classes_2.py:3:21: TCH002 [**] Move third-party import `geopandas` into a type-checking block +runtime_evaluated_base_classes_2.py:3:21: TCH002 [*] Move third-party import `geopandas` into a type-checking block | 1 | from __future__ import annotations 2 | @@ -29,7 +29,7 @@ runtime_evaluated_base_classes_2.py:3:21: TCH002 [**] Move third-party import `g 10 13 | 11 14 | class A(BaseModel): -runtime_evaluated_base_classes_2.py:5:8: TCH002 [**] Move third-party import `pyproj` into a type-checking block +runtime_evaluated_base_classes_2.py:5:8: TCH002 [*] Move third-party import `pyproj` into a type-checking block | 3 | import geopandas as gpd # TCH002 4 | import pydantic diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap index ec04ff48847e33..dafbc94d64aa82 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -runtime_evaluated_decorators_2.py:10:8: TCH002 [**] Move third-party import `numpy` into a type-checking block +runtime_evaluated_decorators_2.py:10:8: TCH002 [*] Move third-party import `numpy` into a type-checking block | 8 | from attrs import frozen 9 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap index d98282d1feda99..496d0f55877f31 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -strict.py:54:25: TCH002 [**] Move third-party import `pkg.bar.A` into a type-checking block +strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-checking block | 52 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime 53 | import pkg @@ -30,7 +30,7 @@ strict.py:54:25: TCH002 [**] Move third-party import `pkg.bar.A` into a type-che 56 59 | def test(value: A): 57 60 | return pkg.B() -strict.py:91:12: TCH002 [**] Move third-party import `pkg` into a type-checking block +strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking block | 89 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is 90 | # testing the implementation. diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap index dd024a9860b04b..df0299e8a79c22 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:4:18: TCH002 [**] Move third-party import `pandas` into a type-checking block +:4:18: TCH002 [*] Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations 3 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap index 21773db16365f3..361042da6bc491 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -:6:18: TCH002 [**] Move third-party import `pandas` into a type-checking block +:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | diff --git a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap index 25c204a99da9fb..17ac7a8ef9812e 100644 --- a/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap +++ b/crates/ruff_linter/src/rules/flynt/snapshots/ruff_linter__rules__flynt__tests__FLY002_FLY002.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/flynt/mod.rs --- -FLY002.py:5:7: FLY002 [**] Consider `f"{a} World"` instead of string join +FLY002.py:5:7: FLY002 [*] Consider `f"{a} World"` instead of string join | 4 | a = "Hello" 5 | ok1 = " ".join([a, " World"]) # OK @@ -21,7 +21,7 @@ FLY002.py:5:7: FLY002 [**] Consider `f"{a} World"` instead of string join 7 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally -FLY002.py:6:7: FLY002 [**] Consider `f"Finally, {a} World"` instead of string join +FLY002.py:6:7: FLY002 [*] Consider `f"Finally, {a} World"` instead of string join | 4 | a = "Hello" 5 | ok1 = " ".join([a, " World"]) # OK @@ -42,7 +42,7 @@ FLY002.py:6:7: FLY002 [**] Consider `f"Finally, {a} World"` instead of string jo 8 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) -FLY002.py:7:7: FLY002 [**] Consider `"1x2x3"` instead of string join +FLY002.py:7:7: FLY002 [*] Consider `"1x2x3"` instead of string join | 5 | ok1 = " ".join([a, " World"]) # OK 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK @@ -63,7 +63,7 @@ FLY002.py:7:7: FLY002 [**] Consider `"1x2x3"` instead of string join 9 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) 10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) -FLY002.py:8:7: FLY002 [**] Consider `f"{1}y{2}y{3}"` instead of string join +FLY002.py:8:7: FLY002 [*] Consider `f"{1}y{2}y{3}"` instead of string join | 6 | ok2 = "".join(["Finally, ", a, " World"]) # OK 7 | ok3 = "x".join(("1", "2", "3")) # OK @@ -84,7 +84,7 @@ FLY002.py:8:7: FLY002 [**] Consider `f"{1}y{2}y{3}"` instead of string join 10 10 | ok6 = "a".join([secrets.token_urlsafe(), secrets.token_hex()]) # OK (attr calls) 11 11 | -FLY002.py:9:7: FLY002 [**] Consider `f"{random()}a{random()}"` instead of string join +FLY002.py:9:7: FLY002 [*] Consider `f"{random()}a{random()}"` instead of string join | 7 | ok3 = "x".join(("1", "2", "3")) # OK 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally @@ -104,7 +104,7 @@ FLY002.py:9:7: FLY002 [**] Consider `f"{random()}a{random()}"` instead of string 11 11 | 12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) -FLY002.py:10:7: FLY002 [**] Consider `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` instead of string join +FLY002.py:10:7: FLY002 [*] Consider `f"{secrets.token_urlsafe()}a{secrets.token_hex()}"` instead of string join | 8 | ok4 = "y".join([1, 2, 3]) # Technically OK, though would've been an error originally 9 | ok5 = "a".join([random(), random()]) # OK (simple calls) @@ -125,7 +125,7 @@ FLY002.py:10:7: FLY002 [**] Consider `f"{secrets.token_urlsafe()}a{secrets.token 12 12 | nok1 = "x".join({"4", "5", "yee"}) # Not OK (set) 13 13 | nok2 = a.join(["1", "2", "3"]) # Not OK (not a static joiner) -FLY002.py:23:11: FLY002 [**] Consider `f"{url}{filename}"` instead of string join +FLY002.py:23:11: FLY002 [*] Consider `f"{url}{filename}"` instead of string join | 21 | # Regression test for: https://github.com/astral-sh/ruff/issues/7197 22 | def create_file_public_url(url, filename): diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap index 973a498d92cd29..1d8aa9dc02fdc1 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-function_NPY003.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -NPY003.py:4:5: NPY003 [**] `np.round_` is deprecated; use `np.round` instead +NPY003.py:4:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead | 2 | import numpy as np 3 | @@ -22,7 +22,7 @@ NPY003.py:4:5: NPY003 [**] `np.round_` is deprecated; use `np.round` instead 6 6 | np.cumproduct(np.random.rand(5, 5)) 7 7 | np.sometrue(np.random.rand(5, 5)) -NPY003.py:5:5: NPY003 [**] `np.product` is deprecated; use `np.prod` instead +NPY003.py:5:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead | 4 | np.round_(np.random.rand(5, 5), 2) 5 | np.product(np.random.rand(5, 5)) @@ -42,7 +42,7 @@ NPY003.py:5:5: NPY003 [**] `np.product` is deprecated; use `np.prod` instead 7 7 | np.sometrue(np.random.rand(5, 5)) 8 8 | np.alltrue(np.random.rand(5, 5)) -NPY003.py:6:5: NPY003 [**] `np.cumproduct` is deprecated; use `np.cumprod` instead +NPY003.py:6:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instead | 4 | np.round_(np.random.rand(5, 5), 2) 5 | np.product(np.random.rand(5, 5)) @@ -63,7 +63,7 @@ NPY003.py:6:5: NPY003 [**] `np.cumproduct` is deprecated; use `np.cumprod` inste 8 8 | np.alltrue(np.random.rand(5, 5)) 9 9 | -NPY003.py:7:5: NPY003 [**] `np.sometrue` is deprecated; use `np.any` instead +NPY003.py:7:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead | 5 | np.product(np.random.rand(5, 5)) 6 | np.cumproduct(np.random.rand(5, 5)) @@ -83,7 +83,7 @@ NPY003.py:7:5: NPY003 [**] `np.sometrue` is deprecated; use `np.any` instead 9 9 | 10 10 | -NPY003.py:8:5: NPY003 [**] `np.alltrue` is deprecated; use `np.all` instead +NPY003.py:8:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead | 6 | np.cumproduct(np.random.rand(5, 5)) 7 | np.sometrue(np.random.rand(5, 5)) @@ -102,7 +102,7 @@ NPY003.py:8:5: NPY003 [**] `np.alltrue` is deprecated; use `np.all` instead 10 10 | 11 11 | def func(): -NPY003.py:14:5: NPY003 [**] `np.round_` is deprecated; use `np.round` instead +NPY003.py:14:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead | 12 | from numpy import round_, product, cumproduct, sometrue, alltrue 13 | @@ -128,7 +128,7 @@ NPY003.py:14:5: NPY003 [**] `np.round_` is deprecated; use `np.round` instead 16 17 | cumproduct(np.random.rand(5, 5)) 17 18 | sometrue(np.random.rand(5, 5)) -NPY003.py:15:5: NPY003 [**] `np.product` is deprecated; use `np.prod` instead +NPY003.py:15:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead | 14 | round_(np.random.rand(5, 5), 2) 15 | product(np.random.rand(5, 5)) @@ -153,7 +153,7 @@ NPY003.py:15:5: NPY003 [**] `np.product` is deprecated; use `np.prod` instead 17 18 | sometrue(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -NPY003.py:16:5: NPY003 [**] `np.cumproduct` is deprecated; use `np.cumprod` instead +NPY003.py:16:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instead | 14 | round_(np.random.rand(5, 5), 2) 15 | product(np.random.rand(5, 5)) @@ -178,7 +178,7 @@ NPY003.py:16:5: NPY003 [**] `np.cumproduct` is deprecated; use `np.cumprod` inst 17 18 | sometrue(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -NPY003.py:17:5: NPY003 [**] `np.sometrue` is deprecated; use `np.any` instead +NPY003.py:17:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead | 15 | product(np.random.rand(5, 5)) 16 | cumproduct(np.random.rand(5, 5)) @@ -201,7 +201,7 @@ NPY003.py:17:5: NPY003 [**] `np.sometrue` is deprecated; use `np.any` instead 18 |+ any(np.random.rand(5, 5)) 18 19 | alltrue(np.random.rand(5, 5)) -NPY003.py:18:5: NPY003 [**] `np.alltrue` is deprecated; use `np.all` instead +NPY003.py:18:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead | 16 | cumproduct(np.random.rand(5, 5)) 17 | sometrue(np.random.rand(5, 5)) diff --git a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap index f729fcf052c38b..f83b5e3a322c5b 100644 --- a/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap +++ b/crates/ruff_linter/src/rules/numpy/snapshots/ruff_linter__rules__numpy__tests__numpy-deprecated-type-alias_NPY001.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/numpy/mod.rs --- -NPY001.py:6:1: NPY001 [**] Type alias `np.bool` is deprecated, replace with builtin type +NPY001.py:6:1: NPY001 [*] Type alias `np.bool` is deprecated, replace with builtin type | 5 | # Error 6 | npy.bool @@ -20,7 +20,7 @@ NPY001.py:6:1: NPY001 [**] Type alias `np.bool` is deprecated, replace with buil 8 8 | 9 9 | if dtype == np.object: -NPY001.py:7:1: NPY001 [**] Type alias `np.int` is deprecated, replace with builtin type +NPY001.py:7:1: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type | 5 | # Error 6 | npy.bool @@ -41,7 +41,7 @@ NPY001.py:7:1: NPY001 [**] Type alias `np.int` is deprecated, replace with built 9 9 | if dtype == np.object: 10 10 | ... -NPY001.py:9:13: NPY001 [**] Type alias `np.object` is deprecated, replace with builtin type +NPY001.py:9:13: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type | 7 | npy.int 8 | @@ -61,7 +61,7 @@ NPY001.py:9:13: NPY001 [**] Type alias `np.object` is deprecated, replace with b 11 11 | 12 12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.long]) -NPY001.py:12:72: NPY001 [**] Type alias `np.int` is deprecated, replace with builtin type +NPY001.py:12:72: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type | 10 | ... 11 | @@ -82,7 +82,7 @@ NPY001.py:12:72: NPY001 [**] Type alias `np.int` is deprecated, replace with bui 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], -NPY001.py:12:80: NPY001 [**] Type alias `np.long` is deprecated, replace with builtin type +NPY001.py:12:80: NPY001 [*] Type alias `np.long` is deprecated, replace with builtin type | 10 | ... 11 | @@ -103,7 +103,7 @@ NPY001.py:12:80: NPY001 [**] Type alias `np.long` is deprecated, replace with bu 14 14 | pdf = pd.DataFrame( 15 15 | data=[[1, 2, 3]], -NPY001.py:17:11: NPY001 [**] Type alias `np.object` is deprecated, replace with builtin type +NPY001.py:17:11: NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type | 15 | data=[[1, 2, 3]], 16 | columns=["a", "b", "c"], @@ -123,7 +123,7 @@ NPY001.py:17:11: NPY001 [**] Type alias `np.object` is deprecated, replace with 19 19 | 20 20 | _ = arr.astype(np.int) -NPY001.py:20:16: NPY001 [**] Type alias `np.int` is deprecated, replace with builtin type +NPY001.py:20:16: NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type | 18 | ) 19 | diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap index 6ebfce7b4c231e..8fd8323c46ecdf 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_PD002.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -PD002.py:5:23: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:5:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 3 | x = pd.DataFrame() 4 | @@ -22,7 +22,7 @@ PD002.py:5:23: PD002 [**] `inplace=True` should be avoided; it has inconsistent 7 7 | x.y.drop(["a"], axis=1, inplace=True) 8 8 | -PD002.py:7:25: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:7:25: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 5 | x.drop(["a"], axis=1, inplace=True) 6 | @@ -43,7 +43,7 @@ PD002.py:7:25: PD002 [**] `inplace=True` should be avoided; it has inconsistent 9 9 | x["y"].drop(["a"], axis=1, inplace=True) 10 10 | -PD002.py:9:28: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:9:28: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 7 | x.y.drop(["a"], axis=1, inplace=True) 8 | @@ -64,7 +64,7 @@ PD002.py:9:28: PD002 [**] `inplace=True` should be avoided; it has inconsistent 11 11 | x.drop( 12 12 | inplace=True, -PD002.py:12:5: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:12:5: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 11 | x.drop( 12 | inplace=True, @@ -85,7 +85,7 @@ PD002.py:12:5: PD002 [**] `inplace=True` should be avoided; it has inconsistent 14 13 | axis=1, 15 14 | ) -PD002.py:19:9: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:19:9: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 17 | if True: 18 | x.drop( @@ -107,7 +107,7 @@ PD002.py:19:9: PD002 [**] `inplace=True` should be avoided; it has inconsistent 21 20 | axis=1, 22 21 | ) -PD002.py:24:33: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:24:33: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 22 | ) 23 | @@ -158,7 +158,7 @@ PD002.py:28:38: PD002 `inplace=True` should be avoided; it has inconsistent beha | = help: Assign to variable; remove `inplace` arg -PD002.py:33:24: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior +PD002.py:33:24: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 31 | torch.m.ReLU(inplace=True) # safe because this isn't a pandas call 32 | diff --git a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap index 00de5c1c668961..d88f95e11436c5 100644 --- a/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap +++ b/crates/ruff_linter/src/rules/pandas_vet/snapshots/ruff_linter__rules__pandas_vet__tests__PD002_fail.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pandas_vet/mod.rs --- -:4:23: PD002 [**] `inplace=True` should be avoided; it has inconsistent behavior +:4:23: PD002 [*] `inplace=True` should be avoided; it has inconsistent behavior | 2 | import pandas as pd 3 | x = pd.DataFrame() diff --git a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap index 2cd54164805b25..f38200c0dec33e 100644 --- a/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap +++ b/crates/ruff_linter/src/rules/perflint/snapshots/ruff_linter__rules__perflint__tests__PERF102_PERF102.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/perflint/mod.rs --- -PERF102.py:5:21: PERF102 [**] When using only the values of a dict use the `values()` method +PERF102.py:5:21: PERF102 [*] When using only the values of a dict use the `values()` method | 4 | def f(): 5 | for _, value in some_dict.items(): # PERF102 @@ -20,7 +20,7 @@ PERF102.py:5:21: PERF102 [**] When using only the values of a dict use the `valu 7 7 | 8 8 | -PERF102.py:10:19: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:10:19: PERF102 [*] When using only the keys of a dict use the `keys()` method | 9 | def f(): 10 | for key, _ in some_dict.items(): # PERF102 @@ -39,7 +39,7 @@ PERF102.py:10:19: PERF102 [**] When using only the keys of a dict use the `keys( 12 12 | 13 13 | -PERF102.py:15:30: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:15:30: PERF102 [*] When using only the keys of a dict use the `keys()` method | 14 | def f(): 15 | for weird_arg_name, _ in some_dict.items(): # PERF102 @@ -58,7 +58,7 @@ PERF102.py:15:30: PERF102 [**] When using only the keys of a dict use the `keys( 17 17 | 18 18 | -PERF102.py:20:25: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:20:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | 19 | def f(): 20 | for name, (_, _) in some_dict.items(): # PERF102 @@ -77,7 +77,7 @@ PERF102.py:20:25: PERF102 [**] When using only the keys of a dict use the `keys( 22 22 | 23 23 | -PERF102.py:30:30: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:30:30: PERF102 [*] When using only the keys of a dict use the `keys()` method | 29 | def f(): 30 | for (key1, _), (_, _) in some_dict.items(): # PERF102 @@ -96,7 +96,7 @@ PERF102.py:30:30: PERF102 [**] When using only the keys of a dict use the `keys( 32 32 | 33 33 | -PERF102.py:35:36: PERF102 [**] When using only the values of a dict use the `values()` method +PERF102.py:35:36: PERF102 [*] When using only the values of a dict use the `values()` method | 34 | def f(): 35 | for (_, (_, _)), (value, _) in some_dict.items(): # PERF102 @@ -115,7 +115,7 @@ PERF102.py:35:36: PERF102 [**] When using only the values of a dict use the `val 37 37 | 38 38 | -PERF102.py:50:32: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:50:32: PERF102 [*] When using only the keys of a dict use the `keys()` method | 49 | def f(): 50 | for ((_, key2), (_, _)) in some_dict.items(): # PERF102 @@ -134,7 +134,7 @@ PERF102.py:50:32: PERF102 [**] When using only the keys of a dict use the `keys( 52 52 | 53 53 | -PERF102.py:85:25: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:85:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | 84 | def f(): 85 | for name, (_, _) in (some_function()).items(): # PERF102 @@ -153,7 +153,7 @@ PERF102.py:85:25: PERF102 [**] When using only the keys of a dict use the `keys( 87 87 | 88 88 | -PERF102.py:90:25: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:90:25: PERF102 [*] When using only the keys of a dict use the `keys()` method | 89 | def f(): 90 | for name, (_, _) in (some_function().some_attribute).items(): # PERF102 @@ -172,7 +172,7 @@ PERF102.py:90:25: PERF102 [**] When using only the keys of a dict use the `keys( 92 92 | 93 93 | -PERF102.py:95:31: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:95:31: PERF102 [*] When using only the keys of a dict use the `keys()` method | 94 | def f(): 95 | for name, unused_value in some_dict.items(): # PERF102 @@ -191,7 +191,7 @@ PERF102.py:95:31: PERF102 [**] When using only the keys of a dict use the `keys( 97 97 | 98 98 | -PERF102.py:100:31: PERF102 [**] When using only the values of a dict use the `values()` method +PERF102.py:100:31: PERF102 [*] When using only the values of a dict use the `values()` method | 99 | def f(): 100 | for unused_name, value in some_dict.items(): # PERF102 @@ -210,7 +210,7 @@ PERF102.py:100:31: PERF102 [**] When using only the values of a dict use the `va 102 102 | 103 103 | -PERF102.py:106:16: PERF102 [**] When using only the keys of a dict use the `keys()` method +PERF102.py:106:16: PERF102 [*] When using only the keys of a dict use the `keys()` method | 104 | # Regression test for: https://github.com/astral-sh/ruff/issues/7097 105 | def _create_context(name_to_value): diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap index 226cd3007a5d9b..0929543ee6c8a7 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E711_E711.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E711.py:2:11: E711 [**] Comparison to `None` should be `cond is None` +E711.py:2:11: E711 [*] Comparison to `None` should be `cond is None` | 1 | #: E711 2 | if res == None: @@ -19,7 +19,7 @@ E711.py:2:11: E711 [**] Comparison to `None` should be `cond is None` 4 4 | #: E711 5 5 | if res != None: -E711.py:5:11: E711 [**] Comparison to `None` should be `cond is not None` +E711.py:5:11: E711 [*] Comparison to `None` should be `cond is not None` | 3 | pass 4 | #: E711 @@ -40,7 +40,7 @@ E711.py:5:11: E711 [**] Comparison to `None` should be `cond is not None` 7 7 | #: E711 8 8 | if None == res: -E711.py:8:4: E711 [**] Comparison to `None` should be `cond is None` +E711.py:8:4: E711 [*] Comparison to `None` should be `cond is None` | 6 | pass 7 | #: E711 @@ -61,7 +61,7 @@ E711.py:8:4: E711 [**] Comparison to `None` should be `cond is None` 10 10 | #: E711 11 11 | if None != res: -E711.py:11:4: E711 [**] Comparison to `None` should be `cond is not None` +E711.py:11:4: E711 [*] Comparison to `None` should be `cond is not None` | 9 | pass 10 | #: E711 @@ -82,7 +82,7 @@ E711.py:11:4: E711 [**] Comparison to `None` should be `cond is not None` 13 13 | #: E711 14 14 | if res[1] == None: -E711.py:14:14: E711 [**] Comparison to `None` should be `cond is None` +E711.py:14:14: E711 [*] Comparison to `None` should be `cond is None` | 12 | pass 13 | #: E711 @@ -103,7 +103,7 @@ E711.py:14:14: E711 [**] Comparison to `None` should be `cond is None` 16 16 | #: E711 17 17 | if res[1] != None: -E711.py:17:14: E711 [**] Comparison to `None` should be `cond is not None` +E711.py:17:14: E711 [*] Comparison to `None` should be `cond is not None` | 15 | pass 16 | #: E711 @@ -124,7 +124,7 @@ E711.py:17:14: E711 [**] Comparison to `None` should be `cond is not None` 19 19 | #: E711 20 20 | if None != res[1]: -E711.py:20:4: E711 [**] Comparison to `None` should be `cond is not None` +E711.py:20:4: E711 [*] Comparison to `None` should be `cond is not None` | 18 | pass 19 | #: E711 @@ -145,7 +145,7 @@ E711.py:20:4: E711 [**] Comparison to `None` should be `cond is not None` 22 22 | #: E711 23 23 | if None == res[1]: -E711.py:23:4: E711 [**] Comparison to `None` should be `cond is None` +E711.py:23:4: E711 [*] Comparison to `None` should be `cond is None` | 21 | pass 22 | #: E711 @@ -165,7 +165,7 @@ E711.py:23:4: E711 [**] Comparison to `None` should be `cond is None` 25 25 | 26 26 | if x == None != None: -E711.py:26:9: E711 [**] Comparison to `None` should be `cond is None` +E711.py:26:9: E711 [*] Comparison to `None` should be `cond is None` | 24 | pass 25 | @@ -185,7 +185,7 @@ E711.py:26:9: E711 [**] Comparison to `None` should be `cond is None` 28 28 | 29 29 | #: Okay -E711.py:26:17: E711 [**] Comparison to `None` should be `cond is not None` +E711.py:26:17: E711 [*] Comparison to `None` should be `cond is not None` | 24 | pass 25 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap index bcfce5f35e2f28..6f4b23c2defc4c 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E712_E712.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E712.py:2:11: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:2:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` | 1 | #: E712 2 | if res == True: @@ -19,7 +19,7 @@ E712.py:2:11: E712 [**] Comparison to `True` should be `cond is True` or `if con 4 4 | #: E712 5 5 | if res != False: -E712.py:5:11: E712 [**] Comparison to `False` should be `cond is not False` or `if cond:` +E712.py:5:11: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:` | 3 | pass 4 | #: E712 @@ -40,7 +40,7 @@ E712.py:5:11: E712 [**] Comparison to `False` should be `cond is not False` or ` 7 7 | #: E712 8 8 | if True != res: -E712.py:8:4: E712 [**] Comparison to `True` should be `cond is not True` or `if not cond:` +E712.py:8:4: E712 [*] Comparison to `True` should be `cond is not True` or `if not cond:` | 6 | pass 7 | #: E712 @@ -61,7 +61,7 @@ E712.py:8:4: E712 [**] Comparison to `True` should be `cond is not True` or `if 10 10 | #: E712 11 11 | if False == res: -E712.py:11:4: E712 [**] Comparison to `False` should be `cond is False` or `if not cond:` +E712.py:11:4: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:` | 9 | pass 10 | #: E712 @@ -82,7 +82,7 @@ E712.py:11:4: E712 [**] Comparison to `False` should be `cond is False` or `if n 13 13 | #: E712 14 14 | if res[1] == True: -E712.py:14:14: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:14:14: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` | 12 | pass 13 | #: E712 @@ -103,7 +103,7 @@ E712.py:14:14: E712 [**] Comparison to `True` should be `cond is True` or `if co 16 16 | #: E712 17 17 | if res[1] != False: -E712.py:17:14: E712 [**] Comparison to `False` should be `cond is not False` or `if cond:` +E712.py:17:14: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:` | 15 | pass 16 | #: E712 @@ -124,7 +124,7 @@ E712.py:17:14: E712 [**] Comparison to `False` should be `cond is not False` or 19 19 | #: E712 20 20 | var = 1 if cond == True else -1 if cond == False else cond -E712.py:20:20: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:20:20: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` | 18 | pass 19 | #: E712 @@ -145,7 +145,7 @@ E712.py:20:20: E712 [**] Comparison to `True` should be `cond is True` or `if co 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass -E712.py:20:44: E712 [**] Comparison to `False` should be `cond is False` or `if not cond:` +E712.py:20:44: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:` | 18 | pass 19 | #: E712 @@ -166,7 +166,7 @@ E712.py:20:44: E712 [**] Comparison to `False` should be `cond is False` or `if 22 22 | if (True) == TrueElement or x == TrueElement: 23 23 | pass -E712.py:22:5: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:22:5: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` | 20 | var = 1 if cond == True else -1 if cond == False else cond 21 | #: E712 @@ -186,7 +186,7 @@ E712.py:22:5: E712 [**] Comparison to `True` should be `cond is True` or `if con 24 24 | 25 25 | if res == True != False: -E712.py:25:11: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:25:11: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` | 23 | pass 24 | @@ -206,7 +206,7 @@ E712.py:25:11: E712 [**] Comparison to `True` should be `cond is True` or `if co 27 27 | 28 28 | if(True) == TrueElement or x == TrueElement: -E712.py:25:19: E712 [**] Comparison to `False` should be `cond is not False` or `if cond:` +E712.py:25:19: E712 [*] Comparison to `False` should be `cond is not False` or `if cond:` | 23 | pass 24 | @@ -226,7 +226,7 @@ E712.py:25:19: E712 [**] Comparison to `False` should be `cond is not False` or 27 27 | 28 28 | if(True) == TrueElement or x == TrueElement: -E712.py:28:4: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:28:4: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` | 26 | pass 27 | @@ -246,7 +246,7 @@ E712.py:28:4: E712 [**] Comparison to `True` should be `cond is True` or `if con 30 30 | 31 31 | if (yield i) == True: -E712.py:31:17: E712 [**] Comparison to `True` should be `cond is True` or `if cond:` +E712.py:31:17: E712 [*] Comparison to `True` should be `cond is True` or `if cond:` | 29 | pass 30 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap index 4bc66847d9620d..b8456517e9faf5 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E731_E731.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E731.py:3:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:3:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 1 | def scope(): 2 | # E731 @@ -20,7 +20,7 @@ E731.py:3:5: E731 [**] Do not assign a `lambda` expression, use a `def` 5 6 | 6 7 | def scope(): -E731.py:8:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:8:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 6 | def scope(): 7 | # E731 @@ -40,7 +40,7 @@ E731.py:8:5: E731 [**] Do not assign a `lambda` expression, use a `def` 10 11 | 11 12 | def scope(): -E731.py:14:9: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:14:9: E731 [*] Do not assign a `lambda` expression, use a `def` | 12 | # E731 13 | while False: @@ -60,7 +60,7 @@ E731.py:14:9: E731 [**] Do not assign a `lambda` expression, use a `def` 16 17 | 17 18 | def scope(): -E731.py:19:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:19:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 17 | def scope(): 18 | # E731 @@ -80,7 +80,7 @@ E731.py:19:5: E731 [**] Do not assign a `lambda` expression, use a `def` 21 22 | 22 23 | def scope(): -E731.py:24:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:24:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 22 | def scope(): 23 | # E731 @@ -182,7 +182,7 @@ E731.py:75:9: E731 Do not assign a `lambda` expression, use a `def` 77 78 | 78 79 | -E731.py:86:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:86:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 84 | # ParamSpec cannot be used in this context, so do not preserve the annotation. 85 | P = ParamSpec("P") @@ -202,7 +202,7 @@ E731.py:86:5: E731 [**] Do not assign a `lambda` expression, use a `def` 88 89 | 89 90 | def scope(): -E731.py:94:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:94:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 92 | from typing import Callable 93 | @@ -222,7 +222,7 @@ E731.py:94:5: E731 [**] Do not assign a `lambda` expression, use a `def` 96 97 | 97 98 | def scope(): -E731.py:102:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:102:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 100 | from typing import Callable 101 | @@ -242,7 +242,7 @@ E731.py:102:5: E731 [**] Do not assign a `lambda` expression, use a `def` 104 105 | 105 106 | def scope(): -E731.py:110:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:110:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 108 | from typing import Callable 109 | @@ -262,7 +262,7 @@ E731.py:110:5: E731 [**] Do not assign a `lambda` expression, use a `def` 112 113 | 113 114 | # Let's use the `Callable` type from `collections.abc` instead. -E731.py:119:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:119:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 117 | from collections.abc import Callable 118 | @@ -282,7 +282,7 @@ E731.py:119:5: E731 [**] Do not assign a `lambda` expression, use a `def` 121 122 | 122 123 | def scope(): -E731.py:127:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:127:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 125 | from collections.abc import Callable 126 | @@ -302,7 +302,7 @@ E731.py:127:5: E731 [**] Do not assign a `lambda` expression, use a `def` 129 130 | 130 131 | def scope(): -E731.py:135:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:135:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 133 | from collections.abc import Callable 134 | @@ -362,7 +362,7 @@ E731.py:140:5: E731 Do not assign a `lambda` expression, use a `def` 142 143 | 143 144 | # Regression test for: https://github.com/astral-sh/ruff/issues/7141 -E731.py:147:5: E731 [**] Do not assign a `lambda` expression, use a `def` +E731.py:147:5: E731 [*] Do not assign a `lambda` expression, use a `def` | 145 | # E731 146 | diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap index 1a6d1eca9a4b49..e8a55ce2fbb6e2 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__constant_literals.snap @@ -106,7 +106,7 @@ constant_literals.py:12:4: F632 [*] Use `==` to compare constant literals 14 14 | if False == None: # E711, E712 (fix) 15 15 | pass -constant_literals.py:14:4: E712 [**] Comparison to `False` should be `cond is False` or `if not cond:` +constant_literals.py:14:4: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:` | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 | pass @@ -127,7 +127,7 @@ constant_literals.py:14:4: E712 [**] Comparison to `False` should be `cond is Fa 16 16 | if None == False: # E711, E712 (fix) 17 17 | pass -constant_literals.py:14:13: E711 [**] Comparison to `None` should be `cond is None` +constant_literals.py:14:13: E711 [*] Comparison to `None` should be `cond is None` | 12 | if False is "abc": # F632 (fix, but leaves behind unfixable E712) 13 | pass @@ -148,7 +148,7 @@ constant_literals.py:14:13: E711 [**] Comparison to `None` should be `cond is No 16 16 | if None == False: # E711, E712 (fix) 17 17 | pass -constant_literals.py:16:4: E711 [**] Comparison to `None` should be `cond is None` +constant_literals.py:16:4: E711 [*] Comparison to `None` should be `cond is None` | 14 | if False == None: # E711, E712 (fix) 15 | pass @@ -168,7 +168,7 @@ constant_literals.py:16:4: E711 [**] Comparison to `None` should be `cond is Non 18 18 | 19 19 | ### -constant_literals.py:16:12: E712 [**] Comparison to `False` should be `cond is False` or `if not cond:` +constant_literals.py:16:12: E712 [*] Comparison to `False` should be `cond is False` or `if not cond:` | 14 | if False == None: # E711, E712 (fix) 15 | pass diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap index 20568a3cc22d32..2e9ab57a982b68 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D.py:129:5: D200 [**] One-line docstring should fit on one line +D.py:129:5: D200 [*] One-line docstring should fit on one line | 127 | @expect('D212: Multi-line docstring summary should start at the first line') 128 | def asdlkfasd(): @@ -25,7 +25,7 @@ D.py:129:5: D200 [**] One-line docstring should fit on one line 133 131 | 134 132 | @expect('D201: No blank lines allowed before function docstring (found 1)') -D.py:597:5: D200 [**] One-line docstring should fit on one line +D.py:597:5: D200 [*] One-line docstring should fit on one line | 595 | @expect('D212: Multi-line docstring summary should start at the first line') 596 | def one_liner(): @@ -49,7 +49,7 @@ D.py:597:5: D200 [**] One-line docstring should fit on one line 601 599 | 602 600 | @expect('D200: One-line docstring should fit on one line with quotes ' -D.py:606:5: D200 [**] One-line docstring should fit on one line +D.py:606:5: D200 [*] One-line docstring should fit on one line | 604 | @expect('D212: Multi-line docstring summary should start at the first line') 605 | def one_liner(): diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap index bcbf0c4182f3ef..d4f68ce602e277 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D200_D200.py.snap @@ -11,7 +11,7 @@ D200.py:2:5: D200 One-line docstring should fit on one line | = help: Reformat to one line -D200.py:7:5: D200 [**] One-line docstring should fit on one line +D200.py:7:5: D200 [*] One-line docstring should fit on one line | 6 | def func(): 7 | """\\ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap index ba5be6e1cb6bb2..7d0eafb11dffba 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D.py:355:5: D400 [**] First line should end with a period +D.py:355:5: D400 [*] First line should end with a period | 353 | "or exclamation point (not 'y')") 354 | def lwnlkjl(): @@ -20,7 +20,7 @@ D.py:355:5: D400 [**] First line should end with a period 357 357 | 358 358 | @expect("D401: First line should be in imperative mood " -D.py:406:25: D400 [**] First line should end with a period +D.py:406:25: D400 [*] First line should end with a period | 404 | @expect("D415: First line should end with a period, question mark," 405 | " or exclamation point (not 'r')") @@ -39,7 +39,7 @@ D.py:406:25: D400 [**] First line should end with a period 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 -D.py:410:5: D400 [**] First line should end with a period +D.py:410:5: D400 [*] First line should end with a period | 409 | def ignored_decorator(func): # noqa: D400,D401,D415 410 | """Runs something""" @@ -59,7 +59,7 @@ D.py:410:5: D400 [**] First line should end with a period 412 412 | pass 413 413 | -D.py:416:5: D400 [**] First line should end with a period +D.py:416:5: D400 [*] First line should end with a period | 415 | def decorator_for_test(func): # noqa: D400,D401,D415 416 | """Runs something""" @@ -79,7 +79,7 @@ D.py:416:5: D400 [**] First line should end with a period 418 418 | pass 419 419 | -D.py:422:35: D400 [**] First line should end with a period +D.py:422:35: D400 [*] First line should end with a period | 421 | @ignored_decorator 422 | def oneliner_ignored_decorator(): """One liner""" @@ -97,7 +97,7 @@ D.py:422:35: D400 [**] First line should end with a period 424 424 | 425 425 | @decorator_for_test -D.py:429:49: D400 [**] First line should end with a period +D.py:429:49: D400 [*] First line should end with a period | 427 | @expect("D415: First line should end with a period, question mark," 428 | " or exclamation point (not 'r')") @@ -116,7 +116,7 @@ D.py:429:49: D400 [**] First line should end with a period 431 431 | 432 432 | @decorator_for_test -D.py:470:5: D400 [**] First line should end with a period +D.py:470:5: D400 [*] First line should end with a period | 468 | "or exclamation point (not 'g')") 469 | def docstring_bad(): @@ -136,7 +136,7 @@ D.py:470:5: D400 [**] First line should end with a period 472 472 | 473 473 | -D.py:475:5: D400 [**] First line should end with a period +D.py:475:5: D400 [*] First line should end with a period | 474 | def docstring_bad_ignore_all(): # noqa 475 | """Runs something""" @@ -155,7 +155,7 @@ D.py:475:5: D400 [**] First line should end with a period 477 477 | 478 478 | -D.py:480:5: D400 [**] First line should end with a period +D.py:480:5: D400 [*] First line should end with a period | 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 480 | """Runs something""" @@ -174,7 +174,7 @@ D.py:480:5: D400 [**] First line should end with a period 482 482 | 483 483 | -D.py:487:5: D400 [**] First line should end with a period +D.py:487:5: D400 [*] First line should end with a period | 485 | "(perhaps 'Run', not 'Runs')") 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -194,7 +194,7 @@ D.py:487:5: D400 [**] First line should end with a period 489 489 | 490 490 | -D.py:514:5: D400 [**] First line should end with a period +D.py:514:5: D400 [*] First line should end with a period | 513 | def valid_google_string(): # noqa: D400 514 | """Test a valid something!""" @@ -212,7 +212,7 @@ D.py:514:5: D400 [**] First line should end with a period 516 516 | 517 517 | @expect("D415: First line should end with a period, question mark, " -D.py:520:5: D400 [**] First line should end with a period +D.py:520:5: D400 [*] First line should end with a period | 518 | "or exclamation point (not 'g')") 519 | def bad_google_string(): # noqa: D400 @@ -231,7 +231,7 @@ D.py:520:5: D400 [**] First line should end with a period 522 522 | 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class -D.py:581:5: D400 [**] First line should end with a period +D.py:581:5: D400 [*] First line should end with a period | 579 | "or exclamation point (not '\"')") 580 | def endswith_quote(): @@ -250,7 +250,7 @@ D.py:581:5: D400 [**] First line should end with a period 583 583 | 584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' -D.py:615:5: D400 [**] First line should end with a period +D.py:615:5: D400 [*] First line should end with a period | 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 | def one_liner(): @@ -272,7 +272,7 @@ D.py:615:5: D400 [**] First line should end with a period 617 617 | """ 618 618 | -D.py:639:17: D400 [**] First line should end with a period +D.py:639:17: D400 [*] First line should end with a period | 639 | class SameLine: """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D400 @@ -291,7 +291,7 @@ D.py:639:17: D400 [**] First line should end with a period 641 641 | def same_line(): """This is a docstring on the same line""" 642 642 | -D.py:641:18: D400 [**] First line should end with a period +D.py:641:18: D400 [*] First line should end with a period | 639 | class SameLine: """This is a docstring on the same line""" 640 | @@ -310,7 +310,7 @@ D.py:641:18: D400 [**] First line should end with a period 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): -D.py:664:5: D400 [**] First line should end with a period +D.py:664:5: D400 [*] First line should end with a period | 663 | def newline_after_closing_quote(self): 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap index 0bb03df8de9187..4404e556416780 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D400_D400.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D400.py:2:5: D400 [**] First line should end with a period +D400.py:2:5: D400 [*] First line should end with a period | 1 | def f(): 2 | "Here's a line without a period" @@ -18,7 +18,7 @@ D400.py:2:5: D400 [**] First line should end with a period 4 4 | 5 5 | -D400.py:7:5: D400 [**] First line should end with a period +D400.py:7:5: D400 [*] First line should end with a period | 6 | def f(): 7 | """Here's a line without a period""" @@ -37,7 +37,7 @@ D400.py:7:5: D400 [**] First line should end with a period 9 9 | 10 10 | -D400.py:12:5: D400 [**] First line should end with a period +D400.py:12:5: D400 [*] First line should end with a period | 11 | def f(): 12 | """ @@ -60,7 +60,7 @@ D400.py:12:5: D400 [**] First line should end with a period 16 16 | ... 17 17 | -D400.py:20:5: D400 [**] First line should end with a period +D400.py:20:5: D400 [*] First line should end with a period | 19 | def f(): 20 | """Here's a line without a period""" @@ -79,7 +79,7 @@ D400.py:20:5: D400 [**] First line should end with a period 22 22 | 23 23 | -D400.py:25:5: D400 [**] First line should end with a period +D400.py:25:5: D400 [*] First line should end with a period | 24 | def f(): 25 | """ @@ -101,7 +101,7 @@ D400.py:25:5: D400 [**] First line should end with a period 29 29 | 30 30 | -D400.py:32:5: D400 [**] First line should end with a period +D400.py:32:5: D400 [*] First line should end with a period | 31 | def f(): 32 | """ @@ -123,7 +123,7 @@ D400.py:32:5: D400 [**] First line should end with a period 36 36 | 37 37 | -D400.py:39:5: D400 [**] First line should end with a period +D400.py:39:5: D400 [*] First line should end with a period | 38 | def f(): 39 | r"Here's a line without a period" @@ -142,7 +142,7 @@ D400.py:39:5: D400 [**] First line should end with a period 41 41 | 42 42 | -D400.py:44:5: D400 [**] First line should end with a period +D400.py:44:5: D400 [*] First line should end with a period | 43 | def f(): 44 | r"""Here's a line without a period""" @@ -161,7 +161,7 @@ D400.py:44:5: D400 [**] First line should end with a period 46 46 | 47 47 | -D400.py:49:5: D400 [**] First line should end with a period +D400.py:49:5: D400 [*] First line should end with a period | 48 | def f(): 49 | r""" @@ -184,7 +184,7 @@ D400.py:49:5: D400 [**] First line should end with a period 53 53 | ... 54 54 | -D400.py:57:5: D400 [**] First line should end with a period +D400.py:57:5: D400 [*] First line should end with a period | 56 | def f(): 57 | r"""Here's a line without a period""" @@ -203,7 +203,7 @@ D400.py:57:5: D400 [**] First line should end with a period 59 59 | 60 60 | -D400.py:62:5: D400 [**] First line should end with a period +D400.py:62:5: D400 [*] First line should end with a period | 61 | def f(): 62 | r""" @@ -225,7 +225,7 @@ D400.py:62:5: D400 [**] First line should end with a period 66 66 | 67 67 | -D400.py:69:5: D400 [**] First line should end with a period +D400.py:69:5: D400 [*] First line should end with a period | 68 | def f(): 69 | r""" diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap index 4cac0b7d927fa4..3bdc949e58ea59 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D415_D.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D.py:355:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:355:5: D415 [*] First line should end with a period, question mark, or exclamation point | 353 | "or exclamation point (not 'y')") 354 | def lwnlkjl(): @@ -20,7 +20,7 @@ D.py:355:5: D415 [**] First line should end with a period, question mark, or exc 357 357 | 358 358 | @expect("D401: First line should be in imperative mood " -D.py:406:25: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:406:25: D415 [*] First line should end with a period, question mark, or exclamation point | 404 | @expect("D415: First line should end with a period, question mark," 405 | " or exclamation point (not 'r')") @@ -39,7 +39,7 @@ D.py:406:25: D415 [**] First line should end with a period, question mark, or ex 408 408 | 409 409 | def ignored_decorator(func): # noqa: D400,D401,D415 -D.py:410:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:410:5: D415 [*] First line should end with a period, question mark, or exclamation point | 409 | def ignored_decorator(func): # noqa: D400,D401,D415 410 | """Runs something""" @@ -59,7 +59,7 @@ D.py:410:5: D415 [**] First line should end with a period, question mark, or exc 412 412 | pass 413 413 | -D.py:416:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:416:5: D415 [*] First line should end with a period, question mark, or exclamation point | 415 | def decorator_for_test(func): # noqa: D400,D401,D415 416 | """Runs something""" @@ -79,7 +79,7 @@ D.py:416:5: D415 [**] First line should end with a period, question mark, or exc 418 418 | pass 419 419 | -D.py:422:35: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:422:35: D415 [*] First line should end with a period, question mark, or exclamation point | 421 | @ignored_decorator 422 | def oneliner_ignored_decorator(): """One liner""" @@ -97,7 +97,7 @@ D.py:422:35: D415 [**] First line should end with a period, question mark, or ex 424 424 | 425 425 | @decorator_for_test -D.py:429:49: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:429:49: D415 [*] First line should end with a period, question mark, or exclamation point | 427 | @expect("D415: First line should end with a period, question mark," 428 | " or exclamation point (not 'r')") @@ -116,7 +116,7 @@ D.py:429:49: D415 [**] First line should end with a period, question mark, or ex 431 431 | 432 432 | @decorator_for_test -D.py:470:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:470:5: D415 [*] First line should end with a period, question mark, or exclamation point | 468 | "or exclamation point (not 'g')") 469 | def docstring_bad(): @@ -136,7 +136,7 @@ D.py:470:5: D415 [**] First line should end with a period, question mark, or exc 472 472 | 473 473 | -D.py:475:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:475:5: D415 [*] First line should end with a period, question mark, or exclamation point | 474 | def docstring_bad_ignore_all(): # noqa 475 | """Runs something""" @@ -155,7 +155,7 @@ D.py:475:5: D415 [**] First line should end with a period, question mark, or exc 477 477 | 478 478 | -D.py:480:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:480:5: D415 [*] First line should end with a period, question mark, or exclamation point | 479 | def docstring_bad_ignore_one(): # noqa: D400,D401,D415 480 | """Runs something""" @@ -174,7 +174,7 @@ D.py:480:5: D415 [**] First line should end with a period, question mark, or exc 482 482 | 483 483 | -D.py:487:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:487:5: D415 [*] First line should end with a period, question mark, or exclamation point | 485 | "(perhaps 'Run', not 'Runs')") 486 | def docstring_ignore_some_violations_but_catch_D401(): # noqa: E501,D400,D415 @@ -194,7 +194,7 @@ D.py:487:5: D415 [**] First line should end with a period, question mark, or exc 489 489 | 490 490 | -D.py:520:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:520:5: D415 [*] First line should end with a period, question mark, or exclamation point | 518 | "or exclamation point (not 'g')") 519 | def bad_google_string(): # noqa: D400 @@ -213,7 +213,7 @@ D.py:520:5: D415 [**] First line should end with a period, question mark, or exc 522 522 | 523 523 | # This is reproducing a bug where AttributeError is raised when parsing class -D.py:581:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:581:5: D415 [*] First line should end with a period, question mark, or exclamation point | 579 | "or exclamation point (not '\"')") 580 | def endswith_quote(): @@ -232,7 +232,7 @@ D.py:581:5: D415 [**] First line should end with a period, question mark, or exc 583 583 | 584 584 | @expect('D209: Multi-line docstring closing quotes should be on a separate ' -D.py:615:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:615:5: D415 [*] First line should end with a period, question mark, or exclamation point | 613 | @expect('D212: Multi-line docstring summary should start at the first line') 614 | def one_liner(): @@ -254,7 +254,7 @@ D.py:615:5: D415 [**] First line should end with a period, question mark, or exc 617 617 | """ 618 618 | -D.py:639:17: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:639:17: D415 [*] First line should end with a period, question mark, or exclamation point | 639 | class SameLine: """This is a docstring on the same line""" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D415 @@ -273,7 +273,7 @@ D.py:639:17: D415 [**] First line should end with a period, question mark, or ex 641 641 | def same_line(): """This is a docstring on the same line""" 642 642 | -D.py:641:18: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:641:18: D415 [*] First line should end with a period, question mark, or exclamation point | 639 | class SameLine: """This is a docstring on the same line""" 640 | @@ -292,7 +292,7 @@ D.py:641:18: D415 [**] First line should end with a period, question mark, or ex 643 643 | 644 644 | def single_line_docstring_with_an_escaped_backslash(): -D.py:664:5: D415 [**] First line should end with a period, question mark, or exclamation point +D.py:664:5: D415 [*] First line should end with a period, question mark, or exclamation point | 663 | def newline_after_closing_quote(self): 664 | "We enforce a newline after the closing quote for a multi-line docstring \ diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap index e74aa5ad1045a3..17a4753d2b8818 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__d209_d400.snap @@ -18,7 +18,7 @@ D209_D400.py:2:5: D209 [*] Multi-line docstring closing quotes should be on a se 3 |+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua 4 |+ """ -D209_D400.py:2:5: D400 [**] First line should end with a period +D209_D400.py:2:5: D400 [*] First line should end with a period | 1 | def lorem(): 2 | """lorem ipsum dolor sit amet consectetur adipiscing elit diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap index 23c456dd6ae96a..f1d52d7d3430f6 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F601_F601.py.snap @@ -66,7 +66,7 @@ F601.py:17:5: F601 Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -F601.py:18:5: F601 [**] Dictionary key literal `"a"` repeated +F601.py:18:5: F601 [*] Dictionary key literal `"a"` repeated | 16 | "a": 2, 17 | "a": 3, @@ -107,7 +107,7 @@ F601.py:24:5: F601 Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -F601.py:25:5: F601 [**] Dictionary key literal `"a"` repeated +F601.py:25:5: F601 [*] Dictionary key literal `"a"` repeated | 23 | "a": 2, 24 | "a": 3, @@ -137,7 +137,7 @@ F601.py:26:5: F601 Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -F601.py:31:5: F601 [**] Dictionary key literal `"a"` repeated +F601.py:31:5: F601 [*] Dictionary key literal `"a"` repeated | 29 | x = { 30 | "a": 1, @@ -211,7 +211,7 @@ F601.py:43:5: F601 Dictionary key literal `"a"` repeated | = help: Remove repeated key literal `"a"` -F601.py:45:5: F601 [**] Dictionary key literal `"a"` repeated +F601.py:45:5: F601 [*] Dictionary key literal `"a"` repeated | 43 | "a": 3, 44 | a: 3, @@ -231,7 +231,7 @@ F601.py:45:5: F601 [**] Dictionary key literal `"a"` repeated 47 46 | } 48 47 | -F601.py:49:14: F601 [**] Dictionary key literal `"a"` repeated +F601.py:49:14: F601 [*] Dictionary key literal `"a"` repeated | 47 | } 48 | @@ -251,7 +251,7 @@ F601.py:49:14: F601 [**] Dictionary key literal `"a"` repeated 51 51 | 52 52 | x = { -F601.py:50:22: F601 [**] Dictionary key literal `"a"` repeated +F601.py:50:22: F601 [*] Dictionary key literal `"a"` repeated | 49 | x = {"a": 1, "a": 1} 50 | x = {"a": 1, "b": 2, "a": 1} @@ -281,7 +281,7 @@ F601.py:54:5: F601 Dictionary key literal `('a', 'b')` repeated | = help: Remove repeated key literal `('a', 'b')` -F601.py:58:19: F601 [**] Dictionary key literal `"x"` repeated +F601.py:58:19: F601 [*] Dictionary key literal `"x"` repeated | 57 | # Regression test for: https://github.com/astral-sh/ruff/issues/4897 58 | t={"x":"test123", "x":("test123")} @@ -300,7 +300,7 @@ F601.py:58:19: F601 [**] Dictionary key literal `"x"` repeated 59 59 | 60 60 | t={"x":("test123"), "x":"test123"} -F601.py:60:21: F601 [**] Dictionary key literal `"x"` repeated +F601.py:60:21: F601 [*] Dictionary key literal `"x"` repeated | 58 | t={"x":"test123", "x":("test123")} 59 | diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap index f166f2a5e5c0a8..378346592ac378 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F602_F602.py.snap @@ -34,7 +34,7 @@ F602.py:12:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:13:5: F602 [**] Dictionary key `a` repeated +F602.py:13:5: F602 [*] Dictionary key `a` repeated | 11 | a: 2, 12 | a: 3, @@ -75,7 +75,7 @@ F602.py:19:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:20:5: F602 [**] Dictionary key `a` repeated +F602.py:20:5: F602 [*] Dictionary key `a` repeated | 18 | a: 2, 19 | a: 3, @@ -105,7 +105,7 @@ F602.py:21:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:26:5: F602 [**] Dictionary key `a` repeated +F602.py:26:5: F602 [*] Dictionary key `a` repeated | 24 | x = { 25 | a: 1, @@ -157,7 +157,7 @@ F602.py:29:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:35:5: F602 [**] Dictionary key `a` repeated +F602.py:35:5: F602 [*] Dictionary key `a` repeated | 33 | a: 1, 34 | "a": 1, @@ -209,7 +209,7 @@ F602.py:41:5: F602 Dictionary key `a` repeated | = help: Remove repeated key `a` -F602.py:44:12: F602 [**] Dictionary key `a` repeated +F602.py:44:12: F602 [*] Dictionary key `a` repeated | 42 | } 43 | @@ -227,7 +227,7 @@ F602.py:44:12: F602 [**] Dictionary key `a` repeated 44 |+x = {a: 1} 45 45 | x = {a: 1, b: 2, a: 1} -F602.py:45:18: F602 [**] Dictionary key `a` repeated +F602.py:45:18: F602 [*] Dictionary key `a` repeated | 44 | x = {a: 1, a: 1} 45 | x = {a: 1, b: 2, a: 1} diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap index f09809aa5b7350..e3f2fc6d0237ef 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_0.py.snap @@ -20,7 +20,7 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used 5 5 | 6 6 | -F841_0.py:16:5: F841 [**] Local variable `z` is assigned to but never used +F841_0.py:16:5: F841 [*] Local variable `z` is assigned to but never used | 14 | x = 1 15 | y = 2 @@ -39,7 +39,7 @@ F841_0.py:16:5: F841 [**] Local variable `z` is assigned to but never used 18 18 | 19 19 | def f(): -F841_0.py:20:5: F841 [**] Local variable `foo` is assigned to but never used +F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | 19 | def f(): 20 | foo = (1, 2) @@ -79,7 +79,7 @@ F841_0.py:21:9: F841 Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -F841_0.py:26:14: F841 [**] Local variable `baz` is assigned to but never used +F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | 24 | (c, d) = bar 25 | @@ -98,7 +98,7 @@ F841_0.py:26:14: F841 [**] Local variable `baz` is assigned to but never used 28 28 | 29 29 | def f(): -F841_0.py:51:9: F841 [**] Local variable `b` is assigned to but never used +F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | 49 | def c(): 50 | # F841 @@ -119,7 +119,7 @@ F841_0.py:51:9: F841 [**] Local variable `b` is assigned to but never used 53 53 | def d(): 54 54 | nonlocal b -F841_0.py:79:26: F841 [**] Local variable `my_file` is assigned to but never used +F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | 78 | def f(): 79 | with open("file") as my_file, open("") as ((this, that)): @@ -138,7 +138,7 @@ F841_0.py:79:26: F841 [**] Local variable `my_file` is assigned to but never use 81 81 | 82 82 | -F841_0.py:85:25: F841 [**] Local variable `my_file` is assigned to but never used +F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | 83 | def f(): 84 | with ( @@ -159,7 +159,7 @@ F841_0.py:85:25: F841 [**] Local variable `my_file` is assigned to but never use 87 87 | ): 88 88 | print("hello") -F841_0.py:102:5: F841 [**] Local variable `msg3` is assigned to but never used +F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | 100 | msg1 = "Hello, world!" 101 | msg2 = "Hello, world!" @@ -179,7 +179,7 @@ F841_0.py:102:5: F841 [**] Local variable `msg3` is assigned to but never used 104 103 | case 1: 105 104 | print(msg1) -F841_0.py:115:5: F841 [**] Local variable `Baz` is assigned to but never used +F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | 113 | Foo = enum.Enum("Foo", "A B") 114 | Bar = enum.Enum("Bar", "A B") diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap index 835d65f1c1517a..21aec0a0e51aeb 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_1.py.snap @@ -17,7 +17,7 @@ F841_1.py:6:8: F841 Local variable `y` is assigned to but never used | = help: Remove assignment to unused variable `y` -F841_1.py:16:14: F841 [**] Local variable `coords` is assigned to but never used +F841_1.py:16:14: F841 [*] Local variable `coords` is assigned to but never used | 15 | def f(): 16 | (x, y) = coords = 1, 2 # this triggers F841 on coords @@ -35,7 +35,7 @@ F841_1.py:16:14: F841 [**] Local variable `coords` is assigned to but never used 18 18 | 19 19 | def f(): -F841_1.py:20:5: F841 [**] Local variable `coords` is assigned to but never used +F841_1.py:20:5: F841 [*] Local variable `coords` is assigned to but never used | 19 | def f(): 20 | coords = (x, y) = 1, 2 # this triggers F841 on coords diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap index 37d9cbaec3b74a..7527c4e2cd8462 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F841_F841_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyflakes/mod.rs --- -F841_3.py:5:5: F841 [**] Local variable `x` is assigned to but never used +F841_3.py:5:5: F841 [*] Local variable `x` is assigned to but never used | 4 | def f(): 5 | x = 1 @@ -19,7 +19,7 @@ F841_3.py:5:5: F841 [**] Local variable `x` is assigned to but never used 7 6 | 8 7 | z = 3 -F841_3.py:6:5: F841 [**] Local variable `y` is assigned to but never used +F841_3.py:6:5: F841 [*] Local variable `y` is assigned to but never used | 4 | def f(): 5 | x = 1 @@ -39,7 +39,7 @@ F841_3.py:6:5: F841 [**] Local variable `y` is assigned to but never used 8 7 | z = 3 9 8 | print(z) -F841_3.py:13:5: F841 [**] Local variable `x` is assigned to but never used +F841_3.py:13:5: F841 [*] Local variable `x` is assigned to but never used | 12 | def f(): 13 | x: int = 1 @@ -57,7 +57,7 @@ F841_3.py:13:5: F841 [**] Local variable `x` is assigned to but never used 15 14 | 16 15 | z: int = 3 -F841_3.py:14:5: F841 [**] Local variable `y` is assigned to but never used +F841_3.py:14:5: F841 [*] Local variable `y` is assigned to but never used | 12 | def f(): 13 | x: int = 1 @@ -77,7 +77,7 @@ F841_3.py:14:5: F841 [**] Local variable `y` is assigned to but never used 16 15 | z: int = 3 17 16 | print(z) -F841_3.py:21:19: F841 [**] Local variable `x1` is assigned to but never used +F841_3.py:21:19: F841 [*] Local variable `x1` is assigned to but never used | 20 | def f(): 21 | with foo() as x1: @@ -96,7 +96,7 @@ F841_3.py:21:19: F841 [**] Local variable `x1` is assigned to but never used 23 23 | 24 24 | with foo() as (x2, y2): -F841_3.py:27:20: F841 [**] Local variable `x3` is assigned to but never used +F841_3.py:27:20: F841 [*] Local variable `x3` is assigned to but never used | 25 | pass 26 | @@ -116,7 +116,7 @@ F841_3.py:27:20: F841 [**] Local variable `x3` is assigned to but never used 29 29 | 30 30 | -F841_3.py:27:33: F841 [**] Local variable `y3` is assigned to but never used +F841_3.py:27:33: F841 [*] Local variable `y3` is assigned to but never used | 25 | pass 26 | @@ -136,7 +136,7 @@ F841_3.py:27:33: F841 [**] Local variable `y3` is assigned to but never used 29 29 | 30 30 | -F841_3.py:27:46: F841 [**] Local variable `z3` is assigned to but never used +F841_3.py:27:46: F841 [*] Local variable `z3` is assigned to but never used | 25 | pass 26 | @@ -176,7 +176,7 @@ F841_3.py:32:10: F841 Local variable `y1` is assigned to but never used | = help: Remove assignment to unused variable `y1` -F841_3.py:33:16: F841 [**] Local variable `coords2` is assigned to but never used +F841_3.py:33:16: F841 [*] Local variable `coords2` is assigned to but never used | 31 | def f(): 32 | (x1, y1) = (1, 2) @@ -196,7 +196,7 @@ F841_3.py:33:16: F841 [**] Local variable `coords2` is assigned to but never use 35 35 | 36 36 | -F841_3.py:34:5: F841 [**] Local variable `coords3` is assigned to but never used +F841_3.py:34:5: F841 [*] Local variable `coords3` is assigned to but never used | 32 | (x1, y1) = (1, 2) 33 | (x2, y2) = coords2 = (1, 2) @@ -255,7 +255,7 @@ F841_3.py:45:47: F841 [*] Local variable `x2` is assigned to but never used 47 47 | 48 48 | -F841_3.py:50:5: F841 [**] Local variable `x` is assigned to but never used +F841_3.py:50:5: F841 [*] Local variable `x` is assigned to but never used | 49 | def f(a, b): 50 | x = ( @@ -275,7 +275,7 @@ F841_3.py:50:5: F841 [**] Local variable `x` is assigned to but never used 52 52 | if a is not None 53 53 | else b -F841_3.py:56:5: F841 [**] Local variable `y` is assigned to but never used +F841_3.py:56:5: F841 [*] Local variable `y` is assigned to but never used | 54 | ) 55 | @@ -296,7 +296,7 @@ F841_3.py:56:5: F841 [**] Local variable `y` is assigned to but never used 59 58 | 60 59 | def f(a, b): -F841_3.py:61:5: F841 [**] Local variable `x` is assigned to but never used +F841_3.py:61:5: F841 [*] Local variable `x` is assigned to but never used | 60 | def f(a, b): 61 | x = ( @@ -319,7 +319,7 @@ F841_3.py:61:5: F841 [**] Local variable `x` is assigned to but never used 67 62 | y = \ 68 63 | a if a is not None else b -F841_3.py:67:5: F841 [**] Local variable `y` is assigned to but never used +F841_3.py:67:5: F841 [*] Local variable `y` is assigned to but never used | 65 | ) 66 | @@ -339,7 +339,7 @@ F841_3.py:67:5: F841 [**] Local variable `y` is assigned to but never used 70 68 | 71 69 | def f(): -F841_3.py:72:24: F841 [**] Local variable `cm` is assigned to but never used +F841_3.py:72:24: F841 [*] Local variable `cm` is assigned to but never used | 71 | def f(): 72 | with Nested(m) as (cm): @@ -358,7 +358,7 @@ F841_3.py:72:24: F841 [**] Local variable `cm` is assigned to but never used 74 74 | 75 75 | -F841_3.py:77:25: F841 [**] Local variable `cm` is assigned to but never used +F841_3.py:77:25: F841 [*] Local variable `cm` is assigned to but never used | 76 | def f(): 77 | with (Nested(m) as (cm),): @@ -377,7 +377,7 @@ F841_3.py:77:25: F841 [**] Local variable `cm` is assigned to but never used 79 79 | 80 80 | -F841_3.py:87:26: F841 [**] Local variable `cm` is assigned to but never used +F841_3.py:87:26: F841 [*] Local variable `cm` is assigned to but never used | 86 | def f(): 87 | with (Nested(m)) as (cm): @@ -396,7 +396,7 @@ F841_3.py:87:26: F841 [**] Local variable `cm` is assigned to but never used 89 89 | 90 90 | -F841_3.py:92:5: F841 [**] Local variable `toplevel` is assigned to but never used +F841_3.py:92:5: F841 [*] Local variable `toplevel` is assigned to but never used | 91 | def f(): 92 | toplevel = tt = lexer.get_token() @@ -416,7 +416,7 @@ F841_3.py:92:5: F841 [**] Local variable `toplevel` is assigned to but never use 94 94 | break 95 95 | -F841_3.py:98:5: F841 [**] Local variable `toplevel` is assigned to but never used +F841_3.py:98:5: F841 [*] Local variable `toplevel` is assigned to but never used | 97 | def f(): 98 | toplevel = tt = lexer.get_token() @@ -434,7 +434,7 @@ F841_3.py:98:5: F841 [**] Local variable `toplevel` is assigned to but never use 100 100 | 101 101 | def f(): -F841_3.py:98:16: F841 [**] Local variable `tt` is assigned to but never used +F841_3.py:98:16: F841 [*] Local variable `tt` is assigned to but never used | 97 | def f(): 98 | toplevel = tt = lexer.get_token() @@ -452,7 +452,7 @@ F841_3.py:98:16: F841 [**] Local variable `tt` is assigned to but never used 100 100 | 101 101 | def f(): -F841_3.py:102:5: F841 [**] Local variable `toplevel` is assigned to but never used +F841_3.py:102:5: F841 [*] Local variable `toplevel` is assigned to but never used | 101 | def f(): 102 | toplevel = (a, b) = lexer.get_token() @@ -470,7 +470,7 @@ F841_3.py:102:5: F841 [**] Local variable `toplevel` is assigned to but never us 104 104 | 105 105 | def f(): -F841_3.py:106:14: F841 [**] Local variable `toplevel` is assigned to but never used +F841_3.py:106:14: F841 [*] Local variable `toplevel` is assigned to but never used | 105 | def f(): 106 | (a, b) = toplevel = lexer.get_token() @@ -488,7 +488,7 @@ F841_3.py:106:14: F841 [**] Local variable `toplevel` is assigned to but never u 108 108 | 109 109 | def f(): -F841_3.py:110:5: F841 [**] Local variable `toplevel` is assigned to but never used +F841_3.py:110:5: F841 [*] Local variable `toplevel` is assigned to but never used | 109 | def f(): 110 | toplevel = tt = 1 @@ -506,7 +506,7 @@ F841_3.py:110:5: F841 [**] Local variable `toplevel` is assigned to but never us 112 112 | 113 113 | def f(provided: int) -> int: -F841_3.py:110:16: F841 [**] Local variable `tt` is assigned to but never used +F841_3.py:110:16: F841 [*] Local variable `tt` is assigned to but never used | 109 | def f(): 110 | toplevel = tt = 1 @@ -604,7 +604,7 @@ F841_3.py:155:17: F841 [*] Local variable `e` is assigned to but never used 157 157 | 158 158 | -F841_3.py:160:5: F841 [**] Local variable `x` is assigned to but never used +F841_3.py:160:5: F841 [*] Local variable `x` is assigned to but never used | 159 | def f(): 160 | x = 1 @@ -622,7 +622,7 @@ F841_3.py:160:5: F841 [**] Local variable `x` is assigned to but never used 162 161 | 163 162 | -F841_3.py:161:5: F841 [**] Local variable `y` is assigned to but never used +F841_3.py:161:5: F841 [*] Local variable `y` is assigned to but never used | 159 | def f(): 160 | x = 1 @@ -640,7 +640,7 @@ F841_3.py:161:5: F841 [**] Local variable `y` is assigned to but never used 163 162 | 164 163 | def f(): -F841_3.py:165:5: F841 [**] Local variable `x` is assigned to but never used +F841_3.py:165:5: F841 [*] Local variable `x` is assigned to but never used | 164 | def f(): 165 | x = 1 @@ -659,7 +659,7 @@ F841_3.py:165:5: F841 [**] Local variable `x` is assigned to but never used 167 166 | y = 2 168 167 | -F841_3.py:167:5: F841 [**] Local variable `y` is assigned to but never used +F841_3.py:167:5: F841 [*] Local variable `y` is assigned to but never used | 165 | x = 1 166 | @@ -677,7 +677,7 @@ F841_3.py:167:5: F841 [**] Local variable `y` is assigned to but never used 169 168 | 170 169 | def f(): -F841_3.py:173:6: F841 [**] Local variable `x` is assigned to but never used +F841_3.py:173:6: F841 [*] Local variable `x` is assigned to but never used | 171 | (x) = foo() 172 | ((x)) = foo() diff --git a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap index bb00f6126bc00d..c117fdff6e54dd 100644 --- a/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap +++ b/crates/ruff_linter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__f841_dummy_variable_rgx.snap @@ -20,7 +20,7 @@ F841_0.py:3:22: F841 [*] Local variable `e` is assigned to but never used 5 5 | 6 6 | -F841_0.py:20:5: F841 [**] Local variable `foo` is assigned to but never used +F841_0.py:20:5: F841 [*] Local variable `foo` is assigned to but never used | 19 | def f(): 20 | foo = (1, 2) @@ -60,7 +60,7 @@ F841_0.py:21:9: F841 Local variable `b` is assigned to but never used | = help: Remove assignment to unused variable `b` -F841_0.py:26:14: F841 [**] Local variable `baz` is assigned to but never used +F841_0.py:26:14: F841 [*] Local variable `baz` is assigned to but never used | 24 | (c, d) = bar 25 | @@ -79,7 +79,7 @@ F841_0.py:26:14: F841 [**] Local variable `baz` is assigned to but never used 28 28 | 29 29 | def f(): -F841_0.py:35:5: F841 [**] Local variable `_` is assigned to but never used +F841_0.py:35:5: F841 [*] Local variable `_` is assigned to but never used | 34 | def f(): 35 | _ = 1 @@ -98,7 +98,7 @@ F841_0.py:35:5: F841 [**] Local variable `_` is assigned to but never used 37 36 | _discarded = 1 38 37 | -F841_0.py:36:5: F841 [**] Local variable `__` is assigned to but never used +F841_0.py:36:5: F841 [*] Local variable `__` is assigned to but never used | 34 | def f(): 35 | _ = 1 @@ -117,7 +117,7 @@ F841_0.py:36:5: F841 [**] Local variable `__` is assigned to but never used 38 37 | 39 38 | -F841_0.py:37:5: F841 [**] Local variable `_discarded` is assigned to but never used +F841_0.py:37:5: F841 [*] Local variable `_discarded` is assigned to but never used | 35 | _ = 1 36 | __ = 1 @@ -135,7 +135,7 @@ F841_0.py:37:5: F841 [**] Local variable `_discarded` is assigned to but never u 39 38 | 40 39 | a = 1 -F841_0.py:51:9: F841 [**] Local variable `b` is assigned to but never used +F841_0.py:51:9: F841 [*] Local variable `b` is assigned to but never used | 49 | def c(): 50 | # F841 @@ -156,7 +156,7 @@ F841_0.py:51:9: F841 [**] Local variable `b` is assigned to but never used 53 53 | def d(): 54 54 | nonlocal b -F841_0.py:79:26: F841 [**] Local variable `my_file` is assigned to but never used +F841_0.py:79:26: F841 [*] Local variable `my_file` is assigned to but never used | 78 | def f(): 79 | with open("file") as my_file, open("") as ((this, that)): @@ -175,7 +175,7 @@ F841_0.py:79:26: F841 [**] Local variable `my_file` is assigned to but never use 81 81 | 82 82 | -F841_0.py:85:25: F841 [**] Local variable `my_file` is assigned to but never used +F841_0.py:85:25: F841 [*] Local variable `my_file` is assigned to but never used | 83 | def f(): 84 | with ( @@ -196,7 +196,7 @@ F841_0.py:85:25: F841 [**] Local variable `my_file` is assigned to but never use 87 87 | ): 88 88 | print("hello") -F841_0.py:102:5: F841 [**] Local variable `msg3` is assigned to but never used +F841_0.py:102:5: F841 [*] Local variable `msg3` is assigned to but never used | 100 | msg1 = "Hello, world!" 101 | msg2 = "Hello, world!" @@ -216,7 +216,7 @@ F841_0.py:102:5: F841 [**] Local variable `msg3` is assigned to but never used 104 103 | case 1: 105 104 | print(msg1) -F841_0.py:115:5: F841 [**] Local variable `Baz` is assigned to but never used +F841_0.py:115:5: F841 [*] Local variable `Baz` is assigned to but never used | 113 | Foo = enum.Enum("Foo", "A B") 114 | Bar = enum.Enum("Bar", "A B") diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap index 44a778a7b88a08..800e9671d8799e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLC0414_import_aliasing.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -import_aliasing.py:6:8: PLC0414 [**] Import alias does not rename original package +import_aliasing.py:6:8: PLC0414 [*] Import alias does not rename original package | 4 | # 2. consider-using-from-import 5 | @@ -22,7 +22,7 @@ import_aliasing.py:6:8: PLC0414 [**] Import alias does not rename original packa 8 8 | from collections import OrderedDict as o_dict 9 9 | import os.path as path # [consider-using-from-import] -import_aliasing.py:7:25: PLC0414 [**] Import alias does not rename original package +import_aliasing.py:7:25: PLC0414 [*] Import alias does not rename original package | 6 | import collections as collections # [useless-import-alias] 7 | from collections import OrderedDict as OrderedDict # [useless-import-alias] @@ -42,7 +42,7 @@ import_aliasing.py:7:25: PLC0414 [**] Import alias does not rename original pack 9 9 | import os.path as path # [consider-using-from-import] 10 10 | import os.path as p -import_aliasing.py:16:15: PLC0414 [**] Import alias does not rename original package +import_aliasing.py:16:15: PLC0414 [*] Import alias does not rename original package | 14 | import os as OS 15 | from sys import version @@ -63,7 +63,7 @@ import_aliasing.py:16:15: PLC0414 [**] Import alias does not rename original pac 18 18 | from . import bar 19 19 | from ..foo import bar as bar # [useless-import-alias] -import_aliasing.py:19:19: PLC0414 [**] Import alias does not rename original package +import_aliasing.py:19:19: PLC0414 [*] Import alias does not rename original package | 17 | from . import bar as Bar 18 | from . import bar @@ -84,7 +84,7 @@ import_aliasing.py:19:19: PLC0414 [**] Import alias does not rename original pac 21 21 | from ..foo.bar import foobar as anotherfoobar 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] -import_aliasing.py:20:23: PLC0414 [**] Import alias does not rename original package +import_aliasing.py:20:23: PLC0414 [*] Import alias does not rename original package | 18 | from . import bar 19 | from ..foo import bar as bar # [useless-import-alias] @@ -105,7 +105,7 @@ import_aliasing.py:20:23: PLC0414 [**] Import alias does not rename original pac 22 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] 23 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] -import_aliasing.py:22:15: PLC0414 [**] Import alias does not rename original package +import_aliasing.py:22:15: PLC0414 [*] Import alias does not rename original package | 20 | from ..foo.bar import foobar as foobar # [useless-import-alias] 21 | from ..foo.bar import foobar as anotherfoobar @@ -126,7 +126,7 @@ import_aliasing.py:22:15: PLC0414 [**] Import alias does not rename original pac 24 24 | from . import foo as bar, foo2 as bar2 25 25 | from foo.bar import foobar as foobar # [useless-import-alias] -import_aliasing.py:23:27: PLC0414 [**] Import alias does not rename original package +import_aliasing.py:23:27: PLC0414 [*] Import alias does not rename original package | 21 | from ..foo.bar import foobar as anotherfoobar 22 | from . import foo as foo, foo2 as bar2 # [useless-import-alias] @@ -147,7 +147,7 @@ import_aliasing.py:23:27: PLC0414 [**] Import alias does not rename original pac 25 25 | from foo.bar import foobar as foobar # [useless-import-alias] 26 26 | from foo.bar import foobar as foo -import_aliasing.py:25:21: PLC0414 [**] Import alias does not rename original package +import_aliasing.py:25:21: PLC0414 [*] Import alias does not rename original package | 23 | from . import foo as bar, foo2 as foo2 # [useless-import-alias] 24 | from . import foo as bar, foo2 as bar2 diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap index d794ebe58d6a1f..397b48cabc19a4 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_0.py:1:1: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_0.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | exit(0) | ^^^^ PLR1722 @@ -17,7 +17,7 @@ sys_exit_alias_0.py:1:1: PLR1722 [**] Use `sys.exit()` instead of `exit` 3 4 | 4 5 | -sys_exit_alias_0.py:2:1: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_0.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 1 | exit(0) 2 | quit(0) @@ -34,7 +34,7 @@ sys_exit_alias_0.py:2:1: PLR1722 [**] Use `sys.exit()` instead of `quit` 4 5 | 5 6 | def main(): -sys_exit_alias_0.py:6:5: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_0.py:6:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 5 | def main(): 6 | exit(2) @@ -54,7 +54,7 @@ sys_exit_alias_0.py:6:5: PLR1722 [**] Use `sys.exit()` instead of `exit` 7 |+ sys.exit(2) 7 8 | quit(2) -sys_exit_alias_0.py:7:5: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_0.py:7:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 5 | def main(): 6 | exit(2) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap index 1499b196df99e5..aa9c93714b984d 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_1.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_1.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | import sys 2 | @@ -20,7 +20,7 @@ sys_exit_alias_1.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -sys_exit_alias_1.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_1.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -38,7 +38,7 @@ sys_exit_alias_1.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -sys_exit_alias_1.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_1.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 7 | def main(): 8 | exit(1) @@ -57,7 +57,7 @@ sys_exit_alias_1.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` 10 10 | 11 11 | -sys_exit_alias_1.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_1.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap index fd65bba2841db8..0fd61d5d82d151 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_11.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_11.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_11.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | from sys import * 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap index 36e0562dd2a252..24108309b0394a 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_12.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_12.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_12.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | import os \ 2 | diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap index 7f4ed3ae677f13..18c4cb9aceb542 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_2.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_2.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | import sys as sys2 2 | @@ -20,7 +20,7 @@ sys_exit_alias_2.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -sys_exit_alias_2.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_2.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -38,7 +38,7 @@ sys_exit_alias_2.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -sys_exit_alias_2.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_2.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 7 | def main(): 8 | exit(1) @@ -55,7 +55,7 @@ sys_exit_alias_2.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` 8 |+ sys2.exit(1) 9 9 | quit(1) -sys_exit_alias_2.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_2.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap index c787537c00f6be..183ad4c91030d1 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_3.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_3.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -19,7 +19,7 @@ sys_exit_alias_3.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -sys_exit_alias_3.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_3.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap index 0492396b9e850e..8b17e1511902fd 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_4.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_4.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | from sys import exit as exit2 2 | @@ -20,7 +20,7 @@ sys_exit_alias_4.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` 5 5 | 6 6 | -sys_exit_alias_4.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_4.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -38,7 +38,7 @@ sys_exit_alias_4.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` 6 6 | 7 7 | def main(): -sys_exit_alias_4.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_4.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 7 | def main(): 8 | exit(1) @@ -55,7 +55,7 @@ sys_exit_alias_4.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` 8 |+ exit2(1) 9 9 | quit(1) -sys_exit_alias_4.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_4.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap index 0bd1350a3c8d51..80b8423a352d9e 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_5.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_5.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_5.py:3:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | from sys import * 2 | @@ -21,7 +21,7 @@ sys_exit_alias_5.py:3:1: PLR1722 [**] Use `sys.exit()` instead of `exit` 5 6 | 6 7 | -sys_exit_alias_5.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_5.py:4:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 3 | exit(0) 4 | quit(0) @@ -40,7 +40,7 @@ sys_exit_alias_5.py:4:1: PLR1722 [**] Use `sys.exit()` instead of `quit` 6 7 | 7 8 | def main(): -sys_exit_alias_5.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_5.py:8:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 7 | def main(): 8 | exit(1) @@ -62,7 +62,7 @@ sys_exit_alias_5.py:8:5: PLR1722 [**] Use `sys.exit()` instead of `exit` 9 |+ sys.exit(1) 9 10 | quit(1) -sys_exit_alias_5.py:9:5: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_5.py:9:5: PLR1722 [*] Use `sys.exit()` instead of `quit` | 7 | def main(): 8 | exit(1) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap index 48e652154f5d6d..b257b7b923dbaa 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_6.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_6.py:1:1: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_6.py:1:1: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | exit(0) | ^^^^ PLR1722 @@ -17,7 +17,7 @@ sys_exit_alias_6.py:1:1: PLR1722 [**] Use `sys.exit()` instead of `exit` 3 4 | 4 5 | -sys_exit_alias_6.py:2:1: PLR1722 [**] Use `sys.exit()` instead of `quit` +sys_exit_alias_6.py:2:1: PLR1722 [*] Use `sys.exit()` instead of `quit` | 1 | exit(0) 2 | quit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap index c2400160908aa5..5d64c2ee631939 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_7.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_7.py:2:5: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_7.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | def main(): 2 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap index d71599d72ccee4..fa796c091fa4bb 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_8.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_8.py:5:5: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_8.py:5:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 4 | def main(): 5 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap index 344032ff81c71c..99d5f3389fc3a1 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLR1722_sys_exit_alias_9.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -sys_exit_alias_9.py:2:5: PLR1722 [**] Use `sys.exit()` instead of `exit` +sys_exit_alias_9.py:2:5: PLR1722 [*] Use `sys.exit()` instead of `exit` | 1 | def main(): 2 | exit(0) diff --git a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap index 3bd813c3a11a50..268f805ab852bd 100644 --- a/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap +++ b/crates/ruff_linter/src/rules/pylint/snapshots/ruff_linter__rules__pylint__tests__PLW3301_nested_min_max.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pylint/mod.rs --- -nested_min_max.py:2:1: PLW3301 [**] Nested `min` calls can be flattened +nested_min_max.py:2:1: PLW3301 [*] Nested `min` calls can be flattened | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -19,7 +19,7 @@ nested_min_max.py:2:1: PLW3301 [**] Nested `min` calls can be flattened 4 4 | min(1, foo("a", "b"), min(3, 4)) 5 5 | min(1, max(2, 3)) -nested_min_max.py:3:1: PLW3301 [**] Nested `min` calls can be flattened +nested_min_max.py:3:1: PLW3301 [*] Nested `min` calls can be flattened | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -39,7 +39,7 @@ nested_min_max.py:3:1: PLW3301 [**] Nested `min` calls can be flattened 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) -nested_min_max.py:3:8: PLW3301 [**] Nested `min` calls can be flattened +nested_min_max.py:3:8: PLW3301 [*] Nested `min` calls can be flattened | 1 | min(1, 2, 3) 2 | min(1, min(2, 3)) @@ -59,7 +59,7 @@ nested_min_max.py:3:8: PLW3301 [**] Nested `min` calls can be flattened 5 5 | min(1, max(2, 3)) 6 6 | max(1, 2, 3) -nested_min_max.py:4:1: PLW3301 [**] Nested `min` calls can be flattened +nested_min_max.py:4:1: PLW3301 [*] Nested `min` calls can be flattened | 2 | min(1, min(2, 3)) 3 | min(1, min(2, min(3, 4))) @@ -80,7 +80,7 @@ nested_min_max.py:4:1: PLW3301 [**] Nested `min` calls can be flattened 6 6 | max(1, 2, 3) 7 7 | max(1, max(2, 3)) -nested_min_max.py:7:1: PLW3301 [**] Nested `max` calls can be flattened +nested_min_max.py:7:1: PLW3301 [*] Nested `max` calls can be flattened | 5 | min(1, max(2, 3)) 6 | max(1, 2, 3) @@ -101,7 +101,7 @@ nested_min_max.py:7:1: PLW3301 [**] Nested `max` calls can be flattened 9 9 | max(1, foo("a", "b"), max(3, 4)) 10 10 | -nested_min_max.py:8:1: PLW3301 [**] Nested `max` calls can be flattened +nested_min_max.py:8:1: PLW3301 [*] Nested `max` calls can be flattened | 6 | max(1, 2, 3) 7 | max(1, max(2, 3)) @@ -121,7 +121,7 @@ nested_min_max.py:8:1: PLW3301 [**] Nested `max` calls can be flattened 10 10 | 11 11 | # These should not trigger; we do not flag cases with keyword args. -nested_min_max.py:8:8: PLW3301 [**] Nested `max` calls can be flattened +nested_min_max.py:8:8: PLW3301 [*] Nested `max` calls can be flattened | 6 | max(1, 2, 3) 7 | max(1, max(2, 3)) @@ -141,7 +141,7 @@ nested_min_max.py:8:8: PLW3301 [**] Nested `max` calls can be flattened 10 10 | 11 11 | # These should not trigger; we do not flag cases with keyword args. -nested_min_max.py:9:1: PLW3301 [**] Nested `max` calls can be flattened +nested_min_max.py:9:1: PLW3301 [*] Nested `max` calls can be flattened | 7 | max(1, max(2, 3)) 8 | max(1, max(2, max(3, 4))) @@ -162,7 +162,7 @@ nested_min_max.py:9:1: PLW3301 [**] Nested `max` calls can be flattened 11 11 | # These should not trigger; we do not flag cases with keyword args. 12 12 | min(1, min(2, 3), key=test) -nested_min_max.py:15:1: PLW3301 [**] Nested `min` calls can be flattened +nested_min_max.py:15:1: PLW3301 [*] Nested `min` calls can be flattened | 13 | min(1, min(2, 3, key=test)) 14 | # This will still trigger, to merge the calls without keyword args. @@ -196,7 +196,7 @@ nested_min_max.py:18:1: PLW3301 Nested `min` calls can be flattened | = help: Flatten nested `min` calls -nested_min_max.py:24:1: PLW3301 [**] Nested `min` calls can be flattened +nested_min_max.py:24:1: PLW3301 [*] Nested `min` calls can be flattened | 23 | # Handle iterable expressions. 24 | min(1, min(a)) @@ -216,7 +216,7 @@ nested_min_max.py:24:1: PLW3301 [**] Nested `min` calls can be flattened 26 26 | max(1, max(a)) 27 27 | max(1, max(i for i in range(10))) -nested_min_max.py:25:1: PLW3301 [**] Nested `min` calls can be flattened +nested_min_max.py:25:1: PLW3301 [*] Nested `min` calls can be flattened | 23 | # Handle iterable expressions. 24 | min(1, min(a)) @@ -237,7 +237,7 @@ nested_min_max.py:25:1: PLW3301 [**] Nested `min` calls can be flattened 27 27 | max(1, max(i for i in range(10))) 28 28 | -nested_min_max.py:26:1: PLW3301 [**] Nested `max` calls can be flattened +nested_min_max.py:26:1: PLW3301 [*] Nested `max` calls can be flattened | 24 | min(1, min(a)) 25 | min(1, min(i for i in range(10))) @@ -257,7 +257,7 @@ nested_min_max.py:26:1: PLW3301 [**] Nested `max` calls can be flattened 28 28 | 29 29 | tuples_list = [ -nested_min_max.py:27:1: PLW3301 [**] Nested `max` calls can be flattened +nested_min_max.py:27:1: PLW3301 [*] Nested `max` calls can be flattened | 25 | min(1, min(i for i in range(10))) 26 | max(1, max(a)) @@ -278,7 +278,7 @@ nested_min_max.py:27:1: PLW3301 [**] Nested `max` calls can be flattened 29 29 | tuples_list = [ 30 30 | (1, 2), -nested_min_max.py:41:1: PLW3301 [**] Nested `max` calls can be flattened +nested_min_max.py:41:1: PLW3301 [*] Nested `max` calls can be flattened | 40 | # Starred argument should be copied as it is. 41 | max(1, max(*a)) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap index 8bf07be8bf2655..eb262e352161d8 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP005.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP005.py:6:9: UP005 [**] `assertEquals` is deprecated, use `assertEqual` +UP005.py:6:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | 4 | class Suite(unittest.TestCase): 5 | def test(self) -> None: @@ -22,7 +22,7 @@ UP005.py:6:9: UP005 [**] `assertEquals` is deprecated, use `assertEqual` 8 8 | self.assertEqual(3, 4) 9 9 | self.failUnlessAlmostEqual(1, 1.1) -UP005.py:7:9: UP005 [**] `assertEquals` is deprecated, use `assertEqual` +UP005.py:7:9: UP005 [*] `assertEquals` is deprecated, use `assertEqual` | 5 | def test(self) -> None: 6 | self.assertEquals (1, 2) @@ -43,7 +43,7 @@ UP005.py:7:9: UP005 [**] `assertEquals` is deprecated, use `assertEqual` 9 9 | self.failUnlessAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") -UP005.py:9:9: UP005 [**] `failUnlessAlmostEqual` is deprecated, use `assertAlmostEqual` +UP005.py:9:9: UP005 [*] `failUnlessAlmostEqual` is deprecated, use `assertAlmostEqual` | 7 | self.assertEquals(1, 2) 8 | self.assertEqual(3, 4) @@ -61,7 +61,7 @@ UP005.py:9:9: UP005 [**] `failUnlessAlmostEqual` is deprecated, use `assertAlmos 9 |+ self.assertAlmostEqual(1, 1.1) 10 10 | self.assertNotRegexpMatches("a", "b") -UP005.py:10:9: UP005 [**] `assertNotRegexpMatches` is deprecated, use `assertNotRegex` +UP005.py:10:9: UP005 [*] `assertNotRegexpMatches` is deprecated, use `assertNotRegex` | 8 | self.assertEqual(3, 4) 9 | self.failUnlessAlmostEqual(1, 1.1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap index e86ec8dc6fb45a..c102b6d608464e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_0.py.snap @@ -231,7 +231,7 @@ UP006_0.py:57:10: UP006 Use `list` instead of `List` for type annotation | = help: Replace with `list` -UP006_0.py:61:10: UP006 [**] Use `collections.deque` instead of `typing.Deque` for type annotation +UP006_0.py:61:10: UP006 [*] Use `collections.deque` instead of `typing.Deque` for type annotation | 61 | def f(x: typing.Deque[str]) -> None: | ^^^^^^^^^^^^ UP006 @@ -257,7 +257,7 @@ UP006_0.py:61:10: UP006 [**] Use `collections.deque` instead of `typing.Deque` f 63 64 | 64 65 | -UP006_0.py:65:10: UP006 [**] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +UP006_0.py:65:10: UP006 [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation | 65 | def f(x: typing.DefaultDict[str, str]) -> None: | ^^^^^^^^^^^^^^^^^^ UP006 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap index 39ac97bd668062..1cf174112856e7 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP006_1.py:9:10: UP006 [**] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +UP006_1.py:9:10: UP006 [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation | 9 | def f(x: typing.DefaultDict[str, str]) -> None: | ^^^^^^^^^^^^^^^^^^ UP006 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap index ed18b6bf6e1d2f..58ea6c2c8acc4e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP006_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP006_3.py:7:11: UP006 [**] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation +UP006_3.py:7:11: UP006 [*] Use `collections.defaultdict` instead of `typing.DefaultDict` for type annotation | 7 | def f(x: "typing.DefaultDict[str, str]") -> None: | ^^^^^^^^^^^^^^^^^^ UP006 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap index 03966d2beb552f..9f97cb06324d5c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP007.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP007.py:6:10: UP007 [**] Use `X | Y` for type annotations +UP007.py:6:10: UP007 [*] Use `X | Y` for type annotations | 6 | def f(x: Optional[str]) -> None: | ^^^^^^^^^^^^^ UP007 @@ -19,7 +19,7 @@ UP007.py:6:10: UP007 [**] Use `X | Y` for type annotations 8 8 | 9 9 | -UP007.py:10:10: UP007 [**] Use `X | Y` for type annotations +UP007.py:10:10: UP007 [*] Use `X | Y` for type annotations | 10 | def f(x: typing.Optional[str]) -> None: | ^^^^^^^^^^^^^^^^^^^^ UP007 @@ -37,7 +37,7 @@ UP007.py:10:10: UP007 [**] Use `X | Y` for type annotations 12 12 | 13 13 | -UP007.py:14:10: UP007 [**] Use `X | Y` for type annotations +UP007.py:14:10: UP007 [*] Use `X | Y` for type annotations | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -55,7 +55,7 @@ UP007.py:14:10: UP007 [**] Use `X | Y` for type annotations 16 16 | 17 17 | -UP007.py:14:26: UP007 [**] Use `X | Y` for type annotations +UP007.py:14:26: UP007 [*] Use `X | Y` for type annotations | 14 | def f(x: Union[str, int, Union[float, bytes]]) -> None: | ^^^^^^^^^^^^^^^^^^^ UP007 @@ -73,7 +73,7 @@ UP007.py:14:26: UP007 [**] Use `X | Y` for type annotations 16 16 | 17 17 | -UP007.py:18:10: UP007 [**] Use `X | Y` for type annotations +UP007.py:18:10: UP007 [*] Use `X | Y` for type annotations | 18 | def f(x: typing.Union[str, int]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -91,7 +91,7 @@ UP007.py:18:10: UP007 [**] Use `X | Y` for type annotations 20 20 | 21 21 | -UP007.py:22:10: UP007 [**] Use `X | Y` for type annotations +UP007.py:22:10: UP007 [*] Use `X | Y` for type annotations | 22 | def f(x: typing.Union[(str, int)]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -109,7 +109,7 @@ UP007.py:22:10: UP007 [**] Use `X | Y` for type annotations 24 24 | 25 25 | -UP007.py:26:10: UP007 [**] Use `X | Y` for type annotations +UP007.py:26:10: UP007 [*] Use `X | Y` for type annotations | 26 | def f(x: typing.Union[(str, int), float]) -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -127,7 +127,7 @@ UP007.py:26:10: UP007 [**] Use `X | Y` for type annotations 28 28 | 29 29 | -UP007.py:30:10: UP007 [**] Use `X | Y` for type annotations +UP007.py:30:10: UP007 [*] Use `X | Y` for type annotations | 30 | def f(x: typing.Union[(int,)]) -> None: | ^^^^^^^^^^^^^^^^^^^^ UP007 @@ -145,7 +145,7 @@ UP007.py:30:10: UP007 [**] Use `X | Y` for type annotations 32 32 | 33 33 | -UP007.py:34:10: UP007 [**] Use `X | Y` for type annotations +UP007.py:34:10: UP007 [*] Use `X | Y` for type annotations | 34 | def f(x: typing.Union[()]) -> None: | ^^^^^^^^^^^^^^^^ UP007 @@ -163,7 +163,7 @@ UP007.py:34:10: UP007 [**] Use `X | Y` for type annotations 36 36 | 37 37 | -UP007.py:38:11: UP007 [**] Use `X | Y` for type annotations +UP007.py:38:11: UP007 [*] Use `X | Y` for type annotations | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -181,7 +181,7 @@ UP007.py:38:11: UP007 [**] Use `X | Y` for type annotations 40 40 | 41 41 | -UP007.py:38:27: UP007 [**] Use `X | Y` for type annotations +UP007.py:38:27: UP007 [*] Use `X | Y` for type annotations | 38 | def f(x: "Union[str, int, Union[float, bytes]]") -> None: | ^^^^^^^^^^^^^^^^^^^ UP007 @@ -199,7 +199,7 @@ UP007.py:38:27: UP007 [**] Use `X | Y` for type annotations 40 40 | 41 41 | -UP007.py:42:11: UP007 [**] Use `X | Y` for type annotations +UP007.py:42:11: UP007 [*] Use `X | Y` for type annotations | 42 | def f(x: "typing.Union[str, int]") -> None: | ^^^^^^^^^^^^^^^^^^^^^^ UP007 @@ -217,7 +217,7 @@ UP007.py:42:11: UP007 [**] Use `X | Y` for type annotations 44 44 | 45 45 | -UP007.py:55:8: UP007 [**] Use `X | Y` for type annotations +UP007.py:55:8: UP007 [*] Use `X | Y` for type annotations | 54 | def f() -> None: 55 | x: Optional[str] @@ -258,7 +258,7 @@ UP007.py:58:9: UP007 Use `X | Y` for type annotations | = help: Convert to `X | Y` -UP007.py:60:8: UP007 [**] Use `X | Y` for type annotations +UP007.py:60:8: UP007 [*] Use `X | Y` for type annotations | 58 | x = Union[str, int] 59 | x = Union["str", "int"] @@ -278,7 +278,7 @@ UP007.py:60:8: UP007 [**] Use `X | Y` for type annotations 62 62 | 63 63 | -UP007.py:61:8: UP007 [**] Use `X | Y` for type annotations +UP007.py:61:8: UP007 [*] Use `X | Y` for type annotations | 59 | x = Union["str", "int"] 60 | x: Union[str, int] @@ -369,7 +369,7 @@ UP007.py:96:10: UP007 Use `X | Y` for type annotations | = help: Convert to `X | Y` -UP007.py:102:28: UP007 [**] Use `X | Y` for type annotations +UP007.py:102:28: UP007 [*] Use `X | Y` for type annotations | 100 | # Regression test for: https://github.com/astral-sh/ruff/issues/7131 101 | class ServiceRefOrValue: @@ -395,7 +395,7 @@ UP007.py:102:28: UP007 [**] Use `X | Y` for type annotations 107 104 | 108 105 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 -UP007.py:110:28: UP007 [**] Use `X | Y` for type annotations +UP007.py:110:28: UP007 [*] Use `X | Y` for type annotations | 108 | # Regression test for: https://github.com/astral-sh/ruff/issues/7201 109 | class ServiceRefOrValue: diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap index 289cefd4d35ef3..0ff5607820a4ce 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP008.py:17:23: UP008 [**] Use `super()` instead of `super(__class__, self)` +UP008.py:17:23: UP008 [*] Use `super()` instead of `super(__class__, self)` | 16 | def wrong(self): 17 | parent = super(Child, self) # wrong @@ -21,7 +21,7 @@ UP008.py:17:23: UP008 [**] Use `super()` instead of `super(__class__, self)` 19 19 | super( 20 20 | Child, -UP008.py:18:14: UP008 [**] Use `super()` instead of `super(__class__, self)` +UP008.py:18:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | 16 | def wrong(self): 17 | parent = super(Child, self) # wrong @@ -42,7 +42,7 @@ UP008.py:18:14: UP008 [**] Use `super()` instead of `super(__class__, self)` 20 20 | Child, 21 21 | self, -UP008.py:19:14: UP008 [**] Use `super()` instead of `super(__class__, self)` +UP008.py:19:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | 17 | parent = super(Child, self) # wrong 18 | super(Child, self).method # wrong @@ -68,7 +68,7 @@ UP008.py:19:14: UP008 [**] Use `super()` instead of `super(__class__, self)` 24 21 | 25 22 | class BaseClass: -UP008.py:36:14: UP008 [**] Use `super()` instead of `super(__class__, self)` +UP008.py:36:14: UP008 [*] Use `super()` instead of `super(__class__, self)` | 34 | class MyClass(BaseClass): 35 | def normal(self): @@ -88,7 +88,7 @@ UP008.py:36:14: UP008 [**] Use `super()` instead of `super(__class__, self)` 38 38 | 39 39 | def different_argument(self, other): -UP008.py:50:18: UP008 [**] Use `super()` instead of `super(__class__, self)` +UP008.py:50:18: UP008 [*] Use `super()` instead of `super(__class__, self)` | 49 | def inner_argument(self): 50 | super(MyClass, self).f() # can use super() diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap index 2f5b2a665711ef..e6ec10b65009ff 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP010.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP010.py:1:1: UP010 [**] Unnecessary `__future__` imports `generators`, `nested_scopes` for target Python version +UP010.py:1:1: UP010 [*] Unnecessary `__future__` imports `generators`, `nested_scopes` for target Python version | 1 | from __future__ import nested_scopes, generators | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP010 @@ -16,7 +16,7 @@ UP010.py:1:1: UP010 [**] Unnecessary `__future__` imports `generators`, `nested_ 3 2 | from __future__ import absolute_import, division 4 3 | from __future__ import generator_stop -UP010.py:2:1: UP010 [**] Unnecessary `__future__` imports `unicode_literals`, `with_statement` for target Python version +UP010.py:2:1: UP010 [*] Unnecessary `__future__` imports `unicode_literals`, `with_statement` for target Python version | 1 | from __future__ import nested_scopes, generators 2 | from __future__ import with_statement, unicode_literals @@ -33,7 +33,7 @@ UP010.py:2:1: UP010 [**] Unnecessary `__future__` imports `unicode_literals`, `w 4 3 | from __future__ import generator_stop 5 4 | from __future__ import print_function, generator_stop -UP010.py:3:1: UP010 [**] Unnecessary `__future__` imports `absolute_import`, `division` for target Python version +UP010.py:3:1: UP010 [*] Unnecessary `__future__` imports `absolute_import`, `division` for target Python version | 1 | from __future__ import nested_scopes, generators 2 | from __future__ import with_statement, unicode_literals @@ -52,7 +52,7 @@ UP010.py:3:1: UP010 [**] Unnecessary `__future__` imports `absolute_import`, `di 5 4 | from __future__ import print_function, generator_stop 6 5 | from __future__ import invalid_module, generators -UP010.py:4:1: UP010 [**] Unnecessary `__future__` import `generator_stop` for target Python version +UP010.py:4:1: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 2 | from __future__ import with_statement, unicode_literals 3 | from __future__ import absolute_import, division @@ -72,7 +72,7 @@ UP010.py:4:1: UP010 [**] Unnecessary `__future__` import `generator_stop` for ta 6 5 | from __future__ import invalid_module, generators 7 6 | -UP010.py:5:1: UP010 [**] Unnecessary `__future__` imports `generator_stop`, `print_function` for target Python version +UP010.py:5:1: UP010 [*] Unnecessary `__future__` imports `generator_stop`, `print_function` for target Python version | 3 | from __future__ import absolute_import, division 4 | from __future__ import generator_stop @@ -91,7 +91,7 @@ UP010.py:5:1: UP010 [**] Unnecessary `__future__` imports `generator_stop`, `pri 7 6 | 8 7 | if True: -UP010.py:6:1: UP010 [**] Unnecessary `__future__` import `generators` for target Python version +UP010.py:6:1: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 4 | from __future__ import generator_stop 5 | from __future__ import print_function, generator_stop @@ -112,7 +112,7 @@ UP010.py:6:1: UP010 [**] Unnecessary `__future__` import `generators` for target 8 8 | if True: 9 9 | from __future__ import generator_stop -UP010.py:9:5: UP010 [**] Unnecessary `__future__` import `generator_stop` for target Python version +UP010.py:9:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 8 | if True: 9 | from __future__ import generator_stop @@ -130,7 +130,7 @@ UP010.py:9:5: UP010 [**] Unnecessary `__future__` import `generator_stop` for ta 11 10 | 12 11 | if True: -UP010.py:10:5: UP010 [**] Unnecessary `__future__` import `generators` for target Python version +UP010.py:10:5: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 8 | if True: 9 | from __future__ import generator_stop @@ -150,7 +150,7 @@ UP010.py:10:5: UP010 [**] Unnecessary `__future__` import `generators` for targe 12 11 | if True: 13 12 | from __future__ import generator_stop -UP010.py:13:5: UP010 [**] Unnecessary `__future__` import `generator_stop` for target Python version +UP010.py:13:5: UP010 [*] Unnecessary `__future__` import `generator_stop` for target Python version | 12 | if True: 13 | from __future__ import generator_stop @@ -166,7 +166,7 @@ UP010.py:13:5: UP010 [**] Unnecessary `__future__` import `generator_stop` for t 13 |- from __future__ import generator_stop 14 13 | from __future__ import invalid_module, generators -UP010.py:14:5: UP010 [**] Unnecessary `__future__` import `generators` for target Python version +UP010.py:14:5: UP010 [*] Unnecessary `__future__` import `generators` for target Python version | 12 | if True: 13 | from __future__ import generator_stop diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap index 8a5057c2923fa1..7f6103fcdb1166 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP013.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP013.py:5:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:5:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 4 | # dict literal 5 | MyType = TypedDict("MyType", {"a": int, "b": str}) @@ -23,7 +23,7 @@ UP013.py:5:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class s 7 9 | # dict call 8 10 | MyType = TypedDict("MyType", dict(a=int, b=str)) -UP013.py:8:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:8:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 7 | # dict call 8 | MyType = TypedDict("MyType", dict(a=int, b=str)) @@ -45,7 +45,7 @@ UP013.py:8:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class s 10 12 | # kwargs 11 13 | MyType = TypedDict("MyType", a=int, b=str) -UP013.py:11:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:11:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 10 | # kwargs 11 | MyType = TypedDict("MyType", a=int, b=str) @@ -67,7 +67,7 @@ UP013.py:11:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 13 15 | # Empty TypedDict 14 16 | MyType = TypedDict("MyType") -UP013.py:14:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:14:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 13 | # Empty TypedDict 14 | MyType = TypedDict("MyType") @@ -88,7 +88,7 @@ UP013.py:14:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 16 17 | # Literal values 17 18 | MyType = TypedDict("MyType", {"a": "hello"}) -UP013.py:17:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:17:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 16 | # Literal values 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -108,7 +108,7 @@ UP013.py:17:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 19 20 | 20 21 | # NotRequired -UP013.py:18:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:18:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 16 | # Literal values 17 | MyType = TypedDict("MyType", {"a": "hello"}) @@ -130,7 +130,7 @@ UP013.py:18:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 20 21 | # NotRequired 21 22 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) -UP013.py:21:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:21:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 20 | # NotRequired 21 | MyType = TypedDict("MyType", {"a": NotRequired[dict]}) @@ -151,7 +151,7 @@ UP013.py:21:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 23 24 | # total 24 25 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) -UP013.py:24:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:24:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 23 | # total 24 | MyType = TypedDict("MyType", {"x": int, "y": int}, total=False) @@ -173,7 +173,7 @@ UP013.py:24:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 26 28 | # using Literal type 27 29 | MyType = TypedDict("MyType", {"key": Literal["value"]}) -UP013.py:27:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:27:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 26 | # using Literal type 27 | MyType = TypedDict("MyType", {"key": Literal["value"]}) @@ -194,7 +194,7 @@ UP013.py:27:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 29 30 | # using namespace TypedDict 30 31 | MyType = typing.TypedDict("MyType", {"key": int}) -UP013.py:30:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:30:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 29 | # using namespace TypedDict 30 | MyType = typing.TypedDict("MyType", {"key": int}) @@ -215,7 +215,7 @@ UP013.py:30:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 32 33 | # invalid identifiers (OK) 33 34 | MyType = TypedDict("MyType", {"in": int, "x-y": int}) -UP013.py:40:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:40:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 39 | # Empty dict literal 40 | MyType = TypedDict("MyType", {}) @@ -236,7 +236,7 @@ UP013.py:40:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class 42 43 | # Empty dict call 43 44 | MyType = TypedDict("MyType", dict()) -UP013.py:43:1: UP013 [**] Convert `MyType` from `TypedDict` functional to class syntax +UP013.py:43:1: UP013 [*] Convert `MyType` from `TypedDict` functional to class syntax | 42 | # Empty dict call 43 | MyType = TypedDict("MyType", dict()) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap index e13aad4bd109cf..f7e9dd895e6270 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP014.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP014.py:5:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:5:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 4 | # with complex annotations 5 | MyType = NamedTuple("MyType", [("a", int), ("b", tuple[str, ...])]) @@ -23,7 +23,7 @@ UP014.py:5:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class 7 9 | # with namespace 8 10 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) -UP014.py:8:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:8:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 7 | # with namespace 8 | MyType = typing.NamedTuple("MyType", [("a", int), ("b", str)]) @@ -45,7 +45,7 @@ UP014.py:8:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class 10 12 | # invalid identifiers (OK) 11 13 | MyType = NamedTuple("MyType", [("x-y", int), ("b", tuple[str, ...])]) -UP014.py:14:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:14:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 13 | # no fields 14 | MyType = typing.NamedTuple("MyType") @@ -66,7 +66,7 @@ UP014.py:14:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class 16 17 | # empty fields 17 18 | MyType = typing.NamedTuple("MyType", []) -UP014.py:17:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:17:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 16 | # empty fields 17 | MyType = typing.NamedTuple("MyType", []) @@ -87,7 +87,7 @@ UP014.py:17:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class 19 20 | # keywords 20 21 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) -UP014.py:20:1: UP014 [**] Convert `MyType` from `NamedTuple` functional to class syntax +UP014.py:20:1: UP014 [*] Convert `MyType` from `NamedTuple` functional to class syntax | 19 | # keywords 20 | MyType = typing.NamedTuple("MyType", a=int, b=tuple[str, ...]) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap index 896e53d7cd5736..6638a8cc904a74 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP020.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP020.py:3:6: UP020 [**] Use builtin `open` +UP020.py:3:6: UP020 [*] Use builtin `open` | 1 | import io 2 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap index 0f6be39f186317..484e53f1d84aab 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP021.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP021.py:5:25: UP021 [**] `universal_newlines` is deprecated, use `text` +UP021.py:5:25: UP021 [*] `universal_newlines` is deprecated, use `text` | 4 | # Errors 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -21,7 +21,7 @@ UP021.py:5:25: UP021 [**] `universal_newlines` is deprecated, use `text` 7 7 | run(["foo"], universal_newlines=True, check=False) 8 8 | -UP021.py:6:25: UP021 [**] `universal_newlines` is deprecated, use `text` +UP021.py:6:25: UP021 [*] `universal_newlines` is deprecated, use `text` | 4 | # Errors 5 | subprocess.run(["foo"], universal_newlines=True, check=True) @@ -41,7 +41,7 @@ UP021.py:6:25: UP021 [**] `universal_newlines` is deprecated, use `text` 8 8 | 9 9 | # OK -UP021.py:7:14: UP021 [**] `universal_newlines` is deprecated, use `text` +UP021.py:7:14: UP021 [*] `universal_newlines` is deprecated, use `text` | 5 | subprocess.run(["foo"], universal_newlines=True, check=True) 6 | subprocess.run(["foo"], universal_newlines=True, text=True) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap index 8b37f71834e5eb..186db762542e54 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP022.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP022.py:4:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:4:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 2 | import subprocess 3 | @@ -22,7 +22,7 @@ UP022.py:4:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, 6 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 7 | -UP022.py:6:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:6:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 4 | output = run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 5 | @@ -43,7 +43,7 @@ UP022.py:6:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, 8 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 9 | -UP022.py:8:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:8:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 6 | output = subprocess.run(["foo"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 7 | @@ -64,7 +64,7 @@ UP022.py:8:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, 10 10 | output = subprocess.run( 11 11 | ["foo"], stdout=subprocess.PIPE, check=True, stderr=subprocess.PIPE -UP022.py:10:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:10:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 8 | output = subprocess.run(stdout=subprocess.PIPE, args=["foo"], stderr=subprocess.PIPE) 9 | @@ -88,7 +88,7 @@ UP022.py:10:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated 13 13 | 14 14 | output = subprocess.run( -UP022.py:14:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:14:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 12 | ) 13 | @@ -112,7 +112,7 @@ UP022.py:14:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated 17 17 | 18 18 | output = subprocess.run( -UP022.py:18:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:18:10: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 16 | ) 17 | @@ -144,7 +144,7 @@ UP022.py:18:10: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated 24 23 | encoding="utf-8", 25 24 | close_fds=True, -UP022.py:29:14: UP022 [**] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` +UP022.py:29:14: UP022 [*] Sending `stdout` and `stderr` to `PIPE` is deprecated, use `capture_output` | 28 | if output: 29 | output = subprocess.run( diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap index 37cbfe306959a2..6944c7925b1758 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP023.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP023.py:2:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:2:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 1 | # These two imports have something after cElementTree, so they should be fixed. 2 | from xml.etree.cElementTree import XML, Element, SubElement @@ -18,7 +18,7 @@ UP023.py:2:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 4 4 | 5 5 | # Weird spacing should not cause issues. -UP023.py:3:8: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:3:8: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 1 | # These two imports have something after cElementTree, so they should be fixed. 2 | from xml.etree.cElementTree import XML, Element, SubElement @@ -38,7 +38,7 @@ UP023.py:3:8: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 5 5 | # Weird spacing should not cause issues. 6 6 | from xml.etree.cElementTree import XML -UP023.py:6:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:6:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 5 | # Weird spacing should not cause issues. 6 | from xml.etree.cElementTree import XML @@ -57,7 +57,7 @@ UP023.py:6:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 8 8 | 9 9 | # Multi line imports should also work fine. -UP023.py:7:11: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:7:11: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 5 | # Weird spacing should not cause issues. 6 | from xml.etree.cElementTree import XML @@ -78,7 +78,7 @@ UP023.py:7:11: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 9 9 | # Multi line imports should also work fine. 10 10 | from xml.etree.cElementTree import ( -UP023.py:10:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:10:1: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 9 | # Multi line imports should also work fine. 10 | / from xml.etree.cElementTree import ( @@ -102,7 +102,7 @@ UP023.py:10:1: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 12 12 | Element, 13 13 | SubElement, -UP023.py:16:12: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:16:12: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 14 | ) 15 | if True: @@ -122,7 +122,7 @@ UP023.py:16:12: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 18 18 | 19 19 | from xml.etree import cElementTree as ET -UP023.py:17:27: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:17:27: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 15 | if True: 16 | import xml.etree.cElementTree as ET @@ -143,7 +143,7 @@ UP023.py:17:27: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 19 19 | from xml.etree import cElementTree as ET 20 20 | -UP023.py:19:23: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:19:23: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 17 | from xml.etree import cElementTree as CET 18 | @@ -164,7 +164,7 @@ UP023.py:19:23: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 21 21 | import contextlib, xml.etree.cElementTree as ET 22 22 | -UP023.py:21:20: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:21:20: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 19 | from xml.etree import cElementTree as ET 20 | @@ -185,7 +185,7 @@ UP023.py:21:20: UP023 [**] `cElementTree` is deprecated, use `ElementTree` 23 23 | # This should fix the second, but not the first invocation. 24 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET -UP023.py:24:32: UP023 [**] `cElementTree` is deprecated, use `ElementTree` +UP023.py:24:32: UP023 [*] `cElementTree` is deprecated, use `ElementTree` | 23 | # This should fix the second, but not the first invocation. 24 | import xml.etree.cElementTree, xml.etree.cElementTree as ET diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap index b4c6a9b54ffced..fb8ecac7ec0a9b 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP026.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP026.py:3:12: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:3:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 1 | # Error (`from unittest import mock`) 2 | if True: @@ -21,7 +21,7 @@ UP026.py:3:12: UP026 [**] `mock` is deprecated, use `unittest.mock` 5 5 | # Error (`from unittest import mock`) 6 6 | if True: -UP026.py:7:12: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:7:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 5 | # Error (`from unittest import mock`) 6 | if True: @@ -43,7 +43,7 @@ UP026.py:7:12: UP026 [**] `mock` is deprecated, use `unittest.mock` 9 10 | # Error (`from unittest.mock import *`) 10 11 | if True: -UP026.py:11:5: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:11:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 9 | # Error (`from unittest.mock import *`) 10 | if True: @@ -64,7 +64,7 @@ UP026.py:11:5: UP026 [**] `mock` is deprecated, use `unittest.mock` 13 13 | # Error (`from unittest import mock`) 14 14 | import mock.mock -UP026.py:14:8: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:14:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 13 | # Error (`from unittest import mock`) 14 | import mock.mock @@ -84,7 +84,7 @@ UP026.py:14:8: UP026 [**] `mock` is deprecated, use `unittest.mock` 16 16 | # Error (`from unittest import mock`) 17 17 | import contextlib, mock, sys -UP026.py:17:20: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:17:20: UP026 [*] `mock` is deprecated, use `unittest.mock` | 16 | # Error (`from unittest import mock`) 17 | import contextlib, mock, sys @@ -105,7 +105,7 @@ UP026.py:17:20: UP026 [**] `mock` is deprecated, use `unittest.mock` 19 20 | # Error (`from unittest import mock`) 20 21 | import mock, sys -UP026.py:20:8: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:20:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 19 | # Error (`from unittest import mock`) 20 | import mock, sys @@ -125,7 +125,7 @@ UP026.py:20:8: UP026 [**] `mock` is deprecated, use `unittest.mock` 22 23 | 23 24 | # Error (`from unittest import mock`) -UP026.py:24:1: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:24:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 23 | # Error (`from unittest import mock`) 24 | from mock import mock @@ -145,7 +145,7 @@ UP026.py:24:1: UP026 [**] `mock` is deprecated, use `unittest.mock` 26 26 | # Error (keep trailing comma) 27 27 | from mock import ( -UP026.py:27:1: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:27:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 26 | # Error (keep trailing comma) 27 | / from mock import ( @@ -176,7 +176,7 @@ UP026.py:27:1: UP026 [**] `mock` is deprecated, use `unittest.mock` 34 34 | a, 35 35 | b, -UP026.py:33:1: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:33:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 31 | c, 32 | ) @@ -208,7 +208,7 @@ UP026.py:33:1: UP026 [**] `mock` is deprecated, use `unittest.mock` 40 40 | # Error (avoid trailing comma) 41 41 | from mock import ( -UP026.py:41:1: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:41:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 40 | # Error (avoid trailing comma) 41 | / from mock import ( @@ -239,7 +239,7 @@ UP026.py:41:1: UP026 [**] `mock` is deprecated, use `unittest.mock` 48 48 | a, 49 49 | b, -UP026.py:47:1: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:47:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 45 | c 46 | ) @@ -272,7 +272,7 @@ UP026.py:47:1: UP026 [**] `mock` is deprecated, use `unittest.mock` 54 54 | from mock import a, b, c, mock 55 55 | -UP026.py:53:1: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:53:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 51 | mock 52 | ) @@ -293,7 +293,7 @@ UP026.py:53:1: UP026 [**] `mock` is deprecated, use `unittest.mock` 55 56 | 56 57 | if True: -UP026.py:54:1: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:54:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 52 | ) 53 | from mock import mock, a, b, c @@ -315,7 +315,7 @@ UP026.py:54:1: UP026 [**] `mock` is deprecated, use `unittest.mock` 56 57 | if True: 57 58 | if False: -UP026.py:58:9: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:58:9: UP026 [*] `mock` is deprecated, use `unittest.mock` | 56 | if True: 57 | if False: @@ -348,7 +348,7 @@ UP026.py:58:9: UP026 [**] `mock` is deprecated, use `unittest.mock` 65 65 | # OK 66 66 | import os, io -UP026.py:69:8: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:69:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 68 | # Error (`from unittest import mock`) 69 | import mock, mock @@ -369,7 +369,7 @@ UP026.py:69:8: UP026 [**] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo -UP026.py:69:14: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:69:14: UP026 [*] `mock` is deprecated, use `unittest.mock` | 68 | # Error (`from unittest import mock`) 69 | import mock, mock @@ -390,7 +390,7 @@ UP026.py:69:14: UP026 [**] `mock` is deprecated, use `unittest.mock` 71 72 | # Error (`from unittest import mock as foo`) 72 73 | import mock as foo -UP026.py:72:8: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:72:8: UP026 [*] `mock` is deprecated, use `unittest.mock` | 71 | # Error (`from unittest import mock as foo`) 72 | import mock as foo @@ -410,7 +410,7 @@ UP026.py:72:8: UP026 [**] `mock` is deprecated, use `unittest.mock` 74 74 | # Error (`from unittest import mock as foo`) 75 75 | from mock import mock as foo -UP026.py:75:1: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:75:1: UP026 [*] `mock` is deprecated, use `unittest.mock` | 74 | # Error (`from unittest import mock as foo`) 75 | from mock import mock as foo @@ -430,7 +430,7 @@ UP026.py:75:1: UP026 [**] `mock` is deprecated, use `unittest.mock` 77 77 | if True: 78 78 | # This should yield multiple, aliased imports. -UP026.py:79:12: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:79:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -453,7 +453,7 @@ UP026.py:79:12: UP026 [**] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -UP026.py:79:25: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:79:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -476,7 +476,7 @@ UP026.py:79:25: UP026 [**] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -UP026.py:79:38: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:79:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | 77 | if True: 78 | # This should yield multiple, aliased imports. @@ -499,7 +499,7 @@ UP026.py:79:38: UP026 [**] `mock` is deprecated, use `unittest.mock` 81 83 | # This should yield multiple, aliased imports, and preserve `os`. 82 84 | import mock as foo, mock as bar, mock, os -UP026.py:82:12: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:82:12: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -522,7 +522,7 @@ UP026.py:82:12: UP026 [**] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -UP026.py:82:25: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:82:25: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -545,7 +545,7 @@ UP026.py:82:25: UP026 [**] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -UP026.py:82:38: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:82:38: UP026 [*] `mock` is deprecated, use `unittest.mock` | 81 | # This should yield multiple, aliased imports, and preserve `os`. 82 | import mock as foo, mock as bar, mock, os @@ -568,7 +568,7 @@ UP026.py:82:38: UP026 [**] `mock` is deprecated, use `unittest.mock` 84 87 | if True: 85 88 | # This should yield multiple, aliased imports. -UP026.py:86:5: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:86:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 84 | if True: 85 | # This should yield multiple, aliased imports. @@ -589,7 +589,7 @@ UP026.py:86:5: UP026 [**] `mock` is deprecated, use `unittest.mock` 88 90 | 89 91 | # OK. -UP026.py:93:5: UP026 [**] `mock` is deprecated, use `unittest.mock` +UP026.py:93:5: UP026 [*] `mock` is deprecated, use `unittest.mock` | 92 | # Error (`mock.Mock()`). 93 | x = mock.mock.Mock() diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap index 95eaadcfa13310..db56ed7f7d5934 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP027.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP027.py:2:17: UP027 [**] Replace unpacked list comprehension with a generator expression +UP027.py:2:17: UP027 [*] Replace unpacked list comprehension with a generator expression | 1 | # Should change 2 | foo, bar, baz = [fn(x) for x in items] @@ -19,7 +19,7 @@ UP027.py:2:17: UP027 [**] Replace unpacked list comprehension with a generator e 4 4 | foo, bar, baz =[fn(x) for x in items] 5 5 | -UP027.py:4:16: UP027 [**] Replace unpacked list comprehension with a generator expression +UP027.py:4:16: UP027 [*] Replace unpacked list comprehension with a generator expression | 2 | foo, bar, baz = [fn(x) for x in items] 3 | @@ -40,7 +40,7 @@ UP027.py:4:16: UP027 [**] Replace unpacked list comprehension with a generator e 6 6 | foo, bar, baz = [fn(x) for x in items] 7 7 | -UP027.py:6:26: UP027 [**] Replace unpacked list comprehension with a generator expression +UP027.py:6:26: UP027 [*] Replace unpacked list comprehension with a generator expression | 4 | foo, bar, baz =[fn(x) for x in items] 5 | @@ -61,7 +61,7 @@ UP027.py:6:26: UP027 [**] Replace unpacked list comprehension with a generator e 8 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 9 | -UP027.py:8:17: UP027 [**] Replace unpacked list comprehension with a generator expression +UP027.py:8:17: UP027 [*] Replace unpacked list comprehension with a generator expression | 6 | foo, bar, baz = [fn(x) for x in items] 7 | @@ -82,7 +82,7 @@ UP027.py:8:17: UP027 [**] Replace unpacked list comprehension with a generator e 10 10 | foo, bar, baz = [ 11 11 | fn(x) -UP027.py:10:17: UP027 [**] Replace unpacked list comprehension with a generator expression +UP027.py:10:17: UP027 [*] Replace unpacked list comprehension with a generator expression | 8 | foo, bar, baz = [[i for i in fn(x)] for x in items] 9 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap index 555ee3158a2477..12c38221bfd00c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP028_0.py:2:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:2:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 1 | def f(): 2 | for x in y: @@ -20,7 +20,7 @@ UP028_0.py:2:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 5 4 | 6 5 | def g(): -UP028_0.py:7:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:7:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 6 | def g(): 7 | for x, y in z: @@ -41,7 +41,7 @@ UP028_0.py:7:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 10 9 | 11 10 | def h(): -UP028_0.py:12:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:12:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 11 | def h(): 12 | for x in [1, 2, 3]: @@ -62,7 +62,7 @@ UP028_0.py:12:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 15 14 | 16 15 | def i(): -UP028_0.py:17:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:17:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 16 | def i(): 17 | for x in {x for x in y}: @@ -83,7 +83,7 @@ UP028_0.py:17:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 20 19 | 21 20 | def j(): -UP028_0.py:22:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:22:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 21 | def j(): 22 | for x in (1, 2, 3): @@ -104,7 +104,7 @@ UP028_0.py:22:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 25 24 | 26 25 | def k(): -UP028_0.py:27:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:27:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 26 | def k(): 27 | for x, y in {3: "x", 6: "y"}: @@ -125,7 +125,7 @@ UP028_0.py:27:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 30 29 | 31 30 | def f(): # Comment one\n' -UP028_0.py:33:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:33:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 31 | def f(): # Comment one\n' 32 | # Comment two\n' @@ -159,7 +159,7 @@ UP028_0.py:33:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 41 39 | 42 40 | -UP028_0.py:44:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:44:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 43 | def f(): 44 | for x, y in [{3: (3, [44, "long ss"]), 6: "y"}]: @@ -180,7 +180,7 @@ UP028_0.py:44:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 47 46 | 48 47 | def f(): -UP028_0.py:49:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:49:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 48 | def f(): 49 | for x, y in z(): @@ -203,7 +203,7 @@ UP028_0.py:49:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 52 51 | def f(): 53 52 | def func(): -UP028_0.py:55:9: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:55:9: UP028 [*] Replace `yield` over `for` loop with `yield from` | 53 | def func(): 54 | # This comment is preserved\n' @@ -229,7 +229,7 @@ UP028_0.py:55:9: UP028 [**] Replace `yield` over `for` loop with `yield from` 59 57 | # Comment\n' 60 58 | def g(): -UP028_0.py:67:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:67:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 65 | for x in y: 66 | yield x @@ -251,7 +251,7 @@ UP028_0.py:67:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 70 69 | 71 70 | def f(): -UP028_0.py:72:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:72:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 71 | def f(): 72 | for x, y in z(): @@ -273,7 +273,7 @@ UP028_0.py:72:5: UP028 [**] Replace `yield` over `for` loop with `yield from` 75 74 | 76 75 | -UP028_0.py:79:5: UP028 [**] Replace `yield` over `for` loop with `yield from` +UP028_0.py:79:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | 77 | # Regression test for: https://github.com/astral-sh/ruff/issues/7103 78 | def _serve_method(fn): diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap index 100e3da5260fa1..f094fbd50c3a62 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP029.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP029.py:1:1: UP029 [**] Unnecessary builtin import: `*` +UP029.py:1:1: UP029 [*] Unnecessary builtin import: `*` | 1 | from builtins import * | ^^^^^^^^^^^^^^^^^^^^^^ UP029 @@ -16,7 +16,7 @@ UP029.py:1:1: UP029 [**] Unnecessary builtin import: `*` 3 2 | from builtins import str as _str 4 3 | from six.moves import filter, zip, zip_longest -UP029.py:2:1: UP029 [**] Unnecessary builtin imports: `ascii`, `bytes` +UP029.py:2:1: UP029 [*] Unnecessary builtin imports: `ascii`, `bytes` | 1 | from builtins import * 2 | from builtins import ascii, bytes, compile @@ -34,7 +34,7 @@ UP029.py:2:1: UP029 [**] Unnecessary builtin imports: `ascii`, `bytes` 4 4 | from six.moves import filter, zip, zip_longest 5 5 | from io import open -UP029.py:4:1: UP029 [**] Unnecessary builtin imports: `filter`, `zip` +UP029.py:4:1: UP029 [*] Unnecessary builtin imports: `filter`, `zip` | 2 | from builtins import ascii, bytes, compile 3 | from builtins import str as _str @@ -55,7 +55,7 @@ UP029.py:4:1: UP029 [**] Unnecessary builtin imports: `filter`, `zip` 6 6 | import io 7 7 | import six -UP029.py:5:1: UP029 [**] Unnecessary builtin import: `open` +UP029.py:5:1: UP029 [*] Unnecessary builtin import: `open` | 3 | from builtins import str as _str 4 | from six.moves import filter, zip, zip_longest diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap index b0d847cac9a711..58595ab3a73cbc 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP030_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP030_0.py:3:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields | 1 | # Invalid calls; errors expected. 2 | @@ -21,7 +21,7 @@ UP030_0.py:3:1: UP030 [**] Use implicit references for positional format fields 5 5 | "a {3} complicated {1} string with {0} {2}".format( 6 6 | "first", "second", "third", "fourth" -UP030_0.py:5:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields | 3 | "{0}" "{1}" "{2}".format(1, 2, 3) 4 | @@ -46,7 +46,7 @@ UP030_0.py:5:1: UP030 [**] Use implicit references for positional format fields 8 8 | 9 9 | '{0}'.format(1) -UP030_0.py:9:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields | 7 | ) 8 | @@ -67,7 +67,7 @@ UP030_0.py:9:1: UP030 [**] Use implicit references for positional format fields 11 11 | '{0:x}'.format(30) 12 12 | -UP030_0.py:11:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields | 9 | '{0}'.format(1) 10 | @@ -88,7 +88,7 @@ UP030_0.py:11:1: UP030 [**] Use implicit references for positional format fields 13 13 | x = '{0}'.format(1) 14 14 | -UP030_0.py:13:5: UP030 [**] Use implicit references for positional format fields +UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields | 11 | '{0:x}'.format(30) 12 | @@ -109,7 +109,7 @@ UP030_0.py:13:5: UP030 [**] Use implicit references for positional format fields 15 15 | '''{0}\n{1}\n'''.format(1, 2) 16 16 | -UP030_0.py:15:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields | 13 | x = '{0}'.format(1) 14 | @@ -130,7 +130,7 @@ UP030_0.py:15:1: UP030 [**] Use implicit references for positional format fields 17 17 | x = "foo {0}" \ 18 18 | "bar {1}".format(1, 2) -UP030_0.py:17:5: UP030 [**] Use implicit references for positional format fields +UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields | 15 | '''{0}\n{1}\n'''.format(1, 2) 16 | @@ -155,7 +155,7 @@ UP030_0.py:17:5: UP030 [**] Use implicit references for positional format fields 20 20 | ("{0}").format(1) 21 21 | -UP030_0.py:20:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields | 18 | "bar {1}".format(1, 2) 19 | @@ -176,7 +176,7 @@ UP030_0.py:20:1: UP030 [**] Use implicit references for positional format fields 22 22 | "\N{snowman} {0}".format(1) 23 23 | -UP030_0.py:22:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields | 20 | ("{0}").format(1) 21 | @@ -197,7 +197,7 @@ UP030_0.py:22:1: UP030 [**] Use implicit references for positional format fields 24 24 | print( 25 25 | 'foo{0}' -UP030_0.py:25:5: UP030 [**] Use implicit references for positional format fields +UP030_0.py:25:5: UP030 [*] Use implicit references for positional format fields | 24 | print( 25 | 'foo{0}' @@ -220,7 +220,7 @@ UP030_0.py:25:5: UP030 [**] Use implicit references for positional format fields 28 28 | 29 29 | print( -UP030_0.py:30:5: UP030 [**] Use implicit references for positional format fields +UP030_0.py:30:5: UP030 [*] Use implicit references for positional format fields | 29 | print( 30 | 'foo{0}' # ohai\n" @@ -254,7 +254,7 @@ UP030_0.py:34:1: UP030 Use implicit references for positional format fields | = help: Remove explicit positional indices -UP030_0.py:39:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:39:1: UP030 [*] Use implicit references for positional format fields | 37 | kwargs = {x: x for x in range(10)} 38 | @@ -275,7 +275,7 @@ UP030_0.py:39:1: UP030 [**] Use implicit references for positional format fields 41 41 | "{0}".format(**kwargs) 42 42 | -UP030_0.py:41:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:41:1: UP030 [*] Use implicit references for positional format fields | 39 | "{0}".format(*args) 40 | @@ -296,7 +296,7 @@ UP030_0.py:41:1: UP030 [**] Use implicit references for positional format fields 43 43 | "{0}_{1}".format(*args) 44 44 | -UP030_0.py:43:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:43:1: UP030 [*] Use implicit references for positional format fields | 41 | "{0}".format(**kwargs) 42 | @@ -317,7 +317,7 @@ UP030_0.py:43:1: UP030 [**] Use implicit references for positional format fields 45 45 | "{0}_{1}".format(1, *args) 46 46 | -UP030_0.py:45:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:45:1: UP030 [*] Use implicit references for positional format fields | 43 | "{0}_{1}".format(*args) 44 | @@ -338,7 +338,7 @@ UP030_0.py:45:1: UP030 [**] Use implicit references for positional format fields 47 47 | "{0}_{1}".format(1, 2, *args) 48 48 | -UP030_0.py:47:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:47:1: UP030 [*] Use implicit references for positional format fields | 45 | "{0}_{1}".format(1, *args) 46 | @@ -359,7 +359,7 @@ UP030_0.py:47:1: UP030 [**] Use implicit references for positional format fields 49 49 | "{0}_{1}".format(*args, 1, 2) 50 50 | -UP030_0.py:49:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:49:1: UP030 [*] Use implicit references for positional format fields | 47 | "{0}_{1}".format(1, 2, *args) 48 | @@ -380,7 +380,7 @@ UP030_0.py:49:1: UP030 [**] Use implicit references for positional format fields 51 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 52 | -UP030_0.py:51:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:51:1: UP030 [*] Use implicit references for positional format fields | 49 | "{0}_{1}".format(*args, 1, 2) 50 | @@ -401,7 +401,7 @@ UP030_0.py:51:1: UP030 [**] Use implicit references for positional format fields 53 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 54 | -UP030_0.py:53:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:53:1: UP030 [*] Use implicit references for positional format fields | 51 | "{0}_{1}_{2}".format(1, **kwargs) 52 | @@ -422,7 +422,7 @@ UP030_0.py:53:1: UP030 [**] Use implicit references for positional format fields 55 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 56 | -UP030_0.py:55:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:55:1: UP030 [*] Use implicit references for positional format fields | 53 | "{0}_{1}_{2}".format(1, 2, **kwargs) 54 | @@ -443,7 +443,7 @@ UP030_0.py:55:1: UP030 [**] Use implicit references for positional format fields 57 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 58 | -UP030_0.py:57:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:57:1: UP030 [*] Use implicit references for positional format fields | 55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs) 56 | @@ -464,7 +464,7 @@ UP030_0.py:57:1: UP030 [**] Use implicit references for positional format fields 59 59 | "{1}_{0}".format(1, 2, *args) 60 60 | -UP030_0.py:59:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:59:1: UP030 [*] Use implicit references for positional format fields | 57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs) 58 | @@ -484,7 +484,7 @@ UP030_0.py:59:1: UP030 [**] Use implicit references for positional format fields 60 60 | 61 61 | "{1}_{0}".format(1, 2) -UP030_0.py:61:1: UP030 [**] Use implicit references for positional format fields +UP030_0.py:61:1: UP030 [*] Use implicit references for positional format fields | 59 | "{1}_{0}".format(1, 2, *args) 60 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap index 58751746014ae5..45ed171e744b43 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP031_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP031_0.py:4:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format | 3 | # UP031 4 | print('%s %s' % (a, b)) @@ -21,7 +21,7 @@ UP031_0.py:4:7: UP031 [**] Use format specifiers instead of percent format 6 6 | print('%s%s' % (a, b)) 7 7 | -UP031_0.py:6:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format | 4 | print('%s %s' % (a, b)) 5 | @@ -42,7 +42,7 @@ UP031_0.py:6:7: UP031 [**] Use format specifiers instead of percent format 8 8 | print("trivial" % ()) 9 9 | -UP031_0.py:8:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format | 6 | print('%s%s' % (a, b)) 7 | @@ -63,7 +63,7 @@ UP031_0.py:8:7: UP031 [**] Use format specifiers instead of percent format 10 10 | print("%s" % ("simple",)) 11 11 | -UP031_0.py:10:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format | 8 | print("trivial" % ()) 9 | @@ -84,7 +84,7 @@ UP031_0.py:10:7: UP031 [**] Use format specifiers instead of percent format 12 12 | print("%s" % ("%s" % ("nested",),)) 13 13 | -UP031_0.py:12:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format | 10 | print("%s" % ("simple",)) 11 | @@ -105,7 +105,7 @@ UP031_0.py:12:7: UP031 [**] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | -UP031_0.py:12:15: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format | 10 | print("%s" % ("simple",)) 11 | @@ -126,7 +126,7 @@ UP031_0.py:12:15: UP031 [**] Use format specifiers instead of percent format 14 14 | print("%s%% percent" % (15,)) 15 15 | -UP031_0.py:14:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format | 12 | print("%s" % ("%s" % ("nested",),)) 13 | @@ -147,7 +147,7 @@ UP031_0.py:14:7: UP031 [**] Use format specifiers instead of percent format 16 16 | print("%f" % (15,)) 17 17 | -UP031_0.py:16:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format | 14 | print("%s%% percent" % (15,)) 15 | @@ -168,7 +168,7 @@ UP031_0.py:16:7: UP031 [**] Use format specifiers instead of percent format 18 18 | print("%.f" % (15,)) 19 19 | -UP031_0.py:18:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format | 16 | print("%f" % (15,)) 17 | @@ -189,7 +189,7 @@ UP031_0.py:18:7: UP031 [**] Use format specifiers instead of percent format 20 20 | print("%.3f" % (15,)) 21 21 | -UP031_0.py:20:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format | 18 | print("%.f" % (15,)) 19 | @@ -210,7 +210,7 @@ UP031_0.py:20:7: UP031 [**] Use format specifiers instead of percent format 22 22 | print("%3f" % (15,)) 23 23 | -UP031_0.py:22:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format | 20 | print("%.3f" % (15,)) 21 | @@ -231,7 +231,7 @@ UP031_0.py:22:7: UP031 [**] Use format specifiers instead of percent format 24 24 | print("%-5f" % (5,)) 25 25 | -UP031_0.py:24:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format | 22 | print("%3f" % (15,)) 23 | @@ -252,7 +252,7 @@ UP031_0.py:24:7: UP031 [**] Use format specifiers instead of percent format 26 26 | print("%9f" % (5,)) 27 27 | -UP031_0.py:26:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format | 24 | print("%-5f" % (5,)) 25 | @@ -273,7 +273,7 @@ UP031_0.py:26:7: UP031 [**] Use format specifiers instead of percent format 28 28 | print("%#o" % (123,)) 29 29 | -UP031_0.py:28:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format | 26 | print("%9f" % (5,)) 27 | @@ -294,7 +294,7 @@ UP031_0.py:28:7: UP031 [**] Use format specifiers instead of percent format 30 30 | print("brace {} %s" % (1,)) 31 31 | -UP031_0.py:30:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format | 28 | print("%#o" % (123,)) 29 | @@ -315,7 +315,7 @@ UP031_0.py:30:7: UP031 [**] Use format specifiers instead of percent format 32 32 | print( 33 33 | "%s" % ( -UP031_0.py:33:3: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:33:3: UP031 [*] Use format specifiers instead of percent format | 32 | print( 33 | "%s" % ( @@ -337,7 +337,7 @@ UP031_0.py:33:3: UP031 [**] Use format specifiers instead of percent format 35 35 | ) 36 36 | ) -UP031_0.py:38:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:38:7: UP031 [*] Use format specifiers instead of percent format | 36 | ) 37 | @@ -358,7 +358,7 @@ UP031_0.py:38:7: UP031 [**] Use format specifiers instead of percent format 40 40 | print("%(k)s" % {"k": "v"}) 41 41 | -UP031_0.py:40:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:40:7: UP031 [*] Use format specifiers instead of percent format | 38 | print("foo %s " % (x,)) 39 | @@ -379,7 +379,7 @@ UP031_0.py:40:7: UP031 [**] Use format specifiers instead of percent format 42 42 | print("%(k)s" % { 43 43 | "k": "v", -UP031_0.py:42:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:42:7: UP031 [*] Use format specifiers instead of percent format | 40 | print("%(k)s" % {"k": "v"}) 41 | @@ -410,7 +410,7 @@ UP031_0.py:42:7: UP031 [**] Use format specifiers instead of percent format 47 47 | print("%(to_list)s" % {"to_list": []}) 48 48 | -UP031_0.py:47:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format | 45 | }) 46 | @@ -431,7 +431,7 @@ UP031_0.py:47:7: UP031 [**] Use format specifiers instead of percent format 49 49 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 50 50 | -UP031_0.py:49:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:49:7: UP031 [*] Use format specifiers instead of percent format | 47 | print("%(to_list)s" % {"to_list": []}) 48 | @@ -452,7 +452,7 @@ UP031_0.py:49:7: UP031 [**] Use format specifiers instead of percent format 51 51 | print("%(ab)s" % {"a" "b": 1}) 52 52 | -UP031_0.py:51:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:51:7: UP031 [*] Use format specifiers instead of percent format | 49 | print("%(k)s" % {"k": "v", "i": 1, "j": []}) 50 | @@ -473,7 +473,7 @@ UP031_0.py:51:7: UP031 [**] Use format specifiers instead of percent format 53 53 | print("%(a)s" % {"a" : 1}) 54 54 | -UP031_0.py:53:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:53:7: UP031 [*] Use format specifiers instead of percent format | 51 | print("%(ab)s" % {"a" "b": 1}) 52 | @@ -494,7 +494,7 @@ UP031_0.py:53:7: UP031 [**] Use format specifiers instead of percent format 55 55 | print(( 56 56 | "foo %s " -UP031_0.py:56:5: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:56:5: UP031 [*] Use format specifiers instead of percent format | 55 | print(( 56 | "foo %s " @@ -517,7 +517,7 @@ UP031_0.py:56:5: UP031 [**] Use format specifiers instead of percent format 59 59 | 60 60 | print( -UP031_0.py:61:5: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:61:5: UP031 [*] Use format specifiers instead of percent format | 60 | print( 61 | "foo %(foo)s " @@ -540,7 +540,7 @@ UP031_0.py:61:5: UP031 [**] Use format specifiers instead of percent format 64 64 | 65 65 | bar = {"bar": y} -UP031_0.py:67:5: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:67:5: UP031 [*] Use format specifiers instead of percent format | 65 | bar = {"bar": y} 66 | print( @@ -564,7 +564,7 @@ UP031_0.py:67:5: UP031 [**] Use format specifiers instead of percent format 70 70 | 71 71 | print("%s \N{snowman}" % (a,)) -UP031_0.py:71:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:71:7: UP031 [*] Use format specifiers instead of percent format | 69 | ) 70 | @@ -585,7 +585,7 @@ UP031_0.py:71:7: UP031 [**] Use format specifiers instead of percent format 73 73 | print("%(foo)s \N{snowman}" % {"foo": 1}) 74 74 | -UP031_0.py:73:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:73:7: UP031 [*] Use format specifiers instead of percent format | 71 | print("%s \N{snowman}" % (a,)) 72 | @@ -606,7 +606,7 @@ UP031_0.py:73:7: UP031 [**] Use format specifiers instead of percent format 75 75 | print(("foo %s " "bar %s") % (x, y)) 76 76 | -UP031_0.py:75:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:75:7: UP031 [*] Use format specifiers instead of percent format | 73 | print("%(foo)s \N{snowman}" % {"foo": 1}) 74 | @@ -627,7 +627,7 @@ UP031_0.py:75:7: UP031 [**] Use format specifiers instead of percent format 77 77 | # Single-value expressions 78 78 | print('Hello %s' % "World") -UP031_0.py:78:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:78:7: UP031 [*] Use format specifiers instead of percent format | 77 | # Single-value expressions 78 | print('Hello %s' % "World") @@ -647,7 +647,7 @@ UP031_0.py:78:7: UP031 [**] Use format specifiers instead of percent format 80 80 | print('Hello %s (%s)' % bar) 81 81 | print('Hello %s (%s)' % bar.baz) -UP031_0.py:79:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format | 77 | # Single-value expressions 78 | print('Hello %s' % "World") @@ -668,7 +668,7 @@ UP031_0.py:79:7: UP031 [**] Use format specifiers instead of percent format 81 81 | print('Hello %s (%s)' % bar.baz) 82 82 | print('Hello %s (%s)' % bar['bop']) -UP031_0.py:80:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format | 78 | print('Hello %s' % "World") 79 | print('Hello %s' % f"World") @@ -689,7 +689,7 @@ UP031_0.py:80:7: UP031 [**] Use format specifiers instead of percent format 82 82 | print('Hello %s (%s)' % bar['bop']) 83 83 | print('Hello %(arg)s' % bar) -UP031_0.py:81:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format | 79 | print('Hello %s' % f"World") 80 | print('Hello %s (%s)' % bar) @@ -710,7 +710,7 @@ UP031_0.py:81:7: UP031 [**] Use format specifiers instead of percent format 83 83 | print('Hello %(arg)s' % bar) 84 84 | print('Hello %(arg)s' % bar.baz) -UP031_0.py:82:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format | 80 | print('Hello %s (%s)' % bar) 81 | print('Hello %s (%s)' % bar.baz) @@ -731,7 +731,7 @@ UP031_0.py:82:7: UP031 [**] Use format specifiers instead of percent format 84 84 | print('Hello %(arg)s' % bar.baz) 85 85 | print('Hello %(arg)s' % bar['bop']) -UP031_0.py:83:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format | 81 | print('Hello %s (%s)' % bar.baz) 82 | print('Hello %s (%s)' % bar['bop']) @@ -752,7 +752,7 @@ UP031_0.py:83:7: UP031 [**] Use format specifiers instead of percent format 85 85 | print('Hello %(arg)s' % bar['bop']) 86 86 | -UP031_0.py:84:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format | 82 | print('Hello %s (%s)' % bar['bop']) 83 | print('Hello %(arg)s' % bar) @@ -772,7 +772,7 @@ UP031_0.py:84:7: UP031 [**] Use format specifiers instead of percent format 86 86 | 87 87 | # Hanging modulos -UP031_0.py:85:7: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format | 83 | print('Hello %(arg)s' % bar) 84 | print('Hello %(arg)s' % bar.baz) @@ -793,7 +793,7 @@ UP031_0.py:85:7: UP031 [**] Use format specifiers instead of percent format 87 87 | # Hanging modulos 88 88 | ( -UP031_0.py:88:1: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:88:1: UP031 [*] Use format specifiers instead of percent format | 87 | # Hanging modulos 88 | / ( @@ -820,7 +820,7 @@ UP031_0.py:88:1: UP031 [**] Use format specifiers instead of percent format 93 93 | ( 94 94 | "foo %(foo)s " -UP031_0.py:93:1: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:93:1: UP031 [*] Use format specifiers instead of percent format | 91 | ) % (x, y) 92 | @@ -848,7 +848,7 @@ UP031_0.py:93:1: UP031 [**] Use format specifiers instead of percent format 98 98 | ( 99 99 | """foo %s""" -UP031_0.py:99:5: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:99:5: UP031 [*] Use format specifiers instead of percent format | 98 | ( 99 | """foo %s""" @@ -870,7 +870,7 @@ UP031_0.py:99:5: UP031 [**] Use format specifiers instead of percent format 102 101 | 103 102 | ( -UP031_0.py:104:5: UP031 [**] Use format specifiers instead of percent format +UP031_0.py:104:5: UP031 [*] Use format specifiers instead of percent format | 103 | ( 104 | """ diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap index 51b045dc87c335..8771bfd691ac23 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP032_0.py:5:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:5:1: UP032 [*] Use f-string instead of `format` call | 3 | ### 4 | @@ -22,7 +22,7 @@ UP032_0.py:5:1: UP032 [**] Use f-string instead of `format` call 7 7 | "{1} {0}".format(a, b) 8 8 | -UP032_0.py:7:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:7:1: UP032 [*] Use f-string instead of `format` call | 5 | "{} {}".format(a, b) 6 | @@ -43,7 +43,7 @@ UP032_0.py:7:1: UP032 [**] Use f-string instead of `format` call 9 9 | "{0} {1} {0}".format(a, b) 10 10 | -UP032_0.py:9:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:9:1: UP032 [*] Use f-string instead of `format` call | 7 | "{1} {0}".format(a, b) 8 | @@ -64,7 +64,7 @@ UP032_0.py:9:1: UP032 [**] Use f-string instead of `format` call 11 11 | "{x.y}".format(x=z) 12 12 | -UP032_0.py:11:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:11:1: UP032 [*] Use f-string instead of `format` call | 9 | "{0} {1} {0}".format(a, b) 10 | @@ -85,7 +85,7 @@ UP032_0.py:11:1: UP032 [**] Use f-string instead of `format` call 13 13 | "{x} {y} {x}".format(x=a, y=b) 14 14 | -UP032_0.py:13:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:13:1: UP032 [*] Use f-string instead of `format` call | 11 | "{x.y}".format(x=z) 12 | @@ -106,7 +106,7 @@ UP032_0.py:13:1: UP032 [**] Use f-string instead of `format` call 15 15 | "{.x} {.y}".format(a, b) 16 16 | -UP032_0.py:15:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:15:1: UP032 [*] Use f-string instead of `format` call | 13 | "{x} {y} {x}".format(x=a, y=b) 14 | @@ -127,7 +127,7 @@ UP032_0.py:15:1: UP032 [**] Use f-string instead of `format` call 17 17 | "{} {}".format(a.b, c.d) 18 18 | -UP032_0.py:17:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:17:1: UP032 [*] Use f-string instead of `format` call | 15 | "{.x} {.y}".format(a, b) 16 | @@ -148,7 +148,7 @@ UP032_0.py:17:1: UP032 [**] Use f-string instead of `format` call 19 19 | "{}".format(a()) 20 20 | -UP032_0.py:19:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:19:1: UP032 [*] Use f-string instead of `format` call | 17 | "{} {}".format(a.b, c.d) 18 | @@ -169,7 +169,7 @@ UP032_0.py:19:1: UP032 [**] Use f-string instead of `format` call 21 21 | "{}".format(a.b()) 22 22 | -UP032_0.py:21:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:21:1: UP032 [*] Use f-string instead of `format` call | 19 | "{}".format(a()) 20 | @@ -190,7 +190,7 @@ UP032_0.py:21:1: UP032 [**] Use f-string instead of `format` call 23 23 | "{}".format(a.b().c()) 24 24 | -UP032_0.py:23:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:23:1: UP032 [*] Use f-string instead of `format` call | 21 | "{}".format(a.b()) 22 | @@ -211,7 +211,7 @@ UP032_0.py:23:1: UP032 [**] Use f-string instead of `format` call 25 25 | "hello {}!".format(name) 26 26 | -UP032_0.py:25:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:25:1: UP032 [*] Use f-string instead of `format` call | 23 | "{}".format(a.b().c()) 24 | @@ -232,7 +232,7 @@ UP032_0.py:25:1: UP032 [**] Use f-string instead of `format` call 27 27 | "{}{b}{}".format(a, c, b=b) 28 28 | -UP032_0.py:27:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:27:1: UP032 [*] Use f-string instead of `format` call | 25 | "hello {}!".format(name) 26 | @@ -253,7 +253,7 @@ UP032_0.py:27:1: UP032 [**] Use f-string instead of `format` call 29 29 | "{}".format(0x0) 30 30 | -UP032_0.py:29:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:29:1: UP032 [*] Use f-string instead of `format` call | 27 | "{}{b}{}".format(a, c, b=b) 28 | @@ -274,7 +274,7 @@ UP032_0.py:29:1: UP032 [**] Use f-string instead of `format` call 31 31 | "{} {}".format(a, b) 32 32 | -UP032_0.py:31:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:31:1: UP032 [*] Use f-string instead of `format` call | 29 | "{}".format(0x0) 30 | @@ -295,7 +295,7 @@ UP032_0.py:31:1: UP032 [**] Use f-string instead of `format` call 33 33 | """{} {}""".format(a, b) 34 34 | -UP032_0.py:33:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:33:1: UP032 [*] Use f-string instead of `format` call | 31 | "{} {}".format(a, b) 32 | @@ -316,7 +316,7 @@ UP032_0.py:33:1: UP032 [**] Use f-string instead of `format` call 35 35 | "foo{}".format(1) 36 36 | -UP032_0.py:35:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:35:1: UP032 [*] Use f-string instead of `format` call | 33 | """{} {}""".format(a, b) 34 | @@ -337,7 +337,7 @@ UP032_0.py:35:1: UP032 [**] Use f-string instead of `format` call 37 37 | r"foo{}".format(1) 38 38 | -UP032_0.py:37:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:37:1: UP032 [*] Use f-string instead of `format` call | 35 | "foo{}".format(1) 36 | @@ -358,7 +358,7 @@ UP032_0.py:37:1: UP032 [**] Use f-string instead of `format` call 39 39 | x = "{a}".format(a=1) 40 40 | -UP032_0.py:39:5: UP032 [**] Use f-string instead of `format` call +UP032_0.py:39:5: UP032 [*] Use f-string instead of `format` call | 37 | r"foo{}".format(1) 38 | @@ -379,7 +379,7 @@ UP032_0.py:39:5: UP032 [**] Use f-string instead of `format` call 41 41 | print("foo {} ".format(x)) 42 42 | -UP032_0.py:41:7: UP032 [**] Use f-string instead of `format` call +UP032_0.py:41:7: UP032 [*] Use f-string instead of `format` call | 39 | x = "{a}".format(a=1) 40 | @@ -400,7 +400,7 @@ UP032_0.py:41:7: UP032 [**] Use f-string instead of `format` call 43 43 | "{a[b]}".format(a=a) 44 44 | -UP032_0.py:43:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:43:1: UP032 [*] Use f-string instead of `format` call | 41 | print("foo {} ".format(x)) 42 | @@ -421,7 +421,7 @@ UP032_0.py:43:1: UP032 [**] Use f-string instead of `format` call 45 45 | "{a.a[b]}".format(a=a) 46 46 | -UP032_0.py:45:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:45:1: UP032 [*] Use f-string instead of `format` call | 43 | "{a[b]}".format(a=a) 44 | @@ -442,7 +442,7 @@ UP032_0.py:45:1: UP032 [**] Use f-string instead of `format` call 47 47 | "{}{{}}{}".format(escaped, y) 48 48 | -UP032_0.py:47:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:47:1: UP032 [*] Use f-string instead of `format` call | 45 | "{a.a[b]}".format(a=a) 46 | @@ -463,7 +463,7 @@ UP032_0.py:47:1: UP032 [**] Use f-string instead of `format` call 49 49 | "{}".format(a) 50 50 | -UP032_0.py:49:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:49:1: UP032 [*] Use f-string instead of `format` call | 47 | "{}{{}}{}".format(escaped, y) 48 | @@ -484,7 +484,7 @@ UP032_0.py:49:1: UP032 [**] Use f-string instead of `format` call 51 51 | '({}={{0!e}})'.format(a) 52 52 | -UP032_0.py:51:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:51:1: UP032 [*] Use f-string instead of `format` call | 49 | "{}".format(a) 50 | @@ -505,7 +505,7 @@ UP032_0.py:51:1: UP032 [**] Use f-string instead of `format` call 53 53 | "{[b]}".format(a) 54 54 | -UP032_0.py:53:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:53:1: UP032 [*] Use f-string instead of `format` call | 51 | '({}={{0!e}})'.format(a) 52 | @@ -526,7 +526,7 @@ UP032_0.py:53:1: UP032 [**] Use f-string instead of `format` call 55 55 | '{[b]}'.format(a) 56 56 | -UP032_0.py:55:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:55:1: UP032 [*] Use f-string instead of `format` call | 53 | "{[b]}".format(a) 54 | @@ -547,7 +547,7 @@ UP032_0.py:55:1: UP032 [**] Use f-string instead of `format` call 57 57 | """{[b]}""".format(a) 58 58 | -UP032_0.py:57:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:57:1: UP032 [*] Use f-string instead of `format` call | 55 | '{[b]}'.format(a) 56 | @@ -568,7 +568,7 @@ UP032_0.py:57:1: UP032 [**] Use f-string instead of `format` call 59 59 | '''{[b]}'''.format(a) 60 60 | -UP032_0.py:59:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:59:1: UP032 [*] Use f-string instead of `format` call | 57 | """{[b]}""".format(a) 58 | @@ -589,7 +589,7 @@ UP032_0.py:59:1: UP032 [**] Use f-string instead of `format` call 61 61 | "{}".format( 62 62 | 1 -UP032_0.py:61:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:61:1: UP032 [*] Use f-string instead of `format` call | 59 | '''{[b]}'''.format(a) 60 | @@ -614,7 +614,7 @@ UP032_0.py:61:1: UP032 [**] Use f-string instead of `format` call 65 63 | "123456789 {}".format( 66 64 | 1111111111111111111111111111111111111111111111111111111111111111111111111, -UP032_0.py:65:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:65:1: UP032 [*] Use f-string instead of `format` call | 63 | ) 64 | @@ -639,7 +639,7 @@ UP032_0.py:65:1: UP032 [**] Use f-string instead of `format` call 69 67 | """ 70 68 | {} -UP032_0.py:69:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:69:1: UP032 [*] Use f-string instead of `format` call | 67 | ) 68 | @@ -665,7 +665,7 @@ UP032_0.py:69:1: UP032 [**] Use f-string instead of `format` call 73 73 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = """ 74 74 | {} -UP032_0.py:73:85: UP032 [**] Use f-string instead of `format` call +UP032_0.py:73:85: UP032 [*] Use f-string instead of `format` call | 71 | """.format(1) 72 | @@ -697,7 +697,7 @@ UP032_0.py:73:85: UP032 [**] Use f-string instead of `format` call 79 77 | "{a}" "{b}".format(a=1, b=1) 80 78 | -UP032_0.py:79:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:79:1: UP032 [*] Use f-string instead of `format` call | 77 | ) 78 | @@ -718,7 +718,7 @@ UP032_0.py:79:1: UP032 [**] Use f-string instead of `format` call 81 81 | ( 82 82 | "{a}" -UP032_0.py:81:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:81:1: UP032 [*] Use f-string instead of `format` call | 79 | "{a}" "{b}".format(a=1, b=1) 80 | @@ -746,7 +746,7 @@ UP032_0.py:81:1: UP032 [**] Use f-string instead of `format` call 86 86 | ( 87 87 | "{a}" -UP032_0.py:86:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:86:1: UP032 [*] Use f-string instead of `format` call | 84 | ).format(a=1, b=1) 85 | @@ -778,7 +778,7 @@ UP032_0.py:86:1: UP032 [**] Use f-string instead of `format` call 93 93 | ( 94 94 | ( -UP032_0.py:94:5: UP032 [**] Use f-string instead of `format` call +UP032_0.py:94:5: UP032 [*] Use f-string instead of `format` call | 93 | ( 94 | ( @@ -812,7 +812,7 @@ UP032_0.py:94:5: UP032 [**] Use f-string instead of `format` call 103 103 | 104 104 | ( -UP032_0.py:104:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:104:1: UP032 [*] Use f-string instead of `format` call | 102 | ) 103 | @@ -837,7 +837,7 @@ UP032_0.py:104:1: UP032 [**] Use f-string instead of `format` call 109 109 | 110 110 | def d(osname, version, release): -UP032_0.py:111:11: UP032 [**] Use f-string instead of `format` call +UP032_0.py:111:11: UP032 [*] Use f-string instead of `format` call | 110 | def d(osname, version, release): 111 | return"{}-{}.{}".format(osname, version, release) @@ -855,7 +855,7 @@ UP032_0.py:111:11: UP032 [**] Use f-string instead of `format` call 113 113 | 114 114 | def e(): -UP032_0.py:115:10: UP032 [**] Use f-string instead of `format` call +UP032_0.py:115:10: UP032 [*] Use f-string instead of `format` call | 114 | def e(): 115 | yield"{}".format(1) @@ -873,7 +873,7 @@ UP032_0.py:115:10: UP032 [**] Use f-string instead of `format` call 117 117 | 118 118 | assert"{}".format(1) -UP032_0.py:118:7: UP032 [**] Use f-string instead of `format` call +UP032_0.py:118:7: UP032 [*] Use f-string instead of `format` call | 118 | assert"{}".format(1) | ^^^^^^^^^^^^^^ UP032 @@ -890,7 +890,7 @@ UP032_0.py:118:7: UP032 [**] Use f-string instead of `format` call 120 120 | 121 121 | async def c(): -UP032_0.py:122:12: UP032 [**] Use f-string instead of `format` call +UP032_0.py:122:12: UP032 [*] Use f-string instead of `format` call | 121 | async def c(): 122 | return "{}".format(await 3) @@ -908,7 +908,7 @@ UP032_0.py:122:12: UP032 [**] Use f-string instead of `format` call 124 124 | 125 125 | async def c(): -UP032_0.py:126:12: UP032 [**] Use f-string instead of `format` call +UP032_0.py:126:12: UP032 [*] Use f-string instead of `format` call | 125 | async def c(): 126 | return "{}".format(1 + await 3) @@ -926,7 +926,7 @@ UP032_0.py:126:12: UP032 [**] Use f-string instead of `format` call 128 128 | 129 129 | "{}".format(1 * 2) -UP032_0.py:129:1: UP032 [**] Use f-string instead of `format` call +UP032_0.py:129:1: UP032 [*] Use f-string instead of `format` call | 129 | "{}".format(1 * 2) | ^^^^^^^^^^^^^^^^^^ UP032 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap index 4c9b55db80c815..1d879bf62a1ec0 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP032_1.py:1:1: UP032 [**] Use f-string instead of `format` call +UP032_1.py:1:1: UP032 [*] Use f-string instead of `format` call | 1 | "{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. | ^^^^^^^^^^^^^^^^^^^^ UP032 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap index 0dbb9b0d745d5f..5751783cf76ab2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP032_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP032_2.py:2:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:2:1: UP032 [*] Use f-string instead of `format` call | 1 | # Errors 2 | "{.real}".format(1) @@ -19,7 +19,7 @@ UP032_2.py:2:1: UP032 [**] Use f-string instead of `format` call 4 4 | "{a.real}".format(a=1) 5 5 | -UP032_2.py:3:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:3:1: UP032 [*] Use f-string instead of `format` call | 1 | # Errors 2 | "{.real}".format(1) @@ -38,7 +38,7 @@ UP032_2.py:3:1: UP032 [**] Use f-string instead of `format` call 5 5 | 6 6 | "{.real}".format(1.0) -UP032_2.py:4:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:4:1: UP032 [*] Use f-string instead of `format` call | 2 | "{.real}".format(1) 3 | "{0.real}".format(1) @@ -59,7 +59,7 @@ UP032_2.py:4:1: UP032 [**] Use f-string instead of `format` call 6 6 | "{.real}".format(1.0) 7 7 | "{0.real}".format(1.0) -UP032_2.py:6:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:6:1: UP032 [*] Use f-string instead of `format` call | 4 | "{a.real}".format(a=1) 5 | @@ -80,7 +80,7 @@ UP032_2.py:6:1: UP032 [**] Use f-string instead of `format` call 8 8 | "{a.real}".format(a=1.0) 9 9 | -UP032_2.py:7:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:7:1: UP032 [*] Use f-string instead of `format` call | 6 | "{.real}".format(1.0) 7 | "{0.real}".format(1.0) @@ -99,7 +99,7 @@ UP032_2.py:7:1: UP032 [**] Use f-string instead of `format` call 9 9 | 10 10 | "{.real}".format(1j) -UP032_2.py:8:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:8:1: UP032 [*] Use f-string instead of `format` call | 6 | "{.real}".format(1.0) 7 | "{0.real}".format(1.0) @@ -120,7 +120,7 @@ UP032_2.py:8:1: UP032 [**] Use f-string instead of `format` call 10 10 | "{.real}".format(1j) 11 11 | "{0.real}".format(1j) -UP032_2.py:10:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:10:1: UP032 [*] Use f-string instead of `format` call | 8 | "{a.real}".format(a=1.0) 9 | @@ -141,7 +141,7 @@ UP032_2.py:10:1: UP032 [**] Use f-string instead of `format` call 12 12 | "{a.real}".format(a=1j) 13 13 | -UP032_2.py:11:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:11:1: UP032 [*] Use f-string instead of `format` call | 10 | "{.real}".format(1j) 11 | "{0.real}".format(1j) @@ -160,7 +160,7 @@ UP032_2.py:11:1: UP032 [**] Use f-string instead of `format` call 13 13 | 14 14 | "{.real}".format(0b01) -UP032_2.py:12:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:12:1: UP032 [*] Use f-string instead of `format` call | 10 | "{.real}".format(1j) 11 | "{0.real}".format(1j) @@ -181,7 +181,7 @@ UP032_2.py:12:1: UP032 [**] Use f-string instead of `format` call 14 14 | "{.real}".format(0b01) 15 15 | "{0.real}".format(0b01) -UP032_2.py:14:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:14:1: UP032 [*] Use f-string instead of `format` call | 12 | "{a.real}".format(a=1j) 13 | @@ -202,7 +202,7 @@ UP032_2.py:14:1: UP032 [**] Use f-string instead of `format` call 16 16 | "{a.real}".format(a=0b01) 17 17 | -UP032_2.py:15:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:15:1: UP032 [*] Use f-string instead of `format` call | 14 | "{.real}".format(0b01) 15 | "{0.real}".format(0b01) @@ -221,7 +221,7 @@ UP032_2.py:15:1: UP032 [**] Use f-string instead of `format` call 17 17 | 18 18 | "{}".format(1 + 2) -UP032_2.py:16:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:16:1: UP032 [*] Use f-string instead of `format` call | 14 | "{.real}".format(0b01) 15 | "{0.real}".format(0b01) @@ -242,7 +242,7 @@ UP032_2.py:16:1: UP032 [**] Use f-string instead of `format` call 18 18 | "{}".format(1 + 2) 19 19 | "{}".format([1, 2]) -UP032_2.py:18:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:18:1: UP032 [*] Use f-string instead of `format` call | 16 | "{a.real}".format(a=0b01) 17 | @@ -263,7 +263,7 @@ UP032_2.py:18:1: UP032 [**] Use f-string instead of `format` call 20 20 | "{}".format({1, 2}) 21 21 | "{}".format({1: 2, 3: 4}) -UP032_2.py:19:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:19:1: UP032 [*] Use f-string instead of `format` call | 18 | "{}".format(1 + 2) 19 | "{}".format([1, 2]) @@ -283,7 +283,7 @@ UP032_2.py:19:1: UP032 [**] Use f-string instead of `format` call 21 21 | "{}".format({1: 2, 3: 4}) 22 22 | "{}".format((i for i in range(2))) -UP032_2.py:20:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:20:1: UP032 [*] Use f-string instead of `format` call | 18 | "{}".format(1 + 2) 19 | "{}".format([1, 2]) @@ -304,7 +304,7 @@ UP032_2.py:20:1: UP032 [**] Use f-string instead of `format` call 22 22 | "{}".format((i for i in range(2))) 23 23 | -UP032_2.py:21:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:21:1: UP032 [*] Use f-string instead of `format` call | 19 | "{}".format([1, 2]) 20 | "{}".format({1, 2}) @@ -324,7 +324,7 @@ UP032_2.py:21:1: UP032 [**] Use f-string instead of `format` call 23 23 | 24 24 | "{.real}".format(1 + 2) -UP032_2.py:22:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:22:1: UP032 [*] Use f-string instead of `format` call | 20 | "{}".format({1, 2}) 21 | "{}".format({1: 2, 3: 4}) @@ -345,7 +345,7 @@ UP032_2.py:22:1: UP032 [**] Use f-string instead of `format` call 24 24 | "{.real}".format(1 + 2) 25 25 | "{.real}".format([1, 2]) -UP032_2.py:24:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:24:1: UP032 [*] Use f-string instead of `format` call | 22 | "{}".format((i for i in range(2))) 23 | @@ -366,7 +366,7 @@ UP032_2.py:24:1: UP032 [**] Use f-string instead of `format` call 26 26 | "{.real}".format({1, 2}) 27 27 | "{.real}".format({1: 2, 3: 4}) -UP032_2.py:25:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:25:1: UP032 [*] Use f-string instead of `format` call | 24 | "{.real}".format(1 + 2) 25 | "{.real}".format([1, 2]) @@ -386,7 +386,7 @@ UP032_2.py:25:1: UP032 [**] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) -UP032_2.py:26:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:26:1: UP032 [*] Use f-string instead of `format` call | 24 | "{.real}".format(1 + 2) 25 | "{.real}".format([1, 2]) @@ -406,7 +406,7 @@ UP032_2.py:26:1: UP032 [**] Use f-string instead of `format` call 27 27 | "{.real}".format({1: 2, 3: 4}) 28 28 | "{}".format((i for i in range(2))) -UP032_2.py:27:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:27:1: UP032 [*] Use f-string instead of `format` call | 25 | "{.real}".format([1, 2]) 26 | "{.real}".format({1, 2}) @@ -424,7 +424,7 @@ UP032_2.py:27:1: UP032 [**] Use f-string instead of `format` call 27 |+f"{({1: 2, 3: 4}).real}" 28 28 | "{}".format((i for i in range(2))) -UP032_2.py:28:1: UP032 [**] Use f-string instead of `format` call +UP032_2.py:28:1: UP032 [*] Use f-string instead of `format` call | 26 | "{.real}".format({1, 2}) 27 | "{.real}".format({1: 2, 3: 4}) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap index ac70395f62ac41..4f8c750737ee2e 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP035.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP035.py:2:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:2:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 1 | # UP035 2 | from collections import Mapping @@ -19,7 +19,7 @@ UP035.py:2:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 4 4 | from collections import Mapping as MAP 5 5 | -UP035.py:4:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:4:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 2 | from collections import Mapping 3 | @@ -40,7 +40,7 @@ UP035.py:4:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 6 6 | from collections import Mapping, Sequence 7 7 | -UP035.py:6:1: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Sequence` +UP035.py:6:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` | 4 | from collections import Mapping as MAP 5 | @@ -61,7 +61,7 @@ UP035.py:6:1: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Sequ 8 8 | from collections import Counter, Mapping 9 9 | -UP035.py:8:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:8:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 6 | from collections import Mapping, Sequence 7 | @@ -83,7 +83,7 @@ UP035.py:8:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 10 11 | from collections import (Counter, Mapping) 11 12 | -UP035.py:10:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:10:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 8 | from collections import Counter, Mapping 9 | @@ -105,7 +105,7 @@ UP035.py:10:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 12 13 | from collections import (Counter, 13 14 | Mapping) -UP035.py:12:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:12:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 10 | from collections import (Counter, Mapping) 11 | @@ -129,7 +129,7 @@ UP035.py:12:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 15 15 | from collections import Counter, \ 16 16 | Mapping -UP035.py:15:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:15:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 13 | Mapping) 14 | @@ -153,7 +153,7 @@ UP035.py:15:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 18 18 | from collections import Counter, Mapping, Sequence 19 19 | -UP035.py:18:1: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Sequence` +UP035.py:18:1: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Sequence` | 16 | Mapping 17 | @@ -175,7 +175,7 @@ UP035.py:18:1: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Seq 20 21 | from collections import Mapping as mapping, Counter 21 22 | -UP035.py:20:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:20:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 18 | from collections import Counter, Mapping, Sequence 19 | @@ -197,7 +197,7 @@ UP035.py:20:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 22 23 | if True: 23 24 | from collections import Mapping, Counter -UP035.py:23:5: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:23:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | 22 | if True: 23 | from collections import Mapping, Counter @@ -218,7 +218,7 @@ UP035.py:23:5: UP035 [**] Import from `collections.abc` instead: `Mapping` 25 26 | if True: 26 27 | if True: -UP035.py:28:5: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:28:5: UP035 [*] Import from `collections.abc` instead: `Mapping` | 26 | if True: 27 | pass @@ -240,7 +240,7 @@ UP035.py:28:5: UP035 [**] Import from `collections.abc` instead: `Mapping` 30 31 | if True: from collections import Mapping 31 32 | -UP035.py:30:10: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:30:10: UP035 [*] Import from `collections.abc` instead: `Mapping` | 28 | from collections import Mapping, Counter 29 | @@ -261,7 +261,7 @@ UP035.py:30:10: UP035 [**] Import from `collections.abc` instead: `Mapping` 32 32 | import os 33 33 | from collections import Counter, Mapping -UP035.py:33:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:33:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 32 | import os 33 | from collections import Counter, Mapping @@ -281,7 +281,7 @@ UP035.py:33:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 35 36 | 36 37 | if True: -UP035.py:37:5: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Callable` +UP035.py:37:5: UP035 [*] Import from `collections.abc` instead: `Mapping`, `Callable` | 36 | if True: 37 | from collections import ( @@ -311,7 +311,7 @@ UP035.py:37:5: UP035 [**] Import from `collections.abc` instead: `Mapping`, `Cal 44 43 | from typing import Callable, Match, Pattern, List, OrderedDict, AbstractSet, ContextManager 45 44 | -UP035.py:44:1: UP035 [**] Import from `collections.abc` instead: `Callable` +UP035.py:44:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 42 | ) 43 | @@ -333,7 +333,7 @@ UP035.py:44:1: UP035 [**] Import from `collections.abc` instead: `Callable` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) -UP035.py:44:1: UP035 [**] Import from `collections` instead: `OrderedDict` +UP035.py:44:1: UP035 [*] Import from `collections` instead: `OrderedDict` | 42 | ) 43 | @@ -355,7 +355,7 @@ UP035.py:44:1: UP035 [**] Import from `collections` instead: `OrderedDict` 46 47 | if True: from collections import ( 47 48 | Mapping, Counter) -UP035.py:44:1: UP035 [**] Import from `re` instead: `Match`, `Pattern` +UP035.py:44:1: UP035 [*] Import from `re` instead: `Match`, `Pattern` | 42 | ) 43 | @@ -429,7 +429,7 @@ UP035.py:50:1: UP035 `typing.ContextManager` is deprecated, use `contextlib.Abst 52 | from typing_extensions import OrderedDict | -UP035.py:51:1: UP035 [**] Import from `collections` instead: `OrderedDict` +UP035.py:51:1: UP035 [*] Import from `collections` instead: `OrderedDict` | 49 | # Bad imports from PYI027 that are now handled by PYI022 (UP035) 50 | from typing import ContextManager @@ -450,7 +450,7 @@ UP035.py:51:1: UP035 [**] Import from `collections` instead: `OrderedDict` 53 53 | from typing import Callable 54 54 | from typing import ByteString -UP035.py:52:1: UP035 [**] Import from `typing` instead: `OrderedDict` +UP035.py:52:1: UP035 [*] Import from `typing` instead: `OrderedDict` | 50 | from typing import ContextManager 51 | from typing import OrderedDict @@ -471,7 +471,7 @@ UP035.py:52:1: UP035 [**] Import from `typing` instead: `OrderedDict` 54 54 | from typing import ByteString 55 55 | from typing import Container -UP035.py:53:1: UP035 [**] Import from `collections.abc` instead: `Callable` +UP035.py:53:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 51 | from typing import OrderedDict 52 | from typing_extensions import OrderedDict @@ -492,7 +492,7 @@ UP035.py:53:1: UP035 [**] Import from `collections.abc` instead: `Callable` 55 55 | from typing import Container 56 56 | from typing import Hashable -UP035.py:54:1: UP035 [**] Import from `collections.abc` instead: `ByteString` +UP035.py:54:1: UP035 [*] Import from `collections.abc` instead: `ByteString` | 52 | from typing_extensions import OrderedDict 53 | from typing import Callable @@ -513,7 +513,7 @@ UP035.py:54:1: UP035 [**] Import from `collections.abc` instead: `ByteString` 56 56 | from typing import Hashable 57 57 | from typing import ItemsView -UP035.py:55:1: UP035 [**] Import from `collections.abc` instead: `Container` +UP035.py:55:1: UP035 [*] Import from `collections.abc` instead: `Container` | 53 | from typing import Callable 54 | from typing import ByteString @@ -534,7 +534,7 @@ UP035.py:55:1: UP035 [**] Import from `collections.abc` instead: `Container` 57 57 | from typing import ItemsView 58 58 | from typing import Iterable -UP035.py:56:1: UP035 [**] Import from `collections.abc` instead: `Hashable` +UP035.py:56:1: UP035 [*] Import from `collections.abc` instead: `Hashable` | 54 | from typing import ByteString 55 | from typing import Container @@ -555,7 +555,7 @@ UP035.py:56:1: UP035 [**] Import from `collections.abc` instead: `Hashable` 58 58 | from typing import Iterable 59 59 | from typing import Iterator -UP035.py:57:1: UP035 [**] Import from `collections.abc` instead: `ItemsView` +UP035.py:57:1: UP035 [*] Import from `collections.abc` instead: `ItemsView` | 55 | from typing import Container 56 | from typing import Hashable @@ -576,7 +576,7 @@ UP035.py:57:1: UP035 [**] Import from `collections.abc` instead: `ItemsView` 59 59 | from typing import Iterator 60 60 | from typing import KeysView -UP035.py:58:1: UP035 [**] Import from `collections.abc` instead: `Iterable` +UP035.py:58:1: UP035 [*] Import from `collections.abc` instead: `Iterable` | 56 | from typing import Hashable 57 | from typing import ItemsView @@ -597,7 +597,7 @@ UP035.py:58:1: UP035 [**] Import from `collections.abc` instead: `Iterable` 60 60 | from typing import KeysView 61 61 | from typing import Mapping -UP035.py:59:1: UP035 [**] Import from `collections.abc` instead: `Iterator` +UP035.py:59:1: UP035 [*] Import from `collections.abc` instead: `Iterator` | 57 | from typing import ItemsView 58 | from typing import Iterable @@ -618,7 +618,7 @@ UP035.py:59:1: UP035 [**] Import from `collections.abc` instead: `Iterator` 61 61 | from typing import Mapping 62 62 | from typing import MappingView -UP035.py:60:1: UP035 [**] Import from `collections.abc` instead: `KeysView` +UP035.py:60:1: UP035 [*] Import from `collections.abc` instead: `KeysView` | 58 | from typing import Iterable 59 | from typing import Iterator @@ -639,7 +639,7 @@ UP035.py:60:1: UP035 [**] Import from `collections.abc` instead: `KeysView` 62 62 | from typing import MappingView 63 63 | from typing import MutableMapping -UP035.py:61:1: UP035 [**] Import from `collections.abc` instead: `Mapping` +UP035.py:61:1: UP035 [*] Import from `collections.abc` instead: `Mapping` | 59 | from typing import Iterator 60 | from typing import KeysView @@ -660,7 +660,7 @@ UP035.py:61:1: UP035 [**] Import from `collections.abc` instead: `Mapping` 63 63 | from typing import MutableMapping 64 64 | from typing import MutableSequence -UP035.py:62:1: UP035 [**] Import from `collections.abc` instead: `MappingView` +UP035.py:62:1: UP035 [*] Import from `collections.abc` instead: `MappingView` | 60 | from typing import KeysView 61 | from typing import Mapping @@ -681,7 +681,7 @@ UP035.py:62:1: UP035 [**] Import from `collections.abc` instead: `MappingView` 64 64 | from typing import MutableSequence 65 65 | from typing import MutableSet -UP035.py:63:1: UP035 [**] Import from `collections.abc` instead: `MutableMapping` +UP035.py:63:1: UP035 [*] Import from `collections.abc` instead: `MutableMapping` | 61 | from typing import Mapping 62 | from typing import MappingView @@ -702,7 +702,7 @@ UP035.py:63:1: UP035 [**] Import from `collections.abc` instead: `MutableMapping 65 65 | from typing import MutableSet 66 66 | from typing import Sequence -UP035.py:64:1: UP035 [**] Import from `collections.abc` instead: `MutableSequence` +UP035.py:64:1: UP035 [*] Import from `collections.abc` instead: `MutableSequence` | 62 | from typing import MappingView 63 | from typing import MutableMapping @@ -723,7 +723,7 @@ UP035.py:64:1: UP035 [**] Import from `collections.abc` instead: `MutableSequenc 66 66 | from typing import Sequence 67 67 | from typing import Sized -UP035.py:65:1: UP035 [**] Import from `collections.abc` instead: `MutableSet` +UP035.py:65:1: UP035 [*] Import from `collections.abc` instead: `MutableSet` | 63 | from typing import MutableMapping 64 | from typing import MutableSequence @@ -744,7 +744,7 @@ UP035.py:65:1: UP035 [**] Import from `collections.abc` instead: `MutableSet` 67 67 | from typing import Sized 68 68 | from typing import ValuesView -UP035.py:66:1: UP035 [**] Import from `collections.abc` instead: `Sequence` +UP035.py:66:1: UP035 [*] Import from `collections.abc` instead: `Sequence` | 64 | from typing import MutableSequence 65 | from typing import MutableSet @@ -765,7 +765,7 @@ UP035.py:66:1: UP035 [**] Import from `collections.abc` instead: `Sequence` 68 68 | from typing import ValuesView 69 69 | from typing import Awaitable -UP035.py:67:1: UP035 [**] Import from `collections.abc` instead: `Sized` +UP035.py:67:1: UP035 [*] Import from `collections.abc` instead: `Sized` | 65 | from typing import MutableSet 66 | from typing import Sequence @@ -786,7 +786,7 @@ UP035.py:67:1: UP035 [**] Import from `collections.abc` instead: `Sized` 69 69 | from typing import Awaitable 70 70 | from typing import AsyncIterator -UP035.py:68:1: UP035 [**] Import from `collections.abc` instead: `ValuesView` +UP035.py:68:1: UP035 [*] Import from `collections.abc` instead: `ValuesView` | 66 | from typing import Sequence 67 | from typing import Sized @@ -807,7 +807,7 @@ UP035.py:68:1: UP035 [**] Import from `collections.abc` instead: `ValuesView` 70 70 | from typing import AsyncIterator 71 71 | from typing import AsyncIterable -UP035.py:69:1: UP035 [**] Import from `collections.abc` instead: `Awaitable` +UP035.py:69:1: UP035 [*] Import from `collections.abc` instead: `Awaitable` | 67 | from typing import Sized 68 | from typing import ValuesView @@ -828,7 +828,7 @@ UP035.py:69:1: UP035 [**] Import from `collections.abc` instead: `Awaitable` 71 71 | from typing import AsyncIterable 72 72 | from typing import Coroutine -UP035.py:70:1: UP035 [**] Import from `collections.abc` instead: `AsyncIterator` +UP035.py:70:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterator` | 68 | from typing import ValuesView 69 | from typing import Awaitable @@ -849,7 +849,7 @@ UP035.py:70:1: UP035 [**] Import from `collections.abc` instead: `AsyncIterator` 72 72 | from typing import Coroutine 73 73 | from typing import Collection -UP035.py:71:1: UP035 [**] Import from `collections.abc` instead: `AsyncIterable` +UP035.py:71:1: UP035 [*] Import from `collections.abc` instead: `AsyncIterable` | 69 | from typing import Awaitable 70 | from typing import AsyncIterator @@ -870,7 +870,7 @@ UP035.py:71:1: UP035 [**] Import from `collections.abc` instead: `AsyncIterable` 73 73 | from typing import Collection 74 74 | from typing import AsyncGenerator -UP035.py:72:1: UP035 [**] Import from `collections.abc` instead: `Coroutine` +UP035.py:72:1: UP035 [*] Import from `collections.abc` instead: `Coroutine` | 70 | from typing import AsyncIterator 71 | from typing import AsyncIterable @@ -891,7 +891,7 @@ UP035.py:72:1: UP035 [**] Import from `collections.abc` instead: `Coroutine` 74 74 | from typing import AsyncGenerator 75 75 | from typing import Reversible -UP035.py:73:1: UP035 [**] Import from `collections.abc` instead: `Collection` +UP035.py:73:1: UP035 [*] Import from `collections.abc` instead: `Collection` | 71 | from typing import AsyncIterable 72 | from typing import Coroutine @@ -912,7 +912,7 @@ UP035.py:73:1: UP035 [**] Import from `collections.abc` instead: `Collection` 75 75 | from typing import Reversible 76 76 | from typing import Generator -UP035.py:74:1: UP035 [**] Import from `collections.abc` instead: `AsyncGenerator` +UP035.py:74:1: UP035 [*] Import from `collections.abc` instead: `AsyncGenerator` | 72 | from typing import Coroutine 73 | from typing import Collection @@ -933,7 +933,7 @@ UP035.py:74:1: UP035 [**] Import from `collections.abc` instead: `AsyncGenerator 76 76 | from typing import Generator 77 77 | from typing import Callable -UP035.py:75:1: UP035 [**] Import from `collections.abc` instead: `Reversible` +UP035.py:75:1: UP035 [*] Import from `collections.abc` instead: `Reversible` | 73 | from typing import Collection 74 | from typing import AsyncGenerator @@ -954,7 +954,7 @@ UP035.py:75:1: UP035 [**] Import from `collections.abc` instead: `Reversible` 77 77 | from typing import Callable 78 78 | from typing import cast -UP035.py:76:1: UP035 [**] Import from `collections.abc` instead: `Generator` +UP035.py:76:1: UP035 [*] Import from `collections.abc` instead: `Generator` | 74 | from typing import AsyncGenerator 75 | from typing import Reversible @@ -975,7 +975,7 @@ UP035.py:76:1: UP035 [**] Import from `collections.abc` instead: `Generator` 78 78 | from typing import cast 79 79 | -UP035.py:77:1: UP035 [**] Import from `collections.abc` instead: `Callable` +UP035.py:77:1: UP035 [*] Import from `collections.abc` instead: `Callable` | 75 | from typing import Reversible 76 | from typing import Generator @@ -995,7 +995,7 @@ UP035.py:77:1: UP035 [**] Import from `collections.abc` instead: `Callable` 79 79 | 80 80 | # OK -UP035.py:87:1: UP035 [**] Import from `typing` instead: `NamedTuple` +UP035.py:87:1: UP035 [*] Import from `typing` instead: `NamedTuple` | 86 | # Ok: `typing_extensions` contains backported improvements. 87 | from typing_extensions import NamedTuple @@ -1015,7 +1015,7 @@ UP035.py:87:1: UP035 [**] Import from `typing` instead: `NamedTuple` 89 89 | # Ok: `typing_extensions` supports `frozen_default` (backported from 3.12). 90 90 | from typing_extensions import dataclass_transform -UP035.py:90:1: UP035 [**] Import from `typing` instead: `dataclass_transform` +UP035.py:90:1: UP035 [*] Import from `typing` instead: `dataclass_transform` | 89 | # Ok: `typing_extensions` supports `frozen_default` (backported from 3.12). 90 | from typing_extensions import dataclass_transform diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap index 385b374ffe6aee..6d66d23ef17be9 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_0.py:3:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:3:4: UP036 [*] Version block is outdated for minimum Python version | 1 | import sys 2 | @@ -24,7 +24,7 @@ UP036_0.py:3:4: UP036 [**] Version block is outdated for minimum Python version 8 5 | if sys.version_info < (3,0): 9 6 | if True: -UP036_0.py:8:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:8:4: UP036 [*] Version block is outdated for minimum Python version | 6 | print("py3") 7 | @@ -51,7 +51,7 @@ UP036_0.py:8:4: UP036 [**] Version block is outdated for minimum Python version 16 10 | if sys.version_info < (3,0): print("PY2!") 17 11 | else: print("PY3!") -UP036_0.py:16:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:16:4: UP036 [*] Version block is outdated for minimum Python version | 14 | print("py3") 15 | @@ -72,7 +72,7 @@ UP036_0.py:16:4: UP036 [**] Version block is outdated for minimum Python version 19 18 | if True: 20 19 | if sys.version_info < (3,0): -UP036_0.py:20:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:20:8: UP036 [*] Version block is outdated for minimum Python version | 19 | if True: 20 | if sys.version_info < (3,0): @@ -95,7 +95,7 @@ UP036_0.py:20:8: UP036 [**] Version block is outdated for minimum Python version 25 22 | if sys.version_info < (3,0): print(1 if True else 3) 26 23 | else: -UP036_0.py:25:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:25:4: UP036 [*] Version block is outdated for minimum Python version | 23 | print("PY3") 24 | @@ -118,7 +118,7 @@ UP036_0.py:25:4: UP036 [**] Version block is outdated for minimum Python version 29 27 | if sys.version_info < (3,0): 30 28 | def f(): -UP036_0.py:29:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:29:4: UP036 [*] Version block is outdated for minimum Python version | 27 | print("py3") 28 | @@ -147,7 +147,7 @@ UP036_0.py:29:4: UP036 [**] Version block is outdated for minimum Python version 37 33 | if sys.version_info > (3,0): 38 34 | print("py3") -UP036_0.py:37:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:37:4: UP036 [*] Version block is outdated for minimum Python version | 35 | print("This the next") 36 | @@ -171,7 +171,7 @@ UP036_0.py:37:4: UP036 [**] Version block is outdated for minimum Python version 42 39 | 43 40 | x = 1 -UP036_0.py:45:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:45:4: UP036 [*] Version block is outdated for minimum Python version | 43 | x = 1 44 | @@ -195,7 +195,7 @@ UP036_0.py:45:4: UP036 [**] Version block is outdated for minimum Python version 50 47 | 51 48 | x = 1 -UP036_0.py:53:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:53:4: UP036 [*] Version block is outdated for minimum Python version | 51 | x = 1 52 | @@ -216,7 +216,7 @@ UP036_0.py:53:4: UP036 [**] Version block is outdated for minimum Python version 56 55 | if sys.version_info > (3,): 57 56 | print("py3") -UP036_0.py:56:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:56:4: UP036 [*] Version block is outdated for minimum Python version | 54 | else: print("py2") 55 | @@ -240,7 +240,7 @@ UP036_0.py:56:4: UP036 [**] Version block is outdated for minimum Python version 61 58 | if True: 62 59 | if sys.version_info > (3,): -UP036_0.py:62:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:62:8: UP036 [*] Version block is outdated for minimum Python version | 61 | if True: 62 | if sys.version_info > (3,): @@ -263,7 +263,7 @@ UP036_0.py:62:8: UP036 [**] Version block is outdated for minimum Python version 67 64 | if sys.version_info < (3,): 68 65 | print("py2") -UP036_0.py:67:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:67:4: UP036 [*] Version block is outdated for minimum Python version | 65 | print("py2") 66 | @@ -287,7 +287,7 @@ UP036_0.py:67:4: UP036 [**] Version block is outdated for minimum Python version 72 69 | def f(): 73 70 | if sys.version_info < (3,0): -UP036_0.py:73:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:73:8: UP036 [*] Version block is outdated for minimum Python version | 72 | def f(): 73 | if sys.version_info < (3,0): @@ -313,7 +313,7 @@ UP036_0.py:73:8: UP036 [**] Version block is outdated for minimum Python version 81 75 | 82 76 | class C: -UP036_0.py:86:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:86:8: UP036 [*] Version block is outdated for minimum Python version | 84 | pass 85 | @@ -340,7 +340,7 @@ UP036_0.py:86:8: UP036 [**] Version block is outdated for minimum Python version 93 89 | def h(): 94 90 | pass -UP036_0.py:97:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:97:8: UP036 [*] Version block is outdated for minimum Python version | 96 | if True: 97 | if sys.version_info < (3,0): @@ -363,7 +363,7 @@ UP036_0.py:97:8: UP036 [**] Version block is outdated for minimum Python version 102 99 | # comment 103 100 | -UP036_0.py:104:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:104:4: UP036 [*] Version block is outdated for minimum Python version | 102 | # comment 103 | @@ -396,7 +396,7 @@ UP036_0.py:104:4: UP036 [**] Version block is outdated for minimum Python versio 115 109 | if True: 116 110 | if sys.version_info > (3,): -UP036_0.py:116:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:116:8: UP036 [*] Version block is outdated for minimum Python version | 115 | if True: 116 | if sys.version_info > (3,): @@ -417,7 +417,7 @@ UP036_0.py:116:8: UP036 [**] Version block is outdated for minimum Python versio 119 118 | print(2+3) 120 119 | -UP036_0.py:122:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:122:8: UP036 [*] Version block is outdated for minimum Python version | 121 | if True: 122 | if sys.version_info > (3,): print(3) @@ -437,7 +437,7 @@ UP036_0.py:122:8: UP036 [**] Version block is outdated for minimum Python versio 124 124 | if True: 125 125 | if sys.version_info > (3,): -UP036_0.py:125:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:125:8: UP036 [*] Version block is outdated for minimum Python version | 124 | if True: 125 | if sys.version_info > (3,): @@ -457,7 +457,7 @@ UP036_0.py:125:8: UP036 [**] Version block is outdated for minimum Python versio 128 127 | 129 128 | if True: -UP036_0.py:130:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:130:8: UP036 [*] Version block is outdated for minimum Python version | 129 | if True: 130 | if sys.version_info <= (3, 0): @@ -485,7 +485,7 @@ UP036_0.py:130:8: UP036 [**] Version block is outdated for minimum Python versio 139 136 | 140 137 | if sys.version_info <= (3, 0): -UP036_0.py:140:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:140:4: UP036 [*] Version block is outdated for minimum Python version | 140 | if sys.version_info <= (3, 0): | ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP036 @@ -512,7 +512,7 @@ UP036_0.py:140:4: UP036 [**] Version block is outdated for minimum Python versio 149 146 | 150 147 | if sys.version_info > (3,0): -UP036_0.py:150:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:150:4: UP036 [*] Version block is outdated for minimum Python version | 150 | if sys.version_info > (3,0): | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 @@ -546,7 +546,7 @@ UP036_0.py:150:4: UP036 [**] Version block is outdated for minimum Python versio 163 162 | if sys.version_info > (3, 0): expected_error = \ 164 163 | [] -UP036_0.py:163:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:163:4: UP036 [*] Version block is outdated for minimum Python version | 161 | "this for some reason") 162 | @@ -566,7 +566,7 @@ UP036_0.py:163:4: UP036 [**] Version block is outdated for minimum Python versio 165 165 | 166 166 | if sys.version_info > (3, 0): expected_error = [] -UP036_0.py:166:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:166:4: UP036 [*] Version block is outdated for minimum Python version | 164 | [] 165 | @@ -587,7 +587,7 @@ UP036_0.py:166:4: UP036 [**] Version block is outdated for minimum Python versio 168 168 | if sys.version_info > (3, 0): \ 169 169 | expected_error = [] -UP036_0.py:168:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:168:4: UP036 [*] Version block is outdated for minimum Python version | 166 | if sys.version_info > (3, 0): expected_error = [] 167 | @@ -608,7 +608,7 @@ UP036_0.py:168:4: UP036 [**] Version block is outdated for minimum Python versio 171 170 | if True: 172 171 | if sys.version_info > (3, 0): expected_error = \ -UP036_0.py:172:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:172:8: UP036 [*] Version block is outdated for minimum Python version | 171 | if True: 172 | if sys.version_info > (3, 0): expected_error = \ @@ -627,7 +627,7 @@ UP036_0.py:172:8: UP036 [**] Version block is outdated for minimum Python versio 174 174 | 175 175 | if True: -UP036_0.py:176:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:176:8: UP036 [*] Version block is outdated for minimum Python version | 175 | if True: 176 | if sys.version_info > (3, 0): expected_error = [] @@ -647,7 +647,7 @@ UP036_0.py:176:8: UP036 [**] Version block is outdated for minimum Python versio 178 178 | if True: 179 179 | if sys.version_info > (3, 0): \ -UP036_0.py:179:8: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:179:8: UP036 [*] Version block is outdated for minimum Python version | 178 | if True: 179 | if sys.version_info > (3, 0): \ @@ -665,7 +665,7 @@ UP036_0.py:179:8: UP036 [**] Version block is outdated for minimum Python versio 181 180 | 182 181 | if sys.version_info < (3,12): -UP036_0.py:182:4: UP036 [**] Version block is outdated for minimum Python version +UP036_0.py:182:4: UP036 [*] Version block is outdated for minimum Python version | 180 | expected_error = [] 181 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap index 1326eb2f4dbb47..2a585cc3f9c97d 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_1.py:3:4: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:3:4: UP036 [*] Version block is outdated for minimum Python version | 1 | import sys 2 | @@ -24,7 +24,7 @@ UP036_1.py:3:4: UP036 [**] Version block is outdated for minimum Python version 8 5 | if sys.version_info < (3,): 9 6 | 2 -UP036_1.py:8:4: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:8:4: UP036 [*] Version block is outdated for minimum Python version | 6 | 3 7 | @@ -48,7 +48,7 @@ UP036_1.py:8:4: UP036 [**] Version block is outdated for minimum Python version 13 10 | if sys.version_info < (3,0): 14 11 | 2 -UP036_1.py:13:4: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:13:4: UP036 [*] Version block is outdated for minimum Python version | 11 | 3 12 | @@ -72,7 +72,7 @@ UP036_1.py:13:4: UP036 [**] Version block is outdated for minimum Python version 18 15 | if sys.version_info == 3: 19 16 | 3 -UP036_1.py:18:4: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:18:4: UP036 [*] Version block is outdated for minimum Python version | 16 | 3 17 | @@ -96,7 +96,7 @@ UP036_1.py:18:4: UP036 [**] Version block is outdated for minimum Python version 23 20 | if sys.version_info > (3,): 24 21 | 3 -UP036_1.py:23:4: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:23:4: UP036 [*] Version block is outdated for minimum Python version | 21 | 2 22 | @@ -120,7 +120,7 @@ UP036_1.py:23:4: UP036 [**] Version block is outdated for minimum Python version 28 25 | if sys.version_info >= (3,): 29 26 | 3 -UP036_1.py:28:4: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:28:4: UP036 [*] Version block is outdated for minimum Python version | 26 | 2 27 | @@ -144,7 +144,7 @@ UP036_1.py:28:4: UP036 [**] Version block is outdated for minimum Python version 33 30 | from sys import version_info 34 31 | -UP036_1.py:35:4: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:35:4: UP036 [*] Version block is outdated for minimum Python version | 33 | from sys import version_info 34 | @@ -168,7 +168,7 @@ UP036_1.py:35:4: UP036 [**] Version block is outdated for minimum Python version 40 37 | if True: 41 38 | print(1) -UP036_1.py:42:6: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:42:6: UP036 [*] Version block is outdated for minimum Python version | 40 | if True: 41 | print(1) @@ -189,7 +189,7 @@ UP036_1.py:42:6: UP036 [**] Version block is outdated for minimum Python version 45 43 | print(3) 46 44 | -UP036_1.py:49:6: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:49:6: UP036 [*] Version block is outdated for minimum Python version | 47 | if True: 48 | print(1) @@ -213,7 +213,7 @@ UP036_1.py:49:6: UP036 [**] Version block is outdated for minimum Python version 54 52 | if True: 55 53 | print(1) -UP036_1.py:56:6: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:56:6: UP036 [*] Version block is outdated for minimum Python version | 54 | if True: 55 | print(1) @@ -233,7 +233,7 @@ UP036_1.py:56:6: UP036 [**] Version block is outdated for minimum Python version 58 58 | 59 59 | def f(): -UP036_1.py:62:10: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:62:10: UP036 [*] Version block is outdated for minimum Python version | 60 | if True: 61 | print(1) @@ -253,7 +253,7 @@ UP036_1.py:62:10: UP036 [**] Version block is outdated for minimum Python versio 64 64 | 65 65 | if True: -UP036_1.py:67:6: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:67:6: UP036 [*] Version block is outdated for minimum Python version | 65 | if True: 66 | print(1) @@ -274,7 +274,7 @@ UP036_1.py:67:6: UP036 [**] Version block is outdated for minimum Python version 70 68 | print(3) 71 69 | -UP036_1.py:75:10: UP036 [**] Version block is outdated for minimum Python version +UP036_1.py:75:10: UP036 [*] Version block is outdated for minimum Python version | 73 | if True: 74 | print(1) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap index 631af594dc981e..8e8332bdd9ebf2 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_2.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_2.py:4:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:4:4: UP036 [*] Version block is outdated for minimum Python version | 2 | from sys import version_info 3 | @@ -25,7 +25,7 @@ UP036_2.py:4:4: UP036 [**] Version block is outdated for minimum Python version 9 6 | if version_info > (3, 5): 10 7 | 3+6 -UP036_2.py:9:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:9:4: UP036 [*] Version block is outdated for minimum Python version | 7 | 3-5 8 | @@ -49,7 +49,7 @@ UP036_2.py:9:4: UP036 [**] Version block is outdated for minimum Python version 14 11 | if sys.version_info >= (3,6): 15 12 | 3+6 -UP036_2.py:14:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:14:4: UP036 [*] Version block is outdated for minimum Python version | 12 | 3-5 13 | @@ -73,7 +73,7 @@ UP036_2.py:14:4: UP036 [**] Version block is outdated for minimum Python version 19 16 | if version_info >= (3,6): 20 17 | 3+6 -UP036_2.py:19:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:19:4: UP036 [*] Version block is outdated for minimum Python version | 17 | 3-5 18 | @@ -97,7 +97,7 @@ UP036_2.py:19:4: UP036 [**] Version block is outdated for minimum Python version 24 21 | if sys.version_info < (3,6): 25 22 | 3-5 -UP036_2.py:24:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:24:4: UP036 [*] Version block is outdated for minimum Python version | 22 | 3-5 23 | @@ -121,7 +121,7 @@ UP036_2.py:24:4: UP036 [**] Version block is outdated for minimum Python version 29 26 | if sys.version_info <= (3,5): 30 27 | 3-5 -UP036_2.py:29:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:29:4: UP036 [*] Version block is outdated for minimum Python version | 27 | 3+6 28 | @@ -145,7 +145,7 @@ UP036_2.py:29:4: UP036 [**] Version block is outdated for minimum Python version 34 31 | if sys.version_info <= (3, 5): 35 32 | 3-5 -UP036_2.py:34:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:34:4: UP036 [*] Version block is outdated for minimum Python version | 32 | 3+6 33 | @@ -169,7 +169,7 @@ UP036_2.py:34:4: UP036 [**] Version block is outdated for minimum Python version 39 36 | if sys.version_info >= (3, 5): 40 37 | pass -UP036_2.py:39:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:39:4: UP036 [*] Version block is outdated for minimum Python version | 37 | 3+6 38 | @@ -190,7 +190,7 @@ UP036_2.py:39:4: UP036 [**] Version block is outdated for minimum Python version 42 41 | if sys.version_info < (3,0): 43 42 | pass -UP036_2.py:42:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:42:4: UP036 [*] Version block is outdated for minimum Python version | 40 | pass 41 | @@ -210,7 +210,7 @@ UP036_2.py:42:4: UP036 [**] Version block is outdated for minimum Python version 45 43 | if True: 46 44 | if sys.version_info < (3,0): -UP036_2.py:46:8: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:46:8: UP036 [*] Version block is outdated for minimum Python version | 45 | if True: 46 | if sys.version_info < (3,0): @@ -230,7 +230,7 @@ UP036_2.py:46:8: UP036 [**] Version block is outdated for minimum Python version 49 48 | if sys.version_info < (3,0): 50 49 | pass -UP036_2.py:49:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:49:4: UP036 [*] Version block is outdated for minimum Python version | 47 | pass 48 | @@ -253,7 +253,7 @@ UP036_2.py:49:4: UP036 [**] Version block is outdated for minimum Python version 53 51 | 54 52 | if sys.version_info > (3,): -UP036_2.py:54:4: UP036 [**] Version block is outdated for minimum Python version +UP036_2.py:54:4: UP036 [*] Version block is outdated for minimum Python version | 52 | pass 53 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap index 589e8af691bef0..d38cfd8b0bf2a1 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_3.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_3.py:3:15: UP036 [**] Version block is outdated for minimum Python version +UP036_3.py:3:15: UP036 [*] Version block is outdated for minimum Python version | 1 | import sys 2 | @@ -30,7 +30,7 @@ UP036_3.py:3:15: UP036 [**] Version block is outdated for minimum Python version 12 7 | if False: 13 8 | if sys.version_info < (3,0): -UP036_3.py:13:19: UP036 [**] Version block is outdated for minimum Python version +UP036_3.py:13:19: UP036 [*] Version block is outdated for minimum Python version | 12 | if False: 13 | if sys.version_info < (3,0): @@ -59,7 +59,7 @@ UP036_3.py:13:19: UP036 [**] Version block is outdated for minimum Python versio 22 17 | 23 18 | if sys.version_info < (3,0): print("PY2!") -UP036_3.py:23:15: UP036 [**] Version block is outdated for minimum Python version +UP036_3.py:23:15: UP036 [*] Version block is outdated for minimum Python version | 23 | if sys.version_info < (3,0): print("PY2!") | ^^^^^^^^^^^^^^^^^^^^^^^^ UP036 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap index 0d5b8438eb156a..28701a4d0a3b30 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_4.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_4.py:4:8: UP036 [**] Version block is outdated for minimum Python version +UP036_4.py:4:8: UP036 [*] Version block is outdated for minimum Python version | 3 | if True: 4 | if sys.version_info < (3, 3): @@ -21,7 +21,7 @@ UP036_4.py:4:8: UP036 [**] Version block is outdated for minimum Python version 7 6 | 8 7 | if True: -UP036_4.py:11:10: UP036 [**] Version block is outdated for minimum Python version +UP036_4.py:11:10: UP036 [*] Version block is outdated for minimum Python version | 9 | if foo: 10 | print() @@ -42,7 +42,7 @@ UP036_4.py:11:10: UP036 [**] Version block is outdated for minimum Python versio 14 13 | if True: 15 14 | if foo: -UP036_4.py:17:10: UP036 [**] Version block is outdated for minimum Python version +UP036_4.py:17:10: UP036 [*] Version block is outdated for minimum Python version | 15 | if foo: 16 | print() @@ -63,7 +63,7 @@ UP036_4.py:17:10: UP036 [**] Version block is outdated for minimum Python versio 20 18 | cmd = [sys.executable, "-m", "test", "-j0"] 21 19 | -UP036_4.py:24:10: UP036 [**] Version block is outdated for minimum Python version +UP036_4.py:24:10: UP036 [*] Version block is outdated for minimum Python version | 22 | if foo: 23 | print() @@ -84,7 +84,7 @@ UP036_4.py:24:10: UP036 [**] Version block is outdated for minimum Python versio 27 26 | if sys.version_info < (3, 3): 28 27 | cmd = [sys.executable, "-m", "test.regrtest"] -UP036_4.py:27:8: UP036 [**] Version block is outdated for minimum Python version +UP036_4.py:27:8: UP036 [*] Version block is outdated for minimum Python version | 25 | cmd = [sys.executable, "-m", "test.regrtest"] 26 | @@ -104,7 +104,7 @@ UP036_4.py:27:8: UP036 [**] Version block is outdated for minimum Python version 30 28 | if foo: 31 29 | print() -UP036_4.py:32:10: UP036 [**] Version block is outdated for minimum Python version +UP036_4.py:32:10: UP036 [*] Version block is outdated for minimum Python version | 30 | if foo: 31 | print() @@ -125,7 +125,7 @@ UP036_4.py:32:10: UP036 [**] Version block is outdated for minimum Python versio 35 33 | cmd = [sys.executable, "-m", "test", "-j0"] 36 34 | -UP036_4.py:37:8: UP036 [**] Version block is outdated for minimum Python version +UP036_4.py:37:8: UP036 [*] Version block is outdated for minimum Python version | 35 | cmd = [sys.executable, "-m", "test", "-j0"] 36 | @@ -149,7 +149,7 @@ UP036_4.py:37:8: UP036 [**] Version block is outdated for minimum Python version 42 39 | if sys.version_info < (3, 3): 43 40 | cmd = [sys.executable, "-m", "test.regrtest"] -UP036_4.py:42:8: UP036 [**] Version block is outdated for minimum Python version +UP036_4.py:42:8: UP036 [*] Version block is outdated for minimum Python version | 40 | cmd = [sys.executable, "-m", "test", "-j0"] 41 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap index c66b462506abd9..f4a5ed27874b29 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP036_5.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP036_5.py:3:4: UP036 [**] Version block is outdated for minimum Python version +UP036_5.py:3:4: UP036 [*] Version block is outdated for minimum Python version | 1 | import sys 2 | @@ -31,7 +31,7 @@ UP036_5.py:3:4: UP036 [**] Version block is outdated for minimum Python version 15 5 | 16 6 | import sys -UP036_5.py:18:4: UP036 [**] Version block is outdated for minimum Python version +UP036_5.py:18:4: UP036 [*] Version block is outdated for minimum Python version | 16 | import sys 17 | diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap index f678cc9fdf49f0..dcba7e8fcff569 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP038.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP038.py:1:1: UP038 [**] Use `X | Y` in `isinstance` call instead of `(X, Y)` +UP038.py:1:1: UP038 [*] Use `X | Y` in `isinstance` call instead of `(X, Y)` | 1 | isinstance(1, (int, float)) # UP038 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP038 @@ -16,7 +16,7 @@ UP038.py:1:1: UP038 [**] Use `X | Y` in `isinstance` call instead of `(X, Y)` 3 3 | 4 4 | isinstance(1, int) # OK -UP038.py:2:1: UP038 [**] Use `X | Y` in `issubclass` call instead of `(X, Y)` +UP038.py:2:1: UP038 [*] Use `X | Y` in `issubclass` call instead of `(X, Y)` | 1 | isinstance(1, (int, float)) # UP038 2 | issubclass("yes", (int, float, str)) # UP038 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap index db36d46d4d5e94..3cde3025383daa 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__datetime_utc_alias_py311.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -UP017.py:7:7: UP017 [**] Use `datetime.UTC` alias +UP017.py:7:7: UP017 [*] Use `datetime.UTC` alias | 6 | print(datetime.timezone(-1)) 7 | print(timezone.utc) @@ -20,7 +20,7 @@ UP017.py:7:7: UP017 [**] Use `datetime.UTC` alias 9 9 | 10 10 | print(datetime.timezone.utc) -UP017.py:8:7: UP017 [**] Use `datetime.UTC` alias +UP017.py:8:7: UP017 [*] Use `datetime.UTC` alias | 6 | print(datetime.timezone(-1)) 7 | print(timezone.utc) @@ -41,7 +41,7 @@ UP017.py:8:7: UP017 [**] Use `datetime.UTC` alias 10 10 | print(datetime.timezone.utc) 11 11 | print(dt.timezone.utc) -UP017.py:10:7: UP017 [**] Use `datetime.UTC` alias +UP017.py:10:7: UP017 [*] Use `datetime.UTC` alias | 8 | print(tz.utc) 9 | @@ -59,7 +59,7 @@ UP017.py:10:7: UP017 [**] Use `datetime.UTC` alias 10 |+print(datetime.UTC) 11 11 | print(dt.timezone.utc) -UP017.py:11:7: UP017 [**] Use `datetime.UTC` alias +UP017.py:11:7: UP017 [*] Use `datetime.UTC` alias | 10 | print(datetime.timezone.utc) 11 | print(dt.timezone.utc) diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap index eea6bdc5c485dc..6c62e6ffb7f60c 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_p37.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -future_annotations.py:40:4: UP007 [**] Use `X | Y` for type annotations +future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations | 40 | x: Optional[int] = None | ^^^^^^^^^^^^^ UP007 diff --git a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap index 6d50e8a5de3de2..c9e4008d7aac7f 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap +++ b/crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__future_annotations_pep_604_py310.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pyupgrade/mod.rs --- -future_annotations.py:40:4: UP007 [**] Use `X | Y` for type annotations +future_annotations.py:40:4: UP007 [*] Use `X | Y` for type annotations | 40 | x: Optional[int] = None | ^^^^^^^^^^^^^ UP007 @@ -19,7 +19,7 @@ future_annotations.py:40:4: UP007 [**] Use `X | Y` for type annotations 41 41 | 42 42 | MyList: TypeAlias = Union[List[int], List[str]] -future_annotations.py:42:21: UP007 [**] Use `X | Y` for type annotations +future_annotations.py:42:21: UP007 [*] Use `X | Y` for type annotations | 40 | x: Optional[int] = None 41 | diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap index 27229b18aa2230..ebec270762c4c2 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB105_FURB105.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB105.py:3:1: FURB105 [**] Unnecessary empty string passed to `print` +FURB105.py:3:1: FURB105 [*] Unnecessary empty string passed to `print` | 1 | # Errors. 2 | @@ -21,7 +21,7 @@ FURB105.py:3:1: FURB105 [**] Unnecessary empty string passed to `print` 5 5 | print("", end="bar") 6 6 | print("", sep=",", end="bar") -FURB105.py:4:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:4:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 3 | print("") 4 | print("", sep=",") @@ -41,7 +41,7 @@ FURB105.py:4:1: FURB105 [**] Unnecessary empty string and separator passed to `p 6 6 | print("", sep=",", end="bar") 7 7 | print(sep="") -FURB105.py:5:1: FURB105 [**] Unnecessary empty string passed to `print` +FURB105.py:5:1: FURB105 [*] Unnecessary empty string passed to `print` | 3 | print("") 4 | print("", sep=",") @@ -62,7 +62,7 @@ FURB105.py:5:1: FURB105 [**] Unnecessary empty string passed to `print` 7 7 | print(sep="") 8 8 | print("", sep="") -FURB105.py:6:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:6:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 4 | print("", sep=",") 5 | print("", end="bar") @@ -83,7 +83,7 @@ FURB105.py:6:1: FURB105 [**] Unnecessary empty string and separator passed to `p 8 8 | print("", sep="") 9 9 | print("", "", sep="") -FURB105.py:7:1: FURB105 [**] Unnecessary separator passed to `print` +FURB105.py:7:1: FURB105 [*] Unnecessary separator passed to `print` | 5 | print("", end="bar") 6 | print("", sep=",", end="bar") @@ -104,7 +104,7 @@ FURB105.py:7:1: FURB105 [**] Unnecessary separator passed to `print` 9 9 | print("", "", sep="") 10 10 | print("", "", sep="", end="") -FURB105.py:8:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:8:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 6 | print("", sep=",", end="bar") 7 | print(sep="") @@ -125,7 +125,7 @@ FURB105.py:8:1: FURB105 [**] Unnecessary empty string and separator passed to `p 10 10 | print("", "", sep="", end="") 11 11 | print("", "", sep="", end="bar") -FURB105.py:9:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:9:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 7 | print(sep="") 8 | print("", sep="") @@ -146,7 +146,7 @@ FURB105.py:9:1: FURB105 [**] Unnecessary empty string and separator passed to `p 11 11 | print("", "", sep="", end="bar") 12 12 | print("", sep="", end="bar") -FURB105.py:10:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:10:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 8 | print("", sep="") 9 | print("", "", sep="") @@ -167,7 +167,7 @@ FURB105.py:10:1: FURB105 [**] Unnecessary empty string and separator passed to ` 12 12 | print("", sep="", end="bar") 13 13 | print(sep="", end="bar") -FURB105.py:11:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:11:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 9 | print("", "", sep="") 10 | print("", "", sep="", end="") @@ -188,7 +188,7 @@ FURB105.py:11:1: FURB105 [**] Unnecessary empty string and separator passed to ` 13 13 | print(sep="", end="bar") 14 14 | print("", "foo", sep="") -FURB105.py:12:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:12:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 10 | print("", "", sep="", end="") 11 | print("", "", sep="", end="bar") @@ -209,7 +209,7 @@ FURB105.py:12:1: FURB105 [**] Unnecessary empty string and separator passed to ` 14 14 | print("", "foo", sep="") 15 15 | print("foo", "", sep="") -FURB105.py:13:1: FURB105 [**] Unnecessary separator passed to `print` +FURB105.py:13:1: FURB105 [*] Unnecessary separator passed to `print` | 11 | print("", "", sep="", end="bar") 12 | print("", sep="", end="bar") @@ -230,7 +230,7 @@ FURB105.py:13:1: FURB105 [**] Unnecessary separator passed to `print` 15 15 | print("foo", "", sep="") 16 16 | print("foo", "", "bar", sep="") -FURB105.py:14:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:14:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 12 | print("", sep="", end="bar") 13 | print(sep="", end="bar") @@ -251,7 +251,7 @@ FURB105.py:14:1: FURB105 [**] Unnecessary empty string and separator passed to ` 16 16 | print("foo", "", "bar", sep="") 17 17 | print("", *args) -FURB105.py:15:1: FURB105 [**] Unnecessary empty string and separator passed to `print` +FURB105.py:15:1: FURB105 [*] Unnecessary empty string and separator passed to `print` | 13 | print(sep="", end="bar") 14 | print("", "foo", sep="") @@ -272,7 +272,7 @@ FURB105.py:15:1: FURB105 [**] Unnecessary empty string and separator passed to ` 17 17 | print("", *args) 18 18 | print("", *args, sep="") -FURB105.py:16:1: FURB105 [**] Unnecessary empty string passed to `print` +FURB105.py:16:1: FURB105 [*] Unnecessary empty string passed to `print` | 14 | print("", "foo", sep="") 15 | print("foo", "", sep="") @@ -293,7 +293,7 @@ FURB105.py:16:1: FURB105 [**] Unnecessary empty string passed to `print` 18 18 | print("", *args, sep="") 19 19 | print("", **kwargs) -FURB105.py:18:1: FURB105 [**] Unnecessary empty string passed to `print` +FURB105.py:18:1: FURB105 [*] Unnecessary empty string passed to `print` | 16 | print("foo", "", "bar", sep="") 17 | print("", *args) @@ -314,7 +314,7 @@ FURB105.py:18:1: FURB105 [**] Unnecessary empty string passed to `print` 20 20 | print(sep="\t") 21 21 | -FURB105.py:19:1: FURB105 [**] Unnecessary empty string passed to `print` +FURB105.py:19:1: FURB105 [*] Unnecessary empty string passed to `print` | 17 | print("", *args) 18 | print("", *args, sep="") @@ -334,7 +334,7 @@ FURB105.py:19:1: FURB105 [**] Unnecessary empty string passed to `print` 21 21 | 22 22 | # OK. -FURB105.py:20:1: FURB105 [**] Unnecessary separator passed to `print` +FURB105.py:20:1: FURB105 [*] Unnecessary separator passed to `print` | 18 | print("", *args, sep="") 19 | print("", **kwargs) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap index fd34207d7a1a2f..4ce5ab6cd5a6ad 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB113_FURB113.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB113.py:23:1: FURB113 [**] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +FURB113.py:23:1: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | 22 | # FURB113 23 | / nums.append(1) @@ -22,7 +22,7 @@ FURB113.py:23:1: FURB113 [**] Use `nums.extend((1, 2))` instead of repeatedly ca 26 25 | 27 26 | -FURB113.py:29:1: FURB113 [**] Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` +FURB113.py:29:1: FURB113 [*] Use `nums3.extend((1, 2))` instead of repeatedly calling `nums3.append()` | 28 | # FURB113 29 | / nums3.append(1) @@ -43,7 +43,7 @@ FURB113.py:29:1: FURB113 [**] Use `nums3.extend((1, 2))` instead of repeatedly c 32 31 | 33 32 | -FURB113.py:35:1: FURB113 [**] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` +FURB113.py:35:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` | 34 | # FURB113 35 | / nums4.append(1) @@ -106,7 +106,7 @@ FURB113.py:53:1: FURB113 Use `nums3.extend((1, 2))` instead of repeatedly callin | = help: Replace with `nums3.extend((1, 2))` -FURB113.py:56:1: FURB113 [**] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` +FURB113.py:56:1: FURB113 [*] Use `nums4.extend((1, 2))` instead of repeatedly calling `nums4.append()` | 54 | nums.append(3) 55 | # FURB113 @@ -129,7 +129,7 @@ FURB113.py:56:1: FURB113 [**] Use `nums4.extend((1, 2))` instead of repeatedly c 59 58 | pass 60 59 | -FURB113.py:62:1: FURB113 [**] Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` +FURB113.py:62:1: FURB113 [*] Use `nums.extend((1, 2, 3))` instead of repeatedly calling `nums.append()` | 61 | # FURB113 62 | / nums.append(1) @@ -151,7 +151,7 @@ FURB113.py:62:1: FURB113 [**] Use `nums.extend((1, 2, 3))` instead of repeatedly 66 64 | 67 65 | if True: -FURB113.py:69:5: FURB113 [**] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +FURB113.py:69:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | 67 | if True: 68 | # FURB113 @@ -173,7 +173,7 @@ FURB113.py:69:5: FURB113 [**] Use `nums.extend((1, 2))` instead of repeatedly ca 72 71 | 73 72 | if True: -FURB113.py:75:5: FURB113 [**] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` +FURB113.py:75:5: FURB113 [*] Use `nums.extend((1, 2))` instead of repeatedly calling `nums.append()` | 73 | if True: 74 | # FURB113 @@ -209,7 +209,7 @@ FURB113.py:82:5: FURB113 Use `nums.extend((1, 2, 3))` instead of repeatedly call | = help: Replace with `nums.extend((1, 2, 3))` -FURB113.py:90:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:90:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 88 | def yes_one(x: list[int]): 89 | # FURB113 @@ -231,7 +231,7 @@ FURB113.py:90:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calli 93 92 | 94 93 | def yes_two(x: List[int]): -FURB113.py:96:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:96:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 94 | def yes_two(x: List[int]): 95 | # FURB113 @@ -253,7 +253,7 @@ FURB113.py:96:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calli 99 98 | 100 99 | def yes_three(*, x: list[int]): -FURB113.py:102:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:102:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 100 | def yes_three(*, x: list[int]): 101 | # FURB113 @@ -275,7 +275,7 @@ FURB113.py:102:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly call 105 104 | 106 105 | def yes_four(x: list[int], /): -FURB113.py:108:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:108:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 106 | def yes_four(x: list[int], /): 107 | # FURB113 @@ -310,7 +310,7 @@ FURB113.py:114:5: FURB113 Use `x.extend((1, 2, 3))` instead of repeatedly callin | = help: Replace with `x.extend((1, 2, 3))` -FURB113.py:122:5: FURB113 [**] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` +FURB113.py:122:5: FURB113 [*] Use `x.extend((1, 2))` instead of repeatedly calling `x.append()` | 120 | def yes_six(x: list): 121 | # FURB113 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap index 53835ec8c180e5..14ad4d9c3cf9a3 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB131_FURB131.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB131.py:11:1: FURB131 [**] Prefer `clear` over deleting a full slice +FURB131.py:11:1: FURB131 [*] Prefer `clear` over deleting a full slice | 10 | # FURB131 11 | del nums[:] @@ -19,7 +19,7 @@ FURB131.py:11:1: FURB131 [**] Prefer `clear` over deleting a full slice 13 13 | 14 14 | # FURB131 -FURB131.py:15:1: FURB131 [**] Prefer `clear` over deleting a full slice +FURB131.py:15:1: FURB131 [*] Prefer `clear` over deleting a full slice | 14 | # FURB131 15 | del names[:] @@ -53,7 +53,7 @@ FURB131.py:23:1: FURB131 Prefer `clear` over deleting a full slice | = help: Replace with `clear()` -FURB131.py:28:5: FURB131 [**] Prefer `clear` over deleting a full slice +FURB131.py:28:5: FURB131 [*] Prefer `clear` over deleting a full slice | 26 | def yes_one(x: list[int]): 27 | # FURB131 @@ -72,7 +72,7 @@ FURB131.py:28:5: FURB131 [**] Prefer `clear` over deleting a full slice 30 30 | 31 31 | def yes_two(x: dict[int, str]): -FURB131.py:33:5: FURB131 [**] Prefer `clear` over deleting a full slice +FURB131.py:33:5: FURB131 [*] Prefer `clear` over deleting a full slice | 31 | def yes_two(x: dict[int, str]): 32 | # FURB131 @@ -91,7 +91,7 @@ FURB131.py:33:5: FURB131 [**] Prefer `clear` over deleting a full slice 35 35 | 36 36 | def yes_three(x: List[int]): -FURB131.py:38:5: FURB131 [**] Prefer `clear` over deleting a full slice +FURB131.py:38:5: FURB131 [*] Prefer `clear` over deleting a full slice | 36 | def yes_three(x: List[int]): 37 | # FURB131 @@ -110,7 +110,7 @@ FURB131.py:38:5: FURB131 [**] Prefer `clear` over deleting a full slice 40 40 | 41 41 | def yes_four(x: Dict[int, str]): -FURB131.py:43:5: FURB131 [**] Prefer `clear` over deleting a full slice +FURB131.py:43:5: FURB131 [*] Prefer `clear` over deleting a full slice | 41 | def yes_four(x: Dict[int, str]): 42 | # FURB131 diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap index 7e21ec3d7bd8ba..25c2e3746bb26d 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB132_FURB132.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB132.py:12:1: FURB132 [**] Use `s.discard("x")` instead of check and `remove` +FURB132.py:12:1: FURB132 [*] Use `s.discard("x")` instead of check and `remove` | 11 | # FURB132 12 | / if "x" in s: @@ -21,7 +21,7 @@ FURB132.py:12:1: FURB132 [**] Use `s.discard("x")` instead of check and `remove` 15 14 | 16 15 | # FURB132 -FURB132.py:22:1: FURB132 [**] Use `s3.discard("x")` instead of check and `remove` +FURB132.py:22:1: FURB132 [*] Use `s3.discard("x")` instead of check and `remove` | 21 | # FURB132 22 | / if "x" in s3: @@ -41,7 +41,7 @@ FURB132.py:22:1: FURB132 [**] Use `s3.discard("x")` instead of check and `remove 25 24 | 26 25 | var = "y" -FURB132.py:28:1: FURB132 [**] Use `s.discard(var)` instead of check and `remove` +FURB132.py:28:1: FURB132 [*] Use `s.discard(var)` instead of check and `remove` | 26 | var = "y" 27 | # FURB132 @@ -62,7 +62,7 @@ FURB132.py:28:1: FURB132 [**] Use `s.discard(var)` instead of check and `remove` 31 30 | 32 31 | if f"{var}:{var}" in s: -FURB132.py:32:1: FURB132 [**] Use `s.discard(f"{var}:{var}")` instead of check and `remove` +FURB132.py:32:1: FURB132 [*] Use `s.discard(f"{var}:{var}")` instead of check and `remove` | 32 | / if f"{var}:{var}" in s: 33 | | s.remove(f"{var}:{var}") diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap index 52811c0d0e9ca0..89541187db04b7 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB140_FURB140.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB140.py:7:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:7:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 6 | # FURB140 7 | [print(x, y) for x, y in zipped()] @@ -25,7 +25,7 @@ FURB140.py:7:1: FURB140 [**] Use `itertools.starmap` instead of the generator 9 10 | # FURB140 10 11 | (print(x, y) for x, y in zipped()) -FURB140.py:10:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:10:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 9 | # FURB140 10 | (print(x, y) for x, y in zipped()) @@ -50,7 +50,7 @@ FURB140.py:10:1: FURB140 [**] Use `itertools.starmap` instead of the generator 12 13 | # FURB140 13 14 | {print(x, y) for x, y in zipped()} -FURB140.py:13:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:13:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 12 | # FURB140 13 | {print(x, y) for x, y in zipped()} @@ -73,7 +73,7 @@ FURB140.py:13:1: FURB140 [**] Use `itertools.starmap` instead of the generator 15 16 | 16 17 | from itertools import starmap as sm -FURB140.py:19:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:19:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 18 | # FURB140 19 | [print(x, y) for x, y in zipped()] @@ -93,7 +93,7 @@ FURB140.py:19:1: FURB140 [**] Use `itertools.starmap` instead of the generator 21 21 | # FURB140 22 22 | (print(x, y) for x, y in zipped()) -FURB140.py:22:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:22:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 21 | # FURB140 22 | (print(x, y) for x, y in zipped()) @@ -113,7 +113,7 @@ FURB140.py:22:1: FURB140 [**] Use `itertools.starmap` instead of the generator 24 24 | # FURB140 25 25 | {print(x, y) for x, y in zipped()} -FURB140.py:25:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:25:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 24 | # FURB140 25 | {print(x, y) for x, y in zipped()} @@ -133,7 +133,7 @@ FURB140.py:25:1: FURB140 [**] Use `itertools.starmap` instead of the generator 27 27 | # FURB140 (check it still flags starred arguments). 28 28 | # See https://github.com/astral-sh/ruff/issues/7636 -FURB140.py:29:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:29:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 27 | # FURB140 (check it still flags starred arguments). 28 | # See https://github.com/astral-sh/ruff/issues/7636 @@ -154,7 +154,7 @@ FURB140.py:29:1: FURB140 [**] Use `itertools.starmap` instead of the generator 31 31 | {foo(*t) for t in [(85, 60), (100, 80)]} 32 32 | -FURB140.py:30:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:30:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 28 | # See https://github.com/astral-sh/ruff/issues/7636 29 | [foo(*t) for t in [(85, 60), (100, 80)]] @@ -174,7 +174,7 @@ FURB140.py:30:1: FURB140 [**] Use `itertools.starmap` instead of the generator 32 32 | 33 33 | # Non-errors. -FURB140.py:31:1: FURB140 [**] Use `itertools.starmap` instead of the generator +FURB140.py:31:1: FURB140 [*] Use `itertools.starmap` instead of the generator | 29 | [foo(*t) for t in [(85, 60), (100, 80)]] 30 | (foo(*t) for t in [(85, 60), (100, 80)]) diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap index 7247ad82bcd758..742f089ebf25d3 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB145_FURB145.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB145.py:4:5: FURB145 [**] Prefer `copy` method over slicing +FURB145.py:4:5: FURB145 [*] Prefer `copy` method over slicing | 3 | # Errors. 4 | a = l[:] @@ -21,7 +21,7 @@ FURB145.py:4:5: FURB145 [**] Prefer `copy` method over slicing 6 6 | d, e = l[:], 1 7 7 | m = l[::] -FURB145.py:5:11: FURB145 [**] Prefer `copy` method over slicing +FURB145.py:5:11: FURB145 [*] Prefer `copy` method over slicing | 3 | # Errors. 4 | a = l[:] @@ -42,7 +42,7 @@ FURB145.py:5:11: FURB145 [**] Prefer `copy` method over slicing 7 7 | m = l[::] 8 8 | l[:] -FURB145.py:6:8: FURB145 [**] Prefer `copy` method over slicing +FURB145.py:6:8: FURB145 [*] Prefer `copy` method over slicing | 4 | a = l[:] 5 | b, c = 1, l[:] @@ -63,7 +63,7 @@ FURB145.py:6:8: FURB145 [**] Prefer `copy` method over slicing 8 8 | l[:] 9 9 | print(l[:]) -FURB145.py:7:5: FURB145 [**] Prefer `copy` method over slicing +FURB145.py:7:5: FURB145 [*] Prefer `copy` method over slicing | 5 | b, c = 1, l[:] 6 | d, e = l[:], 1 @@ -84,7 +84,7 @@ FURB145.py:7:5: FURB145 [**] Prefer `copy` method over slicing 9 9 | print(l[:]) 10 10 | -FURB145.py:8:1: FURB145 [**] Prefer `copy` method over slicing +FURB145.py:8:1: FURB145 [*] Prefer `copy` method over slicing | 6 | d, e = l[:], 1 7 | m = l[::] @@ -104,7 +104,7 @@ FURB145.py:8:1: FURB145 [**] Prefer `copy` method over slicing 10 10 | 11 11 | # False negatives. -FURB145.py:9:7: FURB145 [**] Prefer `copy` method over slicing +FURB145.py:9:7: FURB145 [*] Prefer `copy` method over slicing | 7 | m = l[::] 8 | l[:] diff --git a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap index fac8fc566037b2..a64560382bb591 100644 --- a/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap +++ b/crates/ruff_linter/src/rules/refurb/snapshots/ruff_linter__rules__refurb__tests__FURB148_FURB148.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/refurb/mod.rs --- -FURB148.py:14:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 13 | # Errors 14 | for index, _ in enumerate(books): @@ -20,7 +20,7 @@ FURB148.py:14:17: FURB148 [**] `enumerate` value is unused, use `for x in range( 16 16 | 17 17 | for index, _ in enumerate(books, start=0): -FURB148.py:17:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 15 | print(index) 16 | @@ -40,7 +40,7 @@ FURB148.py:17:17: FURB148 [**] `enumerate` value is unused, use `for x in range( 19 19 | 20 20 | for index, _ in enumerate(books, 0): -FURB148.py:20:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 18 | print(index) 19 | @@ -100,7 +100,7 @@ FURB148.py:32:17: FURB148 `enumerate` value is unused, use `for x in range(len(y | = help: Replace with `range(len(...))` -FURB148.py:35:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 33 | print(book) 34 | @@ -120,7 +120,7 @@ FURB148.py:35:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 37 37 | 38 38 | for _, book in enumerate(books, start=0): -FURB148.py:38:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 36 | print(book) 37 | @@ -140,7 +140,7 @@ FURB148.py:38:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 40 40 | 41 41 | for _, book in enumerate(books, 0): -FURB148.py:41:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 39 | print(book) 40 | @@ -160,7 +160,7 @@ FURB148.py:41:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 43 43 | 44 44 | for _, book in enumerate(books, start=1): -FURB148.py:44:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 42 | print(book) 43 | @@ -180,7 +180,7 @@ FURB148.py:44:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 46 46 | 47 47 | for _, book in enumerate(books, 1): -FURB148.py:47:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 45 | print(book) 46 | @@ -200,7 +200,7 @@ FURB148.py:47:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 49 49 | 50 50 | for _, book in enumerate(books, start=x): -FURB148.py:50:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 48 | print(book) 49 | @@ -220,7 +220,7 @@ FURB148.py:50:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 52 52 | 53 53 | for _, book in enumerate(books, x): -FURB148.py:53:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 51 | print(book) 52 | @@ -240,7 +240,7 @@ FURB148.py:53:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 55 55 | 56 56 | for index, (_, _) in enumerate(books): -FURB148.py:56:22: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 54 | print(book) 55 | @@ -260,7 +260,7 @@ FURB148.py:56:22: FURB148 [**] `enumerate` value is unused, use `for x in range( 58 58 | 59 59 | for (_, _), book in enumerate(books): -FURB148.py:59:21: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 57 | print(index) 58 | @@ -280,7 +280,7 @@ FURB148.py:59:21: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 61 61 | 62 62 | for(index, _)in enumerate(books): -FURB148.py:62:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 60 | print(book) 61 | @@ -300,7 +300,7 @@ FURB148.py:62:17: FURB148 [**] `enumerate` value is unused, use `for x in range( 64 64 | 65 65 | for(index), _ in enumerate(books): -FURB148.py:65:18: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 63 | print(index) 64 | @@ -320,7 +320,7 @@ FURB148.py:65:18: FURB148 [**] `enumerate` value is unused, use `for x in range( 67 67 | 68 68 | for index, _ in enumerate(books_and_authors): -FURB148.py:68:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 66 | print(index) 67 | @@ -340,7 +340,7 @@ FURB148.py:68:17: FURB148 [**] `enumerate` value is unused, use `for x in range( 70 70 | 71 71 | for _, book in enumerate(books_and_authors): -FURB148.py:71:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 69 | print(index) 70 | @@ -360,7 +360,7 @@ FURB148.py:71:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 73 73 | 74 74 | for index, _ in enumerate(books_set): -FURB148.py:74:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 72 | print(book) 73 | @@ -380,7 +380,7 @@ FURB148.py:74:17: FURB148 [**] `enumerate` value is unused, use `for x in range( 76 76 | 77 77 | for _, book in enumerate(books_set): -FURB148.py:77:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 75 | print(index) 76 | @@ -400,7 +400,7 @@ FURB148.py:77:16: FURB148 [**] `enumerate` index is unused, use `for x in y` ins 79 79 | 80 80 | for index, _ in enumerate(books_tuple): -FURB148.py:80:17: FURB148 [**] `enumerate` value is unused, use `for x in range(len(y))` instead +FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead | 78 | print(book) 79 | @@ -420,7 +420,7 @@ FURB148.py:80:17: FURB148 [**] `enumerate` value is unused, use `for x in range( 82 82 | 83 83 | for _, book in enumerate(books_tuple): -FURB148.py:83:16: FURB148 [**] `enumerate` index is unused, use `for x in y` instead +FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead | 81 | print(index) 82 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap index f9c83b5aabbae0..f472f1f9f2eaf4 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF013_0.py:21:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:21:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 21 | def f(arg: int = None): # RUF013 | ^^^ RUF013 @@ -19,7 +19,7 @@ RUF013_0.py:21:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 23 23 | 24 24 | -RUF013_0.py:25:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:25:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 25 | def f(arg: str = None): # RUF013 | ^^^ RUF013 @@ -37,7 +37,7 @@ RUF013_0.py:25:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 27 27 | 28 28 | -RUF013_0.py:29:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 29 | def f(arg: typing.List[str] = None): # RUF013 | ^^^^^^^^^^^^^^^^ RUF013 @@ -55,7 +55,7 @@ RUF013_0.py:29:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 31 31 | 32 32 | -RUF013_0.py:33:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:33:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 33 | def f(arg: Tuple[str] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -73,7 +73,7 @@ RUF013_0.py:33:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 35 35 | 36 36 | -RUF013_0.py:71:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:71:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 71 | def f(arg: Union = None): # RUF013 | ^^^^^ RUF013 @@ -91,7 +91,7 @@ RUF013_0.py:71:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 73 73 | 74 74 | -RUF013_0.py:75:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:75:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 75 | def f(arg: Union[int] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -109,7 +109,7 @@ RUF013_0.py:75:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 77 77 | 78 78 | -RUF013_0.py:79:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:79:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 79 | def f(arg: Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^ RUF013 @@ -127,7 +127,7 @@ RUF013_0.py:79:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 81 81 | 82 82 | -RUF013_0.py:83:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:83:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 83 | def f(arg: typing.Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -145,7 +145,7 @@ RUF013_0.py:83:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 85 85 | 86 86 | -RUF013_0.py:102:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:102:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 102 | def f(arg: int | float = None): # RUF013 | ^^^^^^^^^^^ RUF013 @@ -163,7 +163,7 @@ RUF013_0.py:102:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 104 104 | 105 105 | -RUF013_0.py:106:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:106:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 106 | def f(arg: int | float | str | bytes = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -181,7 +181,7 @@ RUF013_0.py:106:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 108 108 | 109 109 | -RUF013_0.py:125:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:125:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 125 | def f(arg: Literal[1] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -199,7 +199,7 @@ RUF013_0.py:125:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 127 127 | 128 128 | -RUF013_0.py:129:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:129:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 129 | def f(arg: Literal[1, "foo"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^ RUF013 @@ -217,7 +217,7 @@ RUF013_0.py:129:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 131 131 | 132 132 | -RUF013_0.py:133:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:133:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 133 | def f(arg: typing.Literal[1, "foo", True] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -235,7 +235,7 @@ RUF013_0.py:133:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 135 135 | 136 136 | -RUF013_0.py:152:22: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:152:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | 152 | def f(arg: Annotated[int, ...] = None): # RUF013 | ^^^ RUF013 @@ -253,7 +253,7 @@ RUF013_0.py:152:22: RUF013 [**] PEP 484 prohibits implicit `Optional` 154 154 | 155 155 | -RUF013_0.py:156:32: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:156:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | 156 | def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 | ^^^^^^^^^ RUF013 @@ -271,7 +271,7 @@ RUF013_0.py:156:32: RUF013 [**] PEP 484 prohibits implicit `Optional` 158 158 | 159 159 | -RUF013_0.py:172:11: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:172:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 171 | def f( 172 | arg1: int = None, # RUF013 @@ -291,7 +291,7 @@ RUF013_0.py:172:11: RUF013 [**] PEP 484 prohibits implicit `Optional` 174 174 | arg3: Literal[1, 2, 3] = None, # RUF013 175 175 | ): -RUF013_0.py:173:11: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:173:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 171 | def f( 172 | arg1: int = None, # RUF013 @@ -312,7 +312,7 @@ RUF013_0.py:173:11: RUF013 [**] PEP 484 prohibits implicit `Optional` 175 175 | ): 176 176 | pass -RUF013_0.py:174:11: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:174:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 172 | arg1: int = None, # RUF013 173 | arg2: Union[int, float] = None, # RUF013 @@ -333,7 +333,7 @@ RUF013_0.py:174:11: RUF013 [**] PEP 484 prohibits implicit `Optional` 176 176 | pass 177 177 | -RUF013_0.py:202:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:202:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 202 | def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -351,7 +351,7 @@ RUF013_0.py:202:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 204 204 | 205 205 | -RUF013_0.py:209:13: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:209:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | 209 | def f(arg: "int" = None): # RUF013 | ^^^ RUF013 @@ -369,7 +369,7 @@ RUF013_0.py:209:13: RUF013 [**] PEP 484 prohibits implicit `Optional` 211 211 | 212 212 | -RUF013_0.py:213:13: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:213:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | 213 | def f(arg: "str" = None): # RUF013 | ^^^ RUF013 @@ -395,7 +395,7 @@ RUF013_0.py:217:12: RUF013 PEP 484 prohibits implicit `Optional` | = help: Convert to `Optional[T]` -RUF013_0.py:225:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:225:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 225 | def f(arg: Union["int", "str"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^ RUF013 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap index 330d1d707476bb..6647c659483723 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__PY39_RUF013_RUF013_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF013_1.py:4:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 4 | def f(arg: int = None): # RUF011 | ^^^ RUF013 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap index 505c6f6ba86ec0..baf307a873ffe8 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF005_RUF005.py.snap @@ -42,7 +42,7 @@ RUF005.py:16:10: RUF005 Consider `[*first, 4, 5, 6]` instead of concatenation | = help: Replace with `[*first, 4, 5, 6]` -RUF005.py:39:7: RUF005 [**] Consider `[1, 2, 3, *foo]` instead of concatenation +RUF005.py:39:7: RUF005 [*] Consider `[1, 2, 3, *foo]` instead of concatenation | 38 | foo = [4, 5, 6] 39 | bar = [1, 2, 3] + foo @@ -62,7 +62,7 @@ RUF005.py:39:7: RUF005 [**] Consider `[1, 2, 3, *foo]` instead of concatenation 41 41 | quux = (7, 8, 9) + zoob 42 42 | spam = quux + (10, 11, 12) -RUF005.py:41:8: RUF005 [**] Consider `(7, 8, 9, *zoob)` instead of concatenation +RUF005.py:41:8: RUF005 [*] Consider `(7, 8, 9, *zoob)` instead of concatenation | 39 | bar = [1, 2, 3] + foo 40 | zoob = tuple(bar) @@ -83,7 +83,7 @@ RUF005.py:41:8: RUF005 [**] Consider `(7, 8, 9, *zoob)` instead of concatenation 43 43 | spom = list(spam) 44 44 | eggs = spom + [13, 14, 15] -RUF005.py:42:8: RUF005 [**] Consider `(*quux, 10, 11, 12)` instead of concatenation +RUF005.py:42:8: RUF005 [*] Consider `(*quux, 10, 11, 12)` instead of concatenation | 40 | zoob = tuple(bar) 41 | quux = (7, 8, 9) + zoob @@ -104,7 +104,7 @@ RUF005.py:42:8: RUF005 [**] Consider `(*quux, 10, 11, 12)` instead of concatenat 44 44 | eggs = spom + [13, 14, 15] 45 45 | elatement = ("we all say",) + yay() -RUF005.py:44:8: RUF005 [**] Consider `[*spom, 13, 14, 15]` instead of concatenation +RUF005.py:44:8: RUF005 [*] Consider `[*spom, 13, 14, 15]` instead of concatenation | 42 | spam = quux + (10, 11, 12) 43 | spom = list(spam) @@ -125,7 +125,7 @@ RUF005.py:44:8: RUF005 [**] Consider `[*spom, 13, 14, 15]` instead of concatenat 46 46 | excitement = ("we all think",) + Fun().yay() 47 47 | astonishment = ("we all feel",) + Fun.words -RUF005.py:45:13: RUF005 [**] Consider `("we all say", *yay())` instead of concatenation +RUF005.py:45:13: RUF005 [*] Consider `("we all say", *yay())` instead of concatenation | 43 | spom = list(spam) 44 | eggs = spom + [13, 14, 15] @@ -146,7 +146,7 @@ RUF005.py:45:13: RUF005 [**] Consider `("we all say", *yay())` instead of concat 47 47 | astonishment = ("we all feel",) + Fun.words 48 48 | -RUF005.py:46:14: RUF005 [**] Consider `("we all think", *Fun().yay())` instead of concatenation +RUF005.py:46:14: RUF005 [*] Consider `("we all think", *Fun().yay())` instead of concatenation | 44 | eggs = spom + [13, 14, 15] 45 | elatement = ("we all say",) + yay() @@ -166,7 +166,7 @@ RUF005.py:46:14: RUF005 [**] Consider `("we all think", *Fun().yay())` instead o 48 48 | 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) -RUF005.py:47:16: RUF005 [**] Consider `("we all feel", *Fun.words)` instead of concatenation +RUF005.py:47:16: RUF005 [*] Consider `("we all feel", *Fun.words)` instead of concatenation | 45 | elatement = ("we all say",) + yay() 46 | excitement = ("we all think",) + Fun().yay() @@ -187,7 +187,7 @@ RUF005.py:47:16: RUF005 [**] Consider `("we all feel", *Fun.words)` instead of c 49 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 50 | -RUF005.py:49:9: RUF005 [**] Consider iterable unpacking instead of concatenation +RUF005.py:49:9: RUF005 [*] Consider iterable unpacking instead of concatenation | 47 | astonishment = ("we all feel",) + Fun.words 48 | @@ -208,7 +208,7 @@ RUF005.py:49:9: RUF005 [**] Consider iterable unpacking instead of concatenation 51 51 | baz = () + zoob 52 52 | -RUF005.py:49:39: RUF005 [**] Consider `("yes", "no", "pants", *zoob)` instead of concatenation +RUF005.py:49:39: RUF005 [*] Consider `("yes", "no", "pants", *zoob)` instead of concatenation | 47 | astonishment = ("we all feel",) + Fun.words 48 | @@ -229,7 +229,7 @@ RUF005.py:49:39: RUF005 [**] Consider `("yes", "no", "pants", *zoob)` instead of 51 51 | baz = () + zoob 52 52 | -RUF005.py:51:7: RUF005 [**] Consider `(*zoob,)` instead of concatenation +RUF005.py:51:7: RUF005 [*] Consider `(*zoob,)` instead of concatenation | 49 | chain = ["a", "b", "c"] + eggs + list(("yes", "no", "pants") + zoob) 50 | @@ -250,7 +250,7 @@ RUF005.py:51:7: RUF005 [**] Consider `(*zoob,)` instead of concatenation 53 53 | [] + foo + [ 54 54 | ] -RUF005.py:53:1: RUF005 [**] Consider `[*foo]` instead of concatenation +RUF005.py:53:1: RUF005 [*] Consider `[*foo]` instead of concatenation | 51 | baz = () + zoob 52 | @@ -273,7 +273,7 @@ RUF005.py:53:1: RUF005 [**] Consider `[*foo]` instead of concatenation 56 55 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 56 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) -RUF005.py:56:15: RUF005 [**] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation +RUF005.py:56:15: RUF005 [*] Consider `[sys.executable, "-m", "pylint", *args, path]` instead of concatenation | 54 | ] 55 | @@ -294,7 +294,7 @@ RUF005.py:56:15: RUF005 [**] Consider `[sys.executable, "-m", "pylint", *args, p 58 58 | b = a + [2, 3] + [4] 59 59 | -RUF005.py:57:21: RUF005 [**] Consider iterable unpacking instead of concatenation +RUF005.py:57:21: RUF005 [*] Consider iterable unpacking instead of concatenation | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -313,7 +313,7 @@ RUF005.py:57:21: RUF005 [**] Consider iterable unpacking instead of concatenatio 59 59 | 60 60 | # Uses the non-preferred quote style, which should be retained. -RUF005.py:58:5: RUF005 [**] Consider `[*a, 2, 3, 4]` instead of concatenation +RUF005.py:58:5: RUF005 [*] Consider `[*a, 2, 3, 4]` instead of concatenation | 56 | pylint_call = [sys.executable, "-m", "pylint"] + args + [path] 57 | pylint_call_tuple = (sys.executable, "-m", "pylint") + args + (path, path2) @@ -334,7 +334,7 @@ RUF005.py:58:5: RUF005 [**] Consider `[*a, 2, 3, 4]` instead of concatenation 60 60 | # Uses the non-preferred quote style, which should be retained. 61 61 | f"{a() + ['b']}" -RUF005.py:61:4: RUF005 [**] Consider `[*a(), 'b']` instead of concatenation +RUF005.py:61:4: RUF005 [*] Consider `[*a(), 'b']` instead of concatenation | 60 | # Uses the non-preferred quote style, which should be retained. 61 | f"{a() + ['b']}" diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap index ad642299b6ef94..10634c0520c031 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF013_0.py:21:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:21:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 21 | def f(arg: int = None): # RUF013 | ^^^ RUF013 @@ -19,7 +19,7 @@ RUF013_0.py:21:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 23 23 | 24 24 | -RUF013_0.py:25:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:25:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 25 | def f(arg: str = None): # RUF013 | ^^^ RUF013 @@ -37,7 +37,7 @@ RUF013_0.py:25:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 27 27 | 28 28 | -RUF013_0.py:29:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:29:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 29 | def f(arg: typing.List[str] = None): # RUF013 | ^^^^^^^^^^^^^^^^ RUF013 @@ -55,7 +55,7 @@ RUF013_0.py:29:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 31 31 | 32 32 | -RUF013_0.py:33:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:33:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 33 | def f(arg: Tuple[str] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -73,7 +73,7 @@ RUF013_0.py:33:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 35 35 | 36 36 | -RUF013_0.py:71:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:71:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 71 | def f(arg: Union = None): # RUF013 | ^^^^^ RUF013 @@ -91,7 +91,7 @@ RUF013_0.py:71:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 73 73 | 74 74 | -RUF013_0.py:75:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:75:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 75 | def f(arg: Union[int] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -109,7 +109,7 @@ RUF013_0.py:75:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 77 77 | 78 78 | -RUF013_0.py:79:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:79:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 79 | def f(arg: Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^ RUF013 @@ -127,7 +127,7 @@ RUF013_0.py:79:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 81 81 | 82 82 | -RUF013_0.py:83:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:83:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 83 | def f(arg: typing.Union[int, str] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -145,7 +145,7 @@ RUF013_0.py:83:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 85 85 | 86 86 | -RUF013_0.py:102:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:102:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 102 | def f(arg: int | float = None): # RUF013 | ^^^^^^^^^^^ RUF013 @@ -163,7 +163,7 @@ RUF013_0.py:102:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 104 104 | 105 105 | -RUF013_0.py:106:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:106:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 106 | def f(arg: int | float | str | bytes = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -181,7 +181,7 @@ RUF013_0.py:106:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 108 108 | 109 109 | -RUF013_0.py:125:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:125:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 125 | def f(arg: Literal[1] = None): # RUF013 | ^^^^^^^^^^ RUF013 @@ -199,7 +199,7 @@ RUF013_0.py:125:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 127 127 | 128 128 | -RUF013_0.py:129:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:129:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 129 | def f(arg: Literal[1, "foo"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^ RUF013 @@ -217,7 +217,7 @@ RUF013_0.py:129:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 131 131 | 132 132 | -RUF013_0.py:133:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:133:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 133 | def f(arg: typing.Literal[1, "foo", True] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -235,7 +235,7 @@ RUF013_0.py:133:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 135 135 | 136 136 | -RUF013_0.py:152:22: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:152:22: RUF013 [*] PEP 484 prohibits implicit `Optional` | 152 | def f(arg: Annotated[int, ...] = None): # RUF013 | ^^^ RUF013 @@ -253,7 +253,7 @@ RUF013_0.py:152:22: RUF013 [**] PEP 484 prohibits implicit `Optional` 154 154 | 155 155 | -RUF013_0.py:156:32: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:156:32: RUF013 [*] PEP 484 prohibits implicit `Optional` | 156 | def f(arg: Annotated[Annotated[int | str, ...], ...] = None): # RUF013 | ^^^^^^^^^ RUF013 @@ -271,7 +271,7 @@ RUF013_0.py:156:32: RUF013 [**] PEP 484 prohibits implicit `Optional` 158 158 | 159 159 | -RUF013_0.py:172:11: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:172:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 171 | def f( 172 | arg1: int = None, # RUF013 @@ -291,7 +291,7 @@ RUF013_0.py:172:11: RUF013 [**] PEP 484 prohibits implicit `Optional` 174 174 | arg3: Literal[1, 2, 3] = None, # RUF013 175 175 | ): -RUF013_0.py:173:11: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:173:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 171 | def f( 172 | arg1: int = None, # RUF013 @@ -312,7 +312,7 @@ RUF013_0.py:173:11: RUF013 [**] PEP 484 prohibits implicit `Optional` 175 175 | ): 176 176 | pass -RUF013_0.py:174:11: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:174:11: RUF013 [*] PEP 484 prohibits implicit `Optional` | 172 | arg1: int = None, # RUF013 173 | arg2: Union[int, float] = None, # RUF013 @@ -333,7 +333,7 @@ RUF013_0.py:174:11: RUF013 [**] PEP 484 prohibits implicit `Optional` 176 176 | pass 177 177 | -RUF013_0.py:202:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:202:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 202 | def f(arg: Union[Annotated[int, ...], Union[str, bytes]] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF013 @@ -351,7 +351,7 @@ RUF013_0.py:202:12: RUF013 [**] PEP 484 prohibits implicit `Optional` 204 204 | 205 205 | -RUF013_0.py:209:13: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:209:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | 209 | def f(arg: "int" = None): # RUF013 | ^^^ RUF013 @@ -369,7 +369,7 @@ RUF013_0.py:209:13: RUF013 [**] PEP 484 prohibits implicit `Optional` 211 211 | 212 212 | -RUF013_0.py:213:13: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:213:13: RUF013 [*] PEP 484 prohibits implicit `Optional` | 213 | def f(arg: "str" = None): # RUF013 | ^^^ RUF013 @@ -395,7 +395,7 @@ RUF013_0.py:217:12: RUF013 PEP 484 prohibits implicit `Optional` | = help: Convert to `T | None` -RUF013_0.py:225:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_0.py:225:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 225 | def f(arg: Union["int", "str"] = None): # RUF013 | ^^^^^^^^^^^^^^^^^^^ RUF013 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap index 11c785db98c124..df81fc0f7faf57 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF013_RUF013_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF013_1.py:4:12: RUF013 [**] PEP 484 prohibits implicit `Optional` +RUF013_1.py:4:12: RUF013 [*] PEP 484 prohibits implicit `Optional` | 4 | def f(arg: int = None): # RUF011 | ^^^ RUF013 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap index 5224dc2ed9e3ed..6e7933a4116267 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF015_RUF015.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF015.py:4:1: RUF015 [**] Prefer `next(iter(x))` over single element slice +RUF015.py:4:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 3 | # RUF015 4 | list(x)[0] @@ -21,7 +21,7 @@ RUF015.py:4:1: RUF015 [**] Prefer `next(iter(x))` over single element slice 6 6 | list(i for i in x)[0] 7 7 | [i for i in x][0] -RUF015.py:5:1: RUF015 [**] Prefer `next(iter(x))` over single element slice +RUF015.py:5:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 3 | # RUF015 4 | list(x)[0] @@ -42,7 +42,7 @@ RUF015.py:5:1: RUF015 [**] Prefer `next(iter(x))` over single element slice 7 7 | [i for i in x][0] 8 8 | -RUF015.py:6:1: RUF015 [**] Prefer `next(iter(x))` over single element slice +RUF015.py:6:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 4 | list(x)[0] 5 | tuple(x)[0] @@ -62,7 +62,7 @@ RUF015.py:6:1: RUF015 [**] Prefer `next(iter(x))` over single element slice 8 8 | 9 9 | # OK (not indexing (solely) the first element) -RUF015.py:7:1: RUF015 [**] Prefer `next(iter(x))` over single element slice +RUF015.py:7:1: RUF015 [*] Prefer `next(iter(x))` over single element slice | 5 | tuple(x)[0] 6 | list(i for i in x)[0] @@ -83,7 +83,7 @@ RUF015.py:7:1: RUF015 [**] Prefer `next(iter(x))` over single element slice 9 9 | # OK (not indexing (solely) the first element) 10 10 | list(x) -RUF015.py:29:1: RUF015 [**] Prefer `next(i + 1 for i in x)` over single element slice +RUF015.py:29:1: RUF015 [*] Prefer `next(i + 1 for i in x)` over single element slice | 28 | # RUF015 (doesn't mirror the underlying list) 29 | [i + 1 for i in x][0] @@ -103,7 +103,7 @@ RUF015.py:29:1: RUF015 [**] Prefer `next(i + 1 for i in x)` over single element 31 31 | [(i, i + 1) for i in x][0] 32 32 | -RUF015.py:30:1: RUF015 [**] Prefer `next(i for i in x if i > 5)` over single element slice +RUF015.py:30:1: RUF015 [*] Prefer `next(i for i in x if i > 5)` over single element slice | 28 | # RUF015 (doesn't mirror the underlying list) 29 | [i + 1 for i in x][0] @@ -123,7 +123,7 @@ RUF015.py:30:1: RUF015 [**] Prefer `next(i for i in x if i > 5)` over single ele 32 32 | 33 33 | # RUF015 (multiple generators) -RUF015.py:31:1: RUF015 [**] Prefer `next((i, i + 1) for i in x)` over single element slice +RUF015.py:31:1: RUF015 [*] Prefer `next((i, i + 1) for i in x)` over single element slice | 29 | [i + 1 for i in x][0] 30 | [i for i in x if i > 5][0] @@ -144,7 +144,7 @@ RUF015.py:31:1: RUF015 [**] Prefer `next((i, i + 1) for i in x)` over single ele 33 33 | # RUF015 (multiple generators) 34 34 | y = range(10) -RUF015.py:35:1: RUF015 [**] Prefer `next(i + j for i in x for j in y)` over single element slice +RUF015.py:35:1: RUF015 [*] Prefer `next(i + j for i in x for j in y)` over single element slice | 33 | # RUF015 (multiple generators) 34 | y = range(10) @@ -165,7 +165,7 @@ RUF015.py:35:1: RUF015 [**] Prefer `next(i + j for i in x for j in y)` over sing 37 37 | # RUF015 38 38 | list(range(10))[0] -RUF015.py:38:1: RUF015 [**] Prefer `next(iter(range(10)))` over single element slice +RUF015.py:38:1: RUF015 [*] Prefer `next(iter(range(10)))` over single element slice | 37 | # RUF015 38 | list(range(10))[0] @@ -185,7 +185,7 @@ RUF015.py:38:1: RUF015 [**] Prefer `next(iter(range(10)))` over single element s 40 40 | list(x["y"])[0] 41 41 | -RUF015.py:39:1: RUF015 [**] Prefer `next(iter(x.y))` over single element slice +RUF015.py:39:1: RUF015 [*] Prefer `next(iter(x.y))` over single element slice | 37 | # RUF015 38 | list(range(10))[0] @@ -205,7 +205,7 @@ RUF015.py:39:1: RUF015 [**] Prefer `next(iter(x.y))` over single element slice 41 41 | 42 42 | # RUF015 (multi-line) -RUF015.py:40:1: RUF015 [**] Prefer `next(iter(x["y"]))` over single element slice +RUF015.py:40:1: RUF015 [*] Prefer `next(iter(x["y"]))` over single element slice | 38 | list(range(10))[0] 39 | list(x.y)[0] @@ -226,7 +226,7 @@ RUF015.py:40:1: RUF015 [**] Prefer `next(iter(x["y"]))` over single element slic 42 42 | # RUF015 (multi-line) 43 43 | revision_heads_map_ast = [ -RUF015.py:43:26: RUF015 [**] Prefer `next(...)` over single element slice +RUF015.py:43:26: RUF015 [*] Prefer `next(...)` over single element slice | 42 | # RUF015 (multi-line) 43 | revision_heads_map_ast = [ diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap index 5bf23f636f0e64..3d30ebbcbbbe6e 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_0.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF017_0.py:5:1: RUF017 [**] Avoid quadratic list summation +RUF017_0.py:5:1: RUF017 [*] Avoid quadratic list summation | 4 | # RUF017 5 | sum([x, y], start=[]) @@ -24,7 +24,7 @@ RUF017_0.py:5:1: RUF017 [**] Avoid quadratic list summation 7 9 | sum([[1, 2, 3], [4, 5, 6]], start=[]) 8 10 | sum([[1, 2, 3], [4, 5, 6]], []) -RUF017_0.py:6:1: RUF017 [**] Avoid quadratic list summation +RUF017_0.py:6:1: RUF017 [*] Avoid quadratic list summation | 4 | # RUF017 5 | sum([x, y], start=[]) @@ -49,7 +49,7 @@ RUF017_0.py:6:1: RUF017 [**] Avoid quadratic list summation 8 10 | sum([[1, 2, 3], [4, 5, 6]], []) 9 11 | sum([[1, 2, 3], [4, 5, 6]], -RUF017_0.py:7:1: RUF017 [**] Avoid quadratic list summation +RUF017_0.py:7:1: RUF017 [*] Avoid quadratic list summation | 5 | sum([x, y], start=[]) 6 | sum([x, y], []) @@ -75,7 +75,7 @@ RUF017_0.py:7:1: RUF017 [**] Avoid quadratic list summation 9 11 | sum([[1, 2, 3], [4, 5, 6]], 10 12 | []) -RUF017_0.py:8:1: RUF017 [**] Avoid quadratic list summation +RUF017_0.py:8:1: RUF017 [*] Avoid quadratic list summation | 6 | sum([x, y], []) 7 | sum([[1, 2, 3], [4, 5, 6]], start=[]) @@ -102,7 +102,7 @@ RUF017_0.py:8:1: RUF017 [**] Avoid quadratic list summation 10 12 | []) 11 13 | -RUF017_0.py:9:1: RUF017 [**] Avoid quadratic list summation +RUF017_0.py:9:1: RUF017 [*] Avoid quadratic list summation | 7 | sum([[1, 2, 3], [4, 5, 6]], start=[]) 8 | sum([[1, 2, 3], [4, 5, 6]], []) @@ -131,7 +131,7 @@ RUF017_0.py:9:1: RUF017 [**] Avoid quadratic list summation 12 13 | # OK 13 14 | sum([x, y]) -RUF017_0.py:21:5: RUF017 [**] Avoid quadratic list summation +RUF017_0.py:21:5: RUF017 [*] Avoid quadratic list summation | 19 | import functools, operator 20 | @@ -150,7 +150,7 @@ RUF017_0.py:21:5: RUF017 [**] Avoid quadratic list summation 23 23 | 24 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 -RUF017_0.py:26:5: RUF017 [**] Avoid quadratic list summation +RUF017_0.py:26:5: RUF017 [*] Avoid quadratic list summation | 24 | # Regression test for: https://github.com/astral-sh/ruff/issues/7718 25 | def func(): diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap index 8f9bc4fe7aa13e..65bb00fdeb0d04 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__RUF017_RUF017_1.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF017_1.py:1:1: RUF017 [**] Avoid quadratic list summation +RUF017_1.py:1:1: RUF017 [*] Avoid quadratic list summation | 1 | sum((factor.dims for factor in bases), []) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF017 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap index 12a5e6ce36e243..17d3c4a376fbc1 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__noqa.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -noqa.py:23:5: F841 [**] Local variable `I` is assigned to but never used +noqa.py:23:5: F841 [*] Local variable `I` is assigned to but never used | 21 | def f(): 22 | # Only `E741` should be ignored by the `noqa`. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap index 0c153033654183..d1842091b0d9ca 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_0.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF100_0.py:9:12: RUF100 [**] Unused blanket `noqa` directive +RUF100_0.py:9:12: RUF100 [*] Unused blanket `noqa` directive | 8 | # Invalid 9 | c = 1 # noqa @@ -20,7 +20,7 @@ RUF100_0.py:9:12: RUF100 [**] Unused blanket `noqa` directive 11 11 | 12 12 | # Invalid -RUF100_0.py:13:12: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_0.py:13:12: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 12 | # Invalid 13 | d = 1 # noqa: E501 @@ -40,7 +40,7 @@ RUF100_0.py:13:12: RUF100 [**] Unused `noqa` directive (unused: `E501`) 15 15 | # Invalid 16 16 | d = 1 # noqa: F841, E501 -RUF100_0.py:16:12: RUF100 [**] Unused `noqa` directive (unused: `F841`, `E501`) +RUF100_0.py:16:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `E501`) | 15 | # Invalid 16 | d = 1 # noqa: F841, E501 @@ -60,7 +60,7 @@ RUF100_0.py:16:12: RUF100 [**] Unused `noqa` directive (unused: `F841`, `E501`) 18 18 | # Invalid (and unimplemented or not enabled) 19 19 | d = 1 # noqa: F841, W191, F821 -RUF100_0.py:19:12: RUF100 [**] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) +RUF100_0.py:19:12: RUF100 [*] Unused `noqa` directive (unused: `F841`, `W191`; non-enabled: `F821`) | 18 | # Invalid (and unimplemented or not enabled) 19 | d = 1 # noqa: F841, W191, F821 @@ -80,7 +80,7 @@ RUF100_0.py:19:12: RUF100 [**] Unused `noqa` directive (unused: `F841`, `W191`; 21 21 | # Invalid (but external) 22 22 | d = 1 # noqa: F841, V101 -RUF100_0.py:22:12: RUF100 [**] Unused `noqa` directive (unused: `F841`) +RUF100_0.py:22:12: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 21 | # Invalid (but external) 22 | d = 1 # noqa: F841, V101 @@ -100,7 +100,7 @@ RUF100_0.py:22:12: RUF100 [**] Unused `noqa` directive (unused: `F841`) 24 24 | # fmt: off 25 25 | # Invalid - no space before # -RUF100_0.py:26:10: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_0.py:26:10: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 24 | # fmt: off 25 | # Invalid - no space before # @@ -121,7 +121,7 @@ RUF100_0.py:26:10: RUF100 [**] Unused `noqa` directive (unused: `E501`) 28 28 | # Invalid - many spaces before # 29 29 | d = 1 # noqa: E501 -RUF100_0.py:29:5: F841 [**] Local variable `d` is assigned to but never used +RUF100_0.py:29:5: F841 [*] Local variable `d` is assigned to but never used | 28 | # Invalid - many spaces before # 29 | d = 1 # noqa: E501 @@ -139,7 +139,7 @@ RUF100_0.py:29:5: F841 [**] Local variable `d` is assigned to but never used 31 30 | 32 31 | -RUF100_0.py:29:33: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_0.py:29:33: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 28 | # Invalid - many spaces before # 29 | d = 1 # noqa: E501 @@ -158,7 +158,7 @@ RUF100_0.py:29:33: RUF100 [**] Unused `noqa` directive (unused: `E501`) 31 31 | 32 32 | -RUF100_0.py:55:6: RUF100 [**] Unused `noqa` directive (unused: `F841`) +RUF100_0.py:55:6: RUF100 [*] Unused `noqa` directive (unused: `F841`) | 54 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 55 | """ # noqa: E501, F841 @@ -178,7 +178,7 @@ RUF100_0.py:55:6: RUF100 [**] Unused `noqa` directive (unused: `F841`) 57 57 | # Invalid 58 58 | _ = """Lorem ipsum dolor sit amet. -RUF100_0.py:63:6: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_0.py:63:6: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 62 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 63 | """ # noqa: E501 @@ -198,7 +198,7 @@ RUF100_0.py:63:6: RUF100 [**] Unused `noqa` directive (unused: `E501`) 65 65 | # Invalid 66 66 | _ = """Lorem ipsum dolor sit amet. -RUF100_0.py:71:6: RUF100 [**] Unused blanket `noqa` directive +RUF100_0.py:71:6: RUF100 [*] Unused blanket `noqa` directive | 70 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor. 71 | """ # noqa @@ -245,7 +245,7 @@ RUF100_0.py:90:89: E501 Line too long (89 > 88 characters) | ^ E501 | -RUF100_0.py:90:92: RUF100 [**] Unused `noqa` directive (unused: `F401`) +RUF100_0.py:90:92: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 88 | print(sys.path) 89 | diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap index 4735ed8cb91a40..288d46d007d67a 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_1.snap @@ -22,7 +22,7 @@ RUF100_1.py:37:9: F401 [*] `typing.Union` imported but unused 40 39 | 41 40 | def f(): -RUF100_1.py:52:20: RUF100 [**] Unused `noqa` directive (unused: `F401`) +RUF100_1.py:52:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 50 | # This should ignore the error, but the inner noqa should be marked as unused. 51 | from typing import ( # noqa: F401 @@ -42,7 +42,7 @@ RUF100_1.py:52:20: RUF100 [**] Unused `noqa` directive (unused: `F401`) 54 54 | 55 55 | -RUF100_1.py:59:20: RUF100 [**] Unused `noqa` directive (unused: `F401`) +RUF100_1.py:59:20: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 57 | # This should ignore the error, but the inner noqa should be marked as unused. 58 | from typing import ( # noqa @@ -62,7 +62,7 @@ RUF100_1.py:59:20: RUF100 [**] Unused `noqa` directive (unused: `F401`) 61 61 | 62 62 | -RUF100_1.py:66:16: RUF100 [**] Unused `noqa` directive (non-enabled: `F501`) +RUF100_1.py:66:16: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 64 | # This should ignore the error, but mark F501 as unused. 65 | from typing import ( # noqa: F401 @@ -82,7 +82,7 @@ RUF100_1.py:66:16: RUF100 [**] Unused `noqa` directive (non-enabled: `F501`) 68 68 | 69 69 | -RUF100_1.py:72:27: RUF100 [**] Unused `noqa` directive (non-enabled: `F501`) +RUF100_1.py:72:27: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 70 | def f(): 71 | # This should ignore the error, but mark F501 as unused. @@ -135,7 +135,7 @@ RUF100_1.py:89:35: F401 [*] `typing.AwaitableGenerator` imported but unused 89 |- from typing import Awaitable, AwaitableGenerator # noqa: F501 89 |+ pass # noqa: F501 -RUF100_1.py:89:55: RUF100 [**] Unused `noqa` directive (non-enabled: `F501`) +RUF100_1.py:89:55: RUF100 [*] Unused `noqa` directive (non-enabled: `F501`) | 87 | def f(): 88 | # This should mark F501 as unused. diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap index 90e13752ec1b9e..3de393b1c95a4a 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_2.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF100_2.py:1:19: RUF100 [**] Unused `noqa` directive (unused: `F401`) +RUF100_2.py:1:19: RUF100 [*] Unused `noqa` directive (unused: `F401`) | 1 | import itertools # noqa: F401 | ^^^^^^^^^^^^ RUF100 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap index 9ad710e1886dfe..f7c08b2403df8d 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_3.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -RUF100_3.py:1:1: RUF100 [**] Unused blanket `noqa` directive +RUF100_3.py:1:1: RUF100 [*] Unused blanket `noqa` directive | 1 | # noqa | ^^^^^^ RUF100 @@ -16,7 +16,7 @@ RUF100_3.py:1:1: RUF100 [**] Unused blanket `noqa` directive 3 2 | print() # noqa 4 3 | print() # noqa # comment -RUF100_3.py:2:1: RUF100 [**] Unused blanket `noqa` directive +RUF100_3.py:2:1: RUF100 [*] Unused blanket `noqa` directive | 1 | # noqa 2 | # noqa # comment @@ -34,7 +34,7 @@ RUF100_3.py:2:1: RUF100 [**] Unused blanket `noqa` directive 4 4 | print() # noqa # comment 5 5 | print() # noqa # comment -RUF100_3.py:3:10: RUF100 [**] Unused blanket `noqa` directive +RUF100_3.py:3:10: RUF100 [*] Unused blanket `noqa` directive | 1 | # noqa 2 | # noqa # comment @@ -54,7 +54,7 @@ RUF100_3.py:3:10: RUF100 [**] Unused blanket `noqa` directive 5 5 | print() # noqa # comment 6 6 | print() # noqa comment -RUF100_3.py:4:10: RUF100 [**] Unused blanket `noqa` directive +RUF100_3.py:4:10: RUF100 [*] Unused blanket `noqa` directive | 2 | # noqa # comment 3 | print() # noqa @@ -75,7 +75,7 @@ RUF100_3.py:4:10: RUF100 [**] Unused blanket `noqa` directive 6 6 | print() # noqa comment 7 7 | print() # noqa comment -RUF100_3.py:5:10: RUF100 [**] Unused blanket `noqa` directive +RUF100_3.py:5:10: RUF100 [*] Unused blanket `noqa` directive | 3 | print() # noqa 4 | print() # noqa # comment @@ -96,7 +96,7 @@ RUF100_3.py:5:10: RUF100 [**] Unused blanket `noqa` directive 7 7 | print() # noqa comment 8 8 | print(a) # noqa -RUF100_3.py:6:10: RUF100 [**] Unused blanket `noqa` directive +RUF100_3.py:6:10: RUF100 [*] Unused blanket `noqa` directive | 4 | print() # noqa # comment 5 | print() # noqa # comment @@ -117,7 +117,7 @@ RUF100_3.py:6:10: RUF100 [**] Unused blanket `noqa` directive 8 8 | print(a) # noqa 9 9 | print(a) # noqa # comment -RUF100_3.py:7:10: RUF100 [**] Unused blanket `noqa` directive +RUF100_3.py:7:10: RUF100 [*] Unused blanket `noqa` directive | 5 | print() # noqa # comment 6 | print() # noqa comment @@ -138,7 +138,7 @@ RUF100_3.py:7:10: RUF100 [**] Unused blanket `noqa` directive 9 9 | print(a) # noqa # comment 10 10 | print(a) # noqa # comment -RUF100_3.py:14:1: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:14:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 12 | print(a) # noqa comment 13 | @@ -158,7 +158,7 @@ RUF100_3.py:14:1: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) 16 15 | print() # noqa: E501, F821 17 16 | print() # noqa: E501, F821 # comment -RUF100_3.py:15:1: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:15:1: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 14 | # noqa: E501, F821 15 | # noqa: E501, F821 # comment @@ -178,7 +178,7 @@ RUF100_3.py:15:1: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) 17 17 | print() # noqa: E501, F821 # comment 18 18 | print() # noqa: E501, F821 # comment -RUF100_3.py:16:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:16:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 14 | # noqa: E501, F821 15 | # noqa: E501, F821 # comment @@ -199,7 +199,7 @@ RUF100_3.py:16:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) 18 18 | print() # noqa: E501, F821 # comment 19 19 | print() # noqa: E501, F821 comment -RUF100_3.py:17:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:17:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 15 | # noqa: E501, F821 # comment 16 | print() # noqa: E501, F821 @@ -220,7 +220,7 @@ RUF100_3.py:17:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) 19 19 | print() # noqa: E501, F821 comment 20 20 | print() # noqa: E501, F821 comment -RUF100_3.py:18:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:18:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 16 | print() # noqa: E501, F821 17 | print() # noqa: E501, F821 # comment @@ -241,7 +241,7 @@ RUF100_3.py:18:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) 20 20 | print() # noqa: E501, F821 comment 21 21 | print(a) # noqa: E501, F821 -RUF100_3.py:19:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:19:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 17 | print() # noqa: E501, F821 # comment 18 | print() # noqa: E501, F821 # comment @@ -262,7 +262,7 @@ RUF100_3.py:19:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) 21 21 | print(a) # noqa: E501, F821 22 22 | print(a) # noqa: E501, F821 # comment -RUF100_3.py:20:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) +RUF100_3.py:20:10: RUF100 [*] Unused `noqa` directive (unused: `E501`, `F821`) | 18 | print() # noqa: E501, F821 # comment 19 | print() # noqa: E501, F821 comment @@ -283,7 +283,7 @@ RUF100_3.py:20:10: RUF100 [**] Unused `noqa` directive (unused: `E501`, `F821`) 22 22 | print(a) # noqa: E501, F821 # comment 23 23 | print(a) # noqa: E501, F821 # comment -RUF100_3.py:21:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:21:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 19 | print() # noqa: E501, F821 comment 20 | print() # noqa: E501, F821 comment @@ -304,7 +304,7 @@ RUF100_3.py:21:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) 23 23 | print(a) # noqa: E501, F821 # comment 24 24 | print(a) # noqa: E501, F821 comment -RUF100_3.py:22:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:22:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 20 | print() # noqa: E501, F821 comment 21 | print(a) # noqa: E501, F821 @@ -325,7 +325,7 @@ RUF100_3.py:22:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment -RUF100_3.py:23:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:23:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 21 | print(a) # noqa: E501, F821 22 | print(a) # noqa: E501, F821 # comment @@ -345,7 +345,7 @@ RUF100_3.py:23:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) 24 24 | print(a) # noqa: E501, F821 comment 25 25 | print(a) # noqa: E501, F821 comment -RUF100_3.py:24:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:24:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 22 | print(a) # noqa: E501, F821 # comment 23 | print(a) # noqa: E501, F821 # comment @@ -363,7 +363,7 @@ RUF100_3.py:24:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) 24 |+print(a) # noqa: F821 comment 25 25 | print(a) # noqa: E501, F821 comment -RUF100_3.py:25:11: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_3.py:25:11: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 23 | print(a) # noqa: E501, F821 # comment 24 | print(a) # noqa: E501, F821 comment diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap index 67c85f4452042e..6e2ade02471e95 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruf100_5.snap @@ -33,7 +33,7 @@ RUF100_5.py:11:1: ERA001 Found commented-out code 10 10 | 11 |-#import os # noqa: E501 -RUF100_5.py:11:13: RUF100 [**] Unused `noqa` directive (unused: `E501`) +RUF100_5.py:11:13: RUF100 [*] Unused `noqa` directive (unused: `E501`) | 11 | #import os # noqa: E501 | ^^^^^^^^^^^^ RUF100 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap index dc5cd3af52a6a0..974eba08c4e831 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_codes.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/ruff/mod.rs --- -ruff_noqa_codes.py:8:5: F841 [**] Local variable `x` is assigned to but never used +ruff_noqa_codes.py:8:5: F841 [*] Local variable `x` is assigned to but never used | 7 | def f(): 8 | x = 1 diff --git a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap index 94ba2d975e9478..c267b245b6535a 100644 --- a/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap +++ b/crates/ruff_linter/src/rules/ruff/snapshots/ruff_linter__rules__ruff__tests__ruff_noqa_invalid.snap @@ -14,7 +14,7 @@ ruff_noqa_invalid.py:1:8: F401 [*] `os` imported but unused 3 2 | 4 3 | def f(): -ruff_noqa_invalid.py:5:5: F841 [**] Local variable `x` is assigned to but never used +ruff_noqa_invalid.py:5:5: F841 [*] Local variable `x` is assigned to but never used | 4 | def f(): 5 | x = 1 diff --git a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap index a793b8bce48741..6a15b3815f265a 100644 --- a/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap +++ b/crates/ruff_linter/src/rules/tryceratops/snapshots/ruff_linter__rules__tryceratops__tests__verbose-raise_TRY201.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/tryceratops/mod.rs --- -TRY201.py:20:15: TRY201 [**] Use `raise` without specifying exception name +TRY201.py:20:15: TRY201 [*] Use `raise` without specifying exception name | 18 | except MyException as e: 19 | logger.exception("process failed") @@ -20,7 +20,7 @@ TRY201.py:20:15: TRY201 [**] Use `raise` without specifying exception name 22 22 | 23 23 | def good(): -TRY201.py:63:19: TRY201 [**] Use `raise` without specifying exception name +TRY201.py:63:19: TRY201 [*] Use `raise` without specifying exception name | 61 | logger.exception("process failed") 62 | if True: @@ -39,7 +39,7 @@ TRY201.py:63:19: TRY201 [**] Use `raise` without specifying exception name 65 65 | 66 66 | def bad_that_needs_recursion_2(): -TRY201.py:74:23: TRY201 [**] Use `raise` without specifying exception name +TRY201.py:74:23: TRY201 [*] Use `raise` without specifying exception name | 73 | def foo(): 74 | raise e diff --git a/crates/ruff_linter/src/settings/flags.rs b/crates/ruff_linter/src/settings/flags.rs index a41b9226314bd8..a1ce403194c83d 100644 --- a/crates/ruff_linter/src/settings/flags.rs +++ b/crates/ruff_linter/src/settings/flags.rs @@ -1,24 +1,8 @@ #[derive(Debug, Copy, Clone, Hash, is_macro::Is)] pub enum FixMode { - Generate(UnsafeFixes), - Apply(UnsafeFixes), - Diff(UnsafeFixes), -} - -impl FixMode { - pub fn unsafe_fixes(&self) -> &UnsafeFixes { - match self { - FixMode::Generate(suggested) => suggested, - FixMode::Apply(suggested) => suggested, - FixMode::Diff(suggested) => suggested, - } - } -} - -#[derive(Debug, Copy, Clone, Hash, is_macro::Is)] -pub enum UnsafeFixes { - Enabled, - Disabled, + Generate, + Apply, + Diff, } #[derive(Debug, Copy, Clone, Hash, result_like::BoolLike)] diff --git a/crates/ruff_linter/src/settings/mod.rs b/crates/ruff_linter/src/settings/mod.rs index 48fdf907f8db03..881611cfc8d528 100644 --- a/crates/ruff_linter/src/settings/mod.rs +++ b/crates/ruff_linter/src/settings/mod.rs @@ -60,6 +60,7 @@ pub struct LinterSettings { pub tab_size: TabSize, pub task_tags: Vec, pub typing_modules: Vec, + // Plugins pub flake8_annotations: flake8_annotations::settings::Settings, pub flake8_bandit: flake8_bandit::settings::Settings, diff --git a/crates/ruff_linter/src/settings/types.rs b/crates/ruff_linter/src/settings/types.rs index dc8a1e0f4ffd11..8cae1408a2b4ea 100644 --- a/crates/ruff_linter/src/settings/types.rs +++ b/crates/ruff_linter/src/settings/types.rs @@ -99,7 +99,7 @@ impl PythonVersion { } } -#[derive(Clone, Copy, Debug, PartialEq, Eq, Default, CacheKey, is_macro::Is)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, CacheKey, is_macro::Is)] pub enum PreviewMode { #[default] Disabled, @@ -116,6 +116,23 @@ impl From for PreviewMode { } } +#[derive(Debug, Copy, Clone, CacheKey, Default, PartialEq, Eq, is_macro::Is)] +pub enum UnsafeFixes { + #[default] + Disabled, + Enabled, +} + +impl From for UnsafeFixes { + fn from(version: bool) -> Self { + if version { + UnsafeFixes::Enabled + } else { + UnsafeFixes::Disabled + } + } +} + #[derive(Debug, Clone, CacheKey, PartialEq, PartialOrd, Eq, Ord)] pub enum FilePattern { Builtin(&'static str), diff --git a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap index be0132e57dbbde..24253dc073ad8b 100644 --- a/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap +++ b/crates/ruff_linter/src/snapshots/ruff_linter__linter__tests__unused_variable.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/linter.rs --- -unused_variable.ipynb:cell 1:2:5: F841 [**] Local variable `foo1` is assigned to but never used +unused_variable.ipynb:cell 1:2:5: F841 [*] Local variable `foo1` is assigned to but never used | 1 | def f(): 2 | foo1 = %matplotlib --list @@ -18,7 +18,7 @@ unused_variable.ipynb:cell 1:2:5: F841 [**] Local variable `foo1` is assigned to 4 4 | def f(): 5 5 | bar1 = !pwd -unused_variable.ipynb:cell 1:3:5: F841 [**] Local variable `foo2` is assigned to but never used +unused_variable.ipynb:cell 1:3:5: F841 [*] Local variable `foo2` is assigned to but never used | 1 | def f(): 2 | foo1 = %matplotlib --list @@ -36,7 +36,7 @@ unused_variable.ipynb:cell 1:3:5: F841 [**] Local variable `foo2` is assigned to 5 5 | bar1 = !pwd 6 6 | bar2: str = !pwd -unused_variable.ipynb:cell 2:2:5: F841 [**] Local variable `bar1` is assigned to but never used +unused_variable.ipynb:cell 2:2:5: F841 [*] Local variable `bar1` is assigned to but never used | 1 | def f(): 2 | bar1 = !pwd @@ -53,7 +53,7 @@ unused_variable.ipynb:cell 2:2:5: F841 [**] Local variable `bar1` is assigned to 5 |+ !pwd 6 6 | bar2: str = !pwd -unused_variable.ipynb:cell 2:3:5: F841 [**] Local variable `bar2` is assigned to but never used +unused_variable.ipynb:cell 2:3:5: F841 [*] Local variable `bar2` is assigned to but never used | 1 | def f(): 2 | bar1 = !pwd diff --git a/crates/ruff_linter/src/test.rs b/crates/ruff_linter/src/test.rs index c3c5793db0f14a..9a237f4c397e67 100644 --- a/crates/ruff_linter/src/test.rs +++ b/crates/ruff_linter/src/test.rs @@ -26,6 +26,7 @@ use crate::message::{Emitter, EmitterContext, Message, TextEmitter}; use crate::packaging::detect_package_root; use crate::registry::AsRule; use crate::rules::pycodestyle::rules::syntax_error; +use crate::settings::types::UnsafeFixes; use crate::settings::{flags, LinterSettings}; use crate::source_kind::SourceKind; use ruff_notebook::Notebook; @@ -158,7 +159,7 @@ pub(crate) fn test_contents<'a>( }) = fix_file( &diagnostics, &Locator::new(transformed.source_code()), - flags::UnsafeFixes::Enabled, + UnsafeFixes::Enabled, ) { if iterations < max_iterations() { iterations += 1; diff --git a/crates/ruff_workspace/src/configuration.rs b/crates/ruff_workspace/src/configuration.rs index 47734ff415efb5..9733bbf197bdfd 100644 --- a/crates/ruff_workspace/src/configuration.rs +++ b/crates/ruff_workspace/src/configuration.rs @@ -24,7 +24,7 @@ use ruff_linter::rule_selector::{PreviewOptions, Specificity}; use ruff_linter::settings::rule_table::RuleTable; use ruff_linter::settings::types::{ FilePattern, FilePatternSet, PerFileIgnore, PreviewMode, PythonVersion, SerializationFormat, - Version, + UnsafeFixes, Version, }; use ruff_linter::settings::{ resolve_per_file_ignores, LinterSettings, DUMMY_VARIABLE_RGX, PREFIXES, TASK_TAGS, @@ -63,8 +63,8 @@ pub struct Configuration { pub cache_dir: Option, pub extend: Option, pub fix: Option, - pub unsafe_fixes: Option, pub fix_only: Option, + pub unsafe_fixes: Option, pub output_format: Option, pub preview: Option, pub required_version: Option, @@ -137,8 +137,8 @@ impl Configuration { .clone() .unwrap_or_else(|| cache_dir(project_root)), fix: self.fix.unwrap_or(false), - unsafe_fixes: self.unsafe_fixes.unwrap_or(false), fix_only: self.fix_only.unwrap_or(false), + unsafe_fixes: self.unsafe_fixes.unwrap_or_default(), output_format: self.output_format.unwrap_or_default(), show_fixes: self.show_fixes.unwrap_or(false), show_source: self.show_source.unwrap_or(false), @@ -367,7 +367,7 @@ impl Configuration { }), fix: options.fix, fix_only: options.fix_only, - unsafe_fixes: options.unsafe_fixes, + unsafe_fixes: options.unsafe_fixes.map(UnsafeFixes::from), output_format: options.output_format.or_else(|| { options .format diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index c9e0037a33b8e0..1a79575c52ae49 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -93,7 +93,7 @@ pub struct Options { #[option(default = "false", value_type = "bool", example = "fix = true")] pub fix: Option, - /// Enable application of suggested fixes. + /// Enable application of unsafe fixes. #[option( default = "false", value_type = "bool", diff --git a/crates/ruff_workspace/src/settings.rs b/crates/ruff_workspace/src/settings.rs index 12319c7cc8177e..ec4b2834d70f6a 100644 --- a/crates/ruff_workspace/src/settings.rs +++ b/crates/ruff_workspace/src/settings.rs @@ -1,7 +1,7 @@ use path_absolutize::path_dedot; use ruff_cache::cache_dir; use ruff_formatter::{FormatOptions, IndentStyle, LineWidth}; -use ruff_linter::settings::types::{FilePattern, FilePatternSet, SerializationFormat}; +use ruff_linter::settings::types::{FilePattern, FilePatternSet, SerializationFormat, UnsafeFixes}; use ruff_linter::settings::LinterSettings; use ruff_macros::CacheKey; use ruff_python_ast::PySourceType; @@ -17,10 +17,10 @@ pub struct Settings { #[cache_key(ignore)] pub fix: bool, #[cache_key(ignore)] - pub unsafe_fixes: bool, - #[cache_key(ignore)] pub fix_only: bool, #[cache_key(ignore)] + pub unsafe_fixes: UnsafeFixes, + #[cache_key(ignore)] pub output_format: SerializationFormat, #[cache_key(ignore)] pub show_fixes: bool, @@ -38,11 +38,11 @@ impl Default for Settings { Self { cache_dir: cache_dir(project_root), fix: false, - unsafe_fixes: false, fix_only: false, output_format: SerializationFormat::default(), show_fixes: false, show_source: false, + unsafe_fixes: UnsafeFixes::default(), linter: LinterSettings::new(project_root), file_resolver: FileResolverSettings::new(project_root), formatter: FormatterSettings::default(), diff --git a/docs/configuration.md b/docs/configuration.md index 3ed52745dd87e2..cc6b5291b97ec7 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -196,6 +196,8 @@ Options: Apply fixes to resolve lint violations. Use `--no-fix` to disable or `--unsafe-fixes` to include suggested fixes --unsafe-fixes Include fixes that may not retain the original intent of the code + --no-unsafe-fixes + --show-source Show violations with source code. Use `--no-show-source` to disable --show-fixes diff --git a/ruff.schema.json b/ruff.schema.json index 5befc9f6c5e1a0..de0bf5807ed9d4 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -639,7 +639,7 @@ } }, "unsafe-fixes": { - "description": "Enable application of suggested fixes.", + "description": "Enable application of unsafe fixes.", "type": [ "boolean", "null" From 98c2c295755cd05dfcb54b31066a432b14e0c397 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 14:49:21 -0500 Subject: [PATCH 17/28] Update order of applicability levels for `Ord` --- crates/ruff_diagnostics/src/fix.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ruff_diagnostics/src/fix.rs b/crates/ruff_diagnostics/src/fix.rs index 651456a2a71b32..cbc6995b370987 100644 --- a/crates/ruff_diagnostics/src/fix.rs +++ b/crates/ruff_diagnostics/src/fix.rs @@ -10,17 +10,17 @@ use crate::edit::Edit; #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))] pub enum Applicability { - /// The fix is safe and can always be applied. - /// The fix is definitely what the user intended, or it maintains the exact meaning of the code. - Always, + /// The fix is unsafe and should only be manually applied by the user. + /// The fix is likely to be incorrect or the resulting code may have invalid syntax. + Never, /// The fix is unsafe and should only be applied with user opt-in. /// The fix may be what the user intended, but it is uncertain; the resulting code will have valid syntax. Sometimes, - /// The fix is unsafe and should only be manually applied by the user. - /// The fix is likely to be incorrect or the resulting code may have invalid syntax. - Never, + /// The fix is safe and can always be applied. + /// The fix is definitely what the user intended, or it maintains the exact meaning of the code. + Always, } /// Indicates the level of isolation required to apply a fix. From f57b8534c82197a6e43e71b3ca273945a663675b Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 15:12:10 -0500 Subject: [PATCH 18/28] Fix merge compile errors --- crates/ruff_cli/src/commands/check.rs | 2 +- crates/ruff_cli/src/commands/check_stdin.rs | 2 +- crates/ruff_cli/src/diagnostics.rs | 239 +++++++------------- crates/ruff_cli/src/lib.rs | 2 +- crates/ruff_cli/src/printer.rs | 8 +- crates/ruff_cli/tests/integration_test.rs | 90 +++++++- crates/ruff_linter/src/fix/mod.rs | 8 +- crates/ruff_linter/src/message/text.rs | 16 +- crates/ruff_linter/src/settings/types.rs | 10 + 9 files changed, 187 insertions(+), 190 deletions(-) diff --git a/crates/ruff_cli/src/commands/check.rs b/crates/ruff_cli/src/commands/check.rs index 121e524ee81498..4aba4bb98296e2 100644 --- a/crates/ruff_cli/src/commands/check.rs +++ b/crates/ruff_cli/src/commands/check.rs @@ -244,7 +244,7 @@ mod test { use std::os::unix::fs::OpenOptionsExt; use anyhow::Result; - use ruff_linter::settings::types::UnsafeFixes; + use rustc_hash::FxHashMap; use tempfile::TempDir; diff --git a/crates/ruff_cli/src/commands/check_stdin.rs b/crates/ruff_cli/src/commands/check_stdin.rs index 2641bedd686021..ab15f61439f438 100644 --- a/crates/ruff_cli/src/commands/check_stdin.rs +++ b/crates/ruff_cli/src/commands/check_stdin.rs @@ -30,7 +30,7 @@ pub(crate) fn check_stdin( let mut diagnostics = lint_stdin( filename, package_root, - &stdin, + stdin, &pyproject_config.settings, noqa, fix_mode, diff --git a/crates/ruff_cli/src/diagnostics.rs b/crates/ruff_cli/src/diagnostics.rs index c543dc95d8c700..c4ea03c55ba817 100644 --- a/crates/ruff_cli/src/diagnostics.rs +++ b/crates/ruff_cli/src/diagnostics.rs @@ -11,6 +11,7 @@ use anyhow::{Context, Result}; use colored::Colorize; use filetime::FileTime; use log::{debug, error, warn}; +use ruff_linter::settings::types::UnsafeFixes; use rustc_hash::FxHashMap; use ruff_diagnostics::Diagnostic; @@ -19,7 +20,6 @@ use ruff_linter::logging::DisplayParseError; use ruff_linter::message::Message; use ruff_linter::pyproject_toml::lint_pyproject_toml; use ruff_linter::registry::AsRule; -use ruff_linter::settings::types::UnsafeFixes; use ruff_linter::settings::{flags, LinterSettings}; use ruff_linter::source_kind::{SourceError, SourceKind}; use ruff_linter::{fs, IOError, SyntaxError}; @@ -241,109 +241,44 @@ pub(crate) fn lint_path( error: parse_error, }, fixed, - ) = match fix_mode { - flags::FixMode::Apply | flags::FixMode::Diff => { - if let Ok(FixerResult { - result, - transformed, - fixed, - }) = lint_fix( - path, - package, - noqa, - unsafe_fixes, - settings, - &source_kind, - source_type, - ) { - if !fixed.is_empty() { - match fix_mode { - flags::FixMode::Apply => match transformed.as_ref() { - SourceKind::Python(transformed) => { - write(path, transformed.as_bytes())?; - } - SourceKind::IpyNotebook(notebook) => { - let mut writer = BufWriter::new(File::create(path)?); - notebook.write(&mut writer)?; - } - }, - flags::FixMode::Diff => { - match transformed.as_ref() { - SourceKind::Python(transformed) => { - let mut stdout = io::stdout().lock(); - TextDiff::from_lines(source_kind.source_code(), transformed) - .unified_diff() - .header( - &fs::relativize_path(path), - &fs::relativize_path(path), - ) - .to_writer(&mut stdout)?; - stdout.write_all(b"\n")?; - stdout.flush()?; - } - SourceKind::IpyNotebook(dest_notebook) => { - // We need to load the notebook again, since we might've - // mutated it. - let src_notebook = source_kind.as_ipy_notebook().unwrap(); - let mut stdout = io::stdout().lock(); - // Cell indices are 1-based. - for ((idx, src_cell), dest_cell) in (1u32..) - .zip(src_notebook.cells().iter()) - .zip(dest_notebook.cells().iter()) - { - let (Cell::Code(src_code_cell), Cell::Code(dest_code_cell)) = - (src_cell, dest_cell) - else { - continue; - }; - TextDiff::from_lines( - &src_code_cell.source.to_string(), - &dest_code_cell.source.to_string(), - ) - .unified_diff() - // Jupyter notebook cells don't necessarily have a newline - // at the end. For example, - // - // ```python - // print("hello") - // ``` - // - // For a cell containing the above code, there'll only be one line, - // and it won't have a newline at the end. If it did, there'd be - // two lines, and the second line would be empty: - // - // ```python - // print("hello") - // - // ``` - .missing_newline_hint(false) - .header( - &format!("{}:cell {}", &fs::relativize_path(path), idx), - &format!("{}:cell {}", &fs::relativize_path(path), idx), - ) - .to_writer(&mut stdout)?; - } - stdout.write_all(b"\n")?; - stdout.flush()?; - } - } - } - flags::FixMode::Generate => {} + ) = if matches!(fix_mode, flags::FixMode::Apply | flags::FixMode::Diff) { + if let Ok(FixerResult { + result, + transformed, + fixed, + }) = lint_fix( + path, + package, + noqa, + unsafe_fixes, + settings, + &source_kind, + source_type, + ) { + if !fixed.is_empty() { + match fix_mode { + flags::FixMode::Apply => transformed.write(&mut File::create(path)?)?, + flags::FixMode::Diff => { + source_kind.diff( + transformed.as_ref(), + Some(path), + &mut io::stdout().lock(), + )?; } + flags::FixMode::Generate => {} } - (result, fixed) - } else { - // If we fail to fix, lint the original source code. - let result = lint_only(path, package, settings, noqa, &source_kind, source_type); - let fixed = FxHashMap::default(); - (result, fixed) } - } - flags::FixMode::Generate => { + (result, fixed) + } else { + // If we fail to fix, lint the original source code. let result = lint_only(path, package, settings, noqa, &source_kind, source_type); let fixed = FxHashMap::default(); (result, fixed) } + } else { + let result = lint_only(path, package, settings, noqa, &source_kind, source_type); + let fixed = FxHashMap::default(); + (result, fixed) }; let imports = imports.unwrap_or_default(); @@ -394,7 +329,7 @@ pub(crate) fn lint_path( pub(crate) fn lint_stdin( path: Option<&Path>, package: Option<&Path>, - contents: &str, + contents: String, settings: &Settings, noqa: flags::Noqa, fix_mode: flags::FixMode, @@ -405,7 +340,7 @@ pub(crate) fn lint_stdin( }; // Extract the sources from the file. - let source_kind = match SourceKind::from_source_code(contents.to_string(), source_type) { + let source_kind = match SourceKind::from_source_code(contents, source_type) { Ok(Some(source_kind)) => source_kind, Ok(None) => return Ok(Diagnostics::default()), Err(err) => { @@ -420,70 +355,37 @@ pub(crate) fn lint_stdin( error: parse_error, }, fixed, - ) = match fix_mode { - flags::FixMode::Apply | flags::FixMode::Diff => { - if let Ok(FixerResult { - result, - transformed, - fixed, - }) = lint_fix( - path.unwrap_or_else(|| Path::new("-")), - package, - noqa, - settings.unsafe_fixes, - &settings.linter, - &source_kind, - source_type, - ) { - match fix_mode { - flags::FixMode::Apply => { - // Write the contents to stdout, regardless of whether any errors were fixed. - io::stdout().write_all(transformed.source_code().as_bytes())?; - } - flags::FixMode::Diff => { - // But only write a diff if it's non-empty. - if !fixed.is_empty() { - let text_diff = TextDiff::from_lines( - source_kind.source_code(), - transformed.source_code(), - ); - let mut unified_diff = text_diff.unified_diff(); - if let Some(path) = path { - unified_diff - .header(&fs::relativize_path(path), &fs::relativize_path(path)); - } - - let mut stdout = io::stdout().lock(); - unified_diff.to_writer(&mut stdout)?; - stdout.write_all(b"\n")?; - stdout.flush()?; - } - } - flags::FixMode::Generate => {} + ) = if matches!(fix_mode, flags::FixMode::Apply | flags::FixMode::Diff) { + if let Ok(FixerResult { + result, + transformed, + fixed, + }) = lint_fix( + path.unwrap_or_else(|| Path::new("-")), + package, + noqa, + settings.unsafe_fixes, + &settings.linter, + &source_kind, + source_type, + ) { + match fix_mode { + flags::FixMode::Apply => { + // Write the contents to stdout, regardless of whether any errors were fixed. + transformed.write(&mut io::stdout().lock())?; } - - (result, fixed) - } else { - // If we fail to fix, lint the original source code. - let result = lint_only( - path.unwrap_or_else(|| Path::new("-")), - package, - &settings.linter, - noqa, - &source_kind, - source_type, - ); - let fixed = FxHashMap::default(); - - // Write the contents to stdout anyway. - if fix_mode.is_apply() { - io::stdout().write_all(contents.as_bytes())?; + flags::FixMode::Diff => { + // But only write a diff if it's non-empty. + if !fixed.is_empty() { + source_kind.diff(transformed.as_ref(), path, &mut io::stdout().lock())?; + } } - - (result, fixed) + flags::FixMode::Generate => {} } - } - flags::FixMode::Generate => { + + (result, fixed) + } else { + // If we fail to fix, lint the original source code. let result = lint_only( path.unwrap_or_else(|| Path::new("-")), package, @@ -493,8 +395,25 @@ pub(crate) fn lint_stdin( source_type, ); let fixed = FxHashMap::default(); + + // Write the contents to stdout anyway. + if fix_mode.is_apply() { + source_kind.write(&mut io::stdout().lock())?; + } + (result, fixed) } + } else { + let result = lint_only( + path.unwrap_or_else(|| Path::new("-")), + package, + &settings.linter, + noqa, + &source_kind, + source_type, + ); + let fixed = FxHashMap::default(); + (result, fixed) }; let imports = imports.unwrap_or_default(); diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index f8744d660afcea..baff497d2b490a 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -11,7 +11,7 @@ use notify::{recommended_watcher, RecursiveMode, Watcher}; use ruff_linter::logging::{set_up_logging, LogLevel}; use ruff_linter::settings::flags::FixMode; -use ruff_linter::settings::types::{SerializationFormat, UnsafeFixes}; +use ruff_linter::settings::types::{SerializationFormat}; use ruff_linter::{fs, warn_user, warn_user_once}; use ruff_workspace::Settings; diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index ca2880ffa38ba8..9e6402aac7541f 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -443,7 +443,7 @@ fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap Ok(()) } -/// Contains the number of [`Applicability::Automatic`] and [`Applicability::Suggested`] fixes +/// Contains the number of [`Applicability::Always`] and [`Applicability::Sometimes`] fixes struct FixableStatistics { safe_count: u32, unsafe_count: u32, @@ -457,9 +457,9 @@ impl FixableStatistics { for message in &diagnostics.messages { if let Some(fix) = &message.fix { - if fix.applicability() == Applicability::Suggested { + if fix.applicability() == Applicability::Sometimes { unsafe_count += 1; - } else if fix.applicability() == Applicability::Automatic { + } else if fix.applicability() == Applicability::Always { safe_count += 1; } } @@ -482,7 +482,7 @@ impl FixableStatistics { /// Build the displayed fix status message depending on the types of the remaining fixes. fn violation_string(&self) -> Option { - let fix_prefix = format!("[{}]", Applicability::Automatic.symbol().cyan()); + let fix_prefix = format!("[{}]", "*".cyan()); if self.show_unsafe_fixes { let fixable_count = self.safe_count + self.unsafe_count; diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index e16b9bee37b022..1dcbe5b2709cb8 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -241,9 +241,81 @@ fn stdin_fix_jupyter() { success: true exit_code: 0 ----- stdout ----- - print(1) - - + { + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "dccc687c-96e2-4604-b957-a8a89b5bec06", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "19e1b029-f516-4662-a9b9-623b93edac1a", + "metadata": {}, + "source": [ + "Foo" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "cdce7b92-b0fb-4c02-86f6-e233b26fa84f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "e40b33d2-7fe4-46c5-bdf0-8802f3052565", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n" + ] + } + ], + "source": [ + "print(1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a1899bc8-d46f-4ec0-b1d1-e1ca0f04bf60", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 + } ----- stderr ----- "###); } @@ -918,10 +990,10 @@ fn diff_shows_safe_and_unsafe_fixes_with_unsafe_fixes() { exit_code: 1 ----- stdout ----- @@ -1,2 +1,2 @@ - -x = {'a': 1, 'a': 1} - -print(('foo')) - +x = {'a': 1} - +print('foo') + -x = {'a': 1} + -print('foo') + +x = {'a': 1, 'a': 1} + +print(('foo')) ----- stderr ----- @@ -950,8 +1022,8 @@ fn diff_shows_safe_fixes_only() { ----- stdout ----- @@ -1,2 +1,2 @@ x = {'a': 1, 'a': 1} - -print(('foo')) - +print('foo') + -print('foo') + +print(('foo')) ----- stderr ----- diff --git a/crates/ruff_linter/src/fix/mod.rs b/crates/ruff_linter/src/fix/mod.rs index 50ebf594931a3f..09b9a2def7fcdd 100644 --- a/crates/ruff_linter/src/fix/mod.rs +++ b/crates/ruff_linter/src/fix/mod.rs @@ -4,7 +4,7 @@ use std::collections::BTreeSet; use ruff_text_size::{Ranged, TextLen, TextRange, TextSize}; use rustc_hash::{FxHashMap, FxHashSet}; -use ruff_diagnostics::{Applicability, Diagnostic, Edit, Fix, IsolationLevel, SourceMap}; +use ruff_diagnostics::{Diagnostic, Edit, Fix, IsolationLevel, SourceMap}; use ruff_source_file::Locator; use crate::linter::FixTable; @@ -30,11 +30,7 @@ pub(crate) fn fix_file( locator: &Locator, unsafe_fixes: UnsafeFixes, ) -> Option { - let required_applicability = if unsafe_fixes.is_enabled() { - Applicability::Suggested - } else { - Applicability::Automatic - }; + let required_applicability = unsafe_fixes.required_applicability(); let mut with_fixes = diagnostics .iter() diff --git a/crates/ruff_linter/src/message/text.rs b/crates/ruff_linter/src/message/text.rs index b1e5a31f1a8e71..bfc3b56467ba64 100644 --- a/crates/ruff_linter/src/message/text.rs +++ b/crates/ruff_linter/src/message/text.rs @@ -7,7 +7,7 @@ use annotate_snippets::snippet::{Annotation, AnnotationType, Slice, Snippet, Sou use bitflags::bitflags; use colored::Colorize; -use ruff_diagnostics::Applicability; + use ruff_notebook::NotebookIndex; use ruff_source_file::{OneIndexed, SourceLocation}; use ruff_text_size::{Ranged, TextRange, TextSize}; @@ -17,6 +17,7 @@ use crate::line_width::{LineWidthBuilder, TabSize}; use crate::message::diff::Diff; use crate::message::{Emitter, EmitterContext, Message}; use crate::registry::AsRule; +use crate::settings::types::UnsafeFixes; bitflags! { #[derive(Default)] @@ -153,20 +154,19 @@ impl Display for RuleCodeAndBody<'_> { let kind = &self.message.kind; if self.show_fix_status { if let Some(fix) = self.message.fix.as_ref() { - let required_applicability = if self.show_unsafe_fixes { - Applicability::Suggested + let unsafe_fixes = if self.show_unsafe_fixes { + UnsafeFixes::Enabled } else { - Applicability::Automatic + UnsafeFixes::Disabled }; - // Do not display an indicator for unapplicable fixes - if fix.applies(required_applicability) { - let indicator = fix.applicability().symbol(); + // Do not display an indicator for unapplicable fixes + if fix.applies(unsafe_fixes.required_applicability()) { return write!( f, "{code} {fix}{body}", code = kind.rule().noqa_code().to_string().red().bold(), - fix = format_args!("[{}] ", indicator.cyan()), + fix = format_args!("[{}] ", "*".cyan()), body = kind.body, ); } diff --git a/crates/ruff_linter/src/settings/types.rs b/crates/ruff_linter/src/settings/types.rs index 8cae1408a2b4ea..0bdc8b9d587cff 100644 --- a/crates/ruff_linter/src/settings/types.rs +++ b/crates/ruff_linter/src/settings/types.rs @@ -7,6 +7,7 @@ use std::string::ToString; use anyhow::{bail, Result}; use globset::{Glob, GlobSet, GlobSetBuilder}; use pep440_rs::{Version as Pep440Version, VersionSpecifiers}; +use ruff_diagnostics::Applicability; use serde::{de, Deserialize, Deserializer, Serialize}; use strum::IntoEnumIterator; use strum_macros::EnumIter; @@ -133,6 +134,15 @@ impl From for UnsafeFixes { } } +impl UnsafeFixes { + pub fn required_applicability(&self) -> Applicability { + match self { + Self::Enabled => Applicability::Sometimes, + Self::Disabled => Applicability::Always, + } + } +} + #[derive(Debug, Clone, CacheKey, PartialEq, PartialOrd, Eq, Ord)] pub enum FilePattern { Builtin(&'static str), From a57e3d3372323eadf7884784a4c690ac49c2cb30 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 15:27:36 -0500 Subject: [PATCH 19/28] Refactor unsafe fix display to avoid using flags --- crates/ruff_cli/src/lib.rs | 13 ++-- crates/ruff_cli/src/printer.rs | 80 ++++++++++------------- crates/ruff_linter/src/message/grouped.rs | 9 +-- crates/ruff_linter/src/message/text.rs | 24 +++---- crates/ruff_linter/src/test.rs | 4 +- 5 files changed, 59 insertions(+), 71 deletions(-) diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index baff497d2b490a..5815860e390782 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -11,7 +11,7 @@ use notify::{recommended_watcher, RecursiveMode, Watcher}; use ruff_linter::logging::{set_up_logging, LogLevel}; use ruff_linter::settings::flags::FixMode; -use ruff_linter::settings::types::{SerializationFormat}; +use ruff_linter::settings::types::SerializationFormat; use ruff_linter::{fs, warn_user, warn_user_once}; use ruff_workspace::Settings; @@ -263,9 +263,6 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { if show_source { printer_flags |= PrinterFlags::SHOW_SOURCE; } - if unsafe_fixes.is_enabled() { - printer_flags |= PrinterFlags::SHOW_UNSAFE_FIXES; - } if cli.ecosystem_ci { warn_user!( "The formatting of fixes emitted by this option is a work-in-progress, subject to \ @@ -297,7 +294,13 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { return Ok(ExitStatus::Success); } - let printer = Printer::new(output_format, log_level, fix_mode, printer_flags); + let printer = Printer::new( + output_format, + log_level, + fix_mode, + unsafe_fixes, + printer_flags, + ); if cli.watch { if output_format != SerializationFormat::Text { diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index 9e6402aac7541f..57772bcb016415 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -7,7 +7,6 @@ use anyhow::Result; use bitflags::bitflags; use colored::Colorize; use itertools::{iterate, Itertools}; -use ruff_diagnostics::Applicability; use rustc_hash::FxHashMap; use serde::Serialize; @@ -21,7 +20,7 @@ use ruff_linter::message::{ use ruff_linter::notify_user; use ruff_linter::registry::{AsRule, Rule}; use ruff_linter::settings::flags::{self}; -use ruff_linter::settings::types::SerializationFormat; +use ruff_linter::settings::types::{SerializationFormat, UnsafeFixes}; use crate::diagnostics::Diagnostics; @@ -36,8 +35,6 @@ bitflags! { const SHOW_FIX_SUMMARY = 0b0000_0100; /// Whether to show a diff of each fixed violation when emitting diagnostics. const SHOW_FIX_DIFF = 0b0000_1000; - /// Whether to include unsafe fixes when emitting diagnostics. - const SHOW_UNSAFE_FIXES = 0b0001_0000; } } @@ -76,6 +73,7 @@ pub(crate) struct Printer { format: SerializationFormat, log_level: LogLevel, fix_mode: flags::FixMode, + unsafe_fixes: UnsafeFixes, flags: Flags, } @@ -84,12 +82,14 @@ impl Printer { format: SerializationFormat, log_level: LogLevel, fix_mode: flags::FixMode, + unsafe_fixes: UnsafeFixes, flags: Flags, ) -> Self { Self { format, log_level, fix_mode, + unsafe_fixes, flags, } } @@ -121,10 +121,7 @@ impl Printer { writeln!(writer, "Found {remaining} error{s}.")?; } - let fixables = FixableStatistics::new( - diagnostics, - self.flags.intersects(Flags::SHOW_UNSAFE_FIXES), - ); + let fixables = FixableStatistics::new(diagnostics, self.unsafe_fixes); if let Some(violation_message) = fixables.violation_string() { writeln!(writer, "{violation_message}")?; } @@ -174,8 +171,7 @@ impl Printer { } let context = EmitterContext::new(&diagnostics.notebook_indexes); - let fixables = - FixableStatistics::new(diagnostics, self.flags.intersects(Flags::SHOW_UNSAFE_FIXES)); + let fixables = FixableStatistics::new(diagnostics, self.unsafe_fixes); match self.format { SerializationFormat::Json => { @@ -192,7 +188,7 @@ impl Printer { .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) .with_show_fix_diff(self.flags.intersects(Flags::SHOW_FIX_DIFF)) .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) - .with_show_unsafe_fixes(self.flags.intersects(Flags::SHOW_UNSAFE_FIXES)) + .with_unsafe_fixes(self.unsafe_fixes) .emit(writer, &diagnostics.messages, &context)?; if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) { @@ -358,8 +354,7 @@ impl Printer { ); } - let fixables = - FixableStatistics::new(diagnostics, self.flags.intersects(Flags::SHOW_UNSAFE_FIXES)); + let fixables = FixableStatistics::new(diagnostics, self.unsafe_fixes); if !diagnostics.messages.is_empty() { if self.log_level >= LogLevel::Default { @@ -370,7 +365,7 @@ impl Printer { TextEmitter::default() .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) - .with_show_unsafe_fixes(self.flags.intersects(Flags::SHOW_UNSAFE_FIXES)) + .with_unsafe_fixes(self.unsafe_fixes) .emit(writer, &diagnostics.messages, &context)?; } writer.flush()?; @@ -444,74 +439,71 @@ fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap } /// Contains the number of [`Applicability::Always`] and [`Applicability::Sometimes`] fixes +#[derive(Debug)] struct FixableStatistics { - safe_count: u32, - unsafe_count: u32, - show_unsafe_fixes: bool, + applicable: u32, + unapplicable: u32, + unsafe_fixes: UnsafeFixes, } impl FixableStatistics { - fn new(diagnostics: &Diagnostics, show_unsafe_fixes: bool) -> Self { - let mut safe_count = 0; - let mut unsafe_count = 0; + fn new(diagnostics: &Diagnostics, unsafe_fixes: UnsafeFixes) -> Self { + let mut applicable = 0; + let mut unapplicable = 0; for message in &diagnostics.messages { if let Some(fix) = &message.fix { - if fix.applicability() == Applicability::Sometimes { - unsafe_count += 1; - } else if fix.applicability() == Applicability::Always { - safe_count += 1; + if fix.applies(unsafe_fixes.required_applicability()) { + applicable += 1; + } else { + unapplicable += 1; } } } Self { - safe_count, - unsafe_count, - show_unsafe_fixes, + applicable, + unapplicable, + unsafe_fixes, } } fn any_fixes_applicable(&self) -> bool { - if self.show_unsafe_fixes { - self.safe_count > 0 || self.unsafe_count > 0 - } else { - self.safe_count > 0 - } + return self.applicable > 0; } /// Build the displayed fix status message depending on the types of the remaining fixes. fn violation_string(&self) -> Option { let fix_prefix = format!("[{}]", "*".cyan()); - if self.show_unsafe_fixes { - let fixable_count = self.safe_count + self.unsafe_count; - if fixable_count > 0 { + if self.unsafe_fixes.is_enabled() { + if self.applicable > 0 { Some(format!( - "{fix_prefix} {fixable_count} fixable with the --fix option.", + "{fix_prefix} {} fixable with the --fix option.", + self.applicable )) } else { None } } else { - if self.safe_count > 0 && self.unsafe_count > 0 { - let es = if self.unsafe_count == 1 { "" } else { "es" }; + if self.applicable > 0 && self.unapplicable > 0 { + let es = if self.unapplicable == 1 { "" } else { "es" }; Some( format!( "{fix_prefix} {} fixable with the --fix option ({} hidden fix{es} can be enabled with the --unsafe-fixes option).", - self.safe_count, self.unsafe_count + self.applicable, self.unapplicable ) ) - } else if self.safe_count > 0 { + } else if self.applicable > 0 { Some(format!( "{fix_prefix} {} fixable with the --fix option.", - self.safe_count, + self.applicable, )) - } else if self.unsafe_count > 0 { - let es = if self.unsafe_count == 1 { "" } else { "es" }; + } else if self.unapplicable > 0 { + let es = if self.unapplicable == 1 { "" } else { "es" }; Some(format!( "{} hidden fix{es} can be enabled with the --unsafe-fixes option.", - self.unsafe_count + self.unapplicable )) } else { None diff --git a/crates/ruff_linter/src/message/grouped.rs b/crates/ruff_linter/src/message/grouped.rs index f5c2d5b48a3867..0b714c3596d7ed 100644 --- a/crates/ruff_linter/src/message/grouped.rs +++ b/crates/ruff_linter/src/message/grouped.rs @@ -13,12 +13,13 @@ use crate::message::text::{MessageCodeFrame, RuleCodeAndBody}; use crate::message::{ group_messages_by_filename, Emitter, EmitterContext, Message, MessageWithLocation, }; +use crate::settings::types::UnsafeFixes; #[derive(Default)] pub struct GroupedEmitter { show_fix_status: bool, show_source: bool, - show_unsafe_fixes: bool, + unsafe_fixes: UnsafeFixes, } impl GroupedEmitter { @@ -69,7 +70,7 @@ impl Emitter for GroupedEmitter { notebook_index: context.notebook_index(message.filename()), message, show_fix_status: self.show_fix_status, - show_unsafe_fixes: self.show_unsafe_fixes, + unsafe_fixes: self.unsafe_fixes, show_source: self.show_source, row_length, column_length, @@ -91,7 +92,7 @@ impl Emitter for GroupedEmitter { struct DisplayGroupedMessage<'a> { message: MessageWithLocation<'a>, show_fix_status: bool, - show_unsafe_fixes: bool, + unsafe_fixes: UnsafeFixes, show_source: bool, row_length: NonZeroUsize, column_length: NonZeroUsize, @@ -142,7 +143,7 @@ impl Display for DisplayGroupedMessage<'_> { code_and_body = RuleCodeAndBody { message, show_fix_status: self.show_fix_status, - show_unsafe_fixes: self.show_unsafe_fixes + unsafe_fixes: self.unsafe_fixes }, )?; diff --git a/crates/ruff_linter/src/message/text.rs b/crates/ruff_linter/src/message/text.rs index bfc3b56467ba64..867f92bc031deb 100644 --- a/crates/ruff_linter/src/message/text.rs +++ b/crates/ruff_linter/src/message/text.rs @@ -7,7 +7,6 @@ use annotate_snippets::snippet::{Annotation, AnnotationType, Slice, Snippet, Sou use bitflags::bitflags; use colored::Colorize; - use ruff_notebook::NotebookIndex; use ruff_source_file::{OneIndexed, SourceLocation}; use ruff_text_size::{Ranged, TextRange, TextSize}; @@ -28,14 +27,13 @@ bitflags! { const SHOW_FIX_DIFF = 0b0000_0010; /// Whether to show the source code of a diagnostic. const SHOW_SOURCE = 0b0000_0100; - /// Whether to show unsafe fixes. - const SHOW_UNSAFE_FIXES = 0b0000_1000; } } #[derive(Default)] pub struct TextEmitter { flags: EmitterFlags, + unsafe_fixes: UnsafeFixes, } impl TextEmitter { @@ -59,9 +57,8 @@ impl TextEmitter { } #[must_use] - pub fn with_show_unsafe_fixes(mut self, show_unsafe_fixes: bool) -> Self { - self.flags - .set(EmitterFlags::SHOW_UNSAFE_FIXES, show_unsafe_fixes); + pub fn with_unsafe_fixes(mut self, unsafe_fixes: UnsafeFixes) -> Self { + self.unsafe_fixes = unsafe_fixes; self } } @@ -117,7 +114,7 @@ impl Emitter for TextEmitter { code_and_body = RuleCodeAndBody { message, show_fix_status: self.flags.intersects(EmitterFlags::SHOW_FIX_STATUS), - show_unsafe_fixes: self.flags.intersects(EmitterFlags::SHOW_UNSAFE_FIXES) + unsafe_fixes: self.unsafe_fixes, } )?; @@ -146,7 +143,7 @@ impl Emitter for TextEmitter { pub(super) struct RuleCodeAndBody<'a> { pub(crate) message: &'a Message, pub(crate) show_fix_status: bool, - pub(crate) show_unsafe_fixes: bool, + pub(crate) unsafe_fixes: UnsafeFixes, } impl Display for RuleCodeAndBody<'_> { @@ -154,14 +151,8 @@ impl Display for RuleCodeAndBody<'_> { let kind = &self.message.kind; if self.show_fix_status { if let Some(fix) = self.message.fix.as_ref() { - let unsafe_fixes = if self.show_unsafe_fixes { - UnsafeFixes::Enabled - } else { - UnsafeFixes::Disabled - }; - // Do not display an indicator for unapplicable fixes - if fix.applies(unsafe_fixes.required_applicability()) { + if fix.applies(self.unsafe_fixes.required_applicability()) { return write!( f, "{code} {fix}{body}", @@ -364,6 +355,7 @@ mod tests { use crate::message::tests::{capture_emitter_output, create_messages}; use crate::message::TextEmitter; + use crate::settings::types::UnsafeFixes; #[test] fn default() { @@ -388,7 +380,7 @@ mod tests { let mut emitter = TextEmitter::default() .with_show_fix_status(true) .with_show_source(true) - .with_show_unsafe_fixes(true); + .with_unsafe_fixes(UnsafeFixes::Enabled); let content = capture_emitter_output(&mut emitter, &create_messages()); assert_snapshot!(content); diff --git a/crates/ruff_linter/src/test.rs b/crates/ruff_linter/src/test.rs index 9a237f4c397e67..27c94224d9d92d 100644 --- a/crates/ruff_linter/src/test.rs +++ b/crates/ruff_linter/src/test.rs @@ -298,7 +298,7 @@ pub(crate) fn print_jupyter_messages( .with_show_fix_status(true) .with_show_fix_diff(true) .with_show_source(true) - .with_show_unsafe_fixes(true) + .with_unsafe_fixes(UnsafeFixes::Enabled) .emit( &mut output, messages, @@ -319,7 +319,7 @@ pub(crate) fn print_messages(messages: &[Message]) -> String { .with_show_fix_status(true) .with_show_fix_diff(true) .with_show_source(true) - .with_show_unsafe_fixes(true) + .with_unsafe_fixes(UnsafeFixes::Enabled) .emit( &mut output, messages, From d3cb9059e35956ef2b0045dbf9cc59eaa819113f Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 15:31:23 -0500 Subject: [PATCH 20/28] Fix unsafe fixes in grouped emitter --- crates/ruff_cli/src/printer.rs | 1 + crates/ruff_linter/src/message/grouped.rs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index 57772bcb016415..ccaad9e1255c15 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -205,6 +205,7 @@ impl Printer { GroupedEmitter::default() .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) + .with_unsafe_fixes(self.unsafe_fixes) .emit(writer, &diagnostics.messages, &context)?; if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) { diff --git a/crates/ruff_linter/src/message/grouped.rs b/crates/ruff_linter/src/message/grouped.rs index 0b714c3596d7ed..df01b8a9a41079 100644 --- a/crates/ruff_linter/src/message/grouped.rs +++ b/crates/ruff_linter/src/message/grouped.rs @@ -34,6 +34,12 @@ impl GroupedEmitter { self.show_source = show_source; self } + + #[must_use] + pub fn with_unsafe_fixes(mut self, unsafe_fixes: UnsafeFixes) -> Self { + self.unsafe_fixes = unsafe_fixes; + self + } } impl Emitter for GroupedEmitter { @@ -201,6 +207,7 @@ mod tests { use crate::message::tests::{capture_emitter_output, create_messages}; use crate::message::GroupedEmitter; + use crate::settings::types::UnsafeFixes; #[test] fn default() { @@ -227,4 +234,15 @@ mod tests { assert_snapshot!(content); } + + #[test] + fn fix_status_unsafe() { + let mut emitter = GroupedEmitter::default() + .with_show_fix_status(true) + .with_show_source(true) + .with_unsafe_fixes(UnsafeFixes::Enabled); + let content = capture_emitter_output(&mut emitter, &create_messages()); + + assert_snapshot!(content); + } } From 2a5f4547080a4d3fe1dbf3f40f782df02bffa057 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 15:46:03 -0500 Subject: [PATCH 21/28] Refactor `FixableStatistics` --- crates/ruff_cli/src/printer.rs | 81 ++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index ccaad9e1255c15..3f82071db21d06 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -121,9 +121,9 @@ impl Printer { writeln!(writer, "Found {remaining} error{s}.")?; } - let fixables = FixableStatistics::new(diagnostics, self.unsafe_fixes); - if let Some(violation_message) = fixables.violation_string() { - writeln!(writer, "{violation_message}")?; + if let Some(fixables) = FixableStatistics::try_from(diagnostics, self.unsafe_fixes) + { + writeln!(writer, "{fixables}")?; } } else { let fixed = diagnostics @@ -171,7 +171,7 @@ impl Printer { } let context = EmitterContext::new(&diagnostics.notebook_indexes); - let fixables = FixableStatistics::new(diagnostics, self.unsafe_fixes); + let fixables = FixableStatistics::try_from(diagnostics, self.unsafe_fixes); match self.format { SerializationFormat::Json => { @@ -185,7 +185,7 @@ impl Printer { } SerializationFormat::Text => { TextEmitter::default() - .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) + .with_show_fix_status(show_fix_status(self.fix_mode, fixables.as_ref())) .with_show_fix_diff(self.flags.intersects(Flags::SHOW_FIX_DIFF)) .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) .with_unsafe_fixes(self.unsafe_fixes) @@ -204,7 +204,7 @@ impl Printer { SerializationFormat::Grouped => { GroupedEmitter::default() .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) - .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) + .with_show_fix_status(show_fix_status(self.fix_mode, fixables.as_ref())) .with_unsafe_fixes(self.unsafe_fixes) .emit(writer, &diagnostics.messages, &context)?; @@ -355,7 +355,7 @@ impl Printer { ); } - let fixables = FixableStatistics::new(diagnostics, self.unsafe_fixes); + let fixables = FixableStatistics::try_from(diagnostics, self.unsafe_fixes); if !diagnostics.messages.is_empty() { if self.log_level >= LogLevel::Default { @@ -364,7 +364,7 @@ impl Printer { let context = EmitterContext::new(&diagnostics.notebook_indexes); TextEmitter::default() - .with_show_fix_status(show_fix_status(self.fix_mode, &fixables)) + .with_show_fix_status(show_fix_status(self.fix_mode, fixables.as_ref())) .with_show_source(self.flags.intersects(Flags::SHOW_SOURCE)) .with_unsafe_fixes(self.unsafe_fixes) .emit(writer, &diagnostics.messages, &context)?; @@ -389,13 +389,13 @@ fn num_digits(n: usize) -> usize { } /// Return `true` if the [`Printer`] should indicate that a rule is fixable. -fn show_fix_status(fix_mode: flags::FixMode, fixables: &FixableStatistics) -> bool { +fn show_fix_status(fix_mode: flags::FixMode, fixables: Option<&FixableStatistics>) -> bool { // If we're in application mode, avoid indicating that a rule is fixable. // If the specific violation were truly fixable, it would've been fixed in // this pass! (We're occasionally unable to determine whether a specific // violation is fixable without trying to fix it, so if fix is not // enabled, we may inadvertently indicate that a rule is fixable.) - (!fix_mode.is_apply()) && fixables.any_fixes_applicable() + (!fix_mode.is_apply()) && fixables.is_some_and(|fixables| fixables.any_applicable_fixes()) } fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap) -> Result<()> { @@ -439,7 +439,7 @@ fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap Ok(()) } -/// Contains the number of [`Applicability::Always`] and [`Applicability::Sometimes`] fixes +/// Container for the number of [applicable][Applicability] fixes. #[derive(Debug)] struct FixableStatistics { applicable: u32, @@ -448,7 +448,7 @@ struct FixableStatistics { } impl FixableStatistics { - fn new(diagnostics: &Diagnostics, unsafe_fixes: UnsafeFixes) -> Self { + fn try_from(diagnostics: &Diagnostics, unsafe_fixes: UnsafeFixes) -> Option { let mut applicable = 0; let mut unapplicable = 0; @@ -462,52 +462,55 @@ impl FixableStatistics { } } - Self { - applicable, - unapplicable, - unsafe_fixes, + if applicable == 0 && unapplicable == 0 { + None + } else { + Some(Self { + applicable, + unapplicable, + unsafe_fixes, + }) } } - fn any_fixes_applicable(&self) -> bool { + fn any_applicable_fixes(&self) -> bool { return self.applicable > 0; } +} - /// Build the displayed fix status message depending on the types of the remaining fixes. - fn violation_string(&self) -> Option { +impl Display for FixableStatistics { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let fix_prefix = format!("[{}]", "*".cyan()); if self.unsafe_fixes.is_enabled() { - if self.applicable > 0 { - Some(format!( - "{fix_prefix} {} fixable with the --fix option.", - self.applicable - )) - } else { - None - } + write!( + f, + "{fix_prefix} {} fixable with the --fix option.", + self.applicable + ) } else { if self.applicable > 0 && self.unapplicable > 0 { let es = if self.unapplicable == 1 { "" } else { "es" }; - Some( - format!( - "{fix_prefix} {} fixable with the --fix option ({} hidden fix{es} can be enabled with the --unsafe-fixes option).", - self.applicable, self.unapplicable - ) + write!( + f, + "{fix_prefix} {} fixable with the --fix option ({} hidden fix{es} can be enabled with the --unsafe-fixes option).", + self.applicable, self.unapplicable ) } else if self.applicable > 0 { - Some(format!( + // Only applicable fixes + write!( + f, "{fix_prefix} {} fixable with the --fix option.", self.applicable, - )) - } else if self.unapplicable > 0 { + ) + } else { + // Only unapplicable fixes let es = if self.unapplicable == 1 { "" } else { "es" }; - Some(format!( + write!( + f, "{} hidden fix{es} can be enabled with the --unsafe-fixes option.", self.unapplicable - )) - } else { - None + ) } } } From 8d894996413309bd38c1b1ca8b55e539d7967ee5 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 15:49:55 -0500 Subject: [PATCH 22/28] Lint --- crates/ruff_cli/src/commands/check.rs | 2 +- crates/ruff_cli/src/printer.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ruff_cli/src/commands/check.rs b/crates/ruff_cli/src/commands/check.rs index 4aba4bb98296e2..b8cfb91358dbae 100644 --- a/crates/ruff_cli/src/commands/check.rs +++ b/crates/ruff_cli/src/commands/check.rs @@ -244,7 +244,7 @@ mod test { use std::os::unix::fs::OpenOptionsExt; use anyhow::Result; - + use rustc_hash::FxHashMap; use tempfile::TempDir; diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index 3f82071db21d06..c8195d5429426d 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -395,7 +395,7 @@ fn show_fix_status(fix_mode: flags::FixMode, fixables: Option<&FixableStatistics // this pass! (We're occasionally unable to determine whether a specific // violation is fixable without trying to fix it, so if fix is not // enabled, we may inadvertently indicate that a rule is fixable.) - (!fix_mode.is_apply()) && fixables.is_some_and(|fixables| fixables.any_applicable_fixes()) + (!fix_mode.is_apply()) && fixables.is_some_and(FixableStatistics::any_applicable_fixes) } fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap) -> Result<()> { @@ -474,7 +474,7 @@ impl FixableStatistics { } fn any_applicable_fixes(&self) -> bool { - return self.applicable > 0; + self.applicable > 0 } } From b72ab243533e60eb3ee5ffb9177f47ab6e8f920d Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 15:54:12 -0500 Subject: [PATCH 23/28] Fixup `CheckCommand` --- crates/ruff_cli/src/args.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/ruff_cli/src/args.rs b/crates/ruff_cli/src/args.rs index 4285c77b171aab..fc3ab5dc259073 100644 --- a/crates/ruff_cli/src/args.rs +++ b/crates/ruff_cli/src/args.rs @@ -78,15 +78,16 @@ pub struct CheckCommand { /// List of files or directories to check. pub files: Vec, /// Apply fixes to resolve lint violations. - /// Use `--no-fix` to disable or `--unsafe-fixes` to include suggested fixes. + /// Use `--no-fix` to disable or `--unsafe-fixes` to include unsafe fixes. #[arg(long, overrides_with("no_fix"))] fix: bool, - #[clap(long, overrides_with_all(["fix"]), hide = true)] + #[clap(long, overrides_with("fix"), hide = true)] no_fix: bool, /// Include fixes that may not retain the original intent of the code. + /// Use `--no-unsafe-fixes` to disable. #[arg(long, overrides_with("no_unsafe_fixes"))] unsafe_fixes: bool, - #[arg(long, overrides_with("unsafe_fixes"))] + #[arg(long, overrides_with("unsafe_fixes"), hide = true)] no_unsafe_fixes: bool, /// Show violations with source code. /// Use `--no-show-source` to disable. @@ -107,7 +108,7 @@ pub struct CheckCommand { #[arg(short, long)] pub watch: bool, /// Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. - /// Use `--no-fix-only` to disable or `--unsafe-fixes` to include suggested fixes. + /// Use `--no-fix-only` to disable or `--unsafe-fixes` to include unsafe fixes. #[arg(long, overrides_with("no_fix_only"))] fix_only: bool, #[clap(long, overrides_with("fix_only"), hide = true)] From 356f4092324f1152588d8779a8186e74f906f379 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 15:58:43 -0500 Subject: [PATCH 24/28] `FixableStatistics` -> `FixableSummary` --- crates/ruff_cli/src/printer.rs | 19 +++++++++---------- docs/configuration.md | 8 +++----- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index c8195d5429426d..5002d10d284a94 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -121,8 +121,7 @@ impl Printer { writeln!(writer, "Found {remaining} error{s}.")?; } - if let Some(fixables) = FixableStatistics::try_from(diagnostics, self.unsafe_fixes) - { + if let Some(fixables) = FixableSummary::try_from(diagnostics, self.unsafe_fixes) { writeln!(writer, "{fixables}")?; } } else { @@ -171,7 +170,7 @@ impl Printer { } let context = EmitterContext::new(&diagnostics.notebook_indexes); - let fixables = FixableStatistics::try_from(diagnostics, self.unsafe_fixes); + let fixables = FixableSummary::try_from(diagnostics, self.unsafe_fixes); match self.format { SerializationFormat::Json => { @@ -355,7 +354,7 @@ impl Printer { ); } - let fixables = FixableStatistics::try_from(diagnostics, self.unsafe_fixes); + let fixables = FixableSummary::try_from(diagnostics, self.unsafe_fixes); if !diagnostics.messages.is_empty() { if self.log_level >= LogLevel::Default { @@ -389,13 +388,13 @@ fn num_digits(n: usize) -> usize { } /// Return `true` if the [`Printer`] should indicate that a rule is fixable. -fn show_fix_status(fix_mode: flags::FixMode, fixables: Option<&FixableStatistics>) -> bool { +fn show_fix_status(fix_mode: flags::FixMode, fixables: Option<&FixableSummary>) -> bool { // If we're in application mode, avoid indicating that a rule is fixable. // If the specific violation were truly fixable, it would've been fixed in // this pass! (We're occasionally unable to determine whether a specific // violation is fixable without trying to fix it, so if fix is not // enabled, we may inadvertently indicate that a rule is fixable.) - (!fix_mode.is_apply()) && fixables.is_some_and(FixableStatistics::any_applicable_fixes) + (!fix_mode.is_apply()) && fixables.is_some_and(FixableSummary::any_applicable_fixes) } fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap) -> Result<()> { @@ -439,15 +438,15 @@ fn print_fix_summary(writer: &mut dyn Write, fixed: &FxHashMap Ok(()) } -/// Container for the number of [applicable][Applicability] fixes. +/// Summarizes [applicable][ruff_diagnostics::Applicability] fixes. #[derive(Debug)] -struct FixableStatistics { +struct FixableSummary { applicable: u32, unapplicable: u32, unsafe_fixes: UnsafeFixes, } -impl FixableStatistics { +impl FixableSummary { fn try_from(diagnostics: &Diagnostics, unsafe_fixes: UnsafeFixes) -> Option { let mut applicable = 0; let mut unapplicable = 0; @@ -478,7 +477,7 @@ impl FixableStatistics { } } -impl Display for FixableStatistics { +impl Display for FixableSummary { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let fix_prefix = format!("[{}]", "*".cyan()); diff --git a/docs/configuration.md b/docs/configuration.md index cc6b5291b97ec7..e963c310e6000a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -193,11 +193,9 @@ Arguments: Options: --fix - Apply fixes to resolve lint violations. Use `--no-fix` to disable or `--unsafe-fixes` to include suggested fixes + Apply fixes to resolve lint violations. Use `--no-fix` to disable or `--unsafe-fixes` to include unsafe fixes --unsafe-fixes - Include fixes that may not retain the original intent of the code - --no-unsafe-fixes - + Include fixes that may not retain the original intent of the code. Use `--no-unsafe-fixes` to disable --show-source Show violations with source code. Use `--no-show-source` to disable --show-fixes @@ -207,7 +205,7 @@ Options: -w, --watch Run in watch mode by re-running whenever files change --fix-only - Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. Use `--no-fix-only` to disable or `--unsafe-fixes` to include suggested fixes + Apply fixes to resolve lint violations, but don't report on leftover violations. Implies `--fix`. Use `--no-fix-only` to disable or `--unsafe-fixes` to include unsafe fixes --ignore-noqa Ignore any `# noqa` comments --output-format From 1bbc85875e013a63797578c25bf60e03ae8b9aa8 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 16:03:13 -0500 Subject: [PATCH 25/28] Wrap --fix and --unsafe-fixes in code quotes --- crates/ruff_cli/src/printer.rs | 6 +++--- crates/ruff_cli/tests/integration_test.rs | 12 ++++++------ crates/ruff_cli/tests/lint.rs | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/ruff_cli/src/printer.rs b/crates/ruff_cli/src/printer.rs index 5002d10d284a94..d1d5c36a84175e 100644 --- a/crates/ruff_cli/src/printer.rs +++ b/crates/ruff_cli/src/printer.rs @@ -492,14 +492,14 @@ impl Display for FixableSummary { let es = if self.unapplicable == 1 { "" } else { "es" }; write!( f, - "{fix_prefix} {} fixable with the --fix option ({} hidden fix{es} can be enabled with the --unsafe-fixes option).", + "{fix_prefix} {} fixable with the `--fix` option ({} hidden fix{es} can be enabled with the `--unsafe-fixes` option).", self.applicable, self.unapplicable ) } else if self.applicable > 0 { // Only applicable fixes write!( f, - "{fix_prefix} {} fixable with the --fix option.", + "{fix_prefix} {} fixable with the `--fix` option.", self.applicable, ) } else { @@ -507,7 +507,7 @@ impl Display for FixableSummary { let es = if self.unapplicable == 1 { "" } else { "es" }; write!( f, - "{} hidden fix{es} can be enabled with the --unsafe-fixes option.", + "{} hidden fix{es} can be enabled with the `--unsafe-fixes` option.", self.unapplicable ) } diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index 1dcbe5b2709cb8..b5039239253345 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -52,7 +52,7 @@ fn stdin_error() { ----- stdout ----- -:1:8: F401 [*] `os` imported but unused Found 1 error. - [*] 1 fixable with the --fix option. + [*] 1 fixable with the `--fix` option. ----- stderr ----- "###); @@ -69,7 +69,7 @@ fn stdin_filename() { ----- stdout ----- F401.py:1:8: F401 [*] `os` imported but unused Found 1 error. - [*] 1 fixable with the --fix option. + [*] 1 fixable with the `--fix` option. ----- stderr ----- "###); @@ -87,7 +87,7 @@ fn stdin_source_type_py() { ----- stdout ----- TCH.py:1:8: F401 [*] `os` imported but unused Found 1 error. - [*] 1 fixable with the --fix option. + [*] 1 fixable with the `--fix` option. ----- stderr ----- "###); @@ -861,7 +861,7 @@ fn check_input_from_argfile() -> Result<()> { ----- stdout ----- /path/to/a.py:1:8: F401 [*] `os` imported but unused Found 1 error. - [*] 1 fixable with the --fix option. + [*] 1 fixable with the `--fix` option. ----- stderr ----- "###); @@ -891,7 +891,7 @@ fn displays_fix_applicability_levels() { -:1:14: F601 Dictionary key literal `'a'` repeated -:2:7: UP034 [*] Avoid extraneous parentheses Found 2 errors. - [*] 1 fixable with the --fix option (1 hidden fix can be enabled with the --unsafe-fixes option). + [*] 1 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option). ----- stderr ----- "###); @@ -908,7 +908,7 @@ fn displays_remaining_unsafe_fixes() { ----- stdout ----- -:1:14: F601 Dictionary key literal `'a'` repeated Found 1 error. - 1 hidden fix can be enabled with the --unsafe-fixes option. + 1 hidden fix can be enabled with the `--unsafe-fixes` option. ----- stderr ----- "###); diff --git a/crates/ruff_cli/tests/lint.rs b/crates/ruff_cli/tests/lint.rs index 220b14ba028cc8..bef1cb7f261752 100644 --- a/crates/ruff_cli/tests/lint.rs +++ b/crates/ruff_cli/tests/lint.rs @@ -40,7 +40,7 @@ inline-quotes = "single" -:1:5: B005 Using `.strip()` with multi-character strings is misleading -:1:19: Q000 [*] Double quotes found but single quotes preferred Found 3 errors. - [*] 2 fixable with the --fix option. + [*] 2 fixable with the `--fix` option. ----- stderr ----- "###); @@ -75,7 +75,7 @@ inline-quotes = "single" -:1:5: B005 Using `.strip()` with multi-character strings is misleading -:1:19: Q000 [*] Double quotes found but single quotes preferred Found 3 errors. - [*] 2 fixable with the --fix option. + [*] 2 fixable with the `--fix` option. ----- stderr ----- "###); @@ -110,7 +110,7 @@ inline-quotes = "single" -:1:5: B005 Using `.strip()` with multi-character strings is misleading -:1:19: Q000 [*] Double quotes found but single quotes preferred Found 3 errors. - [*] 2 fixable with the --fix option. + [*] 2 fixable with the `--fix` option. ----- stderr ----- "###); @@ -149,7 +149,7 @@ inline-quotes = "single" -:1:5: B005 Using `.strip()` with multi-character strings is misleading -:1:19: Q000 [*] Double quotes found but single quotes preferred Found 3 errors. - [*] 2 fixable with the --fix option. + [*] 2 fixable with the `--fix` option. ----- stderr ----- "###); From b6e3a9a767bf4f05555400889024b59bf9e458aa Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 16:16:33 -0500 Subject: [PATCH 26/28] Clean up integration tests --- crates/ruff_cli/tests/integration_test.rs | 154 ++++++++++++---------- 1 file changed, 88 insertions(+), 66 deletions(-) diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index b5039239253345..28a34d7453c47c 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -871,9 +871,7 @@ fn check_input_from_argfile() -> Result<()> { } #[test] -fn displays_fix_applicability_levels() { - // `--fix` should only apply safe fixes, but should tell the user about `--unsafe-fixes` if - // there are remaining fixes. +fn check_hints_hidden_unsafe_fixes() { assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) .args([ "-", @@ -898,7 +896,7 @@ fn displays_fix_applicability_levels() { } #[test] -fn displays_remaining_unsafe_fixes() { +fn check_hints_hidden_unsafe_fixes_with_no_safe_fixes() { assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) .args(["-", "--output-format", "text", "--no-cache", "--isolated", "--select", "F601"]) .pass_stdin("x = {'a': 1, 'a': 1}\n"), @@ -915,9 +913,33 @@ fn displays_remaining_unsafe_fixes() { } #[test] -fn fix_applies_safe_fixes_only() { - // `--fix` should only apply safe fixes. Since we're runnnig in `stdin` mode, output shouldn't - // be printed. +fn check_shows_unsafe_fixes_with_opt_in() { + assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format=text", + "--isolated", + "--select", + "F601,UP034", + "--no-cache", + "--unsafe-fixes", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: false + exit_code: 1 + ----- stdout ----- + -:1:14: F601 [*] Dictionary key literal `'a'` repeated + -:2:7: UP034 [*] Avoid extraneous parentheses + Found 2 errors. + [*] 2 fixable with the --fix option. + + ----- stderr ----- + "###); +} + +#[test] +fn fix_applies_safe_fixes_by_default() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -943,7 +965,7 @@ fn fix_applies_safe_fixes_only() { } #[test] -fn fix_applies_safe_and_unsafe_fixes_with_unsafe_fixes() { +fn fix_applies_unsafe_fixes_with_opt_in() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -970,7 +992,7 @@ fn fix_applies_safe_and_unsafe_fixes_with_unsafe_fixes() { } #[test] -fn diff_shows_safe_and_unsafe_fixes_with_unsafe_fixes() { +fn fix_only_flag_applies_safe_fixes_by_default() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -978,31 +1000,52 @@ fn diff_shows_safe_and_unsafe_fixes_with_unsafe_fixes() { "--output-format", "text", "--isolated", - "--no-cache", + "--no-cache", "--select", "F601,UP034", - "--diff", - "--unsafe-fixes", + "--fix-only", ]) .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), @r###" - success: false - exit_code: 1 + success: true + exit_code: 0 ----- stdout ----- - @@ -1,2 +1,2 @@ - -x = {'a': 1} - -print('foo') - +x = {'a': 1, 'a': 1} - +print(('foo')) + x = {'a': 1, 'a': 1} + print('foo') + ----- stderr ----- + "###); +} + +#[test] +fn fix_only_flag_applies_unsafe_fixes_with_opt_in() { + assert_cmd_snapshot!( + Command::new(get_cargo_bin(BIN_NAME)) + .args([ + "-", + "--output-format", + "text", + "--isolated", + "--no-cache", + "--select", + "F601,UP034", + "--fix-only", + "--unsafe-fixes", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: true + exit_code: 0 + ----- stdout ----- + x = {'a': 1} + print('foo') ----- stderr ----- - "### - ); + "###); } #[test] -fn diff_shows_safe_fixes_only() { +fn diff_shows_safe_fixes_by_default() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) .args([ @@ -1032,54 +1075,33 @@ fn diff_shows_safe_fixes_only() { } #[test] -fn fix_only_applies_safe_and_unsafe_fixes_with_unsafe_fixes() { +fn diff_shows_unsafe_fixes_with_opt_in() { assert_cmd_snapshot!( Command::new(get_cargo_bin(BIN_NAME)) - .args([ - "-", - "--output-format", - "text", - "--isolated", - "--no-cache", - "--select", - "F601,UP034", - "--fix-only", - "--unsafe-fixes", - ]) - .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), - @r###" - success: true - exit_code: 0 + .args([ + "-", + "--output-format", + "text", + "--isolated", + "--no-cache", + "--select", + "F601,UP034", + "--diff", + "--unsafe-fixes", + ]) + .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), + @r###" + success: false + exit_code: 1 ----- stdout ----- - x = {'a': 1} - print('foo') + @@ -1,2 +1,2 @@ + -x = {'a': 1} + -print('foo') + +x = {'a': 1, 'a': 1} + +print(('foo')) - ----- stderr ----- - "###); -} - -#[test] -fn fix_only_applies_safe_fixes_only() { - assert_cmd_snapshot!( - Command::new(get_cargo_bin(BIN_NAME)) - .args([ - "-", - "--output-format", - "text", - "--isolated", - "--no-cache", - "--select", - "F601,UP034", - "--fix-only", - ]) - .pass_stdin("x = {'a': 1, 'a': 1}\nprint(('foo'))\n"), - @r###" - success: true - exit_code: 0 - ----- stdout ----- - x = {'a': 1, 'a': 1} - print('foo') ----- stderr ----- - "###); + "### + ); } From 47b146b9b681d66617836c4553d49dc5638a63a9 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 16:25:58 -0500 Subject: [PATCH 27/28] Commit missing snapshot --- ...ge__grouped__tests__fix_status_unsafe.snap | 31 +++++++++++++++++++ ...ssage__text__tests__fix_status_unsafe.snap | 29 +++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status_unsafe.snap create mode 100644 crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status_unsafe.snap diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status_unsafe.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status_unsafe.snap new file mode 100644 index 00000000000000..453cf1eda49e2b --- /dev/null +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__fix_status_unsafe.snap @@ -0,0 +1,31 @@ +--- +source: crates/ruff_linter/src/message/grouped.rs +expression: content +--- +fib.py: + 1:8 F401 [*] `os` imported but unused + | + 1 | import os + | ^^ F401 + | + = help: Remove unused import: `os` + + 6:5 F841 [*] Local variable `x` is assigned to but never used + | + 4 | def fibonacci(n): + 5 | """Compute the nth number in the Fibonacci sequence.""" + 6 | x = 1 + | ^ F841 + 7 | if n == 0: + 8 | return 0 + | + = help: Remove assignment to unused variable `x` + +undef.py: + 1:4 F821 Undefined name `a` + | + 1 | if a == 1: pass + | ^ F821 + | + + diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status_unsafe.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status_unsafe.snap new file mode 100644 index 00000000000000..a53420329c119c --- /dev/null +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__text__tests__fix_status_unsafe.snap @@ -0,0 +1,29 @@ +--- +source: crates/ruff_linter/src/message/text.rs +expression: content +--- +fib.py:1:8: F401 [*] `os` imported but unused + | +1 | import os + | ^^ F401 + | + = help: Remove unused import: `os` + +fib.py:6:5: F841 [*] Local variable `x` is assigned to but never used + | +4 | def fibonacci(n): +5 | """Compute the nth number in the Fibonacci sequence.""" +6 | x = 1 + | ^ F841 +7 | if n == 0: +8 | return 0 + | + = help: Remove assignment to unused variable `x` + +undef.py:1:4: F821 Undefined name `a` + | +1 | if a == 1: pass + | ^ F821 + | + + From 859ac7d9f409984e863d6d8a6b3dabb3e1223601 Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 5 Oct 2023 22:32:47 -0500 Subject: [PATCH 28/28] Avoid reading `unsafe_fixes` from nested configuration files --- crates/ruff_cli/src/commands/check.rs | 5 ++++- crates/ruff_cli/src/lib.rs | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ruff_cli/src/commands/check.rs b/crates/ruff_cli/src/commands/check.rs index b8cfb91358dbae..a6ecb66d5d2f71 100644 --- a/crates/ruff_cli/src/commands/check.rs +++ b/crates/ruff_cli/src/commands/check.rs @@ -37,6 +37,7 @@ pub(crate) fn check( cache: flags::Cache, noqa: flags::Noqa, fix_mode: flags::FixMode, + unsafe_fixes: UnsafeFixes, ) -> Result { // Collect all the Python files to check. let start = Instant::now(); @@ -127,7 +128,7 @@ pub(crate) fn check( cache, noqa, fix_mode, - settings.unsafe_fixes, + unsafe_fixes, ) .map_err(|e| { (Some(path.to_owned()), { @@ -245,6 +246,7 @@ mod test { use anyhow::Result; + use ruff_linter::settings::types::UnsafeFixes; use rustc_hash::FxHashMap; use tempfile::TempDir; @@ -297,6 +299,7 @@ mod test { flags::Cache::Disabled, flags::Noqa::Disabled, flags::FixMode::Generate, + UnsafeFixes::Enabled, ) .unwrap(); let mut output = Vec::new(); diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index 5815860e390782..c74279392b564d 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -328,6 +328,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { cache.into(), noqa.into(), fix_mode, + unsafe_fixes, )?; printer.write_continuously(&mut writer, &messages)?; @@ -360,6 +361,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { cache.into(), noqa.into(), fix_mode, + unsafe_fixes, )?; printer.write_continuously(&mut writer, &messages)?; } @@ -386,6 +388,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result { cache.into(), noqa.into(), fix_mode, + unsafe_fixes, )? };