Added check for [ a==b ]
This commit is contained in:
parent
947ae519a2
commit
f9f2982c9f
|
@ -33,6 +33,7 @@ basicChecks = [
|
|||
,checkSingleQuotedVariables
|
||||
,checkUnquotedZN
|
||||
,checkNumberComparisons
|
||||
,checkNoaryWasBinary
|
||||
]
|
||||
|
||||
modifyMap = modify
|
||||
|
@ -225,6 +226,13 @@ checkNumberComparisons (TC_Binary id typ op lhs rhs)
|
|||
eqv _ = "the numerical equivalent"
|
||||
checkNumberComparisons _ = return ()
|
||||
|
||||
prop_checkNoaryWasBinary = verify checkNoaryWasBinary "[[ a==$foo ]]"
|
||||
prop_checkNoaryWasBinary2 = verify checkNoaryWasBinary "[ $foo=3 ]"
|
||||
checkNoaryWasBinary (TC_Noary _ _ t@(T_NormalWord id l)) = do
|
||||
let str = concat $ deadSimple t
|
||||
when ('=' `elem` str) $ addNoteFor id $ Note ErrorC $ "Always true because you didn't put spaces around the ="
|
||||
checkNoaryWasBinary _ = return ()
|
||||
|
||||
allModifiedVariables t = snd $ runState (doAnalysis (\x -> modify $ (++) (getModifiedVariables t)) t) []
|
||||
|
||||
--- Subshell detection
|
||||
|
|
|
@ -146,7 +146,6 @@ acceptButWarn parser level note = do
|
|||
)
|
||||
|
||||
|
||||
prop_readConditionContents = isWarning readCondition "[ grep -q file dir ]"
|
||||
readConditionContents single = do
|
||||
readCondOr `attempting` (lookAhead $ do
|
||||
pos <- getPosition
|
||||
|
|
Loading…
Reference in New Issue