Add reformat check (#4753)

This commit is contained in:
Micha Reiser 2023-05-31 17:36:15 +02:00 committed by GitHub
parent c1286d61df
commit e209b5fc5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 7 deletions

View file

@ -4,14 +4,14 @@ use anyhow::Result;
use clap::Parser as ClapParser;
use ruff_python_formatter::cli::Cli;
use ruff_python_formatter::fmt;
use ruff_python_formatter::format_module;
fn main() -> Result<()> {
let cli = Cli::parse();
let contents = fs::read_to_string(cli.file)?;
#[allow(clippy::print_stdout)]
{
println!("{}", fmt(&contents)?.as_code());
println!("{}", format_module(&contents)?.as_code());
}
Ok(())
}