mirror of
				https://github.com/koalaman/shellcheck.git
				synced 2025-10-31 22:52:50 +08:00 
			
		
		
		
	Don't warn about missing shebang when using directives.
This commit is contained in:
		| @@ -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 ]" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user