use crate::{
profile::Profile,
utils::{run_command_or_exit, string_vec},
};
pub fn lint(files: Vec<String>, fix: bool, unsafe_fixes: bool) {
let pyproject_toml = Profile::load(None).unwrap().materialize(None).unwrap();
let mut uv_command = string_vec![
"uv",
"run",
"--with",
"ruff",
"ruff",
"--config",
pyproject_toml.to_string_lossy().to_string(),
"check"
];
if fix {
uv_command.push("--fix".to_owned());
if unsafe_fixes {
uv_command.push("--unsafe-fixes".to_owned());
}
}
if files.is_empty() {
uv_command.push(".".to_owned());
} else {
uv_command.extend(files);
}
run_command_or_exit(uv_command);
}