From 71889c139aac3ce3597349878c746c774b329882 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Sun, 31 Dec 2023 16:44:21 -0500 Subject: [PATCH] Use a case expression instead of any and take 1 --- src/ShellCheck/Analytics.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs index ae29762f5..ca679bb1d 100644 --- a/src/ShellCheck/Analytics.hs +++ b/src/ShellCheck/Analytics.hs @@ -2756,10 +2756,10 @@ checkLoopKeywordScope params t | Just str:_ -> warn (getId t) 2106 $ "This only exits the subshell caused by the " ++ str ++ "." _ -> return () - else if any isFunction $ take 1 path + else case path of -- breaking at a source/function invocation is an abomination. Let's ignore it. - then err (getId t) 2104 $ "In functions, use return instead of " ++ name ++ "." - else err (getId t) 2105 $ name ++ " is only valid in loops." + h:_ | isFunction h -> err (getId t) 2104 $ "In functions, use return instead of " ++ name ++ "." + _ -> err (getId t) 2105 $ name ++ " is only valid in loops." where path = let p = getPath (parentMap params) t in NE.filter relevant p subshellType t = case leadType params t of