mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-26 00:49:12 +08:00
Also ignore SC2119 for :? and :+.
This commit is contained in:
@@ -2827,6 +2827,8 @@ prop_checkUnpassedInFunctions13 = verifyNotTree checkUnpassedInFunctions "# shel
|
|||||||
prop_checkUnpassedInFunctions14 = verifyTree checkUnpassedInFunctions "foo() { echo $#; }; foo"
|
prop_checkUnpassedInFunctions14 = verifyTree checkUnpassedInFunctions "foo() { echo $#; }; foo"
|
||||||
prop_checkUnpassedInFunctions15 = verifyNotTree checkUnpassedInFunctions "foo() { echo ${1-x}; }; foo"
|
prop_checkUnpassedInFunctions15 = verifyNotTree checkUnpassedInFunctions "foo() { echo ${1-x}; }; foo"
|
||||||
prop_checkUnpassedInFunctions16 = verifyNotTree checkUnpassedInFunctions "foo() { echo ${1:-x}; }; foo"
|
prop_checkUnpassedInFunctions16 = verifyNotTree checkUnpassedInFunctions "foo() { echo ${1:-x}; }; foo"
|
||||||
|
prop_checkUnpassedInFunctions17 = verifyNotTree checkUnpassedInFunctions "foo() { mycommand ${1+--verbose}; }; foo"
|
||||||
|
prop_checkUnpassedInFunctions18 = verifyNotTree checkUnpassedInFunctions "foo() { if mycheck; then foo ${1?Missing}; fi; }; foo"
|
||||||
checkUnpassedInFunctions params root =
|
checkUnpassedInFunctions params root =
|
||||||
execWriter $ mapM_ warnForGroup referenceGroups
|
execWriter $ mapM_ warnForGroup referenceGroups
|
||||||
where
|
where
|
||||||
@@ -2882,9 +2884,10 @@ checkUnpassedInFunctions params root =
|
|||||||
|
|
||||||
isDefaultValueModifier str =
|
isDefaultValueModifier str =
|
||||||
case str of
|
case str of
|
||||||
'-':_ -> True
|
':':c:_ -> c `elem` handlesDefault
|
||||||
':':'-':_ -> True
|
c:_ -> c `elem` handlesDefault
|
||||||
_ -> False
|
_ -> False
|
||||||
|
where handlesDefault = "-+?"
|
||||||
|
|
||||||
isArgumentless (_, b, _) = b
|
isArgumentless (_, b, _) = b
|
||||||
referenceGroups = Map.elems $ foldr updateWith Map.empty referenceList
|
referenceGroups = Map.elems $ foldr updateWith Map.empty referenceList
|
||||||
|
Reference in New Issue
Block a user