fix: resolve all dialyzer warnings — unmatched returns, pattern mismatches, and Mix.Task PLT entries
Some checks failed
Elixir CI / Build and test (push) Successful in 1m33s
Elixir CI / Dialyzer (push) Has been cancelled
Elixir CI / Build and Push Docker Image (push) Has been cancelled

This commit is contained in:
Graham McIntire 2026-07-27 14:18:42 -05:00
parent 20c3eab1c1
commit a9827f245e
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
5 changed files with 22 additions and 13 deletions

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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