You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run into an issue with Dialyzer when using the option escape_max_lines because the spec doesn't define it as an option, even though the error mention it as one.
** (CSV.EscapeSequenceError) Escape sequence started on line 145:
"... a lot of text here ..."
did not terminate. You can use normal mode to continue parsing rows even if single rows have errors.
Escape sequences are allowed to span up to 10 lines. This threshold avoids collecting the whole file into memory when an escape sequence does not terminate.
You can change it using the escape_max_lines option: https://hexdocs.pm/csv/CSV.html#decode/2
(csv 3.0.3) lib/csv.ex:256: CSV.yield_or_raise!/2
Using escape_max_lines as the error mentions causes Dialyzer to throw the error
path/to/file:no_return Function function_name/1 has no local return.
Writing a function like the following and running Dialyzer
def my_fun(stream) do
CSV.decode!(stream, escape_max_lines: 11)
end
The option can be tested like
test "raises error for escape sequences spanning more than 10 lines" do
stream = ["\"a\na\na\na\na\na\na\na\na\na\na\na\n"] |> to_stream
assert_raise CSV.EscapeSequenceError, fn ->
CSV.decode!(stream) |> Stream.run()
end
result = CSV.decode!(stream, escape_max_lines: 11) |> Enum.to_list()
assert [["a\na\na\na\na\na\na\na\na\na\na\n"]] == result
end
I can open a PR to add the missing option to the spec and docs if needed
The text was updated successfully, but these errors were encountered:
Hi, thank you for this awesome library!
I run into an issue with Dialyzer when using the option
escape_max_lines
because thespec
doesn't define it as an option, even though the error mention it as one.Using
escape_max_lines
as the error mentions causes Dialyzer to throw the errormissing in the spec here
If this is a bug, steps to reproduce it
Writing a function like the following and running Dialyzer
The option can be tested like
I can open a PR to add the missing option to the spec and docs if needed
The text was updated successfully, but these errors were encountered: