Skip to main content

drep/languages/definitions/
shell.rs

1//! Shell: ShellCheck over `.sh` and `.bash`.
2
3use crate::languages::spec::{
4    DEFAULT_TOOL_TIMEOUT_SECS, DiagnosticsStream, LanguageSupport, OutputFormat, ToolSpec,
5};
6
7/// Shell deterministic checker.
8///
9/// `.shellcheckrc` is the one config ShellCheck reads, and a repository
10/// without it has not opted into ShellCheck's defaults.
11pub static SHELLCHECK: ToolSpec = ToolSpec {
12    name: "shellcheck",
13    command: &["shellcheck", "-f", "json"],
14    local_paths: &[],
15    config_files: &[".shellcheckrc"],
16    config_flag: None,
17    output_format: OutputFormat::Shellcheck,
18    diagnostics_stream: DiagnosticsStream::Stdout,
19    timeout_secs: DEFAULT_TOOL_TIMEOUT_SECS,
20    timeout_context: None,
21    establishes_compilation: false,
22    serial_in_repository: false,
23    accepts_files: true,
24};
25
26/// Shell language entry.
27pub static SHELL: LanguageSupport = LanguageSupport {
28    name: "shell",
29    display_name: "Shell",
30    extensions: &[".sh", ".bash"],
31    filenames: &[],
32    filename_prefixes: &[],
33    tools: &[&SHELLCHECK],
34    conventions: &[
35        "Unquoted expansions that glob or word-split",
36        "Commands whose failure is never checked",
37        "Pipelines whose failure set -e does not catch",
38        "cd without checking, and traps that never fire on the failure path",
39    ],
40    vendored_dirs: &[],
41};
42
43/// The family's entries in registration order. See `ALL_LANGUAGES`.
44pub(crate) static FAMILY: &[&LanguageSupport] = &[&SHELL];