mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:47 +00:00
Reorder imports (#2638)
This commit is contained in:
parent
0355ba571e
commit
67e9ff7cc8
233 changed files with 626 additions and 593 deletions
|
@ -1,6 +1,5 @@
|
|||
use std::fs::remove_dir_all;
|
||||
use std::io::Write;
|
||||
use std::io::{self, BufWriter, Read};
|
||||
use std::io::{self, BufWriter, Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::Instant;
|
||||
|
||||
|
@ -12,9 +11,6 @@ use log::{debug, error};
|
|||
use path_absolutize::path_dedot;
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
use rayon::prelude::*;
|
||||
use serde::Serialize;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
use ruff::cache::CACHE_DIR_NAME;
|
||||
use ruff::linter::add_noqa_to_path;
|
||||
use ruff::logging::LogLevel;
|
||||
|
@ -23,6 +19,8 @@ use ruff::registry::{Linter, Rule, RuleNamespace};
|
|||
use ruff::resolver::PyprojectDiscovery;
|
||||
use ruff::settings::flags;
|
||||
use ruff::{fix, fs, packaging, resolver, warn_user_once, AutofixAvailability, IOError};
|
||||
use serde::Serialize;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
use crate::args::{HelpFormat, Overrides};
|
||||
use crate::cache;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use itertools::Itertools;
|
||||
use ruff::registry::{Linter, RuleNamespace, UpstreamCategory};
|
||||
use serde::Serialize;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use ruff::registry::{Linter, RuleNamespace, UpstreamCategory};
|
||||
|
||||
use crate::args::HelpFormat;
|
||||
|
||||
pub fn linter(format: HelpFormat) {
|
||||
|
|
|
@ -16,8 +16,8 @@ pub fn command_help() -> String {
|
|||
pub fn subcommand_help() -> String {
|
||||
let mut cmd = args::Args::command();
|
||||
|
||||
// The build call is necessary for the help output to contain `Usage: ruff check` instead of `Usage: check`
|
||||
// see https://github.com/clap-rs/clap/issues/4685
|
||||
// The build call is necessary for the help output to contain `Usage: ruff
|
||||
// check` instead of `Usage: check` see https://github.com/clap-rs/clap/issues/4685
|
||||
cmd.build();
|
||||
|
||||
cmd.find_subcommand_mut("check")
|
||||
|
|
|
@ -3,17 +3,16 @@ use std::path::PathBuf;
|
|||
use std::process::ExitCode;
|
||||
use std::sync::mpsc::channel;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::{CommandFactory, Parser, Subcommand};
|
||||
use colored::Colorize;
|
||||
use notify::{recommended_watcher, RecursiveMode, Watcher};
|
||||
|
||||
use ::ruff::logging::{set_up_logging, LogLevel};
|
||||
use ::ruff::resolver::PyprojectDiscovery;
|
||||
use ::ruff::settings::types::SerializationFormat;
|
||||
use ::ruff::settings::CliSettings;
|
||||
use ::ruff::{fix, fs, warn_user_once};
|
||||
use anyhow::Result;
|
||||
use args::{Args, CheckArgs, Command};
|
||||
use clap::{CommandFactory, Parser, Subcommand};
|
||||
use colored::Colorize;
|
||||
use notify::{recommended_watcher, RecursiveMode, Watcher};
|
||||
use printer::{Printer, Violations};
|
||||
|
||||
pub(crate) mod args;
|
||||
|
@ -257,7 +256,8 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result<ExitCode> {
|
|||
|
||||
if update_check {
|
||||
warn_user_once!(
|
||||
"update-check has been removed; setting it will cause an error in a future version."
|
||||
"update-check has been removed; setting it will cause an error in a future \
|
||||
version."
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -376,8 +376,8 @@ impl<'a> Printer<'a> {
|
|||
let mut stdout = BufWriter::new(io::stdout().lock());
|
||||
match self.format {
|
||||
SerializationFormat::Text => {
|
||||
// Compute the maximum number of digits in the count and code, for all messages, to enable
|
||||
// pretty-printing.
|
||||
// Compute the maximum number of digits in the count and code, for all messages,
|
||||
// to enable pretty-printing.
|
||||
let count_width = num_digits(
|
||||
statistics
|
||||
.iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue