Skip to main content

sandogasa_bugclass/
lib.rs

1// SPDX-License-Identifier: Apache-2.0 OR MIT
2
3//! Classify issue-tracker bugs into a portable set of categories.
4//!
5//! The [`BugKind`] enum is the shared vocabulary across trackers —
6//! CVEs, FTBFS / FTI, update requests, etc. Per-tracker submodules
7//! implement the classification logic for their tracker's specific
8//! conventions (keywords, aliases, blocks relationships, labels,
9//! etc.). Currently only Bugzilla is supported; GitLab / GitHub /
10//! others can be added alongside as new submodules.
11
12pub mod bugzilla;
13
14/// Tracker-agnostic bug category.
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
16pub enum BugKind {
17    /// Package review request.
18    Review,
19    /// Security issue (CVE or equivalent).
20    Security,
21    /// Update request ("X is available").
22    Update,
23    /// Branch request for a downstream distribution.
24    Branch,
25    /// Fails to build from source.
26    Ftbfs,
27    /// Fails to install.
28    Fti,
29    /// Doesn't fit any of the above.
30    Other,
31}
32
33impl BugKind {
34    /// Return the short string id for this kind (stable identifier
35    /// suitable for serialization and reports).
36    pub fn as_str(&self) -> &'static str {
37        match self {
38            BugKind::Review => "review",
39            BugKind::Security => "security",
40            BugKind::Update => "update",
41            BugKind::Branch => "branch",
42            BugKind::Ftbfs => "ftbfs",
43            BugKind::Fti => "fti",
44            BugKind::Other => "other",
45        }
46    }
47}