# `Bylaw.Credo.Check.PhoenixLiveView.NoInlineAssignInReturnTuple`
[🔗](https://github.com/ryanzidago/bylaw/blob/v0.1.0-alpha.1/lib/bylaw/credo/check/phoenix_live_view/no_inline_assign_in_return_tuple.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) via `.credo.exs`.

This check has a base priority of `higher` and works with any version of Elixir.

## Explanation

Extract LiveView `assign/2,3` and `assign_new/3` calls before returning
the socket tuple.

## Examples

Avoid:

      {:noreply, assign(socket, :user, user)}

      {:ok, socket |> assign(:user, user)}

Prefer:

      socket = assign(socket, :user, user)
      {:noreply, socket}

## Notes

Inline assignment hides the socket transformation inside the return value.
That makes it harder to add more socket changes, inspect intermediate
values, or keep return tuples visually consistent.

Keep socket updates in normal expressions and reserve `{:ok, socket}`,
`{:noreply, socket}`, and `{:reply, reply, socket}` for returning the
final socket.

This check uses static AST analysis, so it favors clear source-level patterns over runtime behavior.

## Options

This check has no check-specific options. Configure it with an empty option list.

## Usage

Add this check to Credo's `checks:` list in `.credo.exs`:

```elixir
%{
  configs: [
    %{
      name: "default",
      checks: [
        {Bylaw.Credo.Check.PhoenixLiveView.NoInlineAssignInReturnTuple, []}
      ]
    }
  ]
}
```

## Check-Specific Parameters

*There are no specific parameters for this check.*

## General Parameters

Like with all checks, [general params](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
