mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Run autofix on initial watcher pass (#4311)
This commit is contained in:
parent
04e8e74499
commit
d3b71f1e04
1 changed files with 11 additions and 11 deletions
|
@ -217,6 +217,16 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result<ExitStatus> {
|
|||
warn_user_once!("--format 'text' is used in watch mode.");
|
||||
}
|
||||
|
||||
// Configure the file watcher.
|
||||
let (tx, rx) = channel();
|
||||
let mut watcher = recommended_watcher(tx)?;
|
||||
for file in &cli.files {
|
||||
watcher.watch(file, RecursiveMode::Recursive)?;
|
||||
}
|
||||
if let Some(file) = pyproject_config.path.as_ref() {
|
||||
watcher.watch(file, RecursiveMode::Recursive)?;
|
||||
}
|
||||
|
||||
// Perform an initial run instantly.
|
||||
Printer::clear_screen()?;
|
||||
printer.write_to_user("Starting linter in watch mode...\n");
|
||||
|
@ -227,20 +237,10 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result<ExitStatus> {
|
|||
&overrides,
|
||||
cache.into(),
|
||||
noqa.into(),
|
||||
flags::FixMode::None,
|
||||
autofix,
|
||||
)?;
|
||||
printer.write_continuously(&messages)?;
|
||||
|
||||
// Configure the file watcher.
|
||||
let (tx, rx) = channel();
|
||||
let mut watcher = recommended_watcher(tx)?;
|
||||
for file in &cli.files {
|
||||
watcher.watch(file, RecursiveMode::Recursive)?;
|
||||
}
|
||||
if let Some(file) = pyproject_config.path.as_ref() {
|
||||
watcher.watch(file, RecursiveMode::Recursive)?;
|
||||
}
|
||||
|
||||
// In watch mode, we may need to re-resolve the configuration.
|
||||
// TODO(charlie): Re-compute other derivative values, like the `printer`.
|
||||
let mut pyproject_config = pyproject_config;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue