diff --git a/crates/ruff/src/lib.rs b/crates/ruff/src/lib.rs index 1f310053890e5..e61a9ec441b26 100644 --- a/crates/ruff/src/lib.rs +++ b/crates/ruff/src/lib.rs @@ -237,6 +237,9 @@ pub fn check(args: CheckCommand, global_options: GlobalConfigArgs) -> Result = match cli.output_file { Some(path) if !cli.watch => { colored::control::set_override(false); + if let Some(parent) = path.parent() { + std::fs::create_dir_all(parent)?; + } let file = File::create(path)?; Box::new(BufWriter::new(file)) }