mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-09-19 18:19:22 +08:00
Don't warn about missing shebang when using directives.
This commit is contained in:
@@ -439,9 +439,15 @@ 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
|
||||||
|
"Tips depend on target shell and yours is unknown. Add a shebang."
|
||||||
| not (shellTypeSpecified params) && sb == "" ]
|
| not (shellTypeSpecified params) && sb == "" ]
|
||||||
|
|
||||||
prop_checkBashisms = verify checkBashisms "while read a; do :; done < <(a)"
|
prop_checkBashisms = verify checkBashisms "while read a; do :; done < <(a)"
|
||||||
|
Reference in New Issue
Block a user