OptimumCredo.Check.Readability.AssignThree (OptimumCredo v0.5.0)
View SourceBasics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of low and works with any version of Elixir.
Explanation
Use assign(socket, :key, value) in a pipeline, one assign per line, instead of
assign(socket, key: value) or assign(socket, %{key: value}) with a literal.
Calls that forward a variable, such as assign(socket, assigns), are allowed.
Matching is by name and arity only; non-LiveView assign/2 helpers can be
reported too. Opt-in, low priority.
Bad
assign(socket, page: 1, per_page: 20)Good
socket
|> assign(:page, 1)
|> assign(:per_page, 20)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.