From 4fd0615501b6909c8ca61ef080bb07b8e8de1301 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Mon, 16 Oct 2023 00:55:04 -0400 Subject: [PATCH] Stop using head in isLeadingNumberVar --- src/ShellCheck/Analytics.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs index 3cebb24..5f77f77 100644 --- a/src/ShellCheck/Analytics.hs +++ b/src/ShellCheck/Analytics.hs @@ -4378,9 +4378,8 @@ checkEqualsInCommand params originalToken = return $ isVariableName str isLeadingNumberVar s = - let lead = takeWhile (/= '=') s - in not (null lead) && isDigit (head lead) - && all isVariableChar lead && not (all isDigit lead) + case takeWhile (/= '=') s of + lead@(x:_) -> isDigit x && all isVariableChar lead && not (all isDigit lead) msg cmd leading (T_Literal litId s) = do -- There are many different cases, and the order of the branches matter.