# `LexCredo.Check.Warning.NoTaggedWithClauses`
[🔗](https://github.com/sippy-platform/lex_credo/blob/main/lib/lex_credo/check/warning/no_tagged_with_clauses.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 `high` and works with any version of Elixir.

## Explanation

Do not use tagged-tuple workarounds in `with` clauses to identify which
clause failed in the `else` block.

If you need to distinguish between different failure sources, use `case`
instead. If you do not need to distinguish, normalise error return types
in small private helper functions.

    # BAD — tags exist only to tell apart which step failed
    with {:user, {:ok, user}} <- {:user, fetch_user(id)},
         {:post, {:ok, post}} <- {:post, fetch_post(user)} do
      {:ok, post}
    else
      {:user, {:error, reason}} -> {:error, {:user, reason}}
      {:post, {:error, reason}} -> {:error, {:post, reason}}
    end

    # GOOD — each function returns a distinct error atom,
    # so the step that failed is clear without wrapping tuples
    with {:ok, user} <- fetch_user(id),
         {:ok, post} <- fetch_post(user) do
      {:ok, post}
    else
      {:error, :user_not_found} = err -> err
      {:error, :post_not_found} = err -> err
    end

## Check-Specific Parameters

Use the following parameters to configure this check:

### `:exclude_test_files`

  When `true`, skips test files. Default: `false`.

*This parameter defaults to* `false`.

## 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*
