Various typespec and compilation improvements

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-09-10 11:27:59 +02:00
parent 029a4ea194
commit de047c8939
125 changed files with 790 additions and 357 deletions

View File

@@ -8,7 +8,7 @@ defmodule Mobilizon.Web.Views.Utils do
import Plug.Conn, only: [put_status: 2, halt: 1]
# sobelow_skip ["Traversal.FileModule"]
@spec inject_tags(Enum.t(), String.t()) :: {:ok, {:safe, String.t()}}
@spec inject_tags(Enum.t(), String.t()) :: {:ok, {:safe, String.t()}} | {:error, atom()}
def inject_tags(tags, locale \\ "en") do
with path <- Path.join(Application.app_dir(:mobilizon, "priv/static"), "index.html"),
{:exists, true} <- {:exists, File.exists?(path)},
@@ -17,6 +17,7 @@ defmodule Mobilizon.Web.Views.Utils do
{:ok, {:safe, safe}}
else
{:exists, false} -> {:error, :index_not_found}
{:error, error} when is_atom(error) -> {:error, error}
end
end