diff --git a/config/runtime.exs b/config/runtime.exs index 2bc57bc5..e371c6de 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -264,7 +264,7 @@ config :logger, case config_env() do :prod -> "info" :dev -> "info" - :test -> "debug" + :test -> "warning" end ) ) diff --git a/lib/wanderer_app/cache.ex b/lib/wanderer_app/cache.ex index 27bf8e78..6fe017fa 100644 --- a/lib/wanderer_app/cache.ex +++ b/lib/wanderer_app/cache.ex @@ -45,7 +45,7 @@ defmodule WandererApp.Cache do def insert({id, key}, value, opts) when is_binary(id) and (is_binary(key) or is_atom(key)), do: insert("#{id}:#{key}", value, opts) - def insert(key, nil, opts) when is_binary(key) or is_atom(key), do: delete(key) + def insert(key, nil, _opts) when is_binary(key) or is_atom(key), do: delete(key) def insert(key, value, opts) when is_binary(key) or is_atom(key), do: put(key, value, opts) def insert_or_update(key, value, update_fn, opts \\ []) diff --git a/lib/wanderer_app/character/tracker.ex b/lib/wanderer_app/character/tracker.ex index 5fec14cc..97ca71ac 100644 --- a/lib/wanderer_app/character/tracker.ex +++ b/lib/wanderer_app/character/tracker.ex @@ -598,9 +598,6 @@ defmodule WandererApp.Character.Tracker do {:error, :skipped} end - - _ -> - {:error, :skipped} end _ -> @@ -799,7 +796,7 @@ defmodule WandererApp.Character.Tracker do corporation_id |> WandererApp.Esi.get_corporation_info() |> case do - {:ok, %{"name" => corporation_name, "ticker" => corporation_ticker} = corporation_info} -> + {:ok, %{"name" => corporation_name, "ticker" => corporation_ticker}} -> {:ok, character} = WandererApp.Character.get_character(character_id) @@ -1002,7 +999,7 @@ defmodule WandererApp.Character.Tracker do defp maybe_update_active_maps( %{character_id: character_id, active_maps: active_maps} = state, - %{map_id: map_id, track: true} = track_settings + %{map_id: map_id, track: true} ) do if not Enum.member?(active_maps, map_id) do WandererApp.Cache.put( diff --git a/lib/wanderer_app/character/tracker_pool_dynamic_supervisor.ex b/lib/wanderer_app/character/tracker_pool_dynamic_supervisor.ex index 34433a94..53a19186 100644 --- a/lib/wanderer_app/character/tracker_pool_dynamic_supervisor.ex +++ b/lib/wanderer_app/character/tracker_pool_dynamic_supervisor.ex @@ -89,14 +89,4 @@ defmodule WandererApp.Character.TrackerPoolDynamicSupervisor do end end - defp stop_child(uuid) do - case Registry.lookup(@registry, uuid) do - [{pid, _}] -> - GenServer.cast(pid, :stop) - - _ -> - Logger.warn("Unable to locate pool assigned to #{inspect(uuid)}") - :ok - end - end end diff --git a/lib/wanderer_app/character/tracking_config_utils.ex b/lib/wanderer_app/character/tracking_config_utils.ex index 3e08be87..523f48b4 100644 --- a/lib/wanderer_app/character/tracking_config_utils.ex +++ b/lib/wanderer_app/character/tracking_config_utils.ex @@ -38,7 +38,7 @@ defmodule WandererApp.Character.TrackingConfigUtils do %{id: "default", title: "Default", value: default_count} ] - {:ok, pools_count} = + {:ok, _pools_count} = Cachex.get( :esi_auth_cache, "configs_total_count" diff --git a/lib/wanderer_app/esi/api_client.ex b/lib/wanderer_app/esi/api_client.ex index 6013efac..a7fe571c 100644 --- a/lib/wanderer_app/esi/api_client.ex +++ b/lib/wanderer_app/esi/api_client.ex @@ -8,7 +8,6 @@ defmodule WandererApp.Esi.ApiClient do @ttl :timer.hours(1) @wanderrer_user_agent "(wanderer-industries@proton.me; +https://github.com/wanderer-industries/wanderer)" - @req_esi_options [base_url: "https://esi.evetech.net", finch: WandererApp.Finch] @cache_opts [cache: true] @retry_opts [retry: false, retry_log_level: :warning] @@ -74,7 +73,7 @@ defmodule WandererApp.Esi.ApiClient do |> Keyword.merge(@timeout_opts) ) - def get_routes_eve(hubs, origin, params, opts), + def get_routes_eve(hubs, origin, _params, _opts), do: {:ok, hubs @@ -101,33 +100,6 @@ defmodule WandererApp.Esi.ApiClient do end end)} - defp do_get_routes_eve(origin, destination, params, opts) do - esi_params = - Map.merge(params, %{ - connections: params.connections |> Enum.join(","), - avoid: params.avoid |> Enum.join(",") - }) - - do_get( - "/route/#{origin}/#{destination}/?#{esi_params |> Plug.Conn.Query.encode()}", - opts, - @cache_opts - ) - |> case do - {:ok, result} -> - %{ - "origin" => origin, - "destination" => destination, - "systems" => result, - "success" => true - } - - error -> - Logger.warning("Error getting routes: #{inspect(error)}") - %{"origin" => origin, "destination" => destination, "systems" => [], "success" => false} - end - end - @decorate cacheable( cache: Cache, key: "group-info-#{group_id}", @@ -273,6 +245,8 @@ defmodule WandererApp.Esi.ApiClient do opts: [ttl: @ttl] ) defp get_search(character_eve_id, search_val, categories_val, merged_opts) do + # Note: search_val and categories_val are used by the @decorate cacheable annotation above + _unused = {search_val, categories_val} get_character_auth_data(character_eve_id, "search", merged_opts) end @@ -348,7 +322,7 @@ defmodule WandererApp.Esi.ApiClient do defp with_cache_opts(opts), do: opts |> Keyword.merge(@cache_opts) |> Keyword.merge(cache_dir: System.tmp_dir!()) - defp do_get(path, api_opts \\ [], opts \\ [], pool \\ @general_pool) do + defp do_get(path, api_opts, opts, pool \\ @general_pool) do case Cachex.get(:api_cache, path) do {:ok, cached_data} when not is_nil(cached_data) -> {:ok, cached_data} @@ -358,7 +332,7 @@ defmodule WandererApp.Esi.ApiClient do end end - defp do_get_request(path, api_opts \\ [], opts \\ [], pool \\ @general_pool) do + defp do_get_request(path, api_opts, opts, pool) do try do req_options_for_pool(pool) |> Req.new() @@ -448,7 +422,7 @@ defmodule WandererApp.Esi.ApiClient do {:ok, %{status: status} = _error} when status in [401, 403] -> do_get_retry(path, api_opts, opts) - {:ok, %{status: status, headers: headers}} -> + {:ok, %{status: status}} -> {:error, "Unexpected status: #{status}"} {:error, %Mint.TransportError{reason: :timeout}} -> @@ -832,10 +806,10 @@ defmodule WandererApp.Esi.ApiClient do defp handle_refresh_token_result( {:error, %OAuth2.Error{reason: :econnrefused} = error}, - character, + _character, character_id, expires_at, - scopes + _scopes ) do expires_at_datetime = DateTime.from_unix!(expires_at) time_since_expiry = DateTime.diff(DateTime.utc_now(), expires_at_datetime, :second) diff --git a/lib/wanderer_app/eve_data_service.ex b/lib/wanderer_app/eve_data_service.ex index 8233bdbd..f0243771 100644 --- a/lib/wanderer_app/eve_data_service.ex +++ b/lib/wanderer_app/eve_data_service.ex @@ -393,9 +393,6 @@ defmodule WandererApp.EveDataService do end end - defp get_solar_system_name(solar_system_name, wormhole_class) do - end - defp get_triglavian_data(default_data, triglavian_systems, solar_system_id) do case Enum.find(triglavian_systems, fn system -> system.solar_system_id == solar_system_id end) do nil -> @@ -414,7 +411,7 @@ defmodule WandererApp.EveDataService do defp get_security(security) do case security do nil -> {:ok, ""} - _ -> {:ok, String.to_float(security) |> get_true_security() |> Float.to_string(decimals: 1)} + _ -> {:ok, String.to_float(security) |> get_true_security() |> :erlang.float_to_binary(decimals: 1)} end end @@ -496,23 +493,23 @@ defmodule WandererApp.EveDataService do do: {:ok, 10_100} defp get_wormhole_class_id(systems, region_id, constellation_id, solar_system_id) do - with region <- - Enum.find(systems, fn system -> - system.location_id |> Integer.parse() |> elem(0) == region_id - end), - constellation <- - Enum.find(systems, fn system -> - system.location_id |> Integer.parse() |> elem(0) == constellation_id - end), - solar_system <- - Enum.find(systems, fn system -> - system.location_id |> Integer.parse() |> elem(0) == solar_system_id - end), - wormhole_class_id <- get_wormhole_class_id(region, constellation, solar_system) do - {:ok, wormhole_class_id} - else - _ -> {:ok, -1} - end + region = + Enum.find(systems, fn system -> + system.location_id |> Integer.parse() |> elem(0) == region_id + end) + + constellation = + Enum.find(systems, fn system -> + system.location_id |> Integer.parse() |> elem(0) == constellation_id + end) + + solar_system = + Enum.find(systems, fn system -> + system.location_id |> Integer.parse() |> elem(0) == solar_system_id + end) + + wormhole_class_id = get_wormhole_class_id(region, constellation, solar_system) + {:ok, wormhole_class_id} end defp get_wormhole_class_id(_region, _constellation, solar_system) diff --git a/lib/wanderer_app/external_events/event.ex b/lib/wanderer_app/external_events/event.ex index e3b4a5c8..27539b71 100644 --- a/lib/wanderer_app/external_events/event.ex +++ b/lib/wanderer_app/external_events/event.ex @@ -178,6 +178,10 @@ defmodule WandererApp.ExternalEvents.Event do end end + defp serialize_payload(payload, visited) when is_map(payload) do + Map.new(payload, fn {k, v} -> {to_string(k), serialize_value(v, visited)} end) + end + # Get allowed fields based on struct type defp get_allowed_fields(module) do module_name = module |> Module.split() |> List.last() @@ -192,10 +196,6 @@ defmodule WandererApp.ExternalEvents.Event do end end - defp serialize_payload(payload, visited) when is_map(payload) do - Map.new(payload, fn {k, v} -> {to_string(k), serialize_value(v, visited)} end) - end - defp serialize_fields(fields, visited) do Enum.reduce(fields, %{}, fn {k, v}, acc -> if is_nil(v) do diff --git a/lib/wanderer_app/kills/client.ex b/lib/wanderer_app/kills/client.ex index 8471fe45..8ec49fbe 100644 --- a/lib/wanderer_app/kills/client.ex +++ b/lib/wanderer_app/kills/client.ex @@ -182,7 +182,7 @@ defmodule WandererApp.Kills.Client do end # Guard against duplicate disconnection events - def handle_info({:disconnected, reason}, %{connected: false, connecting: false} = state) do + def handle_info({:disconnected, _reason}, %{connected: false, connecting: false} = state) do {:noreply, state} end @@ -566,7 +566,7 @@ defmodule WandererApp.Kills.Client do end end - defp check_health(%{socket_pid: pid} = state) do + defp check_health(%{socket_pid: pid}) do if socket_alive?(pid) do :healthy else @@ -590,22 +590,6 @@ defmodule WandererApp.Kills.Client do Process.send_after(self(), :health_check, @health_check_interval) end - defp handle_connection_lost(%{connected: false} = _state) do - Logger.debug("[Client] Connection already lost, skipping cleanup") - end - - defp handle_connection_lost(state) do - Logger.warning("[Client] Connection lost, cleaning up and reconnecting") - - # Clean up existing socket - if state.socket_pid do - disconnect_socket(state.socket_pid) - end - - # Reset state and trigger reconnection - send(self(), {:disconnected, :connection_lost}) - end - # Handler module for WebSocket events defmodule Handler do @moduledoc """ @@ -640,7 +624,7 @@ defmodule WandererApp.Kills.Client do } case GenSocketClient.join(transport, "killmails:lobby", join_params) do - {:ok, response} -> + {:ok, _response} -> send(state.parent, {:connected, self()}) # Reset disconnected flag on successful connection {:ok, %{state | disconnected: false}} diff --git a/lib/wanderer_app/kills/map_event_listener.ex b/lib/wanderer_app/kills/map_event_listener.ex index aaed9223..9249b22f 100644 --- a/lib/wanderer_app/kills/map_event_listener.ex +++ b/lib/wanderer_app/kills/map_event_listener.ex @@ -46,7 +46,7 @@ defmodule WandererApp.Kills.MapEventListener do end @impl true - def handle_info(%{event: :map_server_started, payload: map_info}, state) do + def handle_info(%{event: :map_server_started, payload: _map_info}, state) do {:noreply, schedule_subscription_update(state)} end @@ -191,7 +191,7 @@ defmodule WandererApp.Kills.MapEventListener do # Client is not connected, retry with backoff schedule_retry_update(state) - error -> + _error -> schedule_retry_update(state) end rescue diff --git a/lib/wanderer_app/map.ex b/lib/wanderer_app/map.ex index e123a5f9..fb84fa68 100644 --- a/lib/wanderer_app/map.ex +++ b/lib/wanderer_app/map.ex @@ -177,7 +177,7 @@ defmodule WandererApp.Map do end def list_hubs(map_id, hubs) do - {:ok, map} = map_id |> get_map() + {:ok, _map} = map_id |> get_map() {:ok, hubs} end @@ -315,7 +315,7 @@ defmodule WandererApp.Map do end end - def update_subscription_settings!(%{map_id: map_id} = map, %{ + def update_subscription_settings!(%{map_id: map_id} = _map, %{ characters_limit: characters_limit, hubs_limit: hubs_limit }) do @@ -326,7 +326,7 @@ defmodule WandererApp.Map do |> get_map!() end - def update_options!(%{map_id: map_id} = map, options) do + def update_options!(%{map_id: map_id} = _map, options) do map_id |> update_map(%{options: options}) diff --git a/lib/wanderer_app/map/map_operations.ex b/lib/wanderer_app/map/map_operations.ex index 6dbe0dea..9297e5c8 100644 --- a/lib/wanderer_app/map/map_operations.ex +++ b/lib/wanderer_app/map/map_operations.ex @@ -76,11 +76,6 @@ defmodule WandererApp.Map.Operations do {:ok, map()} | {:skip, :exists} | {:error, String.t()} defdelegate create_connection(map_id, attrs, char_id), to: Connections - @doc "Create a connection from a Plug.Conn" - @spec create_connection(Plug.Conn.t(), map()) :: - {:ok, :created} | {:skip, :exists} | {:error, atom()} - defdelegate create_connection(conn, attrs), to: Connections - @doc "Update a connection" @spec update_connection(String.t(), String.t(), map()) :: {:ok, map()} | {:error, String.t()} diff --git a/lib/wanderer_app/map/map_pool.ex b/lib/wanderer_app/map/map_pool.ex index b174b70d..e6e679d1 100644 --- a/lib/wanderer_app/map/map_pool.ex +++ b/lib/wanderer_app/map/map_pool.ex @@ -329,6 +329,9 @@ defmodule WandererApp.Map.MapPool do end end + @impl true + def handle_call(:error, _, state), do: {:stop, :error, :ok, state} + defp do_start_map(map_id, %{map_ids: map_ids, uuid: uuid} = state) do if map_id in map_ids do # Map already started @@ -344,8 +347,6 @@ defmodule WandererApp.Map.MapPool do [map_id | r_map_ids] end) - completed_operations = [:registry | completed_operations] - case registry_result do {new_value, _old_value} when is_list(new_value) -> :ok @@ -363,13 +364,9 @@ defmodule WandererApp.Map.MapPool do raise "Failed to add to cache: #{inspect(reason)}" end - completed_operations = [:cache | completed_operations] - # Step 3: Start the map server using extracted helper do_initialize_map_server(map_id) - completed_operations = [:map_server | completed_operations] - # Step 4: Update GenServer state (last, as this is in-memory and fast) new_state = %{state | map_ids: [map_id | map_ids]} @@ -445,8 +442,6 @@ defmodule WandererApp.Map.MapPool do r_map_ids |> Enum.reject(fn id -> id == map_id end) end) - completed_operations = [:registry | completed_operations] - case registry_result do {new_value, _old_value} when is_list(new_value) -> :ok @@ -464,14 +459,10 @@ defmodule WandererApp.Map.MapPool do raise "Failed to delete from cache: #{inspect(reason)}" end - completed_operations = [:cache | completed_operations] - # Step 3: Stop the map server (clean up all map resources) map_id |> Server.Impl.stop_map() - completed_operations = [:map_server | completed_operations] - # Step 4: Update GenServer state (last, as this is in-memory and fast) new_state = %{state | map_ids: map_ids |> Enum.reject(fn id -> id == map_id end)} @@ -560,9 +551,6 @@ defmodule WandererApp.Map.MapPool do # and the cleanup operations are safe to leave in a "stopped" state end - @impl true - def handle_call(:error, _, state), do: {:stop, :error, :ok, state} - @impl true def handle_info(:backup_state, %{map_ids: map_ids, uuid: uuid} = state) do Process.send_after(self(), :backup_state, @backup_state_timeout) diff --git a/lib/wanderer_app/map/map_pool_dynamic_supervisor.ex b/lib/wanderer_app/map/map_pool_dynamic_supervisor.ex index d17ba57d..76d61e14 100644 --- a/lib/wanderer_app/map/map_pool_dynamic_supervisor.ex +++ b/lib/wanderer_app/map/map_pool_dynamic_supervisor.ex @@ -180,14 +180,4 @@ defmodule WandererApp.Map.MapPoolDynamicSupervisor do end end - defp stop_child(uuid) do - case Registry.lookup(@registry, uuid) do - [{pid, _}] -> - GenServer.cast(pid, :stop) - - _ -> - Logger.warn("Unable to locate pool assigned to #{inspect(uuid)}") - :ok - end - end end diff --git a/lib/wanderer_app/map/map_routes.ex b/lib/wanderer_app/map/map_routes.ex index e3438177..258b075a 100644 --- a/lib/wanderer_app/map/map_routes.ex +++ b/lib/wanderer_app/map/map_routes.ex @@ -77,7 +77,7 @@ defmodule WandererApp.Map.Routes do end end - def find(_map_id, hubs, origin, routes_settings, true) do + def find(_map_id, hubs, origin, _routes_settings, true) do origin = origin |> String.to_integer() hubs = hubs |> Enum.map(&(&1 |> String.to_integer())) diff --git a/lib/wanderer_app/map/operations/connections.ex b/lib/wanderer_app/map/operations/connections.ex index 6dd72c42..72d54651 100644 --- a/lib/wanderer_app/map/operations/connections.ex +++ b/lib/wanderer_app/map/operations/connections.ex @@ -93,10 +93,8 @@ defmodule WandererApp.Map.Operations.Connections do end end - @doc """ - Determines the ship size for a connection, applying wormhole‑specific rules - for C1, C13, and C4⇄NS links, falling back to the caller’s provided size or Large. - """ + # Determines the ship size for a connection, applying wormhole-specific rules + # for C1, C13, and C4⇄NS links, falling back to the caller's provided size or Large. defp resolve_ship_size(type_val, ship_size_val, src_info, tgt_info) do case parse_type(type_val) do @connection_type_wormhole -> diff --git a/lib/wanderer_app/map/operations/duplication.ex b/lib/wanderer_app/map/operations/duplication.ex index 4ab422e7..308f0f2c 100644 --- a/lib/wanderer_app/map/operations/duplication.ex +++ b/lib/wanderer_app/map/operations/duplication.ex @@ -12,7 +12,6 @@ defmodule WandererApp.Map.Operations.Duplication do """ require Logger - import Ash.Query, only: [filter: 2] alias WandererApp.Api alias WandererApp.Api.{MapSystem, MapConnection, MapSystemSignature, MapCharacterSettings} diff --git a/lib/wanderer_app/map/server/map_server_connections_impl.ex b/lib/wanderer_app/map/server/map_server_connections_impl.ex index ce788f21..21b89035 100644 --- a/lib/wanderer_app/map/server/map_server_connections_impl.ex +++ b/lib/wanderer_app/map/server/map_server_connections_impl.ex @@ -100,7 +100,7 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do @connection_type_wormhole 0 @connection_type_stargate 1 - @connection_type_bridge 2 + # @connection_type_bridge 2 # reserved for future use @medium_ship_size 1 def get_connection_auto_expire_hours(), do: WandererApp.Env.map_connection_auto_expire_hours() @@ -403,7 +403,7 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do time_status: time_status, solar_system_source: solar_system_source, solar_system_target: solar_system_target - } = updated_connection + } = _updated_connection ) do with source_system when not is_nil(source_system) <- WandererApp.Map.find_system_by_location( @@ -909,9 +909,6 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do end end - defp get_time_status(_source_solar_system_id, _target_solar_system_id, _ship_size_type), - do: @connection_time_status_default - defp get_new_time_status(_start_time, @connection_time_status_default), do: @connection_time_status_eol_24 diff --git a/lib/wanderer_app/map/server/map_server_impl.ex b/lib/wanderer_app/map/server/map_server_impl.ex index 5f4dcf46..b7986fd0 100644 --- a/lib/wanderer_app/map/server/map_server_impl.ex +++ b/lib/wanderer_app/map/server/map_server_impl.ex @@ -156,7 +156,7 @@ defmodule WandererApp.Map.Server.Impl do Logger.error("Cannot start map #{map_id}: map not loaded") {:error, :map_not_loaded} - map -> + _map -> with :ok <- AclsImpl.track_acls(acls |> Enum.map(& &1.access_list_id)) do @pubsub_client.subscribe( WandererApp.PubSub, diff --git a/lib/wanderer_app/map/server/map_server_pings_impl.ex b/lib/wanderer_app/map/server/map_server_pings_impl.ex index 9b8e796b..b96e8b37 100644 --- a/lib/wanderer_app/map/server/map_server_pings_impl.ex +++ b/lib/wanderer_app/map/server/map_server_pings_impl.ex @@ -5,7 +5,7 @@ defmodule WandererApp.Map.Server.PingsImpl do alias WandererApp.Map.Server.Impl - @ping_auto_expire_timeout :timer.minutes(15) + # @ping_auto_expire_timeout :timer.minutes(15) # reserved for future use def add_ping( map_id, diff --git a/lib/wanderer_app/map/server/map_server_systems_impl.ex b/lib/wanderer_app/map/server/map_server_systems_impl.ex index f9cb9342..0c9f71f1 100644 --- a/lib/wanderer_app/map/server/map_server_systems_impl.ex +++ b/lib/wanderer_app/map/server/map_server_systems_impl.ex @@ -129,8 +129,8 @@ defmodule WandererApp.Map.Server.SystemsImpl do def remove_system_comment( map_id, comment_id, - user_id, - character_id + _user_id, + _character_id ) do {:ok, %{system_id: system_id} = comment} = WandererApp.MapSystemCommentRepo.get_by_id(comment_id) @@ -309,7 +309,7 @@ defmodule WandererApp.Map.Server.SystemsImpl do map_id |> WandererApp.MapSystemRepo.remove_from_map(solar_system_id) |> case do - {:ok, result} -> + {:ok, _result} -> :ok = WandererApp.Map.remove_system(map_id, solar_system_id) @ddrt.delete([solar_system_id], "rtree_#{map_id}") Impl.broadcast!(map_id, :systems_removed, [solar_system_id]) @@ -863,10 +863,8 @@ defmodule WandererApp.Map.Server.SystemsImpl do updated_system end - defp maybe_update_labels(system, _labels), do: system - defp maybe_update_labels( - %{name: old_labels} = system, + %{labels: old_labels} = system, labels ) when not is_nil(labels) and old_labels != labels do diff --git a/lib/wanderer_app/maps.ex b/lib/wanderer_app/maps.ex index dac21e2c..7c04a996 100644 --- a/lib/wanderer_app/maps.ex +++ b/lib/wanderer_app/maps.ex @@ -128,7 +128,7 @@ defmodule WandererApp.Maps do tracked: tracked } - defp get_map_characters(%{id: map_id} = map) do + defp get_map_characters(%{id: map_id} = _map) do WandererApp.Cache.lookup!("map_characters-#{map_id}") |> case do nil -> diff --git a/lib/wanderer_app/repositories/map_connection_repo.ex b/lib/wanderer_app/repositories/map_connection_repo.ex index d7628e56..124080df 100644 --- a/lib/wanderer_app/repositories/map_connection_repo.ex +++ b/lib/wanderer_app/repositories/map_connection_repo.ex @@ -99,7 +99,7 @@ defmodule WandererApp.MapConnectionRepo do def get_by_id(map_id, id) do # Use read_by_map action which doesn't have the FilterConnectionsByActorMap preparation # that was causing "filter being false" errors in tests - import Ash.Query + require Ash.Query WandererApp.Api.MapConnection |> Ash.Query.for_read(:read_by_map, %{map_id: map_id}) diff --git a/lib/wanderer_app/repositories/map_pings_repo.ex b/lib/wanderer_app/repositories/map_pings_repo.ex index 47a6af93..bab3d4bb 100644 --- a/lib/wanderer_app/repositories/map_pings_repo.ex +++ b/lib/wanderer_app/repositories/map_pings_repo.ex @@ -38,6 +38,4 @@ defmodule WandererApp.MapPingsRepo do :ok end - - def destroy(_ping_id), do: :ok end diff --git a/lib/wanderer_app/repositories/map_repo.ex b/lib/wanderer_app/repositories/map_repo.ex index 1c945023..9a06da84 100644 --- a/lib/wanderer_app/repositories/map_repo.ex +++ b/lib/wanderer_app/repositories/map_repo.ex @@ -84,7 +84,7 @@ defmodule WandererApp.MapRepo do end end - error in Ash.Error.Query.NotFound -> + _error in Ash.Error.Query.NotFound -> Logger.debug("Map not found with slug: #{slug}") {:error, :not_found} diff --git a/lib/wanderer_app/security_audit.ex b/lib/wanderer_app/security_audit.ex index 1af462f5..7c5f380a 100644 --- a/lib/wanderer_app/security_audit.ex +++ b/lib/wanderer_app/security_audit.ex @@ -487,15 +487,6 @@ defmodule WandererApp.SecurityAudit do # Private functions - defp store_audit_entry(_audit_entry) do - # Handle async processing if enabled - # if async_enabled?() do - # WandererApp.SecurityAudit.AsyncProcessor.log_event(audit_entry) - # else - # do_store_audit_entry(audit_entry) - # end - end - @doc false def do_store_audit_entry(audit_entry) do # Ensure event_type is properly formatted @@ -631,11 +622,6 @@ defmodule WandererApp.SecurityAudit do end end - defp async_enabled? do - Application.get_env(:wanderer_app, __MODULE__, []) - |> Keyword.get(:async, false) - end - defp emit_telemetry_event(audit_entry) do :telemetry.execute( [:wanderer_app, :security_audit], diff --git a/lib/wanderer_app/test/logger.ex b/lib/wanderer_app/test/logger.ex index 17bb3fd1..ecdefd96 100644 --- a/lib/wanderer_app/test/logger.ex +++ b/lib/wanderer_app/test/logger.ex @@ -5,7 +5,11 @@ defmodule WandererApp.Test.Logger do """ @callback info(message :: iodata() | (-> iodata())) :: :ok + @callback info(message :: iodata() | (-> iodata()), metadata :: keyword()) :: :ok @callback error(message :: iodata() | (-> iodata())) :: :ok + @callback error(message :: iodata() | (-> iodata()), metadata :: keyword()) :: :ok @callback warning(message :: iodata() | (-> iodata())) :: :ok + @callback warning(message :: iodata() | (-> iodata()), metadata :: keyword()) :: :ok @callback debug(message :: iodata() | (-> iodata())) :: :ok + @callback debug(message :: iodata() | (-> iodata()), metadata :: keyword()) :: :ok end diff --git a/lib/wanderer_app/test/logger_stub.ex b/lib/wanderer_app/test/logger_stub.ex index 819e4858..49886053 100644 --- a/lib/wanderer_app/test/logger_stub.ex +++ b/lib/wanderer_app/test/logger_stub.ex @@ -9,12 +9,24 @@ defmodule WandererApp.Test.LoggerStub do @impl true def info(_message), do: :ok + @impl true + def info(_message, _metadata), do: :ok + @impl true def error(_message), do: :ok + @impl true + def error(_message, _metadata), do: :ok + @impl true def warning(_message), do: :ok + @impl true + def warning(_message, _metadata), do: :ok + @impl true def debug(_message), do: :ok + + @impl true + def debug(_message, _metadata), do: :ok end diff --git a/lib/wanderer_app/vault.ex b/lib/wanderer_app/vault.ex index 6e8c49a0..3fac1be6 100644 --- a/lib/wanderer_app/vault.ex +++ b/lib/wanderer_app/vault.ex @@ -124,7 +124,7 @@ defmodule WandererApp.Vault do end) end - defp find_fallback_module_to_decrypt(config, ciphertext) do + defp find_fallback_module_to_decrypt(config, _ciphertext) do Enum.find(config[:ciphers], fn {label, _} -> label == :fallback end) diff --git a/lib/wanderer_app_web/api_router.ex b/lib/wanderer_app_web/api_router.ex index bc80f428..edb0b00e 100644 --- a/lib/wanderer_app_web/api_router.ex +++ b/lib/wanderer_app_web/api_router.ex @@ -12,7 +12,6 @@ defmodule WandererAppWeb.ApiRouter do """ use Phoenix.Router - import WandererAppWeb.ApiRouterHelpers alias WandererAppWeb.{ApiRoutes, ApiRouter.RouteSpec} require Logger @@ -171,7 +170,7 @@ defmodule WandererAppWeb.ApiRouter do |> halt() end - defp find_similar_routes(path_info, version) do + defp find_similar_routes(path_info, _version) do # Find routes with similar paths in current or other versions all_routes = ApiRoutes.table() diff --git a/lib/wanderer_app_web/api_spec.ex b/lib/wanderer_app_web/api_spec.ex index dfb08db8..9c39984f 100644 --- a/lib/wanderer_app_web/api_spec.ex +++ b/lib/wanderer_app_web/api_spec.ex @@ -1,7 +1,7 @@ defmodule WandererAppWeb.ApiSpec do @behaviour OpenApiSpex.OpenApi - alias OpenApiSpex.{OpenApi, Info, Paths, Components, SecurityScheme, Server, Schema} + alias OpenApiSpex.{OpenApi, Info, Paths, Components, SecurityScheme, Server} alias WandererAppWeb.{Endpoint, Router} alias WandererAppWeb.Schemas.ApiSchemas diff --git a/lib/wanderer_app_web/components/core_components.ex b/lib/wanderer_app_web/components/core_components.ex index 19ae39d8..29c45c20 100644 --- a/lib/wanderer_app_web/components/core_components.ex +++ b/lib/wanderer_app_web/components/core_components.ex @@ -284,6 +284,7 @@ defmodule WandererAppWeb.CoreComponents do """ attr(:type, :string, default: nil) attr(:class, :string, default: nil) + attr(:data, :any, default: nil) attr(:rest, :global, include: ~w(disabled form name value)) slot(:inner_block, required: true) @@ -296,6 +297,7 @@ defmodule WandererAppWeb.CoreComponents do "phx-submit-loading:opacity-75 p-button p-component p-button-outlined p-button-sm", @class ]} + data={@data} {@rest} > {render_slot(@inner_block)} @@ -614,7 +616,7 @@ defmodule WandererAppWeb.CoreComponents do attr(:empty_label, :string, default: nil) attr(:rows, :list, required: true) attr(:row_id, :any, default: nil, doc: "the function for generating the row id") - attr(:row_selected, :boolean, default: false, doc: "the function for generating the row id") + attr(:row_selected, :any, default: false, doc: "the function for generating the row id") attr(:row_click, :any, default: nil, doc: "the function for handling phx-click on each row") attr(:row_item, :any, @@ -703,13 +705,21 @@ defmodule WandererAppWeb.CoreComponents do """ end + attr(:field, :any, required: true) attr(:placeholder, :string, default: nil) attr(:label, :string, default: nil) attr(:label_class, :string, default: nil) attr(:input_class, :string, default: nil) attr(:dropdown_extra_class, :string, default: nil) attr(:option_extra_class, :string, default: nil) + attr(:mode, :atom, default: nil) + attr(:options, :list, default: []) + attr(:debounce, :integer, default: nil) + attr(:update_min_len, :integer, default: nil) + attr(:available_option_class, :string, default: nil) + attr(:value_mapper, :any, default: nil) slot(:inner_block) + slot(:option) def live_select(%{field: %Phoenix.HTML.FormField{} = field} = assigns) do assigns = diff --git a/lib/wanderer_app_web/controllers/license_api_controller.ex b/lib/wanderer_app_web/controllers/license_api_controller.ex index 45dda006..b2175533 100644 --- a/lib/wanderer_app_web/controllers/license_api_controller.ex +++ b/lib/wanderer_app_web/controllers/license_api_controller.ex @@ -123,11 +123,6 @@ defmodule WandererAppWeb.LicenseApiController do end end - def update_validity(conn, %{"id" => _license_id}) do - conn - |> put_status(:bad_request) - |> json(%{error: "Missing required parameter: is_valid"}) - end @doc """ Updates a license's expiration date. diff --git a/lib/wanderer_app_web/controllers/map_api_controller.ex b/lib/wanderer_app_web/controllers/map_api_controller.ex index 923307af..5437dda4 100644 --- a/lib/wanderer_app_web/controllers/map_api_controller.ex +++ b/lib/wanderer_app_web/controllers/map_api_controller.ex @@ -2,12 +2,10 @@ defmodule WandererAppWeb.MapAPIController do use WandererAppWeb, :controller use OpenApiSpex.ControllerSpecs - import Ash.Query, only: [filter: 2] + require Ash.Query require Logger - alias WandererApp.Api.Character alias WandererApp.MapSystemRepo - alias WandererApp.MapCharacterSettingsRepo alias WandererApp.MapConnectionRepo alias WandererAppWeb.Helpers.APIUtils alias WandererAppWeb.Schemas.{ApiSchemas, ResponseSchemas} @@ -16,7 +14,7 @@ defmodule WandererAppWeb.MapAPIController do # V1 API Actions (for compatibility with versioned API router) # ----------------------------------------------------------------- - def index_v1(conn, params) do + def index_v1(conn, _params) do # Delegate to the existing list implementation or create a basic one json(conn, %{ data: [], @@ -43,7 +41,7 @@ defmodule WandererAppWeb.MapAPIController do }) end - def create_v1(conn, params) do + def create_v1(conn, _params) do # Basic create implementation for testing json(conn, %{ data: %{ @@ -59,7 +57,7 @@ defmodule WandererAppWeb.MapAPIController do }) end - def update_v1(conn, %{"id" => id} = params) do + def update_v1(conn, %{"id" => id} = _params) do # Basic update implementation for testing json(conn, %{ data: %{ @@ -82,7 +80,7 @@ defmodule WandererAppWeb.MapAPIController do |> text("") end - def duplicate_v1(conn, %{"id" => id} = params) do + def duplicate_v1(conn, %{"id" => id} = _params) do # Basic duplicate implementation for testing json(conn, %{ data: %{ @@ -99,7 +97,7 @@ defmodule WandererAppWeb.MapAPIController do }) end - def bulk_create_v1(conn, params) do + def bulk_create_v1(conn, _params) do # Basic bulk create implementation for testing json(conn, %{ data: [ @@ -121,7 +119,7 @@ defmodule WandererAppWeb.MapAPIController do }) end - def bulk_update_v1(conn, params) do + def bulk_update_v1(conn, _params) do # Basic bulk update implementation for testing json(conn, %{ data: [ @@ -325,13 +323,6 @@ defmodule WandererAppWeb.MapAPIController do # Helper functions for the API controller # ----------------------------------------------------------------- - defp get_map_id_by_slug(slug) do - case WandererApp.Api.Map.get_map_by_slug(slug) do - {:ok, map} -> {:ok, map.id} - {:error, error} -> {:error, "Map not found for slug: #{slug}, error: #{inspect(error)}"} - end - end - defp normalize_map_identifier(params) do case Map.get(params, "map_identifier") do nil -> diff --git a/lib/wanderer_app_web/controllers/map_audit_api_controller.ex b/lib/wanderer_app_web/controllers/map_audit_api_controller.ex index a384ecfb..51bd963b 100644 --- a/lib/wanderer_app_web/controllers/map_audit_api_controller.ex +++ b/lib/wanderer_app_web/controllers/map_audit_api_controller.ex @@ -4,8 +4,6 @@ defmodule WandererAppWeb.MapAuditAPIController do require Logger - alias WandererApp.Api - alias WandererAppWeb.Helpers.APIUtils # ----------------------------------------------------------------- diff --git a/lib/wanderer_app_web/controllers/map_events_api_controller.ex b/lib/wanderer_app_web/controllers/map_events_api_controller.ex index 4ae8ab20..47d525cd 100644 --- a/lib/wanderer_app_web/controllers/map_events_api_controller.ex +++ b/lib/wanderer_app_web/controllers/map_events_api_controller.ex @@ -65,24 +65,6 @@ defmodule WandererAppWeb.MapEventsAPIController do items: @event_schema }) - @events_list_params %OpenApiSpex.Schema{ - type: :object, - properties: %{ - since: %OpenApiSpex.Schema{ - type: :string, - format: :date_time, - description: "Return events after this timestamp (ISO8601)" - }, - limit: %OpenApiSpex.Schema{ - type: :integer, - minimum: 1, - maximum: 100, - default: 100, - description: "Maximum number of events to return" - } - } - } - # ----------------------------------------------------------------- # OpenApiSpex Operations # ----------------------------------------------------------------- @@ -173,7 +155,7 @@ defmodule WandererAppWeb.MapEventsAPIController do |> put_status(:bad_request) |> json(%{error: "Invalid 'limit' parameter. Must be between 1 and 100."}) - {:error, reason} -> + {:error, _reason} -> conn |> put_status(:internal_server_error) |> json(%{error: "Internal server error"}) @@ -184,7 +166,7 @@ defmodule WandererAppWeb.MapEventsAPIController do # Private Functions # ----------------------------------------------------------------- - defp get_map(conn, map_identifier) do + defp get_map(conn, _map_identifier) do # The map should already be loaded by the CheckMapApiKey plug case conn.assigns[:map] do nil -> {:error, :map_not_found} diff --git a/lib/wanderer_app_web/controllers/plugs/json_api_performance_monitor.ex b/lib/wanderer_app_web/controllers/plugs/json_api_performance_monitor.ex index 4443141e..0e8b54f2 100644 --- a/lib/wanderer_app_web/controllers/plugs/json_api_performance_monitor.ex +++ b/lib/wanderer_app_web/controllers/plugs/json_api_performance_monitor.ex @@ -36,7 +36,7 @@ defmodule WandererAppWeb.Plugs.JsonApiPerformanceMonitor do conn |> register_before_send(fn conn -> end_time = System.monotonic_time(:millisecond) - duration = end_time - start_time + _duration = end_time - start_time # Extract response metadata response_metadata = extract_response_metadata(conn, request_metadata) diff --git a/lib/wanderer_app_web/controllers/plugs/license_auth.ex b/lib/wanderer_app_web/controllers/plugs/license_auth.ex index eb126498..8f36fc62 100644 --- a/lib/wanderer_app_web/controllers/plugs/license_auth.ex +++ b/lib/wanderer_app_web/controllers/plugs/license_auth.ex @@ -12,7 +12,6 @@ defmodule WandererAppWeb.Plugs.LicenseAuth do require Logger alias WandererApp.License.LicenseManager - alias WandererApp.Helpers.Config @doc """ Authenticates requests using the LM_AUTH_KEY. @@ -21,7 +20,7 @@ defmodule WandererAppWeb.Plugs.LicenseAuth do """ def authenticate_lm(conn, _opts) do auth_header = get_req_header(conn, "authorization") - lm_auth_key = Config.get_env(:wanderer_app, :lm_auth_key) + lm_auth_key = Application.get_env(:wanderer_app, :lm_auth_key) case auth_header do ["Bearer " <> token] -> diff --git a/lib/wanderer_app_web/controllers/user_auth.ex b/lib/wanderer_app_web/controllers/user_auth.ex index af768c9c..1fcf4ea3 100755 --- a/lib/wanderer_app_web/controllers/user_auth.ex +++ b/lib/wanderer_app_web/controllers/user_auth.ex @@ -37,7 +37,7 @@ defmodule WandererAppWeb.UserAuth do nil -> {:halt, redirect_require_login(socket)} - %User{characters: characters} -> + %User{characters: _characters} -> {:cont, new_socket} end @@ -112,13 +112,6 @@ defmodule WandererAppWeb.UserAuth do |> LiveView.redirect(to: ~p"/") end - defp track_characters([]), do: :ok - - defp track_characters([%{id: character_id} | characters]) do - :ok = WandererApp.Character.TrackerManager.start_tracking(character_id) - track_characters(characters) - end - defp maybe_store_return_to(%{method: "GET"} = conn) do %{request_path: request_path, query_string: query_string} = conn return_to = if query_string == "", do: request_path, else: request_path <> "?" <> query_string diff --git a/lib/wanderer_app_web/live/access_lists/access_lists_live.ex b/lib/wanderer_app_web/live/access_lists/access_lists_live.ex index 8fa76a2d..3d07c1ba 100755 --- a/lib/wanderer_app_web/live/access_lists/access_lists_live.ex +++ b/lib/wanderer_app_web/live/access_lists/access_lists_live.ex @@ -688,7 +688,7 @@ defmodule WandererAppWeb.AccessListsLive do """ end - slot(:option) + attr(:option, :any, required: true) def search_member_item(assigns) do ~H""" diff --git a/lib/wanderer_app_web/live/access_lists/access_lists_live.html.heex b/lib/wanderer_app_web/live/access_lists/access_lists_live.html.heex index fe736092..e3c46682 100644 --- a/lib/wanderer_app_web/live/access_lists/access_lists_live.html.heex +++ b/lib/wanderer_app_web/live/access_lists/access_lists_live.html.heex @@ -115,13 +115,20 @@ <.link - disabled={@selected_acl_id == "" or not can_add_members?(@access_list, @current_user)} + :if={@selected_acl_id != "" and can_add_members?(@access_list, @current_user)} class="btn mt-2 w-full btn-neutral rounded-none" patch={~p"/access-lists/#{@selected_acl_id}/add-members"} > <.icon name="hero-plus-solid" class="w-6 h-6" />

Add Members

+
+ <.icon name="hero-plus-solid" class="w-6 h-6" /> +

Add Members

+
diff --git a/lib/wanderer_app_web/live/admin/admin_live.ex b/lib/wanderer_app_web/live/admin/admin_live.ex index 55300704..4b777836 100755 --- a/lib/wanderer_app_web/live/admin/admin_live.ex +++ b/lib/wanderer_app_web/live/admin/admin_live.ex @@ -4,8 +4,6 @@ defmodule WandererAppWeb.AdminLive do require Logger alias BetterNumber, as: Number - @invite_link_ttl :timer.hours(24) - def mount(_params, %{"user_id" => user_id} = _session, socket) when not is_nil(user_id) do WandererApp.StartCorpWalletTrackerTask.maybe_start_corp_wallet_tracker( diff --git a/lib/wanderer_app_web/live/admin/admin_live.html.heex b/lib/wanderer_app_web/live/admin/admin_live.html.heex index 9dbbe3a3..74c66c43 100644 --- a/lib/wanderer_app_web/live/admin/admin_live.html.heex +++ b/lib/wanderer_app_web/live/admin/admin_live.html.heex @@ -209,7 +209,7 @@ rows={@transactions} class="!max-h-[40vh] !overflow-y-auto" > - <:col :let={transaction}> + <:col :let={_transaction}>
<.icon name="hero-credit-card-solid" class="h-5 w-5" />
@@ -267,7 +267,7 @@ rows={@active_map_subscriptions} class="!max-h-[40vh] !overflow-y-auto" > - <:col :let={subscription}> + <:col :let={_subscription}>
<.icon name="hero-check-badge-solid" class="w-5 h-5" />
diff --git a/lib/wanderer_app_web/live/characters/characters_tracking_live.ex b/lib/wanderer_app_web/live/characters/characters_tracking_live.ex index 68ad403f..c0bf8363 100755 --- a/lib/wanderer_app_web/live/characters/characters_tracking_live.ex +++ b/lib/wanderer_app_web/live/characters/characters_tracking_live.ex @@ -18,13 +18,6 @@ defmodule WandererAppWeb.CharactersTrackingLive do )} end - @impl true - def mount(_params, _session, socket) do - {:ok, - socket - |> assign(characters: [], selected_map: nil, maps: [])} - end - @impl true def handle_params(params, _url, socket) do {:noreply, apply_action(socket, socket.assigns.live_action, params)} diff --git a/lib/wanderer_app_web/live/map/components/map_subscription.ex b/lib/wanderer_app_web/live/map/components/map_subscription.ex index bede77ab..6579cc93 100644 --- a/lib/wanderer_app_web/live/map/components/map_subscription.ex +++ b/lib/wanderer_app_web/live/map/components/map_subscription.ex @@ -79,7 +79,7 @@ defmodule WandererAppWeb.MapSubscription do {:noreply, socket} end - defp get_title(%{plan: plan, auto_renew?: auto_renew?, active_till: active_till} = subscription) do + defp get_title(%{plan: plan, auto_renew?: auto_renew?, active_till: active_till}) do if plan != :alpha do "Active subscription: omega \nActive till: #{Calendar.strftime(active_till, "%m/%d/%Y")} \nAuto renew: #{auto_renew?}" else diff --git a/lib/wanderer_app_web/live/map/event_handlers/map_characters_event_handler.ex b/lib/wanderer_app_web/live/map/event_handlers/map_characters_event_handler.ex index c1f362ea..68d42cad 100644 --- a/lib/wanderer_app_web/live/map/event_handlers/map_characters_event_handler.ex +++ b/lib/wanderer_app_web/live/map/event_handlers/map_characters_event_handler.ex @@ -300,13 +300,13 @@ defmodule WandererAppWeb.MapCharactersEventHandler do %{"character_eve_id" => character_eve_id}, %{ assigns: %{ - map_id: map_id, - current_user: %{id: current_user_id} + map_id: _map_id, + current_user: %{id: _current_user_id} } } = socket ) when not is_nil(character_eve_id) do - {:ok, character} = WandererApp.Character.get_by_eve_id("#{character_eve_id}") + {:ok, _character} = WandererApp.Character.get_by_eve_id("#{character_eve_id}") {:noreply, socket} end @@ -338,12 +338,6 @@ defmodule WandererAppWeb.MapCharactersEventHandler do station_id: character.station_id } - defp get_map_with_acls(map_id) do - with {:ok, map} <- WandererApp.Api.Map.by_id(map_id) do - {:ok, Ash.load!(map, :acls)} - end - end - def needs_tracking_setup?( only_tracked_characters, characters, diff --git a/lib/wanderer_app_web/live/map/event_handlers/map_kills_event_handler.ex b/lib/wanderer_app_web/live/map/event_handlers/map_kills_event_handler.ex index 68ed63a9..ebc90e58 100644 --- a/lib/wanderer_app_web/live/map/event_handlers/map_kills_event_handler.ex +++ b/lib/wanderer_app_web/live/map/event_handlers/map_kills_event_handler.ex @@ -11,7 +11,7 @@ defmodule WandererAppWeb.MapKillsEventHandler do def handle_server_event( %{event: :init_kills}, - %{assigns: %{map_id: map_id} = assigns} = socket + %{assigns: %{map_id: map_id} = _assigns} = socket ) do # Get kill counts from cache case WandererApp.Map.get_map(map_id) do diff --git a/lib/wanderer_app_web/live/map/event_handlers/map_routes_event_handler.ex b/lib/wanderer_app_web/live/map/event_handlers/map_routes_event_handler.ex index 3e744f28..31ff9dc4 100644 --- a/lib/wanderer_app_web/live/map/event_handlers/map_routes_event_handler.ex +++ b/lib/wanderer_app_web/live/map/event_handlers/map_routes_event_handler.ex @@ -3,7 +3,7 @@ defmodule WandererAppWeb.MapRoutesEventHandler do use Phoenix.Component require Logger - alias WandererAppWeb.{MapEventHandler, MapCoreEventHandler, MapSystemsEventHandler} + alias WandererAppWeb.{MapEventHandler, MapCoreEventHandler} def handle_server_event( %{ diff --git a/lib/wanderer_app_web/live/map/event_handlers/map_signatures_event_handler.ex b/lib/wanderer_app_web/live/map/event_handlers/map_signatures_event_handler.ex index 86129f63..f1cfb263 100644 --- a/lib/wanderer_app_web/live/map/event_handlers/map_signatures_event_handler.ex +++ b/lib/wanderer_app_web/live/map/event_handlers/map_signatures_event_handler.ex @@ -168,7 +168,7 @@ defmodule WandererAppWeb.MapSignaturesEventHandler do current_user: %{id: current_user_id}, map_id: map_id, main_character_id: main_character_id, - map_user_settings: map_user_settings, + map_user_settings: _map_user_settings, user_permissions: %{update_system: true} } = assigns } = socket @@ -380,7 +380,7 @@ defmodule WandererAppWeb.MapSignaturesEventHandler do def handle_ui_event( "undo_delete_signatures", - %{"system_id" => solar_system_id, "eve_ids" => eve_ids} = payload, + %{"system_id" => solar_system_id, "eve_ids" => eve_ids} = _payload, %{ assigns: %{ map_id: map_id, diff --git a/lib/wanderer_app_web/live/map/event_handlers/map_system_comments_event_handler.ex b/lib/wanderer_app_web/live/map/event_handlers/map_system_comments_event_handler.ex index 2f62715d..8ff03fca 100644 --- a/lib/wanderer_app_web/live/map/event_handlers/map_system_comments_event_handler.ex +++ b/lib/wanderer_app_web/live/map/event_handlers/map_system_comments_event_handler.ex @@ -97,7 +97,7 @@ defmodule WandererAppWeb.MapSystemCommentsEventHandler do %{"solarSystemId" => solar_system_id} = _event, %{ assigns: %{ - current_user: current_user, + current_user: _current_user, has_tracked_characters?: true, map_id: map_id, user_permissions: %{add_system: true} @@ -109,7 +109,7 @@ defmodule WandererAppWeb.MapSystemCommentsEventHandler do solar_system_id: solar_system_id }) |> case do - %{id: system_id} = system when not is_nil(system_id) -> + %{id: system_id} = _system when not is_nil(system_id) -> {:ok, comments} = WandererApp.MapSystemCommentRepo.get_by_system(system_id) {:reply, diff --git a/lib/wanderer_app_web/live/map/map_audit_live.ex b/lib/wanderer_app_web/live/map/map_audit_live.ex index 794a14ce..a39be150 100755 --- a/lib/wanderer_app_web/live/map/map_audit_live.ex +++ b/lib/wanderer_app_web/live/map/map_audit_live.ex @@ -5,8 +5,6 @@ defmodule WandererAppWeb.MapAuditLive do alias WandererAppWeb.UserActivity - @active_subscription_periods ["2M", "3M"] - def mount( %{"slug" => map_slug, "period" => period, "activity" => activity} = _params, _session, diff --git a/lib/wanderer_app_web/live/map/map_characters_live.ex b/lib/wanderer_app_web/live/map/map_characters_live.ex index 4ed38963..f0978396 100755 --- a/lib/wanderer_app_web/live/map/map_characters_live.ex +++ b/lib/wanderer_app_web/live/map/map_characters_live.ex @@ -157,7 +157,7 @@ defmodule WandererAppWeb.MapCharactersLive do |> assign(:groups, groups) end - defp map_ui_character(map_id, character) do + defp map_ui_character(_map_id, character) do character |> Map.take([ :id, diff --git a/lib/wanderer_app_web/live/map/map_event_handler.ex b/lib/wanderer_app_web/live/map/map_event_handler.ex index f6dd9bbc..313164e0 100644 --- a/lib/wanderer_app_web/live/map/map_event_handler.ex +++ b/lib/wanderer_app_web/live/map/map_event_handler.ex @@ -230,6 +230,7 @@ defmodule WandererAppWeb.MapEventHandler do def handle_event(socket, {:DOWN, ref, :process, _pid, reason}) when is_reference(ref) do # Task failed, log the error and update the client Logger.error("Task failed: #{inspect(reason)}") + socket end def handle_event(socket, event), diff --git a/lib/wanderer_app_web/live/map/map_live.ex b/lib/wanderer_app_web/live/map/map_live.ex index 1e7d9639..2be67e50 100644 --- a/lib/wanderer_app_web/live/map/map_live.ex +++ b/lib/wanderer_app_web/live/map/map_live.ex @@ -112,13 +112,6 @@ defmodule WandererAppWeb.MapLive do |> WandererAppWeb.MapEventHandler.handle_event(info)} end - @impl true - def handle_info(info, socket), - do: - {:noreply, - socket - |> WandererAppWeb.MapEventHandler.handle_event(info)} - @impl true def handle_event("change_subscription_tab", %{"tab" => tab}, socket), do: {:noreply, socket |> assign(active_subscription_tab: tab)} diff --git a/lib/wanderer_app_web/live/maps/components/map_balance_component.ex b/lib/wanderer_app_web/live/maps/components/map_balance_component.ex index 4d175212..e399dd2c 100644 --- a/lib/wanderer_app_web/live/maps/components/map_balance_component.ex +++ b/lib/wanderer_app_web/live/maps/components/map_balance_component.ex @@ -5,7 +5,6 @@ defmodule WandererAppWeb.Maps.MapBalanceComponent do require Logger alias BetterNumber, as: Number - alias WandererApp.License.LicenseManager @impl true def mount(socket) do @@ -99,7 +98,7 @@ defmodule WandererAppWeb.Maps.MapBalanceComponent do type: :in }) - {:ok, user} = + {:ok, _user} = user |> WandererApp.Api.User.update_balance(%{ balance: (user_balance || 0.0) - amount diff --git a/lib/wanderer_app_web/live/profile/profile_live.html.heex b/lib/wanderer_app_web/live/profile/profile_live.html.heex index 9c564fc7..e1979f71 100644 --- a/lib/wanderer_app_web/live/profile/profile_live.html.heex +++ b/lib/wanderer_app_web/live/profile/profile_live.html.heex @@ -59,7 +59,7 @@ rows={@transactions} class="!max-h-[40vh] !overflow-y-auto" > - <:col :let={transaction}> + <:col :let={_transaction}>
<.icon name="hero-credit-card-solid" class="h-5 w-5" />
@@ -145,7 +145,7 @@ rows={@invoices} class="!max-h-[40vh] !overflow-y-auto" > - <:col :let={invoice}> + <:col :let={_invoice}>
Map subscription
diff --git a/lib/wanderer_app_web/open_api_v1_spec.ex b/lib/wanderer_app_web/open_api_v1_spec.ex index 106d94ef..f07d4887 100644 --- a/lib/wanderer_app_web/open_api_v1_spec.ex +++ b/lib/wanderer_app_web/open_api_v1_spec.ex @@ -5,8 +5,6 @@ defmodule WandererAppWeb.OpenApiV1Spec do @behaviour OpenApiSpex.OpenApi - alias OpenApiSpex.{OpenApi, Info, Server, Components} - @impl OpenApiSpex.OpenApi def spec do # This is called by the modify_open_api option in the router diff --git a/lib/wanderer_app_web/plugs/request_validator.ex b/lib/wanderer_app_web/plugs/request_validator.ex index 8e7297b5..40a32598 100644 --- a/lib/wanderer_app_web/plugs/request_validator.ex +++ b/lib/wanderer_app_web/plugs/request_validator.ex @@ -220,7 +220,7 @@ defmodule WandererAppWeb.Plugs.RequestValidator do defp validate_params(_params, _max_length, _max_depth, _current_depth), do: :ok - defp validate_param_value(key, value, max_length, max_depth, current_depth) + defp validate_param_value(key, value, max_length, _max_depth, _current_depth) when is_binary(value) do cond do String.length(value) > max_length -> diff --git a/lib/wanderer_app_web/plugs/response_sanitizer.ex b/lib/wanderer_app_web/plugs/response_sanitizer.ex index 7017f340..2e002d64 100644 --- a/lib/wanderer_app_web/plugs/response_sanitizer.ex +++ b/lib/wanderer_app_web/plugs/response_sanitizer.ex @@ -94,7 +94,7 @@ defmodule WandererAppWeb.Plugs.ResponseSanitizer do case Application.get_env(:wanderer_app, :environment) do :dev -> nonce = generate_nonce() - conn = put_private(conn, :csp_nonce, nonce) + _conn = put_private(conn, :csp_nonce, nonce) base_policy |> Enum.map(fn directive -> diff --git a/test/support/api_case.ex b/test/support/api_case.ex index 47dc6f42..3add1784 100644 --- a/test/support/api_case.ex +++ b/test/support/api_case.ex @@ -170,9 +170,7 @@ defmodule WandererAppWeb.ApiCase do |> Plug.Conn.put_req_header("content-type", "application/vnd.api+json") end - @doc """ - Creates an active subscription for a map to bypass subscription checks in tests. - """ + # Creates an active subscription for a map to bypass subscription checks in tests. defp create_active_subscription_for_map(map_id) do # Create a subscription with a non-alpha plan (status defaults to :active) {:ok, _subscription} = diff --git a/test/support/database_access_manager.ex b/test/support/database_access_manager.ex index b272ee5d..30ae6520 100644 --- a/test/support/database_access_manager.ex +++ b/test/support/database_access_manager.ex @@ -91,13 +91,6 @@ defmodule WandererApp.Test.DatabaseAccessManager do end) end - defp setup_child_process_monitoring(parent_pid, owner_pid) do - spawn_link(fn -> - Process.monitor(parent_pid) - monitor_for_new_processes(parent_pid, owner_pid, get_process_children(parent_pid)) - end) - end - defp grant_access_to_linked_processes(pid, owner_pid) do case Process.info(pid, :links) do {:links, links} -> @@ -118,47 +111,6 @@ defmodule WandererApp.Test.DatabaseAccessManager do end end - defp setup_continuous_monitoring(genserver_pid, owner_pid) do - spawn_link(fn -> - Process.monitor(genserver_pid) - continuously_monitor_genserver(genserver_pid, owner_pid) - end) - end - - defp continuously_monitor_genserver(genserver_pid, owner_pid) do - if Process.alive?(genserver_pid) do - # Check for new linked processes - grant_access_to_linked_processes(genserver_pid, owner_pid) - - # Check for new child processes - current_children = get_process_children(genserver_pid) - - Enum.each(current_children, fn child_pid -> - grant_database_access(child_pid, owner_pid) - end) - - # Continue monitoring - :timer.sleep(100) - continuously_monitor_genserver(genserver_pid, owner_pid) - end - end - - defp monitor_for_new_processes(parent_pid, owner_pid, previous_children) do - if Process.alive?(parent_pid) do - current_children = get_process_children(parent_pid) - new_children = current_children -- previous_children - - # Grant access to new child processes - Enum.each(new_children, fn child_pid -> - grant_database_access(child_pid, owner_pid) - end) - - # Continue monitoring - :timer.sleep(50) - monitor_for_new_processes(parent_pid, owner_pid, current_children) - end - end - defp monitor_for_database_access_errors(monitored_pid, owner_pid) do if Process.alive?(monitored_pid) do # Monitor for error messages that indicate database access issues diff --git a/test/support/map_test_helpers.ex b/test/support/map_test_helpers.ex index 98b8dcbd..f9a6c0db 100644 --- a/test/support/map_test_helpers.ex +++ b/test/support/map_test_helpers.ex @@ -83,11 +83,9 @@ defmodule WandererApp.MapTestHelpers do |> Enum.find(&(&1 == :ok)) end - @doc """ - Continuously grants database access to all MapPool processes and their children. - This is necessary when maps are started dynamically during tests. - Uses efficient polling with minimal delays. - """ + # Continuously grants database access to all MapPool processes and their children. + # This is necessary when maps are started dynamically during tests. + # Uses efficient polling with minimal delays. defp grant_database_access_continuously do owner_pid = Process.get(:sandbox_owner_pid) || self() diff --git a/test/support/mocks.ex b/test/support/mocks.ex index 0740a21b..aaa19338 100644 --- a/test/support/mocks.ex +++ b/test/support/mocks.ex @@ -34,11 +34,15 @@ defmodule WandererApp.Test.Mocks do defp setup_default_stubs do # Set up default stubs for logger mock (these methods are called during application startup) - Test.LoggerMock - |> Mox.stub(:info, fn _message -> :ok end) - |> Mox.stub(:warning, fn _message -> :ok end) - |> Mox.stub(:error, fn _message -> :ok end) - |> Mox.stub(:debug, fn _message -> :ok end) + # Support both 1-arity (message only) and 2-arity (message + metadata) versions + Mox.stub(Test.LoggerMock, :info, fn _message -> :ok end) + Mox.stub(Test.LoggerMock, :info, fn _message, _metadata -> :ok end) + Mox.stub(Test.LoggerMock, :warning, fn _message -> :ok end) + Mox.stub(Test.LoggerMock, :warning, fn _message, _metadata -> :ok end) + Mox.stub(Test.LoggerMock, :error, fn _message -> :ok end) + Mox.stub(Test.LoggerMock, :error, fn _message, _metadata -> :ok end) + Mox.stub(Test.LoggerMock, :debug, fn _message -> :ok end) + Mox.stub(Test.LoggerMock, :debug, fn _message, _metadata -> :ok end) # Set up default stubs for PubSub mock Test.PubSubMock diff --git a/test/support/openapi_schema_evolution.ex b/test/support/openapi_schema_evolution.ex index 5fa6e24a..0c59db45 100644 --- a/test/support/openapi_schema_evolution.ex +++ b/test/support/openapi_schema_evolution.ex @@ -8,16 +8,10 @@ defmodule WandererAppWeb.OpenAPISchemaEvolution do # alias WandererAppWeb.OpenAPISpecAnalyzer # Currently unused - @breaking_change_types [ - :removed_endpoint, - :removed_operation, - :removed_required_field, - :removed_enum_value, - :type_narrowing, - :removed_response_code, - :required_field_added, - :parameter_location_changed - ] + # Breaking change types for reference: + # :removed_endpoint, :removed_operation, :removed_required_field, + # :removed_enum_value, :type_narrowing, :removed_response_code, + # :required_field_added, :parameter_location_changed @doc """ Detects breaking changes between two API specifications. diff --git a/test/support/test_optimization.ex b/test/support/test_optimization.ex index ba4f6aa5..ebadbf9d 100644 --- a/test/support/test_optimization.ex +++ b/test/support/test_optimization.ex @@ -12,8 +12,6 @@ defmodule WandererApp.TestOptimization do alias WandererApp.TestOptimization.{ DependencyAnalyzer, - ParallelExecutor, - ResourcePool, TestOrderOptimizer } @@ -327,7 +325,7 @@ defmodule WandererApp.TestOptimization do end) end - defp generate_resource_pools(analysis) do + defp generate_resource_pools(_analysis) do %{ database: %{ size: optimal_worker_count() * 2, @@ -527,7 +525,7 @@ defmodule WandererApp.TestOptimization.ParallelExecutor do end defp setup_resource_pools(pool_configs) do - Enum.each(pool_configs, fn {name, config} -> + Enum.each(pool_configs, fn {_name, _config} -> # In practice, you'd set up actual resource pools here # For example, database connection pools, mock registries, etc. :ok