mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 00:07:56 +08:00
Only trigger SC2316 on unquoted words.
This commit is contained in:
@@ -948,10 +948,11 @@ prop_checkMultipleDeclaring3 = verify (checkMultipleDeclaring "readonly") "reado
|
||||
prop_checkMultipleDeclaring4 = verify (checkMultipleDeclaring "export") "export readonly foo=5"
|
||||
prop_checkMultipleDeclaring5 = verifyNot (checkMultipleDeclaring "local") "f() { local -r foo=5; }"
|
||||
prop_checkMultipleDeclaring6 = verifyNot (checkMultipleDeclaring "declare") "declare -rx foo=5"
|
||||
prop_checkMultipleDeclaring7 = verifyNot (checkMultipleDeclaring "readonly") "readonly 'local' foo=5"
|
||||
checkMultipleDeclaring cmd = CommandCheck (Exactly cmd) (mapM_ check . arguments)
|
||||
where
|
||||
check t = sequence_ $ do
|
||||
lit <- getLiteralString t
|
||||
lit <- getUnquotedLiteral t
|
||||
guard $ lit `elem` declaringCommands
|
||||
return $ err (getId $ getCommandTokenOrThis t) 2316 $
|
||||
"This applies " ++ cmd ++ " to the variable named " ++ lit ++
|
||||
|
Reference in New Issue
Block a user