From 0369f43bac3203d16f39f85aabb6c8dfe9ecb0a1 Mon Sep 17 00:00:00 2001
From: Vidar Holen <spam@vidarholen.net>
Date: Sat, 1 Nov 2014 13:51:19 -0700
Subject: [PATCH] Fixed 2148 to not trigger if a shell is specified with `-s`.

---
 ShellCheck/Analytics.hs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs
index 82c0c18..e877e32 100644
--- a/ShellCheck/Analytics.hs
+++ b/ShellCheck/Analytics.hs
@@ -39,7 +39,8 @@ import Test.QuickCheck.All (quickCheckAll)
 data Parameters = Parameters {
     variableFlow :: [StackData],
     parentMap :: Map.Map Id Token,
-    shellType :: Shell
+    shellType :: Shell,
+    shellTypeSpecified :: Bool
     }
 
 -- Checks that are run on the AST root
@@ -85,6 +86,7 @@ runList options root list = notes
     where
         params = Parameters {
                 shellType = fromMaybe (determineShell root) $ optionShellType options,
+                shellTypeSpecified = isJust $ optionShellType options,
                 parentMap = getParentTree root,
                 variableFlow = getVariableFlow (shellType params) (parentMap params) root
         }
@@ -592,7 +594,8 @@ prop_checkShebang1 = verifyNotTree checkShebang "#!/usr/bin/env bash -x\necho co
 prop_checkShebang2 = verifyNotTree checkShebang "#! /bin/sh  -l "
 prop_checkShebang3 = verifyTree checkShebang "ls -l"
 checkShebang params (T_Script id sb _) =
-    [Note id ErrorC 2148 "Include a shebang (#!) to specify the shell." | sb == ""]
+    [Note id InfoC 2148 $ "Shebang (#!) missing. Assuming " ++ (show $ shellType params) ++ "."
+        | not (shellTypeSpecified params) && sb == "" ]
 
 prop_checkBashisms = verify checkBashisms "while read a; do :; done < <(a)"
 prop_checkBashisms2 = verify checkBashisms "[ foo -nt bar ]"