mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-31 12:00:35 -07:00
Fixed message for (($1))
This commit is contained in:
parent
24f91ae711
commit
34259f16db
1 changed files with 5 additions and 1 deletions
|
@ -439,8 +439,12 @@ prop_checkArithmeticDeref = verify checkArithmeticDeref "echo $((3+$foo))"
|
||||||
prop_checkArithmeticDeref2 = verify checkArithmeticDeref "cow=14; (( s+= $cow ))"
|
prop_checkArithmeticDeref2 = verify checkArithmeticDeref "cow=14; (( s+= $cow ))"
|
||||||
prop_checkArithmeticDeref3 = verifyNot checkArithmeticDeref "cow=1/40; (( s+= ${cow%%/*} ))"
|
prop_checkArithmeticDeref3 = verifyNot checkArithmeticDeref "cow=1/40; (( s+= ${cow%%/*} ))"
|
||||||
prop_checkArithmeticDeref4 = verifyNot checkArithmeticDeref "(( ! $? ))"
|
prop_checkArithmeticDeref4 = verifyNot checkArithmeticDeref "(( ! $? ))"
|
||||||
checkArithmeticDeref (TA_Expansion _ (T_DollarBraced id l)) | not $ any (`elem` "/.:#%?*@") $ bracedString l =
|
prop_checkArithmeticDeref5 = verifyNot checkArithmeticDeref "(($1))"
|
||||||
|
checkArithmeticDeref (TA_Expansion _ (T_DollarBraced id l)) | not . excepting $ bracedString l =
|
||||||
style id $ "Don't use $ on variables in (( ))."
|
style id $ "Don't use $ on variables in (( ))."
|
||||||
|
where
|
||||||
|
excepting [] = True
|
||||||
|
excepting s = (any (`elem` "/.:#%?*@") s) || (isDigit $ head s)
|
||||||
checkArithmeticDeref _ = return ()
|
checkArithmeticDeref _ = return ()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue