Recommend `typeset` instead of `declare` in SC2324

Bash has both `typeset` and `declare`, but ksh has `typeset` only.
Recommend the more portable alternative to users.
This commit is contained in:
Lawrence Velázquez 2024-03-08 18:24:08 -05:00
parent 50db9a29c4
commit 9cb21c8557
No known key found for this signature in database
GPG Key ID: 9AC940DFFD017443
1 changed files with 2 additions and 1 deletions

View File

@ -5017,7 +5017,8 @@ checkPlusEqualsNumber params t =
state <- CF.getIncomingState cfga id
guard $ isNumber state word
guard . not $ fromMaybe False $ CF.variableMayBeDeclaredInteger state var
return $ warn id 2324 "var+=1 will append, not increment. Use (( var += 1 )), declare -i var, or quote number to silence."
-- Recommend "typeset" because ksh does not have "declare".
return $ warn id 2324 "var+=1 will append, not increment. Use (( var += 1 )), typeset -i var, or quote number to silence."
_ -> return ()
where