vtcode_core/code/code_quality/config/
lint.rs1use crate::tools::tree_sitter::LanguageSupport;
2use std::collections::HashMap;
3
4#[derive(Debug, Clone)]
6pub struct LintConfig {
7 pub language: LanguageSupport,
8 pub tool_name: String,
9 pub command: Vec<String>,
10 pub args: Vec<String>,
11 pub severity_levels: HashMap<String, LintSeverity>,
12 pub enabled: bool,
13}
14
15#[derive(Debug, Clone, PartialEq, Eq)]
17pub enum LintSeverity {
18 Info,
19 Warning,
20 Error,
21 Critical,
22}
23
24impl LintConfig {
25 pub fn clippy() -> Self {
27 Self {
28 language: LanguageSupport::Rust,
29 tool_name: "clippy".to_string(),
30 command: vec!["cargo".to_string(), "clippy".to_string()],
31 args: vec!["--".to_string(), "-D".to_string(), "warnings".to_string()],
32 severity_levels: HashMap::new(),
33 enabled: true,
34 }
35 }
36
37 pub fn eslint() -> Self {
39 Self {
40 language: LanguageSupport::TypeScript,
41 tool_name: "eslint".to_string(),
42 command: vec!["eslint".to_string()],
43 args: vec!["--format".to_string(), "json".to_string()],
44 severity_levels: HashMap::new(),
45 enabled: true,
46 }
47 }
48
49 pub fn pylint() -> Self {
51 Self {
52 language: LanguageSupport::Python,
53 tool_name: "pylint".to_string(),
54 command: vec!["pylint".to_string()],
55 args: vec!["--output-format".to_string(), "json".to_string()],
56 severity_levels: HashMap::new(),
57 enabled: true,
58 }
59 }
60}