Setup Dialyxir and Credo code analyzers:

- Refactor codebase according to analyzers
This commit is contained in:
mitchell 2019-12-30 21:50:39 -05:00
parent 593f29d271
commit b699e661e2
15 changed files with 74 additions and 44 deletions

View file

@ -1,4 +1,8 @@
defmodule Shortnr.URL.Repo.ETS do
@moduledoc """
This module is an implemention of the Repo behaviour using the Erlang ETS library.
"""
@behaviour Shortnr.URL.Repo
@impl true
@ -16,7 +20,7 @@ defmodule Shortnr.URL.Repo.ETS do
end
@impl true
def list() do
def list do
resp = ets().select(:urls, [{:"$1", [], [:"$1"]}])
{:ok, resp |> Enum.map(&elem(&1, 1))}
end

View file

@ -1,6 +1,11 @@
defmodule Shortnr.URL.Repo do
alias Shortnr.URL
@moduledoc """
This module defines the Repo behaviour for the URL service. All Repos must implement this
entire behaviour.
"""
alias Shortnr.Transport
alias Shortnr.URL
@callback put(URL.t()) :: :ok | Transport.error()
@callback get(String.t()) :: {:ok, URL.t()} | Transport.error()