mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-19 13:00:54 -07:00
Warn about passing globs to unset
.
This commit is contained in:
parent
6a4b86cbea
commit
868d53af95
1 changed files with 10 additions and 0 deletions
|
@ -90,6 +90,7 @@ commandChecks = [
|
||||||
,checkExportedExpansions
|
,checkExportedExpansions
|
||||||
,checkAliasesUsesArgs
|
,checkAliasesUsesArgs
|
||||||
,checkAliasesExpandEarly
|
,checkAliasesExpandEarly
|
||||||
|
,checkUnsetGlobs
|
||||||
]
|
]
|
||||||
|
|
||||||
buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis)
|
buildCommandMap :: [CommandCheck] -> Map.Map CommandName (Token -> Analysis)
|
||||||
|
@ -589,5 +590,14 @@ checkAliasesExpandEarly = CommandCheck (Exactly "alias") (f . arguments)
|
||||||
checkArg _ = return ()
|
checkArg _ = return ()
|
||||||
|
|
||||||
|
|
||||||
|
prop_checkUnsetGlobs1 = verify checkUnsetGlobs "unset foo[1]"
|
||||||
|
prop_checkUnsetGlobs2 = verifyNot checkUnsetGlobs "unset foo"
|
||||||
|
checkUnsetGlobs = CommandCheck (Exactly "unset") (mapM_ check . arguments)
|
||||||
|
where
|
||||||
|
check arg =
|
||||||
|
when (isGlob arg) $
|
||||||
|
warn (getId arg) 2184 "Quote arguments to unset so they're not glob expanded."
|
||||||
|
|
||||||
|
|
||||||
return []
|
return []
|
||||||
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue