2023-05-05 10:45:49 -05:00
|
|
|
use crate::{clippy_project_root, exit_if_err};
|
2022-07-18 02:39:37 -05:00
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
/// # Panics
|
|
|
|
///
|
|
|
|
/// Panics if unable to run the dogfood test
|
|
|
|
pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool) {
|
|
|
|
let mut cmd = Command::new("cargo");
|
|
|
|
|
|
|
|
cmd.current_dir(clippy_project_root())
|
|
|
|
.args(["test", "--test", "dogfood"])
|
|
|
|
.args(["--features", "internal"])
|
2023-05-05 10:45:49 -05:00
|
|
|
.args(["--", "dogfood_clippy", "--nocapture"]);
|
2022-07-18 02:39:37 -05:00
|
|
|
|
|
|
|
let mut dogfood_args = Vec::new();
|
|
|
|
if fix {
|
|
|
|
dogfood_args.push("--fix");
|
|
|
|
}
|
|
|
|
|
|
|
|
if allow_dirty {
|
|
|
|
dogfood_args.push("--allow-dirty");
|
|
|
|
}
|
|
|
|
|
|
|
|
if allow_staged {
|
|
|
|
dogfood_args.push("--allow-staged");
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.env("__CLIPPY_DOGFOOD_ARGS", dogfood_args.join(" "));
|
|
|
|
|
2023-05-05 10:45:49 -05:00
|
|
|
exit_if_err(cmd.status());
|
2022-07-18 02:39:37 -05:00
|
|
|
}
|