From 5647e5642a3706f4c1675086c5426ef3a78ea810 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sat, 4 Jul 2026 09:48:47 +0000 Subject: [PATCH] Fix CI: remove unused aliases, run mix format, install root yarn deps - Remove unused aliases that caused warnings-as-errors in EX_CHECK mode - Run mix format to fix formatter check - Add root-level yarn install to CI for prettier (used by mix check) - All 1007 tests pass, zero warnings --- .gitea/workflows/ci.yml | 1 + lib/pinchflat_web/api_auth_plug.ex | 3 +-- .../controllers/api/v1/api_media_item_controller.ex | 3 +-- .../controllers/api/v1/api_media_profile_controller.ex | 3 +-- .../controllers/api/v1/api_setting_controller.ex | 2 +- .../controllers/api/v1/api_source_controller.ex | 4 ++-- .../controllers/api/v1/api_task_controller.ex | 3 ++- .../controllers/api/v1/fallback_controller.ex | 2 +- test/pinchflat_web/api_auth_plug_test.exs | 2 +- .../controllers/api/v1/api_media_item_controller_test.exs | 2 +- .../api/v1/api_media_profile_controller_test.exs | 7 +++++-- .../controllers/api/v1/api_setting_controller_test.exs | 2 +- .../controllers/api/v1/api_source_controller_test.exs | 2 +- .../controllers/api/v1/api_task_controller_test.exs | 2 +- 14 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 9b1e746..42bf084 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: - name: Install deps run: | docker compose exec -T phx mix deps.get + docker compose exec -T phx yarn install docker compose exec -T phx sh -c "cd assets && yarn install" - name: Create and Migrate database diff --git a/lib/pinchflat_web/api_auth_plug.ex b/lib/pinchflat_web/api_auth_plug.ex index 6635a08..b3c552e 100644 --- a/lib/pinchflat_web/api_auth_plug.ex +++ b/lib/pinchflat_web/api_auth_plug.ex @@ -12,7 +12,6 @@ defmodule PinchflatWeb.ApiAuthPlug do """ import Plug.Conn - alias Pinchflat.Settings def init(opts), do: opts @@ -47,4 +46,4 @@ defmodule PinchflatWeb.ApiAuthPlug do |> send_resp(401, ~s({"errors":{"detail":"Unauthorized"}})) |> halt() end -end \ No newline at end of file +end diff --git a/lib/pinchflat_web/controllers/api/v1/api_media_item_controller.ex b/lib/pinchflat_web/controllers/api/v1/api_media_item_controller.ex index 0d8fa27..c4bf168 100644 --- a/lib/pinchflat_web/controllers/api/v1/api_media_item_controller.ex +++ b/lib/pinchflat_web/controllers/api/v1/api_media_item_controller.ex @@ -9,7 +9,6 @@ defmodule PinchflatWeb.Api.V1.ApiMediaItemController do alias Pinchflat.Repo alias Pinchflat.Media - alias Pinchflat.Media.MediaItem alias Pinchflat.Downloading.MediaDownloadWorker def index(conn, params) do @@ -94,4 +93,4 @@ defmodule PinchflatWeb.Api.V1.ApiMediaItemController do end) end) end -end \ No newline at end of file +end diff --git a/lib/pinchflat_web/controllers/api/v1/api_media_profile_controller.ex b/lib/pinchflat_web/controllers/api/v1/api_media_profile_controller.ex index cb8df72..859cd51 100644 --- a/lib/pinchflat_web/controllers/api/v1/api_media_profile_controller.ex +++ b/lib/pinchflat_web/controllers/api/v1/api_media_profile_controller.ex @@ -6,7 +6,6 @@ defmodule PinchflatWeb.Api.V1.ApiMediaProfileController do use PinchflatWeb, :controller alias Pinchflat.Profiles - alias Pinchflat.Profiles.MediaProfile def index(conn, _params) do json(conn, %{data: Profiles.list_media_profiles()}) @@ -65,4 +64,4 @@ defmodule PinchflatWeb.Api.V1.ApiMediaProfileController do end) end) end -end \ No newline at end of file +end diff --git a/lib/pinchflat_web/controllers/api/v1/api_setting_controller.ex b/lib/pinchflat_web/controllers/api/v1/api_setting_controller.ex index 6f433e1..b1f0b73 100644 --- a/lib/pinchflat_web/controllers/api/v1/api_setting_controller.ex +++ b/lib/pinchflat_web/controllers/api/v1/api_setting_controller.ex @@ -53,4 +53,4 @@ defmodule PinchflatWeb.Api.V1.ApiSettingController do end) end) end -end \ No newline at end of file +end diff --git a/lib/pinchflat_web/controllers/api/v1/api_source_controller.ex b/lib/pinchflat_web/controllers/api/v1/api_source_controller.ex index 26fed37..75e5d2c 100644 --- a/lib/pinchflat_web/controllers/api/v1/api_source_controller.ex +++ b/lib/pinchflat_web/controllers/api/v1/api_source_controller.ex @@ -9,7 +9,6 @@ defmodule PinchflatWeb.Api.V1.ApiSourceController do alias Pinchflat.Repo alias Pinchflat.Sources - alias Pinchflat.Sources.Source alias Pinchflat.Tasks alias Pinchflat.Downloading.DownloadingHelpers alias Pinchflat.SlowIndexing.SlowIndexingHelpers @@ -43,6 +42,7 @@ defmodule PinchflatWeb.Api.V1.ApiSourceController do case Sources.create_source(source_params) do {:ok, source} -> source = Repo.preload(source, :media_profile) + conn |> put_status(:created) |> json(%{data: source}) @@ -123,4 +123,4 @@ defmodule PinchflatWeb.Api.V1.ApiSourceController do end) end) end -end \ No newline at end of file +end diff --git a/lib/pinchflat_web/controllers/api/v1/api_task_controller.ex b/lib/pinchflat_web/controllers/api/v1/api_task_controller.ex index 7c9b1eb..cbbe20c 100644 --- a/lib/pinchflat_web/controllers/api/v1/api_task_controller.ex +++ b/lib/pinchflat_web/controllers/api/v1/api_task_controller.ex @@ -15,6 +15,7 @@ defmodule PinchflatWeb.Api.V1.ApiTaskController do case params do %{"source_id" => source_id} -> source = Pinchflat.Sources.get_source!(source_id) + Tasks.list_tasks_for(source) |> Repo.preload(:job) @@ -30,4 +31,4 @@ defmodule PinchflatWeb.Api.V1.ApiTaskController do task = Tasks.get_task!(id) |> Repo.preload(:job) json(conn, %{data: task}) end -end \ No newline at end of file +end diff --git a/lib/pinchflat_web/controllers/api/v1/fallback_controller.ex b/lib/pinchflat_web/controllers/api/v1/fallback_controller.ex index e8e5f41..bd47f49 100644 --- a/lib/pinchflat_web/controllers/api/v1/fallback_controller.ex +++ b/lib/pinchflat_web/controllers/api/v1/fallback_controller.ex @@ -15,4 +15,4 @@ defmodule PinchflatWeb.Api.V1.FallbackController do |> put_status(:not_found) |> json(%{errors: %{detail: "Not found"}}) end -end \ No newline at end of file +end diff --git a/test/pinchflat_web/api_auth_plug_test.exs b/test/pinchflat_web/api_auth_plug_test.exs index 536644c..4540a4f 100644 --- a/test/pinchflat_web/api_auth_plug_test.exs +++ b/test/pinchflat_web/api_auth_plug_test.exs @@ -62,4 +62,4 @@ defmodule PinchflatWeb.ApiAuthPlugTest do assert %{status: 200} = conn end end -end \ No newline at end of file +end diff --git a/test/pinchflat_web/controllers/api/v1/api_media_item_controller_test.exs b/test/pinchflat_web/controllers/api/v1/api_media_item_controller_test.exs index 0da1ec5..24bf0b7 100644 --- a/test/pinchflat_web/controllers/api/v1/api_media_item_controller_test.exs +++ b/test/pinchflat_web/controllers/api/v1/api_media_item_controller_test.exs @@ -77,4 +77,4 @@ defmodule PinchflatWeb.Api.V1.ApiMediaItemControllerTest do assert [_] = all_enqueued(worker: MediaDownloadWorker) end end -end \ No newline at end of file +end diff --git a/test/pinchflat_web/controllers/api/v1/api_media_profile_controller_test.exs b/test/pinchflat_web/controllers/api/v1/api_media_profile_controller_test.exs index e3448a5..e3d981d 100644 --- a/test/pinchflat_web/controllers/api/v1/api_media_profile_controller_test.exs +++ b/test/pinchflat_web/controllers/api/v1/api_media_profile_controller_test.exs @@ -28,7 +28,10 @@ defmodule PinchflatWeb.Api.V1.ApiMediaProfileControllerTest do describe "POST /api/v1/media_profiles" do test "creates a media profile and returns 201", %{conn: conn} do - conn = post(conn, ~p"/api/v1/media_profiles", media_profile: %{name: "Test Profile", output_path_template: "{{title}}.{{ext}}"}) + conn = + post(conn, ~p"/api/v1/media_profiles", + media_profile: %{name: "Test Profile", output_path_template: "{{title}}.{{ext}}"} + ) assert %{status: 201} = conn assert json_response(conn, 201)["data"]["name"] == "Test Profile" @@ -40,4 +43,4 @@ defmodule PinchflatWeb.Api.V1.ApiMediaProfileControllerTest do assert %{status: 422} = conn end end -end \ No newline at end of file +end diff --git a/test/pinchflat_web/controllers/api/v1/api_setting_controller_test.exs b/test/pinchflat_web/controllers/api/v1/api_setting_controller_test.exs index 851fb52..563e5d7 100644 --- a/test/pinchflat_web/controllers/api/v1/api_setting_controller_test.exs +++ b/test/pinchflat_web/controllers/api/v1/api_setting_controller_test.exs @@ -42,4 +42,4 @@ defmodule PinchflatWeb.Api.V1.ApiSettingControllerTest do assert data["environment"] != nil end end -end \ No newline at end of file +end diff --git a/test/pinchflat_web/controllers/api/v1/api_source_controller_test.exs b/test/pinchflat_web/controllers/api/v1/api_source_controller_test.exs index 11ccab4..d0f6c77 100644 --- a/test/pinchflat_web/controllers/api/v1/api_source_controller_test.exs +++ b/test/pinchflat_web/controllers/api/v1/api_source_controller_test.exs @@ -184,4 +184,4 @@ defmodule PinchflatWeb.Api.V1.ApiSourceControllerTest do playlist_title: "some playlist name" })} end -end \ No newline at end of file +end diff --git a/test/pinchflat_web/controllers/api/v1/api_task_controller_test.exs b/test/pinchflat_web/controllers/api/v1/api_task_controller_test.exs index 23d0ba5..e18e62d 100644 --- a/test/pinchflat_web/controllers/api/v1/api_task_controller_test.exs +++ b/test/pinchflat_web/controllers/api/v1/api_task_controller_test.exs @@ -45,4 +45,4 @@ defmodule PinchflatWeb.Api.V1.ApiTaskControllerTest do assert json_response(conn, 200)["data"]["id"] == task.id end end -end \ No newline at end of file +end