Removed trailing whitespace

This commit is contained in:
Vidar Holen 2012-11-26 20:43:19 -08:00
parent f4afb9a88f
commit 4a803d2e48
1 changed files with 12 additions and 12 deletions

View File

@ -61,7 +61,7 @@ basicChecks = [
,checkPrintfVar ,checkPrintfVar
,checkCommarrays ,checkCommarrays
,checkOrNeq ,checkOrNeq
,checkEcho ,checkEcho
,checkConstantIfs ,checkConstantIfs
] ]
@ -115,9 +115,9 @@ checkFull f s = case parseShell "-" s of
prop_checkEcho1 = verify checkEcho "FOO=$(echo \"$cow\" | sed 's/foo/bar/g')" prop_checkEcho1 = verify checkEcho "FOO=$(echo \"$cow\" | sed 's/foo/bar/g')"
prop_checkEcho2 = verify checkEcho "rm $(echo $cow | sed -e 's,foo,bar,')" prop_checkEcho2 = verify checkEcho "rm $(echo $cow | sed -e 's,foo,bar,')"
prop_checkEcho3 = verify checkEcho "n=$(echo $foo | wc -c)" prop_checkEcho3 = verify checkEcho "n=$(echo $foo | wc -c)"
checkEcho (T_Pipeline id [a, b]) = checkEcho (T_Pipeline id [a, b]) =
when (acmd == ["echo", "${VAR}"]) $ when (acmd == ["echo", "${VAR}"]) $
case bcmd of case bcmd of
["sed", v] -> checkIn v ["sed", v] -> checkIn v
["sed", "-e", v] -> checkIn v ["sed", "-e", v] -> checkIn v
["wc", "-c"] -> countMsg ["wc", "-c"] -> countMsg
@ -126,7 +126,7 @@ checkEcho (T_Pipeline id [a, b]) =
where where
acmd = deadSimple a acmd = deadSimple a
bcmd = deadSimple b bcmd = deadSimple b
checkIn s = checkIn s =
case matchRegex checkEchoSedRe s of case matchRegex checkEchoSedRe s of
Just _ -> style id $ "See if you can use ${variable//search/replace} instead." Just _ -> style id $ "See if you can use ${variable//search/replace} instead."
_ -> return () _ -> return ()
@ -380,7 +380,7 @@ getTokenMap t =
f t = modify (Map.insert (getId t) t) f t = modify (Map.insert (getId t) t)
inUnquotableContext tree t = inUnquotableContext tree t =
case t of case t of
TC_Noary _ DoubleBracket _ -> True TC_Noary _ DoubleBracket _ -> True
TC_Unary _ DoubleBracket _ _ -> True TC_Unary _ DoubleBracket _ _ -> True
@ -492,8 +492,8 @@ getModifiedVariablesWithType spacefulF t =
_ -> [] _ -> []
isSpaceful :: (String -> Bool) -> Token -> Bool isSpaceful :: (String -> Bool) -> Token -> Bool
isSpaceful spacefulF x = isSpaceful spacefulF x =
case x of case x of
T_DollarExpansion _ _ -> True T_DollarExpansion _ _ -> True
T_Extglob _ _ _ -> True T_Extglob _ _ _ -> True
T_Literal _ s -> s `containsAny` globspace T_Literal _ s -> s `containsAny` globspace
@ -502,12 +502,12 @@ isSpaceful spacefulF x =
T_NormalWord _ w -> isSpacefulWord spacefulF w T_NormalWord _ w -> isSpacefulWord spacefulF w
T_DoubleQuoted _ w -> isSpacefulWord spacefulF w T_DoubleQuoted _ w -> isSpacefulWord spacefulF w
_ -> False _ -> False
where where
globspace = "* \t\n" globspace = "* \t\n"
containsAny s chars = any (\c -> c `elem` s) chars containsAny s chars = any (\c -> c `elem` s) chars
isSpacefulWord :: (String -> Bool) -> [Token] -> Bool isSpacefulWord :: (String -> Bool) -> [Token] -> Bool
isSpacefulWord f words = isSpacefulWord f words =
any (isSpaceful f) words any (isSpaceful f) words
getModifiedVariableCommand (T_SimpleCommand _ _ ((T_NormalWord _ ((T_Literal _ x):_)):rest)) = getModifiedVariableCommand (T_SimpleCommand _ _ ((T_NormalWord _ ((T_Literal _ x):_)):rest)) =
@ -604,7 +604,7 @@ checkSpacefulness t metaMap =
registerSpacing (id, s, typ) = do registerSpacing (id, s, typ) = do
(metaMap, spaceMap) <- get (metaMap, spaceMap) <- get
put (metaMap, Map.insert s typ spaceMap) put (metaMap, Map.insert s typ spaceMap)
parents = getParentTree t parents = getParentTree t
items = getTokenMap t items = getTokenMap t
@ -612,7 +612,7 @@ checkSpacefulness t metaMap =
startScope t = do startScope t = do
(_, spaceMap) <- get (_, spaceMap) <- get
let let
isSpaceful id = (Map.findWithDefault Spaceless id spaceMap) /= Spaceless isSpaceful id = (Map.findWithDefault Spaceless id spaceMap) /= Spaceless
read = getReferencedVariables t read = getReferencedVariables t
written = getModifiedVariablesWithType isSpaceful t written = getModifiedVariablesWithType isSpaceful t