refactor(xatu): return structured reports

This commit was merged in pull request #73.
This commit is contained in:
2026-09-18 22:43:17 -04:00
parent 113018a62c
commit 1fa3962fed
4 changed files with 54 additions and 13 deletions

View File

@@ -4,17 +4,29 @@ use crate::rules::empty_inherit::EmptyInherit;
pub mod empty_inherit;
#[derive(Debug)]
pub struct Finding {
pub rule_id: &'static str,
pub range: ast::SourceRange,
pub message: &'static str,
}
#[derive(Debug)]
pub struct Diagnostic {
pub file_id: FileId,
pub finding: Finding,
}
impl std::fmt::Display for Diagnostic {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
formatter,
"{}: {}: {}",
self.finding.range, self.finding.rule_id, self.finding.message,
)
}
}
pub trait NodeRule {
type Node;