From 21ad4196dba4fd47275319ccf8bb3e2d7745567f Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Sun, 9 Feb 2020 21:08:32 -0500 Subject: [PATCH] Simplify findFunction --- src/ShellCheck/Analytics.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs index 5f19352..31213f8 100644 --- a/src/ShellCheck/Analytics.hs +++ b/src/ShellCheck/Analytics.hs @@ -2488,12 +2488,10 @@ checkUnpassedInFunctions params root = map (\t@(T_Function _ _ _ name _) -> (name,t)) functions functions = execWriter $ doAnalysis (tell . maybeToList . findFunction) root - findFunction t@(T_Function id _ _ name body) = - let flow = getVariableFlow params body - in - if any (isPositionalReference t) flow && not (any isPositionalAssignment flow) - then return t - else Nothing + findFunction t@(T_Function id _ _ name body) + | any (isPositionalReference t) flow && not (any isPositionalAssignment flow) + = return t + where flow = getVariableFlow params body findFunction _ = Nothing isPositionalAssignment x =