diff --git a/crates/ruff_cli/src/commands/mod.rs b/crates/ruff_cli/src/commands/mod.rs index bc08aa1cd8..cbe30fd5c5 100644 --- a/crates/ruff_cli/src/commands/mod.rs +++ b/crates/ruff_cli/src/commands/mod.rs @@ -1,18 +1,9 @@ -pub use add_noqa::add_noqa; -pub use clean::clean; -pub use linter::linter; -pub use rule::rule; -pub use run::run; -pub use run_stdin::run_stdin; -pub use show_files::show_files; -pub use show_settings::show_settings; - -mod add_noqa; -mod clean; +pub mod add_noqa; +pub mod clean; pub mod config; -mod linter; -mod rule; -mod run; -mod run_stdin; -mod show_files; -mod show_settings; +pub mod linter; +pub mod rule; +pub mod run; +pub mod run_stdin; +pub mod show_files; +pub mod show_settings; diff --git a/crates/ruff_cli/src/main.rs b/crates/ruff_cli/src/main.rs index d8ed2bc85e..899f59734b 100644 --- a/crates/ruff_cli/src/main.rs +++ b/crates/ruff_cli/src/main.rs @@ -100,10 +100,10 @@ quoting the executed command, along with the relevant file contents and `pyproje set_up_logging(&log_level)?; match command { - Command::Rule { rule, format } => commands::rule(&rule, format)?, + Command::Rule { rule, format } => commands::rule::rule(&rule, format)?, Command::Config { option } => return Ok(commands::config::config(option.as_deref())), - Command::Linter { format } => commands::linter(format)?, - Command::Clean => commands::clean(log_level)?, + Command::Linter { format } => commands::linter::linter(format)?, + Command::Clean => commands::clean::clean(log_level)?, Command::GenerateShellCompletion { shell } => { shell.generate(&mut Args::command(), &mut io::stdout()); } @@ -126,11 +126,11 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result { )?; if cli.show_settings { - commands::show_settings(&cli.files, &pyproject_strategy, &overrides)?; + commands::show_settings::show_settings(&cli.files, &pyproject_strategy, &overrides)?; return Ok(ExitStatus::Success); } if cli.show_files { - commands::show_files(&cli.files, &pyproject_strategy, &overrides)?; + commands::show_files::show_files(&cli.files, &pyproject_strategy, &overrides)?; return Ok(ExitStatus::Success); } @@ -184,7 +184,8 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result { if !matches!(autofix, fix::FixMode::None) { warn_user_once!("--fix is incompatible with --add-noqa."); } - let modifications = commands::add_noqa(&cli.files, &pyproject_strategy, &overrides)?; + let modifications = + commands::add_noqa::add_noqa(&cli.files, &pyproject_strategy, &overrides)?; if modifications > 0 && log_level >= LogLevel::Default { #[allow(clippy::print_stderr)] { @@ -208,7 +209,7 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result { Printer::clear_screen()?; printer.write_to_user("Starting linter in watch mode...\n"); - let messages = commands::run( + let messages = commands::run::run( &cli.files, &pyproject_strategy, &overrides, @@ -237,7 +238,7 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result { Printer::clear_screen()?; printer.write_to_user("File change detected...\n"); - let messages = commands::run( + let messages = commands::run::run( &cli.files, &pyproject_strategy, &overrides, @@ -255,14 +256,14 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result { // Generate lint violations. let diagnostics = if is_stdin { - commands::run_stdin( + commands::run_stdin::run_stdin( cli.stdin_filename.map(fs::normalize_path).as_deref(), &pyproject_strategy, &overrides, autofix, )? } else { - commands::run( + commands::run::run( &cli.files, &pyproject_strategy, &overrides,