From f983d9ae93e5eda28297a93a43640aafafa5f46c Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Thu, 21 Dec 2023 13:35:22 -0500 Subject: [PATCH] Simplify functionMap and remove unnecessary partiality --- src/ShellCheck/Analytics.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs index b7844dda2..19ff51b04 100644 --- a/src/ShellCheck/Analytics.hs +++ b/src/ShellCheck/Analytics.hs @@ -2825,13 +2825,11 @@ checkUnpassedInFunctions params root = execWriter $ mapM_ warnForGroup referenceGroups where functionMap :: Map.Map String Token - functionMap = Map.fromList $ - map (\t@(T_Function _ _ _ name _) -> (name,t)) functions - functions = execWriter $ doAnalysis (tell . maybeToList . findFunction) root + functionMap = Map.fromList $ execWriter $ doAnalysis (tell . maybeToList . findFunction) root findFunction t@(T_Function id _ _ name body) | any (isPositionalReference t) flow && not (any isPositionalAssignment flow) - = return t + = return (name,t) where flow = getVariableFlow params body findFunction _ = Nothing