some fixes from dialyzer output

This commit is contained in:
Ramon Snir
2015-04-13 19:15:49 +03:00
committed by Carlos Martín Nieto
parent f943274ad8
commit b2af788af0
6 changed files with 15 additions and 9 deletions

View File

@@ -8,8 +8,8 @@ defmodule Geef.Pkt do
def parse_request(str) do
case :geef_pkt.parse_request(str) do
{:ok, req} ->
{:ok, Geef.Request.new req}
{:ok, {:geef_request, service, path, host}} ->
{:ok, %Geef.Request{service: service, path: path, host: host}}
error ->
error
end

View File

@@ -71,13 +71,13 @@ defimpl Enumerable, for: Geef.Tree do
alias Geef.TreeError
def count(tree) do
Tree.count(tree)
{:ok, Tree.count(tree)}
end
def member?(tree, key) do
case Tree.get(tree, key) do
{:ok, _} -> true
_ -> false
{:ok, _} -> {:ok, true}
_ -> {:ok, false}
end
end

View File

@@ -113,7 +113,8 @@ defmodule Geef.Mixfile do
[ app: :geef,
version: "0.0.1",
compilers: [:nif, :erlang, :elixir, :app],
deps: deps ]
deps: deps,
dialyzer: dialyzer ]
end
def nif do
@@ -131,4 +132,10 @@ defmodule Geef.Mixfile do
defp deps do
[]
end
def dialyzer do
[ plt_apps: [:erts, :kernel, :stdlib, :mnesia],
flags: ["-Wunmatched_returns","-Werror_handling","-Wrace_conditions", "-Wno_opaque"]]
end
end

View File

@@ -115,7 +115,7 @@ commit_tree(_Handle) ->
commit_create(_RepoHandle, _Ref, _Author, _Committer, _Encoding, _Message, _Tree, _Parents) ->
?NIF_FN.
-spec commit_message(term) -> binary().
-spec commit_message(term) -> {ok, binary()} | {error, term()}.
commit_message(_CommitHandle) ->
?NIF_FN.

View File

@@ -2,7 +2,6 @@ defmodule IndexTest do
use ExUnit.Case
use Geef
alias Geef.Index
alias Geef.Index.Entry
import RepoHelpers