Added check for a=ls -l
This commit is contained in:
parent
a8715d2d5f
commit
adfdc0a627
|
@ -65,6 +65,7 @@ basicChecks = [
|
||||||
,checkConstantIfs
|
,checkConstantIfs
|
||||||
,checkTrAZ
|
,checkTrAZ
|
||||||
,checkPipedAssignment
|
,checkPipedAssignment
|
||||||
|
,checkAssignAteCommand
|
||||||
]
|
]
|
||||||
|
|
||||||
modifyMap = modify
|
modifyMap = modify
|
||||||
|
@ -141,9 +142,16 @@ prop_checkPipedAssignment1 = verify checkPipedAssignment "A=ls | grep foo"
|
||||||
prop_checkPipedAssignment2 = verifyNot checkPipedAssignment "A=foo cmd | grep foo"
|
prop_checkPipedAssignment2 = verifyNot checkPipedAssignment "A=foo cmd | grep foo"
|
||||||
prop_checkPipedAssignment3 = verifyNot checkPipedAssignment "A=foo"
|
prop_checkPipedAssignment3 = verifyNot checkPipedAssignment "A=foo"
|
||||||
checkPipedAssignment (T_Pipeline _ (T_Redirecting _ _ (T_SimpleCommand id (_:_) []):_:_)) =
|
checkPipedAssignment (T_Pipeline _ (T_Redirecting _ _ (T_SimpleCommand id (_:_) []):_:_)) =
|
||||||
warn id "If you wanted to assign the output of the pipeline, use a=$(b | c)"
|
warn id "If you wanted to assign the output of the pipeline, use a=$(b | c) ."
|
||||||
checkPipedAssignment _ = return ()
|
checkPipedAssignment _ = return ()
|
||||||
|
|
||||||
|
prop_checkAssignAteCommand1 = verify checkAssignAteCommand "A=ls -l"
|
||||||
|
prop_checkAssignAteCommand2 = verify checkAssignAteCommand "A=ls --sort=$foo"
|
||||||
|
prop_checkAssignAteCommand3 = verifyNot checkAssignAteCommand "A=foo ls -l"
|
||||||
|
checkAssignAteCommand (T_SimpleCommand id (t:[]) (w:_)) | "-" `isPrefixOf` (concat $ deadSimple w) =
|
||||||
|
warn id "To assign the output of a command, use var=$(cmd) ."
|
||||||
|
checkAssignAteCommand _ = return ()
|
||||||
|
|
||||||
|
|
||||||
prop_checkUuoc = verify checkUuoc "cat foo | grep bar"
|
prop_checkUuoc = verify checkUuoc "cat foo | grep bar"
|
||||||
checkUuoc (T_Pipeline _ (T_Redirecting _ _ f@(T_SimpleCommand id _ _):_:_)) =
|
checkUuoc (T_Pipeline _ (T_Redirecting _ _ f@(T_SimpleCommand id _ _):_:_)) =
|
||||||
|
|
Loading…
Reference in New Issue