Don't warn about missing shebang when using directives.

This commit is contained in:
Vidar Holen 2016-07-01 22:02:06 -07:00
parent 50084c06c5
commit 42f7479fb8
1 changed files with 9 additions and 3 deletions

View File

@ -439,10 +439,16 @@ checkShebangParameters _ (T_Script id sb _) =
prop_checkShebang1 = verifyNotTree checkShebang "#!/usr/bin/env bash -x\necho cow" prop_checkShebang1 = verifyNotTree checkShebang "#!/usr/bin/env bash -x\necho cow"
prop_checkShebang2 = verifyNotTree checkShebang "#! /bin/sh -l " prop_checkShebang2 = verifyNotTree checkShebang "#! /bin/sh -l "
prop_checkShebang3 = verifyTree checkShebang "ls -l" prop_checkShebang3 = verifyTree checkShebang "ls -l"
checkShebang params (T_Annotation _ _ t) = checkShebang params t prop_checkShebang4 = verifyNotTree checkShebang "#shellcheck shell=sh\nfoo"
checkShebang params (T_Annotation _ list t) =
if any isOverride list then [] else checkShebang params t
where
isOverride (ShellOverride _) = True
isOverride _ = False
checkShebang params (T_Script id sb _) = checkShebang params (T_Script id sb _) =
[makeComment ErrorC id 2148 "Tips depend on target shell and yours is unknown. Add a shebang." [makeComment ErrorC id 2148
| not (shellTypeSpecified params) && sb == "" ] "Tips depend on target shell and yours is unknown. Add a shebang."
| not (shellTypeSpecified params) && sb == "" ]
prop_checkBashisms = verify checkBashisms "while read a; do :; done < <(a)" prop_checkBashisms = verify checkBashisms "while read a; do :; done < <(a)"
prop_checkBashisms2 = verify checkBashisms "[ foo -nt bar ]" prop_checkBashisms2 = verify checkBashisms "[ foo -nt bar ]"