diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs index 2b7ca26..04b4a32 100644 --- a/.dialyzer_ignore.exs +++ b/.dialyzer_ignore.exs @@ -37,6 +37,7 @@ # in the dialyzer PLT; also the aprs library's return type is inferred incorrectly from # the compiled beam without full type specs {"lib/mix/tasks/aprs.parse_file.ex"}, + {"lib/mix/tasks/aprsme.user_role.ex"}, # Mix.Task.Compiler PLT limitations: same root cause — Mix.* functions and the # Mix.Task.Compiler.Diagnostic struct aren't in the dialyzer PLT. diff --git a/lib/aprsme/deployment_notifier.ex b/lib/aprsme/deployment_notifier.ex index 8af4daf..fa215c2 100644 --- a/lib/aprsme/deployment_notifier.ex +++ b/lib/aprsme/deployment_notifier.ex @@ -14,9 +14,9 @@ defmodule Aprsme.DeploymentNotifier do @impl true def init(_opts) do - if System.get_env("DEPLOYED_AT"), - do: :ok = Process.send_after(self(), :notify_deployment, 10_000), - else: :ok + _ = + if System.get_env("DEPLOYED_AT"), + do: Process.send_after(self(), :notify_deployment, 10_000) {:ok, %{}} end diff --git a/lib/aprsme_web/live/map_live/subscriptions.ex b/lib/aprsme_web/live/map_live/subscriptions.ex index e64ee08..9c0aa16 100644 --- a/lib/aprsme_web/live/map_live/subscriptions.ex +++ b/lib/aprsme_web/live/map_live/subscriptions.ex @@ -25,7 +25,7 @@ defmodule AprsmeWeb.MapLive.Subscriptions do def teardown(socket) do _teardown_connection_monitor(socket) _teardown_spatial(socket) - _teardown_all_timers(socket) + _ = _teardown_all_timers(socket) _teardown_batch_tasks(socket) :ok end @@ -100,9 +100,9 @@ defmodule AprsmeWeb.MapLive.Subscriptions do end defp _teardown_all_timers(socket) do - cancel_if_exists(socket.assigns[:buffer_timer]) - cancel_if_exists(socket.assigns[:bounds_update_timer]) - cancel_if_exists(socket.assigns[:hover_end_timer]) + _ = cancel_if_exists(socket.assigns[:buffer_timer]) + _ = cancel_if_exists(socket.assigns[:bounds_update_timer]) + _ = cancel_if_exists(socket.assigns[:hover_end_timer]) end defp cancel_if_exists(nil), do: :ok diff --git a/lib/aprsme_web/live/status_live/index.ex b/lib/aprsme_web/live/status_live/index.ex index af3a5fd..3cae915 100644 --- a/lib/aprsme_web/live/status_live/index.ex +++ b/lib/aprsme_web/live/status_live/index.ex @@ -422,7 +422,7 @@ defmodule AprsmeWeb.StatusLive.Index do _ -> # Fallback to direct query if cache miss status = get_aprs_status() - Aprsme.Cache.put(:query_cache, "aprs_status", status, ttl: Aprsme.Cache.to_timeout(second: 10)) + _ = Aprsme.Cache.put(:query_cache, "aprs_status", status, ttl: Aprsme.Cache.to_timeout(second: 10)) status end end diff --git a/lib/mix/tasks/aprsme.user_role.ex b/lib/mix/tasks/aprsme.user_role.ex index 19ad7ed..2aa64bc 100644 --- a/lib/mix/tasks/aprsme.user_role.ex +++ b/lib/mix/tasks/aprsme.user_role.ex @@ -11,21 +11,29 @@ defmodule Mix.Tasks.Aprsme.UserRole do @impl Mix.Task def run([email, role_name]) when role_name in ["user", "admin"] do - Mix.Task.run("app.start") + _ = Application.ensure_all_started(:aprsme) case Aprsme.Accounts.get_user_by_email(email) do nil -> - Mix.raise("No user found with email #{email}") + IO.puts(:stderr, "Error: No user found with email #{email}") + System.halt(1) user -> role = String.to_existing_atom(role_name) case Aprsme.Accounts.set_user_role(user, role) do - {:ok, _user} -> Mix.shell().info("Set #{email} role to #{role_name}") - {:error, changeset} -> Mix.raise("Could not update role: #{inspect(changeset.errors)}") + {:ok, _user} -> + IO.puts("Set #{email} role to #{role_name}") + + {:error, changeset} -> + IO.puts(:stderr, "Error: Could not update role: #{inspect(changeset.errors)}") + System.halt(1) end end end - def run(_args), do: Mix.raise("Usage: mix aprsme.user_role EMAIL user|admin") + def run(_args) do + IO.puts(:stderr, "Usage: mix aprsme.user_role EMAIL user|admin") + System.halt(1) + end end