mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-03 13:23:10 +00:00
Add reformat check (#4753)
This commit is contained in:
parent
c1286d61df
commit
e209b5fc5f
2 changed files with 29 additions and 7 deletions
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue