diff --git a/lib/application.ex b/lib/application.ex index 1c8e812..8c4f207 100644 --- a/lib/application.ex +++ b/lib/application.ex @@ -28,7 +28,7 @@ defmodule M51.Application do @impl true def start(_type, args) do if Enum.member?(System.argv(), "--debug") do - Logger.warn("Starting in debug mode") + Logger.warning("Starting in debug mode") Logger.configure(level: :debug) else Logger.configure(level: :info) diff --git a/lib/format/common.ex b/lib/format/common.ex index 600588c..ff9d359 100644 --- a/lib/format/common.ex +++ b/lib/format/common.ex @@ -112,9 +112,9 @@ defmodule M51.Format do |> :mochiweb_html.to_html() |> IO.iodata_to_binary() - html = Regex.replace(~R((.*\)), html, fn _, content -> content end) + html = Regex.replace(~r((.*\)), html, fn _, content -> content end) # more compact - html = Regex.replace(~R(
), html, fn _ -> "
" end) + html = Regex.replace(~r(
), html, fn _ -> "
" end) {plain_text, html} end diff --git a/lib/format/irc2matrix.ex b/lib/format/irc2matrix.ex index a07d753..b81236b 100644 --- a/lib/format/irc2matrix.ex +++ b/lib/format/irc2matrix.ex @@ -238,7 +238,7 @@ defmodule M51.Format.Irc2Matrix do def tokenize(text) do text |> String.to_charlist() - |> do_tokenize(['']) + |> do_tokenize([~c""]) |> Enum.reverse() |> Stream.map(fn token -> token |> Enum.reverse() |> to_string() end) end @@ -249,7 +249,7 @@ defmodule M51.Format.Irc2Matrix do defp do_tokenize([c | tail], acc) when <> in @chars do # new token - do_tokenize(tail, ['' | [[c] | acc]]) + do_tokenize(tail, [~c"" | [[c] | acc]]) end defp do_tokenize([0x03 | tail], acc) do @@ -287,7 +287,7 @@ defmodule M51.Format.Irc2Matrix do {tail, []} end - do_tokenize(tail, ['' | [Enum.reverse([0x03 | normalized_color]) | acc]]) + do_tokenize(tail, [~c"" | [Enum.reverse([0x03 | normalized_color]) | acc]]) end defp do_tokenize([0x04 | tail], acc) do @@ -314,7 +314,7 @@ defmodule M51.Format.Irc2Matrix do {tail, []} end - do_tokenize(tail, ['' | [Enum.reverse([0x04 | normalized_color]) | acc]]) + do_tokenize(tail, [~c"" | [Enum.reverse([0x04 | normalized_color]) | acc]]) end defp do_tokenize([c | tail], [head | acc]) do diff --git a/lib/irc/handler.ex b/lib/irc/handler.ex index 42e4a60..faeb7c6 100644 --- a/lib/irc/handler.ex +++ b/lib/irc/handler.ex @@ -446,8 +446,8 @@ defmodule M51.IrcConn.Handler do # this was only meant to be used with Pantalaimon proxy = case Regex.named_captures( - ~R((plaintextproxy|homeserver-url\)=(?https?://\S*\)), - M51.IrcConn.State.gecos(state) || "" + ~r((plaintextproxy|homeserver-url\)=(?https?://\S*\)), + M51.IrcConn.State.gecos(state) || "" ) do nil -> nil %{"url" => url} -> url diff --git a/lib/matrix_client/client.ex b/lib/matrix_client/client.ex index 5b495bc..9689bbf 100644 --- a/lib/matrix_client/client.ex +++ b/lib/matrix_client/client.ex @@ -525,7 +525,7 @@ defmodule M51.MatrixClient.Client do # The next call will probably fail, but this spares error handling in this one. base_url = "https://" <> hostname - Logger.warn( + Logger.warning( "Well-known request for #{wellknown_url} returned #{Kernel.inspect(res)}. " <> "Falling back to #{base_url}" ) @@ -536,7 +536,7 @@ defmodule M51.MatrixClient.Client do # Treat this in the same way as HTTP error codes above - perm error and fallback base_url = "https://" <> hostname - Logger.warn( + Logger.warning( "Well-known request for #{wellknown_url} failed" <> " with connection error [#{err}]. Falling back to #{base_url}" ) diff --git a/lib/matrix_client/poller.ex b/lib/matrix_client/poller.ex index 6d137ac..985e8af 100644 --- a/lib/matrix_client/poller.ex +++ b/lib/matrix_client/poller.ex @@ -88,7 +88,7 @@ defmodule M51.MatrixClient.Poller do delay = if delay do - Logger.warn( + Logger.warning( "Server connection error [#{reconnect_reason}], retrying after #{round(delay / 1000)}s" ) diff --git a/lib/matrix_client/sender.ex b/lib/matrix_client/sender.ex index 5f785eb..dd70c77 100644 --- a/lib/matrix_client/sender.ex +++ b/lib/matrix_client/sender.ex @@ -70,7 +70,7 @@ defmodule M51.MatrixClient.Sender do {:error, _status_code, reason} -> if nb_attempts < @max_attempts do - Logger.warn("Error while sending event, retrying: #{Kernel.inspect(reason)}") + Logger.warning("Error while sending event, retrying: #{Kernel.inspect(reason)}") backoff_delay = :math.pow(2, nb_attempts) Process.sleep(round(backoff_delay * 1000)) @@ -83,7 +83,7 @@ defmodule M51.MatrixClient.Sender do nb_attempts + 1 ) else - Logger.warn("Error while sending event, giving up: #{Kernel.inspect(reason)}") + Logger.warning("Error while sending event, giving up: #{Kernel.inspect(reason)}") state = M51.IrcConn.Supervisor.matrix_state(sup_pid) channel = M51.MatrixClient.State.room_irc_channel(state, room_id) diff --git a/test/matrix_client/client_test.exs b/test/matrix_client/client_test.exs index fc5546d..d6fe9b7 100644 --- a/test/matrix_client/client_test.exs +++ b/test/matrix_client/client_test.exs @@ -188,7 +188,8 @@ defmodule M51.MatrixClient.ClientTest do client = start_supervised!({M51.MatrixClient.Client, {sup_pid, [httpoison: MockHTTPoison]}}) - assert GenServer.call(client, {:connect, "user", "matrix.example.org", "p4ssw0rd", nil}) == {:ok} + assert GenServer.call(client, {:connect, "user", "matrix.example.org", "p4ssw0rd", nil}) == + {:ok} assert GenServer.call(client, {:dump_state}) == %M51.MatrixClient.Client{ @@ -274,7 +275,8 @@ defmodule M51.MatrixClient.ClientTest do client = start_supervised!({M51.MatrixClient.Client, {sup_pid, [httpoison: MockHTTPoison]}}) - assert GenServer.call(client, {:connect, "user", "matrix.example.org", "p4ssw0rd", nil}) == {:ok} + assert GenServer.call(client, {:connect, "user", "matrix.example.org", "p4ssw0rd", nil}) == + {:ok} assert GenServer.call(client, {:dump_state}) == %M51.MatrixClient.Client{