mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-03-12 12:35:25 -07:00
Manually fuse elem and map in checkArrayValueUsedAsIndex
This commit is contained in:
parent
71c0fcb737
commit
6e5b5401c6
@ -4628,7 +4628,8 @@ checkArrayValueUsedAsIndex params _ =
|
||||
-- Is this one of the 'for' arrays?
|
||||
(loopWord, _) <- find ((==arrayName) . snd) arrays
|
||||
-- Are we still in this loop?
|
||||
guard $ getId loop `elem` NE.map getId (getPath parents t)
|
||||
let loopId = getId loop
|
||||
guard $ any (\t -> loopId == getId t) (getPath parents t)
|
||||
return [
|
||||
makeComment WarningC (getId loopWord) 2302 "This loops over values. To loop over keys, use \"${!array[@]}\".",
|
||||
makeComment WarningC (getId arrayRef) 2303 $ (e4m name) ++ " is an array value, not a key. Use directly or loop over keys instead."
|
||||
|
Loading…
x
Reference in New Issue
Block a user