mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 13:31:36 -07:00
Added check for "#!/usr/bin/env bash -x"
This commit is contained in:
parent
3c2d9557e0
commit
1a4301ea98
2 changed files with 11 additions and 2 deletions
|
@ -33,6 +33,7 @@ checks = concat [
|
|||
,[subshellAssignmentCheck]
|
||||
,[checkSpacefulness]
|
||||
,[checkUnquotedExpansions]
|
||||
,[checkShebang]
|
||||
]
|
||||
|
||||
runAllAnalytics = checkList checks
|
||||
|
@ -223,6 +224,14 @@ bracedString l = concat $ deadSimple l
|
|||
isMagicInQuotes (T_DollarBraced _ l) | '@' `elem` (bracedString l) = True
|
||||
isMagicInQuotes _ = False
|
||||
|
||||
prop_checkShebang1 = verifyFull checkShebang "#!/usr/bin/env bash -x\necho cow"
|
||||
prop_checkShebang2 = verifyNotFull checkShebang "#! /bin/sh -l "
|
||||
checkShebang (T_Script id sb _) m =
|
||||
if (length $ words sb) > 2 then
|
||||
let note = Note ErrorC $ "On most OS, shebangs can only specify a single parameter."
|
||||
in Map.adjust (\(Metadata pos notes) -> Metadata pos (note:notes)) id m
|
||||
else m
|
||||
|
||||
prop_checkForInQuoted = verify checkForInQuoted "for f in \"$(ls)\"; do echo foo; done"
|
||||
prop_checkForInQuoted2 = verifyNot checkForInQuoted "for f in \"$@\"; do echo foo; done"
|
||||
prop_checkForInQuoted3 = verify checkForInQuoted "for f in 'find /'; do true; done"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue