use super::IssueSeverity;
use alloc::vec::Vec;
#[derive(Debug, Clone)]
pub struct LintConfig {
pub min_severity: IssueSeverity,
pub max_issues: usize,
pub strict_mode: bool,
pub enabled_rules: Vec<&'static str>,
pub disabled_rules: Vec<&'static str>,
}
impl Default for LintConfig {
fn default() -> Self {
Self {
min_severity: IssueSeverity::Info,
max_issues: 0, strict_mode: false,
enabled_rules: Vec::new(),
disabled_rules: Vec::new(),
}
}
}
impl LintConfig {
#[must_use]
pub const fn with_min_severity(mut self, severity: IssueSeverity) -> Self {
self.min_severity = severity;
self
}
#[must_use]
pub const fn with_max_issues(mut self, max: usize) -> Self {
self.max_issues = max;
self
}
#[must_use]
pub const fn with_strict_compliance(mut self, enabled: bool) -> Self {
self.strict_mode = enabled;
self
}
#[must_use]
pub fn is_rule_enabled(&self, rule_id: &str) -> bool {
if self.disabled_rules.contains(&rule_id) {
return false;
}
self.enabled_rules.is_empty() || self.enabled_rules.contains(&rule_id)
}
#[must_use]
pub fn should_report_severity(&self, severity: IssueSeverity) -> bool {
severity >= self.min_severity
}
}