Dead clauses the type checker proves unreachable go

bb0fa26 · Gabe Morell · 2026-11-04 21:45

18 files +13 -15
Message
{commit_body(@commit)}

Files changed

modified lib/git_gud/reports.ex
+0 −1
@@ -479,7 +479,6 @@ defmodule GitGud.Reports do
479 479 defp user_name(nil), do: "(deleted user)"
480 480 defp user_name(%{email: e}), do: e |> String.split("@") |> hd()
481 481
482 − defp actor_name(nil), do: "(unknown)"
483 482 defp actor_name(%{preferred_username: u}) when is_binary(u) and u != "", do: u
484 483 defp actor_name(%{name: n}) when is_binary(n) and n != "", do: n
485 484 defp actor_name(_), do: "(unknown)"
modified lib/git_gud/ssh/channel.ex
+10 −3
@@ -224,19 +224,26 @@ defmodule GitGud.Ssh.Channel do
224 224 defp reader?(%{id: uid}, %Repository{owner_id: uid}), do: true
225 225
226 226 defp reader?(%{id: uid}, %Repository{organization_id: oid}) when not is_nil(oid),
227 − do: GitGud.Organizations.org_admin?(%GitGud.Organizations.Organization{id: oid}, %GitGud.Accounts.User{id: uid})
227 + do:
228 + GitGud.Organizations.org_admin?(
229 + %GitGud.Organizations.Organization{id: oid},
230 + %GitGud.Accounts.User{id: uid}
231 + )
228 232
229 233 defp reader?(_, _), do: false
230 234
231 235 defp writer?(%{id: uid}, %Repository{owner_id: uid}), do: true
232 236
233 237 defp writer?(%{id: uid}, %Repository{organization_id: oid}) when not is_nil(oid),
234 − do: GitGud.Organizations.org_admin?(%GitGud.Organizations.Organization{id: oid}, %GitGud.Accounts.User{id: uid})
238 + do:
239 + GitGud.Organizations.org_admin?(
240 + %GitGud.Organizations.Organization{id: oid},
241 + %GitGud.Accounts.User{id: uid}
242 + )
235 243
236 244 defp writer?(_, _), do: false
237 245
238 246 defp format_deny({:error, reason}), do: to_string(reason)
239 − defp format_deny(other), do: inspect(other)
240 247
241 248 defp deny(state, cm, ch, want_reply, reason) do
242 249 if want_reply, do: :ssh_connection.reply_request(cm, want_reply, :failure, ch)
modified lib/git_gud/workflows/runners.ex
+0 −2
@@ -50,8 +50,6 @@ defmodule GitGud.Workflows.Runners do
50 50 end
51 51 end
52 52
53 − defp global_token_valid?(_), do: false
54 −
55 53 @doc """
56 54 Redeem a registration token: resolve it to its scope and, for a
57 55 repository's or organization's token, use it up. Returns:
modified lib/git_gud_web/components/layouts.ex
+3 −3
@@ -59,8 +59,8 @@ defmodule GitGudWeb.Layouts do
59 59 </li>
60 60
61 61 <%!-- Facets: instance-wide ways to browse. Public, like the
62 − pages behind it. Hidden entirely when nothing is on. --%>
63 − <li :if={facets() != []}>
62 + pages behind it. Tags is always on, so it always shows. --%>
63 + <li>
64 64 <div class="dropdown dropdown-end">
65 65 <div
66 66 tabindex="0"
@@ -239,7 +239,7 @@ defmodule GitGudWeb.Layouts do
239 239 defp user_label(_), do: "Account"
240 240
241 241 # Instance-wide browse facets, as {label, path, icon}. Add future ones
242 − # here; the dropdown hides itself when the list comes back empty.
242 + # here; Tags is always one, so the dropdown always shows.
243 243 defp facets do
244 244 syms =
245 245 if GitGud.Syms.enabled?(),
modified lib/git_gud_web/controllers/runner_controller.ex
+0 −1
@@ -711,7 +711,6 @@ defmodule GitGudWeb.RunnerController do
711 711 case Protobuf.JSON.from_decoded(params, msg_module) do
712 712 {:ok, _msg} = ok -> ok
713 713 {:error, e} -> {:error, {:json_decode, inspect(e)}}
714 − msg -> {:ok, msg}
715 714 end
716 715 rescue
717 716 e -> {:error, {:json_decode, Exception.message(e)}}
modified lib/git_gud_web/live/ci_components.ex
+0 −1
@@ -294,7 +294,6 @@ defmodule GitGudWeb.CiComponents do
294 294 defp format_dt(%DateTime{} = dt), do: Calendar.strftime(dt, "%Y-%m-%d %H:%M")
295 295 defp format_dt(_), do: ""
296 296
297 − defp duration(nil, _), do: ""
298 297 defp duration(start, nil), do: "for #{secs(DateTime.diff(DateTime.utc_now(), start))}"
299 298 defp duration(start, %DateTime{} = finish), do: "in #{secs(DateTime.diff(finish, start))}"
300 299
modified lib/git_gud_web/live/workflow_live/show.ex
+0 −2
@@ -460,8 +460,6 @@ defmodule GitGudWeb.WorkflowLive.Show do
460 460
461 461 # `now` is the ticking @now assign so LiveView re-evaluates the elapsed
462 462 # counter each second while a job/step is still running.
463 − defp duration(nil, _finish, _now), do: ""
464 −
465 463 defp duration(start, nil, now),
466 464 do: "for #{seconds_to_human(DateTime.diff(now, start))}"
467 465
modified lib/git_gud_web/plugs/ap_dispatcher.ex
+0 −2
@@ -88,8 +88,6 @@ defmodule GitGudWeb.Plugs.ApDispatcher do
88 88 end
89 89 end
90 90
91 − defp dispatch_post(conn), do: conn
92 −
93 91 # ── invocation ──────────────────────────────────────────────────────
94 92
95 93 defp call_action(conn, action, params) do

Parents: a646eda