Skip to content

Commit

Permalink
Support elixir 1.13 tokenizer results
Browse files Browse the repository at this point in the history
  • Loading branch information
v0idpwn committed Nov 2, 2021
1 parent 10b8c1f commit b449265
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/credo/code.ex
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ defmodule Credo.Code do
end

def to_tokens(source, filename \\ "nofilename") when is_binary(source) do
result =
source
|> String.to_charlist()
|> :elixir_tokenizer.tokenize(1, file: filename)

case result do
source
|> String.to_charlist()
|> :elixir_tokenizer.tokenize(1, file: filename)
|> case do
# Elixir < 1.6
{_, _, _, tokens} ->
tokens
Expand All @@ -143,7 +141,7 @@ defmodule Credo.Code do
tokens

# Elixir >= 1.13
{:ok, _, tokens} ->
{:ok, _, _, _, tokens} ->
tokens
end
end
Expand Down

0 comments on commit b449265

Please sign in to comment.