Skip to content

Commit 553a80f

Browse files
committed
Also ignore SC2119 for :? and :+.
1 parent 7fc992d commit 553a80f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ShellCheck/Analytics.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2827,6 +2827,8 @@ prop_checkUnpassedInFunctions13 = verifyNotTree checkUnpassedInFunctions "# shel
28272827
prop_checkUnpassedInFunctions14 = verifyTree checkUnpassedInFunctions "foo() { echo $#; }; foo"
28282828
prop_checkUnpassedInFunctions15 = verifyNotTree checkUnpassedInFunctions "foo() { echo ${1-x}; }; foo"
28292829
prop_checkUnpassedInFunctions16 = verifyNotTree checkUnpassedInFunctions "foo() { echo ${1:-x}; }; foo"
2830+
prop_checkUnpassedInFunctions17 = verifyNotTree checkUnpassedInFunctions "foo() { mycommand ${1+--verbose}; }; foo"
2831+
prop_checkUnpassedInFunctions18 = verifyNotTree checkUnpassedInFunctions "foo() { if mycheck; then foo ${1?Missing}; fi; }; foo"
28302832
checkUnpassedInFunctions params root =
28312833
execWriter $ mapM_ warnForGroup referenceGroups
28322834
where
@@ -2882,9 +2884,10 @@ checkUnpassedInFunctions params root =
28822884

28832885
isDefaultValueModifier str =
28842886
case str of
2885-
'-':_ -> True
2886-
':':'-':_ -> True
2887+
':':c:_ -> c `elem` handlesDefault
2888+
c:_ -> c `elem` handlesDefault
28872889
_ -> False
2890+
where handlesDefault = "-+?"
28882891

28892892
isArgumentless (_, b, _) = b
28902893
referenceGroups = Map.elems $ foldr updateWith Map.empty referenceList

0 commit comments

Comments
 (0)