use crate::languages::spec::{
DEFAULT_TOOL_TIMEOUT_SECS, DiagnosticsStream, LanguageSupport, OutputFormat, ToolSpec,
};
static JVM_VENDORED_DIRS: &[&str] = &["build", ".gradle", "target"];
pub static CHECKSTYLE: ToolSpec = ToolSpec {
name: "checkstyle",
command: &["checkstyle", "-f", "sarif"],
local_paths: &[],
config_files: &[
"checkstyle.xml",
".checkstyle.xml",
"config/checkstyle/checkstyle.xml",
"gradle/config/checkstyle/checkstyle.xml",
],
config_flag: Some("-c"),
output_format: OutputFormat::Sarif,
diagnostics_stream: DiagnosticsStream::Stdout,
timeout_secs: DEFAULT_TOOL_TIMEOUT_SECS,
timeout_context: None,
establishes_compilation: false,
serial_in_repository: false,
accepts_files: true,
};
pub static KTLINT: ToolSpec = ToolSpec {
name: "ktlint",
command: &["ktlint", "--log-level=none", "--reporter=json"],
local_paths: &[],
config_files: &[".editorconfig"],
config_flag: None,
output_format: OutputFormat::Ktlint,
diagnostics_stream: DiagnosticsStream::Stdout,
timeout_secs: DEFAULT_TOOL_TIMEOUT_SECS,
timeout_context: None,
establishes_compilation: false,
serial_in_repository: false,
accepts_files: true,
};
pub static JAVA: LanguageSupport = LanguageSupport {
name: "java",
display_name: "Java",
extensions: &[".java"],
filenames: &[],
filename_prefixes: &[],
tools: &[&CHECKSTYLE],
conventions: &[
"Resources closed on every path, and try-with-resources where it applies",
"Null handling: Optional versus a nullable return, and unchecked dereferences",
"equals/hashCode/compareTo consistency, and mutable state in a shared object",
"Exceptions swallowed or logged and rethrown, losing the original cause",
"Concurrency: unsynchronised shared state, and non-thread-safe fields on a singleton",
],
vendored_dirs: JVM_VENDORED_DIRS,
};
pub static KOTLIN: LanguageSupport = LanguageSupport {
name: "kotlin",
display_name: "Kotlin",
extensions: &[".kt", ".kts"],
filenames: &[],
filename_prefixes: &[],
tools: &[&KTLINT],
conventions: &[
"Platform types from Java interop dereferenced without a null check",
"runBlocking on a coroutine path, and scopes that outlive their work",
"!! where the null case is real, and lateinit read before assignment",
"data class equality over mutable properties",
],
vendored_dirs: JVM_VENDORED_DIRS,
};
pub static SCALA: LanguageSupport = LanguageSupport {
name: "scala",
display_name: "Scala",
extensions: &[".scala", ".sc"],
filenames: &[],
filename_prefixes: &[],
tools: &[],
conventions: &[
"Partial functions and non-exhaustive matches",
"Option/Either handling versus get and head on an empty collection",
"Implicits whose resolution is not obvious at the call site",
"Futures without an explicit ExecutionContext, and blocking inside one",
],
vendored_dirs: JVM_VENDORED_DIRS,
};
pub static GROOVY: LanguageSupport = LanguageSupport {
name: "groovy",
display_name: "Groovy",
extensions: &[".groovy", ".gradle"],
filenames: &[],
filename_prefixes: &[],
tools: &[],
conventions: &[
"Dynamic dispatch where a typed call would fail at compile time",
"Gradle configuration-time work that belongs in a task action",
"Dependency and plugin versions pinned versus floating",
"String interpolation of values that should be escaped",
],
vendored_dirs: JVM_VENDORED_DIRS,
};
pub(crate) static FAMILY: &[&LanguageSupport] = &[&JAVA, &KOTLIN, &SCALA, &GROOVY];