tracel_xtask/commands/
validate.rs

1use crate::prelude::{Context, Environment};
2
3use super::{
4    check::{CheckCmdArgs, CheckSubCommand},
5    test::{TestCmdArgs, TestSubCommand},
6    Target,
7};
8
9#[tracel_xtask_macros::declare_command_args(None, None)]
10struct ValidateCmdArgs {}
11
12pub fn handle_command(args: ValidateCmdArgs, env: Environment, ctx: Context) -> anyhow::Result<()> {
13    let target = Target::Workspace;
14    let exclude = vec![];
15    let only = vec![];
16
17    // checks
18    [
19        CheckSubCommand::Audit,
20        CheckSubCommand::Format,
21        CheckSubCommand::Lint,
22        CheckSubCommand::Typos,
23    ]
24    .iter()
25    .try_for_each(|c| {
26        super::check::handle_command(
27            CheckCmdArgs {
28                target: target.clone(),
29                exclude: exclude.clone(),
30                only: only.clone(),
31                command: Some(c.clone()),
32                ignore_audit: args.ignore_audit,
33            },
34            env.clone(),
35            ctx.clone(),
36        )
37    })?;
38
39    // tests
40    super::test::handle_command(
41        TestCmdArgs {
42            target: target.clone(),
43            exclude: exclude.clone(),
44            only: only.clone(),
45            threads: None,
46            test: None,
47            jobs: None,
48            command: Some(TestSubCommand::All),
49            force: false,
50            features: None,
51            no_default_features: false,
52            no_capture: false,
53            release: args.release,
54        },
55        env.clone(),
56        ctx.clone(),
57    )?;
58
59    Ok(())
60}