mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 13:31:36 -07:00
Don't suggest removing braces from $((${x+1})) (fixes #1533)
This commit is contained in:
parent
52a9d90e1a
commit
8efbecd64a
1 changed files with 2 additions and 1 deletions
|
@ -1274,11 +1274,12 @@ prop_checkArithmeticDeref12= verify checkArithmeticDeref "for ((i=0; $i < 3; i))
|
||||||
prop_checkArithmeticDeref13= verifyNot checkArithmeticDeref "(( $$ ))"
|
prop_checkArithmeticDeref13= verifyNot checkArithmeticDeref "(( $$ ))"
|
||||||
prop_checkArithmeticDeref14= verifyNot checkArithmeticDeref "(( $! ))"
|
prop_checkArithmeticDeref14= verifyNot checkArithmeticDeref "(( $! ))"
|
||||||
prop_checkArithmeticDeref15= verifyNot checkArithmeticDeref "(( ${!var} ))"
|
prop_checkArithmeticDeref15= verifyNot checkArithmeticDeref "(( ${!var} ))"
|
||||||
|
prop_checkArithmeticDeref16= verifyNot checkArithmeticDeref "(( ${x+1} + ${x=42} ))"
|
||||||
checkArithmeticDeref params t@(TA_Expansion _ [b@(T_DollarBraced id _ _)]) =
|
checkArithmeticDeref params t@(TA_Expansion _ [b@(T_DollarBraced id _ _)]) =
|
||||||
unless (isException $ bracedString b) getWarning
|
unless (isException $ bracedString b) getWarning
|
||||||
where
|
where
|
||||||
isException [] = True
|
isException [] = True
|
||||||
isException s = any (`elem` "/.:#%?*@$-!") s || isDigit (head s)
|
isException s = any (`elem` "/.:#%?*@$-!+=^,") s || isDigit (head s)
|
||||||
getWarning = fromMaybe noWarning . msum . map warningFor $ parents params t
|
getWarning = fromMaybe noWarning . msum . map warningFor $ parents params t
|
||||||
warningFor t =
|
warningFor t =
|
||||||
case t of
|
case t of
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue