# `Mailglass.Credo.NoUnscopedTenantQueryInLib`
[🔗](https://github.com/szTheory/mailglass/blob/v2.7.0/credo_checks/no_unscoped_tenant_query_in_lib.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

Repo queries touching tenanted mailglass schemas must be scoped through
`Mailglass.Tenancy.scope/2` unless explicitly marked with `scope: :unscoped`.

## Check-Specific Parameters

Use the following parameters to configure this check:

### `:tenanted_schemas`

  Schemas treated as tenant-scoped resources.

*This parameter defaults to* `[Mailglass.Outbound.Delivery, Mailglass.Events.Event, Mailglass.Suppression.Entry, Mailglass.Webhook.WebhookEvent]`.

### `:included_path_prefixes`

  Only files in these path prefixes are linted.

*This parameter defaults to* `["lib/mailglass/"]`.

### `:repo_functions`

  Repo functions treated as query entry points.

*This parameter defaults to* `[:all, :one, :get, :get!, :get_by, :get_by!]`.

### `:scope_module`

  Module that provides `scope/2`.

*This parameter defaults to* `Mailglass.Tenancy`.

### `:unscoped_audit_helpers`

  Remote helper calls that satisfy the `scope: :unscoped` telemetry audit requirement.

*This parameter defaults to* `[{Mailglass.Tenancy, :audit_unscoped_bypass}]`.

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