use super::DiagnosticLevel;
use crate::implement_diagnostic_functions;
#[derive(Debug)]
pub enum Lint {
DuplicateFile {
path: String,
},
Deprecated {
identifier: String,
reason: Option<String>,
},
MalformedDocComment { message: String },
IncorrectDocComment { message: String },
BrokenDocLink { message: String },
}
impl Lint {
pub fn get_default_level(&self) -> DiagnosticLevel {
match self {
Self::DuplicateFile { .. } => DiagnosticLevel::Warning,
Self::Deprecated { .. } => DiagnosticLevel::Warning,
Self::MalformedDocComment { .. } => DiagnosticLevel::Warning,
Self::BrokenDocLink { .. } => DiagnosticLevel::Warning,
Self::IncorrectDocComment { .. } => DiagnosticLevel::Warning,
}
}
}
implement_diagnostic_functions!(
Lint,
(
DuplicateFile,
format!("slice file was provided more than once: '{path}'"),
path
),
(
Deprecated,
if let Some(reason) = reason {
format!("'{identifier}' is deprecated: {reason}")
} else {
format!("'{identifier}' is deprecated")
},
identifier,
reason
),
(MalformedDocComment, message, message),
(IncorrectDocComment, message, message),
(BrokenDocLink, message, message)
);