From 1e6a30905a986962a6d78ec55609168a724d253a Mon Sep 17 00:00:00 2001 From: Tito Sacchi Date: Mon, 14 Jan 2019 14:25:01 +0100 Subject: [PATCH] Make ShellCheck not emit warnings about the shebang if the shell type is determined from the extension --- src/ShellCheck/Analytics.hs | 2 +- src/ShellCheck/AnalyzerLib.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs index 6230f5b..8f66aaf 100644 --- a/src/ShellCheck/Analytics.hs +++ b/src/ShellCheck/Analytics.hs @@ -484,7 +484,7 @@ checkShebang params (T_Annotation _ list t) = checkShebang params (T_Script id sb _) = execWriter $ do unless (shellTypeSpecified params) $ do when (sb == "") $ - err id 2148 "Tips depend on target shell and yours is unknown. Add a shebang." + err id 2148 "Tips depend on target shell and yours is unknown. Add a shebang or an extension to the filename." when (executableFromShebang sb == "ash") $ warn id 2187 "Ash scripts will be checked as Dash. Add '# shellcheck shell=dash' to silence." unless (null sb) $ do diff --git a/src/ShellCheck/AnalyzerLib.hs b/src/ShellCheck/AnalyzerLib.hs index 5248d94..b2b4edd 100644 --- a/src/ShellCheck/AnalyzerLib.hs +++ b/src/ShellCheck/AnalyzerLib.hs @@ -184,7 +184,7 @@ makeParameters spec = Sh -> False Ksh -> True, - shellTypeSpecified = isJust $ asShellType spec, + shellTypeSpecified = isJust (asShellType spec) || isJust (asFallbackShell spec), parentMap = getParentTree root, variableFlow = getVariableFlow params root, tokenPositions = asTokenPositions spec