File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3314,14 +3314,12 @@ checkUncheckedCdPushdPopd params root =
33143314 checkElement _ = return ()
33153315 getName t = fromMaybe " " $ getCommandName t
33163316 isLastCommandInFunction t =
3317- case getPath (parentMap params) t of
3318- _ NE. :| T_BraceGroup _ commands: T_Function {}: _ -> t `isLastOf` commands
3319- _ -> False
3320- isLastOf t commands =
3321- case commands of
3322- [x] -> x == t
3323- _: rest -> isLastOf t rest
3324- [] -> False
3317+ go $ NE. tail $ getPath (parentMap params) t
3318+ where
3319+ go (child: T_BraceGroup _ commands: T_Function {}: _) =
3320+ not (null commands) && getId (last commands) == getId child
3321+ go (_: rest) = go rest
3322+ go [] = False
33253323 isSafeDir t = case oversimplify t of
33263324 [_, str] -> str `matches` regex
33273325 _ -> False
You can’t perform that action at this time.
0 commit comments