Basics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of normal and works with any version of Elixir.
Explanation
Enum.reduce(%{}, fn x, acc -> Map.put(acc, key, value) end) is
Map.new/2 (or a for comprehension).
# bad — verbose reduce to build a map
Enum.reduce(batch, %{}, fn event, acc ->
Map.put(acc, event.id, event)
end)
# good — use Map.new
Map.new(batch, fn event -> {event.id, event} end)
# good — for comprehension
for event <- batch, into: %{}, do: {event.id, event}Check-Specific Parameters
There are no specific parameters for this check.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.