Hello! I'd like to contribute to the imap client (looking forward to implement the append command), but I'd love to document some of the internals first.
This pr introduces dialyzer/dialyxir and some typespecs to imap** modules.
At this point mix dialyzer points out some issues:
lib/mailroom/imap.ex:124:pattern_match
The pattern can never match the type.
Pattern:
{:error, _reason}
Type:
{:ok, binary()}
it complains about this pattern, because of the login spec, I'm not sure if currently GenServer.call(pid, {:login, username, password}) can actually reply with an {:error, binary}, but I'm not super sure about that.
lib/mailroom/imap.ex:309:guard_fail
The guard clause:
when _ :: :ok === nil
can never succeed.
that's because the GenServer.cast at line 309 should always return :ok, so I think it complains the && isn't helpful
lib/mailroom/imap/utils.ex:102:pattern_match
The pattern can never match the type.
Pattern:
{nil, _rest}, false, _acc
Type:
nil | {binary(), binary()}, boolean(), [binary()]
Hello! I'd like to contribute to the imap client (looking forward to implement the
append
command), but I'd love to document some of the internals first.This pr introduces dialyzer/dialyxir and some typespecs to
imap**
modules. At this pointmix dialyzer
points out some issues:it complains about this pattern, because of the login spec, I'm not sure if currently
GenServer.call(pid, {:login, username, password})
can actually reply with an{:error, binary}
, but I'm not super sure about that.that's because the
GenServer.cast
at line 309 should always return:ok
, so I think it complains the&&
isn't helpfulit looks like do_parse_string({nil, rest}, false, acc) can never match because
String.next_grapheme("") == nil
, I believe this one could be fixed by just matchingnil
I'd like to address these issues in other pull requests, in this way we keep only typespecs and non-functional code in this one.
Let me know if looks good, cheers!