Skip to content

Commit 0be521c

Browse files
committed
fix: resolve all compile warnings and FunctionClauseError
Found by running `mix test --warnings-as-errors`: * watcher.ex:169 — FunctionClauseError accessing id on a tuple because render_timeline_diff passed the full JSON response (%{"records": [...]}) to new_records/2 instead of extracting the records list. Fixed with %{"records" => records} pattern. * watcher_test.exs — unused build_id, log_id → _build_id, _log_id * pull_requests_test.exs — 8 tests with unused server binding → _server * teams_test.exs — unused alias Teams → removed * releases_test.exs — unused alias Releases → removed * whoami_test.exs — unused alias Whoami → removed * schema_test.exs — unused import CliMate.CLI → removed * output_test.exs — unused import CliMate.CLI → removed * pull_requests_test.exs — unused alias PullRequests → removed 317 tests pass, 0 warnings, mix ci 8/8 green.
1 parent b9b0fe5 commit 0be521c

8 files changed

Lines changed: 11 additions & 17 deletions

File tree

lib/ado_cli/ci/watcher.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ defmodule AdoCli.CI.Watcher do
152152
# Each record represents a job, task, or phase in the pipeline.
153153
defp render_timeline_diff(state, print) do
154154
case fetch_timeline(state.build_id, state.project, state.org) do
155-
{:ok, records} ->
155+
{:ok, %{"records" => records}} ->
156156
Enum.each(new_records(state.last_timeline, records), fn rec ->
157157
print_record(rec, print)
158158
end)

test/ado_cli/ci/watcher_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ defmodule AdoCli.CI.WatcherTest do
124124
# integration test in the docs.
125125
defp run_with_mocked_log(opts) do
126126
parent = self()
127-
log_id = opts[:log_id]
128-
build_id = opts[:build_id]
127+
_log_id = opts[:log_id]
128+
_build_id = opts[:build_id]
129129
lines = opts[:lines]
130130
body = Enum.join(lines, "\n") <> "\n"
131131

test/ado_cli/cli/output_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ defmodule AdoCli.CLI.OutputTest do
22
use ExUnit.Case, async: false
33

44
import ExUnit.CaptureIO
5-
import CliMate.CLI
65
alias AdoCli.CLI.Output
76

87
setup do

test/ado_cli/cli/pull_requests_test.exs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
defmodule AdoCli.CLI.PullRequestsTest do
22
use AdoCli.CLI.TestHelper
33
import ExUnit.CaptureIO
4-
alias AdoCli.CLI.PullRequests
54

65
describe "list_prs" do
76
test "halts 0 on successful get", %{server: server} do
@@ -171,7 +170,7 @@ defmodule AdoCli.CLI.PullRequestsTest do
171170
)
172171
end
173172

174-
test "halts 1 on API error", %{server: server} do
173+
test "halts 1 on API error", %{server: _server} do
175174
# complete_pr uses PATCH, not GET. The generic expect_api_error
176175
# helper mocks GET so this test was incorrectly written. Skipping
177176
# for now — the success path above exercises the code.
@@ -414,7 +413,7 @@ defmodule AdoCli.CLI.PullRequestsTest do
414413
assert msg =~ "No change matches --file 'src/does_not_exist.ex'"
415414
end
416415

417-
test "halts 1 with --file and --unified set together", %{server: server} do
416+
test "halts 1 with --file and --unified set together", %{server: _server} do
418417
capture_io(fn ->
419418
apply(AdoCli.CLI.PullRequests, :diff_pr, [
420419
%{
@@ -686,7 +685,7 @@ defmodule AdoCli.CLI.PullRequestsTest do
686685
)
687686
end
688687

689-
test "halts 1 with a clear error on invalid --status", %{server: server} do
688+
test "halts 1 with a clear error on invalid --status", %{server: _server} do
690689
# No expectation registered: the function must halt BEFORE
691690
# the HTTP call. If the function ever hits the network,
692691
# the test fails with "no expectation matched".
@@ -796,7 +795,7 @@ defmodule AdoCli.CLI.PullRequestsTest do
796795
end
797796

798797
test "halts 1 with a clear error when --content @<missing-file> cannot be read",
799-
%{server: server} do
798+
%{server: _server} do
800799
missing = "/tmp/ado-missing-#{System.unique_integer([:positive])}.md"
801800

802801
capture_io(fn ->
@@ -1010,7 +1009,7 @@ defmodule AdoCli.CLI.PullRequestsTest do
10101009
# ── update_comment (prs comments update) ─────────────────────────
10111010

10121011
describe "update_comment (prs comments update)" do
1013-
test "halts 1 when neither --content nor --status is given", %{server: server} do
1012+
test "halts 1 when neither --content nor --status is given", %{server: _server} do
10141013
capture_io(fn ->
10151014
apply(AdoCli.CLI.PullRequests, :update_comment, [
10161015
%{
@@ -1115,7 +1114,7 @@ defmodule AdoCli.CLI.PullRequestsTest do
11151114
assert_receive {:cli_mate_shell, :halt, 0}, 500
11161115
end
11171116

1118-
test "halts 1 with a clear error on invalid --status", %{server: server} do
1117+
test "halts 1 with a clear error on invalid --status", %{server: _server} do
11191118
capture_io(fn ->
11201119
apply(AdoCli.CLI.PullRequests, :update_comment, [
11211120
%{
@@ -1199,7 +1198,7 @@ defmodule AdoCli.CLI.PullRequestsTest do
11991198
end
12001199

12011200
test "--dry-run with --content prints the would-be PATCH and halts 0 (no API call)",
1202-
%{server: server} do
1201+
%{server: _server} do
12031202
output =
12041203
capture_io(fn ->
12051204
apply(AdoCli.CLI.PullRequests, :update_comment, [
@@ -1232,7 +1231,7 @@ defmodule AdoCli.CLI.PullRequestsTest do
12321231
assert action["body"] == %{"content" => "new text"}
12331232
end
12341233

1235-
test "--dry-run with --status prints the would-be thread PATCH", %{server: server} do
1234+
test "--dry-run with --status prints the would-be thread PATCH", %{server: _server} do
12361235
output =
12371236
capture_io(fn ->
12381237
apply(AdoCli.CLI.PullRequests, :update_comment, [

test/ado_cli/cli/releases_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
defmodule AdoCli.CLI.ReleasesTest do
22
use AdoCli.CLI.TestHelper
3-
alias AdoCli.CLI.Releases
43

54
describe "list_releases" do
65
test "halts 0 on successful get", %{server: server} do

test/ado_cli/cli/schema_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ defmodule AdoCli.CLI.SchemaTest do
22
use ExUnit.Case, async: false
33
import ExUnit.CaptureIO
44

5-
import CliMate.CLI
65
alias AdoCli.CLI.Schema
76

87
describe "build_tree/0" do

test/ado_cli/cli/teams_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
defmodule AdoCli.CLI.TeamsTest do
22
use AdoCli.CLI.TestHelper
3-
alias AdoCli.CLI.Teams
43

54
describe "list_teams" do
65
test "halts 0 on successful get", %{server: server} do

test/ado_cli/cli/whoami_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
defmodule AdoCli.CLI.WhoamiTest do
22
use AdoCli.CLI.TestHelper
3-
alias AdoCli.CLI.Whoami
43

54
describe "run" do
65
test "halts 0 on success" do

0 commit comments

Comments
 (0)