Skip to content

Commit

Permalink
Solution: Cleanup (#354)
Browse files Browse the repository at this point in the history
* Solution: Fix Run Strategy Random

* Make Tests Elixir 1.5 compatible

* Remove unsupported local timezone

* Ingore Dialyzer Warnings
  • Loading branch information
maennchen authored and c-rack committed Aug 12, 2018
1 parent 6dfd157 commit 88b14c0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
12 changes: 12 additions & 0 deletions dialyzer.ignore-warnings
Expand Up @@ -10,3 +10,15 @@ Unknown function 'Elixir.Quantum.RunStrategy.NodeList.Port':'__impl__'/1
Unknown function 'Elixir.Quantum.RunStrategy.NodeList.Reference':'__impl__'/1
Unknown function 'Elixir.Quantum.RunStrategy.NodeList.Tuple':'__impl__'/1
Overloaded contract for 'Elixir.Quantum.DateLibrary':'to_utc!'/2 has overlapping domains; such contracts are currently unsupported and are simply ignored
lib/quantum/execution_broadcaster.ex:201: The inferred return type of handle_call/3 ({'reply',{'resume',{_,_}},#{'jobs':=_, 'last_execution_date':=_, _=>_}}) has nothing in common with {'noreply',[any()],_} | {'stop',_,_} | {'noreply',[any()],_,'hibernate'} | {'reply',_,[any()],_} | {'stop',_,_,_} | {'reply',_,[any()],_,'hibernate'}, which is the expected return type for the callback of the 'Elixir.GenStage' behaviour
lib/quantum/execution_broadcaster.ex:213: The inferred return type of handle_cast/2 ({'noreply',_}) has nothing in common with {'noreply',[any()],_} | {'stop',_,_} | {'noreply',[any()],_,'hibernate'}, which is the expected return type for the callback of the 'Elixir.GenStage' behaviour
lib/quantum/execution_broadcaster.ex:266: The pattern {'ok', Vdate@1} can never match the type {'error',<<_:368>>}
lib/quantum/execution_broadcaster.ex:295: The pattern {'ok', Vdate@1} can never match the type {'error',<<_:368>>}
lib/quantum/execution_broadcaster.ex:319: Function add_to_state/3 will never be called
lib/quantum/execution_broadcaster.ex:327: Function add_job_at_date/3 will never be called
lib/quantum/execution_broadcaster.ex:334: Function find_date_and_put_job/3 will never be called
lib/quantum/executor.ex:23: Overloaded contract for 'Elixir.Quantum.Executor':start_link/2 has overlapping domains; such contracts are currently unsupported and are simply ignored
lib/quantum/util.ex:22: Function 'gen_stage_v12?'/0 has no local return
lib/quantum/util.ex:31: The call 'Elixir.Version':'match?'(binary(),<<_:64>>) will never return since it differs in the 1st argument from the success typing arguments: (#{'__struct__':='Elixir.Version', 'build':='nil' | binary(), 'major':=binary() | non_neg_integer(), 'minor':='nil' | non_neg_integer(), 'patch':='nil' | non_neg_integer(), 'pre':=[binary() | non_neg_integer()]},binary() | #{'__struct__':='Elixir.Version.Requirement', 'compiled':=boolean(), 'matchspec':=[{atom() | tuple(),[any()],[any()]}] | ets:comp_match_spec(), 'source':=_})
lib/quantum/execution_broadcaster.ex:201: The inferred return type of handle_call/3 ({'reply',{'resume',{_,_}},#{'jobs':=_, 'last_execution_date':=_, _=>_}}) has nothing in common with {'noreply',[any()],_} | {'stop',_,_} | {'noreply',[any()],_,'hibernate'} | {'reply',_,[any()],_} | {'stop',_,_,_} | {'reply',_,[any()],_,'hibernate'}, which is the expected return type for the callback of 'Elixir.GenStage' behaviour
lib/quantum/execution_broadcaster.ex:213: The inferred return type of handle_cast/2 ({'noreply',_}) has nothing in common with {'noreply',[any()],_} | {'stop',_,_} | {'noreply',[any()],_,'hibernate'}, which is the expected return type for the callback of 'Elixir.GenStage' behaviour
4 changes: 2 additions & 2 deletions lib/quantum/job.ex
Expand Up @@ -28,7 +28,7 @@ defmodule Quantum.Job do
@type name :: atom | reference()
@type state :: :active | :inactive
@type task :: {atom, atom, [any]} | (() -> any)
@type timezone :: :utc | :local | String.t()
@type timezone :: :utc | String.t()
@type schedule :: Crontab.CronExpression.t()

@type t :: %__MODULE__{
Expand Down Expand Up @@ -212,6 +212,6 @@ defmodule Quantum.Job do
"Europe/Zurich"
"""
@spec set_timezone(t, String.t() | :utc | :local) :: t
@spec set_timezone(t, String.t() | :utc) :: t
def set_timezone(%__MODULE__{} = job, timezone), do: Map.put(job, :timezone, timezone)
end
3 changes: 1 addition & 2 deletions lib/quantum/normalizer.ex
Expand Up @@ -119,9 +119,8 @@ defmodule Quantum.Normalizer do
strategy.normalize_config!(options)
end

@spec normalize_timezone(String.t() | :utc | :local) :: String.t() | :utc | :local
@spec normalize_timezone(String.t() | :utc) :: String.t() | :utc
defp normalize_timezone(timezone) when is_binary(timezone), do: timezone
defp normalize_timezone(:utc), do: :utc
defp normalize_timezone(:local), do: :local
defp normalize_timezone(timezone), do: raise("Invalid timezone: #{inspect(timezone)}")
end
6 changes: 3 additions & 3 deletions test/quantum/cluster_task_supervisor_registry_test.exs
Expand Up @@ -6,10 +6,10 @@ defmodule Quantum.ClusterTaskSupervisorRegistryTest do
alias Quantum.ClusterTaskSupervisorRegistry

test "should register name", %{test: test} do
task_supervisor_pid = start_supervised!({Task.Supervisor, name: test})
{:ok, task_supervisor_pid} = start_supervised({Task.Supervisor, name: test})

registry_pid =
start_supervised!(
{:ok, registry_pid} =
start_supervised(
{ClusterTaskSupervisorRegistry,
name: Module.concat([__MODULE__, test, Registry]),
task_supervisor: test,
Expand Down

0 comments on commit 88b14c0

Please sign in to comment.