ferrous_forge/safety/checks/
mod.rs1use crate::Result;
7use std::path::Path;
8
9use super::report::CheckResult;
10
11pub mod audit;
12pub mod build;
13pub mod clippy;
14pub mod doc;
15pub mod format;
16pub mod license;
17pub mod publish;
18pub mod semver;
19pub mod standards;
20pub mod test;
21pub mod test_runner;
22
23#[allow(async_fn_in_trait)]
25pub trait SafetyCheck {
26 async fn run(project_path: &Path) -> Result<CheckResult>;
28
29 fn name() -> &'static str;
31
32 fn description() -> &'static str;
34}
35
36pub struct CheckRegistry;
38
39impl CheckRegistry {
40 pub fn all_checks() -> Vec<super::CheckType> {
42 vec![
43 super::CheckType::Format,
44 super::CheckType::Clippy,
45 super::CheckType::Build,
46 super::CheckType::Test,
47 super::CheckType::Audit,
48 super::CheckType::Doc,
49 super::CheckType::PublishDryRun,
50 super::CheckType::Standards,
51 super::CheckType::DocCoverage,
52 super::CheckType::License,
53 super::CheckType::Semver,
54 ]
55 }
56
57 pub fn get_description(check_type: super::CheckType) -> &'static str {
59 match check_type {
60 super::CheckType::Format => "Validates code formatting with rustfmt",
61 super::CheckType::Clippy => "Runs clippy lints with strict warnings",
62 super::CheckType::Build => "Ensures project builds successfully",
63 super::CheckType::Test => "Runs the complete test suite",
64 super::CheckType::Audit => "Scans for security vulnerabilities",
65 super::CheckType::Doc => "Builds project documentation",
66 super::CheckType::PublishDryRun => "Validates crates.io publication",
67 super::CheckType::Standards => "Validates Ferrous Forge standards",
68 super::CheckType::DocCoverage => "Checks documentation coverage",
69 super::CheckType::License => "Validates license compatibility",
70 super::CheckType::Semver => "Checks semantic versioning compliance",
71 }
72 }
73}