sarif_rust 0.3.0

A comprehensive Rust library for parsing, generating, and manipulating SARIF (Static Analysis Results Interchange Format) v2.1.0 files
Documentation
//! SARIF enumeration types
//!
//! This module defines all the enumerated values used throughout the SARIF specification.

use serde::{Deserialize, Serialize};

/// Result importance level
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub enum Level {
    /// Default level - not specified
    #[default]
    None,
    /// Informational note
    Note,
    /// Warning level issue
    Warning,
    /// Error level issue
    Error,
}

/// Result kind classification
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum Kind {
    /// Rule does not apply to the analysis target
    NotApplicable,
    /// Rule was evaluated and passed
    Pass,
    /// Rule was evaluated and failed
    Fail,
    /// Rule requires manual review
    Review,
    /// Result represents an open issue
    Open,
    /// Informational result
    Informational,
}

/// Baseline comparison state
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum BaselineState {
    /// New result not present in baseline
    New,
    /// Result unchanged from baseline
    Unchanged,
    /// Result updated from baseline
    Updated,
    /// Result was present in baseline but absent in current run
    Absent,
}

/// Notification importance level
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub enum NotificationLevel {
    /// Default notification level
    #[default]
    None,
    /// Informational notification
    Note,
    /// Warning notification
    Warning,
    /// Error notification
    Error,
}

/// Thread flow kind
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ThreadFlowKind {
    /// Thread flow represents a path through code
    Path,
    /// Thread flow represents a data flow
    Data,
}

/// Suppression state
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SuppressionKind {
    /// Result is suppressed in source code
    InSource,
    /// Result is suppressed via external configuration
    External,
}

// Column kind for location regions - ColumnKind moved to run.rs to avoid conflicts

impl std::fmt::Display for Level {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Level::None => write!(f, "none"),
            Level::Note => write!(f, "note"),
            Level::Warning => write!(f, "warning"),
            Level::Error => write!(f, "error"),
        }
    }
}

impl std::fmt::Display for Kind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Kind::NotApplicable => write!(f, "notApplicable"),
            Kind::Pass => write!(f, "pass"),
            Kind::Fail => write!(f, "fail"),
            Kind::Review => write!(f, "review"),
            Kind::Open => write!(f, "open"),
            Kind::Informational => write!(f, "informational"),
        }
    }
}

impl std::fmt::Display for BaselineState {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            BaselineState::New => write!(f, "new"),
            BaselineState::Unchanged => write!(f, "unchanged"),
            BaselineState::Updated => write!(f, "updated"),
            BaselineState::Absent => write!(f, "absent"),
        }
    }
}