use std::borrow::Cow;
use std::path::PathBuf;
use harn_lexer::{FixEdit, Span};
use harn_parser::{DiagnosticCode as Code, Repair};
#[derive(Debug, Clone)]
pub struct LintDiagnostic {
pub code: Code,
pub rule: Cow<'static, str>,
pub message: String,
pub span: Span,
pub severity: LintSeverity,
pub suggestion: Option<String>,
pub fix: Option<Vec<FixEdit>>,
}
impl LintDiagnostic {
pub fn repair(&self) -> Option<Repair> {
self.code.repair_template().map(Repair::from_template)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LintSeverity {
Info,
Warning,
Error,
}
pub const DEFAULT_COMPLEXITY_THRESHOLD: usize = 25;
#[derive(Debug, Default, Clone)]
pub struct LintOptions<'a> {
pub file_path: Option<&'a std::path::Path>,
pub require_file_header: bool,
pub require_docstrings: bool,
pub complexity_threshold: Option<usize>,
pub persona_step_allowlist: &'a [String],
pub require_stdlib_metadata: bool,
pub engine_rules: &'a [String],
pub native_rule_paths: &'a [PathBuf],
pub severity_overrides: std::collections::HashMap<String, LintSeverity>,
}