feat(xatu): report deprecated toPath calls
This commit was merged in pull request #75.
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
use crate::FileId;
|
||||
use crate::ast;
|
||||
use crate::rules::deprecated_to_path::DeprecatedToPath;
|
||||
use crate::rules::empty_inherit::EmptyInherit;
|
||||
|
||||
pub mod deprecated_to_path;
|
||||
pub mod empty_inherit;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Diagnostic {
|
||||
pub file_id: FileId,
|
||||
pub finding: Finding,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Finding {
|
||||
pub rule_id: &'static str,
|
||||
@@ -11,12 +19,6 @@ pub struct Finding {
|
||||
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!(
|
||||
@@ -54,13 +56,16 @@ pub fn run_rules(file: &ast::ParsedFile) -> Vec<Diagnostic> {
|
||||
file.nodes
|
||||
.iter()
|
||||
.flat_map(|node| {
|
||||
[run_node_rule::<EmptyInherit>(node)]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.map(|finding| Diagnostic {
|
||||
file_id: file.file_id,
|
||||
finding,
|
||||
})
|
||||
[
|
||||
run_node_rule::<DeprecatedToPath>(node),
|
||||
run_node_rule::<EmptyInherit>(node),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.map(|finding| Diagnostic {
|
||||
file_id: file.file_id,
|
||||
finding,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user