diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index 72a1857f9..47c9224f9 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -87,6 +87,11 @@ jobs: - name: Install dependencies run: mix deps.get + # Step: Compile the current project. If unchanged, uses + # the cached version. + - name: Install dependencies + run: mix compile + # Step: Execute the tests. - name: Run tests run: mix test diff --git a/lib/teiserver/account/servers/client_server.ex b/lib/teiserver/account/servers/client_server.ex index 5855858b8..b5bb0d29b 100644 --- a/lib/teiserver/account/servers/client_server.ex +++ b/lib/teiserver/account/servers/client_server.ex @@ -114,7 +114,7 @@ defmodule Teiserver.Account.ClientServer do end def handle_cast({:merge_update_client, partial_client}, state) do - Logger.warn(":merge_update_client is still being used, instead use :update_values") + Logger.warning(":merge_update_client is still being used, instead use :update_values") new_client = Map.merge(state.client, partial_client) PubSub.broadcast( diff --git a/lib/teiserver/battle/servers/match_monitor_server.ex b/lib/teiserver/battle/servers/match_monitor_server.ex index 770534678..91a0c2508 100644 --- a/lib/teiserver/battle/servers/match_monitor_server.ex +++ b/lib/teiserver/battle/servers/match_monitor_server.ex @@ -155,10 +155,10 @@ defmodule Teiserver.Battle.MatchMonitorServer do Telemetry.log_simple_match_event(userid, match_id, event_type_name, game_time) Logger.info("match-event: Stored <#{username}> <#{event_type_name}> <#{game_time}> userid #{userid} match_id #{match_id}") else - Logger.warn("match-event: Cannot get match_id of userid of #{username}") + Logger.warning("match-event: Cannot get match_id of userid of #{username}") end else - Logger.warn("match-event: Cannot get userid of #{username} or is not a bot") + Logger.warning("match-event: Cannot get userid of #{username} or is not a bot") end _ -> @@ -242,7 +242,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do end _ -> - Logger.warn("match-chat nomatch from: #{from_id}: match-chat #{data}") + Logger.warning("match-chat nomatch from: #{from_id}: match-chat #{data}") end {:noreply, state} @@ -288,7 +288,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do end _ -> - Logger.warn("match-chat-name nomatch from: #{from_id}: match-chat [[#{data}]]") + Logger.warning("match-chat-name nomatch from: #{from_id}: match-chat [[#{data}]]") end {:noreply, state} @@ -311,15 +311,15 @@ defmodule Teiserver.Battle.MatchMonitorServer do handle_json_msg(data, from_id) _ -> - Logger.warn("AHM DM no catch, no json-decode - '#{contents_string}'") + Logger.warning("AHM DM no catch, no json-decode - '#{contents_string}'") end _ -> - Logger.warn("AHM DM no catch, no decompress - '#{compressed_contents}'") + Logger.warning("AHM DM no catch, no decompress - '#{compressed_contents}'") end _ -> - Logger.warn("AHM DM no catch, no base64 - '#{message}'") + Logger.warning("AHM DM no catch, no base64 - '#{message}'") end {:noreply, state} @@ -327,7 +327,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do # Catchall handle_info def handle_info(msg, state) do - Logger.warn( + Logger.warning( "Match monitor Server handle_info error. No handler for msg of #{Kernel.inspect(msg)}" ) @@ -337,7 +337,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do defp handle_json_msg(%{"username" => username, "GPU" => _} = contents, from_id) do case CacheUser.get_user_by_name(username) do nil -> - Logger.warn("No username on handle_json_msg: #{username} - #{Kernel.inspect(contents)}") + Logger.warning("No username on handle_json_msg: #{username} - #{Kernel.inspect(contents)}") :ok @@ -367,7 +367,7 @@ defmodule Teiserver.Battle.MatchMonitorServer do end defp handle_json_msg(contents, _from_id) do - Logger.warn("No catch on handle_json_msg: #{Kernel.inspect(contents)}") + Logger.warning("No catch on handle_json_msg: #{Kernel.inspect(contents)}") :ok end diff --git a/lib/teiserver/benchmark/stats_client.ex b/lib/teiserver/benchmark/stats_client.ex index 6a2c88a95..8c78a49c9 100644 --- a/lib/teiserver/benchmark/stats_client.ex +++ b/lib/teiserver/benchmark/stats_client.ex @@ -43,7 +43,7 @@ Avg ping: #{round(average_ping * 100) / 100}ms, Pings: #{Enum.count(state.pings) port: port }) - Logger.warn("Starting stats") + Logger.warning("Starting stats") :timer.send_interval(@registration_interval, self(), :register) send(self(), :register) diff --git a/lib/teiserver/bridge/command_lib.ex b/lib/teiserver/bridge/command_lib.ex index 8034bc149..7332d0333 100644 --- a/lib/teiserver/bridge/command_lib.ex +++ b/lib/teiserver/bridge/command_lib.ex @@ -2,7 +2,6 @@ defmodule Teiserver.Bridge.CommandLib do @moduledoc """ """ - alias Teiserver.Data.Types, as: T require Logger @spec handle_command(Nostrum.Struct.Interaction.t(), map()) :: map() diff --git a/lib/teiserver/bridge/message_commands.ex b/lib/teiserver/bridge/message_commands.ex index a6a21dda2..d0734d28c 100644 --- a/lib/teiserver/bridge/message_commands.ex +++ b/lib/teiserver/bridge/message_commands.ex @@ -17,7 +17,7 @@ defmodule Teiserver.Bridge.MessageCommands do content: "$" <> content, attachments: [] }) do - Logger.warn("1") + Logger.warning("1") [cmd | remaining] = String.split(content, " ") remaining = Enum.join(remaining, " ") @@ -45,7 +45,7 @@ defmodule Teiserver.Bridge.MessageCommands do end def handle(_msg) do - # Logger.warn("2") + # Logger.warning("2") # IO.inspect msg :ok diff --git a/lib/teiserver/coordinator/consul_server.ex b/lib/teiserver/coordinator/consul_server.ex index 83082f448..3567cf309 100644 --- a/lib/teiserver/coordinator/consul_server.ex +++ b/lib/teiserver/coordinator/consul_server.ex @@ -666,7 +666,7 @@ defmodule Teiserver.Coordinator.ConsulServer do # if existing.ready == false and new_client.ready == true and existing.unready_at != nil do # time_elapsed = System.system_time(:millisecond) - existing.unready_at # if time_elapsed < 1000 do - # Logger.warn("Ready up in #{time_elapsed}ms by #{existing.userid}/#{existing.name} using #{existing.lobby_client}") + # Logger.warning("Ready up in #{time_elapsed}ms by #{existing.userid}/#{existing.name} using #{existing.lobby_client}") # end # end @@ -695,7 +695,7 @@ defmodule Teiserver.Coordinator.ConsulServer do if player_count > 4 do if user.hw_hash == nil do - Logger.warn("hw hash block for #{Account.get_username(userid)}") + Logger.warning("hw hash block for #{Account.get_username(userid)}") %{new_client | player: false} else new_client diff --git a/lib/teiserver/helpers/oban_logger.ex b/lib/teiserver/helpers/oban_logger.ex index a5ddf5135..5c2af9cff 100644 --- a/lib/teiserver/helpers/oban_logger.ex +++ b/lib/teiserver/helpers/oban_logger.ex @@ -3,7 +3,7 @@ defmodule Teiserver.Helper.ObanLogger do require Logger def handle_event([:oban, :job, :start], _measure, _meta, _) do - # Logger.warn("[Oban] :started #{meta.worker} at #{measure.system_time}") + # Logger.warning("[Oban] :started #{meta.worker} at #{measure.system_time}") end def handle_event([:oban, :job, :exception], _measure, meta, _) do diff --git a/lib/teiserver/lobby/libs/lobby_lib.ex b/lib/teiserver/lobby/libs/lobby_lib.ex index dfcbd4089..130699009 100644 --- a/lib/teiserver/lobby/libs/lobby_lib.ex +++ b/lib/teiserver/lobby/libs/lobby_lib.ex @@ -199,14 +199,14 @@ defmodule Teiserver.Lobby.LobbyLib do @spec update_lobby(T.lobby(), nil | atom, any) :: T.lobby() def update_lobby(%{id: lobby_id} = lobby, nil, :silent) do - Logger.warn("update_lobby is still being called for :silent") + Logger.warning("update_lobby is still being called for :silent") cast_lobby(lobby_id, {:update_lobby, lobby}) lobby end def update_lobby(%{id: lobby_id} = lobby, nil, reason) do - Logger.warn("update_lobby (no data) is still being called, reason: #{reason}") + Logger.warning("update_lobby (no data) is still being called, reason: #{reason}") cast_lobby(lobby_id, {:update_lobby, lobby}) PubSub.broadcast( @@ -224,7 +224,7 @@ defmodule Teiserver.Lobby.LobbyLib do end def update_lobby(%{id: lobby_id} = lobby, data, reason) do - Logger.warn("update_lobby (with data) is still being called, reason: #{reason}") + Logger.warning("update_lobby (with data) is still being called, reason: #{reason}") cast_lobby(lobby_id, {:update_lobby, lobby}) if Enum.member?([:update_battle_info], reason) do diff --git a/lib/teiserver/protocols/spring/spring_in.ex b/lib/teiserver/protocols/spring/spring_in.ex index 3778da519..060d6d26a 100644 --- a/lib/teiserver/protocols/spring/spring_in.ex +++ b/lib/teiserver/protocols/spring/spring_in.ex @@ -1408,11 +1408,11 @@ defmodule Teiserver.Protocols.SpringIn do cond do Enum.count(status_timestamps) > 10 -> - Logger.warn("status_flood_protection:10 - #{state.username}/#{state.userid}") + Logger.warning("status_flood_protection:10 - #{state.username}/#{state.userid}") {true, %{state | status_timestamps: status_timestamps}} Enum.count(recent_timestamps) > 3 -> - Logger.warn("status_flood_protection:3 - #{state.username}/#{state.userid}") + Logger.warning("status_flood_protection:3 - #{state.username}/#{state.userid}") {true, %{state | status_timestamps: status_timestamps}} true -> diff --git a/lib/teiserver/protocols/spring/spring_out.ex b/lib/teiserver/protocols/spring/spring_out.ex index 4989f8c11..ec08fe695 100644 --- a/lib/teiserver/protocols/spring/spring_out.ex +++ b/lib/teiserver/protocols/spring/spring_out.ex @@ -855,7 +855,7 @@ defmodule Teiserver.Protocols.SpringOut do # I've made the mistake of forgetting it and wondering # why stuff wasn't working so it's staying here if not String.ends_with?(msg, "\n") do - Logger.warn("Attempting to send message without newline at the end - #{msg}") + Logger.warning("Attempting to send message without newline at the end - #{msg}") end msg = diff --git a/lib/teiserver/protocols/spring/spring_system_in.ex b/lib/teiserver/protocols/spring/spring_system_in.ex index be7c41230..c83271e6e 100644 --- a/lib/teiserver/protocols/spring/spring_system_in.ex +++ b/lib/teiserver/protocols/spring/spring_system_in.ex @@ -1,9 +1,7 @@ defmodule Teiserver.Protocols.Spring.SystemIn do @moduledoc false - alias Teiserver.Account.LoginThrottleServer alias Teiserver.Protocols.SpringIn - import Teiserver.Protocols.SpringOut, only: [reply: 5] require Logger @spec do_handle(String.t(), String.t(), String.t() | nil, Map.t()) :: Map.t() diff --git a/lib/teiserver/protocols/spring/spring_telemetry_in.ex b/lib/teiserver/protocols/spring/spring_telemetry_in.ex index 798710551..63e7ca3e7 100644 --- a/lib/teiserver/protocols/spring/spring_telemetry_in.ex +++ b/lib/teiserver/protocols/spring/spring_telemetry_in.ex @@ -156,12 +156,13 @@ defmodule Teiserver.Protocols.Spring.TelemetryIn do defp do_live_client_event(data, state) do if String.length(data) < 1024 do case Regex.run(~r/(\S+) (\S+)/u, data) do - [_, event_name, value64] -> + [_, _event_name, value64] -> case Spring.decode_value(value64) do - {:ok, value} -> + {:ok, _value} -> if state.userid do # TODO: Do stuff with live client events # Telemetry.log_live_client_event(state.userid, event_name, value) + # for now, they're prefixed with underscores to silence warnings :ok end diff --git a/lib/teiserver/protocols/tachyon_lib.ex b/lib/teiserver/protocols/tachyon_lib.ex index a6b3b77d7..3ef48e818 100644 --- a/lib/teiserver/protocols/tachyon_lib.ex +++ b/lib/teiserver/protocols/tachyon_lib.ex @@ -56,11 +56,11 @@ defmodule Teiserver.Protocols.TachyonLib do :error -> # Previously got an error with data 'OK cmd=TACHYON' which suggests # it was still in Spring mode - Logger.warn("Base64 error, given '#{data}'") + Logger.warning("Base64 error, given '#{data}'") {:error, :base64_decode} {:error, :gzip_decompress} -> - Logger.warn("Gzip error, given '#{data}'") + Logger.warning("Gzip error, given '#{data}'") {:error, :gzip_decompress} {:error, %Jason.DecodeError{}} -> diff --git a/lib/teiserver/protocols/tachyon_v1/communication_out.ex b/lib/teiserver/protocols/tachyon_v1/communication_out.ex index 533e1afe8..9b9e7fb4a 100644 --- a/lib/teiserver/protocols/tachyon_v1/communication_out.ex +++ b/lib/teiserver/protocols/tachyon_v1/communication_out.ex @@ -7,7 +7,7 @@ defmodule Teiserver.Protocols.Tachyon.V1.CommunicationOut do ########### # Direct messages def do_reply(:direct_message, {sender_id, msg}) do - Logger.warn( + Logger.warning( "Using :direct_message instead of :received_direct_message in V1.CommunicationOut" ) diff --git a/lib/teiserver/protocols/tachyon_v1/tachyon_out.ex b/lib/teiserver/protocols/tachyon_v1/tachyon_out.ex index 62765c7be..5f709c6ec 100644 --- a/lib/teiserver/protocols/tachyon_v1/tachyon_out.ex +++ b/lib/teiserver/protocols/tachyon_v1/tachyon_out.ex @@ -43,7 +43,7 @@ defmodule Teiserver.Protocols.Tachyon.V1.TachyonOut do LobbyOut.do_reply(reply_cmd, data) :battle -> - Logger.warn("Tachyon :battle namespace message #{reply_cmd}") + Logger.warning("Tachyon :battle namespace message #{reply_cmd}") LobbyOut.do_reply(reply_cmd, data) :matchmaking -> diff --git a/lib/teiserver_web/live/battles/lobbies/chat.ex b/lib/teiserver_web/live/battles/lobbies/chat.ex index 00a6e33c8..e60d5b216 100644 --- a/lib/teiserver_web/live/battles/lobbies/chat.ex +++ b/lib/teiserver_web/live/battles/lobbies/chat.ex @@ -245,7 +245,7 @@ defmodule TeiserverWeb.Battle.LobbyLive.Chat do end def handle_info(msg, socket) do - Logger.warn("No handler in #{__MODULE__} for message #{Kernel.inspect(msg)}") + Logger.warning("No handler in #{__MODULE__} for message #{Kernel.inspect(msg)}") {:noreply, socket} end diff --git a/lib/teiserver_web/live/microblog/admin/post/show.ex b/lib/teiserver_web/live/microblog/admin/post/show.ex index 46e0ec5fc..c98e3a7ed 100644 --- a/lib/teiserver_web/live/microblog/admin/post/show.ex +++ b/lib/teiserver_web/live/microblog/admin/post/show.ex @@ -2,7 +2,6 @@ defmodule TeiserverWeb.Microblog.Admin.PostLive.Show do @moduledoc false use TeiserverWeb, :live_view alias Teiserver.Microblog - import TeiserverWeb.MicroblogComponents @impl true def mount(_params, _session, socket) do diff --git a/lib/teiserver_web/live/microblog/admin/tag/index.ex b/lib/teiserver_web/live/microblog/admin/tag/index.ex index 965fca837..3557d46f7 100644 --- a/lib/teiserver_web/live/microblog/admin/tag/index.ex +++ b/lib/teiserver_web/live/microblog/admin/tag/index.ex @@ -2,7 +2,6 @@ defmodule TeiserverWeb.Microblog.Admin.TagLive.Index do @moduledoc false use TeiserverWeb, :live_view alias Teiserver.Microblog - import TeiserverWeb.MicroblogComponents @impl true def mount(_params, _session, socket) do diff --git a/lib/teiserver_web/live/microblog/admin/tag/show.ex b/lib/teiserver_web/live/microblog/admin/tag/show.ex index 54a0540bc..1f8ca4359 100644 --- a/lib/teiserver_web/live/microblog/admin/tag/show.ex +++ b/lib/teiserver_web/live/microblog/admin/tag/show.ex @@ -2,7 +2,6 @@ defmodule TeiserverWeb.Microblog.Admin.TagLive.Show do @moduledoc false use TeiserverWeb, :live_view alias Teiserver.Microblog - import TeiserverWeb.MicroblogComponents @impl true def mount(_params, _session, socket) do diff --git a/lib/teiserver_web/live/queues/index.ex b/lib/teiserver_web/live/queues/index.ex index 9a290bbe8..acee0803e 100644 --- a/lib/teiserver_web/live/queues/index.ex +++ b/lib/teiserver_web/live/queues/index.ex @@ -207,7 +207,7 @@ defmodule TeiserverWeb.Matchmaking.QueueLive.Index do } = data, socket ) do - Logger.warn("index.ex Match ready") + Logger.warning("index.ex Match ready") {:noreply, socket