// use anyhow::{bail, Result}; use init::init_config; use issues::fetch_open_issues; use kxio::network::Network; use printer::Printer; use scanner::{find_markers, DefaultFileScanner}; mod init; mod issues; mod model; mod patterns; mod printer; mod scanner; #[cfg(test)] mod tests; #[tokio::main] #[cfg(not(tarpaulin_include))] async fn main() -> std::result::Result<(), Box> { use printer::StandardPrinter; Ok(run(&StandardPrinter, Network::new_real()).await?) } async fn run(printer: &impl Printer, net: Network) -> Result<()> { printer.println("Forgejo TODO Checker!"); let config = init_config(printer, net)?; let issues = fetch_open_issues(&config).await?; let markers = find_markers(&config, issues, &DefaultFileScanner)?; let mut errors = false; for marker in (*markers).iter() { match marker { model::Marker::Closed(_, _) | model::Marker::Invalid(_) => { printer.println("{marker}"); errors = true; } model::Marker::Unmarked | model::Marker::Valid(_, _) => {} } } if errors { bail!("Invalid or closed TODO/FIXMEs found") } Ok(()) }