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