From ea8cef3849014760facf9e7bf390db30d7855ddf Mon Sep 17 00:00:00 2001 From: Chris Grieser <73286100+chrisgrieser@users.noreply.github.com> Date: Sat, 30 Mar 2024 10:11:45 +0100 Subject: [PATCH] fix: do not overwrite user-provided shellcheck `--shell` (#1064) --- server/src/shellcheck/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/shellcheck/index.ts b/server/src/shellcheck/index.ts index 5f4f207b..c526d0b9 100644 --- a/server/src/shellcheck/index.ts +++ b/server/src/shellcheck/index.ts @@ -120,13 +120,19 @@ export class Linter { .map((folderName) => `--source-path=${folderName}`) const args = [ - `--shell=${shellName}`, '--format=json1', '--external-sources', ...sourcePathsArgs, ...additionalArgs, ] + // only add `--shell` argument if non is provided by the user in their + // config. This allows to the user to override the shell. See #1064. + const userArgs = additionalArgs.join(' ') + if (!(userArgs.includes('--shell') || userArgs.includes('-s '))) { + args.unshift(`--shell=${shellName}`) + } + logger.debug(`ShellCheck: running "${this.executablePath} ${args.join(' ')}"`) let out = ''