Skip to content

Commit 5aa4f01

Browse files
committed
chore: Satisfy Credo consistency check
1 parent c6c76f0 commit 5aa4f01

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

lib/ex_machina/ecto.ex

+6-6
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ defmodule ExMachina.Ecto do
211211
|> convert_atom_keys_to_strings
212212
end
213213

214-
defp recursively_strip(record = %{__struct__: _}) do
214+
defp recursively_strip(%{__struct__: _} = record) do
215215
record
216216
|> set_persisted_belongs_to_ids
217217
|> handle_assocs
@@ -222,7 +222,7 @@ defmodule ExMachina.Ecto do
222222

223223
defp recursively_strip(record), do: record
224224

225-
defp handle_assocs(record = %{__struct__: struct}) do
225+
defp handle_assocs(%{__struct__: struct} = record) do
226226
Enum.reduce(struct.__schema__(:associations), record, fn association_name, record ->
227227
case struct.__schema__(:association, association_name) do
228228
%{__struct__: Ecto.Association.BelongsTo} ->
@@ -254,7 +254,7 @@ defmodule ExMachina.Ecto do
254254
end
255255
end
256256

257-
defp handle_embeds(record = %{__struct__: struct}) do
257+
defp handle_embeds(%{__struct__: struct} = record) do
258258
Enum.reduce(struct.__schema__(:embeds), record, fn embed_name, record ->
259259
record
260260
|> Map.get(embed_name)
@@ -277,7 +277,7 @@ defmodule ExMachina.Ecto do
277277
end
278278
end
279279

280-
defp set_persisted_belongs_to_ids(record = %{__struct__: struct}) do
280+
defp set_persisted_belongs_to_ids(%{__struct__: struct} = record) do
281281
Enum.reduce(struct.__schema__(:associations), record, fn association_name, record ->
282282
association = struct.__schema__(:association, association_name)
283283

@@ -302,7 +302,7 @@ defmodule ExMachina.Ecto do
302302
Map.put(record, association.owner_key, primary_key)
303303
end
304304

305-
defp insert_belongs_to_assocs(record = %{__struct__: struct}, module) do
305+
defp insert_belongs_to_assocs(%{__struct__: struct} = record, module) do
306306
Enum.reduce(struct.__schema__(:associations), record, fn association_name, record ->
307307
case struct.__schema__(:association, association_name) do
308308
association = %{__struct__: Ecto.Association.BelongsTo} ->
@@ -326,7 +326,7 @@ defmodule ExMachina.Ecto do
326326
end
327327

328328
@doc false
329-
def drop_ecto_fields(record = %{__struct__: struct}) do
329+
def drop_ecto_fields(%{__struct__: struct} = record) do
330330
record
331331
|> Map.from_struct()
332332
|> Map.delete(:__meta__)

mix.exs

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ defmodule ExMachina.Mixfile do
3636
{:ecto_sql, "~> 3.0", optional: true},
3737

3838
# Dev and Test dependencies
39-
{:credo, "~> 1.6", only: :test, runtime: false},
39+
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
4040
{:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false},
4141
{:doctor, "~> 0.21.0", only: [:dev, :test], runtime: false},
4242
{:excoveralls, "~> 0.17.1", only: :test},
4343
{:ex_doc, "~> 0.28", only: [:dev, :test], runtime: false},
44-
{:jason, "~> 1.0", only: :test},
4544
{:postgrex, "~> 0.17", only: :test}
4645
]
4746
end

mix.lock

+3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
%{
2+
"benchee": {:hex, :benchee, "1.3.0", "f64e3b64ad3563fa9838146ddefb2d2f94cf5b473bdfd63f5ca4d0657bf96694", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "34f4294068c11b2bd2ebf2c59aac9c7da26ffa0068afdf3419f1b176e16c5f81"},
23
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
34
"credo": {:hex, :credo, "1.7.3", "05bb11eaf2f2b8db370ecaa6a6bda2ec49b2acd5e0418bc106b73b07128c0436", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "35ea675a094c934c22fb1dca3696f3c31f2728ae6ef5a53b5d648c11180a4535"},
45
"db_connection": {:hex, :db_connection, "2.6.0", "77d835c472b5b67fc4f29556dee74bf511bbafecdcaf98c27d27fa5918152086", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c2f992d15725e721ec7fbc1189d4ecdb8afef76648c746a8e1cad35e3b8a35f3"},
56
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
7+
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
68
"dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"},
79
"doctor": {:hex, :doctor, "0.21.0", "20ef89355c67778e206225fe74913e96141c4d001cb04efdeba1a2a9704f1ab5", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "a227831daa79784eb24cdeedfa403c46a4cb7d0eab0e31232ec654314447e4e0"},
810
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
@@ -18,5 +20,6 @@
1820
"makeup_erlang": {:hex, :makeup_erlang, "0.1.3", "d684f4bac8690e70b06eb52dad65d26de2eefa44cd19d64a8095e1417df7c8fd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "b78dc853d2e670ff6390b605d807263bf606da3c82be37f9d7f68635bd886fc9"},
1921
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
2022
"postgrex": {:hex, :postgrex, "0.17.4", "5777781f80f53b7c431a001c8dad83ee167bcebcf3a793e3906efff680ab62b3", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "6458f7d5b70652bc81c3ea759f91736c16a31be000f306d3c64bcdfe9a18b3cc"},
23+
"statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"},
2124
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
2225
}

0 commit comments

Comments
 (0)