Fixed 2148 to not trigger if a shell is specified with `-s`.
This commit is contained in:
parent
eb2eae2888
commit
0369f43bac
ShellCheck
|
@ -39,7 +39,8 @@ import Test.QuickCheck.All (quickCheckAll)
|
||||||
data Parameters = Parameters {
|
data Parameters = Parameters {
|
||||||
variableFlow :: [StackData],
|
variableFlow :: [StackData],
|
||||||
parentMap :: Map.Map Id Token,
|
parentMap :: Map.Map Id Token,
|
||||||
shellType :: Shell
|
shellType :: Shell,
|
||||||
|
shellTypeSpecified :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Checks that are run on the AST root
|
-- Checks that are run on the AST root
|
||||||
|
@ -85,6 +86,7 @@ runList options root list = notes
|
||||||
where
|
where
|
||||||
params = Parameters {
|
params = Parameters {
|
||||||
shellType = fromMaybe (determineShell root) $ optionShellType options,
|
shellType = fromMaybe (determineShell root) $ optionShellType options,
|
||||||
|
shellTypeSpecified = isJust $ optionShellType options,
|
||||||
parentMap = getParentTree root,
|
parentMap = getParentTree root,
|
||||||
variableFlow = getVariableFlow (shellType params) (parentMap params) 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_checkShebang2 = verifyNotTree checkShebang "#! /bin/sh -l "
|
||||||
prop_checkShebang3 = verifyTree checkShebang "ls -l"
|
prop_checkShebang3 = verifyTree checkShebang "ls -l"
|
||||||
checkShebang params (T_Script id sb _) =
|
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_checkBashisms = verify checkBashisms "while read a; do :; done < <(a)"
|
||||||
prop_checkBashisms2 = verify checkBashisms "[ foo -nt bar ]"
|
prop_checkBashisms2 = verify checkBashisms "[ foo -nt bar ]"
|
||||||
|
|
Loading…
Reference in New Issue