mod json;
mod sarif;
mod text;
pub mod banner;
use std::io::Write;
use crate::VerifiedFinding;
pub use json::{JsonArrayReporter, JsonReporter, JsonlReporter};
pub use sarif::SarifReporter;
pub use text::TextReporter;
pub type ReportError = anyhow::Error;
pub trait Reporter: Send {
fn report(&mut self, finding: &VerifiedFinding) -> Result<(), ReportError>;
fn finish(&mut self) -> Result<(), ReportError>;
}
trait WriterBackedReporter {
type Writer: Write;
fn writer_mut(&mut self) -> &mut Self::Writer;
fn flush_writer(&mut self) -> Result<(), ReportError> {
self.writer_mut().flush()?;
Ok(())
}
}
trait BufferedFindingReporter {
fn findings_mut(&mut self) -> &mut Vec<VerifiedFinding>;
fn push_finding(&mut self, finding: &VerifiedFinding) {
self.findings_mut().push(finding.clone());
}
}