mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00
refactor: Define ruff_dev::ROOT_DIR
This commit is contained in:
parent
faea478ca5
commit
e66a6b6d05
3 changed files with 8 additions and 8 deletions
|
@ -5,6 +5,8 @@ use anyhow::Result;
|
|||
use ruff::settings::options::Options;
|
||||
use schemars::schema_for;
|
||||
|
||||
use crate::ROOT_DIR;
|
||||
|
||||
#[derive(clap::Args)]
|
||||
pub struct Args {
|
||||
/// Write the generated table to stdout (rather than to `ruff.schema.json`).
|
||||
|
@ -19,10 +21,7 @@ pub fn main(args: &Args) -> Result<()> {
|
|||
if args.dry_run {
|
||||
println!("{schema_string}");
|
||||
} else {
|
||||
let file = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
.expect("Failed to find root directory")
|
||||
.join("ruff.schema.json");
|
||||
let file = PathBuf::from(ROOT_DIR).join("ruff.schema.json");
|
||||
fs::write(file, schema_string.as_bytes())?;
|
||||
}
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue