fix credo

This commit is contained in:
2022-03-28 23:05:12 -04:00
parent 34288a0070
commit a2d1ff9b89
27 changed files with 67 additions and 64 deletions

View File

@ -25,6 +25,7 @@ defmodule CanneryWeb.ConnCase do
# Import conveniences for testing with connections
import Plug.Conn
import Phoenix.ConnTest
# credo:disable-for-next-line Credo.Check.Consistency.MultiAliasImportRequireUse
import Cannery.Fixtures
import CanneryWeb.ConnCase

View File

@ -22,10 +22,8 @@ defmodule Cannery.DataCase do
alias Cannery.Repo
import Ecto
import Ecto.Changeset
import Ecto.Query
import Cannery.DataCase
import Cannery.Fixtures
import Ecto.{Changeset, Query}
import Cannery.{DataCase, Fixtures}
end
end
@ -45,7 +43,7 @@ defmodule Cannery.DataCase do
"""
def errors_on(changeset) do
Ecto.Changeset.traverse_errors(changeset, fn {message, opts} ->
Regex.replace(~r"%{(\w+)}", message, fn _, key ->
Regex.replace(~r"%{(\w+)}", message, fn _content, key ->
opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string()
end)
end)