Skip to content

Commit

Permalink
Stop using head in isLeadingNumberVar
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Oct 16, 2023
1 parent 8b3c37a commit 4fd0615
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ShellCheck/Analytics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4fd0615

Please sign in to comment.