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