pub const DEFAULT_TOOL_TIMEOUT_SECS: u64 = 120;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OutputFormat {
Lines,
Json,
Position,
Tsc,
Cargo,
Sarif,
Ktlint,
Shellcheck,
Rubocop,
Phpcs,
Credo,
Sqlfluff,
Msbuild,
}
impl OutputFormat {
pub fn skips_unmatched_input(self) -> bool {
matches!(self, Self::Position | Self::Tsc | Self::Msbuild)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DiagnosticsStream {
Stdout,
Stderr,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ToolSpec {
pub name: &'static str,
pub command: &'static [&'static str],
pub local_paths: &'static [&'static str],
pub config_files: &'static [&'static str],
pub config_flag: Option<&'static str>,
pub output_format: OutputFormat,
pub diagnostics_stream: DiagnosticsStream,
pub timeout_secs: u64,
pub timeout_context: Option<&'static str>,
pub establishes_compilation: bool,
pub serial_in_repository: bool,
pub accepts_files: bool,
}
impl Default for ToolSpec {
fn default() -> Self {
Self {
name: "",
command: &[],
local_paths: &[],
config_files: &[],
config_flag: None,
output_format: OutputFormat::Json,
diagnostics_stream: DiagnosticsStream::Stdout,
timeout_secs: DEFAULT_TOOL_TIMEOUT_SECS,
timeout_context: None,
establishes_compilation: false,
serial_in_repository: false,
accepts_files: true,
}
}
}
#[derive(Debug, Default, Clone, PartialEq)]
pub struct LanguageSupport {
pub name: &'static str,
pub display_name: &'static str,
pub extensions: &'static [&'static str],
pub filenames: &'static [&'static str],
pub filename_prefixes: &'static [&'static str],
pub tools: &'static [&'static ToolSpec],
pub conventions: &'static [&'static str],
pub vendored_dirs: &'static [&'static str],
}