refactor(xatu): return structured reports
This commit was merged in pull request #73.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user