use rpm_spec_profile::Profile;
use crate::config::Config;
use crate::diagnostic::{Diagnostic, LintCategory, Severity};
use crate::visit::Visit;
#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
pub struct LintMetadata {
pub id: &'static str,
pub name: &'static str,
pub description: &'static str,
pub default_severity: Severity,
pub category: LintCategory,
}
impl LintMetadata {
pub const fn new(
id: &'static str,
name: &'static str,
description: &'static str,
default_severity: Severity,
category: LintCategory,
) -> Self {
Self {
id,
name,
description,
default_severity,
category,
}
}
}
pub trait Lint: for<'ast> Visit<'ast> + Send {
fn metadata(&self) -> &'static LintMetadata;
fn take_diagnostics(&mut self) -> Vec<Diagnostic>;
fn set_source(&mut self, source: &str) {
let _ = source;
}
fn set_config(&mut self, config: &Config) {
let _ = config;
}
fn set_profile(&mut self, profile: &Profile) {
let _ = profile;
}
fn set_source_path(&mut self, path: Option<&std::path::Path>) {
let _ = path;
}
fn applies_to_profile(&self, _profile: &Profile) -> bool {
true
}
}