Fix new credo warnings

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-11-26 14:30:46 +01:00
parent 52e624bb88
commit 51afec1856
20 changed files with 77 additions and 72 deletions

View File

@@ -39,9 +39,7 @@ defmodule Mobilizon.Federation.WebFinger.XmlBuilder do
defp to_xml(content) when is_binary(content), do: to_string(content)
defp to_xml(content) when is_list(content) do
content
|> Enum.map(&to_xml/1)
|> Enum.join()
Enum.map_join(content, &to_xml/1)
end
defp to_xml(%NaiveDateTime{} = time), do: NaiveDateTime.to_iso8601(time)
@@ -49,9 +47,7 @@ defmodule Mobilizon.Federation.WebFinger.XmlBuilder do
@spec make_open_tag(tag :: atom, attributes :: map()) :: String.t()
defp make_open_tag(tag, attributes) do
attributes_string =
attributes
|> Enum.map(fn {attribute, value} -> "#{attribute}=\"#{value}\"" end)
|> Enum.join(" ")
Enum.map_join(attributes, " ", fn {attribute, value} -> "#{attribute}=\"#{value}\"" end)
[to_string(tag), attributes_string] |> Enum.join(" ") |> String.trim()
end