Skip to content

Commit 925482f

Browse files
hyperpolymathclaude
andcommitted
feat: add V-lang API for static analysis client
Severity threshold checking, language support validation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6a63f76 commit 925482f

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

api/v/panic_attack.v

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// SPDX-License-Identifier: PMPL-1.0-or-later
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
//
4+
// panic-attack V-lang API — Static analysis scanner client.
5+
module panic_attack
6+
7+
pub enum Severity {
8+
info
9+
warning
10+
@error
11+
critical
12+
}
13+
14+
pub enum ScanOp {
15+
assail
16+
ambush
17+
abduct
18+
adjudicate
19+
axial
20+
}
21+
22+
pub struct Finding {
23+
pub:
24+
file string
25+
line int
26+
severity Severity
27+
message string
28+
rule_id string
29+
}
30+
31+
fn C.panic_severity_compare(a int, b int) int
32+
fn C.panic_severity_meets(severity int, threshold int) int
33+
fn C.panic_valid_lang(lang_id int) int
34+
35+
// severity_meets checks if a finding meets a minimum severity threshold.
36+
pub fn severity_meets(severity Severity, threshold Severity) bool {
37+
return C.panic_severity_meets(int(severity), int(threshold)) == 1
38+
}
39+
40+
// is_supported_lang checks if a language ID is supported (0-46).
41+
pub fn is_supported_lang(lang_id int) bool {
42+
return C.panic_valid_lang(lang_id) == 1
43+
}

0 commit comments

Comments
 (0)