Remove public re-export of commands (#2801)

This commit is contained in:
Charlie Marsh 2023-02-11 23:59:35 -05:00 committed by GitHub
parent 4a12ebb9b1
commit c53f91d943
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 27 deletions

View file

@ -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;

View file

@ -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<ExitStatus> {
)?;
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<ExitStatus> {
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<ExitStatus> {
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<ExitStatus> {
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<ExitStatus> {
// 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,