Skip to content
This repository has been archived by the owner on May 14, 2018. It is now read-only.

Commit

Permalink
Problem: credo warnings
Browse files Browse the repository at this point in the history
> Refactoring opportunities
>
> [F]  Cond statements should contain at least two conditions besides `true`.
>      lib/quantum.ex:33:5 (Quantum.add_job)
>
> Consistency
>
> [C]  There is no whitespace around parentheses/brackets most of the time, but here there is.
>      lib/quantum/normalizer.ex:30 (Quantum.Normalizer.normalize_job)

Solution: fix them
  • Loading branch information
c-rack committed Feb 21, 2016
1 parent 210e0c7 commit 0c7d4e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/quantum.ex
Expand Up @@ -30,9 +30,10 @@ defmodule Quantum do
@spec add_job(expr, job) :: :ok | :error
def add_job(expr, job) do
{name, job} = Normalizer.normalize({expr, job})
cond do
name && find_job(name) -> :error
true -> GenServer.call(Quantum, {:add, {name, job}})
if name && find_job(name) do
:error
else
GenServer.call(Quantum, {:add, {name, job}})
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/quantum/normalizer.ex
Expand Up @@ -27,7 +27,7 @@ defmodule Quantum.Normalizer do
# }
defp normalize_job({job_name, %Quantum.Job{} = job}) do
# Sets defauts for job if necessary
job_name |> job_opts([]) |> Map.merge(%{job | name: job_name })
job_name |> job_opts([]) |> Map.merge(%{job | name: job_name})
end

defp normalize_job({job_name, opts}) when opts |> is_list or opts |> is_map do
Expand Down

0 comments on commit 0c7d4e0

Please sign in to comment.